Scaler

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

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

Grabulosaure
Atari maniac
Atari maniac
Posts: 92
Joined: Tue Sep 05, 2017 9:35 pm
Contact:

Re: Scaler

Postby Grabulosaure » Thu Dec 27, 2018 6:59 pm

Sorgelig wrote:Not sure if we are on the same wave or not, but MiSTer already provides pretty much precise PLL parameters for FPS locking when vsync_adjust option is enabled. It just cannot track the drifting and adjust the clock constantly. So your scaler doesn't need to lock the FPS in wide range as output FPS is already close to input. You just need to track the drifting and fine tune the frequency in tiny range.


Yes, you are right. The software could probably be fast enough to sample the LLSYNC signals (a few Hz would be good enough) to adjust the PLL, and we could get rid of HDMI_PLL_ADJ. As it already monitors the frequency of the input signal, it only needs to sample the phase information.

1) Tune frequency according to measured input signal period.
2) Measure phase.
3) Set new frequency to cancel phase after a fixed delay.
4) Tune back to base frequency
5) Wait a bit, for fresh measurements.
6) Goto (2), until phase is low enough.

In the demo builds of the scaler, the lower line of the TEST mode shows measured phase and frequencies, and can be used to check clock correction.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5366
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Scaler

Postby Sorgelig » Thu Dec 27, 2018 7:08 pm

I would prefer to have a hybrid solution like it's now:
1) HPS provides initial close to ideal tune for PLL
2) HDMI_PLL_ADJ does monitoring and further fine tune the PLL.

Constantly monitoring the phase in HPS will be ineffective in current API as whole HPS<->FPGA communication is done in one thread. Accessing file i/o or even input devices will put phase monitoring on hold and will miss the point. Or this phase monitoring will slowdown the file i/o or gamepad processing.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5366
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Scaler

Postby Sorgelig » Thu Dec 27, 2018 7:20 pm

Grabulosaure wrote:The input part should be able to reach frequencies close to the output part (similar pipelining, same interpoler, same phase accumulator for downsampling...).

just tried - it didn't improve the work in ZX core. The strangest fact is HQ2x/scanlines (CE=28MHz) are working OK while non-processed video (CE=7MHz) has a lot of garbage like old TV didn't tune to station correctly and lines are messed.
This is happened on CLK_VIDEO=112MHz. As i switch to CLK_VIDEO=56MHz - everything is ok.

Grabulosaure
Atari maniac
Atari maniac
Posts: 92
Joined: Tue Sep 05, 2017 9:35 pm
Contact:

Re: Scaler

Postby Grabulosaure » Sat Dec 29, 2018 12:17 am

Sorgelig wrote:just tried - it didn't improve the work in ZX core. The strangest fact is HQ2x/scanlines (CE=28MHz) are working OK while non-processed video (CE=7MHz) has a lot of garbage like old TV didn't tune to station correctly and lines are messed.
This is happened on CLK_VIDEO=112MHz. As i switch to CLK_VIDEO=56MHz - everything is ok.

I have posted a new version of ASCAL, where all inputs are re-clocked.
On this ZX core, the CE signal is generated on _falling edge_. The scaler didn't like that.
(I will optimise a bit the input datapath to reduce some timing limitations.)

There are still atrocious timing errors on that core. The version that I have compiled works only when the FPGA is cold, and errors don't seem to come from the scaler anymore.

Sorgelig wrote:I would prefer to have a hybrid solution like it's now:
1) HPS provides initial close to ideal tune for PLL
2) HDMI_PLL_ADJ does monitoring and further fine tune the PLL.


I'll see how to make HDMI_PLL_ADJ compatible with "vsync_adjust=1"

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5366
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Scaler

Postby Sorgelig » Sat Dec 29, 2018 7:55 am

Grabulosaure wrote:On this ZX core, the CE signal is generated on _falling edge_.

This is pretty common to generate CE on falling edge and use it on rising edge. So timings are more relaxed.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5366
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Scaler

Postby Sorgelig » Sat Dec 29, 2018 8:03 am

Grabulosaure wrote:I'll see how to make HDMI_PLL_ADJ compatible with "vsync_adjust=1"

For test purpose it's OK to have OSD option for low latency with non-standard PLL clock like in your builds. In normal usage this option cannot be placed in OSD as there won't be possible to switch it back in case of no video. Even if TV will work OK it's possible it won't after some time.
THat's why, such option as vsync_adjust is places to MiSTer.ini

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5366
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Scaler

Postby Sorgelig » Sat Dec 29, 2018 3:17 pm

new version works fine with ZX core.

Flausch
Atariator
Atariator
Posts: 27
Joined: Thu Oct 18, 2018 6:27 pm
Location: Germany

Re: Scaler

Postby Flausch » Sat Jan 12, 2019 10:54 am

After the C64 core got the new scaler with the last update, my display only shows a black screen, when using automatic vsync. The same happened to Minimig, when it switched to the new scaler.

At the moment I see only two solutions:
- using older core versions which don't use the new scaler
- using vsync off, which breaks smooth scrolling

I there any other solution to fix this?

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5366
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Scaler

Postby Sorgelig » Sat Jan 12, 2019 11:15 am

make sure you use vsync_adjust=1 not 2

Locutus73
Atari Super Hero
Atari Super Hero
Posts: 503
Joined: Wed Feb 07, 2018 6:13 pm

Re: Scaler

Postby Locutus73 » Sat Jan 12, 2019 11:15 am

Maybe I used the wrong thread for a post of mine.
viewtopic.php?f=117&t=34959#p363814

Thank you in advance.
Regards.

Locutus73

bitfan2011
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 111
Joined: Sat Dec 29, 2018 5:46 pm

Re: Scaler

Postby bitfan2011 » Sat Jan 12, 2019 11:26 am

Is it possible to set the config to use 1600x1200 and get 5x integer scaling on 240p sources over HDMI? It seems like it maxes out at 1080p output, which means 4x scaling. Cheers

Flausch
Atariator
Atariator
Posts: 27
Joined: Thu Oct 18, 2018 6:27 pm
Location: Germany

Re: Scaler

Postby Flausch » Sat Jan 12, 2019 11:33 am

Sorgelig wrote:make sure you use vsync_adjust=1 not 2


Of course I do use vsync_adjust=1
The problem is only on some cores like Minimig and C64. Others like SNES work.

JamesF
Captain Atari
Captain Atari
Posts: 155
Joined: Sat Dec 15, 2018 6:46 am

Re: Scaler

Postby JamesF » Sat Jan 12, 2019 11:33 am

I would love to have 1200p mode in mister.ini without custom mode.
This is the Nvidia default for 1920x1200 displays:

Code: Select all

video_mode=1920,48,32,80,1200,3,6,26,154128

User avatar
BitsNStuff
Atari freak
Atari freak
Posts: 64
Joined: Tue Oct 16, 2018 7:55 am
Contact:

Re: Scaler

Postby BitsNStuff » Sat Jan 12, 2019 8:39 pm

I was wondering of it would it be possible to add a non linear gamma slider to the OSD?

I ask as many of the scan-line options don't line up with the actual pixels on the newer selections that we have, the only one that seems to line up correctly for me are the LCD filters when used on Gameboy. Due to that I've been using the original 25%/50%/75% options which line up perfectly with each of the cores irrelevant of whatever other settings I'm using. The only issue I have with the older scan-line options are that they reduce the overall brightness of the screen which would usually be dealt with by non linear gamma correction.

Thanks.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5366
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Scaler

Postby Sorgelig » Sat Jan 12, 2019 9:04 pm

Old scanlines have been removed not due to brightness. It's because Near Neighbor filter gives awful results with non-integer scaling when scanlines are enabled.

bitfan2011
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 111
Joined: Sat Dec 29, 2018 5:46 pm

Re: Scaler

Postby bitfan2011 » Sat Jan 12, 2019 9:09 pm

BitsNStuff wrote:I was wondering of it would it be possible to add a non linear gamma slider to the OSD?

I ask as many of the scan-line options don't line up with the actual pixels on the newer selections that we have, the only one that seems to line up correctly for me are the LCD filters when used on Gameboy. Due to that I've been using the original 25%/50%/75% options which line up perfectly with each of the cores irrelevant of whatever other settings I'm using. The only issue I have with the older scan-line options are that they reduce the overall brightness of the screen which would usually be dealt with by non linear gamma correction.

Thanks.


I have been testing my Mister using both VGA and HDMI output, with the VGA going into an OSSC (w/ scanlines) so I can see the signal information easily.
Going through each core at native video rates and tuning the filters to look correct on both display types (when the core offers both).
I basically turned off all the Scandoubler effects and now use the individual Filter files. That seems to ensure that you are getting 15kHz out of the VGA port when it's available.
I think I only had to use the Scandoubler scanlines on two cores, as they are obscure and don't display the Filter menu.

profd
Atarian
Atarian
Posts: 2
Joined: Sun Jan 13, 2019 8:07 pm

Re: Scaler

Postby profd » Sun Jan 13, 2019 8:11 pm

Hi guys, I hope this is the best thread for this, its either this or a filters thread.

I am having some odd behaviour with my 1440p monitor (PG279Q).

Due to the pixel clock not being able to handle its native resolution I have a choice of 720p, which should be optimal or 1080p.

Unfortunately my monitor does a poor job of scaling 720p and appears to be blurring everything rather than pixel quading. In contrast it seems to handle 1080p upscaling very well, probably because it’s a much more common console usage case so they fine-tuned it. To me 1080p is cleaner than 720p and I have sat here with a magnifying glass trying to figure it out why ! :)

For gaming with scanlines this is fine setting it to 1080p60 with 0.5 integer scaling works great with no arfitacts. However when running an LCD filter there appear to be horizontal scaling issues with a repeating artefact present on both 1080p60 at .5 integer scaling and 720@60 at 1:1 integer scaling, examples can be seen below:

https://photos.app.goo.gl/dYGe6DUCjSxF4Gk67

Its odd that both resolutions seem to exhibit the same problem isnt it?

My next stop was to create a manual non standard resolution locking out a 1440 vertical scale and bringing the horizontal in until the pixel clock on the DE-10 can take it. My monitor should be good for maintaining the aspect ratio.

Can someone point me towards a tool for generating the custom video modes or do we thing some other strange horizontal scaling issue is present here?

Grabulosaure
Atari maniac
Atari maniac
Posts: 92
Joined: Tue Sep 05, 2017 9:35 pm
Contact:

Re: Scaler

Postby Grabulosaure » Mon Jan 14, 2019 12:40 am

profd wrote:Hi guys, ...
I am having some odd behaviour with my 1440p monitor (PG279Q).
Can someone point me towards a tool for generating the custom video modes or do we thing some other strange horizontal scaling issue is present here?

Out of curiosity, can you try :

video_mode=2560,34,20,50,1440,2,4,3,200000

bitfan2011
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 111
Joined: Sat Dec 29, 2018 5:46 pm

Re: Scaler

Postby bitfan2011 » Mon Jan 14, 2019 1:52 am

profd wrote:
Can someone point me towards a tool for generating the custom video modes or do we thing some other strange horizontal scaling issue is present here?


How would I add 1920x1200 and 1600x1200 as custom video modes to Mister? I see other modes in the .ini file, but nothing above 1080p.

profd
Atarian
Atarian
Posts: 2
Joined: Sun Jan 13, 2019 8:07 pm

Re: Scaler

Postby profd » Mon Jan 14, 2019 11:20 am

Grabulosaure wrote:Out of curiosity, can you try :

video_mode=2560,34,20,50,1440,2,4,3,200000


No signal with those settings.

User avatar
Newsdee
Atari God
Atari God
Posts: 1504
Joined: Fri Sep 19, 2014 8:40 am

Re: Scaler

Postby Newsdee » Mon Jan 14, 2019 4:10 pm

This is not a feature request, just mere curiosity on my part:

I recently read a discussion about implementing filters on an emulator to post-process dithering, e.g. detect some patterns in the line and blend the pixel colors to achieve transparency effects or more colors. The examples given were pretty convincing, it especially benefits the Megadrive and early DOS games.

Is that kind of approach (post-processing a line or the entire screen) possible in the current scaler implementation? Or would it require a completely different approach? Not expecting it at all on MiSTer but I thought it was an interesting concept. I suppose it may add lag, though.

JamesF
Captain Atari
Captain Atari
Posts: 155
Joined: Sat Dec 15, 2018 6:46 am

Re: Scaler

Postby JamesF » Mon Jan 14, 2019 7:10 pm

Bug Report:

Cores that use 480i mode like SNES and Genesis, the output will always be 30fps when it should be 60fps.
This can be verified using 240p test suite using 480i mode and 'scroll test'.

SNES affected games: RPM Racing.
Genesis affected games: Sonic 2, 2 player VS mode.

I would assume that these cores do not show each interlaced field as a frame, but two fields as a frame, resulting in half the framerate.
I did not test other cores but I would assume again that interlaced resolutions run half the framerate in all cores that use interlaced modes if it is indeed the scaler responsible for that.

Grabulosaure
Atari maniac
Atari maniac
Posts: 92
Joined: Tue Sep 05, 2017 9:35 pm
Contact:

Re: Scaler

Postby Grabulosaure » Mon Jan 14, 2019 7:43 pm

JamesF wrote:Bug Report: Cores that use 480i mode like SNES and Genesis, the output will always be 30fps when it should be 60fps.

Yes. I think I can change it. Currently triple buffering pointers are updated every other frame in interlaced mode. I could use two pointers, one for each half-frame. Should the half rate be kept as an option ?

Newsdee wrote:Implementing filters on an emulator to post-process dithering

Do you have any link ? I don't quite understand.
A design limitation is that horizontal and vertical interpolations are separate, it's two vectors, not a matrix.

JamesF
Captain Atari
Captain Atari
Posts: 155
Joined: Sat Dec 15, 2018 6:46 am

Re: Scaler

Postby JamesF » Mon Jan 14, 2019 7:53 pm

Grabulosaure wrote:Should the half rate be kept as an option ?

Personally I don't see a reason to keep the half rate as an option, since no other emulator does that and it will further confuse users.
Both options have combing artifacts in horizontal motion, so there is nothing beneficial in having the half rate as an option.
Thanks for looking into it Grabulosaure.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5366
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Scaler

Postby Sorgelig » Mon Jan 14, 2019 8:01 pm

Grabulosaure wrote:Should the half rate be kept as an option ?

If double frame rate won't be in cost of lower deinterlace quality then there is no reason for half rate option.

Will be improvements in accumulator?


Return to “MiSTer”

Who is online

Users browsing this forum: selfslaughter and 8 guests