avcodec/ivi: Factor width dereference out of the loops in ivi_output_plane()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 4 Aug 2018 00:34:11 +0000 (02:34 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 12 Aug 2018 19:48:15 +0000 (21:48 +0200)
396078 -> 268468 dezicycles

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

index ebb7f03..b23d4af 100644 (file)
@@ -914,13 +914,14 @@ static void ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, ptrdiff_t dst_pi
 
     for (y = 0; y < plane->height; y++) {
         int m = 0;
-        for (x = 0; x < plane->width; x++) {
+        int w = plane->width;
+        for (x = 0; x < w; x++) {
             int t = src[x] + 128;
             dst[x] = t;
             m |= t;
         }
         if (m & ~255)
-            for (x = 0; x < plane->width; x++)
+            for (x = 0; x < w; x++)
                 dst[x] = av_clip_uint8(src[x] + 128);
         src += pitch;
         dst += dst_pitch;