Possibility of sharper HDMI output via integer scaling?

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

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

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

Re: Possibility of sharper HDMI output via integer scaling?

Postby Sorgelig » Thu Oct 18, 2018 7:45 am

I cannot control parameters of bilinear filter in run-time. Even in compile time only coefficient fractional bits can be changed.

Locutus73
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Feb 07, 2018 6:13 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby Locutus73 » Thu Oct 18, 2018 7:47 am

Sorgelig wrote:If HDMI resolution is 1920x1080, it's already hard to process this resolution while you offer to magnify beyond this? You will climb to incredible clocks and hit the low-cost FPGA limits

I’m not talking about doubling 1920x1080 but having a single line buffer (we discussed early) large enough to accommodate the double of a width resolution for the problem you expressed before with “sometimes resolution after first stage may be close to final resolution while other cases may have edge case with resolution almost twice smaller than final one, so smoothness will be stronger.”… so basically I’m talking about something just slightly larger than 1440x24 bits (for the first stage, the final 1920x1080 is Quartus VIP business), since if we are talking about 4:3 computers the target window is 1440x1080 inside the 1920x1080 HDTV image. Mostly we are talking about low res computers, but probably you are referring to Amiga and ao486; can you give me some specific problematic resolutions you’re worried about, in order to see what is the maximum single line buffer width needed?

Sorgelig wrote:Currently i only see the one possible adjustment - coefficients. If it will be possible to neutralize Lanczos function and act it as Near Neighbor, then it will be possible to choose between sharper and filtered looks.

See my other post.

Regards.

Locutus73
Last edited by Locutus73 on Thu Oct 18, 2018 7:52 am, edited 1 time in total.

Locutus73
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Feb 07, 2018 6:13 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby Locutus73 » Thu Oct 18, 2018 7:49 am

Sorgelig wrote:I cannot control parameters of bilinear filter in run-time. Even in compile time on coefficient fractional bits can be changed.

How can we get a list of run-time variable coefficients for different algorithms?

Thank you in advance.
Best regards.

Locutus73

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

Re: Possibility of sharper HDMI output via integer scaling?

Postby Sorgelig » Thu Oct 18, 2018 7:53 am

Locutus73 wrote:
Sorgelig wrote:I cannot control parameters of bilinear filter in run-time. Even in compile time on coefficient fractional bits can be changed.

How can we get a list of run-time variable coefficients for different algorithms?

Thank you in advance.
Best regards.

Locutus73

Different algorithms have different run-time parameters. Only polyphase allows to change coefficients at runtime. There is even edge adaptive option which allows to use different coefficients on edges - but this part is not well documented and doesn't provide default coefficients to try.

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

Re: Possibility of sharper HDMI output via integer scaling?

Postby Sorgelig » Thu Oct 18, 2018 5:36 pm

It seems Polyphase can be turned to Near Neighbor by coefficients.
Testing now - and it looks exactly the same as NN.

cacophony
Atari maniac
Atari maniac
Posts: 82
Joined: Sun Jul 22, 2018 11:14 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby cacophony » Thu Oct 18, 2018 6:02 pm

Sorgelig wrote:It seems Polyphase can be turned to Near Neighbor by coefficients.
Testing now - and it looks exactly the same as NN.


Great news! :D

BitsNStuff
Retro freak
Retro freak
Posts: 12
Joined: Tue Oct 16, 2018 7:55 am
Contact:

Re: Possibility of sharper HDMI output via integer scaling?

Postby BitsNStuff » Thu Oct 18, 2018 6:13 pm

Fantastic!!

Everybody has their own preferred solution so having options like that would be good for everybody. :D

vanfanel
Atari User
Atari User
Posts: 38
Joined: Tue Oct 09, 2018 10:19 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby vanfanel » Thu Oct 18, 2018 6:31 pm

Sorgelig wrote:It seems Polyphase can be turned to Near Neighbor by coefficients.
Testing now - and it looks exactly the same as NN.


Phew!! That's the best thing I have read in a long time! :D
Fantastic news!

Locutus73
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Feb 07, 2018 6:13 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby Locutus73 » Thu Oct 18, 2018 6:45 pm

Sorgelig wrote:It seems Polyphase can be turned to Near Neighbor by coefficients.
Testing now - and it looks exactly the same as NN.

Great news dude!
Now, if tests are successful, I believe that, if the right taps/coefficients can turn polyphase into NN for integer scaling, another similar set of taps/coefficients can make it to linearly scale only target display pixels that cover the edges of original scaled pixels, implementing the "pixel edge interpolation" we discussed for non integer interpolation... having the option to switch settings at runtime!!! GREAT :cheers:
Now I have a question: can Quartus VIP scaler use different sets of parameters for horizontal and vertical scaling?
So we could i.e. integer scale using NN the vertical axis and non integer scale the horizontal axis using "pixel edge interpolation"... that would be end game!

Thank you.
Regards.

Locutus73

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

Re: Possibility of sharper HDMI output via integer scaling?

Postby Sorgelig » Thu Oct 18, 2018 6:52 pm

Locutus73 wrote:can Quartus VIP scaler use different sets of parameters for horizontal and vertical scaling?
So we could i.e. integer scale using NN the vertical axis and non integer scale the horizontal axis using "pixel edge interpolation"

yes. Coefficients can be independent on X and Y. Coefficients can have any values in the range. They don't need to be exactly from Lanczos function. So, i think with correct values it's possible to simulate bilinear. And of course it's possible to mix amount of polyphase making something between NN and polyphase.

Well. It still need to be tested. Currently i'm struggling with uploading coefficients correctly. Hope everything will be solved.

Locutus73
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Feb 07, 2018 6:13 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby Locutus73 » Thu Oct 18, 2018 7:07 pm

Sorgelig wrote:
Locutus73 wrote:can Quartus VIP scaler use different sets of parameters for horizontal and vertical scaling?
So we could i.e. integer scale using NN the vertical axis and non integer scale the horizontal axis using "pixel edge interpolation"

yes. Coefficients can be independent on X and Y. Coefficients can have any values in the range. They don't need to be exactly from Lanczos function.

GREAT, you're the man!!!
Independent coefficients are wonderful... as I said in the other thread, a guy on the Discord channel is testing arbitrary target window in order to scale the original image to whatever width and height, so we could have integer or non integer on single axis with letter boxing, full screen, cropping, whatever... this plus independent polyphase params could lead i.e. to having a vertical axis integer scaled with NN and an horizontal axis interpolated.

Sorgelig wrote:So, i think with correct values it's possible to simulate bilinear. And of course it's possible to mix amount of polyphase making something between NN and polyphase.

Yeah! And this mix is what I call "pixel edge interpolation"... it should work like NN inside enlarged pixels and like linear just when traversing pixel borders/edges: great for non integer scaling in retro gaming/computing.

Sorgelig wrote:Well. It still need to be tested. Currently i'm struggling with uploading coefficients correctly. Hope everything will be solved.

I knew that once we stimulate your curiosity you're unstoppable man!

All these features put together are going to put MiSTer scaler on a level of retro gaming picture quality bliss and perfection!!!

Thank you
Regards

Locutus73

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

Re: Possibility of sharper HDMI output via integer scaling?

Postby Sorgelig » Thu Oct 18, 2018 7:20 pm

Locutus73 wrote:I knew that once we stimulate your curiosity you're unstoppable man!

yeah.. like to tell the joke to entertain yourself...

Locutus73
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Feb 07, 2018 6:13 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby Locutus73 » Thu Oct 18, 2018 7:26 pm

Sorgelig wrote:
Locutus73 wrote:I knew that once we stimulate your curiosity you're unstoppable man!

yeah.. like to tell the joke to entertain yourself...

Language barrier: I didn’t understand what you mean :(

Regards.

Locutus73

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

Re: Possibility of sharper HDMI output via integer scaling?

Postby Sorgelig » Thu Oct 18, 2018 8:08 pm

By the way, is there an online calc of Lanczos function on given amount of taps and phases?

Locutus73
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Feb 07, 2018 6:13 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby Locutus73 » Thu Oct 18, 2018 8:11 pm

Sorgelig wrote:By the way, is there an online calc of Lanczos function on given amount of taps and phases?

This morning I searched for something like that or a computer program to do that, but I didn’t find anything.
That doesn’t mean there is no one available, but I didn’t find it.

Regards.

Locutus73

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

Re: Possibility of sharper HDMI output via integer scaling?

Postby Sorgelig » Thu Oct 18, 2018 10:19 pm

ok. Wrote my own calc :)

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

Re: Possibility of sharper HDMI output via integer scaling?

Postby Sorgelig » Fri Oct 19, 2018 11:41 am

New Genesis release supports coefficients loading.
You need to update MiSTer binary as well.

By default Genesis uses polyphase scaling. To switch to Near Neighbor, you need to copy coeff.txt file into Genesis folder.

example of coeff.txt file for NN is here: https://github.com/MiSTer-devel/Main_Mi ... eff_nn.txt

Locutus73
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Feb 07, 2018 6:13 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby Locutus73 » Fri Oct 19, 2018 12:05 pm

Sorgelig wrote:example of coeff.txt file for NN is here: https://github.com/MiSTer-devel/Main_Mi ... eff_nn.txt

Great man!
So maximum customization for each axis.
Is there any Altera doc somehow describing the parameters in order to fiddle with those not using completely random numbers?

[EDIT]
I guess this is a good starting point
https://www.intel.com/content/dam/www/p ... p-16.0.pdf
Other suggestions?


Thank you in advance
Best regards

Locutus73

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

Re: Possibility of sharper HDMI output via integer scaling?

Postby Sorgelig » Fri Oct 19, 2018 2:35 pm

It's not Altera specific thing. It's common known polyphase filtering.
some info is here: https://www.embedded.com/print/4017531

Locutus73
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Feb 07, 2018 6:13 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby Locutus73 » Fri Oct 19, 2018 3:01 pm

Sorgelig wrote:It's not Altera specific thing. It's common known polyphase filtering.
some info is here: https://www.embedded.com/print/4017531

Good, and do you have the coefficients used by default when not using coeff.txt? Do they correspond to coeff_pp.txt?
Anyway as far I understand each row is a phase with its 4 coefficients right?

Thank you in advance
Regards

Locutus73

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

Re: Possibility of sharper HDMI output via integer scaling?

Postby Sorgelig » Fri Oct 19, 2018 3:26 pm

Locutus73 wrote:Good, and do you have the coefficients used by default when not using coeff.txt? Do they correspond to coeff_pp.txt?
Anyway as far I understand each row is a phase with its 4 coefficients right?

Different cores may use different default coefficients. Genesis uses the same default coefficients as coeff_pp.txt

kitrinx
Atarian
Atarian
Posts: 9
Joined: Wed Sep 26, 2018 6:03 am

Re: Possibility of sharper HDMI output via integer scaling?

Postby kitrinx » Sat Oct 20, 2018 2:35 am

I discovered today that if you build the cores with 1920x1200 as maximum input and output, you can use 1920x1200 resolution with mister, and the new integer scaling will correctly do 5x scaling to 1200. It might be worth building cores with 1200p support going forward.

Locutus73
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Feb 07, 2018 6:13 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby Locutus73 » Sat Oct 20, 2018 6:32 am

kitrinx wrote:I discovered today that if you build the cores with 1920x1200 as maximum input and output, you can use 1920x1200 resolution with mister, and the new integer scaling will correctly do 5x scaling to 1200. It might be worth building cores with 1200p support going forward.

Hi, are you Rysha or Jeebs on the Classic Gaming Discord server or did you help them?
Otherwise probably you discovered that someone else discovered that.
Not that much important, tho... credit where credit is due.

Regards
Locutus73

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

Re: Possibility of sharper HDMI output via integer scaling?

Postby Sorgelig » Sat Oct 20, 2018 7:10 am

I discovered if i grab 5 apples then there will be 5 apples in my hands. Magic!

1920x1200 requires 193MHz pixel clock. I don't want to climb to this clock as some cores are already unstable. So, 1920x1080 is max supported resolution which is standard. 1920x1200 is used in some old monitors (i have such monitor, btw) and not used anymore.

Locutus73
Captain Atari
Captain Atari
Posts: 170
Joined: Wed Feb 07, 2018 6:13 pm

Re: Possibility of sharper HDMI output via integer scaling?

Postby Locutus73 » Sat Oct 20, 2018 7:19 am

Sorgelig wrote:I discovered if i grab 5 apples then there will be 5 apples in my hands. Magic!



Regards.
Locutus73



Return to “MiSTer”

Who is online

Users browsing this forum: No registered users and 5 guests