Commit 4abd0965 authored by Frank Barchard's avatar Frank Barchard

fix for yuv to rgb on arm64.

fill in aarch64 yuv constants to match how the code expects them.

TBR=harryjin@google.com
BUG=libyuv:502

Review URL: https://codereview.chromium.org/1396253004 .
parent 2e4466e2
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 1506 Version: 1507
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -417,18 +417,25 @@ typedef uint32 ulvec32[8]; ...@@ -417,18 +417,25 @@ typedef uint32 ulvec32[8];
typedef uint8 ulvec8[32]; typedef uint8 ulvec8[32];
#endif #endif
#if defined(__arm__) || defined(__aarch64__) #if defined(__aarch64__)
// This struct is for Arm64 color conversion.
// This struct is for Arm color conversion. struct YuvConstants {
uvec16 kUVToRB;
uvec16 kUVToRB2;
uvec16 kUVToG;
uvec16 kUVToG2;
vec16 kUVBiasBGR;
vec32 kYToRgb;
};
#elif defined(__arm__)
// This struct is for ArmV7 color conversion.
struct YuvConstants { struct YuvConstants {
uvec8 kUVToRB; uvec8 kUVToRB;
uvec8 kUVToG; uvec8 kUVToG;
vec16 kUVBiasBGR; vec16 kUVBiasBGR;
vec32 kYToRgb; vec32 kYToRgb;
}; };
#else #else
// This struct is for Intel color conversion. // This struct is for Intel color conversion.
struct YuvConstants { struct YuvConstants {
lvec8 kUVToB; lvec8 kUVToB;
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1506 #define LIBYUV_VERSION 1507
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -1017,13 +1017,17 @@ void J400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int width) { ...@@ -1017,13 +1017,17 @@ void J400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int width) {
// BT.601 constants for YUV to RGB. // BT.601 constants for YUV to RGB.
// TODO(fbarchard): Unify these structures to be platform independent. // TODO(fbarchard): Unify these structures to be platform independent.
// TODO(fbarchard): Generate SIMD structures from float matrix. // TODO(fbarchard): Generate SIMD structures from float matrix.
// BT601 constants for YUV to RGB.
#if defined(__aarch64__) #if defined(__aarch64__)
const YuvConstants SIMD_ALIGNED(kYuvIConstants) = { const YuvConstants SIMD_ALIGNED(kYuvIConstants) = {
{ -UB, 0, -UB, 0, -UB, 0, -UB, 0, -VR, 0, -VR, 0, -VR, 0, -VR, 0 }, { -UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR },
{ UG, 0, UG, 0, UG, 0, UG, 0, VG, 0, VG, 0, VG, 0, VG, 0 }, { -UB, -VR, -UB, -VR, -UB, -VR, -UB, -VR },
{ UG, VG, UG, VG, UG, VG, UG, VG },
{ UG, VG, UG, VG, UG, VG, UG, VG },
{ BB, BG, BR, 0, 0, 0, 0, 0 }, { BB, BG, BR, 0, 0, 0, 0, 0 },
{ 0x0101 * YG, 0, 0, 0 } { 0x0101 * YG, 0, 0, 0 }
}; };
#elif defined(__arm__) #elif defined(__arm__)
const YuvConstants SIMD_ALIGNED(kYuvIConstants) = { const YuvConstants SIMD_ALIGNED(kYuvIConstants) = {
...@@ -1072,8 +1076,8 @@ static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, ...@@ -1072,8 +1076,8 @@ static __inline void YuvPixel(uint8 y, uint8 u, uint8 v,
#if defined(__aarch64__) #if defined(__aarch64__)
int UB = -yuvconstants->kUVToRB[0]; int UB = -yuvconstants->kUVToRB[0];
int UG = yuvconstants->kUVToG[0]; int UG = yuvconstants->kUVToG[0];
int VG = yuvconstants->kUVToG[8]; int VG = yuvconstants->kUVToG[1];
int VR = -yuvconstants->kUVToRB[8]; int VR = -yuvconstants->kUVToRB[1];
int BB = yuvconstants->kUVBiasBGR[0]; int BB = yuvconstants->kUVBiasBGR[0];
int BG = yuvconstants->kUVBiasBGR[1]; int BG = yuvconstants->kUVBiasBGR[1];
int BR = yuvconstants->kUVBiasBGR[2]; int BR = yuvconstants->kUVBiasBGR[2];
...@@ -1126,11 +1130,13 @@ static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, ...@@ -1126,11 +1130,13 @@ static __inline void YuvPixel(uint8 y, uint8 u, uint8 v,
// JPEG constants for YUV to RGB. // JPEG constants for YUV to RGB.
#if defined(__aarch64__) #if defined(__aarch64__)
const YuvConstants SIMD_ALIGNED(kYuvJConstants) = { const YuvConstants SIMD_ALIGNED(kYuvJConstants) = {
{ -UBJ, 0, -UBJ, 0, -UBJ, 0, -UBJ, 0, -VRJ, 0, -VRJ, 0, -VRJ, 0, -VRJ, 0 }, { -UBJ, -VRJ, -UBJ, -VRJ, -UBJ, -VRJ, -UBJ, -VRJ },
{ UGJ, 0, UGJ, 0, UGJ, 0, UGJ, 0, VGJ, 0, VGJ, 0, VGJ, 0, VGJ, 0 }, { -UBJ, -VRJ, -UBJ, -VRJ, -UBJ, -VRJ, -UBJ, -VRJ },
{ UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ },
{ UGJ, VGJ, UGJ, VGJ, UGJ, VGJ, UGJ, VGJ },
{ BBJ, BGJ, BRJ, 0, 0, 0, 0, 0 }, { BBJ, BGJ, BRJ, 0, 0, 0, 0, 0 },
{ 0x0101 * YGJ, 0, 0, 0 } { 0x0101 * YGJ, 0, 0, 0 }
}; };
#elif defined(__arm__) #elif defined(__arm__)
const YuvConstants SIMD_ALIGNED(kYuvJConstants) = { const YuvConstants SIMD_ALIGNED(kYuvJConstants) = {
...@@ -1194,11 +1200,13 @@ const YuvConstants SIMD_ALIGNED(kYuvJConstants) = { ...@@ -1194,11 +1200,13 @@ const YuvConstants SIMD_ALIGNED(kYuvJConstants) = {
// BT.709 constants for YUV to RGB. // BT.709 constants for YUV to RGB.
#if defined(__aarch64__) #if defined(__aarch64__)
const YuvConstants SIMD_ALIGNED(kYuvHConstants) = { const YuvConstants SIMD_ALIGNED(kYuvHConstants) = {
{ -UBH, 0, -UBH, 0, -UBH, 0, -UBH, 0, -VRH, 0, -VRH, 0, -VRH, 0, -VRH, 0 }, { -UBH, -VRH, -UBH, -VRH, -UBH, -VRH, -UBH, -VRH },
{ UGH, 0, UGH, 0, UGH, 0, UGH, 0, VGH, 0, VGH, 0, VGH, 0, VGH, 0 }, { -UBH, -VRH, -UBH, -VRH, -UBH, -VRH, -UBH, -VRH },
{ UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH },
{ UGH, VGH, UGH, VGH, UGH, VGH, UGH, VGH },
{ BBH, BGH, BRH, 0, 0, 0, 0, 0 }, { BBH, BGH, BRH, 0, 0, 0, 0, 0 },
{ 0x0101 * YGH, 0, 0, 0 } { 0x0101 * YGH, 0, 0, 0 }
}; };
#elif defined(__arm__) #elif defined(__arm__)
const YuvConstants SIMD_ALIGNED(kYuvHConstants) = { const YuvConstants SIMD_ALIGNED(kYuvHConstants) = {
......
...@@ -96,8 +96,8 @@ extern "C" { ...@@ -96,8 +96,8 @@ extern "C" {
"ld1r {v25.8h}, [%[kUVBiasBGR]], #2 \n" \ "ld1r {v25.8h}, [%[kUVBiasBGR]], #2 \n" \
"ld1r {v26.8h}, [%[kUVBiasBGR]] \n" \ "ld1r {v26.8h}, [%[kUVBiasBGR]] \n" \
"ld1r {v31.4s}, [%[kYToRgb]] \n" \ "ld1r {v31.4s}, [%[kYToRgb]] \n" \
"ld1 {v27.8h, v28.8h}, [%[kUVToRB]] \n" \ "ld2 {v27.8h, v28.8h}, [%[kUVToRB]] \n" \
"ld1 {v29.8h, v30.8h}, [%[kUVToG]] \n" "ld2 {v29.8h, v30.8h}, [%[kUVToG]] \n"
#define YUVTORGB(vR, vG, vB) \ #define YUVTORGB(vR, vG, vB) \
"uxtl v0.8h, v0.8b \n" /* Extract Y */ \ "uxtl v0.8h, v0.8b \n" /* Extract Y */ \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment