ff_rl_init() initializes RLTable.(max_level|max_run|index_run); max_run is unused by the MPEG-1/2 encoders (as well as SpeedHQ). Furthermore, it initializes these things twice (for two passes), but the second half of this is never used.
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- libavcodec/mpeg12enc.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 4d10b42bf2..2db1d93d0e 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -49,6 +49,7 @@ #include "mpegvideodata.h" #include "mpegvideoenc.h" #include "profiles.h" +#include "rl.h" #if CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER static const uint8_t svcd_scan_offset_placeholder[] = { @@ -62,6 +63,9 @@ static uint8_t fcode_tab[MAX_MV * 2 + 1]; static uint8_t uni_mpeg1_ac_vlc_len[64 * 64 * 2]; static uint8_t uni_mpeg2_ac_vlc_len[64 * 64 * 2]; +static uint8_t mpeg12_max_level[MAX_LEVEL + 1]; +static uint8_t mpeg12_index_run[MAX_RUN + 1]; + /* simple include everything table for dc, first byte is bits * number next 3 are code */ static uint32_t mpeg1_lum_dc_uni[512]; @@ -757,8 +761,8 @@ next_coef: MASK_ABS(sign, alevel); sign &= 1; - if (alevel <= ff_rl_mpeg1.max_level[0][run]) { - code = ff_rl_mpeg1.index_run[0][run] + alevel - 1; + if (alevel <= mpeg12_max_level[run]) { + code = mpeg12_index_run[run] + alevel - 1; /* store the VLC & sign at once */ put_bits(&s->pb, table_vlc[code][1] + 1, (table_vlc[code][0] << 1) + sign); @@ -1076,13 +1080,12 @@ void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[8][64], static av_cold void mpeg12_encode_init_static(void) { - static uint8_t mpeg12_static_rl_table_store[2][2*MAX_RUN + MAX_LEVEL + 3]; - - ff_rl_init(&ff_rl_mpeg1, mpeg12_static_rl_table_store); + ff_rl_init_level_run(mpeg12_max_level, mpeg12_index_run, + ff_mpeg12_run, ff_mpeg12_level, MPEG12_RL_NB_ELEMS); - ff_mpeg1_init_uni_ac_vlc(ff_rl_mpeg1.max_level[0], ff_rl_mpeg1.index_run[0], + ff_mpeg1_init_uni_ac_vlc(mpeg12_max_level, mpeg12_index_run, ff_mpeg1_vlc_table, uni_mpeg1_ac_vlc_len); - ff_mpeg1_init_uni_ac_vlc(ff_rl_mpeg1.max_level[0], ff_rl_mpeg1.index_run[0], + ff_mpeg1_init_uni_ac_vlc(mpeg12_max_level, mpeg12_index_run, ff_mpeg2_vlc_table, uni_mpeg2_ac_vlc_len); /* build unified dc encoding tables */ -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".