aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-10-22 01:39:09 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-10-27 15:44:38 +0200
commit06fafbe01e2a07dd636f512101d95caaa58302b1 (patch)
treefee6feb11b017af3ed581b9613e167c9d947e85e
parent178dcbb96fd9fe11896e468e42e68559ea01d92f (diff)
downloadffmpeg-06fafbe01e2a07dd636f512101d95caaa58302b1.tar.gz
avcodec/mpeg12enc: Don't initialize ff_rl_mpeg2 unnecessarily
ff_rl_mpeg1 and ff_rl_mpeg2 differ only in RLTable.table_vlc, which ff_rl_init() does not use to initialize RLTable.max_level, RLTable.max_run and RLTable.index_run. This implies that these tables agree for ff_rl_mpeg1 and ff_rl_mpeg2; hence one can just use one of them and avoid calling ff_rl_init() ff_rl_mpeg2 alltogether. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/mpeg12enc.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index e0775d6b96..4d10b42bf2 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -1076,14 +1076,13 @@ 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][2*MAX_RUN + MAX_LEVEL + 3];
+ 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[0]);
- ff_rl_init(&ff_rl_mpeg2, mpeg12_static_rl_table_store[1]);
+ ff_rl_init(&ff_rl_mpeg1, mpeg12_static_rl_table_store);
ff_mpeg1_init_uni_ac_vlc(ff_rl_mpeg1.max_level[0], ff_rl_mpeg1.index_run[0],
ff_mpeg1_vlc_table, uni_mpeg1_ac_vlc_len);
- ff_mpeg1_init_uni_ac_vlc(ff_rl_mpeg2.max_level[0], ff_rl_mpeg2.index_run[0],
+ ff_mpeg1_init_uni_ac_vlc(ff_rl_mpeg1.max_level[0], ff_rl_mpeg1.index_run[0],
ff_mpeg2_vlc_table, uni_mpeg2_ac_vlc_len);
/* build unified dc encoding tables */