[FFmpeg-devel] [PATCH 02/39] avcodec/mpeg12: Don't initialize encoder-only parts of RLTable

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Wed Dec 30 21:01:08 EET 2020


Anton Khirnov:
> Quoting Andreas Rheinhardt (2020-12-10 12:16:20)
>> ff_mpeg12_init_vlcs() currently initializes index_run, max_level and
>> max_run of ff_rl_mpeg1/2; yet the only user of these fields is the
>> MPEG-1/2 encoder which already initializes these tables on its own.
>> So remove the initializations in ff_mpeg12_init_vlcs(); this also
>> simplifies making ff_mpeg12_init_vlcs() thread-safe.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
>> ---
>>  libavcodec/mpeg12.c    | 4 ----
>>  libavcodec/mpeg12.h    | 2 --
>>  libavcodec/mpeg12enc.c | 6 ++++--
>>  3 files changed, 4 insertions(+), 8 deletions(-)
> 
> Looks good, thought it's really confusing how rl_vlc is initialized both
> by ff_rl_init() and by INIT_2D_VLC_RL()
> 
It is actually easy: ff_rl_init() initializes index_run, max_level and
max_run (without touching rl_vlc in any way); ff_rl_init_vlc() and
ff_mpeg12_init_vlcs() initialize rl_vlc (via the macros INIT_VLC_RL()
and INIT_2D_VLC_RL() respectively) without touching what ff_rl_init()
sets at all. So rl_vlc is not initialized by ff_rl_init() at all.

- Andreas


More information about the ffmpeg-devel mailing list