diff options
author | nick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-19 02:52:07 +0000 |
---|---|---|
committer | nick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-19 02:52:07 +0000 |
commit | 19e4e8af9251e29da27c4d7e1f66a0e5045c9c75 (patch) | |
tree | 8e3d767c9af5d91bf4315b9b45648cc55ff850ac | |
parent | 24d497e8930d3501eaf0b334d54929b09ab6b0fd (diff) | |
download | chromium_src-19e4e8af9251e29da27c4d7e1f66a0e5045c9c75.zip chromium_src-19e4e8af9251e29da27c4d7e1f66a0e5045c9c75.tar.gz chromium_src-19e4e8af9251e29da27c4d7e1f66a0e5045c9c75.tar.bz2 |
Revert 241755 "Use libyuv::ConvertToI420 for all all color forma..."
[Reason for revert: failed compile on android AOSP builder: http://build.chromium.org/p/chromium.linux/builders/Android%20Webview%20AOSP%20Builder/builds/7101 ]
> Use libyuv::ConvertToI420 for all all color formats in video capture on WIN
>
> Since libyuv has added support for image flipping (vertically) with negative
> src_height as indicator, we'd converge all color formats into one code path.
> And libyuv provides better performance.
>
> BUG=
> R=sergeyu@chromium.org
>
> Review URL: https://codereview.chromium.org/116573005
TBR=wjia@chromium.org
Review URL: https://codereview.chromium.org/104393003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241771 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/renderer_host/media/video_capture_controller.cc | 67 |
1 files changed, 42 insertions, 25 deletions
diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc index 4000563..1840af2 100644 --- a/content/browser/renderer_host/media/video_capture_controller.cc +++ b/content/browser/renderer_host/media/video_capture_controller.cc @@ -281,7 +281,6 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedFrame( int chopped_height = 0; int new_unrotated_width = frame_format.frame_size.width(); int new_unrotated_height = frame_format.frame_size.height(); - bool flip = false; if (new_unrotated_width & 1) { --new_unrotated_width; @@ -353,13 +352,6 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedFrame( break; case media::PIXEL_FORMAT_RGB24: origin_colorspace = libyuv::FOURCC_RAW; -#if defined(OS_WIN) - // TODO(wjia): Currently, for RGB24 on WIN, capture device always - // passes in positive src_width and src_height. Remove this hardcoded - // value when nagative src_height is supported. The negative src_height - // indicates that vertical flipping is needed. - flip = true; -#endif break; case media::PIXEL_FORMAT_ARGB: origin_colorspace = libyuv::FOURCC_ARGB; @@ -371,23 +363,48 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedFrame( NOTREACHED(); } - libyuv::ConvertToI420(data, - length, - yplane, - yplane_stride, - uplane, - uv_plane_stride, - vplane, - uv_plane_stride, - crop_x, - crop_y, - frame_format.frame_size.width(), - (flip ? -frame_format.frame_size.height() : - frame_format.frame_size.height()), - new_unrotated_width, - new_unrotated_height, - rotation_mode, - origin_colorspace); + int need_convert_rgb24_on_win = false; +#if defined(OS_WIN) + // TODO(wjia): Use libyuv::ConvertToI420 since support for image inversion + // (vertical flipping) has been added. Use negative src_height as indicator. + if (frame_format.pixel_format == media::PIXEL_FORMAT_RGB24) { + // Rotation is not supported in kRGB24 and OS_WIN case. + DCHECK(!rotation); + need_convert_rgb24_on_win = true; + } +#endif + if (need_convert_rgb24_on_win) { + int rgb_stride = -3 * (new_unrotated_width + chopped_width); + const uint8* rgb_src = + data + 3 * (new_unrotated_width + chopped_width) * + (new_unrotated_height - 1 + chopped_height); + media::ConvertRGB24ToYUV(rgb_src, + yplane, + uplane, + vplane, + new_unrotated_width, + new_unrotated_height, + rgb_stride, + yplane_stride, + uv_plane_stride); + } else { + libyuv::ConvertToI420(data, + length, + yplane, + yplane_stride, + uplane, + uv_plane_stride, + vplane, + uv_plane_stride, + crop_x, + crop_y, + new_unrotated_width + chopped_width, + new_unrotated_height, + new_unrotated_width, + new_unrotated_height, + rotation_mode, + origin_colorspace); + } #else // Libyuv is not linked in for Android WebView builds, but video capture is // not used in those builds either. Whenever libyuv is added in that build, |