Commit afad6428 authored by bcoudurier's avatar bcoudurier

Fix interlaced vc-3 decoding, issue #1753

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22362 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent d0f9cb55
...@@ -126,12 +126,17 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si ...@@ -126,12 +126,17 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
ctx->mb_width = ctx->width>>4; ctx->mb_width = ctx->width>>4;
ctx->mb_height = buf[0x16d]; ctx->mb_height = buf[0x16d];
if (ctx->mb_height > 68) { dprintf(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height);
av_log(ctx->avctx, AV_LOG_ERROR, "mb height too big\n");
if ((ctx->height+15)>>4 == ctx->mb_height && ctx->picture.interlaced_frame)
ctx->height <<= 1;
if (ctx->mb_height > 68 ||
(ctx->mb_height<<ctx->picture.interlaced_frame) > (ctx->height+15)>>4) {
av_log(ctx->avctx, AV_LOG_ERROR, "mb height too big: %d\n", ctx->mb_height);
return -1; return -1;
} }
dprintf(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height);
for (i = 0; i < ctx->mb_height; i++) { for (i = 0; i < ctx->mb_height; i++) {
ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i<<2)); ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i<<2));
dprintf(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]); dprintf(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]);
...@@ -292,6 +297,13 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size, ...@@ -292,6 +297,13 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (dnxhd_decode_header(ctx, buf, buf_size, first_field) < 0) if (dnxhd_decode_header(ctx, buf, buf_size, first_field) < 0)
return -1; return -1;
if ((avctx->width || avctx->height) &&
(ctx->width != avctx->width || ctx->height != avctx->height)) {
av_log(avctx, AV_LOG_WARNING, "frame size changed: %dx%d -> %dx%d\n",
avctx->width, avctx->height, ctx->width, ctx->height);
first_field = 1;
}
avctx->pix_fmt = PIX_FMT_YUV422P; avctx->pix_fmt = PIX_FMT_YUV422P;
if (avcodec_check_dimensions(avctx, ctx->width, ctx->height)) if (avcodec_check_dimensions(avctx, ctx->width, ctx->height))
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment