diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 20:23:05 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 20:23:05 +0000 |
commit | 980abb1a0ee220077635a9eb47c370b2b41f4fb1 (patch) | |
tree | 142171b517745b7aaeb77313d7cfa439133171fc /webkit | |
parent | 74188f235dd5b4f8e80ca30d6e3a4d4c3061d84d (diff) | |
download | chromium_src-980abb1a0ee220077635a9eb47c370b2b41f4fb1.zip chromium_src-980abb1a0ee220077635a9eb47c370b2b41f4fb1.tar.gz chromium_src-980abb1a0ee220077635a9eb47c370b2b41f4fb1.tar.bz2 |
Optimized version of bilinear video scaler. It is about 2 times faster than Skia that is currently used for video scaling.
BUG=19113
TEST=none
Review URL: http://codereview.chromium.org/1556021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/media/video_renderer_impl.cc | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/webkit/glue/media/video_renderer_impl.cc b/webkit/glue/media/video_renderer_impl.cc index 9148baf..8660920 100644 --- a/webkit/glue/media/video_renderer_impl.cc +++ b/webkit/glue/media/video_renderer_impl.cc @@ -94,11 +94,8 @@ void VideoRendererImpl::Paint(skia::PlatformCanvas* canvas, // 2. No flipping nor mirroring. // 3. Canvas has pixel format ARGB8888. // 4. Canvas is opaque. -// 5. No image scaling required. // TODO(hclam): The fast paint method should support flipping and mirroring. // Disable the flipping and mirroring checks once we have it. -// TODO(sergeyu): Implement bilinear scaling in ScaleYUVToRGB32 (libswscale?) -// and use it for scaling in FastPaint(). bool VideoRendererImpl::CanFastPaint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect) { const SkMatrix& total_matrix = canvas->getTotalMatrix(); @@ -109,9 +106,7 @@ bool VideoRendererImpl::CanFastPaint(skia::PlatformCanvas* canvas, if (SkScalarNearlyZero(total_matrix.getSkewX()) && SkScalarNearlyZero(total_matrix.getSkewY()) && total_matrix.getScaleX() > 0 && - total_matrix.getScaleY() > 0 && - dest_rect.width() == video_size_.width() && - dest_rect.height() == video_size_.height()) { + total_matrix.getScaleY() > 0) { // Get the properties of the SkDevice and the clip rect. SkDevice* device = canvas->getDevice(); @@ -266,18 +261,21 @@ void VideoRendererImpl::FastPaint(media::VideoFrame* video_frame, bitmap.lockPixels(); // TODO(hclam): do rotation and mirroring here. - // TODO(sergeyu): implement bilinear scaling in ScaleYUVToRGB32 - // and use it here. - media::ConvertYUVToRGB32(frame_clip_y, - frame_clip_u, - frame_clip_v, - dest_rect_pointer, - frame_clip_width, - frame_clip_height, - video_frame->stride(media::VideoFrame::kYPlane), - video_frame->stride(media::VideoFrame::kUPlane), - bitmap.rowBytes(), - yuv_type); + // TODO(fbarchard): switch filtering based on performance. + media::ScaleYUVToRGB32(frame_clip_y, + frame_clip_u, + frame_clip_v, + dest_rect_pointer, + frame_clip_width, + frame_clip_height, + local_dest_irect.width(), + local_dest_irect.height(), + video_frame->stride(media::VideoFrame::kYPlane), + video_frame->stride(media::VideoFrame::kUPlane), + bitmap.rowBytes(), + yuv_type, + media::ROTATE_0, + media::FILTER_BILINEAR); bitmap.unlockPixels(); } } |