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 *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 uint32 *palrgb = NULL; // PAL filter buffer for lookup values of RGB with applied moir phases
|
||||||
static float *moire = NULL;
|
static float *moire = NULL;
|
||||||
int palsaturation = 100;
|
int palsaturation = 200;
|
||||||
int palnotch = 0;
|
int palnotch = 64;
|
||||||
bool palhdtv = 0;
|
bool palhdtv = 0;
|
||||||
bool palmonochrome = 0;
|
bool palmonochrome = 0;
|
||||||
bool palupdate = 1;
|
bool palupdate = 1;
|
||||||
|
@ -186,7 +186,7 @@ int InitBlitToHigh(int b, uint32 rmask, uint32 gmask, uint32 bmask, int efx, int
|
||||||
else if (specfilt == 9)
|
else if (specfilt == 9)
|
||||||
{
|
{
|
||||||
palrgb = (uint32 *)FCEU_dmalloc((256+512)*16*sizeof(uint32));
|
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;
|
silt = specfilt;
|
||||||
|
@ -644,28 +644,41 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale,
|
||||||
uint8 xabs = 0;
|
uint8 xabs = 0;
|
||||||
uint32 index = 0;
|
uint32 index = 0;
|
||||||
uint32 lastindex = 0;
|
uint32 lastindex = 0;
|
||||||
uint32 lastindex2 = 0;
|
uint32 newindex = 0;
|
||||||
uint32 color, lastcolor, lastcolor2;
|
uint32 color, lastcolor, realcolor;
|
||||||
int notch = palnotch;
|
int notch = palnotch;
|
||||||
int notch2 = notch/2;
|
|
||||||
int unnotch = 100 - palnotch;
|
int unnotch = 100 - palnotch;
|
||||||
int rmask = 0xff0000;
|
int rmask = 0xff0000;
|
||||||
int gmask = 0x00ff00;
|
int gmask = 0x00ff00;
|
||||||
int bmask = 0x0000ff;
|
int bmask = 0x0000ff;
|
||||||
|
int r, g, b;
|
||||||
|
|
||||||
for (y=0; y<yr; y++) {
|
for (y=0; y<yr; y++) {
|
||||||
lastcolor = 0;
|
lastcolor = 0;
|
||||||
lastcolor2 = 0;
|
for (x=0; x<xr; x++) {
|
||||||
for (x=0; x<xr; x++) {
|
|
||||||
//find out which deemph bitplane value we're on
|
//find out which deemph bitplane value we're on
|
||||||
int ofs = src-XBuf;
|
int ofs = src-XBuf;
|
||||||
uint8 deemph = XDBuf[ofs];
|
uint8 deemph = XDBuf[ofs];
|
||||||
|
|
||||||
//get combined index from basic value and preemph bitplane
|
//get combined index from basic value and preemph bitplane
|
||||||
index = (*src&63) | (deemph*64);
|
index = (*src&63) | (deemph*64);
|
||||||
index += 256;
|
index += 256;
|
||||||
|
|
||||||
src++;
|
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++) {
|
for (int xsub = 0; xsub < 3; xsub++) {
|
||||||
xabs = x*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 (notch)
|
||||||
{
|
{
|
||||||
if (index == lastindex == lastindex2) {
|
r = ((color&rmask)*unnotch + (lastcolor&rmask)*notch)/100;
|
||||||
int r = ((color&rmask)*unnotch + (lastcolor&rmask)*notch2 + (lastcolor2&rmask)*notch2)/100;
|
g = ((color&gmask)*unnotch + (lastcolor&gmask)*notch)/100;
|
||||||
int g = ((color&gmask)*unnotch + (lastcolor&gmask)*notch2 + (lastcolor2&gmask)*notch2)/100;
|
b = ((color&bmask)*unnotch + (lastcolor&bmask)*notch)/100;
|
||||||
int b = ((color&bmask)*unnotch + (lastcolor&bmask)*notch2 + (lastcolor2&bmask)*notch2)/100;
|
color = r&rmask | g&gmask | b&bmask;
|
||||||
color = r&rmask | g&gmask | b&bmask;
|
|
||||||
} else {
|
if (index == lastindex && index == newindex && !palmonochrome) {
|
||||||
int r = ((color&rmask)*unnotch + (lastcolor&rmask)*notch)/100;
|
r = ((color&rmask)*unnotch + (realcolor&rmask)*notch)/100;
|
||||||
int g = ((color&gmask)*unnotch + (lastcolor&gmask)*notch)/100;
|
g = ((color&gmask)*unnotch + (realcolor&gmask)*notch)/100;
|
||||||
int b = ((color&bmask)*unnotch + (lastcolor&bmask)*notch)/100;
|
b = ((color&bmask)*unnotch + (realcolor&bmask)*notch)/100;
|
||||||
color = r&rmask | g&gmask | b&bmask;
|
color = r&rmask | g&gmask | b&bmask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*d++ = color;
|
*d++ = color;
|
||||||
lastcolor2 = lastcolor;
|
|
||||||
lastcolor = color;
|
lastcolor = color;
|
||||||
lastindex = index;
|
lastindex = index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,8 @@ extern bool symbDebugEnabled;
|
||||||
extern bool symbRegNames;
|
extern bool symbRegNames;
|
||||||
extern int palsaturation;
|
extern int palsaturation;
|
||||||
extern int palnotch;
|
extern int palnotch;
|
||||||
|
extern bool palmonochrome;
|
||||||
|
extern bool palhdtv;
|
||||||
|
|
||||||
extern TASEDITOR_CONFIG taseditorConfig;
|
extern TASEDITOR_CONFIG taseditorConfig;
|
||||||
extern char* recentProjectsArray[];
|
extern char* recentProjectsArray[];
|
||||||
|
@ -184,6 +186,8 @@ static CFGSTRUCT fceuconfig[] =
|
||||||
AC(skip_7bit_overclocking),
|
AC(skip_7bit_overclocking),
|
||||||
AC(palsaturation),
|
AC(palsaturation),
|
||||||
AC(palnotch),
|
AC(palnotch),
|
||||||
|
AC(palmonochrome),
|
||||||
|
AC(palhdtv),
|
||||||
|
|
||||||
NAC("palyo",pal_emulation),
|
NAC("palyo",pal_emulation),
|
||||||
NAC("genie",genie),
|
NAC("genie",genie),
|
||||||
|
|
|
@ -145,11 +145,11 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BTN_PALETTE_RESET:
|
case BTN_PALETTE_RESET:
|
||||||
palsaturation = 100;
|
palsaturation = 200;
|
||||||
SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_SETPOS, 1, palsaturation);
|
SendDlgItemMessage(hwndDlg, CTL_PALSAT_TRACKBAR, TBM_SETPOS, 1, palsaturation);
|
||||||
sprintf(text, "Saturation: %d%%", palsaturation);
|
sprintf(text, "Saturation: %d%%", palsaturation);
|
||||||
SendDlgItemMessage(hwndDlg, STATIC_SATVALUE, WM_SETTEXT, 0, (LPARAM) text);
|
SendDlgItemMessage(hwndDlg, STATIC_SATVALUE, WM_SETTEXT, 0, (LPARAM) text);
|
||||||
palnotch = 0;
|
palnotch = 64;
|
||||||
SendDlgItemMessage(hwndDlg, CTL_PALNOTCH_TRACKBAR, TBM_SETPOS, 1, palnotch);
|
SendDlgItemMessage(hwndDlg, CTL_PALNOTCH_TRACKBAR, TBM_SETPOS, 1, palnotch);
|
||||||
sprintf(text, "Notch: %d%", palnotch);
|
sprintf(text, "Notch: %d%", palnotch);
|
||||||
SendDlgItemMessage(hwndDlg, STATIC_NOTCHVALUE, WM_SETTEXT, 0, (LPARAM) text);
|
SendDlgItemMessage(hwndDlg, STATIC_NOTCHVALUE, WM_SETTEXT, 0, (LPARAM) text);
|
||||||
|
|
Loading…
Reference in New Issue