diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-22 01:33:11 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-27 15:44:38 +0200 |
commit | 178dcbb96fd9fe11896e468e42e68559ea01d92f (patch) | |
tree | 38573106b99815540e708c8a51a12fe41b6c4654 /libavcodec/mpeg12enc.c | |
parent | 18412c76e6f087d15a26864999fd2d63df72cdc6 (diff) | |
download | ffmpeg-178dcbb96fd9fe11896e468e42e68559ea01d92f.tar.gz |
avcodec/mpeg12enc: Pass tables explicitly in ff_mpeg1_init_uni_ac_vlc
This will allow to remove ff_rl_mpeg2 soon and remove
all uses of RLTable in MPEG-1/2/SpeedHQ later.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpeg12enc.c')
-rw-r--r-- | libavcodec/mpeg12enc.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 5d991ac99e..e0775d6b96 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -94,7 +94,10 @@ typedef struct MPEG12EncContext { #define A53_MAX_CC_COUNT 0x1f #endif /* CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER */ -av_cold void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len) +av_cold void ff_mpeg1_init_uni_ac_vlc(const int8_t max_level[], + const uint8_t index_run[], + const uint16_t table_vlc[][2], + uint8_t uni_ac_vlc_len[]) { int i; @@ -107,16 +110,16 @@ av_cold void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len int len, code; int alevel = FFABS(level); - if (alevel > rl->max_level[0][run]) + if (alevel > max_level[run]) code = 111; /* rl->n */ else - code = rl->index_run[0][run] + alevel - 1; + code = index_run[run] + alevel - 1; if (code < 111) { /* rl->n */ /* length of VLC and sign */ - len = rl->table_vlc[code][1] + 1; + len = table_vlc[code][1] + 1; } else { - len = rl->table_vlc[111 /* rl->n */][1] + 6; + len = table_vlc[MPEG12_RL_NB_ELEMS][1] + 6; if (alevel < 128) len += 8; @@ -1078,8 +1081,10 @@ static av_cold void mpeg12_encode_init_static(void) 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_mpeg1_init_uni_ac_vlc(&ff_rl_mpeg1, uni_mpeg1_ac_vlc_len); - ff_mpeg1_init_uni_ac_vlc(&ff_rl_mpeg2, uni_mpeg2_ac_vlc_len); + 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_mpeg2_vlc_table, uni_mpeg2_ac_vlc_len); /* build unified dc encoding tables */ for (int i = -255; i < 256; i++) { |