Re: [stella] tia hue luminance

Subject: Re: [stella] tia hue luminance
From: "Eric Ball" <ericball@xxxxxxxxxxxx>
Date: Tue, 9 Dec 2003 21:40:10 -0500
You're right, I did have a mistake in the equations I posted.  I calculated
the Y' factor using 3 LM bits, but then wrote the calculation with 4 bits.

Y' = ( COLU AND 15 ) * 0.045
hue = 180 degrees - ( COLU / 16 - 1 ) * 24 degrees
saturation = 0 if ( COLU / 16 == 0 ), otherwise saturation = 20 / 92.5
U' = saturation * cos ( hue )
V' = saturation * sin ( hue )

R' = 1.140V' + Y'
G' = Y' - 0.3947U' - 0.5808V'
B' = 2.033U' + Y'

Clip the values of R'G'B' to the range 0.0 - 1.0.

I'm not sure why my colors are off.  I thought it might have been that I
reversed something somewhere, but I just double checked my spreadsheet and
don't see any problems.  Maybe Adam will have better luck with his program.

Gamma is a pain.  I kind of understand it; though it's easy to get confused.
The math is a simple power function and the objective is to end up with a
linear output.  Unfortunately, unless you control the entire display path
(or at least have some hard documentation), it's tough to figure out whether
you need to apply some kind of gamma correction to get that linear output.
Plus, there's no guarantee that everyone has the same setup.

For the moment, we may want to generate sample output both with (aka linear)
and without (non-linear) gamma correction.  Oh, and the background should be
black (or at least dark grey) because the 2600 typically displays a black
border and a white background will make my palette look very dark.

Archives (includes files) at
Unsub & more at

Current Thread