From f00bc9ef46d64b10e8e32cd38009a76c73a746b9 Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Tue, 6 Oct 2015 18:46:53 -0700 Subject: [PATCH] Add J444ToARGB conversion function. J444 is JPeg YUV color space with 444 subsampling. This implementation uses the existing I444ToARGB conversion, which is BT.601 color space with 444 subsampling, but passing in the jpeg color matrix constants. TBR=harryjin@google.com BUG=449 Review URL: https://codereview.chromium.org/1387313002 . --- README.chromium | 2 +- include/libyuv/convert_argb.h | 8 +++++++ include/libyuv/version.h | 2 +- source/convert_argb.cc | 45 ++++++++++++++++++++++++++++++----- unit_test/convert_test.cc | 1 + 5 files changed, 50 insertions(+), 8 deletions(-) diff --git a/README.chromium b/README.chromium index 54997b24a..7d9cb9fc2 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1500 +Version: 1501 License: BSD License File: LICENSE diff --git a/include/libyuv/convert_argb.h b/include/libyuv/convert_argb.h index 696fa9d30..ce4e3d075 100644 --- a/include/libyuv/convert_argb.h +++ b/include/libyuv/convert_argb.h @@ -60,6 +60,14 @@ int I444ToARGB(const uint8* src_y, int src_stride_y, uint8* dst_argb, int dst_stride_argb, int width, int height); +// Convert J444 to ARGB. +LIBYUV_API +int J444ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + // Convert I444 to ABGR. LIBYUV_API int I444ToABGR(const uint8* src_y, int src_stride_y, diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 7a6c8fd72..a2a70c4f7 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1500 +#define LIBYUV_VERSION 1501 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/convert_argb.cc b/source/convert_argb.cc index d205f53fb..12fa8f447 100644 --- a/source/convert_argb.cc +++ b/source/convert_argb.cc @@ -46,11 +46,12 @@ int ARGBCopy(const uint8* src_argb, int src_stride_argb, // Convert I444 to ARGB. LIBYUV_API -int I444ToARGB(const uint8* src_y, int src_stride_y, - const uint8* src_u, int src_stride_u, - const uint8* src_v, int src_stride_v, - uint8* dst_argb, int dst_stride_argb, - int width, int height) { +static int I444ToARGBMatrix(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + struct YuvConstants* yuvconstants, + int width, int height) { int y; void (*I444ToARGBRow)(const uint8* y_buf, const uint8* u_buf, @@ -104,7 +105,7 @@ int I444ToARGB(const uint8* src_y, int src_stride_y, #endif for (y = 0; y < height; ++y) { - I444ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvConstants, width); + I444ToARGBRow(src_y, src_u, src_v, dst_argb, yuvconstants, width); dst_argb += dst_stride_argb; src_y += src_stride_y; src_u += src_stride_u; @@ -113,6 +114,38 @@ int I444ToARGB(const uint8* src_y, int src_stride_y, return 0; } +// Convert I444 to ARGB. +LIBYUV_API +int I444ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height) { + return I444ToARGBMatrix(src_y, src_stride_y, + src_u, src_stride_u, + src_v, src_stride_v, + dst_argb, dst_stride_argb, + &kYuvConstants, + width, height); +} + + +// Convert J444 to ARGB. +LIBYUV_API +int J444ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height) { + return I444ToARGBMatrix(src_y, src_stride_y, + src_u, src_stride_u, + src_v, src_stride_v, + dst_argb, dst_stride_argb, + &kYuvJConstants, + width, height); +} + + // Convert I444 to ABGR. LIBYUV_API int I444ToABGR(const uint8* src_y, int src_stride_y, diff --git a/unit_test/convert_test.cc b/unit_test/convert_test.cc index 43258d55b..1308c4cad 100644 --- a/unit_test/convert_test.cc +++ b/unit_test/convert_test.cc @@ -509,6 +509,7 @@ TESTPLANARTOB(I422, 2, 1, ABGR, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I422, 2, 1, RGBA, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I411, 4, 1, ARGB, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I444, 1, 1, ARGB, 4, 4, 1, 2, ARGB, 4) +TESTPLANARTOB(J444, 1, 1, ARGB, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I444, 1, 1, ABGR, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I420, 2, 2, YUY2, 2, 4, 1, 1, ARGB, 4) TESTPLANARTOB(I420, 2, 2, UYVY, 2, 4, 1, 1, ARGB, 4)