From 6efd8f2cf03d47efe9774884fdcc8652173c52ee Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Wed, 27 May 2020 11:05:24 -0700 Subject: [PATCH] NV12ToABGR and RAW Matrix macros Bug: libyuv:861, b/156642185 Change-Id: I5ebcff33aa1a419aa2e766f6133b349e4e658297 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2216704 Commit-Queue: Frank Barchard Reviewed-by: Hsiu Wang --- README.chromium | 2 +- include/libyuv/convert_argb.h | 12 ++++++++++++ include/libyuv/version.h | 2 +- unit_test/convert_test.cc | 12 ++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/README.chromium b/README.chromium index 32f5c883d..860799e76 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1757 +Version: 1758 License: BSD License File: LICENSE diff --git a/include/libyuv/convert_argb.h b/include/libyuv/convert_argb.h index 6f55e11b9..a45b94c7f 100644 --- a/include/libyuv/convert_argb.h +++ b/include/libyuv/convert_argb.h @@ -32,6 +32,18 @@ LIBYUV_API extern const struct YuvConstants kYvuJPEGConstants; // JPeg LIBYUV_API extern const struct YuvConstants kYvuH709Constants; // BT.709 LIBYUV_API extern const struct YuvConstants kYvu2020Constants; // BT.2020 +// Macros for end swapped destination Matrix conversions. +// Swap UV and pass mirrored kYvuJPEGConstants matrix. +// TODO(fbarchard): Add macro for each Matrix function. +#define kYuvI601ConstantsVU kYvuI601Constants +#define kYuvJPEGConstantsVU kYvuJPEGConstants +#define kYuvH709ConstantsVU kYvuH709Constants +#define kYuv2020ConstantsVU kYvu2020Constants +#define NV12ToABGRMatrix(a, b, c, d, e, f, g, h, i) NV21ToARGBMatrix(a, b, c, d, e, f, g##VU, h, i) +#define NV21ToABGRMatrix(a, b, c, d, e, f, g, h, i) NV12ToARGBMatrix(a, b, c, d, e, f, g##VU, h, i) +#define NV12ToRAWMatrix(a, b, c, d, e, f, g, h, i) NV21ToRGB24Matrix(a, b, c, d, e, f, g##VU, h, i) +#define NV21ToRAWMatrix(a, b, c, d, e, f, g, h, i) NV12ToRGB24Matrix(a, b, c, d, e, f, g##VU, h, i) + // Alias. #define ARGBToARGB ARGBCopy diff --git a/include/libyuv/version.h b/include/libyuv/version.h index dcd864f11..ba3ef50c1 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 1757 +#define LIBYUV_VERSION 1758 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/unit_test/convert_test.cc b/unit_test/convert_test.cc index 1d008e57b..6bfed10b9 100644 --- a/unit_test/convert_test.cc +++ b/unit_test/convert_test.cc @@ -787,6 +787,18 @@ TESTQPLANARTOB(I420Alpha, 2, 2, ABGR, 4, 4, 1) TESTBIPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, FMT_C, BPP_B, \ benchmark_width_, _Opt, +, 0) +#define kYuvJPEGConstantsVU kYvuJPEGConstants +#define NV12ToABGRMatrix(a, b, c, d, e, f, g, h, i) \ + NV21ToARGBMatrix(a, b, c, d, e, f, g##VU, h, i) +#define NV21ToABGRMatrix(a, b, c, d, e, f, g, h, i) \ + NV12ToARGBMatrix(a, b, c, d, e, f, g##VU, h, i) +#define NV12ToRAWMatrix(a, b, c, d, e, f, g, h, i) \ + NV21ToRGB24Matrix(a, b, c, d, e, f, g##VU, h, i) +#define NV21ToRAWMatrix(a, b, c, d, e, f, g, h, i) \ + NV12ToRGB24Matrix(a, b, c, d, e, f, g##VU, h, i) +#define NV12ToRGB565Matrix(a, b, c, d, e, f, g, h, i) \ + NV12ToRGB565Matrix(a, b, c, d, e, f, &kYuvJPEGConstants, g, h) + #define JNV12ToARGB(a, b, c, d, e, f, g, h) \ NV12ToARGBMatrix(a, b, c, d, e, f, &kYuvJPEGConstants, g, h) #define JNV21ToARGB(a, b, c, d, e, f, g, h) \