diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2008-09-24 12:45:28 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2008-09-24 12:45:28 +0000 |
commit | e774c41cab765f5d12ecfb31e5fa30df41230de0 (patch) | |
tree | 380a19df70b4ff345a157852ec6b6a362c5bd7c9 | |
parent | f26be477406785ffa88a127fd01574dfae040753 (diff) | |
download | ffmpeg-e774c41cab765f5d12ecfb31e5fa30df41230de0.tar.gz |
Correct wrong lower limit and condition used in APE decoder
Originally committed as revision 15396 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/apedec.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 0489ab49dd..82d567f4cf 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -358,11 +358,10 @@ static inline int range_get_symbol(APEContext * ctx, 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++; |