[FFmpeg-devel] [PATCH] avcodec/pngdec: allow for some code path optimizations.

2014-11-28 Thread Benoit Fouet
Use 'if (CONFIG_APNG_DECODER)' where needed, so that the compiler can
optimize out some portion of code.
---
 libavcodec/pngdec.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index da852c4..a330d36 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -949,7 +949,7 @@ static int decode_frame_common(AVCodecContext *avctx, 
PNGDecContext *s,
 for (;;) {
 length = bytestream2_get_bytes_left(s-gb);
 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))
 return 0;
 else
@@ -984,14 +984,14 @@ static int decode_frame_common(AVCodecContext *avctx, 
PNGDecContext *s,
 goto fail;
 break;
 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;
 if ((ret = decode_fctl_chunk(avctx, s, length))  0)
 goto fail;
 decode_next_dat = 1;
 break;
 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;
 if (!decode_next_dat)
 goto fail;
@@ -999,7 +999,7 @@ static int decode_frame_common(AVCodecContext *avctx, 
PNGDecContext *s,
 length -= 4;
 /* fallthrough */
 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;
 if (decode_idat_chunk(avctx, s, length, p)  0)
 goto fail;
-- 
2.2.0.rc2.23.gca0107e

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/pngdec: allow for some code path optimizations.

2014-11-28 Thread Michael Niedermayer
On Fri, Nov 28, 2014 at 02:03:08PM +0100, Benoit Fouet wrote:
 Use 'if (CONFIG_APNG_DECODER)' where needed, so that the compiler can
 optimize out some portion of code.
 ---
  libavcodec/pngdec.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

applied

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
Rare item - Common item with rare defect or maybe just a lie
Professional - 'Toy' made in china, not functional except as doorstop
Experts will know - The seller hopes you are not an expert


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel