webcodecs: Optimize ImageBitmap to Frame with Skia's readbackYUV API
The code would previously copy SkImage data out and use libyuv to do RGB ->YUV conversion, which causes some unnecessary memory copies. This CL use Skia's YUV420 readback API instead of doing an RGB readback and a color space conversion afterwards. This is verified via a demo which do 720P/30fps UserMedia->ImageBitmap-> VideoFrame->encode->decode->render. and from chrome::tracing, the average cpu time of VideoFrame::Create is reduced from 6.462ms to2.24ms. and the package power consumption is reduced from 8.03W to 6.02W, so about 25%. The IA memory bandwidth is reduced about 29%. Bug: 1102290 Test: Manually test on atlas Change-Id: I709bef072102e9fe23e16d69a370641b969e47e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494900Reviewed-by:Eugene Zemtsov <eugene@chromium.org> Reviewed-by:
Dan Sanders <sandersd@chromium.org> Commit-Queue: Zhaoliang Ma <zhaoliang.ma@intel.com> Cr-Commit-Position: refs/heads/master@{#825244}
Showing
Please register or sign in to comment