shithub: opus

Download patch

ref: d60e0db0e24935903f5aae30414a28232c65c9b0
parent: 9ce950560c866d73954251792a12f0468c2cbb57
author: Jean-Marc Valin <[email protected]>
date: Tue Sep 14 08:22:17 EDT 2010

Fixes a fixed-point overflow in haar1()

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -442,9 +442,11 @@
    for (i=0;i<stride;i++)
       for (j=0;j<N0;j++)
       {
-         celt_norm tmp = X[stride*2*j+i];
-         X[stride*2*j+i] = MULT16_16_Q15(QCONST16(.7070678f,15), X[stride*2*j+i] + X[stride*(2*j+1)+i]);
-         X[stride*(2*j+1)+i] = MULT16_16_Q15(QCONST16(.7070678f,15), tmp - X[stride*(2*j+1)+i]);
+         celt_norm tmp1, tmp2;
+         tmp1 = MULT16_16_Q15(QCONST16(.7070678f,15), X[stride*2*j+i]);
+         tmp2 = MULT16_16_Q15(QCONST16(.7070678f,15), X[stride*(2*j+1)+i]);
+         X[stride*2*j+i] = tmp1 + tmp2;
+         X[stride*(2*j+1)+i] = tmp1 - tmp2;
       }
 }