X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fsvq3.c;h=9cea9ac840f0d8dce2b142bcc92b950dc8efe8bd;hb=a11aa5f3ed7ee4d2385a7b725d43f6070d790b4c;hp=fc17081ecf412e8773c357a72df73f1e1b4cd814;hpb=8a15ad8a175cb97d6c1102b777f28e4d20846fec;p=ffmpeg diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index fc17081ecf4..9cea9ac840f 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -1064,16 +1064,15 @@ static int svq3_decode_slice_header(AVCodecContext *avctx) av_log(s->avctx, AV_LOG_ERROR, "illegal slice type %u \n", slice_id); return -1; } - if (get_bits1(&s->gb_slice)) { - avpriv_report_missing_feature(s->avctx, "Media key encryption"); - return AVERROR_PATCHWELCOME; - } s->slice_type = ff_h264_golomb_to_pict_type[slice_id]; if ((header & 0x9F) == 2) { - i = (s->mb_num < 64) ? 5 : av_log2(s->mb_num - 1); + i = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1)); get_bits(&s->gb_slice, i); + } else if (get_bits1(&s->gb_slice)) { + avpriv_report_missing_feature(s->avctx, "Media key encryption"); + return AVERROR_PATCHWELCOME; } s->slice_num = get_bits(&s->gb_slice, 8); @@ -1184,6 +1183,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx) GetBitContext gb; int frame_size_code; int unk0, unk1, unk2, unk3, unk4; + int w,h; size = AV_RB32(&extradata[4]); if (size > extradata_end - extradata - 8) { @@ -1196,38 +1196,41 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx) frame_size_code = get_bits(&gb, 3); switch (frame_size_code) { case 0: - avctx->width = 160; - avctx->height = 120; + w = 160; + h = 120; break; case 1: - avctx->width = 128; - avctx->height = 96; + w = 128; + h = 96; break; case 2: - avctx->width = 176; - avctx->height = 144; + w = 176; + h = 144; break; case 3: - avctx->width = 352; - avctx->height = 288; + w = 352; + h = 288; break; case 4: - avctx->width = 704; - avctx->height = 576; + w = 704; + h = 576; break; case 5: - avctx->width = 240; - avctx->height = 180; + w = 240; + h = 180; break; case 6: - avctx->width = 320; - avctx->height = 240; + w = 320; + h = 240; break; case 7: - avctx->width = get_bits(&gb, 12); - avctx->height = get_bits(&gb, 12); + w = get_bits(&gb, 12); + h = get_bits(&gb, 12); break; } + ret = ff_set_dimensions(avctx, w, h); + if (ret < 0) + goto fail; s->halfpel_flag = get_bits1(&gb); s->thirdpel_flag = get_bits1(&gb);