[FFmpeg-cvslog] utvideoenc: optimize and simplify mangle_rgb_planes

Michael Niedermayer git at videolan.org
Wed Aug 22 16:56:08 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Aug 22 02:47:32 2012 +0200| [4fced11df73fb1921f60660b5b0f319bb4e723ec] | committer: Michael Niedermayer

utvideoenc: optimize and simplify mangle_rgb_planes

Reviewed-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/utvideoenc.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
index f3ba739..95205ea 100644
--- a/libavcodec/utvideoenc.c
+++ b/libavcodec/utvideoenc.c
@@ -196,16 +196,13 @@ static void mangle_rgb_planes(uint8_t *src, int step, int stride, int width,
                               int height)
 {
     int i, j;
-    uint8_t r, g, b;
+    unsigned g;
 
     for (j = 0; j < height; j++) {
         for (i = 0; i < width * step; i += step) {
-            r = src[i];
-            g = src[i + 1];
-            b = src[i + 2];
-
-            src[i]     = r - g + 0x80;
-            src[i + 2] = b - g + 0x80;
+            g           = src[i + 1] + 0x80;
+            src[i]     -= g;
+            src[i + 2] -= g;
         }
         src += stride;
     }



More information about the ffmpeg-cvslog mailing list