metamerist

Tuesday, September 25, 2007

Roots, Linear RGB and sRGB


Given an efficient implementation of cube root and quintic root, I want to note the implications for conversions between linear RGB and sRGB. These conversions involve powers of 2.4 and 1/2.4 for gamma correction.

Consider the case of x2.4

x2.4 = x1.2 * x1.2
x1.2 = x*x1/5

Given a fast and accurate calculation of quintic roots, efficient calculation of x2.4 is straightforward.

For the case of x1/2.4, since 1/2.4 = 5/12, we can consider some combination of powers such as the following:

x1/2.4 =((x1/4)5)1/3

For the 1/4th power, if our target processor has an efficient square root built in, we might rely on sqrt(sqrt(x)); otherwise, we might opt for an efficient implementation of quartic root. With a little luck, we may wind up with something faster than calling pow( ).

If we use a 2.2. gamma, a quintic root will also come in handy because:

x2.2 = x2*x1/5

The challenge with 2.2 gamma is the inverse, which amounts to x5/11. For x in the range 0 to 1, this amounts to the square root with a small correction: x5/11 = x1/2 / x1/22.

I'll leave that as something to think about.

Note: Hopefully none of the ideas here have been patented. If not, consider this another demonstration of prior art.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home