diff options
author | Yuan Tong <tongyuan200097@gmail.com> | 2021-04-28 13:50:18 +0800 |
---|---|---|
committer | Frank Barchard <fbarchard@chromium.org> | 2021-04-29 15:57:20 +0000 |
commit | 99cddd80513167b307d5d9b18c5a347fa8592c33 (patch) | |
tree | 607ab32711a14cb193f5e11d0abc80f4d0a884ef /source/row_common.cc | |
parent | eb6e7bb63738e29efd82ea3cf2a115238a89fa51 (diff) | |
download | libyuv-99cddd80513167b307d5d9b18c5a347fa8592c33.tar.gz |
Fix ARM YuvConstants value
R=fbarchard@chromium.org
Bug: libyuv:901
Change-Id: Ie2f9ac214a2a7462cc613f510b64308d3b861b74
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2856225
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/row_common.cc')
-rw-r--r-- | source/row_common.cc | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/source/row_common.cc b/source/row_common.cc index 4d0dce2d..1abd8c00 100644 --- a/source/row_common.cc +++ b/source/row_common.cc @@ -1422,17 +1422,14 @@ void J400ToARGBRow_C(const uint8_t* src_y, uint8_t* dst_argb, int width) { // clang-format off #if defined(__aarch64__) || defined(__arm__) -// Bias values to round, and subtract 128 from U and V. -// For B and R this is negative. For G this is positive. -#define BB (UB * 128 - YB) -#define BG (UG * 128 + VG * 128 + YB) -#define BR (VR * 128 - YB) - -#define YUBCONSTANTSBODY(YG, YB, UB, UG, VG, VR) \ - {{UB, VR, UG, VG, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \ - {YG, BB, BG, BR, YB, 0, 0, 0}} +// Bias values include subtract 128 from U and V, bias from Y and rounding. +// For B and R bias is negative. For G bias is positive. +#define YUVCONSTANTSBODY(YG, YB, UB, UG, VG, VR) \ + {{UB, VR, UG, VG, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \ + {YG, (UB * 128 - YB), (UG * 128 + VG * 128 + YB), (VR * 128 - YB), YB, 0, \ + 0, 0}} #else -#define YUBCONSTANTSBODY(YG, YB, UB, UG, VG, VR) \ +#define YUVCONSTANTSBODY(YG, YB, UB, UG, VG, VR) \ {{UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, \ UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0}, \ {UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, \ @@ -1447,9 +1444,9 @@ void J400ToARGBRow_C(const uint8_t* src_y, uint8_t* dst_argb, int width) { #define MAKEYUVCONSTANTS(name, YG, YB, UB, UG, VG, VR) \ const struct YuvConstants SIMD_ALIGNED(kYuv##name##Constants) = \ - YUBCONSTANTSBODY(YG, YB, UB, UG, VG, VR); \ + YUVCONSTANTSBODY(YG, YB, UB, UG, VG, VR); \ const struct YuvConstants SIMD_ALIGNED(kYvu##name##Constants) = \ - YUBCONSTANTSBODY(YG, YB, VR, VG, UG, UB); + YUVCONSTANTSBODY(YG, YB, VR, VG, UG, UB); // TODO(fbarchard): Generate SIMD structures from float matrix. |