]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/ivi: Only clip samples when needed in ivi_output_plane()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 4 Aug 2018 00:31:58 +0000 (02:31 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 12 Aug 2018 19:48:11 +0000 (21:48 +0200)
435740 -> 396078 dezicycles

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ivi.c

index cea40d82ca211edeaff4bcf278b22ebbb3803a13..ebb7f03007eb4f9c51133e1878360b06f602bd89 100644 (file)
@@ -913,8 +913,15 @@ static void ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, ptrdiff_t dst_pi
         return;
 
     for (y = 0; y < plane->height; y++) {
-        for (x = 0; x < plane->width; x++)
-            dst[x] = av_clip_uint8(src[x] + 128);
+        int m = 0;
+        for (x = 0; x < plane->width; x++) {
+            int t = src[x] + 128;
+            dst[x] = t;
+            m |= t;
+        }
+        if (m & ~255)
+            for (x = 0; x < plane->width; x++)
+                dst[x] = av_clip_uint8(src[x] + 128);
         src += pitch;
         dst += dst_pitch;
     }