The loop always consume the bit read and the new bitstream reader
can read 0 bits just fine.
---
 libavcodec/golomb.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 648f924..1977502 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -290,16 +290,10 @@ 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) {
-- 
2.9.2

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to