[FFmpeg-devel] [PATCH 1/7] utvideoenc: optimize and simplify mangle_rgb_planes

Michael Niedermayer michaelni at gmx.at
Wed Aug 22 16:26:43 CEST 2012


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/utvideoenc.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
index f3ba739..3c58ed6 100644
--- a/libavcodec/utvideoenc.c
+++ b/libavcodec/utvideoenc.c
@@ -196,16 +196,11 @@ static void mangle_rgb_planes(uint8_t *src, int step, int stride, int width,
                               int height)
 {
     int i, j;
-    uint8_t r, g, b;
-
     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;
+            unsigned g = src[i + 1] + 0x80;
+            src[i]     -= g;
+            src[i + 2] -= g;
         }
         src += stride;
     }
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list