From a9408c2e1a13149e3787633be8f6b57b4065ef72 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Wed, 30 Apr 2025 12:11:31 +0200 Subject: [PATCH 04/44] avcodec/mpeg4videodec: Set [yd]c_scale_table during init It does not change lateron. (If we were to add short header support later, it would involve a branch in mpeg4_decode_block() anyway and we would then hardcode the dc_scaler value of eight there; the *_scale_tables would stay the same.) Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg4videodec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 51a2cd0a73..7764da7da7 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1344,6 +1344,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, // Note intra & rvlc should be optimized away if this is inlined if (intra) { + // FIXME add short header support if (use_intra_dc_vlc) { /* DC coef */ if (s->partitioned_frame) { @@ -3401,10 +3402,6 @@ end: s->picture_number++; // better than pic number==0 always ;) - // FIXME add short header support - s->y_dc_scale_table = ff_mpeg4_y_dc_scale_table; - s->c_dc_scale_table = ff_mpeg4_c_dc_scale_table; - if (s->workaround_bugs & FF_BUG_EDGE) { s->h_edge_pos = s->width; s->v_edge_pos = s->height; @@ -3878,6 +3875,9 @@ static av_cold int decode_init(AVCodecContext *avctx) // so we can already set dct_unquantize_inter here once and for all. s->dct_unquantize_inter = unquant_dsp_ctx.dct_unquantize_mpeg2_inter; + s->y_dc_scale_table = ff_mpeg4_y_dc_scale_table; + s->c_dc_scale_table = ff_mpeg4_c_dc_scale_table; + s->h263_pred = 1; s->low_delay = 0; /* default, might be overridden in the vol header during header parsing */ s->decode_mb = mpeg4_decode_mb; -- 2.45.2