mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 17:26:49 +08:00
Enable unlimited data for YUV to RGB
- Provide LIBYUV_LIMITED_DATA macro for backwards compatiblity Bug: b/474156256 Change-Id: I5d5d7fb640d51ae3c5ad363f2a28c8bfbd3048a5 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3912081 Reviewed-by: Wan-Teh Chang <wtc@google.com> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
parent
344bd4dd68
commit
b9adaef113
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1844
|
||||
Version: 1845
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 1844
|
||||
#define LIBYUV_VERSION 1845
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
@ -22,13 +22,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// This macro controls YUV to RGB using unsigned math to extend range of
|
||||
// YUV to RGB coefficients to 0 to 4 instead of 0 to 2 for more accuracy on B:
|
||||
// LIBYUV_UNLIMITED_DATA
|
||||
|
||||
// Macros to enable unlimited data for each colorspace
|
||||
// LIBYUV_UNLIMITED_BT601
|
||||
// LIBYUV_UNLIMITED_BT709
|
||||
// LIBYUV_UNLIMITED_BT2020
|
||||
// YUV to RGB coefficients to 0 to 4 instead of 0 to 2 for more accuracy on B.
|
||||
// Enable this macro for backwards compatiability with limited range 0 to 2.
|
||||
// LIBYUV_LIMITED_DATA
|
||||
|
||||
// The following macro from row_win makes the C code match the row_win code,
|
||||
// which is 7 bit fixed point for ARGBToI420:
|
||||
@ -1484,7 +1480,7 @@ void J400ToARGBRow_C(const uint8_t* src_y, uint8_t* dst_argb, int width) {
|
||||
// KR = 0.299; KB = 0.114
|
||||
|
||||
// U and V contributions to R,G,B.
|
||||
#if defined(LIBYUV_UNLIMITED_DATA) || defined(LIBYUV_UNLIMITED_BT601)
|
||||
#if !defined(LIBYUV_LIMITED_DATA)
|
||||
#define UB 129 /* round(2.018 * 64) */
|
||||
#else
|
||||
#define UB 128 /* max(128, round(2.018 * 64)) */
|
||||
@ -1538,7 +1534,7 @@ MAKEYUVCONSTANTS(JPEG, YG, YB, UB, UG, VG, VR)
|
||||
// KR = 0.2126, KB = 0.0722
|
||||
|
||||
// U and V contributions to R,G,B.
|
||||
#if defined(LIBYUV_UNLIMITED_DATA) || defined(LIBYUV_UNLIMITED_BT709)
|
||||
#if !defined(LIBYUV_LIMITED_DATA)
|
||||
#define UB 135 /* round(2.112 * 64) */
|
||||
#else
|
||||
#define UB 128 /* max(128, round(2.112 * 64)) */
|
||||
@ -1592,7 +1588,7 @@ MAKEYUVCONSTANTS(F709, YG, YB, UB, UG, VG, VR)
|
||||
// KR = 0.2627; KB = 0.0593
|
||||
|
||||
// U and V contributions to R,G,B.
|
||||
#if defined(LIBYUV_UNLIMITED_DATA) || defined(LIBYUV_UNLIMITED_BT2020)
|
||||
#if !defined(LIBYUV_LIMITED_DATA)
|
||||
#define UB 137 /* round(2.142 * 64) */
|
||||
#else
|
||||
#define UB 128 /* max(128, round(2.142 * 64)) */
|
||||
|
||||
@ -32,10 +32,10 @@ namespace libyuv {
|
||||
#endif
|
||||
#define ERROR_R 1
|
||||
#define ERROR_G 1
|
||||
#ifdef LIBYUV_UNLIMITED_DATA
|
||||
#define ERROR_B 1
|
||||
#else
|
||||
#if defined(LIBYUV_LIMITED_DATA)
|
||||
#define ERROR_B 18
|
||||
#else
|
||||
#define ERROR_B 1
|
||||
#endif
|
||||
|
||||
#define TESTCS(TESTNAME, YUVTOARGB, ARGBTOYUV, HS1, HS, HN, DIFF) \
|
||||
@ -502,10 +502,10 @@ TEST_F(LibYUVColorTest, TestYUV) {
|
||||
YUVToRGB(240, 0, 0, &r1, &g1, &b1);
|
||||
EXPECT_EQ(57, r1);
|
||||
EXPECT_EQ(255, g1);
|
||||
#ifdef LIBYUV_UNLIMITED_DATA
|
||||
EXPECT_EQ(3, b1);
|
||||
#else
|
||||
#if defined(LIBYUV_LIMITED_DATA)
|
||||
EXPECT_EQ(5, b1);
|
||||
#else
|
||||
EXPECT_EQ(3, b1);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
|
||||
@ -2620,10 +2620,10 @@ TEST_F(LibYUVConvertTest, TestMJPGToARGB) {
|
||||
|
||||
// Test result matches known hash value.
|
||||
uint32_t dst_argb_hash = HashDjb2(dst_argb, width * height, 5381);
|
||||
#ifdef LIBYUV_UNLIMITED_DATA
|
||||
EXPECT_EQ(dst_argb_hash, 3900633302u);
|
||||
#else
|
||||
#if defined(LIBYUV_LIMITED_DATA)
|
||||
EXPECT_EQ(dst_argb_hash, 2355976473u);
|
||||
#else
|
||||
EXPECT_EQ(dst_argb_hash, 3900633302u);
|
||||
#endif
|
||||
|
||||
free_aligned_buffer_page_end(dst_argb);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user