From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 7/8] avcodec/mpegvideo_dec: Always initialize IDCTDSPContext during init
Date: Mon, 2 Oct 2023 12:52:01 +0200
Message-ID: <AS8P250MB074461D7D85EF15990106B458FC5A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB0744CC369A3887A6A38474498FC7A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>
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>
---
libavcodec/h261dec.c | 1 -
libavcodec/h263dec.c | 5 -----
libavcodec/mpeg12dec.c | 2 --
libavcodec/mpegvideo_dec.c | 2 +-
libavcodec/rv10.c | 1 -
libavcodec/rv34.c | 1 -
libavcodec/vc1dec.c | 1 -
7 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index c41b96c3c7..6cdf11f822 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -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);
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 9f63f1a7cb..544d32b682 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -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);
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index d2dbcd5b61..c0f1e8763b 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -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++) {
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 3f173a9feb..39d1282252 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -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
}
@@ -82,7 +83,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;
}
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 6abceade4e..fbecfdae9f 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -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;
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index e9660bb457..152c62fa07 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -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;
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 449d2fea5e..a4f2d30e22 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -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);
--
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:[~2023-10-02 10:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-30 18:02 [FFmpeg-devel] [PATCH 1/4] avcodec/mpegvideo_dec: Check for existence of planes before accesses Andreas Rheinhardt
2023-09-30 18:02 ` [FFmpeg-devel] [PATCH 2/4] avcodec/mpegvideo_dec: Don't memset twice Andreas Rheinhardt
2023-09-30 18:02 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mpegvideo_dec: Remove commented-out legacy cruft Andreas Rheinhardt
2023-10-01 20:29 ` Michael Niedermayer
2023-09-30 18:02 ` [FFmpeg-devel] [PATCH 4/4] avcodec/h264_slice: Don't keep AVCodecContext props in sync manually Andreas Rheinhardt
2023-10-02 10:51 ` [FFmpeg-devel] [PATCH 5/8] avcodec/mpeg12dec: Don't initialize IDCT more than once Andreas Rheinhardt
2023-10-03 22:14 ` Andreas Rheinhardt
2023-10-02 10:52 ` [FFmpeg-devel] [PATCH 6/8] avcodec/mpegvideo_dec: Don't zero context on init failure Andreas Rheinhardt
2023-10-02 10:52 ` Andreas Rheinhardt [this message]
2023-10-02 10:52 ` [FFmpeg-devel] [PATCH 8/8] avcodec/h263dec, mpeg4videodec: Parse extradata during init Andreas Rheinhardt
2023-10-02 23:39 ` [FFmpeg-devel] [PATCH 1/4] avcodec/mpegvideo_dec: Check for existence of planes before accesses Andreas Rheinhardt
2023-10-03 16:04 ` [FFmpeg-devel] [PATCH 09/12] avcodec/rv10: Remove dead code Andreas Rheinhardt
2023-10-04 17:28 ` Michael Niedermayer
2023-10-03 16:04 ` [FFmpeg-devel] [PATCH 10/12] avcodec/rv10: Replace switch by LUT Andreas Rheinhardt
2023-10-04 17:27 ` Michael Niedermayer
2023-10-06 1:42 ` Vittorio Giovara
2023-10-06 2:03 ` Andreas Rheinhardt
2023-10-07 16:44 ` Michael Niedermayer
2023-10-03 16:04 ` [FFmpeg-devel] [PATCH 11/12] avcodec/h261dec, mpeg12dec, vc1dec: Remove setting write-only flags Andreas Rheinhardt
2023-10-04 17:26 ` Michael Niedermayer
2023-10-03 16:04 ` [FFmpeg-devel] [PATCH 12/12] avcodec/mpegvideo: Move allocating new_picture to the encoder Andreas Rheinhardt
2023-10-06 2:21 ` 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=AS8P250MB074461D7D85EF15990106B458FC5A@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