[FFmpeg-cvslog] Simplify using get_bits_left.

Reimar Döffinger git at videolan.org
Sat Nov 5 23:54:34 CET 2011


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Sat Nov  5 22:07:22 2011 +0100| [fffa4530f92ea29594d4b39cf7c9922aa6a7bab3] | committer: Reimar Döffinger

Simplify using get_bits_left.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fffa4530f92ea29594d4b39cf7c9922aa6a7bab3
---

 libavcodec/rtjpeg.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/rtjpeg.c b/libavcodec/rtjpeg.c
index 303183f..1827c91 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);



More information about the ffmpeg-cvslog mailing list