Index: source/row_common.cc |
diff --git a/source/row_common.cc b/source/row_common.cc |
index 13195684cabc130e0da3d8728caa8d9fecce7112..c5b1b4e2954f59b787c66e8c79644798ba384d7c 100644 |
--- a/source/row_common.cc |
+++ b/source/row_common.cc |
@@ -994,6 +994,7 @@ void J400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int width) { |
} |
} |
+ |
harryjin
2015/09/18 22:48:31
Remove the extra line?
|
// 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 |
@@ -1010,11 +1011,38 @@ void J400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int width) { |
#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, with rounding. |
-#define BB (UB * 128 + YGB) |
+// 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) |
- |
+#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 } |
+}; |
// C reference code that mimics the YUV assembly. |
static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, |
uint8* b, uint8* g, uint8* r) { |
@@ -1031,7 +1059,6 @@ static __inline void YPixel(uint8 y, uint8* b, uint8* g, uint8* r) { |
*g = Clamp((int32)(y1 + YGB) >> 6); |
*r = Clamp((int32)(y1 + YGB) >> 6); |
} |
- |
harryjin
2015/09/18 22:48:31
Why removing this empty line?
fbarchard
2015/09/18 22:51:11
Done.
|
#undef YG |
#undef YGB |
#undef UB |
@@ -1058,11 +1085,30 @@ static __inline void YPixel(uint8 y, uint8* b, uint8* g, uint8* r) { |
#define VGJ 46 /* round(0.71414 * 64) */ |
#define VRJ -90 /* round(-1.40200 * 64) */ |
-// Bias values to round Y and subtract 128 from U and V. |
-#define BBJ (UBJ * 128 + YGBJ) |
+// 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) |
- |
+#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 } |
+}; |
// C reference code that mimics the YUV assembly. |
static __inline void YuvJPixel(uint8 y, uint8 u, uint8 v, |
uint8* b, uint8* g, uint8* r) { |
@@ -1103,6 +1149,26 @@ static __inline void YuvJPixel(uint8 y, uint8 u, uint8 v, |
#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 } |
+}; |
+ |
// C reference code that mimics the YUV assembly. |
static __inline void YuvHPixel(uint8 y, uint8 u, uint8 v, |
uint8* b, uint8* g, uint8* r) { |
@@ -1122,6 +1188,13 @@ static __inline void YuvHPixel(uint8 y, uint8 u, uint8 v, |
#undef BGH |
#undef BRH |
+ |
harryjin
2015/09/18 22:48:31
Remove the extra lines here?
fbarchard
2015/09/18 22:51:11
Done.
|
+ |
+ |
+ |
+ |
+ |
+ |
#if !defined(LIBYUV_DISABLE_NEON) && \ |
(defined(__ARM_NEON__) || defined(__aarch64__) || defined(LIBYUV_NEON)) |
// C mimic assembly. |
@@ -2314,13 +2387,6 @@ void I422ToUYVYRow_C(const uint8* src_y, |
} |
} |
-extern struct YuvConstants kYuvConstants; |
-extern struct YuvConstants kYuvJConstants; |
-extern struct YuvConstants kYuvHConstants; |
-extern struct YuvConstantsNEON kYuvConstantsNEON; |
-extern struct YuvConstantsNEON kYuvJConstantsNEON; |
-extern struct YuvConstantsNEON kYuvHConstantsNEON; |
- |
#define ANYYUV(NAMEANY, ANY_SIMD, YUVCONSTANTS) \ |
void NAMEANY(const uint8* y_buf, \ |
const uint8* u_buf, \ |