summaryrefslogtreecommitdiffstats
path: root/libavcodec/golomb.h
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2017-04-11 12:11:59 +0200
committerLuca Barbato <lu_zero@gentoo.org>2017-04-13 13:37:10 +0200
commit19c5fa9eea47d45b5eedce3bff4edeaf83fb3942 (patch)
treec2d4fbdf21669e2f577942ae9134076413523904 /libavcodec/golomb.h
parent1fe858136b315796dd5349f3b4448a29d1bd6fa1 (diff)
downloadffmpeg-streaming-19c5fa9eea47d45b5eedce3bff4edeaf83fb3942.zip
ffmpeg-streaming-19c5fa9eea47d45b5eedce3bff4edeaf83fb3942.tar.gz
golomb: Simplify get_ur_golomb_jpegls
The loop always consumes the bit read and the new bitstream reader can read 0 bits just fine.
Diffstat (limited to 'libavcodec/golomb.h')
-rw-r--r--libavcodec/golomb.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 648f924..cff7e42 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) {
OpenPOWER on IntegriCloud