lcwyylcwyy / libyuv

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

NV21ToARGB for Arm #500

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
On Arm, the NV12ToARGB uses a matrix that assumes 0's for U contribution to Red 
and V contribution to Blue.  Whereas the Intel version and C code does the full 
matrix, multiplying by 0.  So changing the matrix on Arm doesnt allow 
NV21ToARGB.

The NV12ToARGB function can be passed a matrix that when passed NV21 (VU 
instead of UV), produces BGR instead of RGB.
If NV12ToABGR were called with this matrix and NV21, it would produce ARGB.

Original issue reported on code.google.com by fbarch...@chromium.org on 6 Oct 2015 at 6:16

GoogleCodeExporter commented 9 years ago
Another approach is implement READNV21 and support NV21ToARGB.
To implement ABGR, swap U/V for any yuv function, use a matrix that swaps the 
contributions, and the existing functions can output ABGR.

Original comment by fbarch...@chromium.org on 6 Oct 2015 at 9:42

GoogleCodeExporter commented 9 years ago
Intel version benchmarked:

set LIBYUV_WIDTH=1280
set LIBYUV_HEIGHT=720
set LIBYUV_REPEAT=9999
set LIBYUV_FLAGS=-1
out\release\libyuv_unittest --gtest_catch_exceptions=0 
--gtest_filter=*NV??ToARGB_Opt  | sortms

Was
NV12ToARGB_Opt (4545 ms)
NV21ToARGB_Opt (4245 ms)

Now
NV12ToARGB_Opt (4401 ms)
NV21ToARGB_Opt (4213 ms)

Original comment by fbarch...@chromium.org on 7 Oct 2015 at 2:45

GoogleCodeExporter commented 9 years ago
Fixed in r1502.
Implemented using READNV21 technique, exposing NV21ToARGB.

Future work:
To implement NV12ToABGR and NV21ToABGR, can pass VU instead of UV and a matrix 
with coefficints swapped.  Existing low levels can be used.
Normal yuvconstants look like:
UB 0
UG VG
0  VR
Swapped yuvconstants look like:
VR 0
VG UG
0  UB

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