summaryrefslogtreecommitdiff
path: root/libavcodec/speedhqenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-08 21:28:25 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-01-25 14:51:53 +0100
commitf741bd06748d95f1fe45edf1c24e493216170c24 (patch)
tree26739dfdeb64fcff3a6acefb4604556e8fd0a449 /libavcodec/speedhqenc.c
parentc7016e35a624a75bb5b82bee932ddfe28d013b3f (diff)
downloadffmpeg-f741bd06748d95f1fe45edf1c24e493216170c24.tar.gz
avcodec/mpeg12enc, speedhqenc: Avoid redundant copies of tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/speedhqenc.c')
-rw-r--r--libavcodec/speedhqenc.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c
index 51f67c0d5e..a5bedd5301 100644
--- a/libavcodec/speedhqenc.c
+++ b/libavcodec/speedhqenc.c
@@ -46,9 +46,6 @@ static uint16_t mpeg12_vlc_dc_chroma_code_reversed[12];
static uint32_t speedhq_lum_dc_uni[512];
static uint32_t speedhq_chr_dc_uni[512];
-static uint8_t speedhq_index_run[2][64];
-static int8_t speedhq_max_level[2][64];
-
static uint8_t uni_speedhq_ac_vlc_len[64 * 64 * 2];
static uint32_t reverse(uint32_t num, int bits)
@@ -77,11 +74,6 @@ static av_cold void speedhq_init_static_data(void)
ff_rl_init(&ff_rl_speedhq, speedhq_static_rl_table_store);
- for (int i = 0; i < 64; i++) {
- speedhq_max_level[0][i] = ff_rl_speedhq.max_level[0][i];
- speedhq_index_run[0][i] = ff_rl_speedhq.index_run[0][i];
- }
-
/* build unified dc encoding tables */
for (int i = -255; i < 256; i++) {
int adiff, index;
@@ -231,8 +223,8 @@ static void encode_block(MpegEncContext *s, int16_t *block, int n)
MASK_ABS(sign, alevel);
sign &= 1;
- if (alevel <= speedhq_max_level[0][run]) {
- code = speedhq_index_run[0][run] + alevel - 1;
+ if (alevel <= ff_rl_speedhq.max_level[0][run]) {
+ code = ff_rl_speedhq.index_run[0][run] + alevel - 1;
/* store the VLC & sign at once */
put_bits_le(&s->pb, ff_rl_speedhq.table_vlc[code][1] + 1,
ff_rl_speedhq.table_vlc[code][0] + (sign << ff_rl_speedhq.table_vlc[code][1]));