in aks_to_M2 prevent log(0) when signal == 0 when used just by decoder, thanks Dean
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 5 Aug 2012 21:39:23 +0000 (21:39 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 5 Aug 2012 21:39:23 +0000 (21:39 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@600 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/quantise.c

index dd1464cba215dadfe62ebdbdafa42714fd64d0ce..d8232925a14333a5057af95cfeb34e25b519d24b 100644 (file)
@@ -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);