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

YUY2 and UYVY Unaligned and any versions

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@168 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 79a06ac5
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 167 Version: 168
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -11,16 +11,7 @@ ...@@ -11,16 +11,7 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ #ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#ifdef __cplusplus #define LIBYUV_VERSION 168
namespace libyuv {
extern "C" {
#endif
#define LIBYUV_VERSION 167
#ifdef __cplusplus
} // extern "C"
} // namespace libyuv
#endif
#endif // INCLUDE_LIBYUV_VERSION_H_ #endif // INCLUDE_LIBYUV_VERSION_H_
...@@ -366,7 +366,7 @@ int ARGBToI420(const uint8* src_frame, int src_stride_frame, ...@@ -366,7 +366,7 @@ int ARGBToI420(const uint8* src_frame, int src_stride_frame,
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
ARGBToYRow = ARGBToYRow_SSSE3; ARGBToYRow = ARGBToYRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) { } else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) {
ARGBToYRow = ARGBToYAnyRow_SSSE3; ARGBToYRow = ARGBToYRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 16)) {
ARGBToYRow = ARGBToYRow_Unaligned_SSSE3; ARGBToYRow = ARGBToYRow_Unaligned_SSSE3;
} }
...@@ -382,7 +382,7 @@ int ARGBToI420(const uint8* src_frame, int src_stride_frame, ...@@ -382,7 +382,7 @@ int ARGBToI420(const uint8* src_frame, int src_stride_frame,
ARGBToUVRow = ARGBToUVRow_SSSE3; ARGBToUVRow = ARGBToUVRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && } else if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 2) && width <= kMaxStride) { IS_ALIGNED(width, 2) && width <= kMaxStride) {
ARGBToUVRow = ARGBToUVAnyRow_SSSE3; ARGBToUVRow = ARGBToUVRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 16)) {
ARGBToUVRow = ARGBToUVRow_Unaligned_SSSE3; ARGBToUVRow = ARGBToUVRow_Unaligned_SSSE3;
} }
...@@ -428,7 +428,7 @@ int BGRAToI420(const uint8* src_frame, int src_stride_frame, ...@@ -428,7 +428,7 @@ int BGRAToI420(const uint8* src_frame, int src_stride_frame,
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
ARGBToYRow = BGRAToYRow_SSSE3; ARGBToYRow = BGRAToYRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) { } else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) {
ARGBToYRow = BGRAToYAnyRow_SSSE3; ARGBToYRow = BGRAToYRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 16)) {
ARGBToYRow = BGRAToYRow_Unaligned_SSSE3; ARGBToYRow = BGRAToYRow_Unaligned_SSSE3;
} }
...@@ -444,7 +444,7 @@ int BGRAToI420(const uint8* src_frame, int src_stride_frame, ...@@ -444,7 +444,7 @@ int BGRAToI420(const uint8* src_frame, int src_stride_frame,
ARGBToUVRow = BGRAToUVRow_SSSE3; ARGBToUVRow = BGRAToUVRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && } else if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 2) && width <= kMaxStride) { IS_ALIGNED(width, 2) && width <= kMaxStride) {
ARGBToUVRow = BGRAToUVAnyRow_SSSE3; ARGBToUVRow = BGRAToUVRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 16)) {
ARGBToUVRow = BGRAToUVRow_Unaligned_SSSE3; ARGBToUVRow = BGRAToUVRow_Unaligned_SSSE3;
} }
...@@ -490,7 +490,7 @@ int ABGRToI420(const uint8* src_frame, int src_stride_frame, ...@@ -490,7 +490,7 @@ int ABGRToI420(const uint8* src_frame, int src_stride_frame,
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
ARGBToYRow = ABGRToYRow_SSSE3; ARGBToYRow = ABGRToYRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) { } else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) {
ARGBToYRow = ABGRToYAnyRow_SSSE3; ARGBToYRow = ABGRToYRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 16)) {
ARGBToYRow = ABGRToYRow_Unaligned_SSSE3; ARGBToYRow = ABGRToYRow_Unaligned_SSSE3;
} }
...@@ -506,7 +506,7 @@ int ABGRToI420(const uint8* src_frame, int src_stride_frame, ...@@ -506,7 +506,7 @@ int ABGRToI420(const uint8* src_frame, int src_stride_frame,
ARGBToUVRow = ABGRToUVRow_SSSE3; ARGBToUVRow = ABGRToUVRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && } else if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 2) && width <= kMaxStride) { IS_ALIGNED(width, 2) && width <= kMaxStride) {
ARGBToUVRow = ABGRToUVAnyRow_SSSE3; ARGBToUVRow = ABGRToUVRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 16)) {
ARGBToUVRow = ABGRToUVRow_Unaligned_SSSE3; ARGBToUVRow = ABGRToUVRow_Unaligned_SSSE3;
} }
...@@ -561,7 +561,7 @@ int RGB24ToI420(const uint8* src_frame, int src_stride_frame, ...@@ -561,7 +561,7 @@ int RGB24ToI420(const uint8* src_frame, int src_stride_frame,
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
ARGBToYRow = ARGBToYRow_SSSE3; ARGBToYRow = ARGBToYRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) { } else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) {
ARGBToYRow = ARGBToYAnyRow_SSSE3; ARGBToYRow = ARGBToYRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 16)) {
ARGBToYRow = ARGBToYRow_Unaligned_SSSE3; ARGBToYRow = ARGBToYRow_Unaligned_SSSE3;
} }
...@@ -575,7 +575,7 @@ int RGB24ToI420(const uint8* src_frame, int src_stride_frame, ...@@ -575,7 +575,7 @@ int RGB24ToI420(const uint8* src_frame, int src_stride_frame,
ARGBToUVRow = ARGBToUVRow_SSSE3; ARGBToUVRow = ARGBToUVRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && } else if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 2) && width <= kMaxStride) { IS_ALIGNED(width, 2) && width <= kMaxStride) {
ARGBToUVRow = ARGBToUVAnyRow_SSSE3; ARGBToUVRow = ARGBToUVRow_Any_SSSE3;
} else } else
#endif #endif
{ {
...@@ -630,7 +630,7 @@ int RAWToI420(const uint8* src_frame, int src_stride_frame, ...@@ -630,7 +630,7 @@ int RAWToI420(const uint8* src_frame, int src_stride_frame,
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
ARGBToYRow = ARGBToYRow_SSSE3; ARGBToYRow = ARGBToYRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) { } else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) {
ARGBToYRow = ARGBToYAnyRow_SSSE3; ARGBToYRow = ARGBToYRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 16)) {
ARGBToYRow = ARGBToYRow_Unaligned_SSSE3; ARGBToYRow = ARGBToYRow_Unaligned_SSSE3;
} }
...@@ -644,7 +644,7 @@ int RAWToI420(const uint8* src_frame, int src_stride_frame, ...@@ -644,7 +644,7 @@ int RAWToI420(const uint8* src_frame, int src_stride_frame,
ARGBToUVRow = ARGBToUVRow_SSSE3; ARGBToUVRow = ARGBToUVRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && } else if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 2) && width <= kMaxStride) { IS_ALIGNED(width, 2) && width <= kMaxStride) {
ARGBToUVRow = ARGBToUVAnyRow_SSSE3; ARGBToUVRow = ARGBToUVRow_Any_SSSE3;
} else } else
#endif #endif
{ {
...@@ -699,7 +699,7 @@ int RGB565ToI420(const uint8* src_frame, int src_stride_frame, ...@@ -699,7 +699,7 @@ int RGB565ToI420(const uint8* src_frame, int src_stride_frame,
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
ARGBToYRow = ARGBToYRow_SSSE3; ARGBToYRow = ARGBToYRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) { } else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) {
ARGBToYRow = ARGBToYAnyRow_SSSE3; ARGBToYRow = ARGBToYRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 16)) {
ARGBToYRow = ARGBToYRow_Unaligned_SSSE3; ARGBToYRow = ARGBToYRow_Unaligned_SSSE3;
} }
...@@ -713,7 +713,7 @@ int RGB565ToI420(const uint8* src_frame, int src_stride_frame, ...@@ -713,7 +713,7 @@ int RGB565ToI420(const uint8* src_frame, int src_stride_frame,
ARGBToUVRow = ARGBToUVRow_SSSE3; ARGBToUVRow = ARGBToUVRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && } else if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 2) && width <= kMaxStride) { IS_ALIGNED(width, 2) && width <= kMaxStride) {
ARGBToUVRow = ARGBToUVAnyRow_SSSE3; ARGBToUVRow = ARGBToUVRow_Any_SSSE3;
} else } else
#endif #endif
{ {
...@@ -768,7 +768,7 @@ int ARGB1555ToI420(const uint8* src_frame, int src_stride_frame, ...@@ -768,7 +768,7 @@ int ARGB1555ToI420(const uint8* src_frame, int src_stride_frame,
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
ARGBToYRow = ARGBToYRow_SSSE3; ARGBToYRow = ARGBToYRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) { } else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) {
ARGBToYRow = ARGBToYAnyRow_SSSE3; ARGBToYRow = ARGBToYRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 16)) {
ARGBToYRow = ARGBToYRow_Unaligned_SSSE3; ARGBToYRow = ARGBToYRow_Unaligned_SSSE3;
} }
...@@ -782,7 +782,7 @@ int ARGB1555ToI420(const uint8* src_frame, int src_stride_frame, ...@@ -782,7 +782,7 @@ int ARGB1555ToI420(const uint8* src_frame, int src_stride_frame,
ARGBToUVRow = ARGBToUVRow_SSSE3; ARGBToUVRow = ARGBToUVRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && } else if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 2) && width <= kMaxStride) { IS_ALIGNED(width, 2) && width <= kMaxStride) {
ARGBToUVRow = ARGBToUVAnyRow_SSSE3; ARGBToUVRow = ARGBToUVRow_Any_SSSE3;
} else } else
#endif #endif
{ {
...@@ -837,7 +837,7 @@ int ARGB4444ToI420(const uint8* src_frame, int src_stride_frame, ...@@ -837,7 +837,7 @@ int ARGB4444ToI420(const uint8* src_frame, int src_stride_frame,
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
ARGBToYRow = ARGBToYRow_SSSE3; ARGBToYRow = ARGBToYRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) { } else if (TestCpuFlag(kCpuHasSSSE3) && width <= kMaxStride) {
ARGBToYRow = ARGBToYAnyRow_SSSE3; ARGBToYRow = ARGBToYRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 16)) {
ARGBToYRow = ARGBToYRow_Unaligned_SSSE3; ARGBToYRow = ARGBToYRow_Unaligned_SSSE3;
} }
...@@ -851,7 +851,7 @@ int ARGB4444ToI420(const uint8* src_frame, int src_stride_frame, ...@@ -851,7 +851,7 @@ int ARGB4444ToI420(const uint8* src_frame, int src_stride_frame,
ARGBToUVRow = ARGBToUVRow_SSSE3; ARGBToUVRow = ARGBToUVRow_SSSE3;
} else if (TestCpuFlag(kCpuHasSSSE3) && } else if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 2) && width <= kMaxStride) { IS_ALIGNED(width, 2) && width <= kMaxStride) {
ARGBToUVRow = ARGBToUVAnyRow_SSSE3; ARGBToUVRow = ARGBToUVRow_Any_SSSE3;
} else } else
#endif #endif
{ {
......
...@@ -452,22 +452,22 @@ int I420ToBayer(const uint8* src_y, int src_stride_y, ...@@ -452,22 +452,22 @@ int I420ToBayer(const uint8* src_y, int src_stride_y,
src_stride_u = -src_stride_u; src_stride_u = -src_stride_u;
src_stride_v = -src_stride_v; src_stride_v = -src_stride_v;
} }
void (*FastConvertYUVToARGBRow)(const uint8* y_buf, void (*I420ToARGBRow)(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
uint8* rgb_buf, uint8* rgb_buf,
int width); int width);
#if defined(HAS_FASTCONVERTYUVTOARGBROW_NEON) #if defined(HAS_I420TOARGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
FastConvertYUVToARGBRow = FastConvertYUVToARGBRow_NEON; I420ToARGBRow = I420ToARGBRow_NEON;
} else } else
#elif defined(HAS_FASTCONVERTYUVTOARGBROW_SSSE3) #elif defined(HAS_I420TOARGBROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3)) { if (TestCpuFlag(kCpuHasSSSE3)) {
FastConvertYUVToARGBRow = FastConvertYUVToARGBRow_SSSE3; I420ToARGBRow = I420ToARGBRow_SSSE3;
} else } else
#endif #endif
{ {
FastConvertYUVToARGBRow = FastConvertYUVToARGBRow_C; I420ToARGBRow = I420ToARGBRow_C;
} }
SIMD_ALIGNED(uint8 row[kMaxStride]); SIMD_ALIGNED(uint8 row[kMaxStride]);
void (*ARGBToBayerRow)(const uint8* src_argb, void (*ARGBToBayerRow)(const uint8* src_argb,
...@@ -490,7 +490,7 @@ int I420ToBayer(const uint8* src_y, int src_stride_y, ...@@ -490,7 +490,7 @@ int I420ToBayer(const uint8* src_y, int src_stride_y,
} }
for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
FastConvertYUVToARGBRow(src_y, src_u, src_v, row, width); I420ToARGBRow(src_y, src_u, src_v, row, width);
ARGBToBayerRow(row, dst_bayer, index_map[y & 1], width); ARGBToBayerRow(row, dst_bayer, index_map[y & 1], width);
dst_bayer += dst_stride_bayer; dst_bayer += dst_stride_bayer;
src_y += src_stride_y; src_y += src_stride_y;
......
This diff is collapsed.
This diff is collapsed.
...@@ -271,7 +271,7 @@ static __inline uint32 Clip(int32 val) { ...@@ -271,7 +271,7 @@ static __inline uint32 Clip(int32 val) {
} }
static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, uint8* rgb_buf, static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, uint8* rgb_buf,
int ashift, int rshift, int gshift, int bshift) { int ashift, int rshift, int gshift, int bshift) {
int32 y1 = (static_cast<int32>(y) - 16) * YG; int32 y1 = (static_cast<int32>(y) - 16) * YG;
uint32 b = Clip(static_cast<int32>((u * UB + v * VB) - (BB) + y1) >> 6); uint32 b = Clip(static_cast<int32>((u * UB + v * VB) - (BB) + y1) >> 6);
uint32 g = Clip(static_cast<int32>((u * UG + v * VG) - (BG) + y1) >> 6); uint32 g = Clip(static_cast<int32>((u * UG + v * VG) - (BG) + y1) >> 6);
...@@ -282,11 +282,11 @@ static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, uint8* rgb_buf, ...@@ -282,11 +282,11 @@ static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, uint8* rgb_buf,
(255u << ashift); (255u << ashift);
} }
void FastConvertYUVToARGBRow_C(const uint8* y_buf, void I420ToARGBRow_C(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
uint8* rgb_buf, uint8* rgb_buf,
int width) { int width) {
for (int x = 0; x < width - 1; x += 2) { for (int x = 0; x < width - 1; x += 2) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 24, 16, 8, 0); YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 24, 16, 8, 0);
YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 24, 16, 8, 0); YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 24, 16, 8, 0);
...@@ -300,11 +300,11 @@ void FastConvertYUVToARGBRow_C(const uint8* y_buf, ...@@ -300,11 +300,11 @@ void FastConvertYUVToARGBRow_C(const uint8* y_buf,
} }
} }
void FastConvertYUVToBGRARow_C(const uint8* y_buf, void I420ToBGRARow_C(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
uint8* rgb_buf, uint8* rgb_buf,
int width) { int width) {
for (int x = 0; x < width - 1; x += 2) { for (int x = 0; x < width - 1; x += 2) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 0, 8, 16, 24); YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 0, 8, 16, 24);
YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 0, 8, 16, 24); YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 0, 8, 16, 24);
...@@ -318,11 +318,11 @@ void FastConvertYUVToBGRARow_C(const uint8* y_buf, ...@@ -318,11 +318,11 @@ void FastConvertYUVToBGRARow_C(const uint8* y_buf,
} }
} }
void FastConvertYUVToABGRRow_C(const uint8* y_buf, void I420ToABGRRow_C(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
uint8* rgb_buf, uint8* rgb_buf,
int width) { int width) {
for (int x = 0; x < width - 1; x += 2) { for (int x = 0; x < width - 1; x += 2) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 24, 0, 8, 16); YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 24, 0, 8, 16);
YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 24, 0, 8, 16); YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 24, 0, 8, 16);
...@@ -336,11 +336,11 @@ void FastConvertYUVToABGRRow_C(const uint8* y_buf, ...@@ -336,11 +336,11 @@ void FastConvertYUVToABGRRow_C(const uint8* y_buf,
} }
} }
void FastConvertYUV444ToARGBRow_C(const uint8* y_buf, void I444ToARGBRow_C(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
uint8* rgb_buf, uint8* rgb_buf,
int width) { int width) {
for (int x = 0; x < width; ++x) { for (int x = 0; x < width; ++x) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf, 24, 16, 8, 0); YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf, 24, 16, 8, 0);
y_buf += 1; y_buf += 1;
...@@ -350,9 +350,9 @@ void FastConvertYUV444ToARGBRow_C(const uint8* y_buf, ...@@ -350,9 +350,9 @@ void FastConvertYUV444ToARGBRow_C(const uint8* y_buf,
} }
} }
void FastConvertYToARGBRow_C(const uint8* y_buf, void YToARGBRow_C(const uint8* y_buf,
uint8* rgb_buf, uint8* rgb_buf,
int width) { int width) {
for (int x = 0; x < width; ++x) { for (int x = 0; x < width; ++x) {
YuvPixel(y_buf[0], 128, 128, rgb_buf, 24, 16, 8, 0); YuvPixel(y_buf[0], 128, 128, rgb_buf, 24, 16, 8, 0);
y_buf += 1; y_buf += 1;
...@@ -368,6 +368,51 @@ void MirrorRow_C(const uint8* src, uint8* dst, int width) { ...@@ -368,6 +368,51 @@ void MirrorRow_C(const uint8* src, uint8* dst, int width) {
} }
} }
// Filter 2 rows of YUY2 UV's (422) into U and V (420)
void YUY2ToUVRow_C(const uint8* src_yuy2, int src_stride_yuy2,
uint8* dst_u, uint8* dst_v, int pix) {
// Output a row of UV values, filtering 2 rows of YUY2
for (int x = 0; x < pix; x += 2) {
dst_u[0] = (src_yuy2[1] + src_yuy2[src_stride_yuy2 + 1] + 1) >> 1;
dst_v[0] = (src_yuy2[3] + src_yuy2[src_stride_yuy2 + 3] + 1) >> 1;
src_yuy2 += 4;
dst_u += 1;
dst_v += 1;
}
}
void YUY2ToYRow_C(const uint8* src_yuy2,
uint8* dst_y, int pix) {
// Copy a row of yuy2 Y values
for (int x = 0; x < pix; ++x) {
dst_y[0] = src_yuy2[0];
src_yuy2 += 2;
dst_y += 1;
}
}
void UYVYToUVRow_C(const uint8* src_uyvy, int src_stride_uyvy,
uint8* dst_u, uint8* dst_v, int pix) {
// Copy a row of uyvy UV values
for (int x = 0; x < pix; x += 2) {
dst_u[0] = (src_uyvy[0] + src_uyvy[src_stride_uyvy + 0] + 1) >> 1;
dst_v[0] = (src_uyvy[2] + src_uyvy[src_stride_uyvy + 2] + 1) >> 1;
src_uyvy += 4;
dst_u += 1;
dst_v += 1;
}
}
void UYVYToYRow_C(const uint8* src_uyvy,
uint8* dst_y, int pix) {
// Copy a row of uyvy Y values
for (int x = 0; x < pix; ++x) {
dst_y[0] = src_uyvy[1];
src_uyvy += 2;
dst_y += 1;
}
}
// Wrappers to handle odd sizes/alignments // Wrappers to handle odd sizes/alignments
#define MAKEYUVANY(NAMEANY, NAME) \ #define MAKEYUVANY(NAMEANY, NAME) \
void NAMEANY(const uint8* y_buf, \ void NAMEANY(const uint8* y_buf, \
...@@ -380,15 +425,15 @@ void NAMEANY(const uint8* y_buf, \ ...@@ -380,15 +425,15 @@ void NAMEANY(const uint8* y_buf, \
memcpy(rgb_buf, row, width << 2); \ memcpy(rgb_buf, row, width << 2); \
} }
#if defined(HAS_FASTCONVERTYUVTOARGBROW_SSSE3) #if defined(HAS_I420TOARGBROW_SSSE3)
MAKEYUVANY(FastConvertYUVToARGBAnyRow_SSSE3, FastConvertYUVToARGBRow_SSSE3) MAKEYUVANY(I420ToARGBRow_Any_SSSE3, I420ToARGBRow_SSSE3)
MAKEYUVANY(FastConvertYUVToBGRAAnyRow_SSSE3, FastConvertYUVToBGRARow_SSSE3) MAKEYUVANY(I420ToBGRARow_Any_SSSE3, I420ToBGRARow_SSSE3)
MAKEYUVANY(FastConvertYUVToABGRAnyRow_SSSE3, FastConvertYUVToABGRRow_SSSE3) MAKEYUVANY(I420ToABGRRow_Any_SSSE3, I420ToABGRRow_SSSE3)
#endif #endif
#if defined(HAS_FASTCONVERTYUVTOARGBROW_NEON) #if defined(HAS_I420TOARGBROW_NEON)
MAKEYUVANY(FastConvertYUVToARGBAnyRow_NEON, FastConvertYUVToARGBRow_NEON) MAKEYUVANY(I420ToARGBRow_Any_NEON, I420ToARGBRow_NEON)
MAKEYUVANY(FastConvertYUVToBGRAAnyRow_NEON, FastConvertYUVToBGRARow_NEON) MAKEYUVANY(I420ToBGRARow_Any_NEON, I420ToBGRARow_NEON)
MAKEYUVANY(FastConvertYUVToABGRAnyRow_NEON, FastConvertYUVToABGRRow_NEON) MAKEYUVANY(I420ToABGRRow_Any_NEON, I420ToABGRRow_NEON)
#endif #endif
#define MAKEYUVANYRGB(NAMEANY, ARGBTORGB, BPP) \ #define MAKEYUVANYRGB(NAMEANY, ARGBTORGB, BPP) \
...@@ -401,27 +446,29 @@ void NAMEANY(const uint8* argb_buf, \ ...@@ -401,27 +446,29 @@ void NAMEANY(const uint8* argb_buf, \
} }
#if defined(HAS_ARGBTORGB24ROW_SSSE3) #if defined(HAS_ARGBTORGB24ROW_SSSE3)
MAKEYUVANYRGB(ARGBToRGB24AnyRow_SSSE3, ARGBToRGB24Row_SSSE3, 3) MAKEYUVANYRGB(ARGBToRGB24Row_Any_SSSE3, ARGBToRGB24Row_SSSE3, 3)
MAKEYUVANYRGB(ARGBToRAWAnyRow_SSSE3, ARGBToRAWRow_SSSE3, 3) MAKEYUVANYRGB(ARGBToRAWRow_Any_SSSE3, ARGBToRAWRow_SSSE3, 3)
MAKEYUVANYRGB(ARGBToRGB565AnyRow_SSE2, ARGBToRGB565Row_SSE2, 2) MAKEYUVANYRGB(ARGBToRGB565Row_Any_SSE2, ARGBToRGB565Row_SSE2, 2)
MAKEYUVANYRGB(ARGBToARGB1555AnyRow_SSE2, ARGBToARGB1555Row_SSE2, 2) MAKEYUVANYRGB(ARGBToARGB1555Row_Any_SSE2, ARGBToARGB1555Row_SSE2, 2)
MAKEYUVANYRGB(ARGBToARGB4444AnyRow_SSE2, ARGBToARGB4444Row_SSE2, 2) MAKEYUVANYRGB(ARGBToARGB4444Row_Any_SSE2, ARGBToARGB4444Row_SSE2, 2)
#endif #endif
#ifdef HAS_ARGBTOYROW_SSSE3 #ifdef HAS_ARGBTOYROW_SSSE3
#define MAKEARGBTOYANY(NAMEANY, ARGBTOY) \ #define MAKEANYTOYANY(NAMEANY, ARGBTOY) \
void NAMEANY(const uint8* src_argb, uint8* dst_y, int width) { \ void NAMEANY(const uint8* src_argb, uint8* dst_y, int width) { \
SIMD_ALIGNED(uint8 row[kMaxStride]); \ SIMD_ALIGNED(uint8 row[kMaxStride]); \
ARGBTOY(src_argb, row, width); \ ARGBTOY(src_argb, row, width); \
memcpy(dst_y, row, width); \ memcpy(dst_y, row, width); \
} }
MAKEARGBTOYANY(ARGBToYAnyRow_SSSE3, ARGBToYRow_Unaligned_SSSE3) MAKEANYTOYANY(ARGBToYRow_Any_SSSE3, ARGBToYRow_Unaligned_SSSE3)
MAKEARGBTOYANY(BGRAToYAnyRow_SSSE3, BGRAToYRow_Unaligned_SSSE3) MAKEANYTOYANY(BGRAToYRow_Any_SSSE3, BGRAToYRow_Unaligned_SSSE3)
MAKEARGBTOYANY(ABGRToYAnyRow_SSSE3, ABGRToYRow_Unaligned_SSSE3) MAKEANYTOYANY(ABGRToYRow_Any_SSSE3, ABGRToYRow_Unaligned_SSSE3)
MAKEANYTOYANY(YUY2ToYRow_Any_SSE2, YUY2ToYRow_Unaligned_SSE2)
MAKEANYTOYANY(UYVYToYRow_Any_SSE2, UYVYToYRow_Unaligned_SSE2)
#define MAKEARGBTOUVANY(NAMEANY, ARGBTOUV) \ #define MAKEANYTOUVANY(NAMEANY, ARGBTOUV) \
void NAMEANY(const uint8* src_argb0, int src_stride_argb, \ void NAMEANY(const uint8* src_argb0, int src_stride_argb, \
uint8* dst_u, uint8* dst_v, int width) { \ uint8* dst_u, uint8* dst_v, int width) { \
SIMD_ALIGNED(uint8 row[kMaxStride * 2]); \ SIMD_ALIGNED(uint8 row[kMaxStride * 2]); \
...@@ -431,9 +478,11 @@ MAKEARGBTOYANY(ABGRToYAnyRow_SSSE3, ABGRToYRow_Unaligned_SSSE3) ...@@ -431,9 +478,11 @@ MAKEARGBTOYANY(ABGRToYAnyRow_SSSE3, ABGRToYRow_Unaligned_SSSE3)
memcpy(dst_v, row + kMaxStride, halfwidth); \ memcpy(dst_v, row + kMaxStride, halfwidth); \
} }
MAKEARGBTOUVANY(ARGBToUVAnyRow_SSSE3, ARGBToUVRow_Unaligned_SSSE3) MAKEANYTOUVANY(ARGBToUVRow_Any_SSSE3, ARGBToUVRow_Unaligned_SSSE3)
MAKEARGBTOUVANY(BGRAToUVAnyRow_SSSE3, BGRAToUVRow_Unaligned_SSSE3) MAKEANYTOUVANY(BGRAToUVRow_Any_SSSE3, BGRAToUVRow_Unaligned_SSSE3)
MAKEARGBTOUVANY(ABGRToUVAnyRow_SSSE3, ABGRToUVRow_Unaligned_SSSE3) MAKEANYTOUVANY(ABGRToUVRow_Any_SSSE3, ABGRToUVRow_Unaligned_SSSE3)
MAKEANYTOUVANY(YUY2ToUVRow_Any_SSE2, YUY2ToUVRow_Unaligned_SSE2)
MAKEANYTOUVANY(UYVYToUVRow_Any_SSE2, UYVYToUVRow_Unaligned_SSE2)
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -55,19 +55,19 @@ extern "C" { ...@@ -55,19 +55,19 @@ extern "C" {
"vtrn.u8 d22, d23 \n" \ "vtrn.u8 d22, d23 \n" \
"vtrn.u8 d16, d17 \n" \ "vtrn.u8 d16, d17 \n" \
#if defined(HAS_FASTCONVERTYUVTOARGBROW_NEON) || \ #if defined(HAS_I420TOARGBROW_NEON) || \
defined(HAS_FASTCONVERTYUVTOBGRAROW_NEON) || \ defined(HAS_I420TOBGRAROW_NEON) || \
defined(HAS_FASTCONVERTYUVTOABGRROW_NEON) defined(HAS_I420TOABGRROW_NEON)
static const vec8 kUVToRB[8] = { 127, 127, 127, 127, 102, 102, 102, 102 }; static const vec8 kUVToRB[8] = { 127, 127, 127, 127, 102, 102, 102, 102 };
static const vec8 kUVToG[8] = { -25, -25, -25, -25, -52, -52, -52, -52 }; static const vec8 kUVToG[8] = { -25, -25, -25, -25, -52, -52, -52, -52 };
#endif #endif
#if defined(HAS_FASTCONVERTYUVTOARGBROW_NEON) #if defined(HAS_I420TOARGBROW_NEON)
void FastConvertYUVToARGBRow_NEON(const uint8* y_buf, void I420ToARGBRow_NEON(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
uint8* rgb_buf, uint8* rgb_buf,
int width) { int width) {
asm volatile ( asm volatile (
"vld1.u8 {d24}, [%5] \n" "vld1.u8 {d24}, [%5] \n"
"vld1.u8 {d25}, [%6] \n" "vld1.u8 {d25}, [%6] \n"
...@@ -94,12 +94,12 @@ YUVTORGB ...@@ -94,12 +94,12 @@ YUVTORGB
} }
#endif #endif
#if defined(HAS_FASTCONVERTYUVTOBGRAROW_NEON) #if defined(HAS_I420TOBGRAROW_NEON)
void FastConvertYUVToBGRARow_NEON(const uint8* y_buf, void I420ToBGRARow_NEON(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
uint8* rgb_buf, uint8* rgb_buf,
int width) { int width) {
asm volatile ( asm volatile (
"vld1.u8 {d24}, [%5] \n" "vld1.u8 {d24}, [%5] \n"
"vld1.u8 {d25}, [%6] \n" "vld1.u8 {d25}, [%6] \n"
...@@ -127,12 +127,12 @@ YUVTORGB ...@@ -127,12 +127,12 @@ YUVTORGB
} }
#endif #endif
#if defined(HAS_FASTCONVERTYUVTOABGRROW_NEON) #if defined(HAS_I420TOABGRROW_NEON)
void FastConvertYUVToABGRRow_NEON(const uint8* y_buf, void I420ToABGRRow_NEON(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
uint8* rgb_buf, uint8* rgb_buf,
int width) { int width) {
asm volatile ( asm volatile (
"vld1.u8 {d24}, [%5] \n" "vld1.u8 {d24}, [%5] \n"
"vld1.u8 {d25}, [%6] \n" "vld1.u8 {d25}, [%6] \n"
......
This diff is collapsed.
This diff is collapsed.
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