| Index: source/planar_functions.cc
|
| diff --git a/source/planar_functions.cc b/source/planar_functions.cc
|
| index 237ab68315be82d0f40d2b8b4ea6305277ae7e6e..565174547083f85126a87383719a8d16201c3f01 100644
|
| --- a/source/planar_functions.cc
|
| +++ b/source/planar_functions.cc
|
| @@ -31,6 +31,12 @@ void CopyPlane(const uint8* src_y, int src_stride_y,
|
| int width, int height) {
|
| int y;
|
| void (*CopyRow)(const uint8* src, uint8* dst, int width) = CopyRow_C;
|
| + // Negative height means invert the image.
|
| + if (height < 0) {
|
| + height = -height;
|
| + dst_y = dst_y + (height - 1) * dst_stride_y;
|
| + dst_stride_y = -dst_stride_y;
|
| + }
|
| // Coalesce rows.
|
| if (src_stride_y == width &&
|
| dst_stride_y == width) {
|
| @@ -2476,8 +2482,6 @@ int YUY2ToNV12(const uint8* src_yuy2, int src_stride_yuy2,
|
| int width, int height) {
|
| int y;
|
| int halfwidth = (width + 1) >> 1;
|
| - void (*SplitUVRow)(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
|
| - int width) = SplitUVRow_C;
|
| void (*InterpolateRow)(uint8* dst_ptr, const uint8* src_ptr,
|
| ptrdiff_t src_stride, int dst_width,
|
| int source_y_fraction) = InterpolateRow_C;
|
| @@ -2492,30 +2496,6 @@ int YUY2ToNV12(const uint8* src_yuy2, int src_stride_yuy2,
|
| src_yuy2 = src_yuy2 + (height - 1) * src_stride_yuy2;
|
| src_stride_yuy2 = -src_stride_yuy2;
|
| }
|
| -#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_INTERPOLATEROW_SSSE3)
|
| if (TestCpuFlag(kCpuHasSSSE3)) {
|
| InterpolateRow = InterpolateRow_Any_SSSE3;
|
| @@ -2546,6 +2526,12 @@ int YUY2ToNV12(const uint8* src_yuy2, int src_stride_yuy2,
|
| // row of y and 2 rows of uv
|
| align_buffer_64(rows, awidth * 3);
|
|
|
| + SplitUVRowFunction SplitUVRow = GetOptimizedSplitUVRowFunction(
|
| + src_yuy2, src_stride_yuy2,
|
| + rows, awidth,
|
| + rows, awidth,
|
| + awidth);
|
| +
|
| for (y = 0; y < height - 1; y += 2) {
|
| // Split Y from UV.
|
| SplitUVRow(src_yuy2, rows, rows + awidth, awidth);
|
| @@ -2559,8 +2545,9 @@ int YUY2ToNV12(const uint8* src_yuy2, int src_stride_yuy2,
|
| }
|
| if (height & 1) {
|
| // Split Y from UV.
|
| - SplitUVRow(src_yuy2, rows, dst_uv, awidth);
|
| + SplitUVRow(src_yuy2, rows, rows + awidth, awidth);
|
| memcpy(dst_y, rows, width);
|
| + memcpy(dst_uv, rows + awidth, awidth);
|
| }
|
| free_aligned_buffer_64(rows);
|
| }
|
| @@ -2574,8 +2561,6 @@ int UYVYToNV12(const uint8* src_uyvy, int src_stride_uyvy,
|
| int width, int height) {
|
| int y;
|
| int halfwidth = (width + 1) >> 1;
|
| - void (*SplitUVRow)(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
|
| - int width) = SplitUVRow_C;
|
| void (*InterpolateRow)(uint8* dst_ptr, const uint8* src_ptr,
|
| ptrdiff_t src_stride, int dst_width,
|
| int source_y_fraction) = InterpolateRow_C;
|
| @@ -2590,30 +2575,6 @@ int UYVYToNV12(const uint8* src_uyvy, int src_stride_uyvy,
|
| src_uyvy = src_uyvy + (height - 1) * src_stride_uyvy;
|
| src_stride_uyvy = -src_stride_uyvy;
|
| }
|
| -#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_INTERPOLATEROW_SSSE3)
|
| if (TestCpuFlag(kCpuHasSSSE3)) {
|
| InterpolateRow = InterpolateRow_Any_SSSE3;
|
| @@ -2644,6 +2605,12 @@ int UYVYToNV12(const uint8* src_uyvy, int src_stride_uyvy,
|
| // row of y and 2 rows of uv
|
| align_buffer_64(rows, awidth * 3);
|
|
|
| + SplitUVRowFunction SplitUVRow = GetOptimizedSplitUVRowFunction(
|
| + src_uyvy, src_stride_uyvy,
|
| + rows, awidth,
|
| + rows, awidth,
|
| + awidth);
|
| +
|
| for (y = 0; y < height - 1; y += 2) {
|
| // Split Y from UV.
|
| SplitUVRow(src_uyvy, rows + awidth, rows, awidth);
|
| @@ -2657,8 +2624,9 @@ int UYVYToNV12(const uint8* src_uyvy, int src_stride_uyvy,
|
| }
|
| if (height & 1) {
|
| // Split Y from UV.
|
| - SplitUVRow(src_uyvy, dst_uv, rows, awidth);
|
| + SplitUVRow(src_uyvy, rows + awidth, rows, awidth);
|
| memcpy(dst_y, rows, width);
|
| + memcpy(dst_uv, rows + awidth, awidth);
|
| }
|
| free_aligned_buffer_64(rows);
|
| }
|
|
|