Correct wrong lower limit and condition used in APE decoder

Originally committed as revision 15396 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Kostya Shishkov 2008-09-24 12:45:28 +00:00
parent f26be47740
commit e774c41cab
1 changed files with 2 additions and 3 deletions

View File

@ -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++;