aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2011-11-05 22:07:22 +0100
committerAnton Khirnov <anton@khirnov.net>2011-11-26 08:40:51 +0100
commit7fb55e0b02385ae0905af73a52c3db87d08777da (patch)
tree8db8072a08fd3d4082145b46f89355e7ca27b3dc
parent7a62ddb6895f29ff56f65429fdda0bdde4e30265 (diff)
downloadffmpeg-7fb55e0b02385ae0905af73a52c3db87d08777da.tar.gz
rtjpeg: simplify get_block() by using get_bits_left.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de> Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavcodec/rtjpeg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/rtjpeg.c b/libavcodec/rtjpeg.c
index dac7993955..35ab090cb2 100644
--- a/libavcodec/rtjpeg.c
+++ b/libavcodec/rtjpeg.c
@@ -56,7 +56,7 @@ static inline int get_block(GetBitContext *gb, DCTELEM *block, const uint8_t *sc
// number of non-zero coefficients
coeff = get_bits(gb, 6);
- if (get_bits_count(gb) + (coeff << 1) >= gb->size_in_bits)
+ if (get_bits_left(gb) < (coeff << 1))
return -1;
// normally we would only need to clear the (63 - coeff) last values,
@@ -73,7 +73,7 @@ static inline int get_block(GetBitContext *gb, DCTELEM *block, const uint8_t *sc
// 4 bits per coefficient
ALIGN(4);
- if (get_bits_count(gb) + (coeff << 2) >= gb->size_in_bits)
+ if (get_bits_left(gb) < (coeff << 2))
return -1;
while (coeff) {
ac = get_sbits(gb, 4);
@@ -84,7 +84,7 @@ static inline int get_block(GetBitContext *gb, DCTELEM *block, const uint8_t *sc
// 8 bits per coefficient
ALIGN(8);
- if (get_bits_count(gb) + (coeff << 3) >= gb->size_in_bits)
+ if (get_bits_left(gb) < (coeff << 3))
return -1;
while (coeff) {
ac = get_sbits(gb, 8);