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

Michael Niedermayer michael at niedermayer.cc
Tue May 26 21:32:22 EEST 2020


On Tue, May 26, 2020 at 03:13:51PM +0100, Josh de Kock wrote:
> 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;

this doesnt belong in  here

also how does this compare to all the code being converted to the macros
instead ? (most of the speed critical code is not using them IIRC)

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200526/72f060ba/attachment.sig>


More information about the ffmpeg-devel mailing list