[FFmpeg-cvslog] golomb: Simplify get_ur_golomb_jpegls

Luca Barbato git at videolan.org
Sat Oct 28 20:02:53 EEST 2017


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Tue Apr 11 12:11:59 2017 +0200| [19c5fa9eea47d45b5eedce3bff4edeaf83fb3942] | committer: Luca Barbato

golomb: Simplify get_ur_golomb_jpegls

The loop always consumes the bit read and the new bitstream reader
can read 0 bits just fine.

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

 libavcodec/golomb.h | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 648f9243fc..cff7e42e51 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -290,16 +290,12 @@ static inline int get_ur_golomb_jpegls(BitstreamContext *bc, int k, int limit,
         return buf;
     } else {
         int i;
-        for (i = 0; i < limit && bitstream_peek(bc, 1) == 0 && bitstream_bits_left(bc) > 0; i++)
-            bitstream_skip(bc, 1);
-        bitstream_skip(bc, 1);
+        for (i = 0;
+             i < limit && bitstream_read_bit(bc) == 0 && bitstream_bits_left(bc) > 0;
+             i++);
 
         if (i < limit - 1) {
-            if (k) {
-                buf = bitstream_read(bc, k);
-            } else {
-                buf = 0;
-            }
+            buf = bitstream_read(bc, k);
 
             return buf + (i << k);
         } else if (i == limit - 1) {



More information about the ffmpeg-cvslog mailing list