From eb67697d81ed12cd022e17e2559b0d7e930653b8 Mon Sep 17 00:00:00 2001 From: scttgs0 Date: Sun, 28 Jan 2024 17:17:08 -0600 Subject: [PATCH] maintenance: prevent division by 0 --- 3rdparty/iaxclient/lib/libspeex/testenc.c | 6 ++++-- 3rdparty/iaxclient/lib/libspeex/testenc_uwb.c | 6 ++++-- 3rdparty/iaxclient/lib/libspeex/testenc_wb.c | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/3rdparty/iaxclient/lib/libspeex/testenc.c b/3rdparty/iaxclient/lib/libspeex/testenc.c index 2d8c7858c..2f913b45a 100644 --- a/3rdparty/iaxclient/lib/libspeex/testenc.c +++ b/3rdparty/iaxclient/lib/libspeex/testenc.c @@ -125,11 +125,13 @@ int main(int argc, char **argv) fclose(fout); snr = 10 * log10( sigpow / errpow ); - seg_snr /= snr_frames; + if (snr_frames > 0) + seg_snr /= snr_frames; fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr); #ifdef FIXED_DEBUG - printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames)); + if (snr_frames > 0) + printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames)); #endif return 1; diff --git a/3rdparty/iaxclient/lib/libspeex/testenc_uwb.c b/3rdparty/iaxclient/lib/libspeex/testenc_uwb.c index bb2081d92..614f0c609 100644 --- a/3rdparty/iaxclient/lib/libspeex/testenc_uwb.c +++ b/3rdparty/iaxclient/lib/libspeex/testenc_uwb.c @@ -125,11 +125,13 @@ int main(int argc, char **argv) fclose(fout); snr = 10 * log10( sigpow / errpow ); - seg_snr /= snr_frames; + if (snr_frames > 0) + seg_snr /= snr_frames; fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr); #ifdef FIXED_DEBUG - printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames)); + if (snr_frames > 0) + printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames)); #endif return 1; diff --git a/3rdparty/iaxclient/lib/libspeex/testenc_wb.c b/3rdparty/iaxclient/lib/libspeex/testenc_wb.c index 74984b4d6..fce69a93e 100644 --- a/3rdparty/iaxclient/lib/libspeex/testenc_wb.c +++ b/3rdparty/iaxclient/lib/libspeex/testenc_wb.c @@ -130,11 +130,13 @@ int main(int argc, char **argv) fclose(fout); snr = 10 * log10( sigpow / errpow ); - seg_snr /= snr_frames; + if (snr_frames > 0) + seg_snr /= snr_frames; fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr); #ifdef FIXED_DEBUG - printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames)); + if (snr_frames > 0) + printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames)); #endif return 1;