Commit 97b3990d authored by Frank Barchard's avatar Frank Barchard

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: 's avatarFrank Barchard <fbarchard@chromium.org>
Reviewed-by: 's avatarMirko Bonadei <mbonadei@chromium.org>
parent 594d59d0
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 1718
Version: 1719
License: BSD
License File: LICENSE
......
......@@ -298,6 +298,28 @@ int NV21ToRGB24(const uint8_t* src_y,
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,
......
......@@ -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_
......@@ -1940,7 +1940,6 @@ static int NV21ToRGB24Matrix(const uint8_t* src_y,
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 @@ int NV21ToRGB24(const uint8_t* src_y,
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,
......
......@@ -736,6 +736,8 @@ TESTBIPLANARTOB(NV12, 2, 2, ABGR, 4, 2)
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment