diff --git a/README.chromium b/README.chromium index 46459dee2..3b06206af 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 252 +Version: 253 License: BSD License File: LICENSE diff --git a/include/libyuv/planar_functions.h b/include/libyuv/planar_functions.h index c846cc71c..6f8a9208a 100644 --- a/include/libyuv/planar_functions.h +++ b/include/libyuv/planar_functions.h @@ -52,6 +52,11 @@ int NV12ToRGB565(const uint8* src_y, int src_stride_y, uint8* dst_frame, int dst_stride_frame, int width, int height); +// Convert YUY2 to ARGB. +int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + // Convert I422 to ARGB. int I422ToARGB(const uint8* src_y, int src_stride_y, const uint8* src_u, int src_stride_u, diff --git a/include/libyuv/version.h b/include/libyuv/version.h index b2e1c29e3..c15f5b904 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,7 +11,7 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 252 +#define LIBYUV_VERSION 253 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/planar_functions.cc b/source/planar_functions.cc index 8cfb98bc7..fcbb506b0 100644 --- a/source/planar_functions.cc +++ b/source/planar_functions.cc @@ -571,7 +571,6 @@ int NV12ToARGB(const uint8* src_y, int src_stride_y, } } #endif - int halfwidth = (width + 1) >> 1; void (*SplitUV)(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) = SplitUV_C; @@ -600,6 +599,72 @@ int NV12ToARGB(const uint8* src_y, int src_stride_y, return 0; } +// Convert YUY2 to ARGB. +int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2, + uint8* dst_argb, int dst_stride_argb, + int width, int height) { + // Negative height means invert the image. + if (height < 0) { + height = -height; + src_yuy2 = src_yuy2 + (height - 1) * src_stride_yuy2; + src_stride_yuy2 = -src_stride_yuy2; + } + void (*YUY2ToUVRow)(const uint8* src_yuy2, int src_stride_yuy2, + uint8* dst_u, uint8* dst_v, int pix) = YUY2ToUVRow_C; + void (*YUY2ToYRow)(const uint8* src_yuy2, + uint8* dst_y, int pix) = YUY2ToYRow_C; +#if defined(HAS_YUY2TOYROW_SSE2) + if (TestCpuFlag(kCpuHasSSE2)) { + if (width > 16) { + YUY2ToUVRow = YUY2ToUVRow_Any_SSE2; + YUY2ToYRow = YUY2ToYRow_Any_SSE2; + } + if (IS_ALIGNED(width, 16)) { + YUY2ToUVRow = YUY2ToUVRow_Unaligned_SSE2; + YUY2ToYRow = YUY2ToYRow_Unaligned_SSE2; + if (IS_ALIGNED(src_yuy2, 16) && IS_ALIGNED(src_stride_yuy2, 16)) { + YUY2ToUVRow = YUY2ToUVRow_SSE2; + YUY2ToYRow = YUY2ToYRow_SSE2; + } + } + } +#endif + void (*I420ToARGBRow)(const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + uint8* argb_buf, + int width) = I420ToARGBRow_C; +#if defined(HAS_I420TOARGBROW_NEON) + if (TestCpuFlag(kCpuHasNEON)) { + I420ToARGBRow = I420ToARGBRow_Any_NEON; + if (IS_ALIGNED(width, 16)) { + I420ToARGBRow = I420ToARGBRow_NEON; + } + } +#elif defined(HAS_I420TOARGBROW_SSSE3) + if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) { + I420ToARGBRow = I420ToARGBRow_Any_SSSE3; + if (IS_ALIGNED(width, 8) && + IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) { + I420ToARGBRow = I420ToARGBRow_SSSE3; + } + } +#endif + + SIMD_ALIGNED(uint8 rowy[kMaxStride]); + SIMD_ALIGNED(uint8 rowu[kMaxStride]); + SIMD_ALIGNED(uint8 rowv[kMaxStride]); + + for (int y = 0; y < height; ++y) { + YUY2ToUVRow(src_yuy2, src_stride_yuy2, rowu, rowv, width); + YUY2ToYRow(src_yuy2, rowy, width); + I420ToARGBRow(rowy, rowu, rowv, dst_argb, width); + src_yuy2 += src_stride_yuy2; + dst_argb += dst_stride_argb; + } + return 0; +} + // Convert NV12 to RGB565. int NV12ToRGB565(const uint8* src_y, int src_stride_y, const uint8* src_uv, int src_stride_uv,