summaryrefslogtreecommitdiff
path: root/libavcodec/avuidec.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2012-05-19 20:05:21 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2012-05-19 20:07:28 +0200
commit612abe2773e72cc3942069c104294ab2223338eb (patch)
tree4e79ba370bec8df6cc94ce23d380562a2eabbd84 /libavcodec/avuidec.c
parentf1892348c22d879831fdf1a6fbe9e71506ddae22 (diff)
downloadffmpeg-612abe2773e72cc3942069c104294ab2223338eb.tar.gz
Use a variable instead of a repeated calculation when decoding AVUI.
Diffstat (limited to 'libavcodec/avuidec.c')
-rw-r--r--libavcodec/avuidec.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libavcodec/avuidec.c b/libavcodec/avuidec.c
index d6dac5713f..a1beb37e80 100644
--- a/libavcodec/avuidec.c
+++ b/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 *srca;
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])
avctx->release_buffer(avctx, pic);
@@ -56,16 +56,14 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data,
} else {
skip = 16;
}
- if (avpkt->size < 2 * avctx->width * (avctx->height + skip)
- + 4 * interlaced) {
+ opaque_length = 2 * avctx->width * (avctx->height + skip) + 4 * interlaced;
+ if (avpkt->size < opaque_length) {
av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n");
return AVERROR(EINVAL);
}
transparent = avctx->bits_per_coded_sample == 32 &&
- avpkt->size >= 2 * (avctx->height + skip) *
- 2 * avctx->width + 4 + 8 * interlaced;
- srca = src + 2 * (avctx->height + skip) * avctx->width
- + 5 + interlaced * 4;
+ avpkt->size >= opaque_length * 2 + 4;
+ srca = src + opaque_length + 5;
pic->reference = 0;