aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ffv1enc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-07-08 11:36:58 +0200
committerAnton Khirnov <anton@khirnov.net>2024-08-01 10:09:26 +0200
commit4b9f7c7e3a9568a1982a6618c0ab77a3695675c1 (patch)
treee6bfb484e60439b3f9574af0a2e44551abe534d8 /libavcodec/ffv1enc.c
parentd2f507233a6c3cbc24d342d3c31db2c3489df96d (diff)
downloadffmpeg-4b9f7c7e3a9568a1982a6618c0ab77a3695675c1.tar.gz
lavc/ffv1: drop redundant FFV1Context.quant_table
In all cases except decoding version 1 it's either not used, or contains a copy of a table from quant_tables, which we can just as well use directly. When decoding version 1, we can just as well decode into quant_tables[0], which would otherwise be unused.
Diffstat (limited to 'libavcodec/ffv1enc.c')
-rw-r--r--libavcodec/ffv1enc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 5692bfa1fc..1d00a46cdd 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -367,7 +367,7 @@ static void write_header(FFV1Context *f)
put_symbol(c, state, f->chroma_v_shift, 0);
put_rac(c, state, f->transparency);
- write_quant_tables(c, f->quant_table);
+ write_quant_tables(c, f->quant_tables[f->context_model]);
} else if (f->version < 3) {
put_symbol(c, state, f->slice_count, 0);
for (i = 0; i < f->slice_count; i++) {
@@ -735,15 +735,13 @@ static av_cold int encode_init(AVCodecContext *avctx)
}
s->context_count[0] = (11 * 11 * 11 + 1) / 2;
s->context_count[1] = (11 * 11 * 5 * 5 * 5 + 1) / 2;
- memcpy(s->quant_table, s->quant_tables[s->context_model],
- sizeof(s->quant_table));
for (i = 0; i < s->plane_count; i++) {
PlaneContext *const p = &s->plane[i];
- memcpy(p->quant_table, s->quant_table, sizeof(p->quant_table));
p->quant_table_index = s->context_model;
p->context_count = s->context_count[p->quant_table_index];
+ memcpy(p->quant_table, s->quant_tables[p->quant_table_index], sizeof(p->quant_table));
}
if ((ret = ff_ffv1_allocate_initial_states(s)) < 0)