[FFmpeg-cvslog] avcodec/gdv: Optimize 2x scaling loop a little in gdv_decode_frame()

Michael Niedermayer git at videolan.org
Fri Sep 28 02:29:36 EEST 2018


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Aug  5 17:12:33 2018 +0200| [510bd61941548b653ae446ede199013d9af01257] | committer: Michael Niedermayer

avcodec/gdv: Optimize 2x scaling loop a little in gdv_decode_frame()

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

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

 libavcodec/gdv.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c
index 1623febd1a..d497f76157 100644
--- a/libavcodec/gdv.c
+++ b/libavcodec/gdv.c
@@ -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)) {



More information about the ffmpeg-cvslog mailing list