Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-11-01 23:03:40 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-11-06 19:41:26 +0300
commit496b3c6987cfb4dfde6f59fa5da12be8c82c13ab (patch)
tree4b9a2828a4e031d1ab139c15ecfa85f7e2a2e1df /libavcodec
parent1d9aac9c4bfd30efa55404f64519928b10644f5f (diff)
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')
-rw-r--r--libavcodec/h263dec.c12
-rw-r--r--libavcodec/vc1dec.c32
2 files changed, 30 insertions, 14 deletions
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 5f5ecfdddc..da3c9899e3 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -63,9 +63,6 @@ static enum AVPixelFormat h263_get_format(AVCodecContext *avctx)
return avctx->pix_fmt;
}
- 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;
@@ -117,15 +114,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
s->h263_pred = 1;
s->msmpeg4_version = 5;
break;
- case AV_CODEC_ID_VC1:
- case AV_CODEC_ID_WMV3:
- case AV_CODEC_ID_VC1IMAGE:
- case AV_CODEC_ID_WMV3IMAGE:
- case AV_CODEC_ID_MSS2:
- s->h263_pred = 1;
- s->msmpeg4_version = 6;
- avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
- break;
case AV_CODEC_ID_H263I:
break;
case AV_CODEC_ID_FLV1:
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;