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

Side by Side Diff: cc/video_layer_impl.cc

Issue 11413005: YUV software decode path stride fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: <WIP> Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/video_frame.cc » ('j') | media/base/video_frame.cc » ('J')
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/video_layer_impl.h" 5 #include "cc/video_layer_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/io_surface_draw_quad.h" 8 #include "cc/io_surface_draw_quad.h"
9 #include "cc/layer_tree_host_impl.h" 9 #include "cc/layer_tree_host_impl.h"
10 #include "cc/quad_sink.h" 10 #include "cc/quad_sink.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 m_externalTextureResource = 0; 280 m_externalTextureResource = 0;
281 } 281 }
282 282
283 m_provider->putCurrentFrame(m_webFrame); 283 m_provider->putCurrentFrame(m_webFrame);
284 m_frame = 0; 284 m_frame = 0;
285 285
286 m_providerLock.Release(); 286 m_providerLock.Release();
287 } 287 }
288 288
289 static gfx::Size videoFrameDimension(media::VideoFrame* frame, int plane) { 289 static gfx::Size videoFrameDimension(media::VideoFrame* frame, int plane) {
290 gfx::Size dimensions = frame->coded_size(); 290 gfx::Size dimensions = gfx::Size(frame->coded_size());
Ami GONE FROM CHROMIUM 2012/11/16 22:15:43 lolwat?
sheu 2012/11/17 00:35:39 You're looking at a CL 2 revisions old :-)
291 switch (frame->format()) { 291 switch (frame->format()) {
292 case media::VideoFrame::YV12: 292 case media::VideoFrame::YV12:
293 if (plane != media::VideoFrame::kYPlane) { 293 if (plane != media::VideoFrame::kYPlane) {
294 dimensions.set_width(dimensions.width() / 2); 294 dimensions.set_width(dimensions.width() / 2);
295 dimensions.set_height(dimensions.height() / 2); 295 dimensions.set_height(dimensions.height() / 2);
296 } 296 }
297 break; 297 break;
298 case media::VideoFrame::YV16: 298 case media::VideoFrame::YV16:
299 if (plane != media::VideoFrame::kYPlane) { 299 if (plane != media::VideoFrame::kYPlane) {
300 dimensions.set_width(dimensions.width() / 2); 300 dimensions.set_width(dimensions.width() / 2);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 ResourceProvider::ScopedWriteLockSoftware lock(resourceProvider, plane.r esourceId); 365 ResourceProvider::ScopedWriteLockSoftware lock(resourceProvider, plane.r esourceId);
366 m_videoRenderer->Paint(m_frame, lock.skCanvas(), m_frame->visible_rect() , 0xFF); 366 m_videoRenderer->Paint(m_frame, lock.skCanvas(), m_frame->visible_rect() , 0xFF);
367 return true; 367 return true;
368 } 368 }
369 369
370 for (size_t planeIndex = 0; planeIndex < planeCount; ++planeIndex) { 370 for (size_t planeIndex = 0; planeIndex < planeCount; ++planeIndex) {
371 VideoLayerImpl::FramePlane& plane = m_framePlanes[planeIndex]; 371 VideoLayerImpl::FramePlane& plane = m_framePlanes[planeIndex];
372 // Only non-FormatNativeTexture planes should need upload. 372 // Only non-FormatNativeTexture planes should need upload.
373 DCHECK_EQ(plane.format, GL_LUMINANCE); 373 DCHECK_EQ(plane.format, GL_LUMINANCE);
374 const uint8_t* softwarePlanePixels = m_frame->data(planeIndex); 374 const uint8_t* softwarePlanePixels = m_frame->data(planeIndex);
375 gfx::Rect planeRect(gfx::Point(), plane.size); 375 gfx::Rect imageRect(0, 0, m_frame->stride(planeIndex), plane.size.height ());
Ami GONE FROM CHROMIUM 2012/11/16 22:15:43 since this is going to copy anyway why not crop th
sheu 2012/11/17 00:35:39 Using m_frame->stride() here is just slightly hack
Ami GONE FROM CHROMIUM 2012/11/17 00:41:37 Why? ISTM the cleanest thing would be to make the
sheu 2012/11/17 01:50:38 This is the only place that knows about stride now
376 resourceProvider->setPixels(plane.resourceId, softwarePlanePixels, plane Rect, planeRect, gfx::Vector2d()); 376 gfx::Rect sourceRect(gfx::Point(), plane.size);
377 resourceProvider->setPixels(plane.resourceId, softwarePlanePixels, image Rect, sourceRect, gfx::Vector2d());
377 } 378 }
378 return true; 379 return true;
379 } 380 }
380 381
381 void VideoLayerImpl::freePlaneData(ResourceProvider* resourceProvider) 382 void VideoLayerImpl::freePlaneData(ResourceProvider* resourceProvider)
382 { 383 {
383 for (size_t i = 0; i < media::VideoFrame::kMaxPlanes; ++i) 384 for (size_t i = 0; i < media::VideoFrame::kMaxPlanes; ++i)
384 m_framePlanes[i].freeData(resourceProvider); 385 m_framePlanes[i].freeData(resourceProvider);
385 } 386 }
386 387
(...skipping 28 matching lines...) Expand all
415 { 416 {
416 layerTreeHostImpl()->setNeedsRedraw(); 417 layerTreeHostImpl()->setNeedsRedraw();
417 } 418 }
418 419
419 const char* VideoLayerImpl::layerTypeAsString() const 420 const char* VideoLayerImpl::layerTypeAsString() const
420 { 421 {
421 return "VideoLayer"; 422 return "VideoLayer";
422 } 423 }
423 424
424 } // namespace cc 425 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | media/base/video_frame.cc » ('j') | media/base/video_frame.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698