# HG changeset patch # User William Roberts # Date 1271777890 -3600 # Node ID 3aa07f06a4b7a07adaf07128345dfee257ab2da5 # Parent 76efc8f9f7b47002220d51e5b7cb0e9e95f64de4 Apply Faisal's second patch from Bug 2354, plus a missing "break" statement - Add YUV support diff -r 76efc8f9f7b4 -r 3aa07f06a4b7 graphicscomposition/openwfcompositionengine/adaptation/src/Platform/Graphics/symbian/owfnativestreamstub.cpp --- a/graphicscomposition/openwfcompositionengine/adaptation/src/Platform/Graphics/symbian/owfnativestreamstub.cpp Tue Apr 20 16:24:43 2010 +0100 +++ b/graphicscomposition/openwfcompositionengine/adaptation/src/Platform/Graphics/symbian/owfnativestreamstub.cpp Tue Apr 20 16:38:10 2010 +0100 @@ -94,6 +94,11 @@ bytesPerPixel = -8; b.iAlignment = max(4,format->rowPadding); break; + case OWF_IMAGE_UYVY: + b.iPixelFormat = EUidPixelFormatYUV_422Interleaved; + bytesPerPixel = 1; + b.iAlignment = max(4,format->rowPadding); + break; default: return surface; } @@ -291,6 +296,13 @@ aFormat.rowPadding = 4; aFormat.pixelFormat = OWF_IMAGE_L1; break; + + case EUidPixelFormatYUV_422Interleaved : + aFormat.linear = OWF_FALSE; + aFormat.premultiplied = OWF_FALSE; + aFormat.rowPadding = 1; + aFormat.pixelFormat = OWF_IMAGE_UYVY; + break; default: aFormat.linear = OWF_FALSE; aFormat.premultiplied = OWF_FALSE; diff -r 76efc8f9f7b4 -r 3aa07f06a4b7 graphicscomposition/openwfcompositionengine/common/include/owfimage.h --- a/graphicscomposition/openwfcompositionengine/common/include/owfimage.h Tue Apr 20 16:24:43 2010 +0100 +++ b/graphicscomposition/openwfcompositionengine/common/include/owfimage.h Tue Apr 20 16:38:10 2010 +0100 @@ -31,6 +31,7 @@ typedef void* OWF_DISPCTX; +#define CLIP(a) if (a < 0) a = 0; else if (a > 255) a = 255; #undef USE_FLOAT_PIXEL @@ -201,6 +202,7 @@ OWFpixel* tsColor; } OWF_BLEND_INFO; +#define CLIP(a) if (a < 0) a = 0; else if (a > 255) a = 255; /*!--------------------------------------------------------------------------- * \brief Initialize image object diff -r 76efc8f9f7b4 -r 3aa07f06a4b7 graphicscomposition/openwfcompositionengine/common/include/owftypes.h --- a/graphicscomposition/openwfcompositionengine/common/include/owftypes.h Tue Apr 20 16:24:43 2010 +0100 +++ b/graphicscomposition/openwfcompositionengine/common/include/owftypes.h Tue Apr 20 16:38:10 2010 +0100 @@ -73,6 +73,7 @@ OWF_IMAGE_L16 = 0xA16, OWF_IMAGE_L8 = 0xA8, OWF_IMAGE_L1 = 0xA1, + OWF_IMAGE_UYVY = 0x422, /* EUidPixelFormatYUV_422Interleaved */ OWF_IMAGE_ARGB_INTERNAL = 0x666 /* OWFpixel rep */ } OWF_PIXEL_FORMAT; diff -r 76efc8f9f7b4 -r 3aa07f06a4b7 graphicscomposition/openwfcompositionengine/common/src/owfimage.c --- a/graphicscomposition/openwfcompositionengine/common/src/owfimage.c Tue Apr 20 16:24:43 2010 +0100 +++ b/graphicscomposition/openwfcompositionengine/common/src/owfimage.c Tue Apr 20 16:38:10 2010 +0100 @@ -370,7 +370,49 @@ } break; } - + case OWF_IMAGE_UYVY: + { + OWFuint8* srcPtr = (OWFuint8*) srcLinePtr; + OWFint y,u,v,r,g,b,x; + for (x = 0; x < count; x++) + { + u = srcPtr[0] - 128; + v = srcPtr[2] - 128; + y = srcPtr[3] - 16; + + r = ((298 * y + 409 * u) / 256); + g = ((298 * y - 100 * v - 208 * u) / 256); + b = ((298 * y + 516 * v) / 256); + + CLIP(r); + CLIP(g); + CLIP(b); + + dstPtr->color.alpha = 255; + dstPtr->color.red = r; + dstPtr->color.green = g; + dstPtr->color.blue = b; + dstPtr++; + + y = srcPtr[1] - 16; + r = ((298 * y + 409 * u) / 256); + g = ((298 * y - 100 * v - 208 * u) / 256); + b = ((298 * y + 516 * v) / 256); + + CLIP(r); + CLIP(g); + CLIP(b); + + dstPtr->color.alpha = 255; + dstPtr->color.red = r; + dstPtr->color.green = g; + dstPtr->color.blue = b; + dstPtr++; + srcPtr += 4; + } + break; + } + default: { return OWF_FALSE; /* source format not supported */ @@ -547,7 +589,49 @@ #endif break; } - + case OWF_IMAGE_UYVY: + { + OWFuint8* srcPtr = (OWFuint8*) srcLinePtr; + OWFint y,u,v,r,g,b,x; + for (x = 0; x < count; x++) + { + u = srcPtr[0] - 128; + v = srcPtr[2] - 128; + y = srcPtr[3] - 16; + + r = ((298 * y + 409 * u) / 256); + g = ((298 * y - 100 * v - 208 * u) / 256); + b = ((298 * y + 516 * v) / 256); + + CLIP(r); + CLIP(g); + CLIP(b); + + dstPtr->color.alpha = 255; + dstPtr->color.red = r; + dstPtr->color.green = g; + dstPtr->color.blue = b; + dstPtr++; + + y = srcPtr[1] - 16; + r = ((298 * y + 409 * u) / 256); + g = ((298 * y - 100 * v - 208 * u) / 256); + b = ((298 * y + 516 * v) / 256); + + CLIP(r); + CLIP(g); + CLIP(b); + + dstPtr->color.alpha = 255; + dstPtr->color.red = r; + dstPtr->color.green = g; + dstPtr->color.blue = b; + dstPtr++; + srcPtr += 4; + } + break; + } + default: { return OWF_FALSE; /* destination format not supported */ @@ -1797,6 +1881,7 @@ } case OWF_IMAGE_L8: + case OWF_IMAGE_UYVY: { return 1; } @@ -1852,6 +1937,7 @@ } case OWF_IMAGE_L8: + case OWF_IMAGE_UYVY: { padding = 1; break; diff -r 76efc8f9f7b4 -r 3aa07f06a4b7 graphicscomposition/openwfcompositionengine/group/openwfc.mmp --- a/graphicscomposition/openwfcompositionengine/group/openwfc.mmp Tue Apr 20 16:24:43 2010 +0100 +++ b/graphicscomposition/openwfcompositionengine/group/openwfc.mmp Tue Apr 20 16:38:10 2010 +0100 @@ -42,7 +42,7 @@ OPTION ARMCC -O3 -Otime --cpu 6 ALWAYS_BUILD_AS_ARM -OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_SYSTEMINCLUDE OS_LAYER_LIBC_SYSTEMINCLUDE MACRO HG_NO_ALLOCA_H MACRO EGL_DLL