From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 21/24] avcodec/vc1dec: Remove VC-1 decoders->H.263 decoder dependency
Date: Thu, 3 Nov 2022 03:57:37 +0100
Message-ID: <AS8P250MB07446C9109153E4EFE703DBF8F389@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <GV1P250MB0737EF25F056808CC9F6896C8F349@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>
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>
---
configure | 2 +-
libavcodec/h263dec.c | 12 ------------
libavcodec/vc1dec.c | 32 ++++++++++++++++++++++++++++++--
3 files changed, 31 insertions(+), 15 deletions(-)
diff --git a/configure b/configure
index 0822498efe..a59e9a898d 100755
--- a/configure
+++ b/configure
@@ -2981,7 +2981,7 @@ utvideo_encoder_select="bswapdsp huffman llvidencdsp"
vble_decoder_select="llviddsp"
vbn_decoder_select="texturedsp"
vbn_encoder_select="texturedspenc"
-vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideodec vc1dsp"
+vc1_decoder_select="blockdsp h264qpel intrax8 mpegvideodec qpeldsp vc1dsp"
vc1image_decoder_select="vc1_decoder"
vorbis_decoder_select="mdct"
vorbis_encoder_select="audio_frame_queue mdct"
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;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-11-03 2:57 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-30 23:41 [FFmpeg-devel] [PATCH 01/19] avcodec/vc1: Don't check for AVCodecContext.codec Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 02/19] avcodec/vc1: Remove always-false check Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 03/19] avcodec/vc1: Don't check for errors for complete VLC Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 04/19] avcodec/vc1: Don't use VLC to read bfraction Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 05/19] avcodec/vc1_parser: Set parse_only only once Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 06/19] avcodec/vc1_parser: Don't call ff_vc1_init_common() Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 07/19] avcodec/vc1: Move setting res_fasttx-IDCT functions to vc1dec.c Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 08/19] avcodec/vc1data: Remove duplicate defines Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 09/19] avcodec/vc1data: Remove declarations of inexistent arrays Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 10/19] avcodec/vc1data: Move VLC codes/lengths tables to a header Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 11/19] avcodec/vc1: Move ff_vc1_init_common() to vc1dec.c Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 12/19] avcodec/vc1_block: Don't duplicate #defines Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 13/19] avcodec/msmpeg4dec: Factor initializing VLCs shared with VC-1 out Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 14/19] avcodec/vc1dec: Don't open and close decoder during init Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 15/19] avcodec/vc1dec: Factor (re)initializing code out Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 16/19] avcodec/vc1dec: Return early upon error Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 17/19] avcodec/msmpeg4data: Move data shared between msmpeg4 and VC-1 out Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 18/19] avcodec/vc1dec: Split VC-1 decoders from msmpeg4 Andreas Rheinhardt
2022-10-30 23:56 ` [FFmpeg-devel] [PATCH 19/19] avcodec/vc1_block: Remove redundant write Andreas Rheinhardt
2022-11-03 2:57 ` [FFmpeg-devel] [PATCH 20/24] avcodec/mpegvideo_dec: Don't use MotionEstContext as scratch space Andreas Rheinhardt
2022-11-03 2:57 ` Andreas Rheinhardt [this message]
2022-11-03 2:57 ` [FFmpeg-devel] [PATCH 22/24] avcodec/h263dec: Move initializing qpel DSP context to mpeg4videodec.c Andreas Rheinhardt
2022-11-03 2:57 ` [FFmpeg-devel] [PATCH 23/24] avcodec/mpegvideo_enc: Move initializing QpelDSPCtx to mpeg4videoenc.c Andreas Rheinhardt
2022-11-03 2:57 ` [FFmpeg-devel] [PATCH 24/24] avcodec/motion_est: Remove unused field Andreas Rheinhardt
2022-11-05 17:18 ` [FFmpeg-devel] [PATCH 01/19] avcodec/vc1: Don't check for AVCodecContext.codec Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AS8P250MB07446C9109153E4EFE703DBF8F389@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git