shithub: opus

Download patch

ref: 319df9a83656b82305b663ef85928eca9e94830c
parent: e8e57a32f6e9e11998e60272f131880c95de271f
author: Jean-Marc Valin <[email protected]>
date: Fri May 24 22:51:56 EDT 2013

Fixes two warnings in pitch_xcorr()

Rename y0 and y1 because of the name clash with Bessel functions.
Initialize y_3 to zero because gcc is too dumb to realize it can't
be used uninitialized.

--- a/celt/pitch.c
+++ b/celt/pitch.c
@@ -266,65 +266,65 @@
       opus_val32 sum4=0;
       const opus_val16 *y = _y+i;
       const opus_val16 *x = _x;
-      opus_val16 y0, y1, y2, y3;
-      /*y0=y[0];y1=y[1];y2=y[2];y3=y[3];*/
-      y0=*y++;
-      y1=*y++;
-      y2=*y++;
+      opus_val16 y_0, y_1, y_2, y_3;
+      y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */
+      y_0=*y++;
+      y_1=*y++;
+      y_2=*y++;
       for (j=0;j<len-3;j+=4)
       {
          opus_val16 tmp;
          tmp = *x++;
-         y3=*y++;
-         sum1 = MAC16_16(sum1,tmp,y0);
-         sum2 = MAC16_16(sum2,tmp,y1);
-         sum3 = MAC16_16(sum3,tmp,y2);
-         sum4 = MAC16_16(sum4,tmp,y3);
+         y_3=*y++;
+         sum1 = MAC16_16(sum1,tmp,y_0);
+         sum2 = MAC16_16(sum2,tmp,y_1);
+         sum3 = MAC16_16(sum3,tmp,y_2);
+         sum4 = MAC16_16(sum4,tmp,y_3);
          tmp=*x++;
-         y0=*y++;
-         sum1 = MAC16_16(sum1,tmp,y1);
-         sum2 = MAC16_16(sum2,tmp,y2);
-         sum3 = MAC16_16(sum3,tmp,y3);
-         sum4 = MAC16_16(sum4,tmp,y0);
+         y_0=*y++;
+         sum1 = MAC16_16(sum1,tmp,y_1);
+         sum2 = MAC16_16(sum2,tmp,y_2);
+         sum3 = MAC16_16(sum3,tmp,y_3);
+         sum4 = MAC16_16(sum4,tmp,y_0);
          tmp=*x++;
-         y1=*y++;
-         sum1 = MAC16_16(sum1,tmp,y2);
-         sum2 = MAC16_16(sum2,tmp,y3);
-         sum3 = MAC16_16(sum3,tmp,y0);
-         sum4 = MAC16_16(sum4,tmp,y1);
+         y_1=*y++;
+         sum1 = MAC16_16(sum1,tmp,y_2);
+         sum2 = MAC16_16(sum2,tmp,y_3);
+         sum3 = MAC16_16(sum3,tmp,y_0);
+         sum4 = MAC16_16(sum4,tmp,y_1);
          tmp=*x++;
-         y2=*y++;
-         sum1 = MAC16_16(sum1,tmp,y3);
-         sum2 = MAC16_16(sum2,tmp,y0);
-         sum3 = MAC16_16(sum3,tmp,y1);
-         sum4 = MAC16_16(sum4,tmp,y2);
+         y_2=*y++;
+         sum1 = MAC16_16(sum1,tmp,y_3);
+         sum2 = MAC16_16(sum2,tmp,y_0);
+         sum3 = MAC16_16(sum3,tmp,y_1);
+         sum4 = MAC16_16(sum4,tmp,y_2);
       }
       if (j++<len)
       {
          opus_val16 tmp = *x++;
-         y3=*y++;
-         sum1 = MAC16_16(sum1,tmp,y0);
-         sum2 = MAC16_16(sum2,tmp,y1);
-         sum3 = MAC16_16(sum3,tmp,y2);
-         sum4 = MAC16_16(sum4,tmp,y3);
+         y_3=*y++;
+         sum1 = MAC16_16(sum1,tmp,y_0);
+         sum2 = MAC16_16(sum2,tmp,y_1);
+         sum3 = MAC16_16(sum3,tmp,y_2);
+         sum4 = MAC16_16(sum4,tmp,y_3);
       }
       if (j++<len)
       {
          opus_val16 tmp=*x++;
-         y0=*y++;
-         sum1 = MAC16_16(sum1,tmp,y1);
-         sum2 = MAC16_16(sum2,tmp,y2);
-         sum3 = MAC16_16(sum3,tmp,y3);
-         sum4 = MAC16_16(sum4,tmp,y0);
+         y_0=*y++;
+         sum1 = MAC16_16(sum1,tmp,y_1);
+         sum2 = MAC16_16(sum2,tmp,y_2);
+         sum3 = MAC16_16(sum3,tmp,y_3);
+         sum4 = MAC16_16(sum4,tmp,y_0);
       }
       if (j<len)
       {
          opus_val16 tmp=*x++;
-         y1=*y++;
-         sum1 = MAC16_16(sum1,tmp,y2);
-         sum2 = MAC16_16(sum2,tmp,y3);
-         sum3 = MAC16_16(sum3,tmp,y0);
-         sum4 = MAC16_16(sum4,tmp,y1);
+         y_1=*y++;
+         sum1 = MAC16_16(sum1,tmp,y_2);
+         sum2 = MAC16_16(sum2,tmp,y_3);
+         sum3 = MAC16_16(sum3,tmp,y_0);
+         sum4 = MAC16_16(sum4,tmp,y_1);
       }
       xcorr[i]=sum1;
       xcorr[i+1]=sum2;