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

Relax alignment checks especially when doing 2 step conversions

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@147 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 510fe70c
......@@ -373,9 +373,7 @@ int ARGBToI420(const uint8* src_frame, int src_stride_frame,
#if defined(HAS_ARGBTOUVROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(src_frame, 16) && IS_ALIGNED(src_stride_frame, 16) &&
IS_ALIGNED(dst_u, 8) && IS_ALIGNED(dst_stride_u, 8) &&
IS_ALIGNED(dst_v, 8) && IS_ALIGNED(dst_stride_v, 8)) {
IS_ALIGNED(src_frame, 16) && IS_ALIGNED(src_stride_frame, 16)) {
ARGBToUVRow = ARGBToUVRow_SSSE3;
} else
#endif
......@@ -426,9 +424,7 @@ int BGRAToI420(const uint8* src_frame, int src_stride_frame,
#if defined(HAS_BGRATOUVROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(src_frame, 16) && IS_ALIGNED(src_stride_frame, 16) &&
IS_ALIGNED(dst_u, 8) && IS_ALIGNED(dst_stride_u, 8) &&
IS_ALIGNED(dst_v, 8) && IS_ALIGNED(dst_stride_v, 8)) {
IS_ALIGNED(src_frame, 16) && IS_ALIGNED(src_stride_frame, 16)) {
ARGBToUVRow = BGRAToUVRow_SSSE3;
} else
#endif
......@@ -479,9 +475,7 @@ int ABGRToI420(const uint8* src_frame, int src_stride_frame,
#if defined(HAS_ABGRTOUVROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(src_frame, 16) && IS_ALIGNED(src_stride_frame, 16) &&
IS_ALIGNED(dst_u, 8) && IS_ALIGNED(dst_stride_u, 8) &&
IS_ALIGNED(dst_v, 8) && IS_ALIGNED(dst_stride_v, 8)) {
IS_ALIGNED(src_frame, 16) && IS_ALIGNED(src_stride_frame, 16)) {
ARGBToUVRow = ABGRToUVRow_SSSE3;
} else
#endif
......@@ -522,7 +516,6 @@ int RGB24ToI420(const uint8* src_frame, int src_stride_frame,
uint8* dst_u, uint8* dst_v, int width);
#if defined(HAS_RGB24TOARGBROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(src_frame, 16) && IS_ALIGNED(src_stride_frame, 16)) {
RGB24ToARGBRow = RGB24ToARGBRow_SSSE3;
} else
......@@ -541,10 +534,7 @@ int RGB24ToI420(const uint8* src_frame, int src_stride_frame,
ARGBToYRow = ARGBToYRow_C;
}
#if defined(HAS_ARGBTOUVROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(dst_u, 8) && IS_ALIGNED(dst_stride_u, 8) &&
IS_ALIGNED(dst_v, 8) && IS_ALIGNED(dst_stride_v, 8)) {
if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 16)) {
ARGBToUVRow = ARGBToUVRow_SSSE3;
} else
#endif
......@@ -588,7 +578,6 @@ int RAWToI420(const uint8* src_frame, int src_stride_frame,
uint8* dst_u, uint8* dst_v, int width);
#if defined(HAS_RAWTOARGBROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(src_frame, 16) && IS_ALIGNED(src_stride_frame, 16)) {
RAWToARGBRow = RAWToARGBRow_SSSE3;
} else
......@@ -607,10 +596,7 @@ int RAWToI420(const uint8* src_frame, int src_stride_frame,
ARGBToYRow = ARGBToYRow_C;
}
#if defined(HAS_ARGBTOUVROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(dst_u, 8) && IS_ALIGNED(dst_stride_u, 8) &&
IS_ALIGNED(dst_v, 8) && IS_ALIGNED(dst_stride_v, 8)) {
if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 16)) {
ARGBToUVRow = ARGBToUVRow_SSSE3;
} else
#endif
......@@ -654,7 +640,6 @@ int RGB565ToI420(const uint8* src_frame, int src_stride_frame,
uint8* dst_u, uint8* dst_v, int width);
#if defined(HAS_RGB565TOARGBROW_SSE2)
if (TestCpuFlag(kCpuHasSSE2) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(src_frame, 16) && IS_ALIGNED(src_stride_frame, 16)) {
RGB565ToARGBRow = RGB565ToARGBRow_SSE2;
} else
......@@ -673,10 +658,7 @@ int RGB565ToI420(const uint8* src_frame, int src_stride_frame,
ARGBToYRow = ARGBToYRow_C;
}
#if defined(HAS_ARGBTOUVROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(dst_u, 8) && IS_ALIGNED(dst_stride_u, 8) &&
IS_ALIGNED(dst_v, 8) && IS_ALIGNED(dst_stride_v, 8)) {
if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 16)) {
ARGBToUVRow = ARGBToUVRow_SSSE3;
} else
#endif
......@@ -720,7 +702,6 @@ int ARGB1555ToI420(const uint8* src_frame, int src_stride_frame,
uint8* dst_u, uint8* dst_v, int width);
#if defined(HAS_ARGB1555TOARGBROW_SSE2)
if (TestCpuFlag(kCpuHasSSE2) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(src_frame, 16) && IS_ALIGNED(src_stride_frame, 16)) {
ARGB1555ToARGBRow = ARGB1555ToARGBRow_SSE2;
} else
......@@ -739,10 +720,7 @@ int ARGB1555ToI420(const uint8* src_frame, int src_stride_frame,
ARGBToYRow = ARGBToYRow_C;
}
#if defined(HAS_ARGBTOUVROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(dst_u, 8) && IS_ALIGNED(dst_stride_u, 8) &&
IS_ALIGNED(dst_v, 8) && IS_ALIGNED(dst_stride_v, 8)) {
if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 16)) {
ARGBToUVRow = ARGBToUVRow_SSSE3;
} else
#endif
......@@ -786,7 +764,6 @@ int ARGB4444ToI420(const uint8* src_frame, int src_stride_frame,
uint8* dst_u, uint8* dst_v, int width);
#if defined(HAS_ARGB4444TOARGBROW_SSE2)
if (TestCpuFlag(kCpuHasSSE2) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(src_frame, 16) && IS_ALIGNED(src_stride_frame, 16)) {
ARGB4444ToARGBRow = ARGB4444ToARGBRow_SSE2;
} else
......@@ -805,10 +782,7 @@ int ARGB4444ToI420(const uint8* src_frame, int src_stride_frame,
ARGBToYRow = ARGBToYRow_C;
}
#if defined(HAS_ARGBTOUVROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(dst_u, 8) && IS_ALIGNED(dst_stride_u, 8) &&
IS_ALIGNED(dst_v, 8) && IS_ALIGNED(dst_stride_v, 8)) {
if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 16)) {
ARGBToUVRow = ARGBToUVRow_SSSE3;
} else
#endif
......
......@@ -118,8 +118,7 @@ int ARGBToBayerRGB(const uint8* src_rgb, int src_stride_rgb,
#if defined(HAS_ARGBTOBAYERROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 4) &&
IS_ALIGNED(src_rgb, 16) && IS_ALIGNED(src_stride_rgb, 16) &&
IS_ALIGNED(dst_bayer, 4) && IS_ALIGNED(dst_stride_bayer, 4)) {
IS_ALIGNED(src_rgb, 16) && IS_ALIGNED(src_stride_rgb, 16)) {
ARGBToBayerRow = ARGBToBayerRow_SSSE3;
} else
#endif
......@@ -372,7 +371,6 @@ int BayerRGBToI420(const uint8* src_bayer, int src_stride_bayer,
#if defined(HAS_ARGBTOYROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(row, 16) && IS_ALIGNED(kMaxStride, 16) &&
IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) {
ARGBToYRow = ARGBToYRow_SSSE3;
} else
......@@ -381,11 +379,7 @@ int BayerRGBToI420(const uint8* src_bayer, int src_stride_bayer,
ARGBToYRow = ARGBToYRow_C;
}
#if defined(HAS_ARGBTOUVROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(row, 16) && IS_ALIGNED(kMaxStride, 16) &&
IS_ALIGNED(dst_u, 8) && IS_ALIGNED(dst_stride_u, 8) &&
IS_ALIGNED(dst_v, 8) && IS_ALIGNED(dst_stride_v, 8)) {
if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 16)) {
ARGBToUVRow = ARGBToUVRow_SSSE3;
} else
#endif
......@@ -426,7 +420,6 @@ int BayerRGBToI420(const uint8* src_bayer, int src_stride_bayer,
dst_u += dst_stride_u;
dst_v += dst_stride_v;
}
// TODO(fbarchard): Make sure this filters properly
if (height & 1) {
BayerRow0(src_bayer, src_stride_bayer, row, width);
ARGBToUVRow(row, 0, dst_u, dst_v, width);
......
This diff is collapsed.
......@@ -797,17 +797,13 @@ void TransposePlane(const uint8* src, int src_stride,
#if defined(HAS_TRANSPOSE_WX8_FAST_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(src, 16) && IS_ALIGNED(src_stride, 16) &&
IS_ALIGNED(dst, 8) && IS_ALIGNED(dst_stride, 8)) {
IS_ALIGNED(src, 16) && IS_ALIGNED(src_stride, 16)) {
TransposeWx8 = TransposeWx8_FAST_SSSE3;
TransposeWxH = TransposeWxH_C;
} else
#endif
#if defined(HAS_TRANSPOSE_WX8_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 8) &&
IS_ALIGNED(src, 8) && IS_ALIGNED(src_stride, 8) &&
IS_ALIGNED(dst, 8) && IS_ALIGNED(dst_stride, 8)) {
if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 8)) {
TransposeWx8 = TransposeWx8_SSSE3;
TransposeWxH = TransposeWxH_C;
} else
......@@ -949,9 +945,7 @@ void TransposeUV(const uint8* src, int src_stride,
#if defined(HAS_TRANSPOSE_UVWX8_SSE2)
if (TestCpuFlag(kCpuHasSSE2) &&
IS_ALIGNED(width, 8) &&
IS_ALIGNED(src, 16) && IS_ALIGNED(src_stride, 16) &&
IS_ALIGNED(dst_a, 8) && IS_ALIGNED(dst_stride_a, 8) &&
IS_ALIGNED(dst_b, 8) && IS_ALIGNED(dst_stride_b, 8)) {
IS_ALIGNED(src, 16) && IS_ALIGNED(src_stride, 16)) {
TransposeWx8 = TransposeUVWx8_SSE2;
TransposeWxH = TransposeUVWxH_C;
} else
......@@ -1099,9 +1093,7 @@ void RotateUV180(const uint8* src, int src_stride,
#if defined(HAS_REVERSE_ROW_UV_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) &&
IS_ALIGNED(width, 16) &&
IS_ALIGNED(src, 16) && IS_ALIGNED(src_stride, 16) &&
IS_ALIGNED(dst_a, 8) && IS_ALIGNED(dst_stride_a, 8) &&
IS_ALIGNED(dst_b, 8) && IS_ALIGNED(dst_stride_b, 8) ) {
IS_ALIGNED(src, 16) && IS_ALIGNED(src_stride, 16)) {
ReverseRow = ReverseRowUV_SSSE3;
} else
#endif
......
......@@ -217,12 +217,36 @@ void FastConvertYUVToARGBAnyRow_SSSE3(const uint8* y_buf,
uint8* rgb_buf,
int width);
void FastConvertYUVToBGRAAnyRow_SSSE3(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width);
void FastConvertYUVToABGRAnyRow_SSSE3(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width);
void FastConvertYUVToARGBAnyRow_NEON(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width);
void FastConvertYUVToBGRAAnyRow_NEON(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width);
void FastConvertYUVToABGRAnyRow_NEON(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width);
#ifdef __cplusplus
} // extern "C"
} // namespace libyuv
......
......@@ -369,36 +369,26 @@ void ReverseRow_C(const uint8* src, uint8* dst, int width) {
}
// Wrappers to handle odd sizes/alignments
#if defined(HAS_FASTCONVERTYUVTOARGBROW_SSSE3)
void FastConvertYUVToARGBAnyRow_SSSE3(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) {
SIMD_ALIGNED(uint8 row[kMaxStride]);
FastConvertYUVToARGBRow_SSSE3(y_buf,
u_buf,
v_buf,
row,
width);
memcpy(rgb_buf, row, width << 2);
#define MAKEYUVANY(NAMEANY, NAME) \
void NAMEANY(const uint8* y_buf, \
const uint8* u_buf, \
const uint8* v_buf, \
uint8* rgb_buf, \
int width) { \
SIMD_ALIGNED(uint8 row[kMaxStride]); \
NAME(y_buf, u_buf, v_buf, row, width); \
memcpy(rgb_buf, row, width << 2); \
}
#endif
#if defined(HAS_FASTCONVERTYUVTOARGBROW_SSSE3)
MAKEYUVANY(FastConvertYUVToARGBAnyRow_SSSE3, FastConvertYUVToARGBRow_SSSE3)
MAKEYUVANY(FastConvertYUVToBGRAAnyRow_SSSE3, FastConvertYUVToBGRARow_SSSE3)
MAKEYUVANY(FastConvertYUVToABGRAnyRow_SSSE3, FastConvertYUVToABGRRow_SSSE3)
#endif
#if defined(HAS_FASTCONVERTYUVTOARGBROW_NEON)
void FastConvertYUVToARGBAnyRow_NEON(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) {
SIMD_ALIGNED(uint8 row[kMaxStride]);
FastConvertYUVToARGBRow_NEON(y_buf,
u_buf,
v_buf,
row,
width);
memcpy(rgb_buf, row, width << 2);
}
MAKEYUVANY(FastConvertYUVToARGBAnyRow_NEON, FastConvertYUVToARGBRow_NEON)
MAKEYUVANY(FastConvertYUVToBGRAAnyRow_NEON, FastConvertYUVToBGRARow_NEON)
MAKEYUVANY(FastConvertYUVToABGRAnyRow_NEON, FastConvertYUVToABGRRow_NEON)
#endif
#ifdef __cplusplus
......
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