aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-10 21:53:39 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-10 22:40:50 +0200
commitfc57959fd57dadfc9525f8b3e7acd2ed458185d3 (patch)
treef84da63596234a59519052a869c8f864af8b2ddb
parent83956309cc16b47fbf8548e8c5bcf67b8cd4b65f (diff)
downloadffmpeg-fc57959fd57dadfc9525f8b3e7acd2ed458185d3.tar.gz
avcodec/iff: Factorize av_pix_fmt_desc_get() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 9bcdb98839f3d883867d87c6425e67ed7bcc7149) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/iff.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index d93015c0c3..ce06b365fc 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -677,11 +677,15 @@ static int decode_frame(AVCodecContext *avctx,
const uint8_t *buf_end = buf + buf_size;
int y, plane, res;
GetByteContext gb;
+ const AVPixFmtDescriptor *desc;
if ((res = extract_header(avctx, avpkt)) < 0)
return res;
if ((res = ff_reget_buffer(avctx, s->frame)) < 0)
return res;
+
+ desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+
if (!s->init && avctx->bits_per_coded_sample <= 8 &&
avctx->pix_fmt == AV_PIX_FMT_PAL8) {
if ((res = cmap_read_palette(avctx, (uint32_t *)s->frame->data[1])) < 0)
@@ -721,7 +725,6 @@ static int decode_frame(AVCodecContext *avctx,
} else
return unsupported(avctx);
} else if (avctx->codec_tag == MKTAG('D', 'E', 'E', 'P')) {
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
int raw_width = avctx->width * (av_get_bits_per_pixel(desc) >> 3);
int x;
for (y = 0; y < avctx->height && buf < buf_end; y++) {
@@ -838,7 +841,6 @@ static int decode_frame(AVCodecContext *avctx,
} else
return unsupported(avctx);
} else if (avctx->codec_tag == MKTAG('D', 'E', 'E', 'P')) { // IFF-DEEP
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
if (av_get_bits_per_pixel(desc) == 32)
decode_deep_rle32(s->frame->data[0], buf, buf_size, avctx->width, avctx->height, s->frame->linesize[0]);
else
@@ -856,7 +858,6 @@ static int decode_frame(AVCodecContext *avctx,
break;
case 5:
if (avctx->codec_tag == MKTAG('D', 'E', 'E', 'P')) {
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
if (av_get_bits_per_pixel(desc) == 32)
decode_deep_tvdc32(s->frame->data[0], buf, buf_size, avctx->width, avctx->height, s->frame->linesize[0], s->tvdc);
else