240p/120Hz instead of 480p/60Hz for VGA scandoubler?

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Sorgelig, Moderator Team

Stremon
Atarian
Atarian
Posts: 6
Joined: Fri Mar 22, 2019 3:47 am

240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Stremon » Sun May 26, 2019 9:39 pm

Hey guys,
I don't think it's been asked before, but I'm trying to figure if it would be possible to add a second scandoubler mode, that instead of doubling the horizontal sync, double the refresh rate (60=>120).
The 240p/120Hz allows PC CRT screens to display real 240p mode, with thick real scalines and all, a bit like the original 240p was displayed on 480i screens.
It has some drawbacks, but generally looks far better and more authentic than scandoubled to 480p.
Not sure it's even doable, and sadly I don't have enough knowledge to do that alone, so if anyone can help me on that I would be very grateful :)

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4869
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Sorgelig » Sun May 26, 2019 11:03 pm

scandoubler can double only lines per frame. It cannot increase the refresh rate. For changing the refresh rate the scaler is required. So, you need to use vga_scaler=1 in ini with custom defined video mode.
I never tried scaler with such high refresh rate. And there is no point to use vsync_adjust as it won't work. Also it's useless as increasing frame rate anyway will give stroboscopic effect for all moving objects.

Stremon
Atarian
Atarian
Posts: 6
Joined: Fri Mar 22, 2019 3:47 am

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Stremon » Mon May 27, 2019 3:57 am

Sorgelig wrote:scandoubler can double only lines per frame. It cannot increase the refresh rate. For changing the refresh rate the scaler is required. So, you need to use vga_scaler=1 in ini with custom defined video mode.
I never tried scaler with such high refresh rate. And there is no point to use vsync_adjust as it won't work. Also it's useless as increasing frame rate anyway will give stroboscopic effect for all moving objects.

I see, it makes sense. Thanks for the info.
I'm not sure about all the technical stuff, but I am using 240p/120Hz on my 30kHz CRT monitor with groovymame, and it looks awesome, no stroboscopic effect or anything. It really gives an authentic 240p look to it.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4869
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Sorgelig » Mon May 27, 2019 5:58 am

if you simply repeat every frame 4 times (60*4=240) then you will get a stroboscopic effect. It may be visible more or less depending on specific people. To avoid it, the scaler must use adaptive temporal techniques to smooth the move within 4 frames. This is very hard task. It's not simple increase of frame rate.

bleck
Atarian
Atarian
Posts: 2
Joined: Mon May 27, 2019 5:09 pm

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby bleck » Mon May 27, 2019 5:10 pm

What do you think about using black frame insertion instead?

http://emulation.gametechwiki.com/index.php/Black_frame_insertion

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4869
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Sorgelig » Mon May 27, 2019 6:48 pm

I have no 120/240Hz monitors. So i have no idea.
It has very little interest to me.

Stremon
Atarian
Atarian
Posts: 6
Joined: Fri Mar 22, 2019 3:47 am

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Stremon » Tue May 28, 2019 4:49 pm

Sorgelig wrote:I have no 120/240Hz monitors. So i have no idea.
It has very little interest to me.

You don't need a 120Hz monitor (why would even want a 240Hz monitor?), any CRT PC monitor that has 480p will work with it since 240p/120Hz is pretty much the same mode as 480p/60Hz, it's just a trick to get real 240p on a monitor that has only 480p minimum. A bit like 240p was not an official format but a trick to display 240 progressive lines image on 480 interlaced lines screen.
It's just a matter of horizontal frequency/scan rate matching what the screen is expecting. Of course the trick only work with analogic screens, where resolution and frequencies are linked.
It's very different from lcd digital logic where the screen had fixed resolution and frequencies.

And if I'm correct, the current scan doubler is doing almost the same as what I want, it just double the horizontal frequency instead of the vertical one.

For the stroboscopic effect, you will get that only on a lcd, obviously not that on a CRT screen. I've been using 240p/120Hz on my CRT for a while now and it give fantastic results on emulation.
Sorry if I was not clear enough on the fact that I was speaking about a mode that works properly only on analogic signals, and preferably on CRT (or else it's useless since LCD screens just can't replicate 240p natively).

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4869
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Sorgelig » Tue May 28, 2019 5:13 pm

Your explanations are not correct technically.
To double the vertical frequency you need full frame double buffer. This is feature of scaler. Scandoubler has no frame buffer.

amadama
Atariator
Atariator
Posts: 29
Joined: Fri Jun 27, 2014 12:00 am
Location: USA

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby amadama » Tue May 28, 2019 7:29 pm

If you have an HDMI to VGA converter try the following custom video mode:

video_mode=1920,48,192,240,240,3,10,8,75170

This should, in theory, show a 1920x240 display at 120hz. Not sure if this will work on the MiSTer.

All my CRT VGA monitors are in storage at the moment so I haven't tested it out, but this is derived from what I've seen other people do to get 240p at 120hz on a CRT VGA monitor.

Let me know if it works for you.

glaucon1984
Atari User
Atari User
Posts: 32
Joined: Fri Aug 04, 2017 12:23 pm

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby glaucon1984 » Thu May 30, 2019 11:34 am

Hi Amadama, do you have a video mode for 640x240@120?

amadama
Atariator
Atariator
Posts: 29
Joined: Fri Jun 27, 2014 12:00 am
Location: USA

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby amadama » Thu May 30, 2019 5:15 pm

you don't want to do 640x240 because it won't look good with all the cores.
Ideally you want the horizontal resolution as high as possible so it is easier to divide the horizontal resolution of the different cores (some are 320 px, some 256, some 288, etc..)
CRT monitors can handle the high horizontal resolutions just fine and you are going through the scaler so can choose one of the nearest neighbor scalers for really crisp display without horizontal shimmering when scrolling.

(edit, I suppose you can do a custom mode optimal for each core. Try to keep the horizontal resolution an integer scale of the core)

ghogan42
Atari maniac
Atari maniac
Posts: 83
Joined: Wed Oct 17, 2018 7:27 pm

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby ghogan42 » Sat Jun 01, 2019 3:00 am

amadama wrote:you don't want to do 640x240 because it won't look good with all the cores.
Ideally you want the horizontal resolution as high as possible so it is easier to divide the horizontal resolution of the different cores (some are 320 px, some 256, some 288, etc..)
CRT monitors can handle the high horizontal resolutions just fine and you are going through the scaler so can choose one of the nearest neighbor scalers for really crisp display without horizontal shimmering when scrolling.

(edit, I suppose you can do a custom mode optimal for each core. Try to keep the horizontal resolution an integer scale of the core)


The best way to handle this is to have Aspect Ratios work different than they do in MiSTer now.

Right now, you set your output resolution, say 640x240, and MiSTer assumes that the pixels are squares. So when you run a mister core it will take the 240p height, multiply by 4/3 and get a value of 320. So mister will scale whatever the input is, like 256x240, to 320x240 and then that 320x240 output will be in the center of the 640x240 screen.

The result is that your game will be 320 pixels wide and be squished horizontally in the 640x240 image.
Also, the 256 to 320 scaling would look very bad.

The better way to do this is to have a "Display Aspect Ratio" that you set to 16x9, 16x10, 4x3, or 5x4. Then you use that to calculate the correct number of pixels for the width. So for example:

-----Made up Example 1 with a 16x9 display running at 3840x1080-----
If Display Aspect (DAR) = 16/9, Core Aspect (AR) = 4/3, Video Aspect Ratio (VAR) = 3840/1080 then you would do the following calculation:
Height = 1080
Width = (AR)*(VAR)/(DAR)*(Height) = (4/3) * (3840/1080) / (16/9) * 1080 = 2880
So the final resolution is 2880x1080
----------------------------------

-----How you would use it for analog output with SNES core at 2048x240 output res-----
Display Aspect (DAR) = 4/3
Core Aspect (AR) = 64/49 <---- It's not 4/3 anymore because kitrinx fixed it. The osd option says 4:3 but internally it is 64x49
Video Aspect Ratio (VAR) = 2048/240 <----That's your video mode resolution: 2048x240
So then
Height = 240
Width = (AR)*(VAR)/(DAR)*(Height) = (64/49) * (2048/240) / (4/3) * 240 = 2006
Final scaled dimension will be a 2006x240 image in the center of the 2048x240 resolution output.
-----------------------------------

In order to do this, the mister ini would just need a new Display_Aspect variable that you set to your displays physical aspect ratio. Then no matter what resolution you pick for analog out using the scaler, your aspect ratio on screen would be correct. And if you set vscale_mode=1 and use a sharp filter you output would be perfect.

But as of right now, this is not how mister's aspect ratio settings work.

SuperSpongo
Atarian
Atarian
Posts: 5
Joined: Mon May 27, 2019 8:57 am

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby SuperSpongo » Mon Jun 03, 2019 10:09 am

Could I ask a question also regarding the VGA scandoubler?

What does it currently do with interlaced content? This question is akin to the OSSC. It used to handle interlaced content with Bob Deinterlace. on the latest firmwares, you can set a line triple mode to get an interlaced picture again.

Does the MiSTer do Bob Deinterlacing here as well? I don't have an IO board yet, but I'd like to know in advance.

Stremon
Atarian
Atarian
Posts: 6
Joined: Fri Mar 22, 2019 3:47 am

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Stremon » Mon Jun 17, 2019 4:00 pm

ghogan42 wrote:But as of right now, this is not how mister's aspect ratio settings work.

So if I understand correctly, you mean that it's not possible at the moment to get a proper native 240p/120Hz resolution even with the scaler?
Damn I really wish I had the knowledge to read and modify the MiSTer code, I tried to look into it but it's way above my dev skills :shrug:

PS: for those interested in knowing why I want the 240p/120Hz instead of the 480p/60Hz, here a quick example.
(sorry for the blurry parts on the pics, the CRT pixels are very bright and hard to get sharp on cam)

On my high def PC CRT, the real 240p/120Hz mode looks like this:
https://imgur.com/T8LBZoJ
As you may see, the scanline looks quite sharp, it's one line of pixel, one line black.
It's very bright and nice, very close to what it should looks like.

Now the 480p/60Hz with scandoubler fx to 75% looks like that:
https://imgur.com/QdKfQLj
It might be harder to see, but the scanlines are a lot thicker, thicker than the normal lines, and that makes the image looks way darker and kind of wrong.

What happens is pretty simple, on a high def CRT like mine, 480p already has scanlines, but a lot thinner than the 240p scanlines.
So when activating the scandoubler fx, the added fake scanlines are adding up to the already existing 480p scanlines, making the scanlines extra thicker, oversized compared to the normal lines.
For each line there are:
-- one normal line ---------
-- one 480p scanline -------
-- one black line ------------
-- another 480p scanline --

And disabling scandoubler fx doesn't look right either, since the vertical resolution is double compared to 240p, each 240p pixel line has 2 scanlines splitting them (3 if you count both upper and lower ones), which also gives a strange look to it.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4869
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Sorgelig » Mon Jun 17, 2019 4:21 pm

120Hz and scanlines effect are two perpendicular to each other things.
Scanlines Fx on HDMI are applied on output resolution which is not really correct. But it avoids awful scaling when scanlines are applied to original video before scale.
For a good scanlines effect you need to disable Scanlines Fx and use Filter with scanlines effect. It will look proper.

Stremon
Atarian
Atarian
Posts: 6
Joined: Fri Mar 22, 2019 3:47 am

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Stremon » Mon Jun 17, 2019 6:35 pm

Sorgelig wrote:120Hz and scanlines effect are two perpendicular to each other things.
Scanlines Fx on HDMI are applied on output resolution which is not really correct. But it avoids awful scaling when scanlines are applied to original video before scale.
For a good scanlines effect you need to disable Scanlines Fx and use Filter with scanlines effect. It will look proper.

I'm not using the HDMI scaler yet, I'm still trying to see how I can manage to get a better picture through VGA without losing the native VGA modes.

The problem is that since I already get the native CRT scanlines at 480p, no matter which method of scanline I use, the added scanline will always be too thick because of the combination of scanlines like I was saying in my previous post.

Unless I use a higher resolution then use a scanline effect, but the whole point on playing on crt would be lost.

By the way do you know the files when I can find the code for the scandoubler and scandoubler effects? I guess they are in each core, right? For instance in snes core, which file is handling it?

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4869
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Sorgelig » Mon Jun 17, 2019 7:46 pm

Stremon wrote:I'm not using the HDMI scaler yet, I'm still trying to see how I can manage to get a better picture through VGA without losing the native VGA modes.

The problem is that since I already get the native CRT scanlines at 480p, no matter which method of scanline I use, the added scanline will always be too thick because of the combination of scanlines like I was saying in my previous post.

For VGA output scanlines applied correctly to native resolution which is scandoubled in advance. Every second line will be darker according to amount of darkness applied. So simply disable any artificial scanlines in your TV if there are such, and then enable scanlines on MiSTer. It will work correctly. Nothing you can do to improve it. And of course you need to disable any additional image processing in your TV as scanlines are easy to get corrupted if for example scaling applied (that's why HDMI output has separate scanlines FX applied after scaling).

Stremon wrote:By the way do you know the files when I can find the code for the scandoubler and scandoubler effects?

try to guess by file name.

Stremon
Atarian
Atarian
Posts: 6
Joined: Fri Mar 22, 2019 3:47 am

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby Stremon » Tue Jun 18, 2019 1:53 am

Sorgelig wrote:
Stremon wrote:I'm not using the HDMI scaler yet, I'm still trying to see how I can manage to get a better picture through VGA without losing the native VGA modes.

The problem is that since I already get the native CRT scanlines at 480p, no matter which method of scanline I use, the added scanline will always be too thick because of the combination of scanlines like I was saying in my previous post.

For VGA output scanlines applied correctly to native resolution which is scandoubled in advance. Every second line will be darker according to amount of darkness applied. So simply disable any artificial scanlines in your TV if there are such, and then enable scanlines on MiSTer. It will work correctly. Nothing you can do to improve it. And of course you need to disable any additional image processing in your TV as scanlines are easy to get corrupted if for example scaling applied (that's why HDMI output has separate scanlines FX applied after scaling).

Stremon wrote:By the way do you know the files when I can find the code for the scandoubler and scandoubler effects?

try to guess by file name.

Thanks for your answer but once again you didn't read my message carefully.

As I mentioned many times since my very first message, I am not using a TV but a computer CRT with a quite high native resolution (1600*1200).
This resolution is great since pretty much any SD resolution look sharp and without deformation on it.
But if you know how CRT and analog signal work, you also know that on higher resolution display, lower resolution always show scanlines, since it doesn't stretch nor upscale the image like LCDs do. This is not fake scanlines but real ones. That's how analog signal work with CRTs. That's what gives them this characteristic look.
It's the same on all CRTs, low def or high def.

So can you tell me where the scandoubler code is usually located in the source code of the MiSTer cores?
Filenames aren't helping much...
Edit: nevermind I found it, I was searching in the Src folder

glaucon1984
Atari User
Atari User
Posts: 32
Joined: Fri Aug 04, 2017 12:23 pm

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby glaucon1984 » Wed Jul 31, 2019 2:42 pm

amadama wrote:If you have an HDMI to VGA converter try the following custom video mode:

video_mode=1920,48,192,240,240,3,10,8,75170

This should, in theory, show a 1920x240 display at 120hz. Not sure if this will work on the MiSTer.

All my CRT VGA monitors are in storage at the moment so I haven't tested it out, but this is derived from what I've seen other people do to get 240p at 120hz on a CRT VGA monitor.

Let me know if it works for you.


Sorry for the late reply.
I can get it working with vsync_adjust=0, and while the OSD shows correctly with crisp scanlines, the core (SNES in this case) is shrinked to one small vertical band (1/5th) of the screen.

Image

Other vsync modes give me 15KHz signal which is not supported by my monitor.

EDIT: that picture is with the width setting of the monitor set to the maximum possible.

BahnYuki
Retro freak
Retro freak
Posts: 12
Joined: Sun Dec 23, 2018 11:20 pm

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby BahnYuki » Wed Jul 31, 2019 6:05 pm

As someone who created a 240p/120hz custom resolutions on my crt monitor, I'm very interested in this. There's a significant image quality going this route vs filters/scalefx.

Keep up the good work, I look forward to trying it out myself.

ghogan42
Atari maniac
Atari maniac
Posts: 83
Joined: Wed Oct 17, 2018 7:27 pm

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby ghogan42 » Thu Aug 01, 2019 4:22 am

glaucon1984 wrote:
amadama wrote:If you have an HDMI to VGA converter try the following custom video mode:

video_mode=1920,48,192,240,240,3,10,8,75170

This should, in theory, show a 1920x240 display at 120hz. Not sure if this will work on the MiSTer.

All my CRT VGA monitors are in storage at the moment so I haven't tested it out, but this is derived from what I've seen other people do to get 240p at 120hz on a CRT VGA monitor.

Let me know if it works for you.


Sorry for the late reply.
I can get it working with vsync_adjust=0, and while the OSD shows correctly with crisp scanlines, the core (SNES in this case) is shrinked to one small vertical band (1/5th) of the screen.

Image

Other vsync modes give me 15KHz signal which is not supported by my monitor.

EDIT: that picture is with the width setting of the monitor set to the maximum possible.


As I explained in a previous post, mister assumes pixels are square. So if you run snes core and set 4:3 aspect ratio you get* a 298x224 image letter boxed in your 1920x240 resolution. You would need a custom mister binary that computes aspect ratios differently and knows the aspect ratio of your intended display.

*actually not 298x224 because snes is not 4:3 when you set 4:3. Internally the core does the right thing to match the actual not-quite 4:3 output of the actual snes hardware.

jfroco
Atarian
Atarian
Posts: 2
Joined: Tue Aug 20, 2019 11:41 pm

Re: 240p/120Hz instead of 480p/60Hz for VGA scandoubler?

Postby jfroco » Wed Aug 21, 2019 12:10 am

Sorry for reopening this, but I'm using this configuration to get 320x240@120Hz from the VGA port:

Code: Select all

forced_scandoubler=0
ypbpr=0
composite_sync=0
vga_scaler=1
video_mode=320,8,32,40,240,3,4,14,12530


I see the scanlines...

Image
Image

As you can see the output is very similar to scandoubler with CRT 75%, but the scanlines are more defined.


Return to “MiSTer”

Who is online

Users browsing this forum: PsyFX and 4 guests