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

Unified Diff: source/row_common.cc

Issue 1402333002: fix for C version of YUV to RGB for Arm (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: the YuvPixel bug was YG Created 5 years, 2 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
« no previous file with comments | « include/libyuv/version.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/row_common.cc
diff --git a/source/row_common.cc b/source/row_common.cc
index 8c1a8027e29867b8cc5fc7cda10062dcc0d8ec3e..25d16aca0f1ac9199fb40da037941cf7d076dea1 100644
--- a/source/row_common.cc
+++ b/source/row_common.cc
@@ -1052,6 +1052,45 @@ const YuvConstants SIMD_ALIGNED(kYuvIConstants) = {
#endif
// C reference code that mimics the YUV assembly.
+static __inline void YuvPixel(uint8 y, uint8 u, uint8 v,
+ uint8* b, uint8* g, uint8* r,
+ const struct YuvConstants* yuvconstants) {
+#if defined(__aarch64__)
+ int ub = -yuvconstants->kUVToRB[0];
+ int ug = yuvconstants->kUVToG[0];
+ int vg = yuvconstants->kUVToG[1];
+ int vr = -yuvconstants->kUVToRB[1];
+ int bb = yuvconstants->kUVBiasBGR[0];
+ int bg = yuvconstants->kUVBiasBGR[1];
+ int br = yuvconstants->kUVBiasBGR[2];
+ int yg = yuvconstants->kYToRgb[0] / 0x0101;
+#elif defined(__arm__)
+ int ub = -yuvconstants->kUVToRB[0];
+ int ug = yuvconstants->kUVToG[0];
+ int vg = yuvconstants->kUVToG[4];
+ int vr = -yuvconstants->kUVToRB[4];
+ int bb = yuvconstants->kUVBiasBGR[0];
+ int bg = yuvconstants->kUVBiasBGR[1];
+ int br = yuvconstants->kUVBiasBGR[2];
+ int yg = yuvconstants->kYToRgb[0] / 0x0101;
+#else
+ int ub = yuvconstants->kUVToB[0];
+ int ug = yuvconstants->kUVToG[0];
+ int vg = yuvconstants->kUVToG[1];
+ int vr = yuvconstants->kUVToR[1];
+ int bb = yuvconstants->kUVBiasB[0];
+ int bg = yuvconstants->kUVBiasG[0];
+ int br = yuvconstants->kUVBiasR[0];
+ int yg = yuvconstants->kYToRgb[0];
+#endif
+
+ uint32 y1 = (uint32)(y * 0x0101 * yg) >> 16;
+ *b = Clamp((int32)(-(u * ub ) + y1 + bb) >> 6);
+ *g = Clamp((int32)(-(u * ug + v * vg) + y1 + bg) >> 6);
+ *r = Clamp((int32)(-( v * vr) + y1 + br) >> 6);
+}
+
+// C reference code that mimics the YUV assembly.
static __inline void YPixel(uint8 y, uint8* b, uint8* g, uint8* r) {
uint32 y1 = (uint32)(y * 0x0101 * YG) >> 16;
*b = Clamp((int32)(y1 + YGB) >> 6);
@@ -1069,44 +1108,6 @@ static __inline void YPixel(uint8 y, uint8* b, uint8* g, uint8* r) {
#undef VR
#undef 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,
- const struct YuvConstants* yuvconstants) {
-#if defined(__aarch64__)
- int UB = -yuvconstants->kUVToRB[0];
- int UG = yuvconstants->kUVToG[0];
- int VG = yuvconstants->kUVToG[1];
- int VR = -yuvconstants->kUVToRB[1];
- int BB = yuvconstants->kUVBiasBGR[0];
- int BG = yuvconstants->kUVBiasBGR[1];
- int BR = yuvconstants->kUVBiasBGR[2];
- int YG = yuvconstants->kYToRgb[0];
-#elif defined(__arm__)
- int UB = -yuvconstants->kUVToRB[0];
- int UG = yuvconstants->kUVToG[0];
- int VG = yuvconstants->kUVToG[4];
- int VR = -yuvconstants->kUVToRB[4];
- int BB = yuvconstants->kUVBiasBGR[0];
- int BG = yuvconstants->kUVBiasBGR[1];
- int BR = yuvconstants->kUVBiasBGR[2];
- int YG = yuvconstants->kYToRgb[0];
-#else
- int UB = yuvconstants->kUVToB[0];
- int UG = yuvconstants->kUVToG[0];
- int VG = yuvconstants->kUVToG[1];
- int VR = yuvconstants->kUVToR[1];
- int BB = yuvconstants->kUVBiasB[0];
- int BG = yuvconstants->kUVBiasG[0];
- int BR = yuvconstants->kUVBiasR[0];
- int YG = yuvconstants->kYToRgb[0];
-#endif
- uint32 y1 = (uint32)(y * 0x0101 * YG) >> 16;
- *b = Clamp((int32)(-(u * UB ) + y1 + BB) >> 6);
- *g = Clamp((int32)(-(u * UG + v * VG) + y1 + BG) >> 6);
- *r = Clamp((int32)(-( v * VR) + y1 + BR) >> 6);
-}
-
// JPEG YUV to RGB reference
// * R = Y - V * -1.40200
// * G = Y - U * 0.34414 - V * 0.71414
« no previous file with comments | « include/libyuv/version.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698