OSDN Git Service

amrnb: Restart the p_xn pointer when retraversing the array on overflow
authorMartin Storsjo <martin@martin.st>
Wed, 18 May 2011 09:29:28 +0000 (12:29 +0300)
committerMartin Storsjo <martin@martin.st>
Tue, 10 Jul 2012 10:37:42 +0000 (13:37 +0300)
This is a safeguard to avoid issues in a rare codepath.

This was committed on the master branch of the opencore
repository in commit f532d145194e474cb30d8644b8eee83873ad24cc,
based on AOSP contribution 10905.

Change-Id: I9688b009bcbe63d88ee5040e883a021aefa30664

media/libstagefright/codecs/amrnb/enc/src/g_pitch.cpp

index f6235ad..5b80e2a 100644 (file)
@@ -400,8 +400,9 @@ Word16 G_pitch(         /* o : Gain of pitch lag saturated to 1.2       */
     }
     else
     {
-        s = 0;                      /* Avoid case of all zeros */
+        s = 0;  /* re-initialize calculations */
         p_y1 = &y1[0];
+        p_xn = &xn[0];
         for (i = (L_subfr >> 2); i != 0; i--)
         {
             L_temp = (Word32)(*(p_y1++) >> 2);