[FFmpeg-cvslog] swscale: use av_clip_uint8() in yuv2yuv1_c().

Ronald S. Bultje git at videolan.org
Sun May 29 01:02:07 CEST 2011


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Wed May 25 15:28:12 2011 -0400| [9222dddb448789b138a106ed677f3c628c85a840] | committer: Michael Niedermayer

swscale: use av_clip_uint8() in yuv2yuv1_c().

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

 libswscale/swscale_template.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c
index 2957aa4..7078a99 100644
--- a/libswscale/swscale_template.c
+++ b/libswscale/swscale_template.c
@@ -49,29 +49,15 @@ static inline void yuv2yuv1_c(SwsContext *c, const int16_t *lumSrc,
     int i;
     for (i=0; i<dstW; i++) {
         int val= (lumSrc[i]+64)>>7;
-
-        if (val&256) {
-            if (val<0) val=0;
-            else       val=255;
-        }
-
-        dest[i]= val;
+        dest[i]= av_clip_uint8(val);
     }
 
     if (uDest)
         for (i=0; i<chrDstW; i++) {
             int u=(chrSrc[i       ]+64)>>7;
             int v=(chrSrc[i + VOFW]+64)>>7;
-
-            if ((u|v)&256) {
-                if (u<0)        u=0;
-                else if (u>255) u=255;
-                if (v<0)        v=0;
-                else if (v>255) v=255;
-            }
-
-            uDest[i]= u;
-            vDest[i]= v;
+            uDest[i]= av_clip_uint8(u);
+            vDest[i]= av_clip_uint8(v);
         }
 
     if (CONFIG_SWSCALE_ALPHA && aDest)



More information about the ffmpeg-cvslog mailing list