shithub: opus

Download patch

ref: 70bdf9bf39680d8ff808bd580cb2664db9d00f97
parent: bd0610d21b28b76095a49e601df44fb792b96369
author: Jean-Marc Valin <[email protected]>
date: Mon Mar 15 16:50:30 EDT 2010

fixed-point: reducing the mismatch in the folded part

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -491,7 +491,7 @@
       }
       balance += pulses[i] + tell;
       
-      n = SHL16(celt_sqrt(eBands[i+1]-eBands[i]),11);
+      n = celt_sqrt(SHL32(EXTEND32(eBands[i+1]-eBands[i]),22));
 
       if (q > 0)
       {
@@ -600,7 +600,7 @@
          iside = bitexact_cos(16384-itheta);
          delta = (N-1)*(log2_frac(iside,BITRES+2)-log2_frac(imid,BITRES+2))>>2;
       }
-      n = SHL16(celt_sqrt((eBands[i+1]-eBands[i])),11);
+      n = celt_sqrt(SHL32(EXTEND32(eBands[i+1]-eBands[i]),22));
 #if 0
       if (N==2)
       {
@@ -821,7 +821,7 @@
          iside = bitexact_cos(16384-itheta);
          delta = (N-1)*(log2_frac(iside,BITRES+2)-log2_frac(imid,BITRES+2))>>2;
       }
-      n = SHL16(celt_sqrt((eBands[i+1]-eBands[i])),11);
+      n = celt_sqrt(SHL32(EXTEND32(eBands[i+1]-eBands[i]),22));
 
 #if 0
       if (N==2)