Commit 7060e0d8 authored by Frank Barchard's avatar Frank Barchard

I420ToABGRMatrix functions with J420ToABGR wrapper.

Allows direct conversion from JPeg to ABGR for android.

BUG=libyuv:488
R=harryjin@google.com

Review URL: https://webrtc-codereview.appspot.com/55719004 .
parent fbc3d595
...@@ -149,6 +149,22 @@ int J422ToARGB(const uint8* src_y, int src_stride_y, ...@@ -149,6 +149,22 @@ int J422ToARGB(const uint8* src_y, int src_stride_y,
uint8* dst_argb, int dst_stride_argb, uint8* dst_argb, int dst_stride_argb,
int width, int height); int width, int height);
// 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);
// 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);
// BGRA little endian (argb in memory) to ARGB. // BGRA little endian (argb in memory) to ARGB.
LIBYUV_API LIBYUV_API
int BGRAToARGB(const uint8* src_frame, int src_stride_frame, int BGRAToARGB(const uint8* src_frame, int src_stride_frame,
......
...@@ -89,6 +89,7 @@ extern "C" { ...@@ -89,6 +89,7 @@ extern "C" {
#define HAS_I422TOARGB4444ROW_SSSE3 #define HAS_I422TOARGB4444ROW_SSSE3
#define HAS_I422TOARGBROW_SSSE3 #define HAS_I422TOARGBROW_SSSE3
#define HAS_I422TOARGBMATRIXROW_SSSE3 #define HAS_I422TOARGBMATRIXROW_SSSE3
#define HAS_I422TOABGRMATRIXROW_SSSE3
#define HAS_I422TOBGRAROW_SSSE3 #define HAS_I422TOBGRAROW_SSSE3
#define HAS_I422TORAWROW_SSSE3 #define HAS_I422TORAWROW_SSSE3
#define HAS_I422TORGB24ROW_SSSE3 #define HAS_I422TORGB24ROW_SSSE3
...@@ -99,6 +100,7 @@ extern "C" { ...@@ -99,6 +100,7 @@ extern "C" {
#define HAS_I444TOARGBROW_SSSE3 #define HAS_I444TOARGBROW_SSSE3
#define HAS_J400TOARGBROW_SSE2 #define HAS_J400TOARGBROW_SSE2
#define HAS_J422TOARGBROW_SSSE3 #define HAS_J422TOARGBROW_SSSE3
#define HAS_J422TOABGRROW_SSSE3
#define HAS_MERGEUVROW_SSE2 #define HAS_MERGEUVROW_SSE2
#define HAS_MIRRORROW_SSE2 #define HAS_MIRRORROW_SSE2
#define HAS_MIRRORROW_SSSE3 #define HAS_MIRRORROW_SSSE3
...@@ -162,7 +164,9 @@ extern "C" { ...@@ -162,7 +164,9 @@ extern "C" {
#if !defined(LIBYUV_DISABLE_X86) && defined (_M_X64) && \ #if !defined(LIBYUV_DISABLE_X86) && defined (_M_X64) && \
(!defined(__clang__) || defined(__SSSE3__)) (!defined(__clang__) || defined(__SSSE3__))
#define HAS_I422TOARGBROW_SSSE3 #define HAS_I422TOARGBROW_SSSE3
#define HAS_I422TOABGRROW_SSSE3
#define HAS_I422TOARGBMATRIXROW_SSSE3 #define HAS_I422TOARGBMATRIXROW_SSSE3
#define HAS_I422TOABGRMATRIXROW_SSSE3
#endif #endif
// GCC >= 4.7.0 required for AVX2. // GCC >= 4.7.0 required for AVX2.
...@@ -226,12 +230,14 @@ extern "C" { ...@@ -226,12 +230,14 @@ extern "C" {
#define HAS_I422TOABGRROW_AVX2 #define HAS_I422TOABGRROW_AVX2
#define HAS_I422TOARGBROW_AVX2 #define HAS_I422TOARGBROW_AVX2
#define HAS_I422TOARGBMATRIXROW_AVX2 #define HAS_I422TOARGBMATRIXROW_AVX2
#define HAS_I422TOABGRMATRIXROW_AVX2
#define HAS_I422TOBGRAROW_AVX2 #define HAS_I422TOBGRAROW_AVX2
#define HAS_I422TORAWROW_AVX2 #define HAS_I422TORAWROW_AVX2
#define HAS_I422TORGB24ROW_AVX2 #define HAS_I422TORGB24ROW_AVX2
#define HAS_I422TORGBAROW_AVX2 #define HAS_I422TORGBAROW_AVX2
#define HAS_INTERPOLATEROW_AVX2 #define HAS_INTERPOLATEROW_AVX2
#define HAS_J422TOARGBROW_AVX2 #define HAS_J422TOARGBROW_AVX2
#define HAS_J422TOABGRROW_AVX2
#define HAS_MERGEUVROW_AVX2 #define HAS_MERGEUVROW_AVX2
#define HAS_MIRRORROW_AVX2 #define HAS_MIRRORROW_AVX2
#define HAS_SPLITUVROW_AVX2 #define HAS_SPLITUVROW_AVX2
...@@ -294,7 +300,8 @@ extern "C" { ...@@ -294,7 +300,8 @@ extern "C" {
#define HAS_I422TOARGB4444ROW_NEON #define HAS_I422TOARGB4444ROW_NEON
#define HAS_I422TOARGBROW_NEON #define HAS_I422TOARGBROW_NEON
// TODO(fbarchard): Implement NEON version // TODO(fbarchard): Implement NEON version
#define HAS_I422TOARGBMATRIXROW_NEON // #define HAS_I422TOARGBMATRIXROW_NEON
// #define HAS_I422TOABGRMATRIXROW_NEON
#define HAS_I422TOBGRAROW_NEON #define HAS_I422TOBGRAROW_NEON
#define HAS_I422TORAWROW_NEON #define HAS_I422TORAWROW_NEON
#define HAS_I422TORGB24ROW_NEON #define HAS_I422TORGB24ROW_NEON
...@@ -532,6 +539,12 @@ void I422ToARGBMatrixRow_NEON(const uint8* src_y, ...@@ -532,6 +539,12 @@ void I422ToARGBMatrixRow_NEON(const uint8* src_y,
uint8* dst_argb, uint8* dst_argb,
struct YuvConstants* YuvConstants, struct YuvConstants* YuvConstants,
int width); int width);
void I422ToABGRMatrixRow_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
uint8* dst_argb,
struct YuvConstants* YuvConstants,
int width);
void I411ToARGBRow_NEON(const uint8* src_y, void I411ToARGBRow_NEON(const uint8* src_y,
const uint8* src_u, const uint8* src_u,
const uint8* src_v, const uint8* src_v,
...@@ -991,6 +1004,12 @@ void I422ToARGBMatrixRow_C(const uint8* src_y, ...@@ -991,6 +1004,12 @@ void I422ToARGBMatrixRow_C(const uint8* src_y,
uint8* dst_argb, uint8* dst_argb,
struct YuvConstants* YuvConstants, struct YuvConstants* YuvConstants,
int width); int width);
void I422ToABGRMatrixRow_C(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
uint8* dst_argb,
struct YuvConstants* YuvConstants,
int width);
void I411ToARGBRow_C(const uint8* src_y, void I411ToARGBRow_C(const uint8* src_y,
const uint8* src_u, const uint8* src_u,
const uint8* src_v, const uint8* src_v,
...@@ -1023,6 +1042,11 @@ void J422ToARGBRow_C(const uint8* src_y, ...@@ -1023,6 +1042,11 @@ void J422ToARGBRow_C(const uint8* src_y,
const uint8* src_v, const uint8* src_v,
uint8* dst_argb, uint8* dst_argb,
int width); int width);
void J422ToABGRRow_C(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
uint8* dst_argb,
int width);
void I422ToBGRARow_C(const uint8* src_y, void I422ToBGRARow_C(const uint8* src_y,
const uint8* src_u, const uint8* src_u,
const uint8* src_v, const uint8* src_v,
...@@ -1074,6 +1098,12 @@ void I422ToARGBMatrixRow_AVX2(const uint8* src_y, ...@@ -1074,6 +1098,12 @@ void I422ToARGBMatrixRow_AVX2(const uint8* src_y,
uint8* dst_argb, uint8* dst_argb,
struct YuvConstants* YuvConstants, struct YuvConstants* YuvConstants,
int width); int width);
void I422ToABGRMatrixRow_AVX2(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
uint8* dst_argb,
struct YuvConstants* YuvConstants,
int width);
void I422ToBGRARow_AVX2(const uint8* src_y, void I422ToBGRARow_AVX2(const uint8* src_y,
const uint8* src_u, const uint8* src_u,
const uint8* src_v, const uint8* src_v,
...@@ -1110,6 +1140,12 @@ void I422ToARGBMatrixRow_SSSE3(const uint8* src_y, ...@@ -1110,6 +1140,12 @@ void I422ToARGBMatrixRow_SSSE3(const uint8* src_y,
uint8* dst_argb, uint8* dst_argb,
struct YuvConstants* YuvConstants, struct YuvConstants* YuvConstants,
int width); int width);
void I422ToABGRMatrixRow_SSSE3(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
uint8* dst_argb,
struct YuvConstants* YuvConstants,
int width);
void I411ToARGBRow_SSSE3(const uint8* src_y, void I411ToARGBRow_SSSE3(const uint8* src_y,
const uint8* src_u, const uint8* src_u,
const uint8* src_v, const uint8* src_v,
...@@ -1169,11 +1205,21 @@ void J422ToARGBRow_SSSE3(const uint8* src_y, ...@@ -1169,11 +1205,21 @@ void J422ToARGBRow_SSSE3(const uint8* src_y,
const uint8* src_v, const uint8* src_v,
uint8* dst_argb, uint8* dst_argb,
int width); int width);
void J422ToABGRRow_SSSE3(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
uint8* dst_argb,
int width);
void J422ToARGBRow_AVX2(const uint8* src_y, void J422ToARGBRow_AVX2(const uint8* src_y,
const uint8* src_u, const uint8* src_u,
const uint8* src_v, const uint8* src_v,
uint8* dst_argb, uint8* dst_argb,
int width); int width);
void J422ToABGRRow_AVX2(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
uint8* dst_argb,
int width);
void I422ToBGRARow_SSSE3(const uint8* src_y, void I422ToBGRARow_SSSE3(const uint8* src_y,
const uint8* src_u, const uint8* src_u,
const uint8* src_v, const uint8* src_v,
...@@ -1333,11 +1379,21 @@ void J422ToARGBRow_Any_SSSE3(const uint8* src_y, ...@@ -1333,11 +1379,21 @@ void J422ToARGBRow_Any_SSSE3(const uint8* src_y,
const uint8* src_v, const uint8* src_v,
uint8* dst_argb, uint8* dst_argb,
int width); int width);
void J422ToABGRRow_Any_SSSE3(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
uint8* dst_argb,
int width);
void J422ToARGBRow_Any_AVX2(const uint8* src_y, void J422ToARGBRow_Any_AVX2(const uint8* src_y,
const uint8* src_u, const uint8* src_u,
const uint8* src_v, const uint8* src_v,
uint8* dst_argb, uint8* dst_argb,
int width); int width);
void J422ToABGRRow_Any_AVX2(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
uint8* dst_argb,
int width);
void I422ToBGRARow_Any_SSSE3(const uint8* src_y, void I422ToBGRARow_Any_SSSE3(const uint8* src_y,
const uint8* src_u, const uint8* src_u,
const uint8* src_v, const uint8* src_v,
......
...@@ -1398,6 +1398,152 @@ int J422ToARGB(const uint8* src_y, int src_stride_y, ...@@ -1398,6 +1398,152 @@ int J422ToARGB(const uint8* src_y, int src_stride_y,
return 0; 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 (*J422ToABGRRow)(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) = J422ToABGRRow_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_J422TOABGRROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3)) {
J422ToABGRRow = J422ToABGRRow_Any_SSSE3;
if (IS_ALIGNED(width, 8)) {
J422ToABGRRow = J422ToABGRRow_SSSE3;
}
}
#endif
#if defined(HAS_J422TOABGRROW_AVX2)
if (TestCpuFlag(kCpuHasAVX2)) {
J422ToABGRRow = J422ToABGRRow_Any_AVX2;
if (IS_ALIGNED(width, 16)) {
J422ToABGRRow = J422ToABGRRow_AVX2;
}
}
#endif
#if defined(HAS_J422TOABGRROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
J422ToABGRRow = J422ToABGRRow_Any_NEON;
if (IS_ALIGNED(width, 8)) {
J422ToABGRRow = J422ToABGRRow_NEON;
}
}
#endif
#if defined(HAS_J422TOABGRROW_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)) {
J422ToABGRRow = J422ToABGRRow_MIPS_DSPR2;
}
#endif
for (y = 0; y < height; ++y) {
J422ToABGRRow(src_y, src_u, src_v, dst_abgr, 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 (*J422ToABGRRow)(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) = J422ToABGRRow_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_J422TOABGRROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3)) {
J422ToABGRRow = J422ToABGRRow_Any_SSSE3;
if (IS_ALIGNED(width, 8)) {
J422ToABGRRow = J422ToABGRRow_SSSE3;
}
}
#endif
#if defined(HAS_J422TOABGRROW_AVX2)
if (TestCpuFlag(kCpuHasAVX2)) {
J422ToABGRRow = J422ToABGRRow_Any_AVX2;
if (IS_ALIGNED(width, 16)) {
J422ToABGRRow = J422ToABGRRow_AVX2;
}
}
#endif
#if defined(HAS_J422TOABGRROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
J422ToABGRRow = J422ToABGRRow_Any_NEON;
if (IS_ALIGNED(width, 8)) {
J422ToABGRRow = J422ToABGRRow_NEON;
}
}
#endif
#if defined(HAS_J422TOABGRROW_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)) {
J422ToABGRRow = J422ToABGRRow_MIPS_DSPR2;
}
#endif
for (y = 0; y < height; ++y) {
J422ToABGRRow(src_y, src_u, src_v, dst_abgr, 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 #ifdef __cplusplus
} // extern "C" } // extern "C"
} // namespace libyuv } // namespace libyuv
......
...@@ -43,6 +43,7 @@ extern "C" { ...@@ -43,6 +43,7 @@ extern "C" {
#ifdef HAS_I422TOARGBROW_SSSE3 #ifdef HAS_I422TOARGBROW_SSSE3
ANY31(I422ToARGBRow_Any_SSSE3, I422ToARGBRow_SSSE3, 1, 0, 4, 7) ANY31(I422ToARGBRow_Any_SSSE3, I422ToARGBRow_SSSE3, 1, 0, 4, 7)
ANY31(J422ToABGRRow_Any_SSSE3, J422ToABGRRow_SSSE3, 1, 0, 4, 7)
#endif #endif
#ifdef HAS_I444TOARGBROW_SSSE3 #ifdef HAS_I444TOARGBROW_SSSE3
ANY31(I444ToARGBRow_Any_SSSE3, I444ToARGBRow_SSSE3, 0, 0, 4, 7) ANY31(I444ToARGBRow_Any_SSSE3, I444ToARGBRow_SSSE3, 0, 0, 4, 7)
...@@ -70,6 +71,9 @@ ANY31(J422ToARGBRow_Any_SSSE3, J422ToARGBRow_SSSE3, 1, 0, 4, 7) ...@@ -70,6 +71,9 @@ ANY31(J422ToARGBRow_Any_SSSE3, J422ToARGBRow_SSSE3, 1, 0, 4, 7)
#ifdef HAS_J422TOARGBROW_AVX2 #ifdef HAS_J422TOARGBROW_AVX2
ANY31(J422ToARGBRow_Any_AVX2, J422ToARGBRow_AVX2, 1, 0, 4, 15) ANY31(J422ToARGBRow_Any_AVX2, J422ToARGBRow_AVX2, 1, 0, 4, 15)
#endif #endif
#ifdef HAS_J422TOABGRROW_AVX2
ANY31(J422ToABGRRow_Any_AVX2, J422ToABGRRow_AVX2, 1, 0, 4, 15)
#endif
#ifdef HAS_I422TOARGBROW_AVX2 #ifdef HAS_I422TOARGBROW_AVX2
ANY31(I422ToARGBRow_Any_AVX2, I422ToARGBRow_AVX2, 1, 0, 4, 15) ANY31(I422ToARGBRow_Any_AVX2, I422ToARGBRow_AVX2, 1, 0, 4, 15)
#endif #endif
......
...@@ -1179,6 +1179,31 @@ void J422ToARGBRow_C(const uint8* src_y, ...@@ -1179,6 +1179,31 @@ void J422ToARGBRow_C(const uint8* src_y,
} }
} }
void J422ToABGRRow_C(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
uint8* rgb_buf,
int width) {
int x;
for (x = 0; x < width - 1; x += 2) {
YuvJPixel(src_y[0], src_u[0], src_v[0],
rgb_buf + 2, rgb_buf + 1, rgb_buf + 0);
rgb_buf[3] = 255;
YuvJPixel(src_y[1], src_u[0], src_v[0],
rgb_buf + 6, rgb_buf + 5, rgb_buf + 4);
rgb_buf[7] = 255;
src_y += 2;
src_u += 1;
src_v += 1;
rgb_buf += 8; // Advance 2 pixels.
}
if (width & 1) {
YuvJPixel(src_y[0], src_u[0], src_v[0],
rgb_buf + 2, rgb_buf + 1, rgb_buf + 0);
rgb_buf[3] = 255;
}
}
void I422ToRGB24Row_C(const uint8* src_y, void I422ToRGB24Row_C(const uint8* src_y,
const uint8* src_u, const uint8* src_u,
const uint8* src_v, const uint8* src_v,
...@@ -2156,49 +2181,33 @@ void I422ToUYVYRow_C(const uint8* src_y, ...@@ -2156,49 +2181,33 @@ void I422ToUYVYRow_C(const uint8* src_y,
} }
} }
#if defined(HAS_I422TOARGBMATRIXROW_SSSE3)
extern struct YuvConstants kYuvConstants; extern struct YuvConstants kYuvConstants;
extern struct YuvConstants kYuvJConstants; extern struct YuvConstants kYuvJConstants;
// JPeg color space version of I422ToARGB #define ANYYUV(NAMEANY, ANY_SIMD, YUVCONSTANTS) \
void J422ToARGBRow_SSSE3(const uint8* y_buf, void NAMEANY(const uint8* y_buf, \
const uint8* u_buf, const uint8* u_buf, \
const uint8* v_buf, const uint8* v_buf, \
uint8* dst_argb, uint8* dst_argb, \
int width) { int width) { \
I422ToARGBMatrixRow_SSSE3(y_buf, u_buf, v_buf, dst_argb, ANY_SIMD(y_buf, u_buf, v_buf, dst_argb, &YUVCONSTANTS, width); \
&kYuvJConstants, width); }
}
#ifdef HAS_I422TOARGBMATRIXROW_SSSE3
void I422ToARGBRow_SSSE3(const uint8* y_buf, ANYYUV(I422ToARGBRow_SSSE3, I422ToARGBMatrixRow_SSSE3, kYuvConstants)
const uint8* u_buf, ANYYUV(J422ToARGBRow_SSSE3, I422ToARGBMatrixRow_SSSE3, kYuvJConstants)
const uint8* v_buf, #endif
uint8* dst_argb, #ifdef HAS_I422TOARGBMATRIXROW_AVX2
int width) { ANYYUV(I422ToARGBRow_AVX2, I422ToARGBMatrixRow_AVX2, kYuvConstants)
I422ToARGBMatrixRow_SSSE3(y_buf, u_buf, v_buf, dst_argb, ANYYUV(J422ToARGBRow_AVX2, I422ToARGBMatrixRow_AVX2, kYuvJConstants)
&kYuvConstants, width); #endif
} #ifdef HAS_I422TOABGRMATRIXROW_SSSE3
ANYYUV(I422ToABGRRow_SSSE3, I422ToABGRMatrixRow_SSSE3, kYuvConstants)
#if defined(HAS_I422TOARGBMATRIXROW_AVX2) ANYYUV(J422ToABGRRow_SSSE3, I422ToABGRMatrixRow_SSSE3, kYuvJConstants)
// JPeg color space version of I422ToARGB
void J422ToARGBRow_AVX2(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* dst_argb,
int width) {
I422ToARGBMatrixRow_AVX2(y_buf, u_buf, v_buf, dst_argb,
&kYuvJConstants, width);
}
void I422ToARGBRow_AVX2(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* dst_argb,
int width) {
I422ToARGBMatrixRow_AVX2(y_buf, u_buf, v_buf, dst_argb,
&kYuvConstants, width);
}
#endif #endif
#ifdef HAS_I422TOABGRMATRIXROW_AVX2
ANYYUV(I422ToABGRRow_AVX2, I422ToABGRMatrixRow_AVX2, kYuvConstants)
ANYYUV(J422ToABGRRow_AVX2, I422ToABGRMatrixRow_AVX2, kYuvJConstants)
#endif #endif
// Maximum temporary width for wrappers to process at a time, in pixels. // Maximum temporary width for wrappers to process at a time, in pixels.
......
...@@ -1669,7 +1669,7 @@ void OMITFP I422ToARGBMatrixRow_SSSE3(const uint8* y_buf, ...@@ -1669,7 +1669,7 @@ void OMITFP I422ToARGBMatrixRow_SSSE3(const uint8* y_buf,
[v_buf]"+r"(v_buf), // %[v_buf] [v_buf]"+r"(v_buf), // %[v_buf]
[dst_argb]"+r"(dst_argb), // %[dst_argb] [dst_argb]"+r"(dst_argb), // %[dst_argb]
[width]"+rm"(width) // %[width] [width]"+rm"(width) // %[width]
: [kYuvConstants]"r"(YuvConstants) // %[YuvConstants] : [kYuvConstants]"r"(YuvConstants) // %[kYuvConstants]
: "memory", "cc", NACL_R14 : "memory", "cc", NACL_R14
"xmm0", "xmm1", "xmm2", "xmm3", "xmm5" "xmm0", "xmm1", "xmm2", "xmm3", "xmm5"
); );
...@@ -1773,11 +1773,12 @@ void OMITFP I422ToBGRARow_SSSE3(const uint8* y_buf, ...@@ -1773,11 +1773,12 @@ void OMITFP I422ToBGRARow_SSSE3(const uint8* y_buf,
); );
} }
void OMITFP I422ToABGRRow_SSSE3(const uint8* y_buf, void OMITFP I422ToABGRMatrixRow_SSSE3(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
uint8* dst_abgr, uint8* dst_abgr,
int width) { struct YuvConstants* YuvConstants,
int width) {
asm volatile ( asm volatile (
"sub %[u_buf],%[v_buf] \n" "sub %[u_buf],%[v_buf] \n"
"pcmpeqb %%xmm5,%%xmm5 \n" "pcmpeqb %%xmm5,%%xmm5 \n"
...@@ -1793,7 +1794,7 @@ void OMITFP I422ToABGRRow_SSSE3(const uint8* y_buf, ...@@ -1793,7 +1794,7 @@ void OMITFP I422ToABGRRow_SSSE3(const uint8* y_buf,
[v_buf]"+r"(v_buf), // %[v_buf] [v_buf]"+r"(v_buf), // %[v_buf]
[dst_abgr]"+r"(dst_abgr), // %[dst_abgr] [dst_abgr]"+r"(dst_abgr), // %[dst_abgr]
[width]"+rm"(width) // %[width] [width]"+rm"(width) // %[width]
: [kYuvConstants]"r"(&kYuvConstants.kUVToB) // %[kYuvConstants] : [kYuvConstants]"r"(YuvConstants) // %[kYuvConstants]
: "memory", "cc", NACL_R14 : "memory", "cc", NACL_R14
"xmm0", "xmm1", "xmm2", "xmm3", "xmm5" "xmm0", "xmm1", "xmm2", "xmm3", "xmm5"
); );
...@@ -1940,7 +1941,7 @@ void OMITFP I422ToARGBMatrixRow_AVX2(const uint8* y_buf, ...@@ -1940,7 +1941,7 @@ void OMITFP I422ToARGBMatrixRow_AVX2(const uint8* y_buf,
[v_buf]"+r"(v_buf), // %[v_buf] [v_buf]"+r"(v_buf), // %[v_buf]
[dst_argb]"+r"(dst_argb), // %[dst_argb] [dst_argb]"+r"(dst_argb), // %[dst_argb]
[width]"+rm"(width) // %[width] [width]"+rm"(width) // %[width]
: [kYuvConstants]"r"(YuvConstants) // %[YuvConstants] : [kYuvConstants]"r"(YuvConstants) // %[kYuvConstants]
: "memory", "cc", NACL_R14 : "memory", "cc", NACL_R14
"xmm0", "xmm1", "xmm2", "xmm3", "xmm5" "xmm0", "xmm1", "xmm2", "xmm3", "xmm5"
); );
...@@ -1950,11 +1951,12 @@ void OMITFP I422ToARGBMatrixRow_AVX2(const uint8* y_buf, ...@@ -1950,11 +1951,12 @@ void OMITFP I422ToARGBMatrixRow_AVX2(const uint8* y_buf,
#if defined(HAS_I422TOABGRROW_AVX2) #if defined(HAS_I422TOABGRROW_AVX2)
// 16 pixels // 16 pixels
// 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 ABGR (64 bytes). // 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 ABGR (64 bytes).
void OMITFP I422ToABGRRow_AVX2(const uint8* y_buf, void OMITFP I422ToABGRMatrixRow_AVX2(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
uint8* dst_argb, uint8* dst_argb,
int width) { struct YuvConstants* YuvConstants,
int width) {
asm volatile ( asm volatile (
"sub %[u_buf],%[v_buf] \n" "sub %[u_buf],%[v_buf] \n"
"vpcmpeqb %%ymm5,%%ymm5,%%ymm5 \n" "vpcmpeqb %%ymm5,%%ymm5,%%ymm5 \n"
...@@ -1981,7 +1983,7 @@ void OMITFP I422ToABGRRow_AVX2(const uint8* y_buf, ...@@ -1981,7 +1983,7 @@ void OMITFP I422ToABGRRow_AVX2(const uint8* y_buf,
[v_buf]"+r"(v_buf), // %[v_buf] [v_buf]"+r"(v_buf), // %[v_buf]
[dst_argb]"+r"(dst_argb), // %[dst_argb] [dst_argb]"+r"(dst_argb), // %[dst_argb]
[width]"+rm"(width) // %[width] [width]"+rm"(width) // %[width]
: [kYuvConstants]"r"(&kYuvConstants.kUVToB) // %[kYuvConstants] : [kYuvConstants]"r"(YuvConstants) // %[kYuvConstants]
: "memory", "cc", NACL_R14 : "memory", "cc", NACL_R14
"xmm0", "xmm1", "xmm2", "xmm3", "xmm5" "xmm0", "xmm1", "xmm2", "xmm3", "xmm5"
); );
......
This diff is collapsed.
...@@ -492,6 +492,7 @@ TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##N) { \ ...@@ -492,6 +492,7 @@ TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##N) { \
TESTPLANARTOB(I420, 2, 2, ARGB, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I420, 2, 2, ARGB, 4, 4, 1, 2, ARGB, 4)
TESTPLANARTOB(J420, 2, 2, ARGB, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(J420, 2, 2, ARGB, 4, 4, 1, 2, ARGB, 4)
TESTPLANARTOB(J420, 2, 2, ABGR, 4, 4, 1, 2, ARGB, 4)
TESTPLANARTOB(I420, 2, 2, BGRA, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I420, 2, 2, BGRA, 4, 4, 1, 2, ARGB, 4)
TESTPLANARTOB(I420, 2, 2, ABGR, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I420, 2, 2, ABGR, 4, 4, 1, 2, ARGB, 4)
TESTPLANARTOB(I420, 2, 2, RGBA, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I420, 2, 2, RGBA, 4, 4, 1, 2, ARGB, 4)
...@@ -502,6 +503,7 @@ TESTPLANARTOB(I420, 2, 2, ARGB1555, 2, 2, 1, 9, ARGB, 4) ...@@ -502,6 +503,7 @@ TESTPLANARTOB(I420, 2, 2, ARGB1555, 2, 2, 1, 9, ARGB, 4)
TESTPLANARTOB(I420, 2, 2, ARGB4444, 2, 2, 1, 17, ARGB, 4) TESTPLANARTOB(I420, 2, 2, ARGB4444, 2, 2, 1, 17, ARGB, 4)
TESTPLANARTOB(I422, 2, 1, ARGB, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I422, 2, 1, ARGB, 4, 4, 1, 2, ARGB, 4)
TESTPLANARTOB(J422, 2, 1, ARGB, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(J422, 2, 1, ARGB, 4, 4, 1, 2, ARGB, 4)
TESTPLANARTOB(J422, 2, 1, ABGR, 4, 4, 1, 2, ARGB, 4)
TESTPLANARTOB(I422, 2, 1, BGRA, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I422, 2, 1, BGRA, 4, 4, 1, 2, ARGB, 4)
TESTPLANARTOB(I422, 2, 1, ABGR, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I422, 2, 1, ABGR, 4, 4, 1, 2, ARGB, 4)
TESTPLANARTOB(I422, 2, 1, RGBA, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I422, 2, 1, RGBA, 4, 4, 1, 2, ARGB, 4)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment