Commit e774c41c authored by Kostya Shishkov's avatar Kostya Shishkov

Correct wrong lower limit and condition used in APE decoder

Originally committed as revision 15396 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent f26be477
...@@ -358,11 +358,10 @@ static inline int range_get_symbol(APEContext * ctx, ...@@ -358,11 +358,10 @@ static inline int range_get_symbol(APEContext * ctx,
static inline void update_rice(APERice *rice, int x) 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); rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5);
if (rice->k == 0) if (rice->ksum < lim)
rice->k = 1;
else if (rice->ksum < (1 << (rice->k + 4)))
rice->k--; rice->k--;
else if (rice->ksum >= (1 << (rice->k + 5))) else if (rice->ksum >= (1 << (rice->k + 5)))
rice->k++; rice->k++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment