From: drowe67 Date: Sun, 5 Aug 2012 21:39:23 +0000 (+0000) Subject: in aks_to_M2 prevent log(0) when signal == 0 when used just by decoder, thanks Dean X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=44669088e07d8f9e813e1c894bed4f024edf792e;p=freetel-svn-tracking.git in aks_to_M2 prevent log(0) when signal == 0 when used just by decoder, thanks Dean git-svn-id: https://svn.code.sf.net/p/freetel/code@600 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/quantise.c b/codec2-dev/src/quantise.c index dd1464cb..d8232925 100644 --- a/codec2-dev/src/quantise.c +++ b/codec2-dev/src/quantise.c @@ -704,7 +704,11 @@ void aks_to_M2( /* Determine magnitudes by linear interpolation of P(w) -------------------*/ - signal = noise = 0.0; + /* when used just by decoded {A} might be all zeroes so init signal + to prevent log(0) errors */ + + signal = 1E-30; noise = 1E-32; + for(m=1; m<=model->L; m++) { am = floor((m - 0.5)*model->Wo/r + 0.5); bm = floor((m + 0.5)*model->Wo/r + 0.5);