almondyoung / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Add _420ToARGB() and _420ToABGR with BT.709 color space support for SkCanvasVideoRenderer. #472

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Required for this function:
https://code.google.com/p/chromium/codesearch#chromium/src/media/blink/skcanvas_
video_renderer.cc&l=543

BT709 constants available here:
https://code.google.com/p/chromium/codesearch#chromium/src/media/base/yuv_conver
t.cc&l=288

Original issue reported on code.google.com by dalecurtis@chromium.org on 24 Jul 2015 at 9:44

GoogleCodeExporter commented 8 years ago
Theres an SkCanvasVideoRenderer unittest in media_blink_unittests

Original comment by dalecurtis@chromium.org on 24 Jul 2015 at 10:00

GoogleCodeExporter commented 8 years ago
Code search only finds bt709 using the ConvertYUVToRGB32 function now

https://code.google.com/p/chromium/codesearch#search/&q=ConvertYUVToRGB32&sq=pac
kage:chromium&type=cs

Plan to make I420 conversion accept a color matrix.

Original comment by fbarch...@chromium.org on 28 Aug 2015 at 5:45

GoogleCodeExporter commented 8 years ago
r1483 ports H420ToARGB to Neon for arm v7 (32 bit).
aarch64 code uses hard coded constants and needs some reworking

// TODO(fbarchard): Use structure for constants like 32 bit code.
#define RGBTOUV_SETUP_REG                                                      \
    "movi       v20.8h, #56, lsl #0  \n"  /* UB/VR coefficient (0.875) / 2 */  \
    "movi       v21.8h, #37, lsl #0  \n"  /* UG coefficient (-0.5781) / 2  */  \
    "movi       v22.8h, #19, lsl #0  \n"  /* UR coefficient (-0.2969) / 2  */  \
    "movi       v23.8h, #9,  lsl #0  \n"  /* VB coefficient (-0.1406) / 2  */  \
    "movi       v24.8h, #47, lsl #0  \n"  /* VG coefficient (-0.7344) / 2  */  \
    "movi       v25.16b, #0x80       \n"  /* 128.5 (0x8080 in 16-bit)      */

should be similar to armv7
#define YUV422TORGB_SETUP_REG                                                  \
    MEMACCESS([kUVToRB])                                                       \
    "vld1.8     {d24}, [%[kUVToRB]]            \n"                             \
    MEMACCESS([kUVToG])                                                        \
    "vld1.8     {d25}, [%[kUVToG]]             \n"                             \
    MEMACCESS([kUVBiasBGR])                                                    \
    "vld1.16    {d26[], d27[]}, [%[kUVBiasBGR]]! \n"                           \
    MEMACCESS([kUVBiasBGR])                                                    \
    "vld1.16    {d8[], d9[]}, [%[kUVBiasBGR]]!   \n"                           \
    MEMACCESS([kUVBiasBGR])                                                    \
    "vld1.16    {d28[], d29[]}, [%[kUVBiasBGR]]  \n"                           \
    MEMACCESS([kYToRgb])                                                       \
    "vld1.32    {d30[], d31[]}, [%[kYToRgb]]     \n"

Original comment by fbarch...@google.com on 17 Sep 2015 at 5:46

GoogleCodeExporter commented 8 years ago
r1485 implements Intel versions.
TODO: H420ToABGR for arm v7, and H420ToARGB and H420ToABGR for aarch64.
C versions should switch to matrix, to match SIMD.  Calling code can then call 
matrix functions directly, and remove wrappers.

Original comment by fbarch...@google.com on 17 Sep 2015 at 8:08

GoogleCodeExporter commented 8 years ago
r1502 implements aarch64 versions.

Original comment by fbarch...@chromium.org on 7 Oct 2015 at 5:53

GoogleCodeExporter commented 8 years ago
Arm C version and odd width working.
LibYUVConvertTest.H420ToARGB_Opt (3242 ms)
LibYUVConvertTest.H420ToABGR_Opt (3285 ms)
LibYUVConvertTest.I420ToARGB_Opt (3214 ms)

util/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose 
--release --gtest_filter=*I420ToARGB_Opt -a "--libyuv_width=1280 
--libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=-1"

Original comment by fbarch...@chromium.org on 24 Oct 2015 at 1:51