New issue
Advanced search Search tips

Issue 629342 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Feature



Sign in to add a comment

Android: use libyuv::Android420ToI420 API to do de-interlacing to captured YUV_420_888 frame.

Project Member Reported by braveyao@chromium.org, Jul 19 2016

Issue description

When YUV_420_888 format frame is requested on Android, e.g. to CameraDevice or MediaProjection, the 420 frame got actually has interleaved u/v planes (https://developer.android.com/reference/android/graphics/ImageFormat.html#YUV_420_888). So we have to do de-interlacing to convert them into normal I420 frames.
Once we do this in JAVA codes, https://cs.chromium.org/chromium/src/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java?q=videocapturecamera&sq=package:chromium&l=324, which is too slow, more than 20ms for a 720P frame. 
If we do it in native codes, https://cs.chromium.org/chromium/src/media/capture/content/android/screen_capture_machine_android.cc?sq=package:chromium&l=150, which is much better, a little bit more than 1ms for a 720P frame.

Now libyuv offers a new API, Android420ToI420, which can reduce the converting time further to 0.9ms for a 720P frame(Tests are done on same Nexus5, Android M). It's more than 20 times faster than Java and 1.5 times faster than C. So it's very important to utilize the new API ASAP.
 

Comment 1 by mcasas@chromium.org, Jul 19 2016

Components: Blink>GetUserMedia>Webcam Blink>MediaStream
Project Member

Comment 2 by bugdroid1@chromium.org, Jul 22 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b3edc847c341fa19ccb964ba2ebf89325c8c3723

commit b3edc847c341fa19ccb964ba2ebf89325c8c3723
Author: braveyao <braveyao@chromium.org>
Date: Fri Jul 22 17:11:49 2016

Android video capture: use new libyuv::Android420ToI420 API for format converting.

libyuv offers a new API, Android420ToI420, to convert the
Android YUV_420_888 frame (which has interleaved UV planes)
to normal I420 frame.
This can significantly reduce the de-interlacing time on
Android, up to dozens of milliseconds, which can help a lot
on the overall end-to-end video delay.

BUG= 629342 

Review-Url: https://codereview.chromium.org/2156003006
Cr-Commit-Position: refs/heads/master@{#407183}

[modify] https://crrev.com/b3edc847c341fa19ccb964ba2ebf89325c8c3723/media/capture/content/android/screen_capture_machine_android.cc
[modify] https://crrev.com/b3edc847c341fa19ccb964ba2ebf89325c8c3723/media/capture/content/android/screen_capture_machine_android.h
[modify] https://crrev.com/b3edc847c341fa19ccb964ba2ebf89325c8c3723/media/capture/video/android/BUILD.gn
[modify] https://crrev.com/b3edc847c341fa19ccb964ba2ebf89325c8c3723/media/capture/video/android/java/src/org/chromium/media/VideoCapture.java
[modify] https://crrev.com/b3edc847c341fa19ccb964ba2ebf89325c8c3723/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java
[modify] https://crrev.com/b3edc847c341fa19ccb964ba2ebf89325c8c3723/media/capture/video/android/video_capture_device_android.cc
[modify] https://crrev.com/b3edc847c341fa19ccb964ba2ebf89325c8c3723/media/capture/video/android/video_capture_device_android.h

Status: Fixed (was: Assigned)

Sign in to add a comment