| Index: source/convert.cc
|
| diff --git a/source/convert.cc b/source/convert.cc
|
| index cd667bf5605cba6f7404770d30ff9f45f3c27638..4894e16a83c0d08bdf789b014f96c57d6e16b2c3 100644
|
| --- a/source/convert.cc
|
| +++ b/source/convert.cc
|
| @@ -229,15 +229,14 @@ static void CopyPlane2(const uint8* src, int src_stride_0, int src_stride_1,
|
| }
|
| }
|
|
|
| -// Support function for NV12 etc UV channels.
|
| -// Width and height are plane sizes (typically half pixel width).
|
| -static void SplitUVPlane(const uint8* src_uv, int src_stride_uv,
|
| - uint8* dst_u, int dst_stride_u,
|
| - uint8* dst_v, int dst_stride_v,
|
| - int width, int height) {
|
| - int y;
|
| - void (*SplitUVRow)(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
|
| - int width) = SplitUVRow_C;
|
| +LIBYUV_API
|
| +int SplitUVPlane(const uint8* src_uv, int src_stride_uv,
|
| + uint8* dst_u, int dst_stride_u,
|
| + uint8* dst_v, int dst_stride_v,
|
| + int width, int height) {
|
| + if (!src_uv || !dst_u || !dst_v || width <= 0 || height == 0) {
|
| + return -1;
|
| + }
|
| // Negative height means invert the image.
|
| if (height < 0) {
|
| height = -height;
|
| @@ -254,48 +253,17 @@ static void SplitUVPlane(const uint8* src_uv, int src_stride_uv,
|
| height = 1;
|
| src_stride_uv = dst_stride_u = dst_stride_v = 0;
|
| }
|
| -#if defined(HAS_SPLITUVROW_SSE2)
|
| - if (TestCpuFlag(kCpuHasSSE2)) {
|
| - SplitUVRow = SplitUVRow_Any_SSE2;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - SplitUVRow = SplitUVRow_SSE2;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_SPLITUVROW_AVX2)
|
| - if (TestCpuFlag(kCpuHasAVX2)) {
|
| - SplitUVRow = SplitUVRow_Any_AVX2;
|
| - if (IS_ALIGNED(width, 32)) {
|
| - SplitUVRow = SplitUVRow_AVX2;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_SPLITUVROW_NEON)
|
| - if (TestCpuFlag(kCpuHasNEON)) {
|
| - SplitUVRow = SplitUVRow_Any_NEON;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - SplitUVRow = SplitUVRow_NEON;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_SPLITUVROW_DSPR2)
|
| - if (TestCpuFlag(kCpuHasDSPR2) &&
|
| - IS_ALIGNED(dst_u, 4) && IS_ALIGNED(dst_stride_u, 4) &&
|
| - IS_ALIGNED(dst_v, 4) && IS_ALIGNED(dst_stride_v, 4)) {
|
| - SplitUVRow = SplitUVRow_Any_DSPR2;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - SplitUVRow = SplitUVRow_DSPR2;
|
| - }
|
| - }
|
| -#endif
|
| + SplitUVRowFunction SplitUVRow = GetOptimizedSplitUVRowFunction(
|
| + src_uv, src_stride_uv, dst_u, dst_stride_u, dst_v, dst_stride_v, width);
|
|
|
| - for (y = 0; y < height; ++y) {
|
| + for (int y = 0; y < height; ++y) {
|
| // Copy a row of UV.
|
| SplitUVRow(src_uv, dst_u, dst_v, width);
|
| dst_u += dst_stride_u;
|
| dst_v += dst_stride_v;
|
| src_uv += src_stride_uv;
|
| }
|
| + return 0;
|
| }
|
|
|
| // Support converting from FOURCC_M420
|
|
|