[FFmpeg-cvslog] avcodec/tiff: Factor constant computation out of inner loop

Michael Niedermayer git at videolan.org
Tue Apr 11 19:01:44 EEST 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Apr 11 03:37:35 2017 +0200| [cd8e62746fedd1f593a9d441bd3a4ea137c919bb] | committer: Michael Niedermayer

avcodec/tiff: Factor constant computation out of inner loop

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd8e62746fedd1f593a9d441bd3a4ea137c919bb
---

 libavcodec/tiff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 3aaf63338d..cb1a34e73a 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1362,10 +1362,11 @@ static int decode_frame(AVCodecContext *avctx,
         }
 
         if (s->photometric == TIFF_PHOTOMETRIC_WHITE_IS_ZERO) {
+            int c = (s->avctx->pix_fmt == AV_PIX_FMT_PAL8 ? (1<<s->bpp) - 1 : 255);
             dst = p->data[plane];
             for (i = 0; i < s->height; i++) {
                 for (j = 0; j < stride; j++)
-                    dst[j] = (s->avctx->pix_fmt == AV_PIX_FMT_PAL8 ? (1<<s->bpp) - 1 : 255) - dst[j];
+                    dst[j] = c - dst[j];
                 dst += stride;
             }
         }



More information about the ffmpeg-cvslog mailing list