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

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: rebase 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
« no previous file with comments | « cc/layers/video_layer_impl.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index b49ac8eefec9d79361aab1583bbc9e807bc61d0a..adb9f784c2d79f472bb8b1bf426296e5012c4b8d 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -1959,7 +1959,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;
@@ -1980,7 +1981,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);
@@ -1994,7 +1998,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();
}
@@ -2008,14 +2015,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));
« no previous file with comments | « cc/layers/video_layer_impl.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698