diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-11-01 21:03:40 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-11-06 17:41:26 +0100 |
commit | 496b3c6987cfb4dfde6f59fa5da12be8c82c13ab (patch) | |
tree | 4b9a2828a4e031d1ab139c15ecfa85f7e2a2e1df /libavcodec/vc1dec.c | |
parent | 1d9aac9c4bfd30efa55404f64519928b10644f5f (diff) | |
download | ffmpeg-496b3c6987cfb4dfde6f59fa5da12be8c82c13ab.tar.gz |
avcodec/vc1dec: Remove VC-1 decoders->H.263 decoder dependency
The only thing from the H.263 decoder that is reachable
by the VC-1 decoder is ff_h263_decode_init(); but it does
not even use all of it; e.g. h263dsp is unused and so are
the VLCs initialized in ff_h263_decode_init() (they amount
to about 77KB which are now no longer touched).
Notice that one could also call ff_idctdsp_init()
directly instead of ff_mpv_idct_init(); one could even
do so in ff_vc1_init_common().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/vc1dec.c')
-rw-r--r-- | libavcodec/vc1dec.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index e7ad540d84..5cb4c544c9 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -405,6 +405,20 @@ static av_cold int vc1_decode_init_alloc_tables(VC1Context *v) return 0; } +static enum AVPixelFormat vc1_get_format(AVCodecContext *avctx) +{ + if (avctx->codec_id == AV_CODEC_ID_MSS2) + return AV_PIX_FMT_YUV420P; + + if (CONFIG_GRAY && (avctx->flags & AV_CODEC_FLAG_GRAY)) { + if (avctx->color_range == AVCOL_RANGE_UNSPECIFIED) + avctx->color_range = AVCOL_RANGE_MPEG; + return AV_PIX_FMT_GRAY8; + } + + return ff_get_format(avctx, avctx->codec->pix_fmts); +} + av_cold int ff_vc1_decode_init(AVCodecContext *avctx) { VC1Context *const v = avctx->priv_data; @@ -415,7 +429,12 @@ av_cold int ff_vc1_decode_init(AVCodecContext *avctx) if (ret < 0) return ret; - ret = ff_h263_decode_init(avctx); + ff_mpv_decode_init(s, avctx); + ff_mpv_idct_init(s); + + avctx->pix_fmt = vc1_get_format(avctx); + + ret = ff_mpv_common_init(s); if (ret < 0) return ret; @@ -578,13 +597,23 @@ static av_cold void vc1_init_static(void) av_cold void ff_vc1_init_common(VC1Context *v) { static AVOnce init_static_once = AV_ONCE_INIT; + MpegEncContext *const s = &v->s; /* defaults */ v->pq = -1; v->mvrange = 0; /* 7.1.1.18, p80 */ + s->avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; + s->out_format = FMT_H263; + + s->h263_pred = 1; + s->msmpeg4_version = 6; + ff_vc1dsp_init(&v->vc1dsp); + /* For error resilience */ + ff_qpeldsp_init(&s->qdsp); + /* VLC tables */ ff_thread_once(&init_static_once, vc1_init_static); } @@ -702,7 +731,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) ff_blockdsp_init(&s->bdsp); ff_h264chroma_init(&v->h264chroma, 8); - ff_qpeldsp_init(&s->qdsp); avctx->has_b_frames = !!avctx->max_b_frames; |