[FFmpeg-devel] [PATCH 1/7] avcodec/wmv2dec: Parse extradata during init

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sat Oct 7 03:37:39 EEST 2023


And stop setting picture_number which was only done to not parse
extradata multiple times.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/wmv2dec.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 469b2c4b2b..934bf56b1a 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -203,12 +203,8 @@ static int decode_ext_header(WMV2DecContext *w)
 
 int ff_wmv2_decode_picture_header(MpegEncContext *s)
 {
-    WMV2DecContext *const w = (WMV2DecContext *) s;
     int code;
 
-    if (s->picture_number == 0)
-        decode_ext_header(w);
-
     s->pict_type = get_bits1(&s->gb) + 1;
     if (s->pict_type == AV_PICTURE_TYPE_I) {
         code = get_bits(&s->gb, 7);
@@ -333,7 +329,6 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
     }
     s->esc3_level_length = 0;
     s->esc3_run_length   = 0;
-    s->picture_number++; // FIXME ?
 
     if (w->j_type) {
         ff_intrax8_decode_picture(&w->x8, &s->current_picture,
@@ -578,6 +573,8 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
     ff_wmv2_common_init(s);
 
+    decode_ext_header(w);
+
     return ff_intrax8_common_init(avctx, &w->x8,
                                   w->s.block, w->s.block_last_index,
                                   w->s.mb_width, w->s.mb_height);
-- 
2.34.1



More information about the ffmpeg-devel mailing list