Use a variable instead of a repeated calculation when decoding AVUI.

pull/30/merge
Carl Eugen Hoyos 13 years ago
parent f1892348c2
commit 612abe2773
  1. 12
      libavcodec/avuidec.c

@ -43,7 +43,7 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data,
const uint8_t *src = avpkt->data; const uint8_t *src = avpkt->data;
const uint8_t *srca; const uint8_t *srca;
uint8_t *y, *u, *v, *a; uint8_t *y, *u, *v, *a;
int transparent, interlaced = 1, skip, i, j, k; int transparent, interlaced = 1, skip, opaque_length, i, j, k;
if (pic->data[0]) if (pic->data[0])
avctx->release_buffer(avctx, pic); avctx->release_buffer(avctx, pic);
@ -56,16 +56,14 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data,
} else { } else {
skip = 16; skip = 16;
} }
if (avpkt->size < 2 * avctx->width * (avctx->height + skip) opaque_length = 2 * avctx->width * (avctx->height + skip) + 4 * interlaced;
+ 4 * interlaced) { if (avpkt->size < opaque_length) {
av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n"); av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
transparent = avctx->bits_per_coded_sample == 32 && transparent = avctx->bits_per_coded_sample == 32 &&
avpkt->size >= 2 * (avctx->height + skip) * avpkt->size >= opaque_length * 2 + 4;
2 * avctx->width + 4 + 8 * interlaced; srca = src + opaque_length + 5;
srca = src + 2 * (avctx->height + skip) * avctx->width
+ 5 + interlaced * 4;
pic->reference = 0; pic->reference = 0;

Loading…
Cancel
Save