aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-02 12:21:13 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-05 22:05:21 +0200
commitca3dea8a36f15d551ad9b95d7cccee5a9ef23010 (patch)
tree918f7f7961b2abe90b3389fe3c435f0d62fbd33a /libavcodec
parent49b4ed7237489a08e7b992e4be6ccf6ee055d043 (diff)
downloadffmpeg-ca3dea8a36f15d551ad9b95d7cccee5a9ef23010.tar.gz
avcodec/h263dec, mpeg4videodec: Parse extradata during init
Possible now that the IDCT is already initialized at this point. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h263dec.c7
-rw-r--r--libavcodec/mpeg4videodec.c9
-rw-r--r--libavcodec/mpegvideo.h1
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 b24fe3db20..97aec68981 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"
@@ -3828,6 +3829,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