From 028bc21f0576ebbe00b4cdd090f0caacda0d00c9 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sat, 28 Feb 2015 03:42:03 +0000 Subject: [PATCH] Add -128 into the YUV to RGB conversion macro --- lib/PlaYUVerFramePixelFormats.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PlaYUVerFramePixelFormats.h b/lib/PlaYUVerFramePixelFormats.h index b3439ea..0624abe 100644 --- a/lib/PlaYUVerFramePixelFormats.h +++ b/lib/PlaYUVerFramePixelFormats.h @@ -34,9 +34,9 @@ namespace plaYUVer #define CLAMP(X) X = X < 0 ? 0 : X > 255 ? 255 : X; #define YUV2RGB( iY, iU, iV, iR, iG, iB ) \ - iR = iY + ( ( 1436 * iV ) >> 10 ); \ - iG = iY - ( ( 352 * iU + 731 * iV ) >> 10 ); \ - iB = iY + ( ( 1812 * iU ) >> 10 ); \ + iR = iY + ( ( 1436 * ( iV - 128) ) >> 10 ); \ + iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 ); \ + iB = iY + ( ( 1812 * ( iU - 128 ) ) >> 10 ); \ CLAMP(iR) CLAMP(iG) CLAMP(iB) static inline Void rgbToYuv( Int iR, Int iG, Int iB, Int &iY, Int &iU, Int &iV )