Browse code

Correct wrong lower limit and condition used in APE decoder

Originally committed as revision 15396 to svn://svn.ffmpeg.org/ffmpeg/trunk

Kostya Shishkov authored on 2008/09/24 21:45:28
Showing 1 changed files
... ...
@@ -358,11 +358,10 @@ static inline int range_get_symbol(APEContext * ctx,
358 358
 
359 359
 static inline void update_rice(APERice *rice, int x)
360 360
 {
361
+    int lim = rice->k ? (1 << (rice->k + 4)) : 0;
361 362
     rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5);
362 363
 
363
-    if (rice->k == 0)
364
-        rice->k = 1;
365
-    else if (rice->ksum < (1 << (rice->k + 4)))
364
+    if (rice->ksum < lim)
366 365
         rice->k--;
367 366
     else if (rice->ksum >= (1 << (rice->k + 5)))
368 367
         rice->k++;