Chromium Code Reviews| Index: cc/output/gl_renderer.cc |
| diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc |
| index 2dd854e6e53f1941f56607ee8980c98c3931593b..e37088d15d70fa6e868b6ab3689aff2020910289 100644 |
| --- a/cc/output/gl_renderer.cc |
| +++ b/cc/output/gl_renderer.cc |
| @@ -2225,19 +2225,17 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, |
| 1.164f, 1.164f, 1.164f, 0.0f, -0.213f, 2.112f, 1.793f, -0.533f, 0.0f, |
| }; |
| - // These values map to 16, 128, and 128 respectively, and are computed |
| - // as a fraction over 256 (e.g. 16 / 256 = 0.0625). |
| // They are used in the YUV to RGBA conversion formula: |
| // Y - 16 : Gives 16 values of head and footroom for overshooting |
| // U - 128 : Turns unsigned U into signed U [-128,127] |
| // V - 128 : Turns unsigned V into signed V [-128,127] |
| float yuv_adjust_constrained[3] = { |
| - -0.0625f, -0.5f, -0.5f, |
| + -16.f, -128.f, -128.f, |
| }; |
| // Same as above, but without the head and footroom. |
| float yuv_adjust_full[3] = { |
| - 0.0f, -0.5f, -0.5f, |
| + 0.0f, -128.f, -128.f, |
| }; |
| float* yuv_to_rgb = NULL; |
| @@ -2261,12 +2259,17 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, |
| float yuv_to_rgb_multiplied[9]; |
| float yuv_adjust_with_offset[3]; |
| + // Formula according to BT.601-7 section 2.5.3. |
| + float adjustment_multiplier = (1 << (quad->bits_per_channel - 8)) * 1.0f / |
| + ((1 << quad->bits_per_channel) - 1); |
| + |
| for (int i = 0; i < 9; ++i) |
| yuv_to_rgb_multiplied[i] = yuv_to_rgb[i] * quad->resource_multiplier; |
| for (int i = 0; i < 3; ++i) |
|
piman
2016/07/26 06:46:48
nit: can you add {} per style?
|
| yuv_adjust_with_offset[i] = |
| - yuv_adjust[i] / quad->resource_multiplier - quad->resource_offset; |
| + yuv_adjust[i] * adjustment_multiplier / quad->resource_multiplier - |
| + quad->resource_offset; |
| // The transform and vertex data are used to figure out the extents that the |
| // un-antialiased quad should have and which vertex this is and the float |