From 07e87efe3806cdacb3637913d7ac4bbaa568327d Mon Sep 17 00:00:00 2001 From: dborth Date: Wed, 22 Jul 2009 07:01:09 +0000 Subject: [PATCH] --- source/ngc/gcvideo.cpp | 16 ++++++++++++++-- source/ngc/videofilter.cpp | 21 --------------------- source/ngc/videofilter.h | 3 --- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/source/ngc/gcvideo.cpp b/source/ngc/gcvideo.cpp index aec2cbf..c75a564 100644 --- a/source/ngc/gcvideo.cpp +++ b/source/ngc/gcvideo.cpp @@ -54,6 +54,7 @@ static Mtx GXmodelView2D; /*** Texture memory ***/ static unsigned char texturemem[TEX_WIDTH * TEX_HEIGHT * 4] ATTRIBUTE_ALIGN (32); unsigned char filtermem[TEX_WIDTH * TEX_HEIGHT * 4] ATTRIBUTE_ALIGN (32); +unsigned char filtermem2[TEX_WIDTH * TEX_HEIGHT * 4] ATTRIBUTE_ALIGN (32); static int UpdateVideo = 1; static int vmode_60hz = 0; @@ -669,6 +670,9 @@ ResetVideo_Emu () void RenderFrame(unsigned char *XBuf) { + if(!XBuf) + return; + // Ensure previous vb has complete while ((LWP_ThreadIsSuspended (vbthread) == 0) || (copynow == GX_TRUE)) usleep (50); @@ -696,8 +700,16 @@ void RenderFrame(unsigned char *XBuf) if (GCSettings.FilterMethod != FILTER_NONE) { - FilterMethod ((uint8*) XBuf, 272, (uint8*) filtermem, TEX_WIDTH*fscale*2, TEX_WIDTH, TEX_HEIGHT); - MakeTexture565((char *)filtermem, (char *) texturemem, TEX_WIDTH*fscale, TEX_HEIGHT*fscale); + // convert to 16 bpp + uint8 *src = (uint8 *)XBuf; + uint16 * dst = (uint16 *)filtermem; + + for (height = 0; height < TEX_HEIGHT; height++) + for (width = 0; width < TEX_WIDTH; width++) + *dst++ = rgb565[*src++]; + + FilterMethod ((uint8*) filtermem, TEX_WIDTH*2, (uint8*) filtermem2, TEX_WIDTH*fscale*2, TEX_WIDTH, TEX_HEIGHT); + MakeTexture565((char *)filtermem2, (char *) texturemem, TEX_WIDTH*fscale, TEX_HEIGHT*fscale); } else { diff --git a/source/ngc/videofilter.cpp b/source/ngc/videofilter.cpp index e98d489..f816e34 100644 --- a/source/ngc/videofilter.cpp +++ b/source/ngc/videofilter.cpp @@ -34,19 +34,6 @@ TFilterMethod FilterMethod = RenderPlain; // Functions: // -bool -GetFilterHiResSupport (RenderFilter filterID) -{ - switch(filterID) - { - case FILTER_NONE: - return true; - - default: - return false; - } -} - const char* GetFilterName (RenderFilter filterID) { @@ -224,17 +211,10 @@ void InitLUTs(void) for (c = 0 ; c < (1<> 3; r = (int)((c & 0xF800)) >> 8; -//#else -// b = (int)((c & 0x1F)) << 3; -// g = (int)((c & 0x3E0)) >> 2; -// r = (int)((c & 0x7C00)) >> 7; -//#endif - RGBtoBright[c] = r+r+r + g+g+g + b+b; y = (int)( 0.256788f*r + 0.504129f*g + 0.097906f*b + 0.5f) + 16; @@ -242,7 +222,6 @@ void InitLUTs(void) v = (int)( 0.439216f*r - 0.367788f*g - 0.071427f*b + 0.5f) + 128; RGBtoYUV[c] = (y << 16) + (u << 8) + v; - } } diff --git a/source/ngc/videofilter.h b/source/ngc/videofilter.h index e8437d9..c6b4404 100644 --- a/source/ngc/videofilter.h +++ b/source/ngc/videofilter.h @@ -41,7 +41,6 @@ enum RenderFilter { typedef void (*TFilterMethod)(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); extern TFilterMethod FilterMethod; -extern TFilterMethod FilterMethodHiRes; extern unsigned char filtermem[]; @@ -50,10 +49,8 @@ extern unsigned char filtermem[]; // void SelectFilterMethod (); void RenderPlain (uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); -void SelectFilterMethod (); TFilterMethod FilterToMethod (RenderFilter filterID); const char* GetFilterName (RenderFilter filterID); -bool GetFilterHiResSupport (RenderFilter filterID); int GetFilterScale(RenderFilter filterID); template void RenderHQ2X (uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); void InitLUTs();