shithub: opus

Download patch

ref: 85bbab0b4a15d144930ce47d8bc1c0d5d99ec371
parent: fddc521a5cf6ede6d249d028d129f74c7b171568
author: Jean-Marc Valin <[email protected]>
date: Thu Dec 9 10:23:45 EST 2010

Fixes a fixed-point overflow in stereo angle calculation

--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -381,8 +381,8 @@
       for (i=0;i<N;i++)
       {
          celt_norm m, s;
-         m = X[i]+Y[i];
-         s = X[i]-Y[i];
+         m = ADD16(SHR16(X[i],1),SHR16(Y[i],1));
+         s = SUB16(SHR16(X[i],1),SHR16(Y[i],1));
          Emid = MAC16_16(Emid, m, m);
          Eside = MAC16_16(Eside, s, s);
       }