AVS Forum banner
Status
Not open for further replies.
1 - 8 of 8 Posts

·
Registered
Joined
·
1,524 Posts
Discussion Starter · #1 ·
Thanks to milori, who pointed out to me the SetDeviceGammaRamp function in Windows, I've put together a simple command line app for tweaking the gamma on your HTPC. It's very small and simple. (In fact, the C++ source code is smaller than the readme file!)


My HTPC is currently taken down, as my theater is being built, so I can't really do a lot of testing. But anyone wants to give it a whirl, feel free!


You can download it here . I'm attaching the included readme file below:


USE AT YOUR OWN RISK!!!! I've only spent a few hours on it. I ran it on my 1 computer, and nothing Bad happened. All other standard disclaimers/lack of warranty stuff...


Mike

----------------------------------


GammaControl.exe

----------------

The purpose of this program is to allow you to tweak the gamma curve on your HTPC. You can individually adjust any point on the gamma curve, either all colors at once or a single color at a time.


Background

----------

An HTPC, in particular the graphics card, gets an input signal, and applies a mapping to that signal before outputing it. By default, cards apply an identity mapping, i.e. what comes in is what goes out. But as Mark Hunter (milori) pointed out to me, in Windows there's an API, SetDeviceGammaRamp, which lets you modify that mapping. If your monitor/projector has a green shift, meaning it puts out too much green, you can tell your card to reduce the green signal before it's sent to your projector. These changes to your gamma ramp will last until you reboot your computer


About the program

-----------------

When you run the program, it starts out with a straight line gamma ramp, from 0% IRE, 0% output, to 100% IRE, 100% output, for all 3 colors. You can then modify either of the endpoints, or add arbitrarily many internal points. The program essentially draws straight lines between all the points, and that's your gamma curve.


How to use

==========

Tweaker's mode

---------------

Run it with no arguments. It first resets your gamma curve to be linear. Then you get a command prompt. Commands are of a single capital letter (usually), followed by arguments, if any. There are no spaces seperating the commands from the args. Valid commands:


IRE: I<value>

Adds a point at the given IRE value. If there was already one there, it replaces it. <Value> must be between 0 and 1, inclusive.

example:

I.2

The above adds a point at 20% IRE, with red, green, and blue output of 20%. (The point always starts as if it came off the linear ramp.)


Change color point: [RGBW][+-]{percent}

For a given point, the color output of that point will be modified. It works on whatever your current point is. Initially, the point you are modifying is the last point on the curve, the 100% IRE point. Whenever you do an 'I' command, that new IRE level becomes the current point.

You can increase or decrease any of the individual red/green/blue components by a given percent, or you can decrease all of them by that percent with the 'W'hite command. If no percent is given, it defaults to 10%.

examples:

R+30

Increase the red output percentage at the current IRE by 30%. Note this is not additive. If you're at 50% IRE, and you're starting with a linear curve, red output would be 50%. To increase by 30% will set it to 50% * 1.3, *not* 80%.


W-10

Reduce all color components by 10% at the current IRE point


Set-and-exit mode

-----------------

Every time you make a change in Tweaker's mode, the program will generate a gamma curve file, in "out_table.txt". This file is the complete gamma curve specification. If you want to save it, copy it somewhere. When you run GammaControl.exe, you can give a filename as an argument. If you do, it will set in that gamma curve, and then exit. This mode is meant for your Windows->Startup, to set a gamma curve every time you boot.


Suggested usage

---------------

Let's say you have a green push. The simplest thing to do is just start up the program, you're at the 100% IRE point, so just decrease the green:

G-20

Now you're green output will be decreased by 20% throughout your spectrum.


If you want to be more accurate, go to a photo store and get a Kodak Gray reference card. Put up an IRE 80% pattern from Avia (or wherever). From the program, do:

I.8

to move to the 80% IRE point. Then tweak the individual colors up and down until you get an exact gray that matches a reference gray. You don't have to worry about brightness, at this step you're just worrying about colors.


You can then check other IRE points, hopefully they're a good gray, but you can tweak some of the other points too. Note that if you start at 80%, tweak that, then move to 40%, initially the 40% IRE output will be an interpolation between 0% and your tweaked 80%. But once you do the command:

I.4

you add another point, 40% output for all colors at 40% IRE. This is *not* the curve you saw just before the "I.4 command", as your tweaked 80% IRE was also moving the 40% IRE point. This is really sub-optimal behavior, but if I document it, it's a feature, not a bug, right? :)


The next step is to get a light meter. Theoretically, you can a Radio Shack photosensor for like $3, hook it up to a digital multimeter (<$20), and get some kind of light readings. Put up a 0% IRE pattern, 10%, 20%, ... 100%. You want a linear output. What this means is that the difference in readings between any two adjacent IRE points should be equal. In other words, the reading at 10% IRE minus the reading at 0% IRE should equal the 20% IRE reading minus the 10% reading.


If the output is not linear, you can tweak the various IRE settings with the 'W' command, to move all the colors together.


That's all! Send me e-mail with questions/comments/bug reports.


Michael Flaster

[email protected]



------------------

Join the NYC-area HT club! Send me e-mail!


[This message has been edited by mflaster (edited 08-01-2001).]
 

·
Registered
Joined
·
4,525 Posts
Hi Mike,


Nice work!


(also a gratuitous bump)
 

·
Registered
Joined
·
1,524 Posts
Discussion Starter · #3 ·
Now Mark when you deliver ColorFacts, I won't be bugging you to put in some LUT-modification code! This thing adjusts without measuring, so your thing can measure without adjusting! A match made in heaven! http://www.avsforum.com/ubb/smile.gif


Mike



------------------

Join the NYC-area HT club! Send me e-mail!
 

·
Registered
Joined
·
4,378 Posts
Wow, Mike, outstanding work. This will come in handy for a lot of users. Does it alter gamma when Dscaler is running?


Robert


------------------

Robert Clark

See our home theater (with very poor quality pics!)
http://albums.photopoint.com/j/Album...874&a=12744078
 

·
Registered
Joined
·
1,524 Posts
Discussion Starter · #5 ·
There's been some discussion in this thread about whether or not it will affect the overlay. It's possible it will *only* affect dscaler, and not the overlay created by a DVD player.


Despite my <heavy sarcasm>obvious programming prowess</heavy sarcasm>, I know nothing about Windows programming. The call affected my desktop. It also affected the output of Windows Media Player in full-screen mode - is that an overlay?


I'd try it here, but my HTPC is temporarily disassembled. Make some big color shift gamma, and run {dvd player, dScaler, something else}, and see if it affects it!


Mike



------------------

Join the NYC-area HT club! Send me e-mail!
 

·
Registered
Joined
·
80 Posts
Hi,


some caveats:


"Note Gamma ramp capabilities are implemented as part of the GDI display driver, not the 32-bit HAL. In addition, the information provided here applies only to

Windows 98/Me, but not to Windows 2000 and later."


Source: http://msdn.microsoft.com/library/de...ddraw_8m93.asp


So this would only for Win89/SE People be helpful.


Furthermore, AFAIK does the output to the overlay bypass the GDI (this is why you can get Truecolor on Overlay, even if you set 16bit colors in the display settings), so that I think, that adjustments does not affect overlay, but I'll give it a try tonite


Ralph
 

·
Registered
Joined
·
1,524 Posts
Discussion Starter · #7 ·
I just posted the source code for my little app here .


In case anyone can make it work with the overlay!


Mike



------------------

Join the NYC-area HT club! Send me e-mail!
 

·
Registered
Joined
·
1,524 Posts
Discussion Starter · #8 ·
I just posted http://www.avsforum.com/ubb/Forum12/HTML/012786.html#11


I found someone else that has published an app, including source code, for calibrating your gamma. There are limits, though, and I would like some Direct3D help! See my above post.


Mike



------------------

Join the NYC-area HT club! Send me e-mail!
 
1 - 8 of 8 Posts
Status
Not open for further replies.
Top