From 09269fce8c61b8193b25266b681c7849a6ad058d Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 18 Sep 2012 15:54:45 -0400 Subject: GRAPHICS: Implement different luminance ranges Bink and Theora are now much improved --- graphics/yuv_to_rgb.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'graphics/yuv_to_rgb.h') diff --git a/graphics/yuv_to_rgb.h b/graphics/yuv_to_rgb.h index 3af3fe87e4..68a0449d2c 100644 --- a/graphics/yuv_to_rgb.h +++ b/graphics/yuv_to_rgb.h @@ -41,10 +41,17 @@ class YUVToRGBLookup; class YUVToRGBManager : public Common::Singleton { public: + /** The scale of the luminance values */ + enum LuminanceScale { + kScaleFull, /** Luminance values range from [0, 255] */ + kScaleITU /** Luminance values range from [16, 235], the range from ITU-R BT.601 */ + }; + /** * Convert a YUV444 image to an RGB surface * * @param dst the destination surface + * @param scale the scale of the luminance values * @param ySrc the source of the y component * @param uSrc the source of the u component * @param vSrc the source of the v component @@ -53,12 +60,13 @@ public: * @param yPitch the pitch of the y surface * @param uvPitch the pitch of the u and v surfaces */ - void convert444(Graphics::Surface *dst, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch); + void convert444(Graphics::Surface *dst, LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch); /** * Convert a YUV420 image to an RGB surface * * @param dst the destination surface + * @param scale the scale of the luminance values * @param ySrc the source of the y component * @param uSrc the source of the u component * @param vSrc the source of the v component @@ -67,7 +75,7 @@ public: * @param yPitch the pitch of the y surface * @param uvPitch the pitch of the u and v surfaces */ - void convert420(Graphics::Surface *dst, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch); + void convert420(Graphics::Surface *dst, LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch); /** * Convert a YUV410 image to an RGB surface @@ -78,6 +86,7 @@ public: * image (filled with 0x80). This is required in order to speed up this function. * * @param dst the destination surface + * @param scale the scale of the luminance values * @param ySrc the source of the y component * @param uSrc the source of the u component * @param vSrc the source of the v component @@ -86,16 +95,15 @@ public: * @param yPitch the pitch of the y surface * @param uvPitch the pitch of the u and v surfaces */ - void convert410(Graphics::Surface *dst, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch); + void convert410(Graphics::Surface *dst, LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch); private: friend class Common::Singleton; YUVToRGBManager(); ~YUVToRGBManager(); - const YUVToRGBLookup *getLookup(Graphics::PixelFormat format); + const YUVToRGBLookup *getLookup(Graphics::PixelFormat format, LuminanceScale scale); - Graphics::PixelFormat _lastFormat; YUVToRGBLookup *_lookup; int16 _colorTab[4 * 256]; // 2048 bytes }; -- cgit v1.2.3