From e0b8fff6c7a293e35079ba1931bd19372686b3f6 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 29 Jun 2011 21:04:45 -0700 Subject: swscale: fix yuv range correction when using 16-bit scaling. --- libswscale/swscale.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libswscale') diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 987afff2d2..644f84858c 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1982,8 +1982,8 @@ static void chrRangeToJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width) int32_t *dstU = (int32_t *) _dstU; int32_t *dstV = (int32_t *) _dstV; for (i = 0; i < width; i++) { - dstU[i] = (FFMIN(dstU[i],30775)*4663 - 9289992)>>12; //-264 - dstV[i] = (FFMIN(dstV[i],30775)*4663 - 9289992)>>12; //-264 + dstU[i] = (FFMIN(dstU[i],30775<<4)*4663 - (9289992<<4))>>12; //-264 + dstV[i] = (FFMIN(dstV[i],30775<<4)*4663 - (9289992<<4))>>12; //-264 } } static void chrRangeFromJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width) @@ -1992,8 +1992,8 @@ static void chrRangeFromJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width) int32_t *dstU = (int32_t *) _dstU; int32_t *dstV = (int32_t *) _dstV; for (i = 0; i < width; i++) { - dstU[i] = (dstU[i]*1799 + 4081085)>>11; //1469 - dstV[i] = (dstV[i]*1799 + 4081085)>>11; //1469 + dstU[i] = (dstU[i]*1799 + (4081085<<4))>>11; //1469 + dstV[i] = (dstV[i]*1799 + (4081085<<4))>>11; //1469 } } static void lumRangeToJpeg16_c(int16_t *_dst, int width) @@ -2001,14 +2001,14 @@ static void lumRangeToJpeg16_c(int16_t *_dst, int width) int i; int32_t *dst = (int32_t *) _dst; for (i = 0; i < width; i++) - dst[i] = (FFMIN(dst[i],30189)*19077 - 39057361)>>14; + dst[i] = (FFMIN(dst[i],30189<<4)*19077 - (39057361<<4))>>14; } static void lumRangeFromJpeg16_c(int16_t *_dst, int width) { int i; int32_t *dst = (int32_t *) _dst; for (i = 0; i < width; i++) - dst[i] = (dst[i]*14071 + 33561947)>>14; + dst[i] = (dst[i]*14071 + (33561947<<4))>>14; } static void hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth, -- cgit v1.2.3 From 705b21a06ed357ed2b432b967c4fcb09fb992d02 Mon Sep 17 00:00:00 2001 From: Mohamed Naufal Date: Thu, 30 Jun 2011 11:57:32 +0300 Subject: swscale: Unbreak build with --enable-small MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes building with --enable-small, by using the correct variable name. Signed-off-by: Martin Storsjö --- libswscale/swscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libswscale') diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 644f84858c..1e4994ca6b 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -977,7 +977,7 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, const uint32_t *b = (const uint32_t *) _b; #if CONFIG_SMALL - int sh = hasAlpha ? ((fmt == PIX_FMT_RGB32_1 || fmt == PIX_FMT_BGR32_1) ? 0 : 24) : 0; + int sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0); -- cgit v1.2.3 From 81cc7d0bd1eab0aa782ff8dd49e087025a42cdee Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 30 Jun 2011 07:05:52 -0700 Subject: swscale: fix another yuv range conversion overflow in 16bit scaling. --- libswscale/swscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libswscale') diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 1e4994ca6b..ef8fc39c48 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -2001,7 +2001,7 @@ static void lumRangeToJpeg16_c(int16_t *_dst, int width) int i; int32_t *dst = (int32_t *) _dst; for (i = 0; i < width; i++) - dst[i] = (FFMIN(dst[i],30189<<4)*19077 - (39057361<<4))>>14; + dst[i] = (FFMIN(dst[i],30189<<4)*4769 - (39057361<<2))>>12; } static void lumRangeFromJpeg16_c(int16_t *_dst, int width) { -- cgit v1.2.3