Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3203)

Unified Diff: cc/output/gl_renderer.cc

Issue 92703003: Support videos with JPEG color range in GPU YUV convert path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@yuv_v2
Patch Set: Whoops, forgot one. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index cc9a752ecf5cda3c8406bb6a92f9503a3cf4dbe3..a757eea01af774ff3c87c9f196b27925fd3765d9 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -1723,8 +1723,18 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame,
0.0f, -.391f, 2.018f,
1.596f, -.813f, 0.0f,
};
+ float yuv_to_rgb_jpeg[9] = {
+ 1.f, 1.f, 1.f,
+ 0.0f, -.34414f, 1.772f,
+ 1.402f, -.71414, 0.0f,
+ };
+
GLC(Context(),
- Context()->uniformMatrix3fv(yuv_matrix_location, 1, 0, yuv_to_rgb));
+ Context()->uniformMatrix3fv(
+ yuv_matrix_location,
+ 1,
+ 0,
+ quad->has_jpeg_color_range ? yuv_to_rgb_jpeg : yuv_to_rgb));
// These values map to 16, 128, and 128 respectively, and are computed
// as a fraction over 256 (e.g. 16 / 256 = 0.0625).
@@ -1733,8 +1743,15 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame,
// U - 128 : Turns unsigned U into signed U [-128,127]
// V - 128 : Turns unsigned V into signed V [-128,127]
float yuv_adjust[3] = { -0.0625f, -0.5f, -0.5f, };
- GLC(Context(), Context()->uniform3fv(yuv_adj_location, 1, yuv_adjust));
+ // Same as above, but without the head and footroom in Y.
+ float yuv_adjust_jpeg[3] = { 0.f, -0.5f, -0.5f, };
+
+ GLC(Context(),
+ Context()->uniform3fv(
+ yuv_adj_location,
+ 1,
+ quad->has_jpeg_color_range ? yuv_adjust_jpeg : yuv_adjust));
SetShaderOpacity(quad->opacity(), alpha_location);
DrawQuadGeometry(frame, quad->quadTransform(), quad->rect, matrix_location);

Powered by Google App Engine
This is Rietveld 408576698