From: Alexandra Hájková <[email protected]>

Do not prefetch data too often for short codes.
---
 libavcodec/golomb.h | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index cbb5d12..2daedf6 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -105,18 +105,19 @@ static inline unsigned 
get_interleaved_ue_golomb(BitstreamContext *bc)
 {
     uint32_t buf;
 
-    buf = bitstream_peek(bc, 32);
+    buf = bitstream_peek(bc, 9);
 
-    if (buf & 0xAA800000) {
-        buf >>= 32 - 8;
+    if (buf & 0x155) {
+        buf >>= 1;
         bitstream_skip(bc, ff_interleaved_golomb_vlc_len[buf]);
 
         return ff_interleaved_ue_golomb_vlc_code[buf];
     } else {
-        unsigned ret = 1;
+        unsigned ret = (1 << 4) | ff_interleaved_dirac_golomb_vlc_code[buf >> 
1];
 
+        bitstream_skip(bc, 8);
+        buf = bitstream_peek(bc, 8);
         do {
-            buf >>= 32 - 8;
             bitstream_skip(bc, FFMIN(ff_interleaved_golomb_vlc_len[buf], 8));
 
             if (ff_interleaved_golomb_vlc_len[buf] != 9) {
@@ -125,7 +126,7 @@ static inline unsigned 
get_interleaved_ue_golomb(BitstreamContext *bc)
                 break;
             }
             ret = (ret << 4) | ff_interleaved_dirac_golomb_vlc_code[buf];
-            buf = bitstream_peek(bc, 32);
+            buf = bitstream_peek(bc, 8);
         } while (bitstream_bits_left(bc) > 0);
 
         return ret - 1;
-- 
2.1.4

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

Reply via email to