Commit 4b12930f authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/flacdec: use get_unary() simplify code

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 719dbe86
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
#include "flacdata.h" #include "flacdata.h"
#include "flacdsp.h" #include "flacdsp.h"
#include "thread.h" #include "thread.h"
#include "unary.h"
typedef struct FLACContext { typedef struct FLACContext {
FLACSTREAMINFO FLACSTREAMINFO
...@@ -357,7 +359,6 @@ static inline int decode_subframe(FLACContext *s, int channel) ...@@ -357,7 +359,6 @@ static inline int decode_subframe(FLACContext *s, int channel)
if (get_bits1(&s->gb)) { if (get_bits1(&s->gb)) {
int left = get_bits_left(&s->gb); int left = get_bits_left(&s->gb);
wasted = 1;
if ( left < 0 || if ( left < 0 ||
(left < bps && !show_bits_long(&s->gb, left)) || (left < bps && !show_bits_long(&s->gb, left)) ||
!show_bits_long(&s->gb, bps)) { !show_bits_long(&s->gb, bps)) {
...@@ -366,11 +367,7 @@ static inline int decode_subframe(FLACContext *s, int channel) ...@@ -366,11 +367,7 @@ static inline int decode_subframe(FLACContext *s, int channel)
bps, left); bps, left);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
while (!get_bits1(&s->gb)) { wasted = 1 + get_unary(&s->gb, 1, get_bits_left(&s->gb));
wasted++;
if (get_bits_left(&s->gb) <= 0)
return AVERROR_INVALIDDATA;
}
bps -= wasted; bps -= wasted;
} }
if (bps > 32) { if (bps > 32) {
......
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