diff --git a/README.chromium b/README.chromium index 36ac6fbc6..c74572cb6 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1330 +Version: 1333 License: BSD License File: LICENSE diff --git a/include/libyuv/convert.h b/include/libyuv/convert.h index 97936adb2..a8d3fa07a 100644 --- a/include/libyuv/convert.h +++ b/include/libyuv/convert.h @@ -71,6 +71,8 @@ int I400ToI420(const uint8* src_y, int src_stride_y, uint8* dst_v, int dst_stride_v, int width, int height); +#define J400ToJ420 I400ToI420 + // Convert NV12 to I420. LIBYUV_API int NV12ToI420(const uint8* src_y, int src_stride_y, diff --git a/include/libyuv/convert_argb.h b/include/libyuv/convert_argb.h index a0de89efd..360c6d359 100644 --- a/include/libyuv/convert_argb.h +++ b/include/libyuv/convert_argb.h @@ -68,20 +68,20 @@ int I411ToARGB(const uint8* src_y, int src_stride_y, uint8* dst_argb, int dst_stride_argb, int width, int height); -// Convert I400 (grey) to ARGB. +// Convert I400 (grey) to ARGB. Reverse of ARGBToI400. LIBYUV_API int I400ToARGB(const uint8* src_y, int src_stride_y, uint8* dst_argb, int dst_stride_argb, int width, int height); -// Alias. -#define YToARGB I400ToARGB_Reference - -// Convert I400 to ARGB. Reverse of ARGBToI400. +// Convert J400 (jpeg grey) to ARGB. LIBYUV_API -int I400ToARGB_Reference(const uint8* src_y, int src_stride_y, - uint8* dst_argb, int dst_stride_argb, - int width, int height); +int J400ToARGB(const uint8* src_y, int src_stride_y, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Alias. +#define YToARGB I400ToARGB // Convert NV12 to ARGB. LIBYUV_API diff --git a/include/libyuv/planar_functions.h b/include/libyuv/planar_functions.h index e417dab39..7ca5e9820 100644 --- a/include/libyuv/planar_functions.h +++ b/include/libyuv/planar_functions.h @@ -45,6 +45,7 @@ int I400ToI400(const uint8* src_y, int src_stride_y, uint8* dst_y, int dst_stride_y, int width, int height); +#define J400ToJ400 I400ToI400 // Copy I422 to I422. #define I422ToI422 I422Copy @@ -84,6 +85,7 @@ int UYVYToI422(const uint8* src_uyvy, int src_stride_uyvy, uint8* dst_v, int dst_stride_v, int width, int height); + // Convert I420 to I400. (calls CopyPlane ignoring u/v). LIBYUV_API int I420ToI400(const uint8* src_y, int src_stride_y, @@ -93,6 +95,7 @@ int I420ToI400(const uint8* src_y, int src_stride_y, int width, int height); // Alias +#define J420ToJ400 I420ToI400 #define I420ToI420Mirror I420Mirror // I420 mirror. diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 711c8a897..4d28f0f13 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -81,7 +81,7 @@ extern "C" { #define HAS_BGRATOYROW_SSSE3 #define HAS_COPYROW_ERMS #define HAS_COPYROW_SSE2 -#define HAS_I400TOARGBROW_SSE2 +#define HAS_J400TOARGBROW_SSE2 #define HAS_I411TOARGBROW_SSSE3 #define HAS_I422TOABGRROW_SSSE3 #define HAS_I422TOARGB1555ROW_SSSE3 @@ -119,7 +119,7 @@ extern "C" { #define HAS_UYVYTOUV422ROW_SSE2 #define HAS_UYVYTOUVROW_SSE2 #define HAS_UYVYTOYROW_SSE2 -#define HAS_YTOARGBROW_SSE2 +#define HAS_I400TOARGBROW_SSE2 #define HAS_YUY2TOARGBROW_SSSE3 #define HAS_YUY2TOUV422ROW_SSE2 #define HAS_YUY2TOUVROW_SSE2 @@ -199,7 +199,7 @@ extern "C" { #define HAS_I422TOARGB4444ROW_AVX2 #define HAS_I444TOARGBROW_AVX2 #define HAS_I411TOARGBROW_AVX2 -#define HAS_I400TOARGBROW_AVX2 +#define HAS_J400TOARGBROW_AVX2 // TODO(fbarchard): Port to Neon #define HAS_ARGBTORGB565DITHERROW_SSE2 #define HAS_ARGBTORGB565DITHERROW_AVX2 @@ -228,7 +228,7 @@ extern "C" { #define HAS_UYVYTOUV422ROW_AVX2 #define HAS_UYVYTOUVROW_AVX2 #define HAS_UYVYTOYROW_AVX2 -#define HAS_YTOARGBROW_AVX2 +#define HAS_I400TOARGBROW_AVX2 #define HAS_YUY2TOUV422ROW_AVX2 #define HAS_YUY2TOUVROW_AVX2 #define HAS_YUY2TOYROW_AVX2 @@ -299,7 +299,7 @@ extern "C" { #define HAS_BGRATOUVROW_NEON #define HAS_BGRATOYROW_NEON #define HAS_COPYROW_NEON -#define HAS_I400TOARGBROW_NEON +#define HAS_J400TOARGBROW_NEON #define HAS_I411TOARGBROW_NEON #define HAS_I422TOABGRROW_NEON #define HAS_I422TOARGB1555ROW_NEON @@ -338,7 +338,7 @@ extern "C" { #define HAS_UYVYTOUV422ROW_NEON #define HAS_UYVYTOUVROW_NEON #define HAS_UYVYTOYROW_NEON -#define HAS_YTOARGBROW_NEON +#define HAS_I400TOARGBROW_NEON #define HAS_YUY2TOARGBROW_NEON #define HAS_YUY2TOUV422ROW_NEON #define HAS_YUY2TOUVROW_NEON @@ -936,13 +936,13 @@ void ARGBToRGB565Row_C(const uint8* src_argb, uint8* dst_rgb, int pix); void ARGBToARGB1555Row_C(const uint8* src_argb, uint8* dst_rgb, int pix); void ARGBToARGB4444Row_C(const uint8* src_argb, uint8* dst_rgb, int pix); -void I400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix); -void I400ToARGBRow_AVX2(const uint8* src_y, uint8* dst_argb, int pix); -void I400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int pix); -void I400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int pix); -void I400ToARGBRow_Any_SSE2(const uint8* src_y, uint8* dst_argb, int pix); -void I400ToARGBRow_Any_AVX2(const uint8* src_y, uint8* dst_argb, int pix); -void I400ToARGBRow_Any_NEON(const uint8* src_y, uint8* dst_argb, int pix); +void J400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix); +void J400ToARGBRow_AVX2(const uint8* src_y, uint8* dst_argb, int pix); +void J400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int pix); +void J400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int pix); +void J400ToARGBRow_Any_SSE2(const uint8* src_y, uint8* dst_argb, int pix); +void J400ToARGBRow_Any_AVX2(const uint8* src_y, uint8* dst_argb, int pix); +void J400ToARGBRow_Any_NEON(const uint8* src_y, uint8* dst_argb, int pix); void I444ToARGBRow_C(const uint8* src_y, const uint8* src_u, @@ -1335,27 +1335,13 @@ void I422ToRAWRow_Any_SSSE3(const uint8* src_y, uint8* dst_argb, int width); -void YToARGBRow_C(const uint8* src_y, - uint8* dst_argb, - int width); -void YToARGBRow_SSE2(const uint8* src_y, - uint8* dst_argb, - int width); -void YToARGBRow_AVX2(const uint8* src_y, - uint8* dst_argb, - int width); -void YToARGBRow_NEON(const uint8* src_y, - uint8* dst_argb, - int width); -void YToARGBRow_Any_SSE2(const uint8* src_y, - uint8* dst_argb, - int width); -void YToARGBRow_Any_AVX2(const uint8* src_y, - uint8* dst_argb, - int width); -void YToARGBRow_Any_NEON(const uint8* src_y, - uint8* dst_argb, - int width); +void I400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_AVX2(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_Any_SSE2(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_Any_AVX2(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_Any_NEON(const uint8* src_y, uint8* dst_argb, int width); // ARGB preattenuated alpha blend. void ARGBBlendRow_SSSE3(const uint8* src_argb, const uint8* src_argb1, diff --git a/include/libyuv/version.h b/include/libyuv/version.h index bb5d93871..2315e2ed8 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1330 +#define LIBYUV_VERSION 1333 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/convert_argb.cc b/source/convert_argb.cc index ce1d28bb6..21969b9b8 100644 --- a/source/convert_argb.cc +++ b/source/convert_argb.cc @@ -259,13 +259,13 @@ int I411ToARGB(const uint8* src_y, int src_stride_y, // Convert I400 to ARGB. LIBYUV_API -int I400ToARGB_Reference(const uint8* src_y, int src_stride_y, - uint8* dst_argb, int dst_stride_argb, - int width, int height) { +int I400ToARGB(const uint8* src_y, int src_stride_y, + uint8* dst_argb, int dst_stride_argb, + int width, int height) { int y; - void (*YToARGBRow)(const uint8* y_buf, + void (*I400ToARGBRow)(const uint8* y_buf, uint8* rgb_buf, - int width) = YToARGBRow_C; + int width) = I400ToARGBRow_C; if (!src_y || !dst_argb || width <= 0 || height == 0) { return -1; @@ -283,64 +283,6 @@ int I400ToARGB_Reference(const uint8* src_y, int src_stride_y, height = 1; src_stride_y = dst_stride_argb = 0; } -#if defined(HAS_YTOARGBROW_SSE2) - if (TestCpuFlag(kCpuHasSSE2)) { - YToARGBRow = YToARGBRow_Any_SSE2; - if (IS_ALIGNED(width, 8)) { - YToARGBRow = YToARGBRow_SSE2; - } - } -#endif -#if defined(HAS_YTOARGBROW_AVX2) - if (TestCpuFlag(kCpuHasAVX2)) { - YToARGBRow = YToARGBRow_Any_AVX2; - if (IS_ALIGNED(width, 16)) { - YToARGBRow = YToARGBRow_AVX2; - } - } -#endif -#if defined(HAS_YTOARGBROW_NEON) - if (TestCpuFlag(kCpuHasNEON)) { - YToARGBRow = YToARGBRow_Any_NEON; - if (IS_ALIGNED(width, 8)) { - YToARGBRow = YToARGBRow_NEON; - } - } -#endif - - for (y = 0; y < height; ++y) { - YToARGBRow(src_y, dst_argb, width); - dst_argb += dst_stride_argb; - src_y += src_stride_y; - } - return 0; -} - -// Convert I400 to ARGB. -LIBYUV_API -int I400ToARGB(const uint8* src_y, int src_stride_y, - uint8* dst_argb, int dst_stride_argb, - int width, int height) { - int y; - void (*I400ToARGBRow)(const uint8* src_y, uint8* dst_argb, int pix) = - I400ToARGBRow_C; - if (!src_y || !dst_argb || - width <= 0 || height == 0) { - return -1; - } - // Negative height means invert the image. - if (height < 0) { - height = -height; - src_y = src_y + (height - 1) * src_stride_y; - src_stride_y = -src_stride_y; - } - // Coalesce rows. - if (src_stride_y == width && - dst_stride_argb == width * 4) { - width *= height; - height = 1; - src_stride_y = dst_stride_argb = 0; - } #if defined(HAS_I400TOARGBROW_SSE2) if (TestCpuFlag(kCpuHasSSE2)) { I400ToARGBRow = I400ToARGBRow_Any_SSE2; @@ -365,8 +307,66 @@ int I400ToARGB(const uint8* src_y, int src_stride_y, } } #endif + for (y = 0; y < height; ++y) { I400ToARGBRow(src_y, dst_argb, width); + dst_argb += dst_stride_argb; + src_y += src_stride_y; + } + return 0; +} + +// Convert J400 to ARGB. +LIBYUV_API +int J400ToARGB(const uint8* src_y, int src_stride_y, + uint8* dst_argb, int dst_stride_argb, + int width, int height) { + int y; + void (*J400ToARGBRow)(const uint8* src_y, uint8* dst_argb, int pix) = + J400ToARGBRow_C; + if (!src_y || !dst_argb || + width <= 0 || height == 0) { + return -1; + } + // Negative height means invert the image. + if (height < 0) { + height = -height; + src_y = src_y + (height - 1) * src_stride_y; + src_stride_y = -src_stride_y; + } + // Coalesce rows. + if (src_stride_y == width && + dst_stride_argb == width * 4) { + width *= height; + height = 1; + src_stride_y = dst_stride_argb = 0; + } +#if defined(HAS_J400TOARGBROW_SSE2) + if (TestCpuFlag(kCpuHasSSE2)) { + J400ToARGBRow = J400ToARGBRow_Any_SSE2; + if (IS_ALIGNED(width, 8)) { + J400ToARGBRow = J400ToARGBRow_SSE2; + } + } +#endif +#if defined(HAS_J400TOARGBROW_AVX2) + if (TestCpuFlag(kCpuHasAVX2)) { + J400ToARGBRow = J400ToARGBRow_Any_AVX2; + if (IS_ALIGNED(width, 16)) { + J400ToARGBRow = J400ToARGBRow_AVX2; + } + } +#endif +#if defined(HAS_J400TOARGBROW_NEON) + if (TestCpuFlag(kCpuHasNEON)) { + J400ToARGBRow = J400ToARGBRow_Any_NEON; + if (IS_ALIGNED(width, 8)) { + J400ToARGBRow = J400ToARGBRow_NEON; + } + } +#endif + for (y = 0; y < height; ++y) { + J400ToARGBRow(src_y, dst_argb, width); src_y += src_stride_y; dst_argb += dst_stride_argb; } diff --git a/source/row_any.cc b/source/row_any.cc index 20f000cc7..64d6faef2 100644 --- a/source/row_any.cc +++ b/source/row_any.cc @@ -191,18 +191,18 @@ RGBANY(ARGBToARGB4444Row_Any_AVX2, ARGBToARGB4444Row_AVX2, ARGBToARGB4444Row_C, 4, 2, 7) #endif +#if defined(HAS_J400TOARGBROW_SSE2) +RGBANY(J400ToARGBRow_Any_SSE2, J400ToARGBRow_SSE2, J400ToARGBRow_C, 1, 4, 7) +#endif +#if defined(HAS_J400TOARGBROW_AVX2) +RGBANY(J400ToARGBRow_Any_AVX2, J400ToARGBRow_AVX2, J400ToARGBRow_C, 1, 4, 15) +#endif #if defined(HAS_I400TOARGBROW_SSE2) RGBANY(I400ToARGBRow_Any_SSE2, I400ToARGBRow_SSE2, I400ToARGBRow_C, 1, 4, 7) #endif #if defined(HAS_I400TOARGBROW_AVX2) RGBANY(I400ToARGBRow_Any_AVX2, I400ToARGBRow_AVX2, I400ToARGBRow_C, 1, 4, 15) #endif -#if defined(HAS_YTOARGBROW_SSE2) -RGBANY(YToARGBRow_Any_SSE2, YToARGBRow_SSE2, YToARGBRow_C, 1, 4, 7) -#endif -#if defined(HAS_YTOARGBROW_AVX2) -RGBANY(YToARGBRow_Any_AVX2, YToARGBRow_AVX2, YToARGBRow_C, 1, 4, 15) -#endif #if defined(HAS_YUY2TOARGBROW_SSSE3) RGBANY(YUY2ToARGBRow_Any_SSSE3, YUY2ToARGBRow_SSSE3, YUY2ToARGBRow_C, 2, 4, 15) RGBANY(UYVYToARGBRow_Any_SSSE3, UYVYToARGBRow_SSSE3, UYVYToARGBRow_C, 2, 4, 15) @@ -229,8 +229,8 @@ RGBANY(ARGBToARGB1555Row_Any_NEON, ARGBToARGB1555Row_NEON, ARGBToARGB1555Row_C, 4, 2, 7) RGBANY(ARGBToARGB4444Row_Any_NEON, ARGBToARGB4444Row_NEON, ARGBToARGB4444Row_C, 4, 2, 7) +RGBANY(J400ToARGBRow_Any_NEON, J400ToARGBRow_NEON, J400ToARGBRow_C, 1, 4, 7) RGBANY(I400ToARGBRow_Any_NEON, I400ToARGBRow_NEON, I400ToARGBRow_C, 1, 4, 7) -RGBANY(YToARGBRow_Any_NEON, YToARGBRow_NEON, YToARGBRow_C, 1, 4, 7) RGBANY(YUY2ToARGBRow_Any_NEON, YUY2ToARGBRow_NEON, YUY2ToARGBRow_C, 2, 4, 7) RGBANY(UYVYToARGBRow_Any_NEON, UYVYToARGBRow_NEON, UYVYToARGBRow_C, 2, 4, 7) #endif diff --git a/source/row_common.cc b/source/row_common.cc index 12500d883..a65553d4e 100644 --- a/source/row_common.cc +++ b/source/row_common.cc @@ -982,7 +982,7 @@ void SobelXYRow_C(const uint8* src_sobelx, const uint8* src_sobely, } } -void I400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int width) { +void J400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int width) { // Copy a Y to RGB. int x; for (x = 0; x < width; ++x) { @@ -1612,7 +1612,7 @@ void I422ToRGBARow_C(const uint8* src_y, } } -void YToARGBRow_C(const uint8* src_y, uint8* rgb_buf, int width) { +void I400ToARGBRow_C(const uint8* src_y, uint8* rgb_buf, int width) { int x; for (x = 0; x < width - 1; x += 2) { YPixel(src_y[0], rgb_buf + 0, rgb_buf + 1, rgb_buf + 2); diff --git a/source/row_neon.cc b/source/row_neon.cc index 8badc5a9b..6a936c382 100644 --- a/source/row_neon.cc +++ b/source/row_neon.cc @@ -531,9 +531,9 @@ void I422ToARGB4444Row_NEON(const uint8* src_y, ); } -void YToARGBRow_NEON(const uint8* src_y, - uint8* dst_argb, - int width) { +void I400ToARGBRow_NEON(const uint8* src_y, + uint8* dst_argb, + int width) { asm volatile ( YUV422TORGB_SETUP_REG ".p2align 2 \n" @@ -557,12 +557,12 @@ void YToARGBRow_NEON(const uint8* src_y, ); } -void I400ToARGBRow_NEON(const uint8* src_y, +void J400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int width) { asm volatile ( - ".p2align 2 \n" "vmov.u8 d23, #255 \n" + ".p2align 2 \n" "1: \n" MEMACCESS(0) "vld1.8 {d20}, [%0]! \n" diff --git a/source/row_neon64.cc b/source/row_neon64.cc index ddccd5d98..4ca595286 100644 --- a/source/row_neon64.cc +++ b/source/row_neon64.cc @@ -513,10 +513,10 @@ void I422ToARGB4444Row_NEON(const uint8* src_y, } #endif // HAS_I422TOARGB4444ROW_NEON -#ifdef HAS_YTOARGBROW_NEON -void YToARGBRow_NEON(const uint8* src_y, - uint8* dst_argb, - int width) { +#ifdef HAS_I400TOARGBROW_NEON +void I400ToARGBRow_NEON(const uint8* src_y, + uint8* dst_argb, + int width) { asm volatile ( YUV422TORGB_SETUP_REG "1: \n" @@ -536,10 +536,10 @@ void YToARGBRow_NEON(const uint8* src_y, "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30" ); } -#endif // HAS_YTOARGBROW_NEON +#endif // HAS_I400TOARGBROW_NEON -#ifdef HAS_I400TOARGBROW_NEON -void I400ToARGBRow_NEON(const uint8* src_y, +#ifdef HAS_J400TOARGBROW_NEON +void J400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int width) { asm volatile ( @@ -560,7 +560,7 @@ void I400ToARGBRow_NEON(const uint8* src_y, : "cc", "memory", "v20", "v21", "v22", "v23" ); } -#endif // HAS_I400TOARGBROW_NEON +#endif // HAS_J400TOARGBROW_NEON #ifdef HAS_NV12TOARGBROW_NEON void NV12ToARGBRow_NEON(const uint8* src_y, diff --git a/source/row_posix.cc b/source/row_posix.cc index 1a6f7dc4d..4b6614ac1 100644 --- a/source/row_posix.cc +++ b/source/row_posix.cc @@ -236,8 +236,8 @@ void TestRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix) { } #endif // TESTING -#ifdef HAS_I400TOARGBROW_SSE2 -void I400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix) { +#ifdef HAS_J400TOARGBROW_SSE2 +void J400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix) { asm volatile ( "pcmpeqb %%xmm5,%%xmm5 \n" "pslld $0x18,%%xmm5 \n" @@ -262,7 +262,7 @@ void I400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix) { :: "memory", "cc", "xmm0", "xmm1", "xmm5" ); } -#endif // HAS_I400TOARGBROW_SSE2 +#endif // HAS_J400TOARGBROW_SSE2 #ifdef HAS_RGB24TOARGBROW_SSSE3 void RGB24ToARGBRow_SSSE3(const uint8* src_rgb24, uint8* dst_argb, int pix) { @@ -2066,8 +2066,8 @@ void OMITFP I422ToRGBARow_AVX2(const uint8* y_buf, } #endif // HAS_I422TORGBAROW_AVX2 -#ifdef HAS_YTOARGBROW_SSE2 -void YToARGBRow_SSE2(const uint8* y_buf, uint8* dst_argb, int width) { +#ifdef HAS_I400TOARGBROW_SSE2 +void I400ToARGBRow_SSE2(const uint8* y_buf, uint8* dst_argb, int width) { asm volatile ( "mov $0x4a354a35,%%eax \n" // 4a35 = 18997 = 1.164 "movd %%eax,%%xmm2 \n" @@ -2109,12 +2109,12 @@ void YToARGBRow_SSE2(const uint8* y_buf, uint8* dst_argb, int width) { , "xmm0", "xmm1", "xmm2", "xmm3", "xmm4" ); } -#endif // HAS_YTOARGBROW_SSE2 +#endif // HAS_I400TOARGBROW_SSE2 -#ifdef HAS_YTOARGBROW_AVX2 +#ifdef HAS_I400TOARGBROW_AVX2 // 16 pixels of Y converted to 16 pixels of ARGB (64 bytes). // note: vpunpcklbw mutates and vpackuswb unmutates. -void YToARGBRow_AVX2(const uint8* y_buf, uint8* dst_argb, int width) { +void I400ToARGBRow_AVX2(const uint8* y_buf, uint8* dst_argb, int width) { asm volatile ( "mov $0x4a354a35,%%eax \n" // 0488 = 1160 = 1.164 * 16 "vmovd %%eax,%%xmm2 \n" @@ -2156,7 +2156,7 @@ void YToARGBRow_AVX2(const uint8* y_buf, uint8* dst_argb, int width) { , "xmm0", "xmm1", "xmm2", "xmm3", "xmm4" ); } -#endif // HAS_YTOARGBROW_AVX2 +#endif // HAS_I400TOARGBROW_AVX2 #ifdef HAS_MIRRORROW_SSSE3 // Shuffle table for reversing the bytes. diff --git a/source/row_win.cc b/source/row_win.cc index eabe9196d..c531c3855 100644 --- a/source/row_win.cc +++ b/source/row_win.cc @@ -324,7 +324,7 @@ static const uvec8 kShuffleMaskARGBToRAW_0 = { // Duplicates gray value 3 times and fills in alpha opaque. __declspec(naked) __declspec(align(16)) -void I400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix) { +void J400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix) { __asm { mov eax, [esp + 4] // src_y mov edx, [esp + 8] // dst_argb @@ -350,10 +350,10 @@ void I400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix) { } } -#ifdef HAS_I400TOARGBROW_AVX2 +#ifdef HAS_J400TOARGBROW_AVX2 // Duplicates gray value 3 times and fills in alpha opaque. __declspec(naked) __declspec(align(16)) -void I400ToARGBRow_AVX2(const uint8* src_y, uint8* dst_argb, int pix) { +void J400ToARGBRow_AVX2(const uint8* src_y, uint8* dst_argb, int pix) { __asm { mov eax, [esp + 4] // src_y mov edx, [esp + 8] // dst_argb @@ -380,7 +380,7 @@ void I400ToARGBRow_AVX2(const uint8* src_y, uint8* dst_argb, int pix) { ret } } -#endif // HAS_I400TOARGBROW_AVX2 +#endif // HAS_J400TOARGBROW_AVX2 __declspec(naked) __declspec(align(16)) void RGB24ToARGBRow_SSSE3(const uint8* src_rgb24, uint8* dst_argb, int pix) { @@ -2787,12 +2787,12 @@ void I422ToRGBARow_SSSE3(const uint8* y_buf, #endif // HAS_I422TOARGBROW_SSSE3 -#ifdef HAS_YTOARGBROW_SSE2 +#ifdef HAS_I400TOARGBROW_SSE2 // 8 pixels of Y converted to 8 pixels of ARGB (32 bytes). __declspec(naked) __declspec(align(16)) -void YToARGBRow_SSE2(const uint8* y_buf, - uint8* rgb_buf, - int width) { +void I400ToARGBRow_SSE2(const uint8* y_buf, + uint8* rgb_buf, + int width) { __asm { mov eax, 0x4a354a35 // 4a35 = 18997 = round(1.164 * 64 * 256) movd xmm2, eax @@ -2832,15 +2832,15 @@ void YToARGBRow_SSE2(const uint8* y_buf, ret } } -#endif // HAS_YTOARGBROW_SSE2 +#endif // HAS_I400TOARGBROW_SSE2 -#ifdef HAS_YTOARGBROW_AVX2 +#ifdef HAS_I400TOARGBROW_AVX2 // 16 pixels of Y converted to 16 pixels of ARGB (64 bytes). // note: vpunpcklbw mutates and vpackuswb unmutates. __declspec(naked) __declspec(align(16)) -void YToARGBRow_AVX2(const uint8* y_buf, - uint8* rgb_buf, - int width) { +void I400ToARGBRow_AVX2(const uint8* y_buf, + uint8* rgb_buf, + int width) { __asm { mov eax, 0x4a354a35 // 4a35 = 18997 = round(1.164 * 64 * 256) vmovd xmm2, eax @@ -2883,7 +2883,7 @@ void YToARGBRow_AVX2(const uint8* y_buf, ret } } -#endif // HAS_YTOARGBROW_AVX2 +#endif // HAS_I400TOARGBROW_AVX2 #ifdef HAS_MIRRORROW_SSSE3 // Shuffle table for reversing the bytes. diff --git a/unit_test/color_test.cc b/unit_test/color_test.cc index 0dd2989f1..c2c47c554 100644 --- a/unit_test/color_test.cc +++ b/unit_test/color_test.cc @@ -196,7 +196,7 @@ static void YToRGB(int y, int* r, int* g, int* b) { memset(orig_y, y, kPixels); /* YUV converted to ARGB. */ - YToARGB(orig_y, kWidth, orig_pixels, kWidth * 4, kWidth, kHeight); + I400ToARGB(orig_y, kWidth, orig_pixels, kWidth * 4, kWidth, kHeight); *b = orig_pixels[0]; *g = orig_pixels[1]; @@ -213,7 +213,7 @@ static void YJToRGB(int y, int* r, int* g, int* b) { memset(orig_y, y, kPixels); /* YUV converted to ARGB. */ - I400ToARGB(orig_y, kWidth, orig_pixels, kWidth * 4, kWidth, kHeight); + J400ToARGB(orig_y, kWidth, orig_pixels, kWidth * 4, kWidth, kHeight); *b = orig_pixels[0]; *g = orig_pixels[1]; diff --git a/unit_test/convert_test.cc b/unit_test/convert_test.cc index 7f723fa2c..6d768d48a 100644 --- a/unit_test/convert_test.cc +++ b/unit_test/convert_test.cc @@ -518,6 +518,7 @@ TESTPLANARTOB(I420, 2, 2, UYVY, 2, 4, 1, 1, ARGB, 4) TESTPLANARTOB(I422, 2, 1, YUY2, 2, 4, 1, 0, ARGB, 4) TESTPLANARTOB(I422, 2, 1, UYVY, 2, 4, 1, 0, ARGB, 4) TESTPLANARTOB(I420, 2, 2, I400, 1, 1, 1, 0, ARGB, 4) +TESTPLANARTOB(J420, 2, 2, J400, 1, 1, 1, 0, ARGB, 4) #define TESTBIPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, \ W1280, DIFF, N, NEG, OFF) \ @@ -716,6 +717,7 @@ TESTATOPLANAR(UYVY, 2, 1, I420, 2, 2, 2) TESTATOPLANAR(YUY2, 2, 1, I422, 2, 1, 2) TESTATOPLANAR(UYVY, 2, 1, I422, 2, 1, 2) TESTATOPLANAR(I400, 1, 1, I420, 2, 2, 2) +TESTATOPLANAR(J400, 1, 1, J420, 2, 2, 2) #define TESTATOBIPLANARI(FMT_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ W1280, N, NEG, OFF) \ @@ -927,9 +929,10 @@ TESTATOB(ARGB4444, 2, 2, 1, ARGB, 4, 4, 1, 0) TESTATOB(YUY2, 2, 4, 1, ARGB, 4, 4, 1, 4) TESTATOB(UYVY, 2, 4, 1, ARGB, 4, 4, 1, 4) TESTATOB(I400, 1, 1, 1, ARGB, 4, 4, 1, 0) +TESTATOB(J400, 1, 1, 1, ARGB, 4, 4, 1, 0) TESTATOB(I400, 1, 1, 1, I400, 1, 1, 1, 0) +TESTATOB(J400, 1, 1, 1, J400, 1, 1, 1, 0) TESTATOB(I400, 1, 1, 1, I400Mirror, 1, 1, 1, 0) -TESTATOB(Y, 1, 1, 1, ARGB, 4, 4, 1, 0) TESTATOB(ARGB, 4, 4, 1, ARGBMirror, 4, 4, 1, 0) #define TESTATOBDI(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \