Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
Alberto Delmás authored on 2012/11/11 17:23:06... | ... |
@@ -474,7 +474,7 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *data_size, |
474 | 474 |
int keyframe, has_wmv9, has_mv, is_rle, is_555, ret; |
475 | 475 |
|
476 | 476 |
Rectangle wmv9rects[MAX_WMV9_RECTANGLES], *r; |
477 |
- int used_rects = 0, i, implicit_rect, av_uninit(wmv9_mask); |
|
477 |
+ int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask); |
|
478 | 478 |
|
479 | 479 |
av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >= |
480 | 480 |
ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8); |
... | ... |
@@ -650,7 +650,14 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *data_size, |
650 | 650 |
return AVERROR_INVALIDDATA; |
651 | 651 |
|
652 | 652 |
buf_size -= bytestream2_tell(&gB); |
653 |
- } else if (is_rle) { |
|
653 |
+ } else { |
|
654 |
+ if (keyframe) { |
|
655 |
+ c->corrupted = 0; |
|
656 |
+ ff_mss12_slicecontext_reset(&ctx->sc[0]); |
|
657 |
+ if (c->slice_split) |
|
658 |
+ ff_mss12_slicecontext_reset(&ctx->sc[1]); |
|
659 |
+ } |
|
660 |
+ if (is_rle) { |
|
654 | 661 |
init_get_bits(&gb, buf, buf_size * 8); |
655 | 662 |
if (ret = decode_rle(&gb, c->pal_pic, c->pal_stride, |
656 | 663 |
c->rgb_pic, c->rgb_stride, c->pal, keyframe, |
... | ... |
@@ -669,14 +676,8 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *data_size, |
669 | 669 |
align_get_bits(&gb); |
670 | 670 |
buf += get_bits_count(&gb) >> 3; |
671 | 671 |
buf_size -= get_bits_count(&gb) >> 3; |
672 |
- } else { |
|
673 |
- if (keyframe) { |
|
674 |
- c->corrupted = 0; |
|
675 |
- ff_mss12_slicecontext_reset(&ctx->sc[0]); |
|
676 |
- if (c->slice_split) |
|
677 |
- ff_mss12_slicecontext_reset(&ctx->sc[1]); |
|
678 |
- } |
|
679 |
- else if (c->corrupted) |
|
672 |
+ } else if (!implicit_rect || wmv9_mask != -1) { |
|
673 |
+ if (c->corrupted) |
|
680 | 674 |
return AVERROR_INVALIDDATA; |
681 | 675 |
bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING); |
682 | 676 |
arith2_init(&acoder, &gB); |
... | ... |
@@ -702,6 +703,8 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *data_size, |
702 | 702 |
buf += arith2_get_consumed_bytes(&acoder); |
703 | 703 |
buf_size -= arith2_get_consumed_bytes(&acoder); |
704 | 704 |
} |
705 |
+ } else |
|
706 |
+ memset(c->pal_pic, 0, c->pal_stride * avctx->height); |
|
705 | 707 |
} |
706 | 708 |
|
707 | 709 |
if (has_wmv9) { |