Log in

View Full Version : YUV to RGB


jonny
27th July 2004, 15:31
I was searching for the correct way to make this conversion and i've found a couple of slightly different implementations.

Looking at Avisynth source (YUV2RGB function in convert.h) seems to me something like this:


B = (Y - 16) * 255 / 219 + (U - 128) * 2.018
G = (Y - 16) * 255 / 219 - (U - 128) * 0.391 - (V - 128) * 0.813
R = (Y - 16) * 255 / 219 + (V - 128) * 1.596


Is that correct?
(my target is Avisynth YV12 input, RGB output in a window)

tnks!

hank315
27th July 2004, 23:26
That's a correct conversion.
Don't forget to saturate the RGB values in the range 0...255

hank

jonny
28th July 2004, 08:42
Thanks for the answer, additional search confirmed this too (wow there is a lot of confusion around this!).

ciao
jonny