mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-02-16 23:29:52 +08:00
Add I422AlphaToARGB and I444AlphaToARGB
Bug: libyuv:878 Change-Id: I64c314326ac7ae5242acc64e20016e30adc6d17f Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2639439 Reviewed-by: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
parent
93b1b332cd
commit
08d0dce5fc
@ -49,6 +49,10 @@ LIBYUV_API extern const struct YuvConstants kYvu2020Constants; // BT.2020
|
|||||||
NV12ToRGB24Matrix(a, b, c, d, e, f, g##VU, h, i)
|
NV12ToRGB24Matrix(a, b, c, d, e, f, g##VU, h, i)
|
||||||
#define I420AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \
|
#define I420AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \
|
||||||
I420AlphaToARGBMatrix(a, b, e, f, c, d, g, h, i, j, k##VU, l, m, n)
|
I420AlphaToARGBMatrix(a, b, e, f, c, d, g, h, i, j, k##VU, l, m, n)
|
||||||
|
#define I422AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \
|
||||||
|
I422AlphaToARGBMatrix(a, b, e, f, c, d, g, h, i, j, k##VU, l, m, n)
|
||||||
|
#define I444AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \
|
||||||
|
I444AlphaToARGBMatrix(a, b, e, f, c, d, g, h, i, j, k##VU, l, m, n)
|
||||||
|
|
||||||
// Alias.
|
// Alias.
|
||||||
#define ARGBToARGB ARGBCopy
|
#define ARGBToARGB ARGBCopy
|
||||||
@ -562,6 +566,70 @@ int I420AlphaToABGR(const uint8_t* src_y,
|
|||||||
int height,
|
int height,
|
||||||
int attenuate);
|
int attenuate);
|
||||||
|
|
||||||
|
// Convert I422 with Alpha to preattenuated ARGB.
|
||||||
|
LIBYUV_API
|
||||||
|
int I422AlphaToARGB(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
int dst_stride_argb,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate);
|
||||||
|
|
||||||
|
// Convert I422 with Alpha to preattenuated ABGR.
|
||||||
|
LIBYUV_API
|
||||||
|
int I422AlphaToABGR(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_abgr,
|
||||||
|
int dst_stride_abgr,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate);
|
||||||
|
|
||||||
|
// Convert I444 with Alpha to preattenuated ARGB.
|
||||||
|
LIBYUV_API
|
||||||
|
int I444AlphaToARGB(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
int dst_stride_argb,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate);
|
||||||
|
|
||||||
|
// Convert I444 with Alpha to preattenuated ABGR.
|
||||||
|
LIBYUV_API
|
||||||
|
int I444AlphaToABGR(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_abgr,
|
||||||
|
int dst_stride_abgr,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate);
|
||||||
|
|
||||||
// Convert I400 (grey) to ARGB. Reverse of ARGBToI400.
|
// Convert I400 (grey) to ARGB. Reverse of ARGBToI400.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int I400ToARGB(const uint8_t* src_y,
|
int I400ToARGB(const uint8_t* src_y,
|
||||||
@ -1412,6 +1480,40 @@ int I420AlphaToARGBMatrix(const uint8_t* src_y,
|
|||||||
int height,
|
int height,
|
||||||
int attenuate);
|
int attenuate);
|
||||||
|
|
||||||
|
// Convert I422 with Alpha to preattenuated ARGB with matrix.
|
||||||
|
LIBYUV_API
|
||||||
|
int I422AlphaToARGBMatrix(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
int dst_stride_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate);
|
||||||
|
|
||||||
|
// Convert I444 with Alpha to preattenuated ARGB with matrix.
|
||||||
|
LIBYUV_API
|
||||||
|
int I444AlphaToARGBMatrix(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
int dst_stride_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate);
|
||||||
|
|
||||||
// Convert NV12 to ARGB with matrix.
|
// Convert NV12 to ARGB with matrix.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int NV12ToARGBMatrix(const uint8_t* src_y,
|
int NV12ToARGBMatrix(const uint8_t* src_y,
|
||||||
|
|||||||
@ -175,6 +175,7 @@ extern "C" {
|
|||||||
defined(_MSC_VER)
|
defined(_MSC_VER)
|
||||||
// TODO(fbarchard): fix build error on android_full_debug=1
|
// TODO(fbarchard): fix build error on android_full_debug=1
|
||||||
// https://code.google.com/p/libyuv/issues/detail?id=517
|
// https://code.google.com/p/libyuv/issues/detail?id=517
|
||||||
|
#define HAS_I444ALPHATOARGBROW_SSSE3
|
||||||
#define HAS_I422ALPHATOARGBROW_SSSE3
|
#define HAS_I422ALPHATOARGBROW_SSSE3
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -239,6 +240,7 @@ extern "C" {
|
|||||||
defined(_MSC_VER)
|
defined(_MSC_VER)
|
||||||
// TODO(fbarchard): fix build error on android_full_debug=1
|
// TODO(fbarchard): fix build error on android_full_debug=1
|
||||||
// https://code.google.com/p/libyuv/issues/detail?id=517
|
// https://code.google.com/p/libyuv/issues/detail?id=517
|
||||||
|
#define HAS_I444ALPHATOARGBROW_AVX2
|
||||||
#define HAS_I422ALPHATOARGBROW_AVX2
|
#define HAS_I422ALPHATOARGBROW_AVX2
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -259,6 +261,8 @@ extern "C" {
|
|||||||
// The following are also available on x64 Visual C.
|
// The following are also available on x64 Visual C.
|
||||||
#if !defined(LIBYUV_DISABLE_X86) && defined(_MSC_VER) && defined(_M_X64) && \
|
#if !defined(LIBYUV_DISABLE_X86) && defined(_MSC_VER) && defined(_M_X64) && \
|
||||||
(!defined(__clang__) || defined(__SSSE3__))
|
(!defined(__clang__) || defined(__SSSE3__))
|
||||||
|
#define HAS_I444ALPHATOARGBROW_SSSE3
|
||||||
|
#define HAS_I444TOARGBROW_SSSE3
|
||||||
#define HAS_I422ALPHATOARGBROW_SSSE3
|
#define HAS_I422ALPHATOARGBROW_SSSE3
|
||||||
#define HAS_I422TOARGBROW_SSSE3
|
#define HAS_I422TOARGBROW_SSSE3
|
||||||
#endif
|
#endif
|
||||||
@ -357,6 +361,7 @@ extern "C" {
|
|||||||
#define HAS_HALFFLOATROW_NEON
|
#define HAS_HALFFLOATROW_NEON
|
||||||
#define HAS_HALFMERGEUVROW_NEON
|
#define HAS_HALFMERGEUVROW_NEON
|
||||||
#define HAS_I400TOARGBROW_NEON
|
#define HAS_I400TOARGBROW_NEON
|
||||||
|
#define HAS_I444ALPHATOARGBROW_NEON
|
||||||
#define HAS_I422ALPHATOARGBROW_NEON
|
#define HAS_I422ALPHATOARGBROW_NEON
|
||||||
#define HAS_I422TOARGB1555ROW_NEON
|
#define HAS_I422TOARGB1555ROW_NEON
|
||||||
#define HAS_I422TOARGB4444ROW_NEON
|
#define HAS_I422TOARGB4444ROW_NEON
|
||||||
@ -795,6 +800,13 @@ void I422ToARGBRow_NEON(const uint8_t* src_y,
|
|||||||
uint8_t* dst_argb,
|
uint8_t* dst_argb,
|
||||||
const struct YuvConstants* yuvconstants,
|
const struct YuvConstants* yuvconstants,
|
||||||
int width);
|
int width);
|
||||||
|
void I444AlphaToARGBRow_NEON(const uint8_t* src_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width);
|
||||||
void I422AlphaToARGBRow_NEON(const uint8_t* src_y,
|
void I422AlphaToARGBRow_NEON(const uint8_t* src_y,
|
||||||
const uint8_t* src_u,
|
const uint8_t* src_u,
|
||||||
const uint8_t* src_v,
|
const uint8_t* src_v,
|
||||||
@ -802,12 +814,6 @@ void I422AlphaToARGBRow_NEON(const uint8_t* src_y,
|
|||||||
uint8_t* dst_argb,
|
uint8_t* dst_argb,
|
||||||
const struct YuvConstants* yuvconstants,
|
const struct YuvConstants* yuvconstants,
|
||||||
int width);
|
int width);
|
||||||
void I422ToARGBRow_NEON(const uint8_t* src_y,
|
|
||||||
const uint8_t* src_u,
|
|
||||||
const uint8_t* src_v,
|
|
||||||
uint8_t* dst_argb,
|
|
||||||
const struct YuvConstants* yuvconstants,
|
|
||||||
int width);
|
|
||||||
void I422ToRGBARow_NEON(const uint8_t* src_y,
|
void I422ToRGBARow_NEON(const uint8_t* src_y,
|
||||||
const uint8_t* src_u,
|
const uint8_t* src_u,
|
||||||
const uint8_t* src_v,
|
const uint8_t* src_v,
|
||||||
@ -2306,6 +2312,13 @@ void I210ToARGBRow_C(const uint16_t* src_y,
|
|||||||
uint8_t* rgb_buf,
|
uint8_t* rgb_buf,
|
||||||
const struct YuvConstants* yuvconstants,
|
const struct YuvConstants* yuvconstants,
|
||||||
int width);
|
int width);
|
||||||
|
void I444AlphaToARGBRow_C(const uint8_t* src_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
uint8_t* rgb_buf,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width);
|
||||||
void I422AlphaToARGBRow_C(const uint8_t* src_y,
|
void I422AlphaToARGBRow_C(const uint8_t* src_y,
|
||||||
const uint8_t* src_u,
|
const uint8_t* src_u,
|
||||||
const uint8_t* src_v,
|
const uint8_t* src_v,
|
||||||
@ -2404,18 +2417,6 @@ void I444ToARGBRow_AVX2(const uint8_t* y_buf,
|
|||||||
uint8_t* dst_argb,
|
uint8_t* dst_argb,
|
||||||
const struct YuvConstants* yuvconstants,
|
const struct YuvConstants* yuvconstants,
|
||||||
int width);
|
int width);
|
||||||
void I444ToARGBRow_SSSE3(const uint8_t* y_buf,
|
|
||||||
const uint8_t* u_buf,
|
|
||||||
const uint8_t* v_buf,
|
|
||||||
uint8_t* dst_argb,
|
|
||||||
const struct YuvConstants* yuvconstants,
|
|
||||||
int width);
|
|
||||||
void I444ToARGBRow_AVX2(const uint8_t* y_buf,
|
|
||||||
const uint8_t* u_buf,
|
|
||||||
const uint8_t* v_buf,
|
|
||||||
uint8_t* dst_argb,
|
|
||||||
const struct YuvConstants* yuvconstants,
|
|
||||||
int width);
|
|
||||||
void I422ToARGBRow_SSSE3(const uint8_t* y_buf,
|
void I422ToARGBRow_SSSE3(const uint8_t* y_buf,
|
||||||
const uint8_t* u_buf,
|
const uint8_t* u_buf,
|
||||||
const uint8_t* v_buf,
|
const uint8_t* v_buf,
|
||||||
@ -2459,6 +2460,20 @@ void I210ToAR30Row_AVX2(const uint16_t* y_buf,
|
|||||||
uint8_t* dst_ar30,
|
uint8_t* dst_ar30,
|
||||||
const struct YuvConstants* yuvconstants,
|
const struct YuvConstants* yuvconstants,
|
||||||
int width);
|
int width);
|
||||||
|
void I444AlphaToARGBRow_SSSE3(const uint8_t* y_buf,
|
||||||
|
const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf,
|
||||||
|
const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width);
|
||||||
|
void I444AlphaToARGBRow_AVX2(const uint8_t* y_buf,
|
||||||
|
const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf,
|
||||||
|
const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width);
|
||||||
void I422AlphaToARGBRow_SSSE3(const uint8_t* y_buf,
|
void I422AlphaToARGBRow_SSSE3(const uint8_t* y_buf,
|
||||||
const uint8_t* u_buf,
|
const uint8_t* u_buf,
|
||||||
const uint8_t* v_buf,
|
const uint8_t* v_buf,
|
||||||
@ -2663,6 +2678,20 @@ void I210ToAR30Row_Any_AVX2(const uint16_t* y_buf,
|
|||||||
uint8_t* dst_ptr,
|
uint8_t* dst_ptr,
|
||||||
const struct YuvConstants* yuvconstants,
|
const struct YuvConstants* yuvconstants,
|
||||||
int width);
|
int width);
|
||||||
|
void I444AlphaToARGBRow_Any_SSSE3(const uint8_t* y_buf,
|
||||||
|
const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf,
|
||||||
|
const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_ptr,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width);
|
||||||
|
void I444AlphaToARGBRow_Any_AVX2(const uint8_t* y_buf,
|
||||||
|
const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf,
|
||||||
|
const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_ptr,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width);
|
||||||
void I422AlphaToARGBRow_Any_SSSE3(const uint8_t* y_buf,
|
void I422AlphaToARGBRow_Any_SSSE3(const uint8_t* y_buf,
|
||||||
const uint8_t* u_buf,
|
const uint8_t* u_buf,
|
||||||
const uint8_t* v_buf,
|
const uint8_t* v_buf,
|
||||||
@ -3164,6 +3193,13 @@ void I422ToARGBRow_Any_NEON(const uint8_t* y_buf,
|
|||||||
uint8_t* dst_ptr,
|
uint8_t* dst_ptr,
|
||||||
const struct YuvConstants* yuvconstants,
|
const struct YuvConstants* yuvconstants,
|
||||||
int width);
|
int width);
|
||||||
|
void I444AlphaToARGBRow_Any_NEON(const uint8_t* y_buf,
|
||||||
|
const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf,
|
||||||
|
const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_ptr,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width);
|
||||||
void I422AlphaToARGBRow_Any_NEON(const uint8_t* y_buf,
|
void I422AlphaToARGBRow_Any_NEON(const uint8_t* y_buf,
|
||||||
const uint8_t* u_buf,
|
const uint8_t* u_buf,
|
||||||
const uint8_t* v_buf,
|
const uint8_t* v_buf,
|
||||||
|
|||||||
@ -1516,6 +1516,264 @@ int I420AlphaToARGBMatrix(const uint8_t* src_y,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert I422 with Alpha to preattenuated ARGB with matrix.
|
||||||
|
LIBYUV_API
|
||||||
|
int I422AlphaToARGBMatrix(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
int dst_stride_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate) {
|
||||||
|
int y;
|
||||||
|
void (*I422AlphaToARGBRow)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf, const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) = I422AlphaToARGBRow_C;
|
||||||
|
void (*ARGBAttenuateRow)(const uint8_t* src_argb, uint8_t* 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)
|
||||||
|
if (TestCpuFlag(kCpuHasNEON)) {
|
||||||
|
I422AlphaToARGBRow = I422AlphaToARGBRow_Any_NEON;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
I422AlphaToARGBRow = I422AlphaToARGBRow_NEON;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_I422ALPHATOARGBROW_MMI)
|
||||||
|
if (TestCpuFlag(kCpuHasMMI)) {
|
||||||
|
I422AlphaToARGBRow = I422AlphaToARGBRow_Any_MMI;
|
||||||
|
if (IS_ALIGNED(width, 4)) {
|
||||||
|
I422AlphaToARGBRow = I422AlphaToARGBRow_MMI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_I422ALPHATOARGBROW_MSA)
|
||||||
|
if (TestCpuFlag(kCpuHasMSA)) {
|
||||||
|
I422AlphaToARGBRow = I422AlphaToARGBRow_Any_MSA;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
I422AlphaToARGBRow = I422AlphaToARGBRow_MSA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_ARGBATTENUATEROW_SSSE3)
|
||||||
|
if (TestCpuFlag(kCpuHasSSSE3)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_Any_SSSE3;
|
||||||
|
if (IS_ALIGNED(width, 4)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_SSSE3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_ARGBATTENUATEROW_AVX2)
|
||||||
|
if (TestCpuFlag(kCpuHasAVX2)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_Any_AVX2;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_AVX2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_ARGBATTENUATEROW_NEON)
|
||||||
|
if (TestCpuFlag(kCpuHasNEON)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_NEON;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_ARGBATTENUATEROW_MMI)
|
||||||
|
if (TestCpuFlag(kCpuHasMMI)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_Any_MMI;
|
||||||
|
if (IS_ALIGNED(width, 2)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_MMI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_ARGBATTENUATEROW_MSA)
|
||||||
|
if (TestCpuFlag(kCpuHasMSA)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_Any_MSA;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_MSA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (y = 0; y < height; ++y) {
|
||||||
|
I422AlphaToARGBRow(src_y, src_u, src_v, src_a, dst_argb, yuvconstants,
|
||||||
|
width);
|
||||||
|
if (attenuate) {
|
||||||
|
ARGBAttenuateRow(dst_argb, dst_argb, width);
|
||||||
|
}
|
||||||
|
dst_argb += dst_stride_argb;
|
||||||
|
src_a += src_stride_a;
|
||||||
|
src_y += src_stride_y;
|
||||||
|
src_u += src_stride_u;
|
||||||
|
src_v += src_stride_v;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert I444 with Alpha to preattenuated ARGB with matrix.
|
||||||
|
LIBYUV_API
|
||||||
|
int I444AlphaToARGBMatrix(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
int dst_stride_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate) {
|
||||||
|
int y;
|
||||||
|
void (*I444AlphaToARGBRow)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf, const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) = I444AlphaToARGBRow_C;
|
||||||
|
void (*ARGBAttenuateRow)(const uint8_t* src_argb, uint8_t* 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_I444ALPHATOARGBROW_SSSE3)
|
||||||
|
if (TestCpuFlag(kCpuHasSSSE3)) {
|
||||||
|
I444AlphaToARGBRow = I444AlphaToARGBRow_Any_SSSE3;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
I444AlphaToARGBRow = I444AlphaToARGBRow_SSSE3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_I444ALPHATOARGBROW_AVX2)
|
||||||
|
if (TestCpuFlag(kCpuHasAVX2)) {
|
||||||
|
I444AlphaToARGBRow = I444AlphaToARGBRow_Any_AVX2;
|
||||||
|
if (IS_ALIGNED(width, 16)) {
|
||||||
|
I444AlphaToARGBRow = I444AlphaToARGBRow_AVX2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_I444ALPHATOARGBROW_NEON)
|
||||||
|
if (TestCpuFlag(kCpuHasNEON)) {
|
||||||
|
I444AlphaToARGBRow = I444AlphaToARGBRow_Any_NEON;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
I444AlphaToARGBRow = I444AlphaToARGBRow_NEON;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_I444ALPHATOARGBROW_MMI)
|
||||||
|
if (TestCpuFlag(kCpuHasMMI)) {
|
||||||
|
I444AlphaToARGBRow = I444AlphaToARGBRow_Any_MMI;
|
||||||
|
if (IS_ALIGNED(width, 4)) {
|
||||||
|
I444AlphaToARGBRow = I444AlphaToARGBRow_MMI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_I444ALPHATOARGBROW_MSA)
|
||||||
|
if (TestCpuFlag(kCpuHasMSA)) {
|
||||||
|
I444AlphaToARGBRow = I444AlphaToARGBRow_Any_MSA;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
I444AlphaToARGBRow = I444AlphaToARGBRow_MSA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_ARGBATTENUATEROW_SSSE3)
|
||||||
|
if (TestCpuFlag(kCpuHasSSSE3)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_Any_SSSE3;
|
||||||
|
if (IS_ALIGNED(width, 4)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_SSSE3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_ARGBATTENUATEROW_AVX2)
|
||||||
|
if (TestCpuFlag(kCpuHasAVX2)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_Any_AVX2;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_AVX2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_ARGBATTENUATEROW_NEON)
|
||||||
|
if (TestCpuFlag(kCpuHasNEON)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_NEON;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_ARGBATTENUATEROW_MMI)
|
||||||
|
if (TestCpuFlag(kCpuHasMMI)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_Any_MMI;
|
||||||
|
if (IS_ALIGNED(width, 2)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_MMI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_ARGBATTENUATEROW_MSA)
|
||||||
|
if (TestCpuFlag(kCpuHasMSA)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_Any_MSA;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
ARGBAttenuateRow = ARGBAttenuateRow_MSA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (y = 0; y < height; ++y) {
|
||||||
|
I444AlphaToARGBRow(src_y, src_u, src_v, src_a, dst_argb, yuvconstants,
|
||||||
|
width);
|
||||||
|
if (attenuate) {
|
||||||
|
ARGBAttenuateRow(dst_argb, dst_argb, width);
|
||||||
|
}
|
||||||
|
dst_argb += dst_stride_argb;
|
||||||
|
src_a += src_stride_a;
|
||||||
|
src_y += src_stride_y;
|
||||||
|
src_u += src_stride_u;
|
||||||
|
src_v += src_stride_v;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Convert I420 with Alpha to ARGB.
|
// Convert I420 with Alpha to ARGB.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int I420AlphaToARGB(const uint8_t* src_y,
|
int I420AlphaToARGB(const uint8_t* src_y,
|
||||||
@ -1559,6 +1817,92 @@ int I420AlphaToABGR(const uint8_t* src_y,
|
|||||||
width, height, attenuate);
|
width, height, attenuate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert I422 with Alpha to ARGB.
|
||||||
|
LIBYUV_API
|
||||||
|
int I422AlphaToARGB(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
int dst_stride_argb,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate) {
|
||||||
|
return I422AlphaToARGBMatrix(src_y, src_stride_y, src_u, src_stride_u, src_v,
|
||||||
|
src_stride_v, src_a, src_stride_a, dst_argb,
|
||||||
|
dst_stride_argb, &kYuvI601Constants, width,
|
||||||
|
height, attenuate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert I422 with Alpha to ABGR.
|
||||||
|
LIBYUV_API
|
||||||
|
int I422AlphaToABGR(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_abgr,
|
||||||
|
int dst_stride_abgr,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate) {
|
||||||
|
return I422AlphaToARGBMatrix(
|
||||||
|
src_y, src_stride_y, src_v, src_stride_v, // Swap U and V
|
||||||
|
src_u, src_stride_u, src_a, src_stride_a, dst_abgr, dst_stride_abgr,
|
||||||
|
&kYvuI601Constants, // Use Yvu matrix
|
||||||
|
width, height, attenuate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert I444 with Alpha to ARGB.
|
||||||
|
LIBYUV_API
|
||||||
|
int I444AlphaToARGB(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
int dst_stride_argb,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate) {
|
||||||
|
return I444AlphaToARGBMatrix(src_y, src_stride_y, src_u, src_stride_u, src_v,
|
||||||
|
src_stride_v, src_a, src_stride_a, dst_argb,
|
||||||
|
dst_stride_argb, &kYuvI601Constants, width,
|
||||||
|
height, attenuate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert I444 with Alpha to ABGR.
|
||||||
|
LIBYUV_API
|
||||||
|
int I444AlphaToABGR(const uint8_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
int src_stride_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
int src_stride_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
int src_stride_a,
|
||||||
|
uint8_t* dst_abgr,
|
||||||
|
int dst_stride_abgr,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int attenuate) {
|
||||||
|
return I444AlphaToARGBMatrix(
|
||||||
|
src_y, src_stride_y, src_v, src_stride_v, // Swap U and V
|
||||||
|
src_u, src_stride_u, src_a, src_stride_a, dst_abgr, dst_stride_abgr,
|
||||||
|
&kYvuI601Constants, // Use Yvu matrix
|
||||||
|
width, height, attenuate);
|
||||||
|
}
|
||||||
|
|
||||||
// Convert I400 to ARGB with matrix.
|
// Convert I400 to ARGB with matrix.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int I400ToARGBMatrix(const uint8_t* src_y,
|
int I400ToARGBMatrix(const uint8_t* src_y,
|
||||||
|
|||||||
@ -52,18 +52,33 @@ extern "C" {
|
|||||||
SS(r, DUVSHIFT) * BPP); \
|
SS(r, DUVSHIFT) * BPP); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAS_I444ALPHATOARGBROW_SSSE3
|
||||||
|
ANY41C(I444AlphaToARGBRow_Any_SSSE3, I444AlphaToARGBRow_SSSE3, 0, 0, 4, 7)
|
||||||
|
#endif
|
||||||
|
#ifdef HAS_I444ALPHATOARGBROW_AVX2
|
||||||
|
ANY41C(I444AlphaToARGBRow_Any_AVX2, I444AlphaToARGBRow_AVX2, 0, 0, 4, 15)
|
||||||
|
#endif
|
||||||
#ifdef HAS_I422ALPHATOARGBROW_SSSE3
|
#ifdef HAS_I422ALPHATOARGBROW_SSSE3
|
||||||
ANY41C(I422AlphaToARGBRow_Any_SSSE3, I422AlphaToARGBRow_SSSE3, 1, 0, 4, 7)
|
ANY41C(I422AlphaToARGBRow_Any_SSSE3, I422AlphaToARGBRow_SSSE3, 1, 0, 4, 7)
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_I422ALPHATOARGBROW_AVX2
|
#ifdef HAS_I422ALPHATOARGBROW_AVX2
|
||||||
ANY41C(I422AlphaToARGBRow_Any_AVX2, I422AlphaToARGBRow_AVX2, 1, 0, 4, 15)
|
ANY41C(I422AlphaToARGBRow_Any_AVX2, I422AlphaToARGBRow_AVX2, 1, 0, 4, 15)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAS_I444ALPHATOARGBROW_NEON
|
||||||
|
ANY41C(I444AlphaToARGBRow_Any_NEON, I444AlphaToARGBRow_NEON, 0, 0, 4, 7)
|
||||||
|
#endif
|
||||||
#ifdef HAS_I422ALPHATOARGBROW_NEON
|
#ifdef HAS_I422ALPHATOARGBROW_NEON
|
||||||
ANY41C(I422AlphaToARGBRow_Any_NEON, I422AlphaToARGBRow_NEON, 1, 0, 4, 7)
|
ANY41C(I422AlphaToARGBRow_Any_NEON, I422AlphaToARGBRow_NEON, 1, 0, 4, 7)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAS_I444ALPHATOARGBROW_MSA
|
||||||
|
ANY41C(I444AlphaToARGBRow_Any_MSA, I444AlphaToARGBRow_MSA, 0, 0, 4, 7)
|
||||||
|
#endif
|
||||||
#ifdef HAS_I422ALPHATOARGBROW_MSA
|
#ifdef HAS_I422ALPHATOARGBROW_MSA
|
||||||
ANY41C(I422AlphaToARGBRow_Any_MSA, I422AlphaToARGBRow_MSA, 1, 0, 4, 7)
|
ANY41C(I422AlphaToARGBRow_Any_MSA, I422AlphaToARGBRow_MSA, 1, 0, 4, 7)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAS_I444ALPHATOARGBROW_MMI
|
||||||
|
ANY41C(I444AlphaToARGBRow_Any_MMI, I444AlphaToARGBRow_MMI, 0, 0, 4, 7)
|
||||||
|
#endif
|
||||||
#ifdef HAS_I422ALPHATOARGBROW_MMI
|
#ifdef HAS_I422ALPHATOARGBROW_MMI
|
||||||
ANY41C(I422AlphaToARGBRow_Any_MMI, I422AlphaToARGBRow_MMI, 1, 0, 4, 7)
|
ANY41C(I422AlphaToARGBRow_Any_MMI, I422AlphaToARGBRow_MMI, 1, 0, 4, 7)
|
||||||
#endif
|
#endif
|
||||||
@ -164,6 +179,11 @@ ANY31(BlendPlaneRow_Any_MMI, BlendPlaneRow_MMI, 0, 0, 1, 7)
|
|||||||
|
|
||||||
#ifdef HAS_I422TOARGBROW_SSSE3
|
#ifdef HAS_I422TOARGBROW_SSSE3
|
||||||
ANY31C(I422ToARGBRow_Any_SSSE3, I422ToARGBRow_SSSE3, 1, 0, 4, 7)
|
ANY31C(I422ToARGBRow_Any_SSSE3, I422ToARGBRow_SSSE3, 1, 0, 4, 7)
|
||||||
|
ANY31C(I422ToRGBARow_Any_SSSE3, I422ToRGBARow_SSSE3, 1, 0, 4, 7)
|
||||||
|
ANY31C(I422ToARGB4444Row_Any_SSSE3, I422ToARGB4444Row_SSSE3, 1, 0, 2, 7)
|
||||||
|
ANY31C(I422ToARGB1555Row_Any_SSSE3, I422ToARGB1555Row_SSSE3, 1, 0, 2, 7)
|
||||||
|
ANY31C(I422ToRGB565Row_Any_SSSE3, I422ToRGB565Row_SSSE3, 1, 0, 2, 7)
|
||||||
|
ANY31C(I422ToRGB24Row_Any_SSSE3, I422ToRGB24Row_SSSE3, 1, 0, 3, 15)
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_I422TOAR30ROW_SSSE3
|
#ifdef HAS_I422TOAR30ROW_SSSE3
|
||||||
ANY31C(I422ToAR30Row_Any_SSSE3, I422ToAR30Row_SSSE3, 1, 0, 4, 7)
|
ANY31C(I422ToAR30Row_Any_SSSE3, I422ToAR30Row_SSSE3, 1, 0, 4, 7)
|
||||||
@ -173,11 +193,6 @@ ANY31C(I422ToAR30Row_Any_AVX2, I422ToAR30Row_AVX2, 1, 0, 4, 15)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef HAS_I444TOARGBROW_SSSE3
|
#ifdef HAS_I444TOARGBROW_SSSE3
|
||||||
ANY31C(I444ToARGBRow_Any_SSSE3, I444ToARGBRow_SSSE3, 0, 0, 4, 7)
|
ANY31C(I444ToARGBRow_Any_SSSE3, I444ToARGBRow_SSSE3, 0, 0, 4, 7)
|
||||||
ANY31C(I422ToRGBARow_Any_SSSE3, I422ToRGBARow_SSSE3, 1, 0, 4, 7)
|
|
||||||
ANY31C(I422ToARGB4444Row_Any_SSSE3, I422ToARGB4444Row_SSSE3, 1, 0, 2, 7)
|
|
||||||
ANY31C(I422ToARGB1555Row_Any_SSSE3, I422ToARGB1555Row_SSSE3, 1, 0, 2, 7)
|
|
||||||
ANY31C(I422ToRGB565Row_Any_SSSE3, I422ToRGB565Row_SSSE3, 1, 0, 2, 7)
|
|
||||||
ANY31C(I422ToRGB24Row_Any_SSSE3, I422ToRGB24Row_SSSE3, 1, 0, 3, 15)
|
|
||||||
#endif // HAS_I444TOARGBROW_SSSE3
|
#endif // HAS_I444TOARGBROW_SSSE3
|
||||||
#ifdef HAS_I422TORGB24ROW_AVX2
|
#ifdef HAS_I422TORGB24ROW_AVX2
|
||||||
ANY31C(I422ToRGB24Row_Any_AVX2, I422ToRGB24Row_AVX2, 1, 0, 3, 31)
|
ANY31C(I422ToRGB24Row_Any_AVX2, I422ToRGB24Row_AVX2, 1, 0, 3, 31)
|
||||||
|
|||||||
@ -2016,6 +2016,26 @@ void I422ToAR30Row_C(const uint8_t* src_y,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I444AlphaToARGBRow_C(const uint8_t* src_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
uint8_t* rgb_buf,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) {
|
||||||
|
int x;
|
||||||
|
for (x = 0; x < width; ++x) {
|
||||||
|
YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 0, rgb_buf + 1,
|
||||||
|
rgb_buf + 2, yuvconstants);
|
||||||
|
rgb_buf[3] = src_a[0];
|
||||||
|
src_y += 1;
|
||||||
|
src_u += 1;
|
||||||
|
src_v += 1;
|
||||||
|
src_a += 1;
|
||||||
|
rgb_buf += 4; // Advance 1 pixel.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void I422AlphaToARGBRow_C(const uint8_t* src_y,
|
void I422AlphaToARGBRow_C(const uint8_t* src_y,
|
||||||
const uint8_t* src_u,
|
const uint8_t* src_u,
|
||||||
const uint8_t* src_v,
|
const uint8_t* src_v,
|
||||||
|
|||||||
@ -1964,6 +1964,18 @@ void RGBAToUVRow_SSSE3(const uint8_t* src_rgba0,
|
|||||||
"movq (%[a_buf]),%%xmm5 \n" \
|
"movq (%[a_buf]),%%xmm5 \n" \
|
||||||
"lea 0x8(%[a_buf]),%[a_buf] \n"
|
"lea 0x8(%[a_buf]),%[a_buf] \n"
|
||||||
|
|
||||||
|
// Read 8 UV from 444. With 8 Alpha.
|
||||||
|
#define READYUVA444 \
|
||||||
|
"movq (%[u_buf]),%%xmm0 \n" \
|
||||||
|
"movq 0x00(%[u_buf],%[v_buf],1),%%xmm1 \n" \
|
||||||
|
"lea 0x8(%[u_buf]),%[u_buf] \n" \
|
||||||
|
"punpcklbw %%xmm1,%%xmm0 \n" \
|
||||||
|
"movq (%[y_buf]),%%xmm4 \n" \
|
||||||
|
"punpcklbw %%xmm4,%%xmm4 \n" \
|
||||||
|
"lea 0x8(%[y_buf]),%[y_buf] \n" \
|
||||||
|
"movq (%[a_buf]),%%xmm5 \n" \
|
||||||
|
"lea 0x8(%[a_buf]),%[a_buf] \n"
|
||||||
|
|
||||||
// Read 4 UV from NV12, upsample to 8 UV
|
// Read 4 UV from NV12, upsample to 8 UV
|
||||||
#define READNV12 \
|
#define READNV12 \
|
||||||
"movq (%[uv_buf]),%%xmm0 \n" \
|
"movq (%[uv_buf]),%%xmm0 \n" \
|
||||||
@ -2138,6 +2150,44 @@ void OMITFP I444ToARGBRow_SSSE3(const uint8_t* y_buf,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAS_I444ALPHATOARGBROW_SSSE3
|
||||||
|
void OMITFP I444AlphaToARGBRow_SSSE3(const uint8_t* y_buf,
|
||||||
|
const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf,
|
||||||
|
const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) {
|
||||||
|
// clang-format off
|
||||||
|
asm volatile (
|
||||||
|
YUVTORGB_SETUP(yuvconstants)
|
||||||
|
"sub %[u_buf],%[v_buf] \n"
|
||||||
|
|
||||||
|
LABELALIGN
|
||||||
|
"1: \n"
|
||||||
|
READYUVA444
|
||||||
|
YUVTORGB(yuvconstants)
|
||||||
|
STOREARGB
|
||||||
|
"subl $0x8,%[width] \n"
|
||||||
|
"jg 1b \n"
|
||||||
|
: [y_buf]"+r"(y_buf), // %[y_buf]
|
||||||
|
[u_buf]"+r"(u_buf), // %[u_buf]
|
||||||
|
[v_buf]"+r"(v_buf), // %[v_buf]
|
||||||
|
[a_buf]"+r"(a_buf), // %[a_buf]
|
||||||
|
[dst_argb]"+r"(dst_argb), // %[dst_argb]
|
||||||
|
#if defined(__i386__)
|
||||||
|
[width]"+m"(width) // %[width]
|
||||||
|
#else
|
||||||
|
[width]"+rm"(width) // %[width]
|
||||||
|
#endif
|
||||||
|
: [yuvconstants]"r"(yuvconstants) // %[yuvconstants]
|
||||||
|
: "memory", "cc", YUVTORGB_REGS
|
||||||
|
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5"
|
||||||
|
);
|
||||||
|
// clang-format on
|
||||||
|
}
|
||||||
|
#endif // HAS_I444ALPHATOARGBROW_SSSE3
|
||||||
|
|
||||||
void OMITFP I422ToRGB24Row_SSSE3(const uint8_t* y_buf,
|
void OMITFP I422ToRGB24Row_SSSE3(const uint8_t* y_buf,
|
||||||
const uint8_t* u_buf,
|
const uint8_t* u_buf,
|
||||||
const uint8_t* v_buf,
|
const uint8_t* v_buf,
|
||||||
@ -2537,6 +2587,22 @@ void OMITFP I422ToRGBARow_SSSE3(const uint8_t* y_buf,
|
|||||||
"vpsllw $0x6,%%ymm4,%%ymm4 \n" \
|
"vpsllw $0x6,%%ymm4,%%ymm4 \n" \
|
||||||
"lea 0x20(%[y_buf]),%[y_buf] \n"
|
"lea 0x20(%[y_buf]),%[y_buf] \n"
|
||||||
|
|
||||||
|
// Read 16 UV from 444. With 16 Alpha.
|
||||||
|
#define READYUVA444_AVX2 \
|
||||||
|
"vmovdqu (%[u_buf]),%%xmm0 \n" \
|
||||||
|
"vmovdqu 0x00(%[u_buf],%[v_buf],1),%%xmm1 \n" \
|
||||||
|
"lea 0x10(%[u_buf]),%[u_buf] \n" \
|
||||||
|
"vpermq $0xd8,%%ymm0,%%ymm0 \n" \
|
||||||
|
"vpermq $0xd8,%%ymm1,%%ymm1 \n" \
|
||||||
|
"vpunpcklbw %%ymm1,%%ymm0,%%ymm0 \n" \
|
||||||
|
"vmovdqu (%[y_buf]),%%xmm4 \n" \
|
||||||
|
"vpermq $0xd8,%%ymm4,%%ymm4 \n" \
|
||||||
|
"vpunpcklbw %%ymm4,%%ymm4,%%ymm4 \n" \
|
||||||
|
"lea 0x10(%[y_buf]),%[y_buf] \n" \
|
||||||
|
"vmovdqu (%[a_buf]),%%xmm5 \n" \
|
||||||
|
"vpermq $0xd8,%%ymm5,%%ymm5 \n" \
|
||||||
|
"lea 0x10(%[a_buf]),%[a_buf] \n"
|
||||||
|
|
||||||
// Read 8 UV from 422, upsample to 16 UV. With 16 Alpha.
|
// Read 8 UV from 422, upsample to 16 UV. With 16 Alpha.
|
||||||
#define READYUVA422_AVX2 \
|
#define READYUVA422_AVX2 \
|
||||||
"vmovq (%[u_buf]),%%xmm0 \n" \
|
"vmovq (%[u_buf]),%%xmm0 \n" \
|
||||||
@ -2868,6 +2934,47 @@ void OMITFP I210ToAR30Row_AVX2(const uint16_t* y_buf,
|
|||||||
}
|
}
|
||||||
#endif // HAS_I210TOAR30ROW_AVX2
|
#endif // HAS_I210TOAR30ROW_AVX2
|
||||||
|
|
||||||
|
#if defined(HAS_I444ALPHATOARGBROW_AVX2)
|
||||||
|
// 16 pixels
|
||||||
|
// 16 UV values with 16 Y and 16 A producing 16 ARGB.
|
||||||
|
void OMITFP I444AlphaToARGBRow_AVX2(const uint8_t* y_buf,
|
||||||
|
const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf,
|
||||||
|
const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) {
|
||||||
|
// clang-format off
|
||||||
|
asm volatile (
|
||||||
|
YUVTORGB_SETUP_AVX2(yuvconstants)
|
||||||
|
"sub %[u_buf],%[v_buf] \n"
|
||||||
|
|
||||||
|
LABELALIGN
|
||||||
|
"1: \n"
|
||||||
|
READYUVA444_AVX2
|
||||||
|
YUVTORGB_AVX2(yuvconstants)
|
||||||
|
STOREARGB_AVX2
|
||||||
|
"subl $0x10,%[width] \n"
|
||||||
|
"jg 1b \n"
|
||||||
|
"vzeroupper \n"
|
||||||
|
: [y_buf]"+r"(y_buf), // %[y_buf]
|
||||||
|
[u_buf]"+r"(u_buf), // %[u_buf]
|
||||||
|
[v_buf]"+r"(v_buf), // %[v_buf]
|
||||||
|
[a_buf]"+r"(a_buf), // %[a_buf]
|
||||||
|
[dst_argb]"+r"(dst_argb), // %[dst_argb]
|
||||||
|
#if defined(__i386__)
|
||||||
|
[width]"+m"(width) // %[width]
|
||||||
|
#else
|
||||||
|
[width]"+rm"(width) // %[width]
|
||||||
|
#endif
|
||||||
|
: [yuvconstants]"r"(yuvconstants) // %[yuvconstants]
|
||||||
|
: "memory", "cc", YUVTORGB_REGS_AVX2
|
||||||
|
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5"
|
||||||
|
);
|
||||||
|
// clang-format on
|
||||||
|
}
|
||||||
|
#endif // HAS_I444ALPHATOARGBROW_AVX2
|
||||||
|
|
||||||
#if defined(HAS_I422ALPHATOARGBROW_AVX2)
|
#if defined(HAS_I422ALPHATOARGBROW_AVX2)
|
||||||
// 16 pixels
|
// 16 pixels
|
||||||
// 8 UV values upsampled to 16 UV, mixed with 16 Y and 16 A producing 16 ARGB.
|
// 8 UV values upsampled to 16 UV, mixed with 16 Y and 16 A producing 16 ARGB.
|
||||||
|
|||||||
@ -158,6 +158,34 @@ void I422ToARGBRow_NEON(const uint8_t* src_y,
|
|||||||
"q12", "q13", "q14", "q15");
|
"q12", "q13", "q14", "q15");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I444AlphaToARGBRow_NEON(const uint8_t* src_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) {
|
||||||
|
asm volatile(
|
||||||
|
YUVTORGB_SETUP
|
||||||
|
"1: \n" READYUV444 YUVTORGB
|
||||||
|
"subs %5, %5, #8 \n"
|
||||||
|
"vld1.8 {d23}, [%3]! \n"
|
||||||
|
"vst4.8 {d20, d21, d22, d23}, [%4]! \n"
|
||||||
|
"bgt 1b \n"
|
||||||
|
: "+r"(src_y), // %0
|
||||||
|
"+r"(src_u), // %1
|
||||||
|
"+r"(src_v), // %2
|
||||||
|
"+r"(src_a), // %3
|
||||||
|
"+r"(dst_argb), // %4
|
||||||
|
"+r"(width) // %5
|
||||||
|
: [kUVToRB] "r"(&yuvconstants->kUVToRB),
|
||||||
|
[kUVToG] "r"(&yuvconstants->kUVToG),
|
||||||
|
[kUVBiasBGR] "r"(&yuvconstants->kUVBiasBGR),
|
||||||
|
[kYToRgb] "r"(&yuvconstants->kYToRgb)
|
||||||
|
: "cc", "memory", "q0", "q1", "q2", "q3", "q4", "q8", "q9", "q10", "q11",
|
||||||
|
"q12", "q13", "q14", "q15");
|
||||||
|
}
|
||||||
|
|
||||||
void I422AlphaToARGBRow_NEON(const uint8_t* src_y,
|
void I422AlphaToARGBRow_NEON(const uint8_t* src_y,
|
||||||
const uint8_t* src_u,
|
const uint8_t* src_u,
|
||||||
const uint8_t* src_v,
|
const uint8_t* src_v,
|
||||||
|
|||||||
@ -171,6 +171,41 @@ void I422ToARGBRow_NEON(const uint8_t* src_y,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I444AlphaToARGBRow_NEON(const uint8_t* src_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) {
|
||||||
|
asm volatile (
|
||||||
|
YUVTORGB_SETUP
|
||||||
|
"1: \n"
|
||||||
|
READYUV444
|
||||||
|
"prfm pldl1keep, [%0, 448] \n"
|
||||||
|
YUVTORGB(v22, v21, v20)
|
||||||
|
"ld1 {v23.8b}, [%3], #8 \n"
|
||||||
|
"prfm pldl1keep, [%1, 128] \n"
|
||||||
|
"prfm pldl1keep, [%2, 128] \n"
|
||||||
|
"prfm pldl1keep, [%3, 448] \n"
|
||||||
|
"subs %w5, %w5, #8 \n"
|
||||||
|
"st4 {v20.8b,v21.8b,v22.8b,v23.8b}, [%4], #32 \n"
|
||||||
|
"b.gt 1b \n"
|
||||||
|
: "+r"(src_y), // %0
|
||||||
|
"+r"(src_u), // %1
|
||||||
|
"+r"(src_v), // %2
|
||||||
|
"+r"(src_a), // %3
|
||||||
|
"+r"(dst_argb), // %4
|
||||||
|
"+r"(width) // %5
|
||||||
|
: [kUVToRB]"r"(&yuvconstants->kUVToRB),
|
||||||
|
[kUVToG]"r"(&yuvconstants->kUVToG),
|
||||||
|
[kUVBiasBGR]"r"(&yuvconstants->kUVBiasBGR),
|
||||||
|
[kYToRgb]"r"(&yuvconstants->kYToRgb)
|
||||||
|
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v20",
|
||||||
|
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void I422AlphaToARGBRow_NEON(const uint8_t* src_y,
|
void I422AlphaToARGBRow_NEON(const uint8_t* src_y,
|
||||||
const uint8_t* src_u,
|
const uint8_t* src_u,
|
||||||
const uint8_t* src_v,
|
const uint8_t* src_v,
|
||||||
|
|||||||
@ -27,6 +27,28 @@ extern "C" {
|
|||||||
// 64 bit
|
// 64 bit
|
||||||
#if defined(_M_X64)
|
#if defined(_M_X64)
|
||||||
|
|
||||||
|
// Read 8 UV from 444
|
||||||
|
#define READYUV444 \
|
||||||
|
xmm0 = _mm_loadl_epi64((__m128i*)u_buf); \
|
||||||
|
xmm1 = _mm_loadl_epi64((__m128i*)(u_buf + offset)); \
|
||||||
|
xmm0 = _mm_unpacklo_epi8(xmm0, xmm1); \
|
||||||
|
u_buf += 8; \
|
||||||
|
xmm4 = _mm_loadl_epi64((__m128i*)y_buf); \
|
||||||
|
xmm4 = _mm_unpacklo_epi8(xmm4, xmm4); \
|
||||||
|
y_buf += 8;
|
||||||
|
|
||||||
|
// Read 8 UV from 444, With 8 Alpha.
|
||||||
|
#define READYUVA444 \
|
||||||
|
xmm0 = _mm_loadl_epi64((__m128i*)u_buf); \
|
||||||
|
xmm1 = _mm_loadl_epi64((__m128i*)(u_buf + offset)); \
|
||||||
|
xmm0 = _mm_unpacklo_epi8(xmm0, xmm1); \
|
||||||
|
u_buf += 8; \
|
||||||
|
xmm4 = _mm_loadl_epi64((__m128i*)y_buf); \
|
||||||
|
xmm4 = _mm_unpacklo_epi8(xmm4, xmm4); \
|
||||||
|
y_buf += 8; \
|
||||||
|
xmm5 = _mm_loadl_epi64((__m128i*)a_buf); \
|
||||||
|
a_buf += 8;
|
||||||
|
|
||||||
// Read 4 UV from 422, upsample to 8 UV.
|
// Read 4 UV from 422, upsample to 8 UV.
|
||||||
#define READYUV422 \
|
#define READYUV422 \
|
||||||
xmm0 = _mm_cvtsi32_si128(*(uint32_t*)u_buf); \
|
xmm0 = _mm_cvtsi32_si128(*(uint32_t*)u_buf); \
|
||||||
@ -121,6 +143,44 @@ void I422AlphaToARGBRow_SSSE3(const uint8_t* y_buf,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAS_I444TOARGBROW_SSSE3)
|
||||||
|
void I444ToARGBRow_SSSE3(const uint8_t* y_buf,
|
||||||
|
const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) {
|
||||||
|
__m128i xmm0, xmm1, xmm2, xmm4;
|
||||||
|
const __m128i xmm5 = _mm_set1_epi8(-1);
|
||||||
|
const ptrdiff_t offset = (uint8_t*)v_buf - (uint8_t*)u_buf;
|
||||||
|
while (width > 0) {
|
||||||
|
READYUV444
|
||||||
|
YUVTORGB(yuvconstants)
|
||||||
|
STOREARGB
|
||||||
|
width -= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAS_I444ALPHATOARGBROW_SSSE3)
|
||||||
|
void I444AlphaToARGBRow_SSSE3(const uint8_t* y_buf,
|
||||||
|
const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf,
|
||||||
|
const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) {
|
||||||
|
__m128i xmm0, xmm1, xmm2, xmm4, xmm5;
|
||||||
|
const ptrdiff_t offset = (uint8_t*)v_buf - (uint8_t*)u_buf;
|
||||||
|
while (width > 0) {
|
||||||
|
READYUVA444
|
||||||
|
YUVTORGB(yuvconstants)
|
||||||
|
STOREARGB
|
||||||
|
width -= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// 32 bit
|
// 32 bit
|
||||||
#else // defined(_M_X64)
|
#else // defined(_M_X64)
|
||||||
#ifdef HAS_ARGBTOYROW_SSSE3
|
#ifdef HAS_ARGBTOYROW_SSSE3
|
||||||
@ -1938,6 +1998,23 @@ __declspec(naked) void RGBAToUVRow_SSSE3(const uint8_t* src_argb0,
|
|||||||
__asm vpunpcklbw ymm4, ymm4, ymm4 \
|
__asm vpunpcklbw ymm4, ymm4, ymm4 \
|
||||||
__asm lea eax, [eax + 16]}
|
__asm lea eax, [eax + 16]}
|
||||||
|
|
||||||
|
// Read 16 UV from 444. With 16 Alpha.
|
||||||
|
#define READYUVA444_AVX2 \
|
||||||
|
__asm { \
|
||||||
|
__asm vmovdqu xmm0, [esi] /* U */ \
|
||||||
|
__asm vmovdqu xmm1, [esi + edi] /* V */ \
|
||||||
|
__asm lea esi, [esi + 16] \
|
||||||
|
__asm vpermq ymm0, ymm0, 0xd8 \
|
||||||
|
__asm vpermq ymm1, ymm1, 0xd8 \
|
||||||
|
__asm vpunpcklbw ymm0, ymm0, ymm1 /* UV */ \
|
||||||
|
__asm vmovdqu xmm4, [eax] /* Y */ \
|
||||||
|
__asm vpermq ymm4, ymm4, 0xd8 \
|
||||||
|
__asm vpunpcklbw ymm4, ymm4, ymm4 \
|
||||||
|
__asm lea eax, [eax + 16] \
|
||||||
|
__asm vmovdqu xmm5, [ebp] /* A */ \
|
||||||
|
__asm vpermq ymm5, ymm5, 0xd8 \
|
||||||
|
__asm lea ebp, [ebp + 16]}
|
||||||
|
|
||||||
// Read 8 UV from 422, upsample to 16 UV.
|
// Read 8 UV from 422, upsample to 16 UV.
|
||||||
#define READYUV422_AVX2 \
|
#define READYUV422_AVX2 \
|
||||||
__asm { \
|
__asm { \
|
||||||
@ -2183,6 +2260,48 @@ __declspec(naked) void I444ToARGBRow_AVX2(
|
|||||||
}
|
}
|
||||||
#endif // HAS_I444TOARGBROW_AVX2
|
#endif // HAS_I444TOARGBROW_AVX2
|
||||||
|
|
||||||
|
#ifdef HAS_I444ALPHATOARGBROW_AVX2
|
||||||
|
// 16 pixels
|
||||||
|
// 16 UV values with 16 Y producing 16 ARGB (64 bytes).
|
||||||
|
__declspec(naked) void I444AlphaToARGBRow_AVX2(
|
||||||
|
const uint8_t* y_buf,
|
||||||
|
const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf,
|
||||||
|
const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) {
|
||||||
|
__asm {
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ebx
|
||||||
|
push ebp
|
||||||
|
mov eax, [esp + 16 + 4] // Y
|
||||||
|
mov esi, [esp + 16 + 8] // U
|
||||||
|
mov edi, [esp + 16 + 12] // V
|
||||||
|
mov ebp, [esp + 16 + 16] // A
|
||||||
|
mov edx, [esp + 16 + 20] // argb
|
||||||
|
mov ebx, [esp + 16 + 24] // yuvconstants
|
||||||
|
mov ecx, [esp + 16 + 28] // width
|
||||||
|
sub edi, esi
|
||||||
|
convertloop:
|
||||||
|
READYUVA444_AVX2
|
||||||
|
YUVTORGB_AVX2(ebx)
|
||||||
|
STOREARGB_AVX2
|
||||||
|
|
||||||
|
sub ecx, 16
|
||||||
|
jg convertloop
|
||||||
|
|
||||||
|
pop ebp
|
||||||
|
pop ebx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
vzeroupper
|
||||||
|
ret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // HAS_I444AlphaTOARGBROW_AVX2
|
||||||
|
|
||||||
#ifdef HAS_NV12TOARGBROW_AVX2
|
#ifdef HAS_NV12TOARGBROW_AVX2
|
||||||
// 16 pixels.
|
// 16 pixels.
|
||||||
// 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 ARGB (64 bytes).
|
// 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 ARGB (64 bytes).
|
||||||
@ -2370,6 +2489,19 @@ __declspec(naked) void I422ToRGBARow_AVX2(
|
|||||||
__asm punpcklbw xmm4, xmm4 \
|
__asm punpcklbw xmm4, xmm4 \
|
||||||
__asm lea eax, [eax + 8]}
|
__asm lea eax, [eax + 8]}
|
||||||
|
|
||||||
|
// Read 4 UV from 444. With 8 Alpha.
|
||||||
|
#define READYUVA444 \
|
||||||
|
__asm { \
|
||||||
|
__asm movq xmm0, qword ptr [esi] /* U */ \
|
||||||
|
__asm movq xmm1, qword ptr [esi + edi] /* V */ \
|
||||||
|
__asm lea esi, [esi + 8] \
|
||||||
|
__asm punpcklbw xmm0, xmm1 /* UV */ \
|
||||||
|
__asm movq xmm4, qword ptr [eax] \
|
||||||
|
__asm punpcklbw xmm4, xmm4 \
|
||||||
|
__asm lea eax, [eax + 8] \
|
||||||
|
__asm movq xmm5, qword ptr [ebp] /* A */ \
|
||||||
|
__asm lea ebp, [ebp + 8]}
|
||||||
|
|
||||||
// Read 4 UV from 422, upsample to 8 UV.
|
// Read 4 UV from 422, upsample to 8 UV.
|
||||||
#define READYUV422 \
|
#define READYUV422 \
|
||||||
__asm { \
|
__asm { \
|
||||||
@ -2585,6 +2717,46 @@ __declspec(naked) void I444ToARGBRow_SSSE3(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 8 pixels.
|
||||||
|
// 8 UV values, mixed with 8 Y and 8A producing 8 ARGB (32 bytes).
|
||||||
|
__declspec(naked) void I444AlphaToARGBRow_SSSE3(
|
||||||
|
const uint8_t* y_buf,
|
||||||
|
const uint8_t* u_buf,
|
||||||
|
const uint8_t* v_buf,
|
||||||
|
const uint8_t* a_buf,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) {
|
||||||
|
__asm {
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ebx
|
||||||
|
push ebp
|
||||||
|
mov eax, [esp + 16 + 4] // Y
|
||||||
|
mov esi, [esp + 16 + 8] // U
|
||||||
|
mov edi, [esp + 16 + 12] // V
|
||||||
|
mov ebp, [esp + 16 + 16] // A
|
||||||
|
mov edx, [esp + 16 + 20] // argb
|
||||||
|
mov ebx, [esp + 16 + 24] // yuvconstants
|
||||||
|
mov ecx, [esp + 16 + 28] // width
|
||||||
|
sub edi, esi
|
||||||
|
|
||||||
|
convertloop:
|
||||||
|
READYUVA444
|
||||||
|
YUVTORGB(ebx)
|
||||||
|
STOREARGB
|
||||||
|
|
||||||
|
sub ecx, 8
|
||||||
|
jg convertloop
|
||||||
|
|
||||||
|
pop ebp
|
||||||
|
pop ebx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
ret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 8 pixels.
|
// 8 pixels.
|
||||||
// 4 UV values upsampled to 8 UV, mixed with 8 Y producing 8 RGB24 (24 bytes).
|
// 4 UV values upsampled to 8 UV, mixed with 8 Y producing 8 RGB24 (24 bytes).
|
||||||
__declspec(naked) void I422ToRGB24Row_SSSE3(
|
__declspec(naked) void I422ToRGB24Row_SSSE3(
|
||||||
|
|||||||
@ -738,6 +738,42 @@ TESTPLANARTOB(H420, 2, 2, AR30, 4, 4, 1)
|
|||||||
#define U420AlphaToABGR(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
#define U420AlphaToABGR(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
I420AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, &kYuv2020Constants, k, \
|
I420AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, &kYuv2020Constants, k, \
|
||||||
l, m)
|
l, m)
|
||||||
|
#define J422AlphaToARGB(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I422AlphaToARGBMatrix(a, b, c, d, e, f, g, h, i, j, &kYuvJPEGConstants, k, \
|
||||||
|
l, m)
|
||||||
|
#define J422AlphaToABGR(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I422AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, &kYuvJPEGConstants, k, \
|
||||||
|
l, m)
|
||||||
|
#define H422AlphaToARGB(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I422AlphaToARGBMatrix(a, b, c, d, e, f, g, h, i, j, &kYuvH709Constants, k, \
|
||||||
|
l, m)
|
||||||
|
#define H422AlphaToABGR(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I422AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, &kYuvH709Constants, k, \
|
||||||
|
l, m)
|
||||||
|
#define U422AlphaToARGB(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I422AlphaToARGBMatrix(a, b, c, d, e, f, g, h, i, j, &kYuv2020Constants, k, \
|
||||||
|
l, m)
|
||||||
|
#define U422AlphaToABGR(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I422AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, &kYuv2020Constants, k, \
|
||||||
|
l, m)
|
||||||
|
#define J444AlphaToARGB(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I444AlphaToARGBMatrix(a, b, c, d, e, f, g, h, i, j, &kYuvJPEGConstants, k, \
|
||||||
|
l, m)
|
||||||
|
#define J444AlphaToABGR(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I444AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, &kYuvJPEGConstants, k, \
|
||||||
|
l, m)
|
||||||
|
#define H444AlphaToARGB(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I444AlphaToARGBMatrix(a, b, c, d, e, f, g, h, i, j, &kYuvH709Constants, k, \
|
||||||
|
l, m)
|
||||||
|
#define H444AlphaToABGR(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I444AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, &kYuvH709Constants, k, \
|
||||||
|
l, m)
|
||||||
|
#define U444AlphaToARGB(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I444AlphaToARGBMatrix(a, b, c, d, e, f, g, h, i, j, &kYuv2020Constants, k, \
|
||||||
|
l, m)
|
||||||
|
#define U444AlphaToABGR(a, b, c, d, e, f, g, h, i, j, k, l, m) \
|
||||||
|
I444AlphaToABGRMatrix(a, b, c, d, e, f, g, h, i, j, &kYuv2020Constants, k, \
|
||||||
|
l, m)
|
||||||
|
|
||||||
TESTQPLANARTOB(I420Alpha, 2, 2, ARGB, 4, 4, 1)
|
TESTQPLANARTOB(I420Alpha, 2, 2, ARGB, 4, 4, 1)
|
||||||
TESTQPLANARTOB(I420Alpha, 2, 2, ABGR, 4, 4, 1)
|
TESTQPLANARTOB(I420Alpha, 2, 2, ABGR, 4, 4, 1)
|
||||||
@ -747,6 +783,22 @@ TESTQPLANARTOB(H420Alpha, 2, 2, ARGB, 4, 4, 1)
|
|||||||
TESTQPLANARTOB(H420Alpha, 2, 2, ABGR, 4, 4, 1)
|
TESTQPLANARTOB(H420Alpha, 2, 2, ABGR, 4, 4, 1)
|
||||||
TESTQPLANARTOB(U420Alpha, 2, 2, ARGB, 4, 4, 1)
|
TESTQPLANARTOB(U420Alpha, 2, 2, ARGB, 4, 4, 1)
|
||||||
TESTQPLANARTOB(U420Alpha, 2, 2, ABGR, 4, 4, 1)
|
TESTQPLANARTOB(U420Alpha, 2, 2, ABGR, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(I422Alpha, 2, 1, ARGB, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(I422Alpha, 2, 1, ABGR, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(J422Alpha, 2, 1, ARGB, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(J422Alpha, 2, 1, ABGR, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(H422Alpha, 2, 1, ARGB, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(H422Alpha, 2, 1, ABGR, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(U422Alpha, 2, 1, ARGB, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(U422Alpha, 2, 1, ABGR, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(I444Alpha, 1, 1, ARGB, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(I444Alpha, 1, 1, ABGR, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(J444Alpha, 1, 1, ARGB, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(J444Alpha, 1, 1, ABGR, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(H444Alpha, 1, 1, ARGB, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(H444Alpha, 1, 1, ABGR, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(U444Alpha, 1, 1, ARGB, 4, 4, 1)
|
||||||
|
TESTQPLANARTOB(U444Alpha, 1, 1, ABGR, 4, 4, 1)
|
||||||
|
|
||||||
#define TESTBIPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, FMT_C, \
|
#define TESTBIPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, FMT_C, \
|
||||||
BPP_B, W1280, N, NEG, OFF) \
|
BPP_B, W1280, N, NEG, OFF) \
|
||||||
@ -2762,6 +2814,22 @@ TESTQPLANARTOE(H420Alpha, 2, 2, ARGB, 1, 4, ABGR, 4)
|
|||||||
TESTQPLANARTOE(H420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4)
|
TESTQPLANARTOE(H420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4)
|
||||||
TESTQPLANARTOE(U420Alpha, 2, 2, ARGB, 1, 4, ABGR, 4)
|
TESTQPLANARTOE(U420Alpha, 2, 2, ARGB, 1, 4, ABGR, 4)
|
||||||
TESTQPLANARTOE(U420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4)
|
TESTQPLANARTOE(U420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4)
|
||||||
|
TESTQPLANARTOE(I422Alpha, 2, 1, ARGB, 1, 4, ABGR, 4)
|
||||||
|
TESTQPLANARTOE(I422Alpha, 2, 1, ABGR, 1, 4, ARGB, 4)
|
||||||
|
TESTQPLANARTOE(J422Alpha, 2, 1, ARGB, 1, 4, ABGR, 4)
|
||||||
|
TESTQPLANARTOE(J422Alpha, 2, 1, ABGR, 1, 4, ARGB, 4)
|
||||||
|
TESTQPLANARTOE(H422Alpha, 2, 1, ARGB, 1, 4, ABGR, 4)
|
||||||
|
TESTQPLANARTOE(H422Alpha, 2, 1, ABGR, 1, 4, ARGB, 4)
|
||||||
|
TESTQPLANARTOE(U422Alpha, 2, 1, ARGB, 1, 4, ABGR, 4)
|
||||||
|
TESTQPLANARTOE(U422Alpha, 2, 1, ABGR, 1, 4, ARGB, 4)
|
||||||
|
TESTQPLANARTOE(I444Alpha, 1, 1, ARGB, 1, 4, ABGR, 4)
|
||||||
|
TESTQPLANARTOE(I444Alpha, 1, 1, ABGR, 1, 4, ARGB, 4)
|
||||||
|
TESTQPLANARTOE(J444Alpha, 1, 1, ARGB, 1, 4, ABGR, 4)
|
||||||
|
TESTQPLANARTOE(J444Alpha, 1, 1, ABGR, 1, 4, ARGB, 4)
|
||||||
|
TESTQPLANARTOE(H444Alpha, 1, 1, ARGB, 1, 4, ABGR, 4)
|
||||||
|
TESTQPLANARTOE(H444Alpha, 1, 1, ABGR, 1, 4, ARGB, 4)
|
||||||
|
TESTQPLANARTOE(U444Alpha, 1, 1, ARGB, 1, 4, ABGR, 4)
|
||||||
|
TESTQPLANARTOE(U444Alpha, 1, 1, ABGR, 1, 4, ARGB, 4)
|
||||||
|
|
||||||
#define TESTPLANETOEI(FMT_A, SUB_A, BPP_A, FMT_B, SUB_B, BPP_B, W1280, N, NEG, \
|
#define TESTPLANETOEI(FMT_A, SUB_A, BPP_A, FMT_B, SUB_B, BPP_B, W1280, N, NEG, \
|
||||||
OFF, FMT_C, BPP_C) \
|
OFF, FMT_C, BPP_C) \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user