Good news :)

1st tests when converting Luma to interger was ok. And as a result of the convertion, when i compensate Luma to be adjusted to Chroma, no more errors whatsoever on extrapolations of the sqrt(29) limit. It seems that the compensation ratio adjusts Chroma and Hue on such a way that it will always be within their boundaries.

I´ll make a minor test on the backward function (it do needs to calculate the reversed compensation ratio, but...no problem. It won´t affect performance. It will be needed to check the limits anyway, so, a pointer to another member of the structure won´t make any significant difference in terms of speed, and any eventual loss of speed can be compensated later when i start to give a try and convert it to SSE and Real4 to be used in the matrix. I just hope we won´t loose accuracy after converting all variables to Real4 rather then Real8)

The errors on the algorithm when show up are a kind of hide and seek play

One question. How to calculate the probability or density of a certain range of data ?

THis is to analyse what CieLCH is doing with the pixels. I mean, after the fixes, i suceeded to map all 16 million pixels on another table from 0 to 255 (also biased on the luma), and figure it out that the distribution is almost proportional (or making a sine curve, perhaps ?) all over the table.

For example:

Gray/Luma = 0, total pixels = 38

Gray/Luma = 1, total pixels = 250

Gray/Luma = 2, total pixels = 330

....

Gray/Luma = 142, total pixels = 128694

after that it starts decreasing again.

Gray/Luma = 143, total pixels = 108965

Gray/Luma = 144, total pixels = 107555

...

Gray/Luma = 255, total pixels = 0

It seems that i suceeded to adjust CieLab equations to behave as a parabolic cylinder, but the midpoint seems to be at 142 and the decresing values does not match to their opposite side.

So, how to "equalize" the distribution of a range of data in order to it results in something like this:

Gray/Luma = 0, total pixels = 38

Gray/Luma = 1, total pixels = 250

Gray/Luma = 2, total pixels = 330

....

Gray/Luma = 126, total pixels = 100000

Gray/Luma = 127, total pixels = 128694 ; midpoint

Gray/Luma = 128, total pixels = 128694 ; midpoint

after that it starts decreasing again.

Gray/Luma = 129, total pixels = 100000

...

Gray/Luma = 253, total pixels = 330

Gray/Luma = 254, total pixels = 250

Gray/Luma = 255, total pixels = 38