From 2abcc32bbd0ba350ea552925b04b0522d78e56fe Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Fri, 23 Aug 2013 00:07:21 +1200 Subject: [PATCH] Fixed a few issues bought up in code review. --- .../Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp | 14 ++++++-------- .../Plugin_VideoSoftware/Src/EfbInterface.cpp | 6 +++--- .../Plugin_VideoSoftware/Src/EfbInterface.h | 9 +++++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp index 3959942f83..5b858e61a8 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp @@ -53,8 +53,8 @@ namespace EfbCopy int left = bpmem.copyTexSrcXY.x; int top = bpmem.copyTexSrcXY.y; - int right = left + bpmem.copyTexSrcWH.x + 1; - int bottom = top + bpmem.copyTexSrcWH.y + 1; + int right = left + bpmem.copyTexSrcWH.x; + int bottom = top + bpmem.copyTexSrcWH.y; for (u16 y = top; y <= bottom; y++) { @@ -72,12 +72,10 @@ namespace EfbCopy rc.left = (int)bpmem.copyTexSrcXY.x; rc.top = (int)bpmem.copyTexSrcXY.y; - // Here Width+1 like Height, otherwise some textures are corrupted already since the native resolution. - rc.right = (int)(bpmem.copyTexSrcXY.x + bpmem.copyTexSrcWH.x + 1); - rc.bottom = (int)(bpmem.copyTexSrcXY.y + bpmem.copyTexSrcWH.y + 1); - - //if (bpmem.triggerEFBCopy.copy_to_xfb) - // DebugUtil::OnFrameEnd(); // FIXME: not actually frame end + // flipper represents the widths internally as last pixel minus starting pixel, so + // these are zero indexed. + rc.right = rc.left + (int)bpmem.copyTexSrcWH.x + 1; + rc.bottom = rc.top + (int)bpmem.copyTexSrcWH.y + 1; if (!g_bSkipCurrentFrame) { diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/EfbInterface.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/EfbInterface.cpp index 26c48bdd3d..446d9d8495 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/EfbInterface.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/EfbInterface.cpp @@ -536,13 +536,13 @@ namespace EfbInterface { // YU pixel xfb_in_ram[x].Y = scanline[i].Y; - // U[i] = 1/4 * U[i-1] + 1/2 * U[i] + 1/4 U[i+1] - // we add in 10 bit space so it will round more accurately + // we mix our color difrences in 10 bit space so it will round more accurately + // U[i] = 1/4 * U[i-1] + 1/2 * U[i] + 1/4 * U[i+1] xfb_in_ram[x].UV = 128 + ((scanline[i-1].U + (scanline[i].U << 1) + scanline[i+1].U) >> 2); // YV pixel xfb_in_ram[x+1].Y = scanline[i+1].Y; - // V[i] = 1/4 * V[i-1] + 1/2 * V[i] + 1/4 V[i+1] + // V[i] = 1/4 * V[i-1] + 1/2 * V[i] + 1/4 * V[i+1] xfb_in_ram[x+1].UV = 128 + ((scanline[i].V + (scanline[i+1].V << 1) + scanline[i+2].V) >> 2); } xfb_in_ram += 640; diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/EfbInterface.h b/Source/Plugins/Plugin_VideoSoftware/Src/EfbInterface.h index 0df8082e59..18807916d3 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/EfbInterface.h +++ b/Source/Plugins/Plugin_VideoSoftware/Src/EfbInterface.h @@ -11,10 +11,7 @@ namespace EfbInterface { const int DEPTH_BUFFER_START = EFB_WIDTH * EFB_HEIGHT * 3; - // color order is ABGR in order to emulate RGBA on little-endian hardware - enum { ALP_C, BLU_C, GRN_C, RED_C }; - - // packed so the compiler doesn't mess with alignment + // xfb color format - packed so the compiler doesn't mess with alignment #pragma pack(push,1) typedef struct { u8 Y; @@ -29,6 +26,10 @@ namespace EfbInterface s8 V; } yuv444; + enum { ALP_C, BLU_C, GRN_C, RED_C }; + + // color order is ABGR in order to emulate RGBA on little-endian hardware + // does full blending of an incoming pixel void BlendTev(u16 x, u16 y, u8 *color);