Commit b7ae15a2 authored by fbarchard@google.com's avatar fbarchard@google.com

Neon optimized ARGBToY

BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/916004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@427 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent db694edf
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 426 Version: 427
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -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 426 #define LIBYUV_VERSION 427
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -37,11 +37,26 @@ int ARGBToI400(const uint8* src_argb, int src_stride_argb, ...@@ -37,11 +37,26 @@ int ARGBToI400(const uint8* src_argb, int src_stride_argb,
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) = void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
ARGBToYRow_C; ARGBToYRow_C;
#if defined(HAS_ARGBTOYROW_SSSE3) #if defined(HAS_ARGBTOYROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) && if (TestCpuFlag(kCpuHasSSSE3)) {
IS_ALIGNED(width, 4) && if (width > 16) {
IS_ALIGNED(src_argb, 16) && IS_ALIGNED(src_stride_argb, 16) && ARGBToYRow = ARGBToYRow_Any_SSSE3;
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { }
ARGBToYRow = ARGBToYRow_SSSE3; if (IS_ALIGNED(width, 16)) {
ARGBToYRow = ARGBToYRow_Unaligned_SSSE3;
if (IS_ALIGNED(src_argb, 16) && IS_ALIGNED(src_stride_argb, 16) &&
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
ARGBToYRow = ARGBToYRow_SSSE3;
}
}
}
#elif defined(HAS_ARGBTOYROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
if (width > 8) {
ARGBToYRow = ARGBToYRow_Any_NEON;
}
if (IS_ALIGNED(width, 8)) {
ARGBToYRow = ARGBToYRow_NEON;
}
} }
#endif #endif
...@@ -69,10 +84,10 @@ int ARGBToI422(const uint8* src_argb, int src_stride_argb, ...@@ -69,10 +84,10 @@ int ARGBToI422(const uint8* src_argb, int src_stride_argb,
src_argb = src_argb + (height - 1) * src_stride_argb; src_argb = src_argb + (height - 1) * src_stride_argb;
src_stride_argb = -src_stride_argb; src_stride_argb = -src_stride_argb;
} }
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
ARGBToYRow_C;
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C; uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
ARGBToYRow_C;
#if defined(HAS_ARGBTOYROW_SSSE3) #if defined(HAS_ARGBTOYROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3)) { if (TestCpuFlag(kCpuHasSSSE3)) {
if (width > 16) { if (width > 16) {
...@@ -90,6 +105,15 @@ int ARGBToI422(const uint8* src_argb, int src_stride_argb, ...@@ -90,6 +105,15 @@ int ARGBToI422(const uint8* src_argb, int src_stride_argb,
} }
} }
} }
#elif defined(HAS_ARGBTOYROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
if (width > 8) {
ARGBToYRow = ARGBToYRow_Any_NEON;
}
if (IS_ALIGNED(width, 8)) {
ARGBToYRow = ARGBToYRow_NEON;
}
}
#endif #endif
for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
......
...@@ -299,22 +299,33 @@ int BayerToI420(const uint8* src_bayer, int src_stride_bayer, ...@@ -299,22 +299,33 @@ int BayerToI420(const uint8* src_bayer, int src_stride_bayer,
uint8* dst_argb, int pix); uint8* dst_argb, int pix);
void (*BayerRow1)(const uint8* src_bayer, int src_stride_bayer, void (*BayerRow1)(const uint8* src_bayer, int src_stride_bayer,
uint8* dst_argb, int pix); uint8* dst_argb, int pix);
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
ARGBToYRow_C;
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb,
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C; uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C;
SIMD_ALIGNED(uint8 row[kMaxStride * 2]); void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
ARGBToYRow_C;
#if defined(HAS_ARGBTOYROW_SSSE3) #if defined(HAS_ARGBTOYROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) && if (TestCpuFlag(kCpuHasSSSE3)) {
IS_ALIGNED(width, 16) && if (width > 16) {
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { ARGBToUVRow = ARGBToUVRow_Any_SSSE3;
ARGBToYRow = ARGBToYRow_SSSE3; ARGBToYRow = ARGBToYRow_Any_SSSE3;
}
if (IS_ALIGNED(width, 16)) {
ARGBToUVRow = ARGBToUVRow_SSSE3;
ARGBToYRow = ARGBToYRow_Unaligned_SSSE3;
if (IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
ARGBToYRow = ARGBToYRow_SSSE3;
}
}
} }
#endif #elif defined(HAS_ARGBTOYROW_NEON)
#if defined(HAS_ARGBTOUVROW_SSSE3) if (TestCpuFlag(kCpuHasNEON)) {
if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 16)) { if (width > 8) {
ARGBToUVRow = ARGBToUVRow_SSSE3; ARGBToYRow = ARGBToYRow_Any_NEON;
}
if (IS_ALIGNED(width, 8)) {
ARGBToYRow = ARGBToYRow_NEON;
}
} }
#endif #endif
...@@ -339,6 +350,7 @@ int BayerToI420(const uint8* src_bayer, int src_stride_bayer, ...@@ -339,6 +350,7 @@ int BayerToI420(const uint8* src_bayer, int src_stride_bayer,
return -1; // Bad FourCC return -1; // Bad FourCC
} }
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
for (int y = 0; y < height - 1; y += 2) { for (int y = 0; y < height - 1; y += 2) {
BayerRow0(src_bayer, src_stride_bayer, row, width); BayerRow0(src_bayer, src_stride_bayer, row, width);
BayerRow1(src_bayer + src_stride_bayer, -src_stride_bayer, BayerRow1(src_bayer + src_stride_bayer, -src_stride_bayer,
......
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