Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: source/row_gcc.cc

Issue 1359443005: move constants into common (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: source/row_gcc.cc
diff --git a/source/row_gcc.cc b/source/row_gcc.cc
index 52046645ebc2f24234759e159b777e0787e01a70..94975032179279d0de90f587c7b533ee19202626 100644
--- a/source/row_gcc.cc
+++ b/source/row_gcc.cc
@@ -1319,167 +1319,6 @@ void RGBAToUVRow_SSSE3(const uint8* src_rgba0, int src_stride_rgba,
#if defined(HAS_I422TOARGBROW_SSSE3) || defined(HAS_I422TOARGBROW_AVX2)
-// BT.601 YUV to RGB reference
-// R = (Y - 16) * 1.164 - V * -1.596
-// G = (Y - 16) * 1.164 - U * 0.391 - V * 0.813
-// B = (Y - 16) * 1.164 - U * -2.018
-
-// Y contribution to R,G,B. Scale and bias.
-// TODO(fbarchard): Consider moving constants into a common header.
-#define YG 18997 /* round(1.164 * 64 * 256 * 256 / 257) */
-#define YGB -1160 /* 1.164 * 64 * -16 + 64 / 2 */
-
-// U and V contributions to R,G,B.
-#define UB -128 /* max(-128, round(-2.018 * 64)) */
-#define UG 25 /* round(0.391 * 64) */
-#define VG 52 /* round(0.813 * 64) */
-#define VR -102 /* round(-1.596 * 64) */
-
-// Bias values to subtract 16 from Y and 128 from U and V.
-#define BB (UB * 128 + YGB)
-#define BG (UG * 128 + VG * 128 + YGB)
-#define BR (VR * 128 + YGB)
-
-// BT601 constants for YUV to RGB.
-YuvConstants SIMD_ALIGNED(kYuvConstants) = {
- { 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,
- UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG },
- { 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR,
- 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR },
- { BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB },
- { BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG },
- { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR },
- { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG }
-};
-
-// BT601 constants for NV21 where chroma plane is VU instead of UV.
-YuvConstants SIMD_ALIGNED(kYvuConstants) = {
- { 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, UB },
- { VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG,
- VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG },
- { VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0,
- VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0 },
- { BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB, BB },
- { BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG, BG },
- { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR },
- { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG }
-};
-
-#undef YG
-#undef YGB
-#undef UB
-#undef UG
-#undef VG
-#undef VR
-#undef BB
-#undef BG
-#undef BR
-
-// JPEG YUV to RGB reference
-// * R = Y - V * -1.40200
-// * G = Y - U * 0.34414 - V * 0.71414
-// * B = Y - U * -1.77200
-
-// Y contribution to R,G,B. Scale and bias.
-// TODO(fbarchard): Consider moving constants into a common header.
-#define YGJ 16320 /* round(1.000 * 64 * 256 * 256 / 257) */
-#define YGBJ 32 /* 64 / 2 */
-
-// U and V contributions to R,G,B.
-#define UBJ -113 /* round(-1.77200 * 64) */
-#define UGJ 22 /* round(0.34414 * 64) */
-#define VGJ 46 /* round(0.71414 * 64) */
-#define VRJ -90 /* round(-1.40200 * 64) */
-
-// Bias values to subtract 16 from Y and 128 from U and V.
-#define BBJ (UBJ * 128 + YGBJ)
-#define BGJ (UGJ * 128 + VGJ * 128 + YGBJ)
-#define BRJ (VRJ * 128 + YGBJ)
-
-// JPEG constants for YUV to RGB.
-YuvConstants SIMD_ALIGNED(kYuvJConstants) = {
- { UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0,
- UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0, UBJ, 0 },
- { UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ,
- UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ,
- UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ,
- UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ },
- { 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ,
- 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ, 0, VRJ },
- { BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ,
- BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ, BBJ },
- { BGJ, BGJ, BGJ, BGJ, BGJ, BGJ, BGJ, BGJ,
- BGJ, BGJ, BGJ, BGJ, BGJ, BGJ, BGJ, BGJ },
- { BRJ, BRJ, BRJ, BRJ, BRJ, BRJ, BRJ, BRJ,
- BRJ, BRJ, BRJ, BRJ, BRJ, BRJ, BRJ, BRJ },
- { YGJ, YGJ, YGJ, YGJ, YGJ, YGJ, YGJ, YGJ,
- YGJ, YGJ, YGJ, YGJ, YGJ, YGJ, YGJ, YGJ }
-};
-
-#undef YGJ
-#undef YGBJ
-#undef UBJ
-#undef UGJ
-#undef VGJ
-#undef VRJ
-#undef BBJ
-#undef BGJ
-#undef BRJ
-
-// BT.709 YUV to RGB reference
-// * R = Y - V * -1.28033
-// * G = Y - U * 0.21482 - V * 0.38059
-// * B = Y - U * -2.12798
-
-// Y contribution to R,G,B. Scale and bias.
-// TODO(fbarchard): Consider moving constants into a common header.
-#define YGH 16320 /* round(1.000 * 64 * 256 * 256 / 257) */
-#define YGBH 32 /* 64 / 2 */
-
-// U and V contributions to R,G,B.
-#define UBH -128 /* max(-128, round(-2.12798 * 64)) */
-#define UGH 14 /* round(0.21482 * 64) */
-#define VGH 24 /* round(0.38059 * 64) */
-#define VRH -82 /* round(-1.28033 * 64) */
-
-// Bias values to round, and subtract 128 from U and V.
-#define BBH (UBH * 128 + YGBH)
-#define BGH (UGH * 128 + VGH * 128 + YGBH)
-#define BRH (VRH * 128 + YGBH)
-
-// BT.709 constants for YUV to RGB.
-YuvConstants SIMD_ALIGNED(kYuvHConstants) = {
- { UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0,
- UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0, UBH, 0 },
- { UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH,
- UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH,
- UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH,
- UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH },
- { 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH,
- 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH, 0, VRH },
- { BBH, BBH, BBH, BBH, BBH, BBH, BBH, BBH,
- BBH, BBH, BBH, BBH, BBH, BBH, BBH, BBH },
- { BGH, BGH, BGH, BGH, BGH, BGH, BGH, BGH,
- BGH, BGH, BGH, BGH, BGH, BGH, BGH, BGH },
- { BRH, BRH, BRH, BRH, BRH, BRH, BRH, BRH,
- BRH, BRH, BRH, BRH, BRH, BRH, BRH, BRH },
- { YGH, YGH, YGH, YGH, YGH, YGH, YGH, YGH,
- YGH, YGH, YGH, YGH, YGH, YGH, YGH, YGH }
-};
-
-#undef YGH
-#undef YGBH
-#undef UBH
-#undef UGH
-#undef VGH
-#undef VRH
-#undef BBH
-#undef BGH
-#undef BRH
-
// Read 8 UV from 411
#define READYUV444 \
"movq " MEMACCESS([u_buf]) ",%%xmm0 \n" \
« source/row_common.cc ('K') | « source/row_common.cc ('k') | source/row_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698