VideoSoftware: Implement xfb copy filter (Deflickering/Brightness)

This commit is contained in:
Scott Mansell
2016-05-18 08:21:02 +12:00
committed by Stenzek
parent 0cd46f4d21
commit fc96479f12
5 changed files with 116 additions and 37 deletions

View File

@ -4,6 +4,7 @@
#pragma once
#include <array>
#include <string>
#include "Common/BitField.h"
@ -944,8 +945,8 @@ union UPE_Copy
{
u32 Hex;
BitField<0, 1, u32> clamp0; // if set clamp top
BitField<1, 1, u32> clamp1; // if set clamp bottom
BitField<0, 1, u32> clamp_top; // if set clamp top
BitField<1, 1, u32> clamp_bottom; // if set clamp bottom
BitField<2, 1, u32> yuv; // if set, color conversion from RGB to YUV
BitField<3, 4, u32> target_pixel_format; // realformat is (fmt/2)+((fmt&1)*8).... for some reason
// the msb is the lsb (pattern: cycling right shift)
@ -967,6 +968,27 @@ union UPE_Copy
}
};
union CopyFilterCoefficients
{
u64 Hex;
BitField<0, 6, u64> w0;
BitField<6, 6, u64> w1;
BitField<12, 6, u64> w2;
BitField<18, 6, u64> w3;
BitField<32, 6, u64> w4;
BitField<38, 6, u64> w5;
BitField<44, 6, u64> w6;
std::array<u8, 7> GetCoefficients() const
{
return {
static_cast<u8>(w0), static_cast<u8>(w1), static_cast<u8>(w2), static_cast<u8>(w3),
static_cast<u8>(w4), static_cast<u8>(w5), static_cast<u8>(w6),
};
}
};
union BPU_PreloadTileInfo
{
u32 hex;
@ -1036,29 +1058,29 @@ struct BPMemory
// 2 channel, 16 when dest is RGBA
// also, doubles whenever mipmap box filter option is set (excent on RGBA). Probably to do with
// number of bytes to look at when smoothing
u32 dispcopyyscale; // 4e
u32 clearcolorAR; // 4f
u32 clearcolorGB; // 50
u32 clearZValue; // 51
UPE_Copy triggerEFBCopy; // 52
u32 copyfilter[2]; // 53,54
u32 boundbox0; // 55
u32 boundbox1; // 56
u32 unknown7[2]; // 57,58
X10Y10 scissorOffset; // 59
u32 unknown8[6]; // 5a,5b,5c,5d, 5e,5f
BPS_TmemConfig tmem_config; // 60-66
u32 metric; // 67
FieldMode fieldmode; // 68
u32 unknown10[7]; // 69-6F
u32 unknown11[16]; // 70-7F
FourTexUnits tex[2]; // 80-bf
TevStageCombiner combiners[16]; // 0xC0-0xDF
TevReg tevregs[4]; // 0xE0
FogRangeParams fogRange; // 0xE8
FogParams fog; // 0xEE,0xEF,0xF0,0xF1,0xF2
AlphaTest alpha_test; // 0xF3
ZTex1 ztex1; // 0xf4,0xf5
u32 dispcopyyscale; // 4e
u32 clearcolorAR; // 4f
u32 clearcolorGB; // 50
u32 clearZValue; // 51
UPE_Copy triggerEFBCopy; // 52
CopyFilterCoefficients copyfilter; // 53,54
u32 boundbox0; // 55
u32 boundbox1; // 56
u32 unknown7[2]; // 57,58
X10Y10 scissorOffset; // 59
u32 unknown8[6]; // 5a,5b,5c,5d, 5e,5f
BPS_TmemConfig tmem_config; // 60-66
u32 metric; // 67
FieldMode fieldmode; // 68
u32 unknown10[7]; // 69-6F
u32 unknown11[16]; // 70-7F
FourTexUnits tex[2]; // 80-bf
TevStageCombiner combiners[16]; // 0xC0-0xDF
TevReg tevregs[4]; // 0xE0
FogRangeParams fogRange; // 0xE8
FogParams fog; // 0xEE,0xEF,0xF0,0xF1,0xF2
AlphaTest alpha_test; // 0xF3
ZTex1 ztex1; // 0xf4,0xf5
ZTex2 ztex2;
TevKSel tevksel[8]; // 0xf6,0xf7,f8,f9,fa,fb,fc,fd
u32 bpMask; // 0xFE