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

Unified Diff: cc/output/gl_renderer.cc

Issue 1008493002: Increase YUV video clamping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: individual ya and uv texture size Created 5 years, 9 months 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 613ea4b16a3d7d91d20b769bbe6b040fa35cc509..49217100f4043ad39c2c25558cff1d970535fd48 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -1960,7 +1960,8 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame,
int matrix_location = -1;
int tex_scale_location = -1;
int tex_offset_location = -1;
- int clamp_rect_location = -1;
+ int ya_clamp_rect_location = -1;
+ int uv_clamp_rect_location = -1;
int y_texture_location = -1;
int u_texture_location = -1;
int v_texture_location = -1;
@@ -1981,7 +1982,10 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame,
a_texture_location = program->fragment_shader().a_texture_location();
yuv_matrix_location = program->fragment_shader().yuv_matrix_location();
yuv_adj_location = program->fragment_shader().yuv_adj_location();
- clamp_rect_location = program->fragment_shader().clamp_rect_location();
+ ya_clamp_rect_location =
+ program->fragment_shader().ya_clamp_rect_location();
+ uv_clamp_rect_location =
+ program->fragment_shader().uv_clamp_rect_location();
alpha_location = program->fragment_shader().alpha_location();
} else {
const VideoYUVProgram* program = GetVideoYUVProgram(tex_coord_precision);
@@ -1995,7 +1999,10 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame,
v_texture_location = program->fragment_shader().v_texture_location();
yuv_matrix_location = program->fragment_shader().yuv_matrix_location();
yuv_adj_location = program->fragment_shader().yuv_adj_location();
- clamp_rect_location = program->fragment_shader().clamp_rect_location();
+ ya_clamp_rect_location =
+ program->fragment_shader().ya_clamp_rect_location();
+ uv_clamp_rect_location =
+ program->fragment_shader().uv_clamp_rect_location();
alpha_location = program->fragment_shader().alpha_location();
}
@@ -2009,14 +2016,23 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame,
quad->tex_coord_rect.y()));
// Clamping to half a texel inside the tex coord rect prevents bilinear
// filtering from filtering outside the tex coord rect.
- gfx::RectF clamp_rect(quad->tex_coord_rect);
+ gfx::RectF ya_clamp_rect(quad->tex_coord_rect);
// Special case: empty texture size implies no clamping.
- if (!quad->tex_size.IsEmpty()) {
- clamp_rect.Inset(0.5f / quad->tex_size.width(),
- 0.5f / quad->tex_size.height());
- }
- GLC(gl_, gl_->Uniform4f(clamp_rect_location, clamp_rect.x(), clamp_rect.y(),
- clamp_rect.right(), clamp_rect.bottom()));
+ if (!quad->ya_tex_size.IsEmpty()) {
+ ya_clamp_rect.Inset(0.5f / quad->ya_tex_size.width(),
+ 0.5f / quad->ya_tex_size.height());
+ }
+ gfx::RectF uv_clamp_rect(quad->tex_coord_rect);
+ if (!quad->uv_tex_size.IsEmpty()) {
+ uv_clamp_rect.Inset(0.5f / quad->uv_tex_size.width(),
+ 0.5f / quad->uv_tex_size.height());
+ }
+ GLC(gl_, gl_->Uniform4f(ya_clamp_rect_location, ya_clamp_rect.x(),
+ ya_clamp_rect.y(), ya_clamp_rect.right(),
+ ya_clamp_rect.bottom()));
+ GLC(gl_, gl_->Uniform4f(uv_clamp_rect_location, uv_clamp_rect.x(),
+ uv_clamp_rect.y(), uv_clamp_rect.right(),
+ uv_clamp_rect.bottom()));
GLC(gl_, gl_->Uniform1i(y_texture_location, 1));
GLC(gl_, gl_->Uniform1i(u_texture_location, 2));

Powered by Google App Engine
This is Rietveld 408576698