avcodec/wmv2dec: Parse extradata during init

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

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2023-10-06 22:33:51 +02:00
parent 37b5f4a1f6
commit cae30c5ed2

View File

@ -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);