]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/gdv: Eliminate 50% of the reads in the first inner loop in rescale()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 5 Aug 2018 15:06:44 +0000 (17:06 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 27 Sep 2018 23:25:17 +0000 (01:25 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/gdv.c

index 595d8ff4e4cc9897f86bd1f6aa961c8cf8dbd860..aea15a88ef0131e10471ca19477e2ba0c212a51c 100644 (file)
@@ -85,9 +85,15 @@ static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, in
             int y = h - j - 1;
             uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
             uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>!!gdv->scale_h) * (w>>1);
-            for (x = w - 1; x >= 0; x--) {
+
+            for (x = w - 1; x >= 0 && !(x&1); x--) {
                 dst1[x] = src1[(x>>1)];
             }
+
+            for (x--; x >= 0; x-=2) {
+                dst1[x  ] =
+                dst1[x+1] = src1[(x>>1)];
+            }
         }
     } else if (gdv->scale_h) {
         for (j = 0; j < h; j++) {