Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 8/8] avcodec/h263dec, mpeg4videodec: Parse extradata during init
Date: Mon,  2 Oct 2023 12:52:02 +0200
Message-ID: <AS8P250MB074456C9005C8C6C2212A82F8FC5A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB0744CC369A3887A6A38474498FC7A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

Possible now that the IDCT is already initialized at this point.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/h263dec.c       | 7 -------
 libavcodec/mpeg4videodec.c | 9 +++++++++
 libavcodec/mpegvideo.h     | 1 -
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 544d32b682..eb1d87a2fe 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -464,13 +464,6 @@ retry:
     } else if (CONFIG_MSMPEG4DEC && s->msmpeg4_version) {
         ret = ff_msmpeg4_decode_picture_header(s);
     } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
-        if (s->avctx->extradata_size && !s->extradata_parsed) {
-            GetBitContext gb;
-
-            if (init_get_bits8(&gb, s->avctx->extradata, s->avctx->extradata_size) >= 0 )
-                ff_mpeg4_decode_picture_header(avctx->priv_data, &gb, 1, 0);
-            s->extradata_parsed = 1;
-        }
         ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb, 0, 0);
         s->skipped_last_frame = (ret == FRAME_SKIPPED);
     } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index a8dd57bf6b..c8d4939259 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -42,6 +42,7 @@
 #include "h263.h"
 #include "h263data.h"
 #include "h263dec.h"
+#include "internal.h"
 #include "profiles.h"
 #include "qpeldsp.h"
 #include "threadframe.h"
@@ -3831,6 +3832,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     ff_thread_once(&init_static_once, mpeg4_init_static);
 
+    /* Must be after initializing the MPEG-4 static tables */
+    if (avctx->extradata_size && !avctx->internal->is_copy) {
+        GetBitContext gb;
+
+        if (init_get_bits8(&gb, avctx->extradata, avctx->extradata_size) >= 0)
+            ff_mpeg4_decode_picture_header(ctx, &gb, 1, 0);
+    }
+
     return 0;
 }
 
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 55828e6102..d7c2f57682 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -114,7 +114,6 @@ typedef struct MpegEncContext {
     int input_picture_number;  ///< used to set pic->display_picture_number, should not be used for/by anything else
     int coded_picture_number;  ///< used to set pic->coded_picture_number, should not be used for/by anything else
     int picture_number;       //FIXME remove, unclear definition
-    int extradata_parsed;
     int picture_in_gop_number; ///< 0-> first pic in gop, ...
     int mb_width, mb_height;   ///< number of MBs horizontally & vertically
     int mb_stride;             ///< mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11
-- 
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".

  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 ` [FFmpeg-devel] [PATCH 7/8] avcodec/mpegvideo_dec: Always initialize IDCTDSPContext during init Andreas Rheinhardt
2023-10-02 10:52 ` Andreas Rheinhardt [this message]
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=AS8P250MB074456C9005C8C6C2212A82F8FC5A@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