changeset 7914:c15b1e83d27d libavcodec

Correct wrong lower limit and condition used in APE decoder
author kostya
date Wed, 24 Sep 2008 12:45:28 +0000
parents 3551c55a7ccb
children 2d530c3d155e
files apedec.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/apedec.c	Tue Sep 23 23:16:48 2008 +0000
+++ b/apedec.c	Wed Sep 24 12:45:28 2008 +0000
@@ -358,11 +358,10 @@
 
 static inline void update_rice(APERice *rice, int x)
 {
+    int lim = rice->k ? (1 << (rice->k + 4)) : 0;
     rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5);
 
-    if (rice->k == 0)
-        rice->k = 1;
-    else if (rice->ksum < (1 << (rice->k + 4)))
+    if (rice->ksum < lim)
         rice->k--;
     else if (rice->ksum >= (1 << (rice->k + 5)))
         rice->k++;