From affb6a38a198d410922492026e5277794a310279 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 18 May 2011 09:41:08 -0400 Subject: GRAPHICS: Add some docs and sanity checks to the YUV to RGB code --- graphics/yuv_to_rgb.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'graphics/yuv_to_rgb.cpp') diff --git a/graphics/yuv_to_rgb.cpp b/graphics/yuv_to_rgb.cpp index b1107a7475..831736cd75 100644 --- a/graphics/yuv_to_rgb.cpp +++ b/graphics/yuv_to_rgb.cpp @@ -203,6 +203,13 @@ namespace Graphics { *((uint32 *)(d)) = (L[cr_r] | L[crb_g] | L[cb_b]) void convertYUV420ToRGB(Graphics::Surface *dst, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) { + // Sanity checks + assert(dst && dst->pixels); + assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4); + assert(ySrc && uSrc && vSrc); + assert((yWidth & 1) == 0); + assert((yHeight & 1) == 0); + const YUVToRGBLookup *lookup = YUVToRGBMan.getLookup(dst->format); byte *dstPtr = (byte *)dst->pixels; -- cgit v1.2.3