PAL filter: improved notch.
solution still makes no sense, but is now surprisingly close to composite console capture with default values (sat: 200%, notch: 64). only todo is rainbow effect, but it's hard.
This commit is contained in:
parent
4737bf0cf1
commit
0ed69d8830
|
@ -51,8 +51,8 @@ static uint8 *ntscblit = NULL; // For nes_ntsc
|
|||
static uint32 *prescalebuf = NULL; // Prescale pointresizes to 2x-4x to allow less blur with hardware acceleration.
|
||||
static uint32 *palrgb = NULL; // PAL filter buffer for lookup values of RGB with applied moir phases
|
||||
static float *moire = NULL;
|
||||
int palsaturation = 100;
|
||||
int palnotch = 0;
|
||||
int palsaturation = 200;
|
||||
int palnotch = 64;
|
||||
bool palhdtv = 0;
|
||||
bool palmonochrome = 0;
|
||||
bool palupdate = 1;
|
||||
|
@ -186,7 +186,7 @@ int InitBlitToHigh(int b, uint32 rmask, uint32 gmask, uint32 bmask, int efx, int
|
|||
else if (specfilt == 9)
|
||||
{
|
||||
palrgb = (uint32 *)FCEU_dmalloc((256+512)*16*sizeof(uint32));
|
||||
moire = (float *)FCEU_dmalloc( 16*sizeof(float));
|
||||
moire = (float *)FCEU_dmalloc( 16*sizeof(float));
|
||||
}
|
||||
|
||||
silt = specfilt;
|
||||
|
@ -644,28 +644,41 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale,
|
|||
uint8 xabs = 0;
|
||||
uint32 index = 0;
|
||||
uint32 lastindex = 0;
|
||||
uint32 lastindex2 = 0;
|
||||
uint32 color, lastcolor, lastcolor2;
|
||||
uint32 newindex = 0;
|
||||
uint32 color, lastcolor, realcolor;
|
||||
int notch = palnotch;
|
||||
int notch2 = notch/2;
|
||||
int unnotch = 100 - palnotch;
|
||||
int rmask = 0xff0000;
|
||||
int gmask = 0x00ff00;
|
||||
int bmask = 0x0000ff;
|
||||
int r, g, b;
|
||||
|
||||
for (y=0; y<yr; y++) {
|
||||
lastcolor = 0;
|
||||
lastcolor2 = 0;
|
||||
for (x=0; x<xr; x++) {
|
||||
lastcolor = 0;
|
||||
for (x=0; x<xr; x++) {
|
||||
//find out which deemph bitplane value we're on
|
||||
int ofs = src-XBuf;
|
||||
uint8 deemph = XDBuf[ofs];
|
||||
|
||||
//get combined index from basic value and preemph bitplane
|
||||
index = (*src&63) | (deemph*64);
|
||||
index += 256;
|
||||
index += 256;
|
||||
|
||||
src++;
|
||||
|
||||
if (notch)
|
||||
{
|
||||
if (deemph != 0)
|
||||
realcolor = palettetranslate[256 + (index&0x3F) + deemph*64];
|
||||
else
|
||||
realcolor = palettetranslate[index];
|
||||
|
||||
ofs = src-XBuf;
|
||||
uint8 deemph = XDBuf[ofs];
|
||||
newindex = (*src&63) | (deemph*64);
|
||||
newindex += 256;
|
||||
}
|
||||
|
||||
for (int xsub = 0; xsub < 3; xsub++) {
|
||||
xabs = x*3 + xsub;
|
||||
|
||||
|
@ -706,20 +719,19 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale,
|
|||
|
||||
if (notch)
|
||||
{
|
||||
if (index == lastindex == lastindex2) {
|
||||
int r = ((color&rmask)*unnotch + (lastcolor&rmask)*notch2 + (lastcolor2&rmask)*notch2)/100;
|
||||
int g = ((color&gmask)*unnotch + (lastcolor&gmask)*notch2 + (lastcolor2&gmask)*notch2)/100;
|
||||
int b = ((color&bmask)*unnotch + (lastcolor&bmask)*notch2 + (lastcolor2&bmask)*notch2)/100;
|
||||
color = r&rmask | g&gmask | b&bmask;
|
||||
} else {
|
||||
int r = ((color&rmask)*unnotch + (lastcolor&rmask)*notch)/100;
|
||||
int g = ((color&gmask)*unnotch + (lastcolor&gmask)*notch)/100;
|
||||
int b = ((color&bmask)*unnotch + (lastcolor&bmask)*notch)/100;
|
||||
r = ((color&rmask)*unnotch + (lastcolor&rmask)*notch)/100;
|
||||
g = ((color&gmask)*unnotch + (lastcolor&gmask)*notch)/100;
|
||||
b = ((color&bmask)*unnotch + (lastcolor&bmask)*notch)/100;
|
||||
color = r&rmask | g&gmask | b&bmask;
|
||||
|
||||
if (index == lastindex && index == newindex && !palmonochrome) {
|
||||
r = ((color&rmask)*unnotch + (realcolor&rmask)*notch)/100;
|
||||
g = ((color&gmask)*unnotch + (realcolor&gmask)*notch)/100;
|
||||
b = ((color&bmask)*unnotch + (realcolor&bmask)*notch)/100;
|
||||
color = r&rmask | g&gmask | b&bmask;
|
||||
}
|
||||
}
|
||||
*d++ = color;
|
||||
lastcolor2 = lastcolor;
|
||||
lastcolor = color;
|
||||
lastindex = index;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,8 @@ extern bool symbDebugEnabled;
|
|||
extern bool symbRegNames;
|
||||
extern int palsaturation;
|
||||
extern int palnotch;
|
||||
extern bool palmonochrome;
|
||||
extern bool palhdtv;
|
||||
|
||||
extern TASEDITOR_CONFIG taseditorConfig;
|
||||
extern char* recentProjectsArray[];
|
||||
|
@ -184,6 +186,8 @@ static CFGSTRUCT fceuconfig[] =
|
|||
AC(skip_7bit_overclocking),
|
||||
AC(palsaturation),
|
||||
AC(palnotch),
|
||||
AC(palmonochrome),
|
||||
AC(palhdtv),
|
||||
|
||||
NAC("palyo",pal_emulation),
|
||||
NAC("genie",genie),
|
||||
|
|
|
@ -145,11 +145,11 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
break;
|
||||
|
||||
case BTN_PALETTE_RESET:
|
||||
palsaturation = 100;
|
||||
palsaturation = 200;
|
||||
SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_SETPOS, 1, palsaturation);
|
||||
sprintf(text, "Saturation: %d%%", palsaturation);
|
||||
SendDlgItemMessage(hwndDlg, STATIC_SATVALUE, WM_SETTEXT, 0, (LPARAM) text);
|
||||
palnotch = 0;
|
||||
palnotch = 64;
|
||||
SendDlgItemMessage(hwndDlg, CTL_PALNOTCH_TRACKBAR, TBM_SETPOS, 1, palnotch);
|
||||
sprintf(text, "Notch: %d%", palnotch);
|
||||
SendDlgItemMessage(hwndDlg, STATIC_NOTCHVALUE, WM_SETTEXT, 0, (LPARAM) text);
|
||||
|
|
Loading…
Reference in New Issue