## Re: [stella] tia hue luminance

 Subject: Re: [stella] tia hue luminance From: Adam Wozniak Date: Sat, 6 Dec 2003 09:06:01 -0800 (PST)
```On Fri, 5 Dec 2003, Eric Ball wrote:
> Note: R'G'B' are non-linear values which should be limitted to the range
> 0.0 - 1.0 and represent the voltage used to drive the CRT guns.  Linear RGB
> requires a gamma correction of 2.2 from R'G'B'.

As with every conversion I've ever seen posted here, the equations yeild
values below zero and above 1.  Do you clip these?  Scale them?

Here are some examples:

COLU     R'     G'      B'
16       0      .283    -.428
158      1.35   -.055   1.818

The problem always lies here:

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

> Y' = 0.1 * ( COLU AND 15 )

> hue = 180 degrees - ( COLU / 16 - 1 ) * 24 degrees
> saturation = 0 if ( COLU / 16 == 0 ), otherwise saturation = 40/190
> U' = saturation * cos ( hue )
> V' = saturation * sin ( hue )

U' and V' can range from 0 to +/- 0.2105
Y' can range from 0 to 1.5

In a worst case U'=-0.215 and Y'=0, B' =2.033*-0.2105+0 = -0.428
Which is about what you see for COLU=16

At first I thought it would work out if you could just pick the right
value for saturation, but Y' can always be zero, meaning there is
always a way to get R', G', or B' to be negative.  There are similar
problems on the high end too.

-0.23869 < R' < 1.6386
-0.14744 < G' < 1.5464
-0.42794 < B' < 1.8186

Which doesn't jive at all with:
> Note: R'G'B' are non-linear values which should be limitted to the range
> 0.0 - 1.0 and represent the voltage used to drive the CRT guns.  Linear RGB
> requires a gamma correction of 2.2 from R'G'B'.

So do these get clipped or scaled or what?

--