English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 09 April 2017, 16:15   #1
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 41
Posts: 2,964
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  
AdSense AdSense  
Old 10 April 2017, 10:08   #2
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 44
Posts: 2,420
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 online now  
Old 10 April 2017, 14:34   #3
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 41
Posts: 2,964
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, 19:48   #4
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 41
Posts: 2,964
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, 20:08   #5
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 44
Posts: 2,420
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 online now  
Old 10 April 2017, 20:40   #6
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 41
Posts: 2,964
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, 15:29   #7
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 41
Posts: 2,964
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  
AdSense AdSense  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
OS wide gamma correction. Thorham Coders. System 62 27 June 2016 00:10
Doom 64 - Gamma Fix Nibbler OT - Gaming 13 25 May 2016 20:22
Alien Breed 3D, stuck on level 8, Test Area Gamma HardStep support.Games 11 26 June 2011 15:20
HUE correction [was colour correction] Marcuz request.UAE Wishlist 6 17 September 2008 23: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 14:36.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.13050 seconds with 14 queries