From a192a3bb3043c921ec897186c2a927b33050dffc Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Thu, 19 May 2016 10:16:26 +1200 Subject: [PATCH] While I'm here, fix some chroma sub-sampling bugs. RE4's brightness screen is actually very good for spotting these. Bug 1: Colors at the end of the scanlines are clamped, instead of a black border Bug 2: U and V color channels share coordinates, instead of being offset by a pixel. --- Source/Core/VideoBackends/Software/EfbInterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp index 12c208f70c..5d852e0ff9 100644 --- a/Source/Core/VideoBackends/Software/EfbInterface.cpp +++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp @@ -599,7 +599,7 @@ void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rec src_ptr[x + 1].Y = scanline[i + 1].Y + 16; // V[i] = 1/4 * V[i-1] + 1/2 * V[i] + 1/4 * V[i+1] src_ptr[x + 1].UV = - 128 + ((scanline[i].V + (scanline[i + 1].V << 1) + scanline[i + 2].V) >> 2); + 128 + ((scanline[i - 1].V + (scanline[i].V << 1) + scanline[i + 1].V) >> 2); } src_ptr += memory_stride; }