English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 09 April 2017, 15:15   #1
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,754
OS wide gamma correction Part 2.

After writing a simple program that patches LoadRGB4 and LoadRGB32 to apply gamma correction, which works fine, I tried to patch GetRGB32 so that it can return the original color values. Because LoadRGB32 takes 32bit values for each component, I assumed that these were just stored as is, so that I could store the original values in that (gamma corrected byte, original byte, two zero bytes). Turns out that only the top byte of each component is actually used, the rest is discarded (missed it in the docs).

Major pain

Other than storing a color table for each viewport, does anyone have any ideas as how to get GetRGB32 to return the original, uncorrected color values? Note that gamma correction is lossy, so you can't just reverse it.

Perhaps the LoadRGB functions shouldn't be patched, but something else?
Thorham is offline  
Old 10 April 2017, 09:08   #2
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by Thorham View Post
Perhaps the LoadRGB functions shouldn't be patched, but something else?
You could try patching graphics.library/MakeVPort or graphics.library/MrgCop.
Or bin your old monitor and get one that does not need gamma correction
meynaf is offline  
Old 10 April 2017, 13:34   #3
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,754
Quote:
Originally Posted by meynaf View Post
You could try patching graphics.library/MakeVPort or graphics.library/MrgCop.
Yeah, that might be a good idea. Both require messing with copper lists, though.

Seems worth looking at, thanks.

Quote:
Originally Posted by meynaf View Post
Or bin your old monitor and get one that does not need gamma correction
Noooooo
Thorham is offline  
Old 10 April 2017, 18:48   #4
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,754
Turns out you don't have to mess with the copper lists (thank goodness).

Basic steps:

1. Patch makevport by copying the colortable over and applying the gamma correction to the copy. Have makevport use the copy, and restore the original pointer.

2. Patch loadrgb32 to set gamma corrected colors. Make a new color table with the original colors.

3. Done

...or so it seems
Thorham is offline  
Old 10 April 2017, 19:08   #5
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Good news. The trick seems to be catching the color data right before the coplist is made, so u don't have to store original colors. At least it was what made me suggest getting to a lower level...
meynaf is offline  
Old 10 April 2017, 19:40   #6
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,754
It mostly works. Grabbed screens use original colors, etc. There's still a problem. Some screens don't get corrected. Probably something small.
Thorham is offline  
Old 11 April 2017, 14:29   #7
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,754
It seems that it's impossible to get it to work completely properly like this The OS probably just sticks the colors directly into the copperlist. If only it was possible to safely call this routine.

Guess it's time to look into changing a viewport's copperlist manually. Hopefully that will be a little easier than I thought.
Thorham is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Alien Breed 3D, stuck on level 8, Test Area Gamma HardStep support.Games 18 25 September 2019 01:22
OS wide gamma correction. Thorham Coders. System 62 26 June 2016 23:10
HUE correction [was colour correction] Marcuz request.UAE Wishlist 6 17 September 2008 22:13

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 18:17.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07396 seconds with 15 queries