Gamma correction

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

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

bhamadicharef
Atariator
Atariator
Posts: 23
Joined: Tue Jul 18, 2017 8:31 am
Location: Singapore

Re: Gamma correction

Post by bhamadicharef »

The ADV7513 does not seem to have Gamma correction
https://www.analog.com/en/products/adv7513.html
Brahim HAMADI CHAREF:: Singapore
paulbnl
Captain Atari
Captain Atari
Posts: 151
Joined: Wed Oct 24, 2018 9:43 am

Re: Gamma correction

Post by paulbnl »

The ADV dsp is just basic multiplication/division so it is not suitable for gamma correction.

Can we re-use the scaler's 8bit palette to use as LUT?
ghogan42
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 109
Joined: Wed Oct 17, 2018 7:27 pm

Re: Gamma correction

Post by ghogan42 »

paulbnl wrote:The ADV dsp is just basic multiplication/division so it is not suitable for gamma correction.

Can we re-use the scaler's 8bit palette to use as LUT?
Grabolosaure told me months ago that it can be used for that.

I asked him about fully gamma correct blending for the upscaling (requires gamma LUT at the beginning of the scaler and again at the end at output resolution). He said no because it would require more hardware in the scaler and would not be worth it.

But gamma like you have implemented he said could be done. Or maybe he has done? I don't remember.
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Gamma correction

Post by Sorgelig »

"No" doesn't always means it's impossible. Sometimes it requires unreasonably high resources and of course more timing violations and hence instability.

Also, scaler is for scaled HDMI video. It won't work with direct video.
My original idea is to put gamma control to core side (not in framework). So each core will deal with instability separately. 256 bytes in logic with quadruple address decoder is quite large logic area!

actually gamma correction could be made inside the VDP/PPU on palette level. So it could be a free solution. May be not so flexible. But with several choices for palette correction could be done.
Threepwood
Captain Atari
Captain Atari
Posts: 154
Joined: Thu Jan 10, 2019 10:06 am

Re: Gamma correction

Post by Threepwood »

Just downloaded the update with gamma correction in the main branch. Congratulations, it works great!

Will it be possible to add this to all cores over time?
2x MiSTer FPGA: [Official Stormtrooper Case, USB Hub 2.1 with Bridge Board, 128MB SDRAM, ADC, RTC 1.3, I/O v5.5] + [3D printed MiSTer XS Case v2, 128MB SDRAM, I/O v5.6 XL]
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Gamma correction

Post by Sorgelig »

paulbnl did a great job in refactoring the code, so now it uses BRAM and minimum logic and therefore is good to integrate.

But in general, I still don't see much use of that. In most cases well adjusted brightness and contrast on a good quality monitor provides a great picture without gamma corrections.
Many small monitors (<13") today are produced mostly by unknown cost saving companies and have garbage quality of color level representation. I have several such monitors.
Threepwood
Captain Atari
Captain Atari
Posts: 154
Joined: Thu Jan 10, 2019 10:06 am

Re: Gamma correction

Post by Threepwood »

Sorgelig wrote:paulbnl did a great job in refactoring the code, so now it uses BRAM and minimum logic and therefore is good to integrate.
That's awesome to hear!
Sorgelig wrote:But in general, I still don't see much use of that. In most cases well adjusted brightness and contrast on a good quality monitor provides a great picture without gamma corrections.
Well, we covered this already extensively in this thread. No LCD offers the necessary gamma corrections and thus it is not a case of "just buy a better monitor", besides the article pualbnl linked written by byuu covers the issue quite well. No matter what, thank you and all involved for integrating this feature, it is very appreciated.
Sorgelig wrote:Many small monitors (<13") today are produced mostly by unknown cost saving companies and have garbage quality of color level representation. I have several such monitors.
Take a look at monitors by https://www.beetronics.co.uk/ They sell industrial grade small screens with IPS panels. I have their 15" 4:3 IPS (Model 15VGM), which is gorgeous.
2x MiSTer FPGA: [Official Stormtrooper Case, USB Hub 2.1 with Bridge Board, 128MB SDRAM, ADC, RTC 1.3, I/O v5.5] + [3D printed MiSTer XS Case v2, 128MB SDRAM, I/O v5.6 XL]
paulbnl
Captain Atari
Captain Atari
Posts: 151
Joined: Wed Oct 24, 2018 9:43 am

Re: Gamma correction

Post by paulbnl »

Sorgelig also suggested to add per component gamma correction so it is now also possible to put 3 comma separated values per line instead of 1 if you would want to adjust colors separately.
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Gamma correction

Post by Sorgelig »

Threepwood wrote:Take a look at monitors by https://www.beetronics.co.uk/ They sell industrial grade small screens with IPS panels. I have their 15" 4:3 IPS (Model 15VGM), which is gorgeous.
In many cases "professional monitor" means some specific feature and completely disregards many other features. I've bough Lilliput monitor which is also called "professional" It has many buttons and rockers on face plate, it comes with sunshade and battery options, It has many digital and analog inputs. So it pretends to be a professional but:
- glossy screen - only this option should remove this monitor from professional category.
- it doesn't lock to input frame rate. So it's locked internally to 60Hz regardless input frequency.
- dark levels are quite rubbish regardless the settings.
Otherwise it's professional :mrgreen:
JamesF
Captain Atari
Captain Atari
Posts: 159
Joined: Sat Dec 15, 2018 6:46 am

Re: Gamma correction

Post by JamesF »

Attached Polynomial Gamma with 2.3 to 3.0 cure below 50% input in 0.1 jumps, and above that is your native gamma.
Looks fantastic, please try.
You do not have the required permissions to view the files attached to this post.
Threepwood
Captain Atari
Captain Atari
Posts: 154
Joined: Thu Jan 10, 2019 10:06 am

Re: Gamma correction

Post by Threepwood »

Sorgelig wrote:In many cases "professional monitor" means some specific feature and completely disregards many other features. I've bough Lilliput monitor which is also called "professional" It has many buttons and rockers on face plate, it comes with sunshade and battery options, It has many digital and analog inputs. So it pretends to be a professional but:
- glossy screen - only this option should remove this monitor from professional category.
- it doesn't lock to input frame rate. So it's locked internally to 60Hz regardless input frequency.
- dark levels are quite rubbish regardless the settings.
Otherwise it's professional :mrgreen:
I know, that is why I recommend you the beetronics monitors I mentioned ;) Mine has many inputs (including BNC), matte quality IPS, 4:3, metal frame including mount rails, is firmware updateable, has a remote and I can use my 60Hz modded SEGA Master System in 50Hz and 60Hz with it directly without conversion or upscaling (the display tells you the mode, PAL or PAL-60 automatically). Ain't a cheap display, though.
JamesF wrote:Attached Polynomial Gamma with 2.3 to 3.0 cure below 50% input in 0.1 jumps, and above that is your native gamma.
Cool, will give them a test later :)
2x MiSTer FPGA: [Official Stormtrooper Case, USB Hub 2.1 with Bridge Board, 128MB SDRAM, ADC, RTC 1.3, I/O v5.5] + [3D printed MiSTer XS Case v2, 128MB SDRAM, I/O v5.6 XL]
softtest1
Atari User
Atari User
Posts: 34
Joined: Tue Apr 30, 2019 6:37 pm

Re: Gamma correction

Post by softtest1 »

Would it be possible to go the other way? I feel that Megadrive games are usually on the dark side, but I don't want the blacks to become grey. Some kind of polynominal brightening may be a good addition.
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Gamma correction

Post by Sorgelig »

both ways are possible
Locked

Return to “MiSTer”