[FFmpeg-cvslog] avcodec/utvideodec: Factor multiply out of inner loop

Michael Niedermayer git at videolan.org
Wed Jun 28 15:10:12 EEST 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Jun 27 21:47:35 2017 +0200| [850c6db97d1f78e7607952ab8b854a93a185319e] | committer: Michael Niedermayer

avcodec/utvideodec: Factor multiply out of inner loop

0.5% faster loop

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Reviewed-by: Steven Liu <lingjiujianke at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 22da8cda1c..40c12772b3 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -195,7 +195,8 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
 
         prev = 0x200;
         for (j = sstart; j < send; j++) {
-            for (i = 0; i < width * step; i += step) {
+            int ws = width * step;
+            for (i = 0; i < ws; i += step) {
                 pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3);
                 if (pix < 0) {
                     av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
@@ -299,7 +300,8 @@ static int decode_plane(UtvideoContext *c, int plane_no,
 
         prev = 0x80;
         for (j = sstart; j < send; j++) {
-            for (i = 0; i < width * step; i += step) {
+            int ws = width * step;
+            for (i = 0; i < ws; i += step) {
                 pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3);
                 if (pix < 0) {
                     av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");



More information about the ffmpeg-cvslog mailing list