koxiong / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

bt 601 check accuracy #397

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Check the bt.601 YUV to RGB formala is correct.

This is reference code used by libyuv

void YUVToRGBReference(int y, int u, int v, int* r, int* g, int* b) {
  *r = RoundToByte((y - 16) * 1.164 + (v - 128) * 1.596);
  *g = RoundToByte((y - 16) * 1.164 + (u - 128) * -0.391 + (v - 128) * -0.813);
  *b = RoundToByte((y - 16) * 1.164 + (u - 128) * 2.018);
}

which matches this
http://stackoverflow.com/questions/11306802/yuv420p-to-rgb-image-conversion

Microsoft documents it with more accuracy
https://msdn.microsoft.com/en-us/library/windows/desktop/dd206750%28v=vs.85%29.a
spx

This also shows some of the conversions
http://en.wikipedia.org/wiki/YUV#Numerical_approximations

Original issue reported on code.google.com by fbarch...@google.com on 6 Feb 2015 at 11:04

GoogleCodeExporter commented 8 years ago
BT.601 is accurate.

Original comment by fbarch...@chromium.org on 6 Oct 2015 at 9:42