| Index: source/convert_argb.cc
|
| diff --git a/source/convert_argb.cc b/source/convert_argb.cc
|
| index af18e66ffe07a80b14dcb370b66f4bad27092a56..3b5a25d6dc3043ce7305a61dc201a236054f8e00 100644
|
| --- a/source/convert_argb.cc
|
| +++ b/source/convert_argb.cc
|
| @@ -44,22 +44,21 @@ int ARGBCopy(const uint8* src_argb, int src_stride_argb,
|
| return 0;
|
| }
|
|
|
| -// Convert I444 to ARGB.
|
| -static int I444ToARGBMatrix(const uint8* src_y, int src_stride_y,
|
| +// Convert I422 to ARGB with matrix
|
| +static int I420ToARGBMatrix(const uint8* src_y, int src_stride_y,
|
| const uint8* src_u, int src_stride_u,
|
| const uint8* src_v, int src_stride_v,
|
| uint8* dst_argb, int dst_stride_argb,
|
| const struct YuvConstants* yuvconstants,
|
| int width, int height) {
|
| int y;
|
| - void (*I444ToARGBRow)(const uint8* y_buf,
|
| + void (*I422ToARGBRow)(const uint8* y_buf,
|
| const uint8* u_buf,
|
| const uint8* v_buf,
|
| uint8* rgb_buf,
|
| const struct YuvConstants* yuvconstants,
|
| - int width) = I444ToARGBRow_C;
|
| - if (!src_y || !src_u || !src_v ||
|
| - !dst_argb ||
|
| + int width) = I422ToARGBRow_C;
|
| + if (!src_y || !src_u || !src_v || !dst_argb ||
|
| width <= 0 || height == 0) {
|
| return -1;
|
| }
|
| @@ -69,58 +68,60 @@ static int I444ToARGBMatrix(const uint8* src_y, int src_stride_y,
|
| dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
| dst_stride_argb = -dst_stride_argb;
|
| }
|
| - // Coalesce rows.
|
| - if (src_stride_y == width &&
|
| - src_stride_u == width &&
|
| - src_stride_v == width &&
|
| - dst_stride_argb == width * 4) {
|
| - width *= height;
|
| - height = 1;
|
| - src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0;
|
| - }
|
| -#if defined(HAS_I444TOARGBROW_SSSE3)
|
| +#if defined(HAS_I422TOARGBROW_SSSE3)
|
| if (TestCpuFlag(kCpuHasSSSE3)) {
|
| - I444ToARGBRow = I444ToARGBRow_Any_SSSE3;
|
| + I422ToARGBRow = I422ToARGBRow_Any_SSSE3;
|
| if (IS_ALIGNED(width, 8)) {
|
| - I444ToARGBRow = I444ToARGBRow_SSSE3;
|
| + I422ToARGBRow = I422ToARGBRow_SSSE3;
|
| }
|
| }
|
| #endif
|
| -#if defined(HAS_I444TOARGBROW_AVX2)
|
| +#if defined(HAS_I422TOARGBROW_AVX2)
|
| if (TestCpuFlag(kCpuHasAVX2)) {
|
| - I444ToARGBRow = I444ToARGBRow_Any_AVX2;
|
| + I422ToARGBRow = I422ToARGBRow_Any_AVX2;
|
| if (IS_ALIGNED(width, 16)) {
|
| - I444ToARGBRow = I444ToARGBRow_AVX2;
|
| + I422ToARGBRow = I422ToARGBRow_AVX2;
|
| }
|
| }
|
| #endif
|
| -#if defined(HAS_I444TOARGBROW_NEON)
|
| +#if defined(HAS_I422TOARGBROW_NEON)
|
| if (TestCpuFlag(kCpuHasNEON)) {
|
| - I444ToARGBRow = I444ToARGBRow_Any_NEON;
|
| + I422ToARGBRow = I422ToARGBRow_Any_NEON;
|
| if (IS_ALIGNED(width, 8)) {
|
| - I444ToARGBRow = I444ToARGBRow_NEON;
|
| + I422ToARGBRow = I422ToARGBRow_NEON;
|
| }
|
| }
|
| #endif
|
| +#if defined(HAS_I422TOARGBROW_MIPS_DSPR2)
|
| + if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) &&
|
| + IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) &&
|
| + IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) &&
|
| + IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) &&
|
| + IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) {
|
| + I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2;
|
| + }
|
| +#endif
|
|
|
| for (y = 0; y < height; ++y) {
|
| - I444ToARGBRow(src_y, src_u, src_v, dst_argb, yuvconstants, width);
|
| + I422ToARGBRow(src_y, src_u, src_v, dst_argb, yuvconstants, width);
|
| dst_argb += dst_stride_argb;
|
| src_y += src_stride_y;
|
| - src_u += src_stride_u;
|
| - src_v += src_stride_v;
|
| + if (y & 1) {
|
| + src_u += src_stride_u;
|
| + src_v += src_stride_v;
|
| + }
|
| }
|
| return 0;
|
| }
|
|
|
| -// Convert I444 to ARGB.
|
| +// Convert I420 to ARGB.
|
| LIBYUV_API
|
| -int I444ToARGB(const uint8* src_y, int src_stride_y,
|
| +int I420ToARGB(const uint8* src_y, int src_stride_y,
|
| const uint8* src_u, int src_stride_u,
|
| const uint8* src_v, int src_stride_v,
|
| uint8* dst_argb, int dst_stride_argb,
|
| int width, int height) {
|
| - return I444ToARGBMatrix(src_y, src_stride_y,
|
| + return I420ToARGBMatrix(src_y, src_stride_y,
|
| src_u, src_stride_u,
|
| src_v, src_stride_v,
|
| dst_argb, dst_stride_argb,
|
| @@ -128,14 +129,14 @@ int I444ToARGB(const uint8* src_y, int src_stride_y,
|
| width, height);
|
| }
|
|
|
| -// Convert I444 to ABGR.
|
| +// Convert I420 to ABGR.
|
| LIBYUV_API
|
| -int I444ToABGR(const uint8* src_y, int src_stride_y,
|
| +int I420ToABGR(const uint8* src_y, int src_stride_y,
|
| const uint8* src_u, int src_stride_u,
|
| const uint8* src_v, int src_stride_v,
|
| uint8* dst_abgr, int dst_stride_abgr,
|
| int width, int height) {
|
| - return I444ToARGBMatrix(src_y, src_stride_y,
|
| + return I420ToARGBMatrix(src_y, src_stride_y,
|
| src_v, src_stride_v, // Swap U and V
|
| src_u, src_stride_u,
|
| dst_abgr, dst_stride_abgr,
|
| @@ -143,14 +144,14 @@ int I444ToABGR(const uint8* src_y, int src_stride_y,
|
| width, height);
|
| }
|
|
|
| -// Convert J444 to ARGB.
|
| +// Convert J420 to ARGB.
|
| LIBYUV_API
|
| -int J444ToARGB(const uint8* src_y, int src_stride_y,
|
| +int J420ToARGB(const uint8* src_y, int src_stride_y,
|
| const uint8* src_u, int src_stride_u,
|
| const uint8* src_v, int src_stride_v,
|
| uint8* dst_argb, int dst_stride_argb,
|
| int width, int height) {
|
| - return I444ToARGBMatrix(src_y, src_stride_y,
|
| + return I420ToARGBMatrix(src_y, src_stride_y,
|
| src_u, src_stride_u,
|
| src_v, src_stride_v,
|
| dst_argb, dst_stride_argb,
|
| @@ -158,13 +159,58 @@ int J444ToARGB(const uint8* src_y, int src_stride_y,
|
| width, height);
|
| }
|
|
|
| -// Convert I422 to ARGB.
|
| +// Convert J420 to ABGR.
|
| LIBYUV_API
|
| -int I422ToARGB(const uint8* src_y, int src_stride_y,
|
| +int J420ToABGR(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_abgr, int dst_stride_abgr,
|
| + int width, int height) {
|
| + return I420ToARGBMatrix(src_y, src_stride_y,
|
| + src_v, src_stride_v, // Swap U and V
|
| + src_u, src_stride_u,
|
| + dst_abgr, dst_stride_abgr,
|
| + &kYvuJConstants, // Use Yvu matrix
|
| + width, height);
|
| +}
|
| +
|
| +// Convert H420 to ARGB.
|
| +LIBYUV_API
|
| +int H420ToARGB(const uint8* src_y, int src_stride_y,
|
| const uint8* src_u, int src_stride_u,
|
| const uint8* src_v, int src_stride_v,
|
| uint8* dst_argb, int dst_stride_argb,
|
| int width, int height) {
|
| + return I420ToARGBMatrix(src_y, src_stride_y,
|
| + src_u, src_stride_u,
|
| + src_v, src_stride_v,
|
| + dst_argb, dst_stride_argb,
|
| + &kYuvHConstants,
|
| + width, height);
|
| +}
|
| +
|
| +// Convert H420 to ABGR.
|
| +LIBYUV_API
|
| +int H420ToABGR(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_abgr, int dst_stride_abgr,
|
| + int width, int height) {
|
| + return I420ToARGBMatrix(src_y, src_stride_y,
|
| + src_v, src_stride_v, // Swap U and V
|
| + src_u, src_stride_u,
|
| + dst_abgr, dst_stride_abgr,
|
| + &kYvuHConstants, // Use Yvu matrix
|
| + width, height);
|
| +}
|
| +
|
| +// Convert I422 to ARGB with matrix
|
| +static int I422ToARGBMatrix(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_argb, int dst_stride_argb,
|
| + const struct YuvConstants* yuvconstants,
|
| + int width, int height) {
|
| int y;
|
| void (*I422ToARGBRow)(const uint8* y_buf,
|
| const uint8* u_buf,
|
| @@ -227,7 +273,7 @@ int I422ToARGB(const uint8* src_y, int src_stride_y,
|
| #endif
|
|
|
| for (y = 0; y < height; ++y) {
|
| - I422ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvIConstants, width);
|
| + I422ToARGBRow(src_y, src_u, src_v, dst_argb, yuvconstants, width);
|
| dst_argb += dst_stride_argb;
|
| src_y += src_stride_y;
|
| src_u += src_stride_u;
|
| @@ -236,20 +282,110 @@ int I422ToARGB(const uint8* src_y, int src_stride_y,
|
| return 0;
|
| }
|
|
|
| -// Convert I411 to ARGB.
|
| +// Convert I422 to ARGB.
|
| LIBYUV_API
|
| -int I411ToARGB(const uint8* src_y, int src_stride_y,
|
| +int I422ToARGB(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_argb, int dst_stride_argb,
|
| + int width, int height) {
|
| + return I422ToARGBMatrix(src_y, src_stride_y,
|
| + src_u, src_stride_u,
|
| + src_v, src_stride_v,
|
| + dst_argb, dst_stride_argb,
|
| + &kYuvIConstants,
|
| + width, height);
|
| +}
|
| +
|
| +// Convert I422 to ABGR.
|
| +LIBYUV_API
|
| +int I422ToABGR(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_abgr, int dst_stride_abgr,
|
| + int width, int height) {
|
| + return I422ToARGBMatrix(src_y, src_stride_y,
|
| + src_v, src_stride_v, // Swap U and V
|
| + src_u, src_stride_u,
|
| + dst_abgr, dst_stride_abgr,
|
| + &kYvuIConstants, // Use Yvu matrix
|
| + width, height);
|
| +}
|
| +
|
| +// Convert J422 to ARGB.
|
| +LIBYUV_API
|
| +int J422ToARGB(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_argb, int dst_stride_argb,
|
| + int width, int height) {
|
| + return I422ToARGBMatrix(src_y, src_stride_y,
|
| + src_u, src_stride_u,
|
| + src_v, src_stride_v,
|
| + dst_argb, dst_stride_argb,
|
| + &kYuvJConstants,
|
| + width, height);
|
| +}
|
| +
|
| +// Convert J422 to ABGR.
|
| +LIBYUV_API
|
| +int J422ToABGR(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_abgr, int dst_stride_abgr,
|
| + int width, int height) {
|
| + return I422ToARGBMatrix(src_y, src_stride_y,
|
| + src_v, src_stride_v, // Swap U and V
|
| + src_u, src_stride_u,
|
| + dst_abgr, dst_stride_abgr,
|
| + &kYvuJConstants, // Use Yvu matrix
|
| + width, height);
|
| +}
|
| +
|
| +// Convert H422 to ARGB.
|
| +LIBYUV_API
|
| +int H422ToARGB(const uint8* src_y, int src_stride_y,
|
| const uint8* src_u, int src_stride_u,
|
| const uint8* src_v, int src_stride_v,
|
| uint8* dst_argb, int dst_stride_argb,
|
| int width, int height) {
|
| + return I422ToARGBMatrix(src_y, src_stride_y,
|
| + src_u, src_stride_u,
|
| + src_v, src_stride_v,
|
| + dst_argb, dst_stride_argb,
|
| + &kYuvHConstants,
|
| + width, height);
|
| +}
|
| +
|
| +// Convert H422 to ABGR.
|
| +LIBYUV_API
|
| +int H422ToABGR(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_abgr, int dst_stride_abgr,
|
| + int width, int height) {
|
| + return I422ToARGBMatrix(src_y, src_stride_y,
|
| + src_v, src_stride_v, // Swap U and V
|
| + src_u, src_stride_u,
|
| + dst_abgr, dst_stride_abgr,
|
| + &kYvuHConstants, // Use Yvu matrix
|
| + width, height);
|
| +}
|
| +
|
| +// Convert I444 to ARGB with matrix
|
| +static int I444ToARGBMatrix(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_argb, int dst_stride_argb,
|
| + const struct YuvConstants* yuvconstants,
|
| + int width, int height) {
|
| int y;
|
| - void (*I411ToARGBRow)(const uint8* y_buf,
|
| + void (*I444ToARGBRow)(const uint8* y_buf,
|
| const uint8* u_buf,
|
| const uint8* v_buf,
|
| uint8* rgb_buf,
|
| const struct YuvConstants* yuvconstants,
|
| - int width) = I411ToARGBRow_C;
|
| + int width) = I444ToARGBRow_C;
|
| if (!src_y || !src_u || !src_v ||
|
| !dst_argb ||
|
| width <= 0 || height == 0) {
|
| @@ -263,40 +399,40 @@ int I411ToARGB(const uint8* src_y, int src_stride_y,
|
| }
|
| // Coalesce rows.
|
| if (src_stride_y == width &&
|
| - src_stride_u * 4 == width &&
|
| - src_stride_v * 4 == width &&
|
| + src_stride_u == width &&
|
| + src_stride_v == width &&
|
| dst_stride_argb == width * 4) {
|
| width *= height;
|
| height = 1;
|
| src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0;
|
| }
|
| -#if defined(HAS_I411TOARGBROW_SSSE3)
|
| +#if defined(HAS_I444TOARGBROW_SSSE3)
|
| if (TestCpuFlag(kCpuHasSSSE3)) {
|
| - I411ToARGBRow = I411ToARGBRow_Any_SSSE3;
|
| + I444ToARGBRow = I444ToARGBRow_Any_SSSE3;
|
| if (IS_ALIGNED(width, 8)) {
|
| - I411ToARGBRow = I411ToARGBRow_SSSE3;
|
| + I444ToARGBRow = I444ToARGBRow_SSSE3;
|
| }
|
| }
|
| #endif
|
| -#if defined(HAS_I411TOARGBROW_AVX2)
|
| +#if defined(HAS_I444TOARGBROW_AVX2)
|
| if (TestCpuFlag(kCpuHasAVX2)) {
|
| - I411ToARGBRow = I411ToARGBRow_Any_AVX2;
|
| + I444ToARGBRow = I444ToARGBRow_Any_AVX2;
|
| if (IS_ALIGNED(width, 16)) {
|
| - I411ToARGBRow = I411ToARGBRow_AVX2;
|
| + I444ToARGBRow = I444ToARGBRow_AVX2;
|
| }
|
| }
|
| #endif
|
| -#if defined(HAS_I411TOARGBROW_NEON)
|
| +#if defined(HAS_I444TOARGBROW_NEON)
|
| if (TestCpuFlag(kCpuHasNEON)) {
|
| - I411ToARGBRow = I411ToARGBRow_Any_NEON;
|
| + I444ToARGBRow = I444ToARGBRow_Any_NEON;
|
| if (IS_ALIGNED(width, 8)) {
|
| - I411ToARGBRow = I411ToARGBRow_NEON;
|
| + I444ToARGBRow = I444ToARGBRow_NEON;
|
| }
|
| }
|
| #endif
|
|
|
| for (y = 0; y < height; ++y) {
|
| - I411ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvIConstants, width);
|
| + I444ToARGBRow(src_y, src_u, src_v, dst_argb, yuvconstants, width);
|
| dst_argb += dst_stride_argb;
|
| src_y += src_stride_y;
|
| src_u += src_stride_u;
|
| @@ -305,48 +441,162 @@ int I411ToARGB(const uint8* src_y, int src_stride_y,
|
| return 0;
|
| }
|
|
|
| -// Convert I420 with Alpha to preattenuated ARGB.
|
| -static int I420AlphaToARGBMatrix(const uint8* src_y, int src_stride_y,
|
| - const uint8* src_u, int src_stride_u,
|
| - const uint8* src_v, int src_stride_v,
|
| - const uint8* src_a, int src_stride_a,
|
| - uint8* dst_argb, int dst_stride_argb,
|
| - const struct YuvConstants* yuvconstants,
|
| - int width, int height, int attenuate) {
|
| - int y;
|
| - void (*I422AlphaToARGBRow)(const uint8* y_buf,
|
| - const uint8* u_buf,
|
| - const uint8* v_buf,
|
| - const uint8* a_buf,
|
| - uint8* dst_argb,
|
| - const struct YuvConstants* yuvconstants,
|
| - int width) = I422AlphaToARGBRow_C;
|
| - void (*ARGBAttenuateRow)(const uint8* src_argb, uint8* dst_argb,
|
| - int width) = ARGBAttenuateRow_C;
|
| - if (!src_y || !src_u || !src_v || !dst_argb ||
|
| - width <= 0 || height == 0) {
|
| - return -1;
|
| - }
|
| - // Negative height means invert the image.
|
| - if (height < 0) {
|
| - height = -height;
|
| - dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
| - dst_stride_argb = -dst_stride_argb;
|
| - }
|
| -#if defined(HAS_I422ALPHATOARGBROW_SSSE3)
|
| - if (TestCpuFlag(kCpuHasSSSE3)) {
|
| - I422AlphaToARGBRow = I422AlphaToARGBRow_Any_SSSE3;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422AlphaToARGBRow = I422AlphaToARGBRow_SSSE3;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422ALPHATOARGBROW_AVX2)
|
| - if (TestCpuFlag(kCpuHasAVX2)) {
|
| - I422AlphaToARGBRow = I422AlphaToARGBRow_Any_AVX2;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - I422AlphaToARGBRow = I422AlphaToARGBRow_AVX2;
|
| - }
|
| +// Convert I444 to ARGB.
|
| +LIBYUV_API
|
| +int I444ToARGB(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_argb, int dst_stride_argb,
|
| + int width, int height) {
|
| + return I444ToARGBMatrix(src_y, src_stride_y,
|
| + src_u, src_stride_u,
|
| + src_v, src_stride_v,
|
| + dst_argb, dst_stride_argb,
|
| + &kYuvIConstants,
|
| + width, height);
|
| +}
|
| +
|
| +// Convert I444 to ABGR.
|
| +LIBYUV_API
|
| +int I444ToABGR(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_abgr, int dst_stride_abgr,
|
| + int width, int height) {
|
| + return I444ToARGBMatrix(src_y, src_stride_y,
|
| + src_v, src_stride_v, // Swap U and V
|
| + src_u, src_stride_u,
|
| + dst_abgr, dst_stride_abgr,
|
| + &kYvuIConstants, // Use Yvu matrix
|
| + width, height);
|
| +}
|
| +
|
| +// Convert J444 to ARGB.
|
| +LIBYUV_API
|
| +int J444ToARGB(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_argb, int dst_stride_argb,
|
| + int width, int height) {
|
| + return I444ToARGBMatrix(src_y, src_stride_y,
|
| + src_u, src_stride_u,
|
| + src_v, src_stride_v,
|
| + dst_argb, dst_stride_argb,
|
| + &kYuvJConstants,
|
| + width, height);
|
| +}
|
| +
|
| +// Convert I411 to ARGB.
|
| +LIBYUV_API
|
| +int I411ToARGB(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + uint8* dst_argb, int dst_stride_argb,
|
| + int width, int height) {
|
| + int y;
|
| + void (*I411ToARGBRow)(const uint8* y_buf,
|
| + const uint8* u_buf,
|
| + const uint8* v_buf,
|
| + uint8* rgb_buf,
|
| + const struct YuvConstants* yuvconstants,
|
| + int width) = I411ToARGBRow_C;
|
| + if (!src_y || !src_u || !src_v ||
|
| + !dst_argb ||
|
| + width <= 0 || height == 0) {
|
| + return -1;
|
| + }
|
| + // Negative height means invert the image.
|
| + if (height < 0) {
|
| + height = -height;
|
| + dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
| + dst_stride_argb = -dst_stride_argb;
|
| + }
|
| + // Coalesce rows.
|
| + if (src_stride_y == width &&
|
| + src_stride_u * 4 == width &&
|
| + src_stride_v * 4 == width &&
|
| + dst_stride_argb == width * 4) {
|
| + width *= height;
|
| + height = 1;
|
| + src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0;
|
| + }
|
| +#if defined(HAS_I411TOARGBROW_SSSE3)
|
| + if (TestCpuFlag(kCpuHasSSSE3)) {
|
| + I411ToARGBRow = I411ToARGBRow_Any_SSSE3;
|
| + if (IS_ALIGNED(width, 8)) {
|
| + I411ToARGBRow = I411ToARGBRow_SSSE3;
|
| + }
|
| + }
|
| +#endif
|
| +#if defined(HAS_I411TOARGBROW_AVX2)
|
| + if (TestCpuFlag(kCpuHasAVX2)) {
|
| + I411ToARGBRow = I411ToARGBRow_Any_AVX2;
|
| + if (IS_ALIGNED(width, 16)) {
|
| + I411ToARGBRow = I411ToARGBRow_AVX2;
|
| + }
|
| + }
|
| +#endif
|
| +#if defined(HAS_I411TOARGBROW_NEON)
|
| + if (TestCpuFlag(kCpuHasNEON)) {
|
| + I411ToARGBRow = I411ToARGBRow_Any_NEON;
|
| + if (IS_ALIGNED(width, 8)) {
|
| + I411ToARGBRow = I411ToARGBRow_NEON;
|
| + }
|
| + }
|
| +#endif
|
| +
|
| + for (y = 0; y < height; ++y) {
|
| + I411ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvIConstants, width);
|
| + dst_argb += dst_stride_argb;
|
| + src_y += src_stride_y;
|
| + src_u += src_stride_u;
|
| + src_v += src_stride_v;
|
| + }
|
| + return 0;
|
| +}
|
| +
|
| +// Convert I420 with Alpha to preattenuated ARGB.
|
| +static int I420AlphaToARGBMatrix(const uint8* src_y, int src_stride_y,
|
| + const uint8* src_u, int src_stride_u,
|
| + const uint8* src_v, int src_stride_v,
|
| + const uint8* src_a, int src_stride_a,
|
| + uint8* dst_argb, int dst_stride_argb,
|
| + const struct YuvConstants* yuvconstants,
|
| + int width, int height, int attenuate) {
|
| + int y;
|
| + void (*I422AlphaToARGBRow)(const uint8* y_buf,
|
| + const uint8* u_buf,
|
| + const uint8* v_buf,
|
| + const uint8* a_buf,
|
| + uint8* dst_argb,
|
| + const struct YuvConstants* yuvconstants,
|
| + int width) = I422AlphaToARGBRow_C;
|
| + void (*ARGBAttenuateRow)(const uint8* src_argb, uint8* dst_argb,
|
| + int width) = ARGBAttenuateRow_C;
|
| + if (!src_y || !src_u || !src_v || !dst_argb ||
|
| + width <= 0 || height == 0) {
|
| + return -1;
|
| + }
|
| + // Negative height means invert the image.
|
| + if (height < 0) {
|
| + height = -height;
|
| + dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
| + dst_stride_argb = -dst_stride_argb;
|
| + }
|
| +#if defined(HAS_I422ALPHATOARGBROW_SSSE3)
|
| + if (TestCpuFlag(kCpuHasSSSE3)) {
|
| + I422AlphaToARGBRow = I422AlphaToARGBRow_Any_SSSE3;
|
| + if (IS_ALIGNED(width, 8)) {
|
| + I422AlphaToARGBRow = I422AlphaToARGBRow_SSSE3;
|
| + }
|
| + }
|
| +#endif
|
| +#if defined(HAS_I422ALPHATOARGBROW_AVX2)
|
| + if (TestCpuFlag(kCpuHasAVX2)) {
|
| + I422AlphaToARGBRow = I422AlphaToARGBRow_Any_AVX2;
|
| + if (IS_ALIGNED(width, 16)) {
|
| + I422AlphaToARGBRow = I422AlphaToARGBRow_AVX2;
|
| + }
|
| }
|
| #endif
|
| #if defined(HAS_I422ALPHATOARGBROW_NEON)
|
| @@ -408,7 +658,7 @@ static int I420AlphaToARGBMatrix(const uint8* src_y, int src_stride_y,
|
| return 0;
|
| }
|
|
|
| -// Convert I420 with Alpha to preattenuated ARGB.
|
| +// Convert I420 with Alpha to ARGB.
|
| LIBYUV_API
|
| int I420AlphaToARGB(const uint8* src_y, int src_stride_y,
|
| const uint8* src_u, int src_stride_u,
|
| @@ -425,7 +675,7 @@ int I420AlphaToARGB(const uint8* src_y, int src_stride_y,
|
| width, height, attenuate);
|
| }
|
|
|
| -// Convert I420 with Alpha to preattenuated ARGB.
|
| +// Convert I420 with Alpha to ABGR.
|
| LIBYUV_API
|
| int I420AlphaToABGR(const uint8* src_y, int src_stride_y,
|
| const uint8* src_u, int src_stride_u,
|
| @@ -1199,598 +1449,6 @@ int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy,
|
| return 0;
|
| }
|
|
|
| -// Convert J420 to ARGB.
|
| -LIBYUV_API
|
| -int J420ToARGB(const uint8* src_y, int src_stride_y,
|
| - const uint8* src_u, int src_stride_u,
|
| - const uint8* src_v, int src_stride_v,
|
| - uint8* dst_argb, int dst_stride_argb,
|
| - int width, int height) {
|
| - int y;
|
| - void (*I422ToARGBRow)(const uint8* y_buf,
|
| - const uint8* u_buf,
|
| - const uint8* v_buf,
|
| - uint8* rgb_buf,
|
| - const struct YuvConstants* yuvconstants,
|
| - int width) = I422ToARGBRow_C;
|
| - if (!src_y || !src_u || !src_v || !dst_argb ||
|
| - width <= 0 || height == 0) {
|
| - return -1;
|
| - }
|
| - // Negative height means invert the image.
|
| - if (height < 0) {
|
| - height = -height;
|
| - dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
| - dst_stride_argb = -dst_stride_argb;
|
| - }
|
| -#if defined(HAS_I422TOARGBROW_SSSE3)
|
| - if (TestCpuFlag(kCpuHasSSSE3)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_SSSE3;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToARGBRow = I422ToARGBRow_SSSE3;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_AVX2)
|
| - if (TestCpuFlag(kCpuHasAVX2)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_AVX2;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - I422ToARGBRow = I422ToARGBRow_AVX2;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_NEON)
|
| - if (TestCpuFlag(kCpuHasNEON)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_NEON;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToARGBRow = I422ToARGBRow_NEON;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_MIPS_DSPR2)
|
| - if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) &&
|
| - IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) &&
|
| - IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) &&
|
| - IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) &&
|
| - IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) {
|
| - I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2;
|
| - }
|
| -#endif
|
| -
|
| - for (y = 0; y < height; ++y) {
|
| - I422ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvJConstants, width);
|
| - dst_argb += dst_stride_argb;
|
| - src_y += src_stride_y;
|
| - if (y & 1) {
|
| - src_u += src_stride_u;
|
| - src_v += src_stride_v;
|
| - }
|
| - }
|
| - return 0;
|
| -}
|
| -
|
| -// Convert J422 to ARGB.
|
| -LIBYUV_API
|
| -int J422ToARGB(const uint8* src_y, int src_stride_y,
|
| - const uint8* src_u, int src_stride_u,
|
| - const uint8* src_v, int src_stride_v,
|
| - uint8* dst_argb, int dst_stride_argb,
|
| - int width, int height) {
|
| - int y;
|
| - void (*I422ToARGBRow)(const uint8* y_buf,
|
| - const uint8* u_buf,
|
| - const uint8* v_buf,
|
| - uint8* rgb_buf,
|
| - const struct YuvConstants* yuvconstants,
|
| - int width) = I422ToARGBRow_C;
|
| - if (!src_y || !src_u || !src_v ||
|
| - !dst_argb ||
|
| - width <= 0 || height == 0) {
|
| - return -1;
|
| - }
|
| - // Negative height means invert the image.
|
| - if (height < 0) {
|
| - height = -height;
|
| - dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
| - dst_stride_argb = -dst_stride_argb;
|
| - }
|
| - // Coalesce rows.
|
| - if (src_stride_y == width &&
|
| - src_stride_u * 2 == width &&
|
| - src_stride_v * 2 == width &&
|
| - dst_stride_argb == width * 4) {
|
| - width *= height;
|
| - height = 1;
|
| - src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0;
|
| - }
|
| -#if defined(HAS_I422TOARGBROW_SSSE3)
|
| - if (TestCpuFlag(kCpuHasSSSE3)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_SSSE3;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToARGBRow = I422ToARGBRow_SSSE3;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_AVX2)
|
| - if (TestCpuFlag(kCpuHasAVX2)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_AVX2;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - I422ToARGBRow = I422ToARGBRow_AVX2;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_NEON)
|
| - if (TestCpuFlag(kCpuHasNEON)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_NEON;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToARGBRow = I422ToARGBRow_NEON;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_MIPS_DSPR2)
|
| - if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) &&
|
| - IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) &&
|
| - IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) &&
|
| - IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) &&
|
| - IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) {
|
| - I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2;
|
| - }
|
| -#endif
|
| -
|
| - for (y = 0; y < height; ++y) {
|
| - I422ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvJConstants, width);
|
| - dst_argb += dst_stride_argb;
|
| - src_y += src_stride_y;
|
| - src_u += src_stride_u;
|
| - src_v += src_stride_v;
|
| - }
|
| - return 0;
|
| -}
|
| -
|
| -// Convert J420 to ABGR.
|
| -LIBYUV_API
|
| -int J420ToABGR(const uint8* src_y, int src_stride_y,
|
| - const uint8* src_u, int src_stride_u,
|
| - const uint8* src_v, int src_stride_v,
|
| - uint8* dst_abgr, int dst_stride_abgr,
|
| - int width, int height) {
|
| - int y;
|
| - void (*I422ToABGRRow)(const uint8* y_buf,
|
| - const uint8* u_buf,
|
| - const uint8* v_buf,
|
| - uint8* rgb_buf,
|
| - const struct YuvConstants* yuvconstants,
|
| - int width) = I422ToABGRRow_C;
|
| - if (!src_y || !src_u || !src_v || !dst_abgr ||
|
| - width <= 0 || height == 0) {
|
| - return -1;
|
| - }
|
| - // Negative height means invert the image.
|
| - if (height < 0) {
|
| - height = -height;
|
| - dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr;
|
| - dst_stride_abgr = -dst_stride_abgr;
|
| - }
|
| -#if defined(HAS_I422TOABGRROW_SSSE3)
|
| - if (TestCpuFlag(kCpuHasSSSE3)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_SSSE3;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToABGRRow = I422ToABGRRow_SSSE3;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_AVX2)
|
| - if (TestCpuFlag(kCpuHasAVX2)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_AVX2;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - I422ToABGRRow = I422ToABGRRow_AVX2;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_NEON)
|
| - if (TestCpuFlag(kCpuHasNEON)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_NEON;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToABGRRow = I422ToABGRRow_NEON;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_MIPS_DSPR2)
|
| - if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) &&
|
| - IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) &&
|
| - IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) &&
|
| - IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) &&
|
| - IS_ALIGNED(dst_abgr, 4) && IS_ALIGNED(dst_stride_abgr, 4)) {
|
| - I422ToABGRRow = I422ToABGRRow_MIPS_DSPR2;
|
| - }
|
| -#endif
|
| -
|
| - for (y = 0; y < height; ++y) {
|
| - I422ToABGRRow(src_y, src_u, src_v, dst_abgr, &kYuvJConstants, width);
|
| - dst_abgr += dst_stride_abgr;
|
| - src_y += src_stride_y;
|
| - if (y & 1) {
|
| - src_u += src_stride_u;
|
| - src_v += src_stride_v;
|
| - }
|
| - }
|
| - return 0;
|
| -}
|
| -
|
| -// Convert J422 to ABGR.
|
| -LIBYUV_API
|
| -int J422ToABGR(const uint8* src_y, int src_stride_y,
|
| - const uint8* src_u, int src_stride_u,
|
| - const uint8* src_v, int src_stride_v,
|
| - uint8* dst_abgr, int dst_stride_abgr,
|
| - int width, int height) {
|
| - int y;
|
| - void (*I422ToABGRRow)(const uint8* y_buf,
|
| - const uint8* u_buf,
|
| - const uint8* v_buf,
|
| - uint8* rgb_buf,
|
| - const struct YuvConstants* yuvconstants,
|
| - int width) = I422ToABGRRow_C;
|
| - if (!src_y || !src_u || !src_v ||
|
| - !dst_abgr ||
|
| - width <= 0 || height == 0) {
|
| - return -1;
|
| - }
|
| - // Negative height means invert the image.
|
| - if (height < 0) {
|
| - height = -height;
|
| - dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr;
|
| - dst_stride_abgr = -dst_stride_abgr;
|
| - }
|
| - // Coalesce rows.
|
| - if (src_stride_y == width &&
|
| - src_stride_u * 2 == width &&
|
| - src_stride_v * 2 == width &&
|
| - dst_stride_abgr == width * 4) {
|
| - width *= height;
|
| - height = 1;
|
| - src_stride_y = src_stride_u = src_stride_v = dst_stride_abgr = 0;
|
| - }
|
| -#if defined(HAS_I422TOABGRROW_SSSE3)
|
| - if (TestCpuFlag(kCpuHasSSSE3)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_SSSE3;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToABGRRow = I422ToABGRRow_SSSE3;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_AVX2)
|
| - if (TestCpuFlag(kCpuHasAVX2)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_AVX2;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - I422ToABGRRow = I422ToABGRRow_AVX2;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_NEON)
|
| - if (TestCpuFlag(kCpuHasNEON)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_NEON;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToABGRRow = I422ToABGRRow_NEON;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_MIPS_DSPR2)
|
| - if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) &&
|
| - IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) &&
|
| - IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) &&
|
| - IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) &&
|
| - IS_ALIGNED(dst_abgr, 4) && IS_ALIGNED(dst_stride_abgr, 4)) {
|
| - I422ToABGRRow = I422ToABGRRow_MIPS_DSPR2;
|
| - }
|
| -#endif
|
| -
|
| - for (y = 0; y < height; ++y) {
|
| - I422ToABGRRow(src_y, src_u, src_v, dst_abgr, &kYuvJConstants, width);
|
| - dst_abgr += dst_stride_abgr;
|
| - src_y += src_stride_y;
|
| - src_u += src_stride_u;
|
| - src_v += src_stride_v;
|
| - }
|
| - return 0;
|
| -}
|
| -
|
| -// Convert H420 to ARGB.
|
| -LIBYUV_API
|
| -int H420ToARGB(const uint8* src_y, int src_stride_y,
|
| - const uint8* src_u, int src_stride_u,
|
| - const uint8* src_v, int src_stride_v,
|
| - uint8* dst_argb, int dst_stride_argb,
|
| - int width, int height) {
|
| - int y;
|
| - void (*I422ToARGBRow)(const uint8* y_buf,
|
| - const uint8* u_buf,
|
| - const uint8* v_buf,
|
| - uint8* rgb_buf,
|
| - const struct YuvConstants* yuvconstants,
|
| - int width) = I422ToARGBRow_C;
|
| - if (!src_y || !src_u || !src_v || !dst_argb ||
|
| - width <= 0 || height == 0) {
|
| - return -1;
|
| - }
|
| - // Negative height means invert the image.
|
| - if (height < 0) {
|
| - height = -height;
|
| - dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
| - dst_stride_argb = -dst_stride_argb;
|
| - }
|
| -#if defined(HAS_I422TOARGBROW_SSSE3)
|
| - if (TestCpuFlag(kCpuHasSSSE3)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_SSSE3;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToARGBRow = I422ToARGBRow_SSSE3;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_AVX2)
|
| - if (TestCpuFlag(kCpuHasAVX2)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_AVX2;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - I422ToARGBRow = I422ToARGBRow_AVX2;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_NEON)
|
| - if (TestCpuFlag(kCpuHasNEON)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_NEON;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToARGBRow = I422ToARGBRow_NEON;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_MIPS_DSPR2)
|
| - if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) &&
|
| - IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) &&
|
| - IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) &&
|
| - IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) &&
|
| - IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) {
|
| - I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2;
|
| - }
|
| -#endif
|
| -
|
| - for (y = 0; y < height; ++y) {
|
| - I422ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvHConstants, width);
|
| - dst_argb += dst_stride_argb;
|
| - src_y += src_stride_y;
|
| - if (y & 1) {
|
| - src_u += src_stride_u;
|
| - src_v += src_stride_v;
|
| - }
|
| - }
|
| - return 0;
|
| -}
|
| -
|
| -// Convert H422 to ARGB.
|
| -LIBYUV_API
|
| -int H422ToARGB(const uint8* src_y, int src_stride_y,
|
| - const uint8* src_u, int src_stride_u,
|
| - const uint8* src_v, int src_stride_v,
|
| - uint8* dst_argb, int dst_stride_argb,
|
| - int width, int height) {
|
| - int y;
|
| - void (*I422ToARGBRow)(const uint8* y_buf,
|
| - const uint8* u_buf,
|
| - const uint8* v_buf,
|
| - uint8* rgb_buf,
|
| - const struct YuvConstants* yuvconstants,
|
| - int width) = I422ToARGBRow_C;
|
| - if (!src_y || !src_u || !src_v ||
|
| - !dst_argb ||
|
| - width <= 0 || height == 0) {
|
| - return -1;
|
| - }
|
| - // Negative height means invert the image.
|
| - if (height < 0) {
|
| - height = -height;
|
| - dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
| - dst_stride_argb = -dst_stride_argb;
|
| - }
|
| - // Coalesce rows.
|
| - if (src_stride_y == width &&
|
| - src_stride_u * 2 == width &&
|
| - src_stride_v * 2 == width &&
|
| - dst_stride_argb == width * 4) {
|
| - width *= height;
|
| - height = 1;
|
| - src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0;
|
| - }
|
| -#if defined(HAS_I422TOARGBROW_SSSE3)
|
| - if (TestCpuFlag(kCpuHasSSSE3)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_SSSE3;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToARGBRow = I422ToARGBRow_SSSE3;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_AVX2)
|
| - if (TestCpuFlag(kCpuHasAVX2)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_AVX2;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - I422ToARGBRow = I422ToARGBRow_AVX2;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_NEON)
|
| - if (TestCpuFlag(kCpuHasNEON)) {
|
| - I422ToARGBRow = I422ToARGBRow_Any_NEON;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToARGBRow = I422ToARGBRow_NEON;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOARGBROW_MIPS_DSPR2)
|
| - if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) &&
|
| - IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) &&
|
| - IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) &&
|
| - IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) &&
|
| - IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) {
|
| - I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2;
|
| - }
|
| -#endif
|
| -
|
| - for (y = 0; y < height; ++y) {
|
| - I422ToARGBRow(src_y, src_u, src_v, dst_argb, &kYuvHConstants, width);
|
| - dst_argb += dst_stride_argb;
|
| - src_y += src_stride_y;
|
| - src_u += src_stride_u;
|
| - src_v += src_stride_v;
|
| - }
|
| - return 0;
|
| -}
|
| -
|
| -// Convert H420 to ABGR.
|
| -LIBYUV_API
|
| -int H420ToABGR(const uint8* src_y, int src_stride_y,
|
| - const uint8* src_u, int src_stride_u,
|
| - const uint8* src_v, int src_stride_v,
|
| - uint8* dst_abgr, int dst_stride_abgr,
|
| - int width, int height) {
|
| - int y;
|
| - void (*I422ToABGRRow)(const uint8* y_buf,
|
| - const uint8* u_buf,
|
| - const uint8* v_buf,
|
| - uint8* rgb_buf,
|
| - const struct YuvConstants* yuvconstants,
|
| - int width) = I422ToABGRRow_C;
|
| - if (!src_y || !src_u || !src_v || !dst_abgr ||
|
| - width <= 0 || height == 0) {
|
| - return -1;
|
| - }
|
| - // Negative height means invert the image.
|
| - if (height < 0) {
|
| - height = -height;
|
| - dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr;
|
| - dst_stride_abgr = -dst_stride_abgr;
|
| - }
|
| -#if defined(HAS_I422TOABGRROW_SSSE3)
|
| - if (TestCpuFlag(kCpuHasSSSE3)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_SSSE3;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToABGRRow = I422ToABGRRow_SSSE3;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_AVX2)
|
| - if (TestCpuFlag(kCpuHasAVX2)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_AVX2;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - I422ToABGRRow = I422ToABGRRow_AVX2;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_NEON)
|
| - if (TestCpuFlag(kCpuHasNEON)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_NEON;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToABGRRow = I422ToABGRRow_NEON;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_MIPS_DSPR2)
|
| - if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) &&
|
| - IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) &&
|
| - IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) &&
|
| - IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) &&
|
| - IS_ALIGNED(dst_abgr, 4) && IS_ALIGNED(dst_stride_abgr, 4)) {
|
| - I422ToABGRRow = I422ToABGRRow_MIPS_DSPR2;
|
| - }
|
| -#endif
|
| -
|
| - for (y = 0; y < height; ++y) {
|
| - I422ToABGRRow(src_y, src_u, src_v, dst_abgr, &kYuvHConstants, width);
|
| - dst_abgr += dst_stride_abgr;
|
| - src_y += src_stride_y;
|
| - if (y & 1) {
|
| - src_u += src_stride_u;
|
| - src_v += src_stride_v;
|
| - }
|
| - }
|
| - return 0;
|
| -}
|
| -
|
| -// Convert H422 to ABGR.
|
| -LIBYUV_API
|
| -int H422ToABGR(const uint8* src_y, int src_stride_y,
|
| - const uint8* src_u, int src_stride_u,
|
| - const uint8* src_v, int src_stride_v,
|
| - uint8* dst_abgr, int dst_stride_abgr,
|
| - int width, int height) {
|
| - int y;
|
| - void (*I422ToABGRRow)(const uint8* y_buf,
|
| - const uint8* u_buf,
|
| - const uint8* v_buf,
|
| - uint8* rgb_buf,
|
| - const struct YuvConstants* yuvconstants,
|
| - int width) = I422ToABGRRow_C;
|
| - if (!src_y || !src_u || !src_v ||
|
| - !dst_abgr ||
|
| - width <= 0 || height == 0) {
|
| - return -1;
|
| - }
|
| - // Negative height means invert the image.
|
| - if (height < 0) {
|
| - height = -height;
|
| - dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr;
|
| - dst_stride_abgr = -dst_stride_abgr;
|
| - }
|
| - // Coalesce rows.
|
| - if (src_stride_y == width &&
|
| - src_stride_u * 2 == width &&
|
| - src_stride_v * 2 == width &&
|
| - dst_stride_abgr == width * 4) {
|
| - width *= height;
|
| - height = 1;
|
| - src_stride_y = src_stride_u = src_stride_v = dst_stride_abgr = 0;
|
| - }
|
| -#if defined(HAS_I422TOABGRROW_SSSE3)
|
| - if (TestCpuFlag(kCpuHasSSSE3)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_SSSE3;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToABGRRow = I422ToABGRRow_SSSE3;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_AVX2)
|
| - if (TestCpuFlag(kCpuHasAVX2)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_AVX2;
|
| - if (IS_ALIGNED(width, 16)) {
|
| - I422ToABGRRow = I422ToABGRRow_AVX2;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_NEON)
|
| - if (TestCpuFlag(kCpuHasNEON)) {
|
| - I422ToABGRRow = I422ToABGRRow_Any_NEON;
|
| - if (IS_ALIGNED(width, 8)) {
|
| - I422ToABGRRow = I422ToABGRRow_NEON;
|
| - }
|
| - }
|
| -#endif
|
| -#if defined(HAS_I422TOABGRROW_MIPS_DSPR2)
|
| - if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) &&
|
| - IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) &&
|
| - IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) &&
|
| - IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) &&
|
| - IS_ALIGNED(dst_abgr, 4) && IS_ALIGNED(dst_stride_abgr, 4)) {
|
| - I422ToABGRRow = I422ToABGRRow_MIPS_DSPR2;
|
| - }
|
| -#endif
|
| -
|
| - for (y = 0; y < height; ++y) {
|
| - I422ToABGRRow(src_y, src_u, src_v, dst_abgr, &kYuvHConstants, width);
|
| - dst_abgr += dst_stride_abgr;
|
| - src_y += src_stride_y;
|
| - src_u += src_stride_u;
|
| - src_v += src_stride_v;
|
| - }
|
| - return 0;
|
| -}
|
| -
|
| #ifdef __cplusplus
|
| } // extern "C"
|
| } // namespace libyuv
|
|
|