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

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

Issue 2122573003: media: replace LUMINANCE_F16 by RG_88 for 9/10-bit h264 videos Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to ToT Created 4 years, 2 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/output/gl_renderer.h ('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 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( 2209 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired(
2210 gl_, &highp_threshold_cache_, highp_threshold_min_, 2210 gl_, &highp_threshold_cache_, highp_threshold_min_,
2211 quad->shared_quad_state->visible_quad_layer_rect.bottom_right()); 2211 quad->shared_quad_state->visible_quad_layer_rect.bottom_right());
2212 2212
2213 bool use_alpha_plane = quad->a_plane_resource_id() != 0; 2213 bool use_alpha_plane = quad->a_plane_resource_id() != 0;
2214 bool use_nv12 = quad->v_plane_resource_id() == quad->u_plane_resource_id(); 2214 bool use_nv12 = quad->v_plane_resource_id() == quad->u_plane_resource_id();
2215 bool use_color_lut = 2215 bool use_color_lut =
2216 base::FeatureList::IsEnabled(media::kVideoColorManagement); 2216 base::FeatureList::IsEnabled(media::kVideoColorManagement);
2217 DCHECK(!(use_nv12 && use_alpha_plane)); 2217 DCHECK(!(use_nv12 && use_alpha_plane));
2218 2218
2219 FragmentShaderYUVVideo::HighbitTexture highbit_texture =
2220 FragmentShaderYUVVideo::HIGHBIT_Y8;
2221 if (quad->bits_per_channel > 8) {
2222 // TODO(dshwang): the resource should know its format. crbug.com/624436
2223 ResourceFormat resource_format =
2224 resource_provider_->GetResourceFormat(quad->y_plane_resource_id());
2225 if (resource_format == LUMINANCE_F16) {
2226 highbit_texture = FragmentShaderYUVVideo::HIGHBIT_LUMINANCE_F16;
2227 } else {
2228 DCHECK(RG_88 == resource_format || RGBA_8888 == resource_format);
2229 highbit_texture = FragmentShaderYUVVideo::HIGHBIT_RG88;
2230 }
2231 }
2232 DCHECK_LE(YUVVideoDrawQuad::kMinBitsPerChannel, quad->bits_per_channel);
2233 DCHECK_LE(quad->bits_per_channel, YUVVideoDrawQuad::kMaxBitsPerChannel);
2234 GLenum filter = highbit_texture == FragmentShaderYUVVideo::HIGHBIT_RG88
2235 ? GL_NEAREST
2236 : GL_LINEAR;
2237
2238 // y_plane can be RG texture, so use manual bilinear shader.
2219 ResourceProvider::ScopedSamplerGL y_plane_lock( 2239 ResourceProvider::ScopedSamplerGL y_plane_lock(
2220 resource_provider_, quad->y_plane_resource_id(), GL_TEXTURE1, GL_LINEAR); 2240 resource_provider_, quad->y_plane_resource_id(), GL_TEXTURE1, filter);
2221 ResourceProvider::ScopedSamplerGL u_plane_lock( 2241 ResourceProvider::ScopedSamplerGL u_plane_lock(
2222 resource_provider_, quad->u_plane_resource_id(), GL_TEXTURE2, GL_LINEAR); 2242 resource_provider_, quad->u_plane_resource_id(), GL_TEXTURE2, filter);
2223 DCHECK_EQ(y_plane_lock.target(), u_plane_lock.target()); 2243 DCHECK_EQ(y_plane_lock.target(), u_plane_lock.target());
2224 // TODO(jbauman): Use base::Optional when available. 2244 // TODO(jbauman): Use base::Optional when available.
2225 std::unique_ptr<ResourceProvider::ScopedSamplerGL> v_plane_lock; 2245 std::unique_ptr<ResourceProvider::ScopedSamplerGL> v_plane_lock;
2226 if (!use_nv12) { 2246 if (!use_nv12) {
2227 v_plane_lock.reset(new ResourceProvider::ScopedSamplerGL( 2247 v_plane_lock.reset(new ResourceProvider::ScopedSamplerGL(
2228 resource_provider_, quad->v_plane_resource_id(), GL_TEXTURE3, 2248 resource_provider_, quad->v_plane_resource_id(), GL_TEXTURE3, filter));
2229 GL_LINEAR));
2230 DCHECK_EQ(y_plane_lock.target(), v_plane_lock->target()); 2249 DCHECK_EQ(y_plane_lock.target(), v_plane_lock->target());
2250 } else {
2251 // |bits_per_channel| of PIXEL_FORMAT_NV12 is 8.
2252 DCHECK_EQ(static_cast<GLenum>(GL_LINEAR), filter);
2231 } 2253 }
2232 std::unique_ptr<ResourceProvider::ScopedSamplerGL> a_plane_lock; 2254 std::unique_ptr<ResourceProvider::ScopedSamplerGL> a_plane_lock;
2233 if (use_alpha_plane) { 2255 if (use_alpha_plane) {
2234 a_plane_lock.reset(new ResourceProvider::ScopedSamplerGL( 2256 a_plane_lock.reset(new ResourceProvider::ScopedSamplerGL(
2235 resource_provider_, quad->a_plane_resource_id(), GL_TEXTURE4, 2257 resource_provider_, quad->a_plane_resource_id(), GL_TEXTURE4,
2236 GL_LINEAR)); 2258 GL_LINEAR));
2237 DCHECK_EQ(y_plane_lock.target(), a_plane_lock->target()); 2259 DCHECK_EQ(y_plane_lock.target(), a_plane_lock->target());
2260 // |bits_per_channel| of PIXEL_FORMAT_YV12A is 8.
2261 DCHECK_EQ(static_cast<GLenum>(GL_LINEAR), filter);
2238 } 2262 }
2239 2263
2240 // All planes must have the same sampler type. 2264 // All planes must have the same sampler type.
2241 SamplerType sampler = SamplerTypeFromTextureTarget(y_plane_lock.target()); 2265 SamplerType sampler = SamplerTypeFromTextureTarget(y_plane_lock.target());
2242 2266
2243 int matrix_location = -1; 2267 int matrix_location = -1;
2244 int ya_tex_scale_location = -1; 2268 int ya_tex_scale_location = -1;
2245 int ya_tex_offset_location = -1; 2269 int ya_tex_offset_location = -1;
2246 int uv_tex_scale_location = -1; 2270 int uv_tex_scale_location = -1;
2247 int uv_tex_offset_location = -1; 2271 int uv_tex_offset_location = -1;
2272 int ya_size_location = -1;
2273 int uv_size_location = -1;
2248 int ya_clamp_rect_location = -1; 2274 int ya_clamp_rect_location = -1;
2249 int uv_clamp_rect_location = -1; 2275 int uv_clamp_rect_location = -1;
2250 int y_texture_location = -1; 2276 int y_texture_location = -1;
2251 int u_texture_location = -1; 2277 int u_texture_location = -1;
2252 int v_texture_location = -1; 2278 int v_texture_location = -1;
2253 int uv_texture_location = -1; 2279 int uv_texture_location = -1;
2254 int a_texture_location = -1; 2280 int a_texture_location = -1;
2255 int lut_texture_location = -1; 2281 int lut_texture_location = -1;
2256 int yuv_matrix_location = -1; 2282 int yuv_matrix_location = -1;
2257 int yuv_adj_location = -1; 2283 int yuv_adj_location = -1;
2258 int alpha_location = -1; 2284 int alpha_location = -1;
2259 int resource_multiplier_location = -1; 2285 int resource_multiplier_location = -1;
2260 int resource_offset_location = -1; 2286 int resource_offset_location = -1;
2261 const VideoYUVProgram* program = GetVideoYUVProgram( 2287 const VideoYUVProgram* program =
2262 tex_coord_precision, sampler, use_alpha_plane, use_nv12, use_color_lut); 2288 GetVideoYUVProgram(tex_coord_precision, sampler, use_alpha_plane,
2289 use_nv12, use_color_lut, highbit_texture);
2263 DCHECK(program && (program->initialized() || IsContextLost())); 2290 DCHECK(program && (program->initialized() || IsContextLost()));
2264 SetUseProgram(program->program()); 2291 SetUseProgram(program->program());
2265 matrix_location = program->vertex_shader().matrix_location(); 2292 matrix_location = program->vertex_shader().matrix_location();
2266 ya_tex_scale_location = program->vertex_shader().ya_tex_scale_location(); 2293 ya_tex_scale_location = program->vertex_shader().ya_tex_scale_location();
2267 ya_tex_offset_location = program->vertex_shader().ya_tex_offset_location(); 2294 ya_tex_offset_location = program->vertex_shader().ya_tex_offset_location();
2268 uv_tex_scale_location = program->vertex_shader().uv_tex_scale_location(); 2295 uv_tex_scale_location = program->vertex_shader().uv_tex_scale_location();
2269 uv_tex_offset_location = program->vertex_shader().uv_tex_offset_location(); 2296 uv_tex_offset_location = program->vertex_shader().uv_tex_offset_location();
2270 y_texture_location = program->fragment_shader().y_texture_location(); 2297 y_texture_location = program->fragment_shader().y_texture_location();
2271 u_texture_location = program->fragment_shader().u_texture_location(); 2298 u_texture_location = program->fragment_shader().u_texture_location();
2272 v_texture_location = program->fragment_shader().v_texture_location(); 2299 v_texture_location = program->fragment_shader().v_texture_location();
2273 uv_texture_location = program->fragment_shader().uv_texture_location(); 2300 uv_texture_location = program->fragment_shader().uv_texture_location();
2274 a_texture_location = program->fragment_shader().a_texture_location(); 2301 a_texture_location = program->fragment_shader().a_texture_location();
2275 lut_texture_location = program->fragment_shader().lut_texture_location(); 2302 lut_texture_location = program->fragment_shader().lut_texture_location();
2276 yuv_matrix_location = program->fragment_shader().yuv_matrix_location(); 2303 yuv_matrix_location = program->fragment_shader().yuv_matrix_location();
2277 yuv_adj_location = program->fragment_shader().yuv_adj_location(); 2304 yuv_adj_location = program->fragment_shader().yuv_adj_location();
2305 ya_size_location = program->fragment_shader().ya_size_location();
2306 uv_size_location = program->fragment_shader().uv_size_location();
2278 ya_clamp_rect_location = program->fragment_shader().ya_clamp_rect_location(); 2307 ya_clamp_rect_location = program->fragment_shader().ya_clamp_rect_location();
2279 uv_clamp_rect_location = program->fragment_shader().uv_clamp_rect_location(); 2308 uv_clamp_rect_location = program->fragment_shader().uv_clamp_rect_location();
2280 alpha_location = program->fragment_shader().alpha_location(); 2309 alpha_location = program->fragment_shader().alpha_location();
2281 resource_multiplier_location = 2310 resource_multiplier_location =
2282 program->fragment_shader().resource_multiplier_location(); 2311 program->fragment_shader().resource_multiplier_location();
2283 resource_offset_location = 2312 resource_offset_location =
2284 program->fragment_shader().resource_offset_location(); 2313 program->fragment_shader().resource_offset_location();
2285 2314
2286 gfx::SizeF ya_tex_scale(1.0f, 1.0f); 2315 gfx::SizeF ya_tex_scale(1.0f, 1.0f);
2287 gfx::SizeF uv_tex_scale(1.0f, 1.0f); 2316 gfx::SizeF uv_tex_scale(1.0f, 1.0f);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 gl_->Uniform1i(y_texture_location, 1); 2366 gl_->Uniform1i(y_texture_location, 1);
2338 if (use_nv12) { 2367 if (use_nv12) {
2339 gl_->Uniform1i(uv_texture_location, 2); 2368 gl_->Uniform1i(uv_texture_location, 2);
2340 } else { 2369 } else {
2341 gl_->Uniform1i(u_texture_location, 2); 2370 gl_->Uniform1i(u_texture_location, 2);
2342 gl_->Uniform1i(v_texture_location, 3); 2371 gl_->Uniform1i(v_texture_location, 3);
2343 } 2372 }
2344 if (use_alpha_plane) 2373 if (use_alpha_plane)
2345 gl_->Uniform1i(a_texture_location, 4); 2374 gl_->Uniform1i(a_texture_location, 4);
2346 2375
2347 // These values are magic numbers that are used in the transformation from YUV 2376 float resource_multiplier = 1.f;
2348 // to RGB color values. They are taken from the following webpage: 2377 switch (highbit_texture) {
2349 // http://www.fourcc.org/fccyvrgb.php 2378 case FragmentShaderYUVVideo::HIGHBIT_Y8:
2350 float yuv_to_rgb_rec601[9] = { 2379 resource_multiplier = 1.f;
2351 1.164f, 1.164f, 1.164f, 0.0f, -.391f, 2.018f, 1.596f, -.813f, 0.0f,
2352 };
2353 float yuv_to_rgb_jpeg[9] = {
2354 1.f, 1.f, 1.f, 0.0f, -.34414f, 1.772f, 1.402f, -.71414f, 0.0f,
2355 };
2356 float yuv_to_rgb_rec709[9] = {
2357 1.164f, 1.164f, 1.164f, 0.0f, -0.213f, 2.112f, 1.793f, -0.533f, 0.0f,
2358 };
2359
2360 // They are used in the YUV to RGBA conversion formula:
2361 // Y - 16 : Gives 16 values of head and footroom for overshooting
2362 // U - 128 : Turns unsigned U into signed U [-128,127]
2363 // V - 128 : Turns unsigned V into signed V [-128,127]
2364 float yuv_adjust_constrained[3] = {
2365 -16.f, -128.f, -128.f,
2366 };
2367
2368 // Same as above, but without the head and footroom.
2369 float yuv_adjust_full[3] = {
2370 0.0f, -128.f, -128.f,
2371 };
2372
2373 float* yuv_to_rgb = NULL;
2374 float* yuv_adjust = NULL;
2375
2376 switch (quad->color_space) {
2377 case YUVVideoDrawQuad::REC_601:
2378 yuv_to_rgb = yuv_to_rgb_rec601;
2379 yuv_adjust = yuv_adjust_constrained;
2380 break; 2380 break;
2381 case YUVVideoDrawQuad::REC_709: 2381 case FragmentShaderYUVVideo::HIGHBIT_LUMINANCE_F16:
2382 yuv_to_rgb = yuv_to_rgb_rec709; 2382 resource_multiplier = quad->resource_multiplier;
2383 yuv_adjust = yuv_adjust_constrained;
2384 break; 2383 break;
2385 case YUVVideoDrawQuad::JPEG: 2384 case FragmentShaderYUVVideo::HIGHBIT_RG88:
2386 yuv_to_rgb = yuv_to_rgb_jpeg; 2385 // f(r, g) = normalized_float = ((g * 256 * 255) + r * 255) / 1023
2387 yuv_adjust = yuv_adjust_full; 2386 // when |bits_per_channel| is 10 bit, and |r| and |g| is normalized.
2387 resource_multiplier = 255.f / ((1 << quad->bits_per_channel) - 1);
2388 break; 2388 break;
2389 } 2389 }
2390 2390
2391 float yuv_to_rgb_multiplied[9]; 2391 if (use_color_lut) {
2392 float yuv_adjust_with_offset[3]; 2392 DCHECK_NE(-1, lut_texture_location);
2393
2394 // Formula according to BT.601-7 section 2.5.3.
2395 DCHECK_LE(YUVVideoDrawQuad::kMinBitsPerChannel, quad->bits_per_channel);
2396 DCHECK_LE(quad->bits_per_channel, YUVVideoDrawQuad::kMaxBitsPerChannel);
2397 float adjustment_multiplier = (1 << (quad->bits_per_channel - 8)) * 1.0f /
2398 ((1 << quad->bits_per_channel) - 1);
2399
2400 for (int i = 0; i < 9; ++i)
2401 yuv_to_rgb_multiplied[i] = yuv_to_rgb[i] * quad->resource_multiplier;
2402
2403 for (int i = 0; i < 3; ++i) {
2404 yuv_adjust_with_offset[i] =
2405 yuv_adjust[i] * adjustment_multiplier / quad->resource_multiplier -
2406 quad->resource_offset;
2407 }
2408
2409 if (lut_texture_location != -1) {
2410 unsigned int lut_texture = color_lut_cache_.GetLUT( 2393 unsigned int lut_texture = color_lut_cache_.GetLUT(
2411 quad->video_color_space, frame->device_color_space, 32); 2394 quad->video_color_space, frame->device_color_space, 32);
2412 gl_->ActiveTexture(GL_TEXTURE5); 2395 gl_->ActiveTexture(GL_TEXTURE5);
2413 gl_->BindTexture(GL_TEXTURE_2D, lut_texture); 2396 gl_->BindTexture(GL_TEXTURE_2D, lut_texture);
2414 gl_->Uniform1i(lut_texture_location, 5); 2397 gl_->Uniform1i(lut_texture_location, 5);
2415 gl_->ActiveTexture(GL_TEXTURE0); 2398 gl_->ActiveTexture(GL_TEXTURE0);
2399
2400 if (highbit_texture == FragmentShaderYUVVideo::HIGHBIT_LUMINANCE_F16 ||
2401 highbit_texture == FragmentShaderYUVVideo::HIGHBIT_RG88) {
2402 DCHECK_NE(-1, resource_multiplier_location);
2403 gl_->Uniform1f(resource_multiplier_location, resource_multiplier);
2404 }
2405 if (highbit_texture == FragmentShaderYUVVideo::HIGHBIT_LUMINANCE_F16) {
2406 DCHECK_NE(-1, resource_offset_location);
2407 gl_->Uniform1f(resource_offset_location, quad->resource_offset);
2408 }
2409 } else {
2410 DCHECK_NE(-1, yuv_matrix_location);
2411 DCHECK_NE(-1, yuv_adj_location);
2412
2413 // These values are magic numbers that are used in the transformation from
2414 // YUV to RGB color values. They are taken from the following webpage:
2415 // http://www.fourcc.org/fccyvrgb.php
2416 float yuv_to_rgb_rec601[9] = {
2417 1.164f, 1.164f, 1.164f, 0.0f, -.391f, 2.018f, 1.596f, -.813f, 0.0f,
2418 };
2419 float yuv_to_rgb_jpeg[9] = {
2420 1.f, 1.f, 1.f, 0.0f, -.34414f, 1.772f, 1.402f, -.71414f, 0.0f,
2421 };
2422 float yuv_to_rgb_rec709[9] = {
2423 1.164f, 1.164f, 1.164f, 0.0f, -0.213f, 2.112f, 1.793f, -0.533f, 0.0f,
2424 };
2425
2426 // They are used in the YUV to RGBA conversion formula:
2427 // Y - 16 : Gives 16 values of head and footroom for overshooting
2428 // U - 128 : Turns unsigned U into signed U [-128,127]
2429 // V - 128 : Turns unsigned V into signed V [-128,127]
2430 float yuv_adjust_constrained[3] = {
2431 -16.f, -128.f, -128.f,
2432 };
2433
2434 // Same as above, but without the head and footroom.
2435 float yuv_adjust_full[3] = {
2436 0.0f, -128.f, -128.f,
2437 };
2438
2439 float* yuv_to_rgb = NULL;
2440 float* yuv_adjust = NULL;
2441
2442 switch (quad->color_space) {
2443 case YUVVideoDrawQuad::REC_601:
2444 yuv_to_rgb = yuv_to_rgb_rec601;
2445 yuv_adjust = yuv_adjust_constrained;
2446 break;
2447 case YUVVideoDrawQuad::REC_709:
2448 yuv_to_rgb = yuv_to_rgb_rec709;
2449 yuv_adjust = yuv_adjust_constrained;
2450 break;
2451 case YUVVideoDrawQuad::JPEG:
2452 yuv_to_rgb = yuv_to_rgb_jpeg;
2453 yuv_adjust = yuv_adjust_full;
2454 break;
2455 }
2456
2457 float yuv_to_rgb_multiplied[9];
2458 for (int i = 0; i < 9; ++i)
2459 yuv_to_rgb_multiplied[i] = yuv_to_rgb[i] * resource_multiplier;
2460 gl_->UniformMatrix3fv(yuv_matrix_location, 1, 0, yuv_to_rgb_multiplied);
2461
2462 float yuv_adjust_with_offset[3];
2463 // Formula according to BT.601-7 section 2.5.3.
2464 float adjustment_multiplier = (1 << (quad->bits_per_channel - 8)) * 1.0f /
2465 ((1 << quad->bits_per_channel) - 1);
2466 float resource_offset = 0.f;
2467 if (highbit_texture == FragmentShaderYUVVideo::HIGHBIT_LUMINANCE_F16)
2468 resource_offset = quad->resource_offset;
2469 for (int i = 0; i < 3; ++i) {
2470 yuv_adjust_with_offset[i] =
2471 yuv_adjust[i] * adjustment_multiplier / resource_multiplier -
2472 resource_offset;
2473 }
2474
2475 gl_->Uniform3fv(yuv_adj_location, 1, yuv_adjust_with_offset);
2416 } 2476 }
2417 2477
2418 if (resource_multiplier_location != -1) { 2478 if (highbit_texture == FragmentShaderYUVVideo::HIGHBIT_RG88) {
2419 gl_->Uniform1f(resource_multiplier_location, quad->resource_multiplier); 2479 DCHECK_NE(-1, ya_size_location);
2420 } 2480 DCHECK_NE(-1, uv_size_location);
2421 2481 gl_->Uniform2f(ya_size_location, quad->ya_tex_size.width(),
2422 if (resource_offset_location != -1) { 2482 quad->ya_tex_size.height());
2423 gl_->Uniform1f(resource_offset_location, quad->resource_offset); 2483 gl_->Uniform2f(uv_size_location, quad->uv_tex_size.width(),
2484 quad->uv_tex_size.height());
2424 } 2485 }
2425 2486
2426 // The transform and vertex data are used to figure out the extents that the 2487 // The transform and vertex data are used to figure out the extents that the
2427 // un-antialiased quad should have and which vertex this is and the float 2488 // un-antialiased quad should have and which vertex this is and the float
2428 // quad passed in via uniform is the actual geometry that gets used to draw 2489 // quad passed in via uniform is the actual geometry that gets used to draw
2429 // it. This is why this centered rect is used and not the original quad_rect. 2490 // it. This is why this centered rect is used and not the original quad_rect.
2430 auto tile_rect = gfx::RectF(quad->rect); 2491 auto tile_rect = gfx::RectF(quad->rect);
2431 if (yuv_matrix_location != -1) {
2432 gl_->UniformMatrix3fv(yuv_matrix_location, 1, 0, yuv_to_rgb_multiplied);
2433 }
2434
2435 if (yuv_adj_location) {
2436 gl_->Uniform3fv(yuv_adj_location, 1, yuv_adjust_with_offset);
2437 }
2438 2492
2439 SetShaderOpacity(quad->shared_quad_state->opacity, alpha_location); 2493 SetShaderOpacity(quad->shared_quad_state->opacity, alpha_location);
2440 if (!clip_region) { 2494 if (!clip_region) {
2441 DrawQuadGeometry(frame->projection_matrix, 2495 DrawQuadGeometry(frame->projection_matrix,
2442 quad->shared_quad_state->quad_to_target_transform, 2496 quad->shared_quad_state->quad_to_target_transform,
2443 tile_rect, matrix_location); 2497 tile_rect, matrix_location);
2444 } else { 2498 } else {
2445 float uvs[8] = {0}; 2499 float uvs[8] = {0};
2446 GetScaledUVs(quad->visible_rect, clip_region, uvs); 2500 GetScaledUVs(quad->visible_rect, clip_region, uvs);
2447 gfx::QuadF region_quad = *clip_region; 2501 gfx::QuadF region_quad = *clip_region;
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3627 sampler); 3681 sampler);
3628 } 3682 }
3629 return program; 3683 return program;
3630 } 3684 }
3631 3685
3632 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram( 3686 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram(
3633 TexCoordPrecision precision, 3687 TexCoordPrecision precision,
3634 SamplerType sampler, 3688 SamplerType sampler,
3635 bool use_alpha_plane, 3689 bool use_alpha_plane,
3636 bool use_nv12, 3690 bool use_nv12,
3637 bool use_color_lut) { 3691 bool use_color_lut,
3692 FragmentShaderYUVVideo::HighbitTexture highbit_texture) {
3638 DCHECK_GE(precision, 0); 3693 DCHECK_GE(precision, 0);
3639 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); 3694 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
3640 DCHECK_GE(sampler, 0); 3695 DCHECK_GE(sampler, 0);
3641 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); 3696 DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
3642 VideoYUVProgram* program = 3697 VideoYUVProgram* program =
3643 &video_yuv_program_[precision][sampler][use_alpha_plane][use_nv12] 3698 &video_yuv_program_[precision][sampler][use_alpha_plane][use_nv12]
3644 [use_color_lut]; 3699 [use_color_lut][highbit_texture];
3645 if (!program->initialized()) { 3700 if (!program->initialized()) {
3646 TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize"); 3701 TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize");
3647 program->mutable_fragment_shader()->SetFeatures(use_alpha_plane, use_nv12, 3702 program->mutable_fragment_shader()->SetFeatures(
3648 use_color_lut); 3703 use_alpha_plane, use_nv12, use_color_lut, highbit_texture);
3649 program->Initialize(output_surface_->context_provider(), precision, 3704 program->Initialize(output_surface_->context_provider(), precision,
3650 sampler); 3705 sampler);
3651 } 3706 }
3652 return program; 3707 return program;
3653 } 3708 }
3654 3709
3655 const GLRenderer::VideoStreamTextureProgram* 3710 const GLRenderer::VideoStreamTextureProgram*
3656 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { 3711 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) {
3657 DCHECK_GE(precision, 0); 3712 DCHECK_GE(precision, 0);
3658 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); 3713 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
(...skipping 24 matching lines...) Expand all
3683 render_pass_mask_program_[i][j][k][l].Cleanup(gl_); 3738 render_pass_mask_program_[i][j][k][l].Cleanup(gl_);
3684 render_pass_mask_program_aa_[i][j][k][l].Cleanup(gl_); 3739 render_pass_mask_program_aa_[i][j][k][l].Cleanup(gl_);
3685 render_pass_mask_color_matrix_program_aa_[i][j][k][l].Cleanup(gl_); 3740 render_pass_mask_color_matrix_program_aa_[i][j][k][l].Cleanup(gl_);
3686 render_pass_mask_color_matrix_program_[i][j][k][l].Cleanup(gl_); 3741 render_pass_mask_color_matrix_program_[i][j][k][l].Cleanup(gl_);
3687 } 3742 }
3688 } 3743 }
3689 3744
3690 for (int k = 0; k < 2; k++) { 3745 for (int k = 0; k < 2; k++) {
3691 for (int l = 0; l < 2; l++) { 3746 for (int l = 0; l < 2; l++) {
3692 for (int m = 0; m < 2; m++) { 3747 for (int m = 0; m < 2; m++) {
3693 video_yuv_program_[i][j][k][l][m].Cleanup(gl_); 3748 for (int n = 0; n <= FragmentShaderYUVVideo::LAST_HIGHBIT_TEXTURE;
3749 n++) {
3750 video_yuv_program_[i][j][k][l][m][n].Cleanup(gl_);
3751 }
3694 } 3752 }
3695 } 3753 }
3696 } 3754 }
3697 } 3755 }
3698 for (int j = 0; j <= LAST_BLEND_MODE; j++) { 3756 for (int j = 0; j <= LAST_BLEND_MODE; j++) {
3699 render_pass_program_[i][j].Cleanup(gl_); 3757 render_pass_program_[i][j].Cleanup(gl_);
3700 render_pass_program_aa_[i][j].Cleanup(gl_); 3758 render_pass_program_aa_[i][j].Cleanup(gl_);
3701 render_pass_color_matrix_program_[i][j].Cleanup(gl_); 3759 render_pass_color_matrix_program_[i][j].Cleanup(gl_);
3702 render_pass_color_matrix_program_aa_[i][j].Cleanup(gl_); 3760 render_pass_color_matrix_program_aa_[i][j].Cleanup(gl_);
3703 } 3761 }
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
4044 4102
4045 gl_->ScheduleCALayerSharedStateCHROMIUM( 4103 gl_->ScheduleCALayerSharedStateCHROMIUM(
4046 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect, 4104 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect,
4047 sorting_context_id, gl_transform); 4105 sorting_context_id, gl_transform);
4048 gl_->ScheduleCALayerCHROMIUM( 4106 gl_->ScheduleCALayerCHROMIUM(
4049 texture_id, contents_rect, ca_layer_overlay->background_color, 4107 texture_id, contents_rect, ca_layer_overlay->background_color,
4050 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); 4108 ca_layer_overlay->edge_aa_mask, bounds_rect, filter);
4051 } 4109 }
4052 4110
4053 } // namespace cc 4111 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698