diff options
| author | JMC47 <JMC4789@gmail.com> | 2022-07-17 00:07:50 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-17 00:07:50 -0400 |
| commit | f1d23ff9a48ce866f9cd391d32eacb4bfb1c244e (patch) | |
| tree | 1dcb1a30c58a973c881092525eb797c6b1e635f5 /Source/Core/VideoBackends/Software/EfbInterface.cpp | |
| parent | 2ef069e0e861e275497854e0fe2d19f0c333850a (diff) | |
| parent | a6e06f38adb933187605ac07ef7a0cb1940afa80 (diff) | |
Merge pull request #10466 from Pokechu22/efb-copy-gamma
Accurately handle the copy filter and gamma for EFB and XFB copies
Diffstat (limited to 'Source/Core/VideoBackends/Software/EfbInterface.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Software/EfbInterface.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp index 1e5498e28a..399e0bb57f 100644 --- a/Source/Core/VideoBackends/Software/EfbInterface.cpp +++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp @@ -535,9 +535,14 @@ static yuv444 ConvertColorToYUV(u32 color) // GameCube/Wii uses the BT.601 standard algorithm for converting to YCbCr; see // http://www.equasys.de/colorconversion.html#YCbCr-RGBColorFormatConversion - return {static_cast<u8>(0.257f * red + 0.504f * green + 0.098f * blue), - static_cast<s8>(-0.148f * red + -0.291f * green + 0.439f * blue), - static_cast<s8>(0.439f * red + -0.368f * green + -0.071f * blue)}; + // These numbers were determined by hardware testing + const u16 y = +66 * red + 129 * green + +25 * blue; + const s16 u = -38 * red + -74 * green + 112 * blue; + const s16 v = 112 * red + -94 * green + -18 * blue; + const u8 y_round = static_cast<u8>((y >> 8) + ((y >> 7) & 1)); + const s8 u_round = static_cast<s8>((u >> 8) + ((u >> 7) & 1)); + const s8 v_round = static_cast<s8>((v >> 8) + ((v >> 7) & 1)); + return {y_round, u_round, v_round}; } u32 GetDepth(u16 x, u16 y) |
