shithub: opus

Download patch

ref: 02dcf6aad863c40e5a8372694055ab8ee0fa23ae
parent: 5f4b8dd1989a4ebe8e67afa10a41427b87e24a8a
author: Jean-Marc Valin <[email protected]>
date: Tue Oct 9 11:07:53 EDT 2012

Fixes a fixed-point stereo savings issue causing a celt_ilog2(0)

--- a/celt/celt.c
+++ b/celt/celt.c
@@ -895,6 +895,7 @@
          sum = ADD16(sum, EXTRACT16(SHR32(partial, 18)));
       }
       sum = MULT16_16_Q15(QCONST16(1.f/8, 15), sum);
+      sum = MIN16(QCONST16(1.f, 10), ABS16(sum));
       minXC = sum;
       for (i=8;i<intensity;i++)
       {
@@ -902,8 +903,9 @@
          opus_val32 partial = 0;
          for (j=m->eBands[i]<<LM;j<m->eBands[i+1]<<LM;j++)
             partial = MAC16_16(partial, X[j], X[N0+j]);
-         minXC = MIN16(minXC, EXTRACT16(SHR32(partial, 18)));
+         minXC = MIN16(minXC, ABS16(EXTRACT16(SHR32(partial, 18))));
       }
+      minXC = MIN16(QCONST16(1.f, 10), ABS16(minXC));
       /*printf ("%f\n", sum);*/
       if (sum > QCONST16(.995f,10))
          trim_index-=4;