diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2011-05-25 15:28:12 -0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-05-26 09:31:27 -0400 |
commit | 48520772d9eba9725382be612f1dcd87d2fda2e6 (patch) | |
tree | 933aa51b843fde1d6411b19c7e163c6a6f51bf2a | |
parent | 0f4eb8b04341081591bf401eaa2c07d6bc3ff52e (diff) | |
download | ffmpeg-48520772d9eba9725382be612f1dcd87d2fda2e6.tar.gz |
swscale: use av_clip_uint8() in yuv2yuv1_c().
-rw-r--r-- | 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 435f1a200f..29836f123a 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -52,29 +52,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=(chrUSrc[i]+64)>>7; int v=(chrVSrc[i]+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) |