[FFmpeg-cvslog] avcodec/ivi: Factor width dereference out of the loops in ivi_output_plane()

Michael Niedermayer git at videolan.org
Sun Aug 12 23:16:57 EEST 2018


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Aug  4 02:34:11 2018 +0200| [bf97d11b0881aae26410cb938c2bdd53585e7398] | committer: Michael Niedermayer

avcodec/ivi: Factor width dereference out of the loops in ivi_output_plane()

396078 -> 268468 dezicycles

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

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

 libavcodec/ivi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ivi.c b/libavcodec/ivi.c
index ebb7f03007..b23d4af27e 100644
--- a/libavcodec/ivi.c
+++ b/libavcodec/ivi.c
@@ -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;



More information about the ffmpeg-cvslog mailing list