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

Side by Side Diff: cc/layers/video_layer_impl.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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/output/gl_renderer.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layers/video_layer_impl.h" 5 #include "cc/layers/video_layer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "cc/layers/video_frame_provider_client_impl.h" 9 #include "cc/layers/video_frame_provider_client_impl.h"
10 #include "cc/quads/io_surface_draw_quad.h" 10 #include "cc/quads/io_surface_draw_quad.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 DCHECK_GE(frame_resources_.size(), 3u); 222 DCHECK_GE(frame_resources_.size(), 3u);
223 if (frame_resources_.size() < 3u) 223 if (frame_resources_.size() < 3u)
224 break; 224 break;
225 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601; 225 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601;
226 if (frame_->format() == media::VideoFrame::YV12J) { 226 if (frame_->format() == media::VideoFrame::YV12J) {
227 color_space = YUVVideoDrawQuad::JPEG; 227 color_space = YUVVideoDrawQuad::JPEG;
228 } else if (frame_->format() == media::VideoFrame::YV12HD) { 228 } else if (frame_->format() == media::VideoFrame::YV12HD) {
229 color_space = YUVVideoDrawQuad::REC_709; 229 color_space = YUVVideoDrawQuad::REC_709;
230 } 230 }
231 231
232 const gfx::Size ya_tex_size = coded_size;
233 const gfx::Size uv_tex_size = media::VideoFrame::PlaneSize(
234 frame_->format(), media::VideoFrame::kUPlane, coded_size);
235 DCHECK(uv_tex_size ==
236 media::VideoFrame::PlaneSize(
237 frame_->format(), media::VideoFrame::kVPlane, coded_size));
238 if (frame_resources_.size() > 3) {
239 DCHECK(ya_tex_size ==
240 media::VideoFrame::PlaneSize(
241 frame_->format(), media::VideoFrame::kAPlane, coded_size));
242 }
243
232 gfx::RectF tex_coord_rect( 244 gfx::RectF tex_coord_rect(
233 tex_x_offset, tex_y_offset, tex_width_scale, tex_height_scale); 245 tex_x_offset, tex_y_offset, tex_width_scale, tex_height_scale);
234 YUVVideoDrawQuad* yuv_video_quad = 246 YUVVideoDrawQuad* yuv_video_quad =
235 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); 247 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>();
236 yuv_video_quad->SetNew( 248 yuv_video_quad->SetNew(
237 shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, 249 shared_quad_state, quad_rect, opaque_rect, visible_quad_rect,
238 tex_coord_rect, coded_size, frame_resources_[0], frame_resources_[1], 250 tex_coord_rect, ya_tex_size, uv_tex_size, frame_resources_[0],
239 frame_resources_[2], 251 frame_resources_[1], frame_resources_[2],
240 frame_resources_.size() > 3 ? frame_resources_[3] : 0, color_space); 252 frame_resources_.size() > 3 ? frame_resources_[3] : 0, color_space);
241 break; 253 break;
242 } 254 }
243 case VideoFrameExternalResources::RGB_RESOURCE: { 255 case VideoFrameExternalResources::RGB_RESOURCE: {
244 DCHECK_EQ(frame_resources_.size(), 1u); 256 DCHECK_EQ(frame_resources_.size(), 1u);
245 if (frame_resources_.size() < 1u) 257 if (frame_resources_.size() < 1u)
246 break; 258 break;
247 bool premultiplied_alpha = true; 259 bool premultiplied_alpha = true;
248 gfx::PointF uv_top_left(0.f, 0.f); 260 gfx::PointF uv_top_left(0.f, 0.f);
249 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); 261 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 void VideoLayerImpl::SetProviderClientImpl( 379 void VideoLayerImpl::SetProviderClientImpl(
368 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { 380 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) {
369 provider_client_impl_ = provider_client_impl; 381 provider_client_impl_ = provider_client_impl;
370 } 382 }
371 383
372 const char* VideoLayerImpl::LayerTypeAsString() const { 384 const char* VideoLayerImpl::LayerTypeAsString() const {
373 return "cc::VideoLayerImpl"; 385 return "cc::VideoLayerImpl";
374 } 386 }
375 387
376 } // namespace cc 388 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/gl_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698