[FFmpeg-cvslog] avcodec/ivi: Only clip samples when needed in ivi_output_plane()

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


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Aug  4 02:31:58 2018 +0200| [82920bf49434d14ed0144319f785cc74a1534fc5] | committer: Michael Niedermayer

avcodec/ivi: Only clip samples when needed in ivi_output_plane()

435740 -> 396078 dezicycles

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

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

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

diff --git a/libavcodec/ivi.c b/libavcodec/ivi.c
index cea40d82ca..ebb7f03007 100644
--- a/libavcodec/ivi.c
+++ b/libavcodec/ivi.c
@@ -913,8 +913,15 @@ static void ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, ptrdiff_t dst_pi
         return;
 
     for (y = 0; y < plane->height; y++) {
-        for (x = 0; x < plane->width; x++)
-            dst[x] = av_clip_uint8(src[x] + 128);
+        int m = 0;
+        for (x = 0; x < plane->width; x++) {
+            int t = src[x] + 128;
+            dst[x] = t;
+            m |= t;
+        }
+        if (m & ~255)
+            for (x = 0; x < plane->width; x++)
+                dst[x] = av_clip_uint8(src[x] + 128);
         src += pitch;
         dst += dst_pitch;
     }



More information about the ffmpeg-cvslog mailing list