SNES NTSC Composite Video Filter

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Ok, all hail pagefault. Version 0.2.2 of the filter has been implemented. The only thing we need here is to convert the settings back to the GUI... but otherwise it is complete.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

bravo, i luv the RGB preset... makes everything not flicker now.
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

The flicker comes if you don't use the "Blend Frames" option, not the RGB option. The RGB preset does have the most clarity though.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
blargg
Regular
Posts: 327
Joined: Thu Jun 30, 2005 1:54 pm
Location: USA
Contact:

Post by blargg »

Yeah, the Blend Frames option never completely disabled flickering; I fixed that in the code I send to pagefault a couple of days ago. I'm not sure why the GUI would need updating, because I didn't add/remove any options (I just changed the "hue warping" slider to do "enhancement" instead, which adjusts the amount of artifacts, useful in combination with increasing the sharpness). If I could access the damn CVS without a lot of trouble, I'd take a look at the rest of the code.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

blargg wrote:Yeah, the Blend Frames option never completely disabled flickering; I fixed that in the code I send to pagefault a couple of days ago. I'm not sure why the GUI would need updating, because I didn't add/remove any options (I just changed the "hue warping" slider to do "enhancement" instead, which adjusts the amount of artifacts, useful in combination with increasing the sharpness). If I could access the damn CVS without a lot of trouble, I'd take a look at the rest of the code.
blargg, we have an SVN thread: http://board.zsnes.com/phpBB2/viewtopic.php?t=7371

If you have any troubles, please let us know.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

im running zsnes @ 60hz refresh rate and like your description in the config file says... that blend option is only useful for non 60hz displays.
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

I guess it's the same for 120 Hz? Will have to try later...
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
blargg
Regular
Posts: 327
Joined: Thu Jun 30, 2005 1:54 pm
Location: USA
Contact:

Post by blargg »

120 Hz will probably also work well with blend OFF.

OK, I was just able to look at the current NTSC code using the Safari web browser on Mac OS X (that Bounty Source SVN viewer apparently puts some heavy requirements on the web browser, preventing older ones from working). I see that several presets have been added and every NTSC control exposed in the UI. This makes it a bit more complex to configure, though I guess some people might want full control of everything.

By the looks of the source, when the user has selected a preset, the sliders are ignored. It'd be nice if the presets were (momentary) pushbuttons that simply moved the relevant sliders to the appropriate positions, so that they could then be fine-tuned as desired. This would also make it clearer how the sliders affect the image, so you could see for example the difference in going from S-Video to RGB (color bleed eliminated, higher resolution). Here is a function to implement the presets that way. After calling this the GUI should be updated with the new values (the same way it is when first opening, where it uses the last saved values):

Code: Select all

void set_ntsc_preset( int i )
{
    static const signed char presets [4] [6] = {
        /*Sharp Sat   Res   Art Fringe Bleed */
        { 0,     0,    0,    0,    0,    0},/* Composite */
        {20,     0,   20, -100, -100,    0},/* S-Video */
        {20,     0,   70, -100, -100, -100},/* RGB */
        {20,  -100,   20,  -20,  -20, -100} /* Monochrome */
    };
    if ( i >= 0 && i < 4 )
    {
        NTSCSharp  = presets [i] [0];
        NTSCSat    = presets [i] [1];
        NTSCRes    = presets [i] [2];
        NTSCArt    = presets [i] [3];
        NTSCFringe = presets [i] [4];
        NTSCBleed  = presets [i] [5];
        
        NTSCFilterInit();
   }
}
I don't have a machine to run ZSNES on, but is there some way to see a live preview of what the picture will look like as you move the sliders? I seem to remember the UI covering the SNES image; if so, perhaps a small portion of the image or a fixed example image could be shown below the sliders.

If you have access to Mac OS X, take a look at how QuickNES implements the NTSC filter controls. Open an iNES file and choose Edit->Emulator Setup, then click on the Video tab. There's a popup menu of presets, with a Custom option at the bottom. Selecting a preset moves the sliders appropriately. If you then move any of the sliders, the preset popup changes to Custom, making it clear that you're not using a preset anymore. Further, if you select a preset, the sliders move as before, and if you then select Custom from the popup, they move back to your previous custom settings. This allows you to compare with a preset without losing your custom settings.
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

blargg wrote:I don't have a machine to run ZSNES on, but is there some way to see a live preview of what the picture will look like as you move the sliders? I seem to remember the UI covering the SNES image; if so, perhaps a small portion of the image or a fixed example image could be shown below the sliders.
yep moving the sliders in the windows version allow us to (with the "refresh" option ticked and with having the gui filtering option turned on aswell.) see the change on the gui while adjusting sliders
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

Blargg thanks for the advice. I was originally going to do this but I ran out of time and needed to get to bed last night so I will finish implmenting this feature today. Currently you can see your changes as the sliders move. I must say the new filter is very impressive.

I just wanted to make sure everyone had it working first as well.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

blargg wrote:OK, I was just able to look at the current NTSC code using the Safari web browser on Mac OS X (that Bounty Source SVN viewer apparently puts some heavy requirements on the web browser, preventing older ones from working). I see that several presets have been added and every NTSC control exposed in the UI. This makes it a bit more complex to configure, though I guess some people might want full control of everything.
More power! :twisted:
By the looks of the source, when the user has selected a preset, the sliders are ignored. It'd be nice if the presets were (momentary) pushbuttons that simply moved the relevant sliders to the appropriate positions, so that they could then be fine-tuned as desired. This would also make it clearer how the sliders affect the image, so you could see for example the difference in going from S-Video to RGB (color bleed eliminated, higher resolution). Here is a function to implement the presets that way. After calling this the GUI should be updated with the new values (the same way it is when first opening, where it uses the last saved values):

Code: Select all

void set_ntsc_preset( int i )
{
    static const signed char presets [4] [6] = {
        /*Sharp Sat   Res   Art Fringe Bleed */
        { 0,     0,    0,    0,    0,    0},/* Composite */
        {20,     0,   20, -100, -100,    0},/* S-Video */
        {20,     0,   70, -100, -100, -100},/* RGB */
        {20,  -100,   20,  -20,  -20, -100} /* Monochrome */
    };
    if ( i >= 0 && i < 4 )
    {
        NTSCSharp  = presets [i] [0];
        NTSCSat    = presets [i] [1];
        NTSCRes    = presets [i] [2];
        NTSCArt    = presets [i] [3];
        NTSCFringe = presets [i] [4];
        NTSCBleed  = presets [i] [5];
        
        NTSCFilterInit();
   }
}
If the sample code had all the preset values, it would be nicer (details are always cool. :)
I don't have a machine to run ZSNES on, but is there some way to see a live preview of what the picture will look like as you move the sliders? I seem to remember the UI covering the SNES image; if so, perhaps a small portion of the image or a fixed example image could be shown below the sliders.
Use the "None" preset option, though, that probably could be renamed to "Custom".
If you have access to Mac OS X, take a look at how QuickNES implements the NTSC filter controls. Open an iNES file and choose Edit->Emulator Setup, then click on the Video tab. There's a popup menu of presets, with a Custom option at the bottom. Selecting a preset moves the sliders appropriately. If you then move any of the sliders, the preset popup changes to Custom, making it clear that you're not using a preset anymore. Further, if you select a preset, the sliders move as before, and if you then select Custom from the popup, they move back to your previous custom settings. This allows you to compare with a preset without losing your custom settings.
I was thinking that could be added as I also thought it would be a requested feature. I was thinking more along the lines, as the presets set the settings, and then you go back to "None/Custom" to tweak off the base.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
blargg
Regular
Posts: 327
Joined: Thu Jun 30, 2005 1:54 pm
Location: USA
Contact:

Post by blargg »

If the sample code had all the preset values, it would be nicer (details are always cool).
I'm not following. set_ntsc_preset() changes all relevant values for each setting; the ones not changed (hue, brightness, etc.) are not relevant, and it would be annoying to the user anyway.
I was thinking that could be added as I also thought it would be a requested feature. I was thinking more along the lines, as the presets set the settings, and then you go back to "None/Custom" to tweak off the base.
The pushbutton method (same way as Nestopia implements it) is best; having it modal with radio buttons won't be as pleasant for the user. The key point is that the user can use the presets as a starting point for customization. "Let's try Composite. Hmmm, a bit grainy, how about S-Video? Better. Now let's increase sharpness and resolution. Perfect." The QuickNES implementation described simply makes it clear whether the preset has been customized at all, otherwise it's the same as the pushbutton.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

We have changed everything to meet your concerns. Thanks again. Your input is valuable.

I sound like a recorded message.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

blargg wrote:
If the sample code had all the preset values, it would be nicer (details are always cool).
I'm not following. set_ntsc_preset() changes all relevant values for each setting; the ones not changed (hue, brightness, etc.) are not relevant, and it would be annoying to the user anyway.
Don't worry about it.
I was thinking that could be added as I also thought it would be a requested feature. I was thinking more along the lines, as the presets set the settings, and then you go back to "None/Custom" to tweak off the base.
The pushbutton method (same way as Nestopia implements it) is best; having it modal with radio buttons won't be as pleasant for the user. The key point is that the user can use the presets as a starting point for customization. "Let's try Composite. Hmmm, a bit grainy, how about S-Video? Better. Now let's increase sharpness and resolution. Perfect." The QuickNES implementation described simply makes it clear whether the preset has been customized at all, otherwise it's the same as the pushbutton.
I had it as buttons initially.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
byuu

Post by byuu »

blargg, may I bother you to please post snes-ntsc_0.2.2, assuming it's finalized? I still have v0.2.1 from your page.

I was planning on redoing my GUI anyway, so I may as well add the latest version and controls for all of the options your library supports that my palette lookup table doesn't already.

Also, are the setting changes realtime? Or can you add a function that I can call to immediately recalculate all of the tables? I'd like the sliders to be adjustable while a game is playing so a user can observe them without a restart.

Excellent work, as always, by the way :)
blargg
Regular
Posts: 327
Joined: Thu Jun 30, 2005 1:54 pm
Location: USA
Contact:

Post by blargg »

pagefault wrote:We have changed everything to meet your concerns.
Heh, well, change things only when reason moves you.
byuu wrote:blargg, may I bother you to please post snes-ntsc_0.2.2, assuming it's finalized?
Yeah, I should be posting several NTSC filters in a few days. I don't think there are any functional changes between snes_ntsc 0.2.1 and 0.2.2. It's mainly a switch to a version using a common set of code shared by all the NTSC filters (a huge help to me), and a nicer demo.
Also, are the setting changes realtime? Or can you add a function that I can call to immediately recalculate all of the tables? I'd like the sliders to be adjustable while a game is playing so a user can observe them without a restart.
Yeah, call snes_ntsc_init() whenever you want to change the settings. I figured you already had live sliders by now. :)
byuu

Post by byuu »

Yeah, I should be posting several NTSC filters in a few days. I don't think there are any functional changes between snes_ntsc 0.2.1 and 0.2.2. It's mainly a switch to a version using a common set of code shared by all the NTSC filters (a huge help to me), and a nicer demo.
Awesome, thank you :D
Hmm, I thought you said above you ironed out the blend frames option, but maybe you were meaning 0.2.0->0.2.1, since ZSNES was using the older one. Either way though, I'm happy to upgrade, especially if it makes things easier for you in the future.
Yeah, call snes_ntsc_init() whenever you want to change the settings. I figured you already had live sliders by now.
Cool, will do. Unfortunately, I do not. Haven't really done much with my GUI in the last few months. I'm definitely interested in adding the options, though. The NTSC filter is the closest we can ever get to nostalgia on our high-resolution LCD monitors, so it would seem, heh.

Now we just need to add Richard Bannister's "TV tube curvature" effect in to our emulators :)
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

May I suggest you rename the composite profile to RF adaptor. My composite never looked like that but an RF adaptor would produce those results.
byuu

Post by byuu »

You may also wish to comment the source with acceptable ranges for all individual settings, perferrably only sane ranges, for the purpose of adding adjustable sliders. Or are they all -128 to +127?
blargg
Regular
Posts: 327
Joined: Thu Jun 30, 2005 1:54 pm
Location: USA
Contact:

Post by blargg »

byuu: Take a look at the header file. Also, I e-mailed your gmail account about the filter.

pagefault: the composite profile matches closely what a video capture of my SNES looks like (which admittedly looks like crap as compared to how it looks on a TV). The presets are mainly a guide and convenience for a basic implementation of the filter; if you can come up with better settings, by all means use them (one can spend quite a bit of time fine-tuning these things to match a TV).
GashouseGorilla

Post by GashouseGorilla »

I LOVE THIS FILTER!!!!

Now Blargg, could you please, PLEASE, make this filter so that it works for my entire desktop and all the programs that run under it? Because on my laptop, red looks pink, and I want to change the hue so that it's red once and for all!
blackmyst
Zealot
Posts: 1161
Joined: Sun Sep 26, 2004 8:36 pm
Location: Place.

Post by blackmyst »

GashouseGorilla wrote:I LOVE THIS FILTER!!!!

Now Blargg, could you please, PLEASE, make this filter so that it works for my entire desktop and all the programs that run under it? Because on my laptop, red looks pink, and I want to change the hue so that it's red once and for all!
Hahaha what? ...why would someone implement the entire NTSC filter for your desktop when all you want is a hue change (which can be achieved in many other infinitely simpler ways)? Do you even know what the point of the filter is? Do you even know what it does?
[size=75][b]Procrastination.[/b]
Hard Work Often Pays Off After Time, but Laziness Always Pays Off Now.[/size]
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

blackmyst wrote:
GashouseGorilla wrote:I LOVE THIS FILTER!!!!

Now Blargg, could you please, PLEASE, make this filter so that it works for my entire desktop and all the programs that run under it? Because on my laptop, red looks pink, and I want to change the hue so that it's red once and for all!
Hahaha what? ...why would someone implement the entire NTSC filter for your desktop when all you want is a hue change (which can be achieved in many other infinitely simpler ways)? Do you even know what the point of the filter is? Do you even know what it does?
It is all about teh pretty colors!
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
GashouseGorilla

Post by GashouseGorilla »

All right then, tell be the BEST way to change the hue for my desktop and all the programs that run under it, because I've tried several of them and none of them worked.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

GashouseGorilla wrote:All right then, tell be the BEST way to change the hue for my desktop and all the programs that run under it, because I've tried several of them and none of them worked.
Your video card utilities (for ATI+NVidia video cards) are the solution more often than not. Unfortunately using crappy integrated Intel video wouldn't do you any good....
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Post Reply