From a7230e880bc34fb85dfca22db1e5d28380a12cec Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 2 Mar 2025 23:09:39 +0100 Subject: [PATCH 19/40] avcodec/mpeg4videodec: Bail out earlier when parsing The scantables are unused for the parser (and in fact the IDCT permutation used has not been initialized at all). Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg4videodec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index eace43b4cb..2a340ea682 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -3250,6 +3250,12 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb, } else s->alternate_scan = 0; } + /* Skip at this point when only parsing since the remaining + * data is not useful for a parser and requires the + * sprite_trajectory VLC to be initialized. */ + if (parse_only) + goto end; + if (s->alternate_scan) { ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan); ff_permute_scantable(s->permutated_intra_h_scantable, ff_alternate_vertical_scan, @@ -3262,12 +3268,6 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb, ff_permute_scantable(s->permutated_intra_v_scantable, ff_alternate_vertical_scan, s->idsp.idct_permutation); - /* Skip at this point when only parsing since the remaining - * data is not useful for a parser and requires the - * sprite_trajectory VLC to be initialized. */ - if (parse_only) - goto end; - if (s->pict_type == AV_PICTURE_TYPE_S) { if((ctx->vol_sprite_usage == STATIC_SPRITE || ctx->vol_sprite_usage == GMC_SPRITE)) { -- 2.45.2