Commit af8804ac authored by Benoit Fouet's avatar Benoit Fouet Committed by Michael Niedermayer

avcodec/pngdec: allow for some code path optimizations.

Use 'if (CONFIG_APNG_DECODER)' where needed, so that the compiler can
optimize out some portion of code.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent aff50ae1
...@@ -949,7 +949,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, ...@@ -949,7 +949,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
for (;;) { for (;;) {
length = bytestream2_get_bytes_left(&s->gb); length = bytestream2_get_bytes_left(&s->gb);
if (length <= 0) { if (length <= 0) {
if (avctx->codec_id == AV_CODEC_ID_APNG && length == 0) { if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && length == 0) {
if (!(s->state & PNG_IDAT)) if (!(s->state & PNG_IDAT))
return 0; return 0;
else else
...@@ -984,14 +984,14 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, ...@@ -984,14 +984,14 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
goto fail; goto fail;
break; break;
case MKTAG('f', 'c', 'T', 'L'): case MKTAG('f', 'c', 'T', 'L'):
if (avctx->codec_id != AV_CODEC_ID_APNG) if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)
goto skip_tag; goto skip_tag;
if ((ret = decode_fctl_chunk(avctx, s, length)) < 0) if ((ret = decode_fctl_chunk(avctx, s, length)) < 0)
goto fail; goto fail;
decode_next_dat = 1; decode_next_dat = 1;
break; break;
case MKTAG('f', 'd', 'A', 'T'): case MKTAG('f', 'd', 'A', 'T'):
if (avctx->codec_id != AV_CODEC_ID_APNG) if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)
goto skip_tag; goto skip_tag;
if (!decode_next_dat) if (!decode_next_dat)
goto fail; goto fail;
...@@ -999,7 +999,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, ...@@ -999,7 +999,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
length -= 4; length -= 4;
/* fallthrough */ /* fallthrough */
case MKTAG('I', 'D', 'A', 'T'): case MKTAG('I', 'D', 'A', 'T'):
if (avctx->codec_id == AV_CODEC_ID_APNG && !decode_next_dat) if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && !decode_next_dat)
goto skip_tag; goto skip_tag;
if (decode_idat_chunk(avctx, s, length, p) < 0) if (decode_idat_chunk(avctx, s, length, p) < 0)
goto fail; goto fail;
......
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