1
0
Fork 0

avcodec/mpegvideo_dec: Always initialize IDCTDSPContext during init

It has currently not been done for H263, H263P and MPEG4.
Doing so avoids having to initialize the IDCT permutation
lateron when decoding packets in order to be able to parse
a quant matrix; it means that every mpegvideo decoder always
has an initialized IDCTDSPContext after init.
Initializing is done generically in ff_mpv_decode_init().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2023-10-01 19:50:04 +02:00
parent d86f7603cf
commit 49b4ed7237
7 changed files with 1 additions and 12 deletions

View File

@ -94,7 +94,6 @@ static av_cold int h261_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
h->gob_start_code_skipped = 0;
ff_mpv_idct_init(s);
ff_thread_once(&init_static_once, h261_decode_init_static);

View File

@ -128,7 +128,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
avctx->codec->id != AV_CODEC_ID_H263P &&
avctx->codec->id != AV_CODEC_ID_MPEG4) {
avctx->pix_fmt = h263_get_format(avctx);
ff_mpv_idct_init(s);
if ((ret = ff_mpv_common_init(s)) < 0)
return ret;
}
@ -459,10 +458,6 @@ retry:
if (ret < 0)
return ret;
if (!s->context_initialized)
// we need the idct permutation for reading a custom matrix
ff_mpv_idct_init(s);
/* let's go :-) */
if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
ret = ff_wmv2_decode_picture_header(s);

View File

@ -1057,7 +1057,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
avctx->coded_width = avctx->coded_height = 0; // do not trust dimensions from input
ff_mpv_decode_init(s2, avctx);
ff_mpv_idct_init(s2);
ff_mpeg12_init_vlcs();
s2->chroma_format = 1;
@ -3048,7 +3047,6 @@ static av_cold int ipu_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
ff_mpv_decode_init(m, avctx);
ff_mpv_idct_init(m);
ff_mpeg12_init_vlcs();
for (int i = 0; i < 64; i++) {

View File

@ -54,6 +54,7 @@ void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
/* convert fourcc to upper case */
s->codec_tag = ff_toupper4(avctx->codec_tag);
ff_mpv_idct_init(s);
ff_h264chroma_init(&s->h264chroma, 8); //for lowres
}
@ -84,7 +85,6 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
s->bitstream_buffer_size = s->allocated_bitstream_buffer_size = 0;
if (s1->context_initialized) {
ff_mpv_idct_init(s);
if ((err = ff_mpv_common_init(s)) < 0)
return err;
}

View File

@ -420,7 +420,6 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
ff_mpv_idct_init(s);
if ((ret = ff_mpv_common_init(s)) < 0)
return ret;

View File

@ -1498,7 +1498,6 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
avctx->has_b_frames = 1;
s->low_delay = 0;
ff_mpv_idct_init(s);
if ((ret = ff_mpv_common_init(s)) < 0)
return ret;

View File

@ -431,7 +431,6 @@ av_cold int ff_vc1_decode_init(AVCodecContext *avctx)
return ret;
ff_mpv_decode_init(s, avctx);
ff_mpv_idct_init(s);
avctx->pix_fmt = vc1_get_format(avctx);