NV21ToRAW and NV12ToRAW functions added RAW is a big endian style RGB buffer with R first in memory, then G and B. Convert NV21 and NV12 to RAW format. Performance on SkylakeX for 720p with AVX2 I420ToRAW_Opt (388 ms) H420ToRAW_Opt (371 ms) NV12ToRAW_Opt (341 ms) NV21ToRAW_Opt (339 ms) SSSE3 I420ToRAW_Opt (507 ms) H420ToRAW_Opt (481 ms) NV12ToRAW_Opt (498 ms) NV21ToRAW_Opt (493 ms) C I420ToRAW_Opt (2287 ms) H420ToRAW_Opt (2246 ms) NV12ToRAW_Opt (2191 ms) NV21ToRAW_Opt (2204 ms) Performance on Pixel 2 for 720p out/Release/bin/run_libyuv_unittest -v -t 7200 --gtest_filter=*NV??ToR*Opt --libyuv_repeat=1000 --libyuv_width=1280 --libyuv_height=720 LibYUVConvertTest.NV12ToRGB24_Opt (1739 ms) LibYUVConvertTest.NV21ToRGB24_Opt (1734 ms) LibYUVConvertTest.NV12ToRAW_Opt (1719 ms) LibYUVConvertTest.NV21ToRAW_Opt (1691 ms) LibYUVConvertTest.NV12ToRGB565_Opt (2152 ms) Bug: libyuv:778, b:117522975 Test: add new NV21ToRAW and NV12ToRAW tests Change-Id: Ieabb68a2c6d8c26743e609c5696c81bb14fb253f Reviewed-on: https://chromium-review.googlesource.com/c/1272615 Commit-Queue: Frank Barchard <fbarchard@chromium.org> Reviewed-by: Frank Barchard <fbarchard@chromium.org> Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
diff --git a/README.chromium b/README.chromium index 48dbc40..d3f431f 100644 --- a/README.chromium +++ b/README.chromium
@@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1718 +Version: 1719 License: BSD License File: LICENSE
diff --git a/include/libyuv/convert_argb.h b/include/libyuv/convert_argb.h index ab772b6..891c57d 100644 --- a/include/libyuv/convert_argb.h +++ b/include/libyuv/convert_argb.h
@@ -298,6 +298,28 @@ int width, int height); +// Convert NV12 to RAW. +LIBYUV_API +int NV12ToRAW(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_uv, + int src_stride_uv, + uint8_t* dst_raw, + int dst_stride_raw, + int width, + int height); + +// Convert NV21 to RAW. +LIBYUV_API +int NV21ToRAW(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_vu, + int src_stride_vu, + uint8_t* dst_raw, + int dst_stride_raw, + int width, + int height); + // Convert M420 to ARGB. LIBYUV_API int M420ToARGB(const uint8_t* src_m420,
diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 6858b03..d2d00e5 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h
@@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1718 +#define LIBYUV_VERSION 1719 #endif // INCLUDE_LIBYUV_VERSION_H_
diff --git a/source/convert_argb.cc b/source/convert_argb.cc index dddab61..143f75b 100644 --- a/source/convert_argb.cc +++ b/source/convert_argb.cc
@@ -1940,7 +1940,6 @@ return 0; } -// TODO(fbarchard): NV12ToRAW can be implemented by mirrored matrix. // Convert NV12 to RGB24. LIBYUV_API int NV12ToRGB24(const uint8_t* src_y, @@ -1971,6 +1970,36 @@ width, height); } +// Convert NV12 to RAW. +LIBYUV_API +int NV12ToRAW(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_uv, + int src_stride_uv, + uint8_t* dst_raw, + int dst_stride_raw, + int width, + int height) { + return NV21ToRGB24Matrix(src_y, src_stride_y, src_uv, src_stride_uv, + dst_raw, dst_stride_raw, &kYvuI601Constants, + width, height); +} + +// Convert NV21 to RAW. +LIBYUV_API +int NV21ToRAW(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_vu, + int src_stride_vu, + uint8_t* dst_raw, + int dst_stride_raw, + int width, + int height) { + return NV12ToRGB24Matrix(src_y, src_stride_y, src_vu, src_stride_vu, + dst_raw, dst_stride_raw, &kYvuI601Constants, + width, height); +} + // Convert M420 to ARGB. LIBYUV_API int M420ToARGB(const uint8_t* src_m420,
diff --git a/unit_test/convert_test.cc b/unit_test/convert_test.cc index c13d882..47ed653 100644 --- a/unit_test/convert_test.cc +++ b/unit_test/convert_test.cc
@@ -736,6 +736,8 @@ TESTBIPLANARTOB(NV21, 2, 2, ABGR, 4, 2) TESTBIPLANARTOB(NV12, 2, 2, RGB24, 3, 2) TESTBIPLANARTOB(NV21, 2, 2, RGB24, 3, 2) +TESTBIPLANARTOB(NV12, 2, 2, RAW, 3, 2) +TESTBIPLANARTOB(NV21, 2, 2, RAW, 3, 2) TESTBIPLANARTOB(NV12, 2, 2, RGB565, 2, 9) #ifdef DO_THREE_PLANES