diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-10-30 14:58:04 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-30 14:58:04 +0100 |
commit | 4b12930f79eda58f522f8449e67769f1b2b012d7 (patch) | |
tree | 97ed101fa98317891f0a3d16a23362b80bc5de16 | |
parent | 719dbe86ea0e85b3b89f492c69e10bb0e733bcbb (diff) | |
download | ffmpeg-4b12930f79eda58f522f8449e67769f1b2b012d7.tar.gz |
avcodec/flacdec: use get_unary() simplify code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/flacdec.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 95623cbbbc..596b24d76d 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -45,6 +45,8 @@ #include "flacdata.h" #include "flacdsp.h" #include "thread.h" +#include "unary.h" + typedef struct FLACContext { FLACSTREAMINFO @@ -357,7 +359,6 @@ static inline int decode_subframe(FLACContext *s, int channel) if (get_bits1(&s->gb)) { int left = get_bits_left(&s->gb); - wasted = 1; if ( left < 0 || (left < bps && !show_bits_long(&s->gb, left)) || !show_bits_long(&s->gb, bps)) { @@ -366,11 +367,7 @@ static inline int decode_subframe(FLACContext *s, int channel) bps, left); return AVERROR_INVALIDDATA; } - while (!get_bits1(&s->gb)) { - wasted++; - if (get_bits_left(&s->gb) <= 0) - return AVERROR_INVALIDDATA; - } + wasted = 1 + get_unary(&s->gb, 1, get_bits_left(&s->gb)); bps -= wasted; } if (bps > 32) { |