I'm writing a graphics program that needs to convert standard YUV images to RGB. The problem is that every website I see that has the YUV to RGB conversion formula, has a slightly different formula.
From http://www.fourcc.org/fccyvrgb.php
one person posted
B = 1.164(Y - 16) + 2.018(U - 128)
G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)
R = 1.164(Y - 16) + 1.596(V - 128)
while someone else posted
R = Y + 1.403V'
G = Y - 0.344U' - 0.714V'
B = Y + 1.770U'
And on http://www.pcmag.com/encyclopedia/te...rsion-formulas it says
R = Y + 1.140V
G = Y - 0.395U - 0.581V
B = Y + 2.032U
I would have THOUGHT that there was one specific CORRECT way to convert YUV to RGB, but that specification appears to be long lost.
If someone here can give me a correct specification on the proper YUV to RGB conversion (including what valid range of inputs these formulas are expecting, and how the YUV data is normally stored such that I can find the proper pre-processing method to use on the YUV data prior to performing the YUV to RGB conversion) I'd be VERY grateful.
From http://www.fourcc.org/fccyvrgb.php
one person posted
Quote:
B = 1.164(Y - 16) + 2.018(U - 128)
G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)
R = 1.164(Y - 16) + 1.596(V - 128)
while someone else posted
Quote:
R = Y + 1.403V'
G = Y - 0.344U' - 0.714V'
B = Y + 1.770U'
And on http://www.pcmag.com/encyclopedia/te...rsion-formulas it says
Quote:
R = Y + 1.140V
G = Y - 0.395U - 0.581V
B = Y + 2.032U
I would have THOUGHT that there was one specific CORRECT way to convert YUV to RGB, but that specification appears to be long lost.
If someone here can give me a correct specification on the proper YUV to RGB conversion (including what valid range of inputs these formulas are expecting, and how the YUV data is normally stored such that I can find the proper pre-processing method to use on the YUV data prior to performing the YUV to RGB conversion) I'd be VERY grateful.