[FFmpeg-devel] [PATCH] lavc/h264_cavlc: use inline function get_bits API

Josh de Kock josh at itanimul.li
Tue May 26 17:13:51 EEST 2020


To prepare for using the cached bitstream reader, which only defines the
inline functions rather than the macros, with CAVLC decoding.

Signed-off-by: Josh de Kock <josh at itanimul.li>
---
 libavcodec/h264_cavlc.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index 6481992e58..c1ecaea1ba 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -414,19 +414,12 @@ av_cold void ff_h264_decode_init_vlc(void){
 }
 
 static inline int get_level_prefix(GetBitContext *gb){
-    unsigned int buf;
     int log;
 
-    OPEN_READER(re, gb);
-    UPDATE_CACHE(re, gb);
-    buf=GET_CACHE(re, gb);
+    log = 16 - av_log2_16bit(show_bits(gb, 16));
+    skip_bits(gb, log);
 
-    log= 32 - av_log2(buf);
-
-    LAST_SKIP_BITS(re, gb, log);
-    CLOSE_READER(re, gb);
-
-    return log-1;
+    return log - 1;
 }
 
 /**
-- 
2.26.0



More information about the ffmpeg-devel mailing list