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

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: 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); 197 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData);
198 198
199 // FIXME: When we pass quads out of process, we need to double-buffer, or 199 // FIXME: When we pass quads out of process, we need to double-buffer, or
200 // otherwise synchonize use of all textures in the quad. 200 // otherwise synchonize use of all textures in the quad.
201 201
202 gfx::Rect quadRect(gfx::Point(), contentBounds()); 202 gfx::Rect quadRect(gfx::Point(), contentBounds());
203 gfx::Rect visibleRect = m_frame->visible_rect(); 203 gfx::Rect visibleRect = m_frame->visible_rect();
204 gfx::Size codedSize = m_frame->coded_size(); 204 gfx::Size codedSize = m_frame->coded_size();
205 205
206 // pixels for macroblocked formats. 206 // pixels for macroblocked formats.
207 const float texWidthScale = 207 float texWidthScale =
208 static_cast<float>(visibleRect.width()) / codedSize.width(); 208 static_cast<float>(visibleRect.width()) / codedSize.width();
209 const float texHeightScale = 209 float texHeightScale =
Ami GONE FROM CHROMIUM 2012/11/15 18:15:36 Undo these changes?
sheu 2012/11/15 19:46:38 They're applicable for the rest of the paths, so I
Ami GONE FROM CHROMIUM 2012/11/15 20:39:09 My point was that all you changed was dropping the
sheu 2012/11/15 22:20:53 Ah right, no-op change. Fixed.
210 static_cast<float>(visibleRect.height()) / codedSize.height(); 210 static_cast<float>(visibleRect.height()) / codedSize.height();
211 211
212 switch (m_format) { 212 switch (m_format) {
213 case GL_LUMINANCE: { 213 case GL_LUMINANCE: {
214 // YUV software decoder. 214 // YUV software decoder.
215 const FramePlane& yPlane = m_framePlanes[media::VideoFrame::kYPlane]; 215 const FramePlane& yPlane = m_framePlanes[media::VideoFrame::kYPlane];
216 const FramePlane& uPlane = m_framePlanes[media::VideoFrame::kUPlane]; 216 const FramePlane& uPlane = m_framePlanes[media::VideoFrame::kUPlane];
217 const FramePlane& vPlane = m_framePlanes[media::VideoFrame::kVPlane]; 217 const FramePlane& vPlane = m_framePlanes[media::VideoFrame::kVPlane];
218 gfx::SizeF texScale(texWidthScale, texHeightScale); 218 // YUV software decoder uses CPU-allocated textures that have extra
219 // padding past what coded_size_ reflects.
Ami GONE FROM CHROMIUM 2012/11/15 18:15:36 I don't see how this CL changes things; how is yPl
sheu 2012/11/15 19:46:38 See video_frame.cc, where we do some extra alignme
Ami GONE FROM CHROMIUM 2012/11/15 20:39:09 I somehow missed the thunk below in videoFrameDime
220 gfx::SizeF texScale(
221 static_cast<float>(visibleRect.width()) / yPlane.size.width(),
Ami GONE FROM CHROMIUM 2012/11/15 20:39:09 What is this supposed to be scaling from/to? My a
sheu 2012/11/15 22:20:53 We're not scaling to <video> dimensions -- that's
222 static_cast<float>(visibleRect.height()) / yPlane.size.height());
219 scoped_ptr<YUVVideoDrawQuad> yuvVideoQuad = YUVVideoDrawQuad::create( 223 scoped_ptr<YUVVideoDrawQuad> yuvVideoQuad = YUVVideoDrawQuad::create(
220 sharedQuadState, quadRect, texScale, yPlane, uPlane, vPlane); 224 sharedQuadState, quadRect, texScale, yPlane, uPlane, vPlane);
221 quadSink.append(yuvVideoQuad.PassAs<DrawQuad>(), appendQuadsData); 225 quadSink.append(yuvVideoQuad.PassAs<DrawQuad>(), appendQuadsData);
222 break; 226 break;
223 } 227 }
224 case GL_RGBA: { 228 case GL_RGBA: {
225 // RGBA software decoder. 229 // RGBA software decoder.
226 const FramePlane& plane = m_framePlanes[media::VideoFrame::kRGBPlane]; 230 const FramePlane& plane = m_framePlanes[media::VideoFrame::kRGBPlane];
227 bool premultipliedAlpha = true; 231 bool premultipliedAlpha = true;
228 gfx::RectF uvRect(0, 0, texWidthScale, texHeightScale); 232 gfx::RectF uvRect(0, 0, texWidthScale, texHeightScale);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 m_externalTextureResource = 0; 284 m_externalTextureResource = 0;
281 } 285 }
282 286
283 m_provider->putCurrentFrame(m_webFrame); 287 m_provider->putCurrentFrame(m_webFrame);
284 m_frame = 0; 288 m_frame = 0;
285 289
286 m_providerLock.Release(); 290 m_providerLock.Release();
287 } 291 }
288 292
289 static gfx::Size videoFrameDimension(media::VideoFrame* frame, int plane) { 293 static gfx::Size videoFrameDimension(media::VideoFrame* frame, int plane) {
290 gfx::Size dimensions = frame->coded_size(); 294 gfx::Size dimensions = gfx::Size(frame->stride(plane),
295 frame->coded_size().height());
291 switch (frame->format()) { 296 switch (frame->format()) {
292 case media::VideoFrame::YV12: 297 case media::VideoFrame::YV12:
293 if (plane != media::VideoFrame::kYPlane) { 298 if (plane != media::VideoFrame::kYPlane)
294 dimensions.set_width(dimensions.width() / 2);
295 dimensions.set_height(dimensions.height() / 2); 299 dimensions.set_height(dimensions.height() / 2);
296 }
297 break;
298 case media::VideoFrame::YV16:
299 if (plane != media::VideoFrame::kYPlane) {
300 dimensions.set_width(dimensions.width() / 2);
301 }
302 break; 300 break;
303 default: 301 default:
304 break; 302 break;
305 } 303 }
306 return dimensions; 304 return dimensions;
307 } 305 }
308 306
309 bool VideoLayerImpl::FramePlane::allocateData( 307 bool VideoLayerImpl::FramePlane::allocateData(
310 ResourceProvider* resourceProvider) 308 ResourceProvider* resourceProvider)
311 { 309 {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 { 413 {
416 layerTreeHostImpl()->setNeedsRedraw(); 414 layerTreeHostImpl()->setNeedsRedraw();
417 } 415 }
418 416
419 const char* VideoLayerImpl::layerTypeAsString() const 417 const char* VideoLayerImpl::layerTypeAsString() const
420 { 418 {
421 return "VideoLayer"; 419 return "VideoLayer";
422 } 420 }
423 421
424 } // namespace cc 422 } // 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