Is anyone here knowledgeable about color space conversion methods? As far as I can tell the color space conversion in Grandia from YCbCr to RGB works like I described in the post before. I've searched online for other information about the formula, but didn't find much. However, there is one patent by Nvidia that pretty much describes the same thing. The forward conversion from RGB to YCbCr in the patent is just the inverse function as one would expect. The problem is that this can't be the way that the RGB to YCbCr values were calculated in Grandia. Black frames have the values Y=-128, Cb=0, Cr=0, but if I use the inverse formula for Y, it's Y=(R/4 + G/2 + B/4) - 124. Obviously a value of -128 is impossible with this formula since RGB values can't be negative. The question is now, how was the forward transform actually calculated. I tried to do a curve fitting to this function
But the results are not very accurate. I think the problem is that I don't know the real exact colors that the source video had. The simple color space conversion was probably chosen because it can be done very fast. Like described in the patent, you can do all math operations with shifts and additions/subtractions. My guess is that this simple conversion method distorts the original colors somewhat and that's why it's hard to find the right parameters for the transfer function. What goes a bit against this theory is that the DSP is used for the color space conversion. I think it should be powerful enough to do a proper color space conversion. Maybe I'm missing something or maybe I'm overthinking this too much.
def fit_func(X, a, d, e, f): r, g, b = X return a*b+d*g+e*r - f
US7050065B1 - Minimalist color space converters for optimizing image processing operations - Google Patents
An apparatus for graphics processing unit, which includes a memory for storing pixel data in a red, green and blue (RGB) color space and a display pipeline. The display pipeline includes an RGB color space to a luminance color, blue color difference and red color difference (YCbCr) color space...