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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 2773103002: cc: Unify all sources of color space for YUVVideoDrawQuad (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « cc/layers/video_layer_impl.cc ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 gl_, &highp_threshold_cache_, highp_threshold_min_, 2048 gl_, &highp_threshold_cache_, highp_threshold_min_,
2049 quad->shared_quad_state->visible_quad_layer_rect.bottom_right()); 2049 quad->shared_quad_state->visible_quad_layer_rect.bottom_right());
2050 YUVAlphaTextureMode alpha_texture_mode = quad->a_plane_resource_id() 2050 YUVAlphaTextureMode alpha_texture_mode = quad->a_plane_resource_id()
2051 ? YUV_HAS_ALPHA_TEXTURE 2051 ? YUV_HAS_ALPHA_TEXTURE
2052 : YUV_NO_ALPHA_TEXTURE; 2052 : YUV_NO_ALPHA_TEXTURE;
2053 UVTextureMode uv_texture_mode = 2053 UVTextureMode uv_texture_mode =
2054 quad->v_plane_resource_id() == quad->u_plane_resource_id() 2054 quad->v_plane_resource_id() == quad->u_plane_resource_id()
2055 ? UV_TEXTURE_MODE_UV 2055 ? UV_TEXTURE_MODE_UV
2056 : UV_TEXTURE_MODE_U_V; 2056 : UV_TEXTURE_MODE_U_V;
2057 2057
2058 // TODO(ccameron): There are currently three sources of the color space: the 2058 ResourceProvider::ScopedSamplerGL y_plane_lock(
2059 // resource, quad->color_space, and quad->video_color_space. Remove two of 2059 resource_provider_, quad->y_plane_resource_id(), GL_TEXTURE1, GL_LINEAR);
2060 // them. 2060
2061 gfx::ColorSpace src_color_space = quad->video_color_space; 2061 gfx::ColorSpace src_color_space = y_plane_lock.color_space();
2062 gfx::ColorSpace dst_color_space = 2062 gfx::ColorSpace dst_color_space =
2063 current_frame()->current_render_pass->color_space; 2063 current_frame()->current_render_pass->color_space;
2064 if (!base::FeatureList::IsEnabled(media::kVideoColorManagement)) { 2064 if (!base::FeatureList::IsEnabled(media::kVideoColorManagement)) {
2065 if (!settings_->enable_color_correct_rendering) 2065 if (!settings_->enable_color_correct_rendering)
2066 dst_color_space = gfx::ColorSpace(); 2066 dst_color_space = gfx::ColorSpace();
2067 switch (quad->color_space) {
2068 case YUVVideoDrawQuad::REC_601:
2069 src_color_space = gfx::ColorSpace::CreateREC601();
2070 break;
2071 case YUVVideoDrawQuad::REC_709:
2072 src_color_space = gfx::ColorSpace::CreateREC709();
2073 break;
2074 case YUVVideoDrawQuad::JPEG:
2075 src_color_space = gfx::ColorSpace::CreateJpeg();
2076 break;
2077 }
2078 } 2067 }
2079 // Invalid or unspecified color spaces should be treated as REC709. 2068 // Invalid or unspecified color spaces should be treated as REC709.
2080 if (!src_color_space.IsValid()) 2069 if (!src_color_space.IsValid())
2081 src_color_space = gfx::ColorSpace::CreateREC709(); 2070 src_color_space = gfx::ColorSpace::CreateREC709();
2082 2071
2083 // The source color space should never be RGB. 2072 // The source color space should never be RGB.
2084 DCHECK_NE(src_color_space, src_color_space.GetAsFullRangeRGB()); 2073 DCHECK_NE(src_color_space, src_color_space.GetAsFullRangeRGB());
2085 2074
2086 ResourceProvider::ScopedSamplerGL y_plane_lock(
2087 resource_provider_, quad->y_plane_resource_id(), GL_TEXTURE1, GL_LINEAR);
2088 if (base::FeatureList::IsEnabled(media::kVideoColorManagement))
2089 DCHECK_EQ(src_color_space, y_plane_lock.color_space());
2090 ResourceProvider::ScopedSamplerGL u_plane_lock( 2075 ResourceProvider::ScopedSamplerGL u_plane_lock(
2091 resource_provider_, quad->u_plane_resource_id(), GL_TEXTURE2, GL_LINEAR); 2076 resource_provider_, quad->u_plane_resource_id(), GL_TEXTURE2, GL_LINEAR);
2092 DCHECK_EQ(y_plane_lock.target(), u_plane_lock.target()); 2077 DCHECK_EQ(y_plane_lock.target(), u_plane_lock.target());
2093 DCHECK_EQ(y_plane_lock.color_space(), u_plane_lock.color_space()); 2078 DCHECK_EQ(y_plane_lock.color_space(), u_plane_lock.color_space());
2094 // TODO(jbauman): Use base::Optional when available. 2079 // TODO(jbauman): Use base::Optional when available.
2095 std::unique_ptr<ResourceProvider::ScopedSamplerGL> v_plane_lock; 2080 std::unique_ptr<ResourceProvider::ScopedSamplerGL> v_plane_lock;
2096 2081
2097 if (uv_texture_mode == UV_TEXTURE_MODE_U_V) { 2082 if (uv_texture_mode == UV_TEXTURE_MODE_U_V) {
2098 v_plane_lock.reset(new ResourceProvider::ScopedSamplerGL( 2083 v_plane_lock.reset(new ResourceProvider::ScopedSamplerGL(
2099 resource_provider_, quad->v_plane_resource_id(), GL_TEXTURE3, 2084 resource_provider_, quad->v_plane_resource_id(), GL_TEXTURE3,
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
3586 return; 3571 return;
3587 3572
3588 // Report GPU overdraw as a percentage of |max_result|. 3573 // Report GPU overdraw as a percentage of |max_result|.
3589 TRACE_COUNTER1( 3574 TRACE_COUNTER1(
3590 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", 3575 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw",
3591 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / 3576 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) /
3592 max_result); 3577 max_result);
3593 } 3578 }
3594 3579
3595 } // namespace cc 3580 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/video_layer_impl.cc ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698