[FFmpeg-devel] Reduce static table size for VLC tables in h264_cavlc.c

Michael Niedermayer michael at niedermayer.cc
Sun Sep 9 03:49:44 EEST 2018


On Fri, Sep 07, 2018 at 04:50:57PM -0700, Dale Curtis wrote:
> These tables represent ~70k so moving the allocation to when
> they're actually used reduces memory usage in cases where the
> h264 decoder isn't used.

>  h264_cavlc.c |   43 ++++++++++++++++++++++++++-----------------
>  1 file changed, 26 insertions(+), 17 deletions(-)
> c7d67012a2207911076717c1667e698842fa101a  cavlc-size.patch
> From e1cbe52a1f41a39698136efb4695d8d019117853 Mon Sep 17 00:00:00 2001
> From: Dale Curtis <dalecurtis at chromium.org>
> Date: Fri, 31 Aug 2018 16:50:23 -0700
> Subject: [PATCH] Reduce static table size for VLC tables in h264_cavlc.c
> 
> These tables represent ~70k so moving the allocation to when
> they're actually used reduces memory usage in cases where the
> h264 decoder isn't used.
> 
> Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
> ---
>  libavcodec/h264_cavlc.c | 43 +++++++++++++++++++++++++----------------
>  1 file changed, 26 insertions(+), 17 deletions(-)
> 
> diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
> index a7e60676a0..7769202401 100644
> --- a/libavcodec/h264_cavlc.c
> +++ b/libavcodec/h264_cavlc.c
> @@ -236,35 +236,35 @@ static const uint8_t run_bits[7][16]={
>  };
>  
>  static VLC coeff_token_vlc[4];
> -static VLC_TYPE coeff_token_vlc_tables[520+332+280+256][2];
> +static VLC_TYPE (*coeff_token_vlc_tables)[520+332+280+256][2];
>  static const int coeff_token_vlc_tables_size[4]={520,332,280,256};

dont all modern OS assign physical memory only once something is stored
in these tables?

[...]

-- 
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: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180909/e3c88d8e/attachment.sig>


More information about the ffmpeg-devel mailing list