avcodec/gdv: Optimize 2x scaling loop a little in gdv_decode_frame()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 5 Aug 2018 15:12:33 +0000 (17:12 +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 1623feb..d497f76 100644 (file)
@@ -481,8 +481,12 @@ static int gdv_decode_frame(AVCodecContext *avctx, void *data,
             if (!gdv->scale_v) {
                 memcpy(dst + didx, gdv->frame + sidx, avctx->width);
             } else {
-                for (x = 0; x < avctx->width; x++) {
-                    dst[didx + x] = gdv->frame[sidx + x/2];
+                for (x = 0; x < avctx->width - 1; x+=2) {
+                    dst[didx + x    ] =
+                    dst[didx + x + 1] = gdv->frame[sidx + (x>>1)];
+                }
+                for (; x < avctx->width; x++) {
+                    dst[didx + x] = gdv->frame[sidx + (x>>1)];
                 }
             }
             if (!gdv->scale_h || ((y & 1) == 1)) {