1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

avcodec/vc1dec: Don't open and close decoder during init

This is done since 16af29a7a6
(and is actually unnecessary, because the tables initialized
in ff_msmpeg4_decode_init() are only ever used in vc1_block.c
which is only entered after a call to ff_msmpeg4_decode_init())
in a very ugly manner; said manner had the byproduct of
involving lots of unnecessary allocations and even opening
and closing a hwaccel in case one is used.

This commit achieves the aim of 16af29a7a6
by initializing the VLCs used by VC-1 in ff_vc1_init_common().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-10-30 14:36:20 +01:00
parent 83dfc21a21
commit 5a157313b3

View File

@ -540,6 +540,7 @@ static av_cold void vc1_init_static(void)
vc1_if_1mv_mbmode_bits[i], 1, 1,
vc1_if_1mv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
}
ff_msmp4_vc1_vlcs_init_once();
}
/**
@ -672,16 +673,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
avctx->color_range = AVCOL_RANGE_MPEG;
}
// ensure static VLC tables are initialized
if ((ret = ff_msmpeg4_decode_init(avctx)) < 0)
return ret;
if ((ret = ff_vc1_decode_init_alloc_tables(v)) < 0)
return ret;
// Hack to ensure the above functions will be called
// again once we know all necessary settings.
// That this is necessary might indicate a bug.
ff_vc1_decode_end(avctx);
ff_blockdsp_init(&s->bdsp);
ff_h264chroma_init(&v->h264chroma, 8);
ff_qpeldsp_init(&s->qdsp);