mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-10-28 18:07:12 +08:00
clang format and bump version
Bug: None Change-Id: I6a482d5c538b113549b88e820473af644d6d3704 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/8467772 Reviewed-by: richard winterton <rrwinterton@gmail.com>
This commit is contained in:
parent
128b8362d2
commit
f1c9b58986
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: https://chromium.googlesource.com/libyuv/libyuv/
|
||||
Version: 1972
|
||||
Version: 1973
|
||||
Revision: DEPS
|
||||
License: BSD-3-Clause
|
||||
License File: LICENSE
|
||||
|
||||
@ -196,7 +196,8 @@ int ARGBToI444(const uint8_t* src_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ARGB to I444 with matrix. See ArgbConstants at the top of this file for usage.
|
||||
// ARGB to I444 with matrix. See ArgbConstants at the top of this file for
|
||||
// usage.
|
||||
LIBYUV_API
|
||||
int ARGBToI444Matrix(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
@ -260,7 +261,8 @@ int ABGRToI422(const uint8_t* src_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ARGB to I422 with matrix. See ArgbConstants at the top of this file for usage.
|
||||
// ARGB to I422 with matrix. See ArgbConstants at the top of this file for
|
||||
// usage.
|
||||
LIBYUV_API
|
||||
int ARGBToI422Matrix(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
@ -408,7 +410,8 @@ int ARGBToNV12(const uint8_t* src_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ARGB to NV12 with matrix. See ArgbConstants at the top of this file for usage.
|
||||
// ARGB to NV12 with matrix. See ArgbConstants at the top of this file for
|
||||
// usage.
|
||||
LIBYUV_API
|
||||
int ARGBToNV12Matrix(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
@ -431,7 +434,8 @@ int ARGBToNV16(const uint8_t* src_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ARGB to NV16 with matrix. See ArgbConstants at the top of this file for usage.
|
||||
// ARGB to NV16 with matrix. See ArgbConstants at the top of this file for
|
||||
// usage.
|
||||
LIBYUV_API
|
||||
int ARGBToNV16Matrix(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
@ -454,7 +458,8 @@ int ARGBToNV24(const uint8_t* src_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ARGB to NV24 with matrix. See ArgbConstants at the top of this file for usage.
|
||||
// ARGB to NV24 with matrix. See ArgbConstants at the top of this file for
|
||||
// usage.
|
||||
LIBYUV_API
|
||||
int ARGBToNV24Matrix(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
@ -466,7 +471,8 @@ int ARGBToNV24Matrix(const uint8_t* src_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ARGB to NV21 with matrix. See ArgbConstants at the top of this file for usage.
|
||||
// ARGB to NV21 with matrix. See ArgbConstants at the top of this file for
|
||||
// usage.
|
||||
LIBYUV_API
|
||||
int ARGBToNV21Matrix(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
@ -500,7 +506,8 @@ int ARGBToP010(const uint8_t* src_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ARGB to P010 with matrix. See ArgbConstants at the top of this file for usage.
|
||||
// ARGB to P010 with matrix. See ArgbConstants at the top of this file for
|
||||
// usage.
|
||||
LIBYUV_API
|
||||
int ARGBToP010Matrix(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
@ -523,7 +530,8 @@ int ARGBToP210(const uint8_t* src_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ARGB to P210 with matrix. See ArgbConstants at the top of this file for usage.
|
||||
// ARGB to P210 with matrix. See ArgbConstants at the top of this file for
|
||||
// usage.
|
||||
LIBYUV_API
|
||||
int ARGBToP210Matrix(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
@ -546,7 +554,8 @@ int ARGBToP410(const uint8_t* src_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ARGB to P410 with matrix. See ArgbConstants at the top of this file for usage.
|
||||
// ARGB to P410 with matrix. See ArgbConstants at the top of this file for
|
||||
// usage.
|
||||
LIBYUV_API
|
||||
int ARGBToP410Matrix(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
|
||||
@ -52,9 +52,11 @@ void Convert16To8Plane(const uint16_t* src_y,
|
||||
int height);
|
||||
|
||||
// Convert 8 bit Y to 10/12/16 bit.
|
||||
// "bits" accepts bit depths (10, 12, 16) or legacy scale values (1024, 4096, 65536).
|
||||
// "bits" accepts bit depths (10, 12, 16) or legacy scale values (1024, 4096,
|
||||
// 65536).
|
||||
LIBYUV_API
|
||||
void Convert8To16Plane(const uint8_t* src_y,
|
||||
void Convert8To16Plane(
|
||||
const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint16_t* dst_y,
|
||||
int dst_stride_y,
|
||||
|
||||
@ -2151,10 +2151,14 @@ static inline void ARGBToUVMatrixRow_SVE_SC(const uint8_t* src_argb,
|
||||
}
|
||||
|
||||
#define ARGBTOYMATRIX_SVE(p1, p2, p3, p4, p5) \
|
||||
"ld1w {z0.s}, " p1 "/z, [%[src]] \n" /* load 4*vl pixels */\
|
||||
"ld1w {z1.s}, " p2 "/z, [%[src], #1, mul vl] \n" \
|
||||
"ld1w {z2.s}, " p3 "/z, [%[src], #2, mul vl] \n" \
|
||||
"ld1w {z3.s}, " p4 "/z, [%[src], #3, mul vl] \n" \
|
||||
"ld1w {z0.s}, " p1 \
|
||||
"/z, [%[src]] \n" /* load 4*vl pixels */ \
|
||||
"ld1w {z1.s}, " p2 \
|
||||
"/z, [%[src], #1, mul vl] \n" \
|
||||
"ld1w {z2.s}, " p3 \
|
||||
"/z, [%[src], #2, mul vl] \n" \
|
||||
"ld1w {z3.s}, " p4 \
|
||||
"/z, [%[src], #3, mul vl] \n" \
|
||||
"incb %[src], all, mul #4 \n" \
|
||||
"mov z16.b, #0 \n" \
|
||||
"mov z17.b, #0 \n" \
|
||||
@ -2169,7 +2173,8 @@ static inline void ARGBToUVMatrixRow_SVE_SC(const uint8_t* src_argb,
|
||||
"addhnb z16.b, z16.h, z25.h \n" \
|
||||
"addhnb z18.b, z18.h, z25.h \n" \
|
||||
"uzp1 z20.b, z16.b, z18.b \n" \
|
||||
"st1b {z20.b}, " p5 ", [%[dst_y]] \n" \
|
||||
"st1b {z20.b}, " p5 \
|
||||
", [%[dst_y]] \n" \
|
||||
"incb %[dst_y] \n" \
|
||||
"subs %w[width], %w[width], %w[vl], lsl #2 \n"
|
||||
|
||||
|
||||
@ -218,7 +218,6 @@ void ScalePlaneVertical_16(int src_height,
|
||||
int wpp,
|
||||
enum FilterMode filtering);
|
||||
|
||||
|
||||
// Simplify the filtering based on scale factors.
|
||||
enum FilterMode ScaleFilterReduce(int src_width,
|
||||
int src_height,
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 1972
|
||||
#define LIBYUV_VERSION 1973
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
@ -2091,9 +2091,9 @@ static int Px10ToI420(const uint16_t* src_y,
|
||||
SplitUVRow_16_C;
|
||||
void (*Half16To8)(const uint16_t* src_uv, ptrdiff_t src_uv_stride,
|
||||
uint8_t* dst_uv, int scale, int width) =
|
||||
subsample_x ? HalfRow_16To8_C
|
||||
: ((width & 1) ? HalfWidthRow_16To8_Odd_C
|
||||
: HalfWidthRow_16To8_C);
|
||||
subsample_x
|
||||
? HalfRow_16To8_C
|
||||
: ((width & 1) ? HalfWidthRow_16To8_Odd_C : HalfWidthRow_16To8_C);
|
||||
|
||||
#if defined(HAS_SPLITUVROW_16_AVX2)
|
||||
if (TestCpuFlag(kCpuHasAVX2)) {
|
||||
@ -3807,10 +3807,9 @@ static int RAWToI444Matrix(const uint8_t* src_raw,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*RGBToUV444MatrixRow)(const uint8_t* src_rgb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width,
|
||||
const struct ArgbConstants* c) =
|
||||
RGBToUV444MatrixRow_C;
|
||||
void (*RGBToUV444MatrixRow)(
|
||||
const uint8_t* src_rgb, uint8_t* dst_u, uint8_t* dst_v, int width,
|
||||
const struct ArgbConstants* c) = RGBToUV444MatrixRow_C;
|
||||
void (*RGBToYMatrixRow)(const uint8_t* src_rgb, uint8_t* dst_y, int width,
|
||||
const struct ArgbConstants* c) = RGBToYMatrixRow_C;
|
||||
|
||||
@ -3948,8 +3947,8 @@ int RAWToI444(const uint8_t* src_raw,
|
||||
int width,
|
||||
int height) {
|
||||
return RAWToI444Matrix(src_raw, src_stride_raw, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v,
|
||||
&kAbgrI601Constants, width, height);
|
||||
dst_stride_u, dst_v, dst_stride_v, &kAbgrI601Constants,
|
||||
width, height);
|
||||
}
|
||||
|
||||
// Convert RAW to J444.
|
||||
@ -3965,8 +3964,8 @@ int RAWToJ444(const uint8_t* src_raw,
|
||||
int width,
|
||||
int height) {
|
||||
return RAWToI444Matrix(src_raw, src_stride_raw, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v,
|
||||
&kAbgrJPEGConstants, width, height);
|
||||
dst_stride_u, dst_v, dst_stride_v, &kAbgrJPEGConstants,
|
||||
width, height);
|
||||
}
|
||||
|
||||
// Convert RGB565 to I420.
|
||||
|
||||
@ -957,8 +957,8 @@ static int I420ToPxxx(const uint8_t* src_y,
|
||||
dst_uv_width, width, height, dst_uv_width, abs_height);
|
||||
if (!r) {
|
||||
r = i4xx_to_pxxx(src_y, src_stride_y, tmp_u, dst_uv_width, tmp_v,
|
||||
dst_uv_width, dst_y, dst_stride_y, dst_uv,
|
||||
dst_stride_uv, width, height);
|
||||
dst_uv_width, dst_y, dst_stride_y, dst_uv, dst_stride_uv,
|
||||
width, height);
|
||||
}
|
||||
}
|
||||
free_aligned_buffer_64(plane_u);
|
||||
|
||||
@ -871,8 +871,8 @@ int ARGBToNV16Matrix(const uint8_t* src_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
size_t row_size = (static_cast<size_t>(halfwidth) + 31) &
|
||||
~static_cast<size_t>(31);
|
||||
size_t row_size =
|
||||
(static_cast<size_t>(halfwidth) + 31) & ~static_cast<size_t>(31);
|
||||
if (row_size > SIZE_MAX / 2) {
|
||||
return -1;
|
||||
}
|
||||
@ -1109,8 +1109,8 @@ int ARGBToNV24Matrix(const uint8_t* src_argb,
|
||||
}
|
||||
#endif
|
||||
|
||||
size_t row_size = (static_cast<size_t>(width) + 31) &
|
||||
~static_cast<size_t>(31);
|
||||
size_t row_size =
|
||||
(static_cast<size_t>(width) + 31) & ~static_cast<size_t>(31);
|
||||
if (row_size > SIZE_MAX / 2) {
|
||||
return -1;
|
||||
}
|
||||
@ -3586,7 +3586,6 @@ int RGBAToJ400(const uint8_t* src_rgba,
|
||||
&kRgbaJPEGConstants, width, height);
|
||||
}
|
||||
|
||||
|
||||
// Convert ABGR to J420. (JPeg full range I420).
|
||||
LIBYUV_API
|
||||
int ABGRToJ420(const uint8_t* src_abgr,
|
||||
@ -3780,8 +3779,7 @@ static int RAWToNVMatrix(const uint8_t* src_raw,
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
void (*RGBToUVMatrixRow)(const uint8_t* src_rgb, int src_stride_rgb,
|
||||
uint8_t* dst_u, uint8_t* dst_v, int width,
|
||||
const struct ArgbConstants* c) =
|
||||
RGBToUVMatrixRow_C;
|
||||
const struct ArgbConstants* c) = RGBToUVMatrixRow_C;
|
||||
void (*RGBToYMatrixRow)(const uint8_t* src_rgb, uint8_t* dst_y, int width,
|
||||
const struct ArgbConstants* c) = RGBToYMatrixRow_C;
|
||||
void (*MergeUVRow)(const uint8_t* src_uj, const uint8_t* src_vj,
|
||||
@ -4034,9 +4032,8 @@ int RGB24ToNV12(const uint8_t* src_rgb24,
|
||||
int dst_stride_uv,
|
||||
int width,
|
||||
int height) {
|
||||
return RAWToNVMatrix(src_rgb24, src_stride_rgb24, dst_y, dst_stride_y,
|
||||
dst_uv, dst_stride_uv, &kArgbI601Constants, width,
|
||||
height, 0);
|
||||
return RAWToNVMatrix(src_rgb24, src_stride_rgb24, dst_y, dst_stride_y, dst_uv,
|
||||
dst_stride_uv, &kArgbI601Constants, width, height, 0);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -123,9 +123,9 @@ static int NV24ToARGB(const uint8_t* src_y,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I444ToARGBRow)(
|
||||
const uint8_t* y_buf, const uint8_t* u_buf, const uint8_t* v_buf,
|
||||
uint8_t* rgb_buf, const struct YuvConstants* yuvconstants, int width) =
|
||||
void (*I444ToARGBRow)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||
const uint8_t* v_buf, uint8_t* rgb_buf,
|
||||
const struct YuvConstants* yuvconstants, int width) =
|
||||
I444ToARGBRow_C;
|
||||
void (*SplitUVRow)(const uint8_t* src_uv, uint8_t* dst_u, uint8_t* dst_v,
|
||||
int width) = SplitUVRow_C;
|
||||
@ -293,8 +293,7 @@ int ConvertToARGB(const uint8_t* sample,
|
||||
// and then rotate the ARGB to the final destination buffer.
|
||||
// For in-place conversion, if destination dst_argb is same as source sample,
|
||||
// also enable temporary buffer.
|
||||
int need_buf =
|
||||
(rotation && format != FOURCC_ARGB) || dst_argb == sample;
|
||||
int need_buf = (rotation && format != FOURCC_ARGB) || dst_argb == sample;
|
||||
uint8_t* dest_argb = dst_argb;
|
||||
int dest_dst_stride_argb = dst_stride_argb;
|
||||
uint8_t* rotate_buffer = NULL;
|
||||
@ -428,8 +427,7 @@ int ConvertToARGB(const uint8_t* sample,
|
||||
break;
|
||||
case FOURCC_NV24:
|
||||
src = sample + ((ptrdiff_t)src_width * crop_y + crop_x);
|
||||
src_uv = sample +
|
||||
(ptrdiff_t)aligned_src_width * abs_src_height +
|
||||
src_uv = sample + (ptrdiff_t)aligned_src_width * abs_src_height +
|
||||
(ptrdiff_t)aligned_src_width * 2 * crop_y +
|
||||
(ptrdiff_t)crop_x * 2;
|
||||
r = NV24ToARGB(src, src_width, src_uv, aligned_src_width * 2, dst_argb,
|
||||
|
||||
@ -161,13 +161,11 @@ static int NV24ToI420(const uint8_t* src_y,
|
||||
dst_u[halfwidth - 1] = row_uv[(halfwidth - 1) * 4 + 0];
|
||||
dst_v[halfwidth - 1] = row_uv[(halfwidth - 1) * 4 + 1];
|
||||
} else {
|
||||
dst_u[halfwidth - 1] =
|
||||
(row_uv[(halfwidth - 1) * 4 + 0] + row_uv[(halfwidth - 1) * 4 + 2] +
|
||||
1) >>
|
||||
dst_u[halfwidth - 1] = (row_uv[(halfwidth - 1) * 4 + 0] +
|
||||
row_uv[(halfwidth - 1) * 4 + 2] + 1) >>
|
||||
1;
|
||||
dst_v[halfwidth - 1] =
|
||||
(row_uv[(halfwidth - 1) * 4 + 1] + row_uv[(halfwidth - 1) * 4 + 3] +
|
||||
1) >>
|
||||
dst_v[halfwidth - 1] = (row_uv[(halfwidth - 1) * 4 + 1] +
|
||||
row_uv[(halfwidth - 1) * 4 + 3] + 1) >>
|
||||
1;
|
||||
}
|
||||
src_uv += (ptrdiff_t)src_stride_uv * 2;
|
||||
@ -219,8 +217,7 @@ int ConvertToI420(const uint8_t* sample,
|
||||
const uint8_t* src;
|
||||
const uint8_t* src_uv;
|
||||
int r = 0;
|
||||
int need_buf =
|
||||
(rotation && format != FOURCC_I420 && format != FOURCC_NV12 &&
|
||||
int need_buf = (rotation && format != FOURCC_I420 && format != FOURCC_NV12 &&
|
||||
format != FOURCC_NV21 && format != FOURCC_YV12) ||
|
||||
dst_y == sample;
|
||||
uint8_t* tmp_y = dst_y;
|
||||
@ -363,8 +360,7 @@ int ConvertToI420(const uint8_t* sample,
|
||||
case FOURCC_NV16:
|
||||
src = sample + ((ptrdiff_t)src_width * crop_y + crop_x);
|
||||
src_uv = sample + ((ptrdiff_t)aligned_src_width * abs_src_height) +
|
||||
((ptrdiff_t)crop_y * aligned_src_width) +
|
||||
((crop_x / 2) * 2);
|
||||
((ptrdiff_t)crop_y * aligned_src_width) + ((crop_x / 2) * 2);
|
||||
r = NV16ToI420(src, src_width, src_uv, aligned_src_width, dst_y,
|
||||
dst_stride_y, dst_u, dst_stride_u, dst_v, dst_stride_v,
|
||||
crop_width, inv_crop_height);
|
||||
@ -372,8 +368,7 @@ int ConvertToI420(const uint8_t* sample,
|
||||
case FOURCC_NV24:
|
||||
src = sample + ((ptrdiff_t)src_width * crop_y + crop_x);
|
||||
src_uv = sample + ((ptrdiff_t)aligned_src_width * abs_src_height) +
|
||||
((ptrdiff_t)crop_y * aligned_src_width * 2) +
|
||||
(crop_x * 2);
|
||||
((ptrdiff_t)crop_y * aligned_src_width * 2) + (crop_x * 2);
|
||||
r = NV24ToI420(src, src_width, src_uv, aligned_src_width * 2, dst_y,
|
||||
dst_stride_y, dst_u, dst_stride_u, dst_v, dst_stride_v,
|
||||
crop_width, inv_crop_height);
|
||||
|
||||
@ -141,7 +141,8 @@ bool MJpegDecoder::LoadFrame(const uint8_t* src, size_t src_len) {
|
||||
// next scanline.
|
||||
int databuf_stride = GetComponentStride(i);
|
||||
// Cannot overflow:
|
||||
// - JPEG width is stored as an u16, so `databuf_stride` (width rounded up to
|
||||
// - JPEG width is stored as an u16, so `databuf_stride` (width rounded up
|
||||
// to
|
||||
// DCTSIZE) is at most slightly larger than UINT16_MAX.
|
||||
// - Sampling factor is stored in 4 bits, so scanlines_size is < 16.
|
||||
int databuf_size = scanlines_size * databuf_stride;
|
||||
|
||||
@ -192,7 +192,8 @@ void Convert16To8Plane(const uint16_t* src_y,
|
||||
|
||||
// Convert a plane of 8 bit data to 16 bit
|
||||
LIBYUV_API
|
||||
void Convert8To16Plane(const uint8_t* src_y,
|
||||
void Convert8To16Plane(
|
||||
const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint16_t* dst_y,
|
||||
int dst_stride_y,
|
||||
|
||||
@ -1826,7 +1826,11 @@ ANY11HS(HalfRow_16To8_Any_SSSE3, HalfRow_16To8_SSSE3, uint16_t, uint8_t, 15)
|
||||
ANY11HS(HalfRow_16To8_Any_AVX2, HalfRow_16To8_AVX2, uint16_t, uint8_t, 31)
|
||||
#endif
|
||||
#ifdef HAS_HALFROW_16TO8_AVX512BW
|
||||
ANY11HS(HalfRow_16To8_Any_AVX512BW, HalfRow_16To8_AVX512BW, uint16_t, uint8_t, 63)
|
||||
ANY11HS(HalfRow_16To8_Any_AVX512BW,
|
||||
HalfRow_16To8_AVX512BW,
|
||||
uint16_t,
|
||||
uint8_t,
|
||||
63)
|
||||
#endif
|
||||
#ifdef HAS_HALFROW_16TO8_NEON
|
||||
ANY11HS(HalfRow_16To8_Any_NEON, HalfRow_16To8_NEON, uint16_t, uint8_t, 15)
|
||||
@ -1858,16 +1862,32 @@ ANY11HS(HalfRow_16To8_Any_NEON, HalfRow_16To8_NEON, uint16_t, uint8_t, 15)
|
||||
}
|
||||
|
||||
#ifdef HAS_HALFWIDTHROW_16TO8_SSSE3
|
||||
ANY11HWS(HalfWidthRow_16To8_Any_SSSE3, HalfWidthRow_16To8_SSSE3, uint16_t, uint8_t, 7)
|
||||
ANY11HWS(HalfWidthRow_16To8_Any_SSSE3,
|
||||
HalfWidthRow_16To8_SSSE3,
|
||||
uint16_t,
|
||||
uint8_t,
|
||||
7)
|
||||
#endif
|
||||
#ifdef HAS_HALFWIDTHROW_16TO8_AVX2
|
||||
ANY11HWS(HalfWidthRow_16To8_Any_AVX2, HalfWidthRow_16To8_AVX2, uint16_t, uint8_t, 15)
|
||||
ANY11HWS(HalfWidthRow_16To8_Any_AVX2,
|
||||
HalfWidthRow_16To8_AVX2,
|
||||
uint16_t,
|
||||
uint8_t,
|
||||
15)
|
||||
#endif
|
||||
#ifdef HAS_HALFWIDTHROW_16TO8_AVX512BW
|
||||
ANY11HWS(HalfWidthRow_16To8_Any_AVX512BW, HalfWidthRow_16To8_AVX512BW, uint16_t, uint8_t, 31)
|
||||
ANY11HWS(HalfWidthRow_16To8_Any_AVX512BW,
|
||||
HalfWidthRow_16To8_AVX512BW,
|
||||
uint16_t,
|
||||
uint8_t,
|
||||
31)
|
||||
#endif
|
||||
#ifdef HAS_HALFWIDTHROW_16TO8_NEON
|
||||
ANY11HWS(HalfWidthRow_16To8_Any_NEON, HalfWidthRow_16To8_NEON, uint16_t, uint8_t, 7)
|
||||
ANY11HWS(HalfWidthRow_16To8_Any_NEON,
|
||||
HalfWidthRow_16To8_NEON,
|
||||
uint16_t,
|
||||
uint8_t,
|
||||
7)
|
||||
#endif
|
||||
|
||||
#undef ANY11HWS
|
||||
@ -2299,10 +2319,7 @@ ANY12M(ARGBToUV444MatrixRow_Any_NEON, ARGBToUV444MatrixRow_NEON, 4, 7)
|
||||
ANY12M(RGBToUV444MatrixRow_Any_NEON, RGBToUV444MatrixRow_NEON, 3, 7)
|
||||
#endif
|
||||
#ifdef HAS_ARGBTOUV444MATRIXROW_NEON_I8MM
|
||||
ANY12M(ARGBToUV444MatrixRow_Any_NEON_I8MM,
|
||||
ARGBToUV444MatrixRow_NEON_I8MM,
|
||||
4,
|
||||
7)
|
||||
ANY12M(ARGBToUV444MatrixRow_Any_NEON_I8MM, ARGBToUV444MatrixRow_NEON_I8MM, 4, 7)
|
||||
#endif
|
||||
|
||||
#define ANY11MC(NAMEANY, ANY_SIMD, BPP, MASK) \
|
||||
|
||||
@ -3704,19 +3704,16 @@ void HalfWidthRow_16To8_C(const uint16_t* src_uv,
|
||||
int x;
|
||||
for (x = 0; x < width - 1; x += 2) {
|
||||
dst_uv[0] = STATIC_CAST(
|
||||
uint8_t,
|
||||
C16TO8((s[0] + s[1] + t[0] + t[1] + 2) >> 2, scale));
|
||||
uint8_t, C16TO8((s[0] + s[1] + t[0] + t[1] + 2) >> 2, scale));
|
||||
dst_uv[1] = STATIC_CAST(
|
||||
uint8_t,
|
||||
C16TO8((s[2] + s[3] + t[2] + t[3] + 2) >> 2, scale));
|
||||
uint8_t, C16TO8((s[2] + s[3] + t[2] + t[3] + 2) >> 2, scale));
|
||||
dst_uv += 2;
|
||||
s += 4;
|
||||
t += 4;
|
||||
}
|
||||
if (width & 1) {
|
||||
dst_uv[0] = STATIC_CAST(
|
||||
uint8_t,
|
||||
C16TO8((s[0] + s[1] + t[0] + t[1] + 2) >> 2, scale));
|
||||
uint8_t, C16TO8((s[0] + s[1] + t[0] + t[1] + 2) >> 2, scale));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3731,19 +3728,16 @@ void HalfWidthRow_16To8_Odd_C(const uint16_t* src_uv,
|
||||
width -= 1;
|
||||
for (x = 0; x < width - 1; x += 2) {
|
||||
dst_uv[0] = STATIC_CAST(
|
||||
uint8_t,
|
||||
C16TO8((s[0] + s[1] + t[0] + t[1] + 2) >> 2, scale));
|
||||
uint8_t, C16TO8((s[0] + s[1] + t[0] + t[1] + 2) >> 2, scale));
|
||||
dst_uv[1] = STATIC_CAST(
|
||||
uint8_t,
|
||||
C16TO8((s[2] + s[3] + t[2] + t[3] + 2) >> 2, scale));
|
||||
uint8_t, C16TO8((s[2] + s[3] + t[2] + t[3] + 2) >> 2, scale));
|
||||
dst_uv += 2;
|
||||
s += 4;
|
||||
t += 4;
|
||||
}
|
||||
if (width & 1) {
|
||||
dst_uv[0] = STATIC_CAST(
|
||||
uint8_t,
|
||||
C16TO8((s[0] + s[1] + t[0] + t[1] + 2) >> 2, scale));
|
||||
uint8_t, C16TO8((s[0] + s[1] + t[0] + t[1] + 2) >> 2, scale));
|
||||
dst_uv += 1;
|
||||
s += 2;
|
||||
t += 2;
|
||||
@ -4280,8 +4274,6 @@ void I422ToARGB4444Row_AVX2(const uint8_t* src_y,
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(HAS_I444TOARGBROW_AVX2) && defined(HAS_ARGBTORGB24ROW_AVX2)
|
||||
void I444ToRGB24Row_AVX2(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
@ -4675,8 +4667,7 @@ void RGBToUVMatrixRow_AVX512BW(const uint8_t* src_rgb,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAS_ARGBTOUV444MATRIXROW_SSSE3) && \
|
||||
defined(HAS_RGB24TOARGBROW_SSSE3)
|
||||
#if defined(HAS_ARGBTOUV444MATRIXROW_SSSE3) && defined(HAS_RGB24TOARGBROW_SSSE3)
|
||||
void RGBToUV444MatrixRow_SSSE3(const uint8_t* src_rgb,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
@ -4695,8 +4686,7 @@ void RGBToUV444MatrixRow_SSSE3(const uint8_t* src_rgb,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAS_ARGBTOUV444MATRIXROW_AVX2) && \
|
||||
defined(HAS_RGB24TOARGBROW_AVX2)
|
||||
#if defined(HAS_ARGBTOUV444MATRIXROW_AVX2) && defined(HAS_RGB24TOARGBROW_AVX2)
|
||||
void RGBToUV444MatrixRow_AVX2(const uint8_t* src_rgb,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
|
||||
@ -101,33 +101,33 @@ static const uint32_t kPermdRGB24_2_AVX512BW[16] = {
|
||||
#endif // defined(HAS_RAWTORGB24ROW_AVX512BW)
|
||||
#if defined(HAS_RAWTORGB24ROW_AVX512VBMI)
|
||||
static const uint8_t kPermRAWToRGB24_0[64] = {
|
||||
0x02, 0x01, 0x00, 0x05, 0x04, 0x03, 0x08, 0x07, 0x06, 0x0b, 0x0a, 0x09,
|
||||
0x0e, 0x0d, 0x0c, 0x11, 0x10, 0x0f, 0x14, 0x13, 0x12, 0x17, 0x16, 0x15,
|
||||
0x1a, 0x19, 0x18, 0x1d, 0x1c, 0x1b, 0x20, 0x1f, 0x1e, 0x23, 0x22, 0x21,
|
||||
0x26, 0x25, 0x24, 0x29, 0x28, 0x27, 0x2c, 0x2b, 0x2a, 0x2f, 0x2e, 0x2d,
|
||||
0x32, 0x31, 0x30, 0x35, 0x34, 0x33, 0x38, 0x37, 0x36, 0x3b, 0x3a, 0x39,
|
||||
0x3e, 0x3d, 0x3c, 0x41};
|
||||
0x02, 0x01, 0x00, 0x05, 0x04, 0x03, 0x08, 0x07, 0x06, 0x0b, 0x0a,
|
||||
0x09, 0x0e, 0x0d, 0x0c, 0x11, 0x10, 0x0f, 0x14, 0x13, 0x12, 0x17,
|
||||
0x16, 0x15, 0x1a, 0x19, 0x18, 0x1d, 0x1c, 0x1b, 0x20, 0x1f, 0x1e,
|
||||
0x23, 0x22, 0x21, 0x26, 0x25, 0x24, 0x29, 0x28, 0x27, 0x2c, 0x2b,
|
||||
0x2a, 0x2f, 0x2e, 0x2d, 0x32, 0x31, 0x30, 0x35, 0x34, 0x33, 0x38,
|
||||
0x37, 0x36, 0x3b, 0x3a, 0x39, 0x3e, 0x3d, 0x3c, 0x41};
|
||||
static const uint8_t kPermRAWToRGB24_1[64] = {
|
||||
0x00, 0x7f, 0x04, 0x03, 0x02, 0x07, 0x06, 0x05, 0x0a, 0x09, 0x08, 0x0d,
|
||||
0x0c, 0x0b, 0x10, 0x0f, 0x0e, 0x13, 0x12, 0x11, 0x16, 0x15, 0x14, 0x19,
|
||||
0x18, 0x17, 0x1c, 0x1b, 0x1a, 0x1f, 0x1e, 0x1d, 0x22, 0x21, 0x20, 0x25,
|
||||
0x24, 0x23, 0x28, 0x27, 0x26, 0x2b, 0x2a, 0x29, 0x2e, 0x2d, 0x2c, 0x31,
|
||||
0x30, 0x2f, 0x34, 0x33, 0x32, 0x37, 0x36, 0x35, 0x3a, 0x39, 0x38, 0x3d,
|
||||
0x3c, 0x3b, 0x00, 0x3f};
|
||||
0x00, 0x7f, 0x04, 0x03, 0x02, 0x07, 0x06, 0x05, 0x0a, 0x09, 0x08,
|
||||
0x0d, 0x0c, 0x0b, 0x10, 0x0f, 0x0e, 0x13, 0x12, 0x11, 0x16, 0x15,
|
||||
0x14, 0x19, 0x18, 0x17, 0x1c, 0x1b, 0x1a, 0x1f, 0x1e, 0x1d, 0x22,
|
||||
0x21, 0x20, 0x25, 0x24, 0x23, 0x28, 0x27, 0x26, 0x2b, 0x2a, 0x29,
|
||||
0x2e, 0x2d, 0x2c, 0x31, 0x30, 0x2f, 0x34, 0x33, 0x32, 0x37, 0x36,
|
||||
0x35, 0x3a, 0x39, 0x38, 0x3d, 0x3c, 0x3b, 0x00, 0x3f};
|
||||
static const uint8_t kPermRAWToRGB24_2[64] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
|
||||
0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
|
||||
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
|
||||
0x3c, 0x3d, 0x40, 0x3f};
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
|
||||
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
|
||||
0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
|
||||
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
|
||||
0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
|
||||
0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x40, 0x3f};
|
||||
static const uint8_t kPermRAWToRGB24_3[64] = {
|
||||
0x3e, 0x43, 0x42, 0x41, 0x46, 0x45, 0x44, 0x49, 0x48, 0x47, 0x4c, 0x4b,
|
||||
0x4a, 0x4f, 0x4e, 0x4d, 0x52, 0x51, 0x50, 0x55, 0x54, 0x53, 0x58, 0x57,
|
||||
0x56, 0x5b, 0x5a, 0x59, 0x5e, 0x5d, 0x5c, 0x61, 0x60, 0x5f, 0x64, 0x63,
|
||||
0x62, 0x67, 0x66, 0x65, 0x6a, 0x69, 0x68, 0x6d, 0x6c, 0x6b, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x72, 0x71, 0x76, 0x75, 0x74, 0x79, 0x78, 0x77, 0x7c, 0x7b,
|
||||
0x7a, 0x7f, 0x7e, 0x7d};
|
||||
0x3e, 0x43, 0x42, 0x41, 0x46, 0x45, 0x44, 0x49, 0x48, 0x47, 0x4c,
|
||||
0x4b, 0x4a, 0x4f, 0x4e, 0x4d, 0x52, 0x51, 0x50, 0x55, 0x54, 0x53,
|
||||
0x58, 0x57, 0x56, 0x5b, 0x5a, 0x59, 0x5e, 0x5d, 0x5c, 0x61, 0x60,
|
||||
0x5f, 0x64, 0x63, 0x62, 0x67, 0x66, 0x65, 0x6a, 0x69, 0x68, 0x6d,
|
||||
0x6c, 0x6b, 0x70, 0x6f, 0x6e, 0x73, 0x72, 0x71, 0x76, 0x75, 0x74,
|
||||
0x79, 0x78, 0x77, 0x7c, 0x7b, 0x7a, 0x7f, 0x7e, 0x7d};
|
||||
#endif // defined(HAS_RAWTORGB24ROW_AVX512VBMI)
|
||||
|
||||
#if defined(HAS_RAWTORGBAROW_SSSE3)
|
||||
@ -434,14 +434,11 @@ void RAWToARGBRow_AVX2(const uint8_t* src_raw, uint8_t* dst_argb, int width) {
|
||||
defined(HAS_RGB24TOARGBROW_AVX512BW) || \
|
||||
defined(HAS_RAWTORGB24ROW_AVX512BW) || \
|
||||
defined(HAS_RGBTOYMATRIXROW_AVX512BW)
|
||||
static const uint64_t kPermqRGB24ToARGB0_AVX512BW[8] = {0, 1, 1, 2,
|
||||
3, 4, 4, 5};
|
||||
static const uint64_t kPermqRGB24ToARGB0_AVX512BW[8] = {0, 1, 1, 2, 3, 4, 4, 5};
|
||||
static const uint64_t kPermqRGB24ToARGB1_AVX512BW[8] = {6, 7, 7, 8,
|
||||
9, 10, 10, 11};
|
||||
static const uint64_t kPermqRGB24ToARGB2_AVX512BW[8] = {4, 5, 5, 6,
|
||||
7, 8, 8, 9};
|
||||
static const uint64_t kPermqRGB24ToARGB3_AVX512BW[8] = {2, 3, 3, 4,
|
||||
5, 6, 6, 7};
|
||||
static const uint64_t kPermqRGB24ToARGB2_AVX512BW[8] = {4, 5, 5, 6, 7, 8, 8, 9};
|
||||
static const uint64_t kPermqRGB24ToARGB3_AVX512BW[8] = {2, 3, 3, 4, 5, 6, 6, 7};
|
||||
#endif // defined(HAS_RAWTOARGBROW_AVX512BW) ||
|
||||
// defined(HAS_RGB24TOARGBROW_AVX512BW) ||
|
||||
// defined(HAS_RAWTORGB24ROW_AVX512BW) ||
|
||||
@ -595,9 +592,7 @@ void RAWToRGB24Row_SSSE3(const uint8_t* src_raw,
|
||||
#endif // HAS_RAWTORGB24ROW_SSSE3
|
||||
|
||||
#ifdef HAS_RAWTORGB24ROW_AVX2
|
||||
void RAWToRGB24Row_AVX2(const uint8_t* src_raw,
|
||||
uint8_t* dst_rgb24,
|
||||
int width) {
|
||||
void RAWToRGB24Row_AVX2(const uint8_t* src_raw, uint8_t* dst_rgb24, int width) {
|
||||
asm volatile(
|
||||
"vmovdqu %3,%%ymm7 \n" // shuffler (32 bytes)
|
||||
"vmovdqu %4,%%ymm8 \n" // kPermd0_AVX2
|
||||
@ -716,8 +711,8 @@ void RAWToRGB24Row_AVX512BW(const uint8_t* src_raw,
|
||||
"m"(kPermdRGB24_1_AVX512BW), // %9
|
||||
"m"(kPermdRGB24_2_AVX512BW) // %10
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm16",
|
||||
"xmm17", "xmm18", "xmm19", "xmm20", "xmm21", "xmm22", "xmm23",
|
||||
"xmm24", "xmm25", "xmm26");
|
||||
"xmm17", "xmm18", "xmm19", "xmm20", "xmm21", "xmm22", "xmm23", "xmm24",
|
||||
"xmm25", "xmm26");
|
||||
}
|
||||
#endif // HAS_RAWTORGB24ROW_AVX512BW
|
||||
|
||||
@ -1838,8 +1833,7 @@ void ARGBToYMatrixRow_AVX512BW(const uint8_t* src_argb,
|
||||
"vpmaddwd %%zmm16,%%zmm18,%%zmm18 \n"
|
||||
"vpackssdw %%zmm18,%%zmm18,%%zmm18 \n"
|
||||
"vpsubw %%zmm18,%%zmm17,%%zmm17 \n"
|
||||
"vmovups %4,%%zmm18 \n"
|
||||
LABELALIGN
|
||||
"vmovups %4,%%zmm18 \n" LABELALIGN
|
||||
"1: \n"
|
||||
"vmovups (%0),%%zmm0 \n"
|
||||
"vmovups 0x40(%0),%%zmm1 \n"
|
||||
@ -1876,8 +1870,8 @@ void ARGBToYMatrixRow_AVX512BW(const uint8_t* src_argb,
|
||||
"+r"(width) // %2
|
||||
: "r"(c), // %3
|
||||
"m"(kPermdARGBToY_AVX512BW) // %4
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5",
|
||||
"xmm16", "xmm17", "xmm18");
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm16",
|
||||
"xmm17", "xmm18");
|
||||
}
|
||||
#endif // HAS_ARGBTOYMATRIXROW_AVX512BW
|
||||
|
||||
@ -1902,7 +1896,8 @@ void RGBToYMatrixRow_AVX512BW(const uint8_t* src_rgb,
|
||||
"vpmaddwd %%zmm16,%%zmm18,%%zmm18 \n"
|
||||
"vpackssdw %%zmm18,%%zmm18,%%zmm18 \n"
|
||||
"vpsubw %%zmm18,%%zmm17,%%zmm17 \n" // zmm17 = adjusted bias
|
||||
"vmovups %4,%%zmm25 \n" // zmm25 = kPermdARGBToY_AVX512BW
|
||||
"vmovups %4,%%zmm25 \n" // zmm25 =
|
||||
// kPermdARGBToY_AVX512BW
|
||||
LABELALIGN
|
||||
"1: \n"
|
||||
"vmovdqu8 (%0),%%zmm0 \n"
|
||||
@ -1956,9 +1951,9 @@ void RGBToYMatrixRow_AVX512BW(const uint8_t* src_rgb,
|
||||
"m"(kPermqRGB24ToARGB2_AVX512BW), // %7
|
||||
"m"(kPermqRGB24ToARGB3_AVX512BW), // %8
|
||||
"m"(kShuffleMaskRGB24ToARGB) // %9
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5",
|
||||
"xmm16", "xmm17", "xmm18", "xmm19", "xmm20", "xmm21", "xmm22",
|
||||
"xmm23", "xmm24", "xmm25");
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm16",
|
||||
"xmm17", "xmm18", "xmm19", "xmm20", "xmm21", "xmm22", "xmm23", "xmm24",
|
||||
"xmm25");
|
||||
}
|
||||
#endif // HAS_RGBTOYMATRIXROW_AVX512BW
|
||||
|
||||
@ -2179,8 +2174,8 @@ void ARGBToUV444MatrixRow_AVX512BW(const uint8_t* src_argb,
|
||||
#endif
|
||||
: "r"(c), // %4
|
||||
"m"(kPermdARGBToY_AVX512BW) // %5
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5",
|
||||
"xmm16", "xmm17", "xmm18");
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm16",
|
||||
"xmm17", "xmm18");
|
||||
}
|
||||
#endif // HAS_ARGBTOUV444MATRIXROW_AVX512BW
|
||||
|
||||
@ -2425,8 +2420,8 @@ void ARGBToUVMatrixRow_AVX512BW(const uint8_t* src_argb,
|
||||
"m"(kShuffleAARRGGBB), // %6
|
||||
"m"(kPermdARGBToY_AVX512BW), // %7
|
||||
"m"(kPermdARGBToUV_AVX512BW) // %8
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5",
|
||||
"xmm16", "xmm17", "xmm18", "xmm19", "xmm20", "xmm21");
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm16",
|
||||
"xmm17", "xmm18", "xmm19", "xmm20", "xmm21");
|
||||
}
|
||||
#endif // HAS_ARGBTOUVMATRIXROW_AVX512BW
|
||||
|
||||
@ -4051,7 +4046,8 @@ void OMITFP I422ToARGBRow_AVX2(const uint8_t* y_buf,
|
||||
|
||||
#if defined(HAS_I422TORGB24ROW_AVX2)
|
||||
// 16 pixels
|
||||
// 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 RGB24 (48 bytes).
|
||||
// 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 RGB24 (48
|
||||
// bytes).
|
||||
void OMITFP I422ToRGB24Row_AVX2(const uint8_t* y_buf,
|
||||
const uint8_t* u_buf,
|
||||
const uint8_t* v_buf,
|
||||
@ -4154,29 +4150,30 @@ void OMITFP I422ToARGBRow_AVX512BW(const uint8_t* y_buf,
|
||||
|
||||
#if defined(HAS_I422TORGB24ROW_AVX512VBMI)
|
||||
static const uint8_t kMaskBG[64] = {
|
||||
0x00, 0x40, 0x01, 0x41, 0x02, 0x42, 0x03, 0x43, 0x04, 0x44, 0x05, 0x45,
|
||||
0x06, 0x46, 0x07, 0x47, 0x10, 0x50, 0x11, 0x51, 0x12, 0x52, 0x13, 0x53,
|
||||
0x14, 0x54, 0x15, 0x55, 0x16, 0x56, 0x17, 0x57, 0x20, 0x60, 0x21, 0x61,
|
||||
0x22, 0x62, 0x23, 0x63, 0x24, 0x64, 0x25, 0x65, 0x26, 0x66, 0x27, 0x67,
|
||||
0x30, 0x70, 0x31, 0x71, 0x32, 0x72, 0x33, 0x73, 0x34, 0x74, 0x35, 0x75,
|
||||
0x36, 0x76, 0x37, 0x77};
|
||||
0x00, 0x40, 0x01, 0x41, 0x02, 0x42, 0x03, 0x43, 0x04, 0x44, 0x05,
|
||||
0x45, 0x06, 0x46, 0x07, 0x47, 0x10, 0x50, 0x11, 0x51, 0x12, 0x52,
|
||||
0x13, 0x53, 0x14, 0x54, 0x15, 0x55, 0x16, 0x56, 0x17, 0x57, 0x20,
|
||||
0x60, 0x21, 0x61, 0x22, 0x62, 0x23, 0x63, 0x24, 0x64, 0x25, 0x65,
|
||||
0x26, 0x66, 0x27, 0x67, 0x30, 0x70, 0x31, 0x71, 0x32, 0x72, 0x33,
|
||||
0x73, 0x34, 0x74, 0x35, 0x75, 0x36, 0x76, 0x37, 0x77};
|
||||
static const uint8_t kMaskDST0[64] = {
|
||||
0x00, 0x01, 0x40, 0x02, 0x03, 0x41, 0x04, 0x05, 0x42, 0x06, 0x07, 0x43,
|
||||
0x08, 0x09, 0x44, 0x0a, 0x0b, 0x45, 0x0c, 0x0d, 0x46, 0x0e, 0x0f, 0x47,
|
||||
0x10, 0x11, 0x50, 0x12, 0x13, 0x51, 0x14, 0x15, 0x52, 0x16, 0x17, 0x53,
|
||||
0x18, 0x19, 0x54, 0x1a, 0x1b, 0x55, 0x1c, 0x1d, 0x56, 0x1e, 0x1f, 0x57,
|
||||
0x20, 0x21, 0x60, 0x22, 0x23, 0x61, 0x24, 0x25, 0x62, 0x26, 0x27, 0x63,
|
||||
0x28, 0x29, 0x64, 0x2a};
|
||||
0x00, 0x01, 0x40, 0x02, 0x03, 0x41, 0x04, 0x05, 0x42, 0x06, 0x07,
|
||||
0x43, 0x08, 0x09, 0x44, 0x0a, 0x0b, 0x45, 0x0c, 0x0d, 0x46, 0x0e,
|
||||
0x0f, 0x47, 0x10, 0x11, 0x50, 0x12, 0x13, 0x51, 0x14, 0x15, 0x52,
|
||||
0x16, 0x17, 0x53, 0x18, 0x19, 0x54, 0x1a, 0x1b, 0x55, 0x1c, 0x1d,
|
||||
0x56, 0x1e, 0x1f, 0x57, 0x20, 0x21, 0x60, 0x22, 0x23, 0x61, 0x24,
|
||||
0x25, 0x62, 0x26, 0x27, 0x63, 0x28, 0x29, 0x64, 0x2a};
|
||||
static const uint8_t kMaskDST1[64] = {
|
||||
0x2b, 0x65, 0x2c, 0x2d, 0x66, 0x2e, 0x2f, 0x67, 0x30, 0x31, 0x70, 0x32,
|
||||
0x33, 0x71, 0x34, 0x35, 0x72, 0x36, 0x37, 0x73, 0x38, 0x39, 0x74, 0x3a,
|
||||
0x3b, 0x75, 0x3c, 0x3d, 0x76, 0x3e, 0x3f, 0x77, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00};
|
||||
0x2b, 0x65, 0x2c, 0x2d, 0x66, 0x2e, 0x2f, 0x67, 0x30, 0x31, 0x70,
|
||||
0x32, 0x33, 0x71, 0x34, 0x35, 0x72, 0x36, 0x37, 0x73, 0x38, 0x39,
|
||||
0x74, 0x3a, 0x3b, 0x75, 0x3c, 0x3d, 0x76, 0x3e, 0x3f, 0x77, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
// 32 pixels
|
||||
// 16 UV values upsampled to 32 UV, mixed with 32 Y producing 32 RGB24 (96 bytes).
|
||||
// 16 UV values upsampled to 32 UV, mixed with 32 Y producing 32 RGB24 (96
|
||||
// bytes).
|
||||
void OMITFP I422ToRGB24Row_AVX512VBMI(const uint8_t* y_buf,
|
||||
const uint8_t* u_buf,
|
||||
const uint8_t* v_buf,
|
||||
@ -5903,8 +5900,7 @@ void MultiplyRow_16_AVX512BW(const uint16_t* src_y,
|
||||
uint16_t* dst_y,
|
||||
int scale,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"vpbroadcastw %3,%%zmm2 \n"
|
||||
asm volatile("vpbroadcastw %3,%%zmm2 \n"
|
||||
|
||||
// 64 pixels per loop.
|
||||
LABELALIGN
|
||||
@ -6150,8 +6146,8 @@ void HalfWidthRow_16To8_SSSE3(const uint16_t* src_uv,
|
||||
: "r"(src_uv_stride), // %3
|
||||
"rm"(scale), // %4
|
||||
"m"(kShuffleMaskHalfWidth16To8) // %5
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5",
|
||||
"xmm6", "xmm7");
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6",
|
||||
"xmm7");
|
||||
}
|
||||
#endif // HAS_HALFWIDTHROW_16TO8_SSSE3
|
||||
|
||||
@ -6237,8 +6233,7 @@ void HalfWidthRow_16To8_AVX2(const uint16_t* src_uv,
|
||||
"+r"(width) // %2
|
||||
: "r"(src_uv_stride), // %3
|
||||
"rm"(scale) // %4
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5",
|
||||
"xmm6");
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6");
|
||||
}
|
||||
#endif // HAS_HALFWIDTHROW_16TO8_AVX2
|
||||
|
||||
@ -6250,8 +6245,7 @@ void HalfRow_16To8_AVX512BW(const uint16_t* src_uv,
|
||||
int width) {
|
||||
const uint16_t* src_uv1 = src_uv + src_uv_stride;
|
||||
const int shift = 16 - __builtin_ctz((uint32_t)scale);
|
||||
asm volatile(
|
||||
"vpbroadcastw %4,%%zmm2 \n"
|
||||
asm volatile("vpbroadcastw %4,%%zmm2 \n"
|
||||
|
||||
// 64 pixels per loop.
|
||||
LABELALIGN
|
||||
@ -6325,8 +6319,7 @@ void HalfWidthRow_16To8_AVX512BW(const uint16_t* src_uv,
|
||||
"+r"(dst_uv), // %2
|
||||
"+r"(width) // %3
|
||||
: "rm"(scale) // %4
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5",
|
||||
"xmm6");
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6");
|
||||
}
|
||||
#endif // HAS_HALFWIDTHROW_16TO8_AVX512BW
|
||||
|
||||
@ -6340,8 +6333,7 @@ void Convert8To16Row_SSE2(const uint8_t* src_y,
|
||||
int bits,
|
||||
int width) {
|
||||
const int shift = 16 - bits;
|
||||
asm volatile(
|
||||
"movd %3,%%xmm2 \n"
|
||||
asm volatile("movd %3,%%xmm2 \n"
|
||||
|
||||
// 16 pixels per loop.
|
||||
LABELALIGN
|
||||
@ -7206,8 +7198,7 @@ void MergeXR30Row_AVX2(const uint16_t* src_r,
|
||||
#else
|
||||
: "rm"(shift) // %5
|
||||
#endif
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5",
|
||||
"xmm6");
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6");
|
||||
}
|
||||
#endif // HAS_MERGEXR30ROW_AVX2
|
||||
|
||||
@ -8990,7 +8981,8 @@ void ARGBMultiplyRow_SSE2(const uint8_t* src_argb,
|
||||
const uint8_t* src_argb1,
|
||||
uint8_t* dst_argb,
|
||||
int width) {
|
||||
asm volatile("pxor %%xmm5,%%xmm5 \n"
|
||||
asm volatile(
|
||||
"pxor %%xmm5,%%xmm5 \n"
|
||||
"pcmpeqw %%xmm4,%%xmm4 \n"
|
||||
"psrlw $0xf,%%xmm4 \n"
|
||||
"psllw $0x7,%%xmm4 \n"
|
||||
@ -9024,8 +9016,7 @@ void ARGBMultiplyRow_SSE2(const uint8_t* src_argb,
|
||||
"+r"(dst_argb), // %2
|
||||
"+r"(width) // %3
|
||||
:
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4",
|
||||
"xmm5");
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5");
|
||||
}
|
||||
#endif // HAS_ARGBMULTIPLYROW_SSE2
|
||||
|
||||
@ -9343,8 +9334,7 @@ void SobelToPlaneRow_SSE2(const uint8_t* src_sobelx,
|
||||
const uint8_t* src_sobely,
|
||||
uint8_t* dst_y,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"sub %0,%1 \n"
|
||||
asm volatile("sub %0,%1 \n"
|
||||
|
||||
// 8 pixel loop.
|
||||
LABELALIGN
|
||||
@ -10789,7 +10779,8 @@ void NV21ToYUV24Row_AVX512(const uint8_t* src_y,
|
||||
"+r"(dst_yuv24), // %2
|
||||
"+r"(width) // %3
|
||||
: "r"(&kYUV24Perm[0]) // %4
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm16");
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5",
|
||||
"xmm16");
|
||||
}
|
||||
|
||||
#endif // HAS_NV21ToYUV24ROW_AVX512
|
||||
|
||||
@ -491,8 +491,7 @@ void NV12ToRGB24Row_NEON(const uint8_t* src_y,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(
|
||||
YUVTORGB_SETUP
|
||||
"1: \n" //
|
||||
YUVTORGB_SETUP "1: \n" //
|
||||
READNV12 YUVTORGB RGBTORGB8
|
||||
"subs %[width], %[width], #8 \n"
|
||||
"vst3.8 {d0, d2, d4}, [%[dst_rgb24]]! \n"
|
||||
@ -512,8 +511,7 @@ void NV21ToRGB24Row_NEON(const uint8_t* src_y,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(
|
||||
YUVTORGB_SETUP
|
||||
"1: \n" //
|
||||
YUVTORGB_SETUP "1: \n" //
|
||||
READNV21 YUVTORGB RGBTORGB8
|
||||
"subs %[width], %[width], #8 \n"
|
||||
"vst3.8 {d0, d2, d4}, [%[dst_rgb24]]! \n"
|
||||
@ -1940,8 +1938,8 @@ void RGBToUV444MatrixRow_NEON(const uint8_t* src_rgb,
|
||||
: "r"(&c->kRGBToU), // %4
|
||||
"r"(&c->kRGBToV), // %5
|
||||
"r"(&c->kAddUV) // %6
|
||||
: "cc", "memory", "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7",
|
||||
"q10", "q11", "q12", "q13");
|
||||
: "cc", "memory", "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7", "q10",
|
||||
"q11", "q12", "q13");
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
@ -2087,8 +2085,8 @@ void RGBToUVMatrixRow_NEON(const uint8_t* src_rgb,
|
||||
"+r"(width) // %4
|
||||
: "r"(&c->kRGBToU), // %5
|
||||
"r"(&c->kRGBToV) // %6
|
||||
: "cc", "memory", "q0", "q1", "q2", "q3", "q4", "q5", "q8",
|
||||
"q9", "q11", "q12", "q14", "q15");
|
||||
: "cc", "memory", "q0", "q1", "q2", "q3", "q4", "q5", "q8", "q9", "q11",
|
||||
"q12", "q14", "q15");
|
||||
}
|
||||
|
||||
void RGB24ToUVRow_NEON(const uint8_t* src_rgb24,
|
||||
@ -3127,8 +3125,10 @@ void BlendPlaneRow_NEON(const uint8_t* src0,
|
||||
"vmull.u8 q6, d2, d18 \n"
|
||||
"pld [%2, #448] \n"
|
||||
"vmull.u8 q7, d3, d19 \n"
|
||||
"vmlal.u8 q4, d4, d20 \n" // low + src1 * (255 - alpha)
|
||||
"vmlal.u8 q5, d5, d21 \n" // high + src1 * (255 - alpha)
|
||||
"vmlal.u8 q4, d4, d20 \n" // low + src1 * (255 -
|
||||
// alpha)
|
||||
"vmlal.u8 q5, d5, d21 \n" // high + src1 * (255 -
|
||||
// alpha)
|
||||
"vmlal.u8 q6, d6, d22 \n"
|
||||
"vmlal.u8 q7, d7, d23 \n"
|
||||
"vaddhn.u16 d0, q4, q15 \n" // (low + 255) >> 8
|
||||
@ -3148,8 +3148,10 @@ void BlendPlaneRow_NEON(const uint8_t* src0,
|
||||
"vmvn.8 q12, q2 \n" // 255 - alpha
|
||||
"vmull.u8 q4, d0, d4 \n" // low src0 * alpha
|
||||
"vmull.u8 q5, d1, d5 \n" // high src0 * alpha
|
||||
"vmlal.u8 q4, d2, d24 \n" // low + src1 * (255 - alpha)
|
||||
"vmlal.u8 q5, d3, d25 \n" // high + src1 * (255 - alpha)
|
||||
"vmlal.u8 q4, d2, d24 \n" // low + src1 * (255 -
|
||||
// alpha)
|
||||
"vmlal.u8 q5, d3, d25 \n" // high + src1 * (255 -
|
||||
// alpha)
|
||||
"vaddhn.u16 d0, q4, q15 \n" // + 255 >> 8
|
||||
"vaddhn.u16 d1, q5, q15 \n" // + 255 >> 8
|
||||
"vst1.8 {q0}, [%3]! \n" // store 16 dst
|
||||
|
||||
@ -2850,9 +2850,8 @@ void RGBToUV444MatrixRow_NEON(const uint8_t* src_rgb,
|
||||
"+r"(dst_v), // %2
|
||||
"+r"(width) // %3
|
||||
: [c] "r"(c) // %4
|
||||
: "cc", "memory", "v0", "v1", "v2", "v4", "v5", "v6", "v16",
|
||||
"v17", "v18", "v19", "v20", "v21", "v22", "v24", "v25", "v26",
|
||||
"v27");
|
||||
: "cc", "memory", "v0", "v1", "v2", "v4", "v5", "v6", "v16", "v17", "v18",
|
||||
"v19", "v20", "v21", "v22", "v24", "v25", "v26", "v27");
|
||||
}
|
||||
|
||||
void ARGBToUV444MatrixRow_NEON_I8MM(const uint8_t* src_argb,
|
||||
@ -3020,7 +3019,8 @@ void RGBToUVMatrixRow_NEON(const uint8_t* src_rgb,
|
||||
"dup v24.8h, v17.h[0] \n" // V0
|
||||
"dup v26.8h, v17.h[1] \n" // V1
|
||||
"dup v27.8h, v17.h[2] \n" // V2
|
||||
"movi v25.8h, #0x80, lsl #8 \n" // 128.0 in 16-bit (0x8000)
|
||||
"movi v25.8h, #0x80, lsl #8 \n" // 128.0 in 16-bit
|
||||
// (0x8000)
|
||||
|
||||
"1: \n"
|
||||
"ld3 {v0.16b,v1.16b,v2.16b}, [%0], #48 \n" // load 16 pixels.
|
||||
@ -4297,8 +4297,10 @@ void BlendPlaneRow_NEON(const uint8_t* src0,
|
||||
"umull v10.8h, v1.8b, v5.8b \n"
|
||||
"prfm pldl1keep, [%2, 448] \n"
|
||||
"umull2 v11.8h, v1.16b, v5.16b \n"
|
||||
"umlal v8.8h, v2.8b, v6.8b \n" // low + src1 * (255 - alpha)
|
||||
"umlal2 v9.8h, v2.16b, v6.16b \n" // high + src1 * (255 - alpha)
|
||||
"umlal v8.8h, v2.8b, v6.8b \n" // low + src1 * (255 -
|
||||
// alpha)
|
||||
"umlal2 v9.8h, v2.16b, v6.16b \n" // high + src1 * (255 -
|
||||
// alpha)
|
||||
"umlal v10.8h, v3.8b, v7.8b \n"
|
||||
"umlal2 v11.8h, v3.16b, v7.16b \n"
|
||||
"addhn v0.8b, v8.8h, v15.8h \n" // (low + 255) >> 8
|
||||
@ -4318,8 +4320,10 @@ void BlendPlaneRow_NEON(const uint8_t* src0,
|
||||
"mvn v3.16b, v2.16b \n" // 255 - alpha
|
||||
"umull v4.8h, v0.8b, v2.8b \n" // low src0 * alpha
|
||||
"umull2 v5.8h, v0.16b, v2.16b \n" // high src0 * alpha
|
||||
"umlal v4.8h, v1.8b, v3.8b \n" // low + src1 * (255 - alpha)
|
||||
"umlal2 v5.8h, v1.16b, v3.16b \n" // high + src1 * (255 - alpha)
|
||||
"umlal v4.8h, v1.8b, v3.8b \n" // low + src1 * (255 -
|
||||
// alpha)
|
||||
"umlal2 v5.8h, v1.16b, v3.16b \n" // high + src1 * (255 -
|
||||
// alpha)
|
||||
"addhn v0.8b, v4.8h, v15.8h \n" // (low + 255) >> 8
|
||||
"addhn v1.8b, v5.8h, v15.8h \n" // (high + 255) >> 8
|
||||
"st1 {v0.8b, v1.8b}, [%3], #16 \n" // store 16 dst
|
||||
@ -4471,8 +4475,8 @@ void ComputeCumulativeSumRow_NEON(const uint8_t* row,
|
||||
"+r"(previous_cumsum), // %2
|
||||
"+r"(width) // %3
|
||||
:
|
||||
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v16", "v17",
|
||||
"v18", "v19");
|
||||
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v16", "v17", "v18",
|
||||
"v19");
|
||||
}
|
||||
#endif // HAS_COMPUTECUMULATIVESUMROW_NEON
|
||||
|
||||
|
||||
@ -2313,8 +2313,7 @@ void ARGBMultiplyRow_RVV(const uint8_t* src_argb,
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wvla"
|
||||
size_t vl;
|
||||
asm(
|
||||
"1: \n"
|
||||
asm("1: \n"
|
||||
"vsetvli %[vl], %[w], e8, m2, ta, ma \n"
|
||||
"vle8.v v8, (%[src0]) \n"
|
||||
"vle8.v v10, (%[src1]) \n"
|
||||
|
||||
@ -1229,10 +1229,7 @@ void CopyRow_SVE2(const uint8_t* src, uint8_t* dst, int width) {
|
||||
"b.gt 3b \n"
|
||||
|
||||
"99: \n"
|
||||
: [src] "+r"(src),
|
||||
[dst] "+r"(dst),
|
||||
[width] "+r"(width),
|
||||
[vl] "=&r"(vl),
|
||||
: [src] "+r"(src), [dst] "+r"(dst), [width] "+r"(width), [vl] "=&r"(vl),
|
||||
[vl2] "=&r"(vl2)
|
||||
:
|
||||
: "cc", "memory", "z0", "z1", "p0");
|
||||
@ -1285,11 +1282,8 @@ void InterpolateRow_SVE2(uint8_t* dst_ptr,
|
||||
"st1b {z2.b}, p0, [%[dst_ptr]] \n"
|
||||
|
||||
"99: \n"
|
||||
: [src_ptr] "+r"(src_ptr),
|
||||
[src_ptr1] "+r"(src_ptr1),
|
||||
[dst_ptr] "+r"(dst_ptr),
|
||||
[width] "+r"(width),
|
||||
[vl] "=&r"(vl)
|
||||
: [src_ptr] "+r"(src_ptr), [src_ptr1] "+r"(src_ptr1),
|
||||
[dst_ptr] "+r"(dst_ptr), [width] "+r"(width), [vl] "=&r"(vl)
|
||||
:
|
||||
: "cc", "memory", "z2", "z3", "p0");
|
||||
return;
|
||||
|
||||
@ -312,14 +312,11 @@ void RAWToARGBRow_AVX2(const uint8_t* src_raw, uint8_t* dst_argb, int width) {
|
||||
defined(HAS_RGB24TOARGBROW_AVX512BW) || \
|
||||
defined(HAS_RAWTORGB24ROW_AVX512BW) || \
|
||||
defined(HAS_RGBTOYMATRIXROW_AVX512BW)
|
||||
static const uint64_t kPermqRGB24ToARGB0_AVX512BW[8] = {0, 1, 1, 2,
|
||||
3, 4, 4, 5};
|
||||
static const uint64_t kPermqRGB24ToARGB0_AVX512BW[8] = {0, 1, 1, 2, 3, 4, 4, 5};
|
||||
static const uint64_t kPermqRGB24ToARGB1_AVX512BW[8] = {6, 7, 7, 8,
|
||||
9, 10, 10, 11};
|
||||
static const uint64_t kPermqRGB24ToARGB2_AVX512BW[8] = {4, 5, 5, 6,
|
||||
7, 8, 8, 9};
|
||||
static const uint64_t kPermqRGB24ToARGB3_AVX512BW[8] = {2, 3, 3, 4,
|
||||
5, 6, 6, 7};
|
||||
static const uint64_t kPermqRGB24ToARGB2_AVX512BW[8] = {4, 5, 5, 6, 7, 8, 8, 9};
|
||||
static const uint64_t kPermqRGB24ToARGB3_AVX512BW[8] = {2, 3, 3, 4, 5, 6, 6, 7};
|
||||
#endif // defined(HAS_RAWTOARGBROW_AVX512BW) ||
|
||||
// defined(HAS_RGB24TOARGBROW_AVX512BW) ||
|
||||
// defined(HAS_RAWTORGB24ROW_AVX512BW) ||
|
||||
@ -328,21 +325,24 @@ static const uint64_t kPermqRGB24ToARGB3_AVX512BW[8] = {2, 3, 3, 4,
|
||||
#if defined(HAS_RGB24TOARGBROW_AVX512BW) || \
|
||||
defined(HAS_RGBTOYMATRIXROW_AVX512BW)
|
||||
static const uint8_t kShuffleMaskRGB24ToARGB_AVX512BW[32] = {
|
||||
0u, 1u, 2u, 128u, 3u, 4u, 5u, 128u, 6u, 7u, 8u, 128u, 9u, 10u, 11u, 128u,
|
||||
4u, 5u, 6u, 128u, 7u, 8u, 9u, 128u, 10u, 11u, 12u, 128u, 13u, 14u, 15u, 128u};
|
||||
0u, 1u, 2u, 128u, 3u, 4u, 5u, 128u, 6u, 7u, 8u,
|
||||
128u, 9u, 10u, 11u, 128u, 4u, 5u, 6u, 128u, 7u, 8u,
|
||||
9u, 128u, 10u, 11u, 12u, 128u, 13u, 14u, 15u, 128u};
|
||||
#endif // defined(HAS_RGB24TOARGBROW_AVX512BW) ||
|
||||
// defined(HAS_RGBTOYMATRIXROW_AVX512BW)
|
||||
|
||||
#if defined(HAS_RAWTOARGBROW_AVX512BW)
|
||||
static const uint8_t kShuffleMaskRAWToARGB_AVX512BW[32] = {
|
||||
2u, 1u, 0u, 128u, 5u, 4u, 3u, 128u, 8u, 7u, 6u, 128u, 11u, 10u, 9u, 128u,
|
||||
6u, 5u, 4u, 128u, 9u, 8u, 7u, 128u, 12u, 11u, 10u, 128u, 15u, 14u, 13u, 128u};
|
||||
2u, 1u, 0u, 128u, 5u, 4u, 3u, 128u, 8u, 7u, 6u,
|
||||
128u, 11u, 10u, 9u, 128u, 6u, 5u, 4u, 128u, 9u, 8u,
|
||||
7u, 128u, 12u, 11u, 10u, 128u, 15u, 14u, 13u, 128u};
|
||||
#endif // defined(HAS_RAWTOARGBROW_AVX512BW)
|
||||
|
||||
#if defined(HAS_RAWTORGB24ROW_AVX2) || defined(HAS_RAWTORGB24ROW_AVX512BW)
|
||||
static const uint8_t kShuffleMaskRAWToRGB24_AVX2[32] = {
|
||||
2u, 1u, 0u, 5u, 4u, 3u, 8u, 7u, 6u, 11u, 10u, 9u, 128u, 128u, 128u, 128u,
|
||||
6u, 5u, 4u, 9u, 8u, 7u, 12u, 11u, 10u, 15u, 14u, 13u, 128u, 128u, 128u, 128u};
|
||||
2u, 1u, 0u, 5u, 4u, 3u, 8u, 7u, 6u, 11u, 10u,
|
||||
9u, 128u, 128u, 128u, 128u, 6u, 5u, 4u, 9u, 8u, 7u,
|
||||
12u, 11u, 10u, 15u, 14u, 13u, 128u, 128u, 128u, 128u};
|
||||
#endif // defined(HAS_RAWTORGB24ROW_AVX2) ||
|
||||
// defined(HAS_RAWTORGB24ROW_AVX512BW)
|
||||
|
||||
@ -364,33 +364,33 @@ static const uint32_t kPermdRGB24_2_AVX512BW[16] = {
|
||||
#endif // defined(HAS_RAWTORGB24ROW_AVX512BW)
|
||||
#if defined(HAS_RAWTORGB24ROW_AVX512VBMI)
|
||||
static const uint8_t kPermRAWToRGB24_0[64] = {
|
||||
0x02, 0x01, 0x00, 0x05, 0x04, 0x03, 0x08, 0x07, 0x06, 0x0b, 0x0a, 0x09,
|
||||
0x0e, 0x0d, 0x0c, 0x11, 0x10, 0x0f, 0x14, 0x13, 0x12, 0x17, 0x16, 0x15,
|
||||
0x1a, 0x19, 0x18, 0x1d, 0x1c, 0x1b, 0x20, 0x1f, 0x1e, 0x23, 0x22, 0x21,
|
||||
0x26, 0x25, 0x24, 0x29, 0x28, 0x27, 0x2c, 0x2b, 0x2a, 0x2f, 0x2e, 0x2d,
|
||||
0x32, 0x31, 0x30, 0x35, 0x34, 0x33, 0x38, 0x37, 0x36, 0x3b, 0x3a, 0x39,
|
||||
0x3e, 0x3d, 0x3c, 0x41};
|
||||
0x02, 0x01, 0x00, 0x05, 0x04, 0x03, 0x08, 0x07, 0x06, 0x0b, 0x0a,
|
||||
0x09, 0x0e, 0x0d, 0x0c, 0x11, 0x10, 0x0f, 0x14, 0x13, 0x12, 0x17,
|
||||
0x16, 0x15, 0x1a, 0x19, 0x18, 0x1d, 0x1c, 0x1b, 0x20, 0x1f, 0x1e,
|
||||
0x23, 0x22, 0x21, 0x26, 0x25, 0x24, 0x29, 0x28, 0x27, 0x2c, 0x2b,
|
||||
0x2a, 0x2f, 0x2e, 0x2d, 0x32, 0x31, 0x30, 0x35, 0x34, 0x33, 0x38,
|
||||
0x37, 0x36, 0x3b, 0x3a, 0x39, 0x3e, 0x3d, 0x3c, 0x41};
|
||||
static const uint8_t kPermRAWToRGB24_1[64] = {
|
||||
0x00, 0x7f, 0x04, 0x03, 0x02, 0x07, 0x06, 0x05, 0x0a, 0x09, 0x08, 0x0d,
|
||||
0x0c, 0x0b, 0x10, 0x0f, 0x0e, 0x13, 0x12, 0x11, 0x16, 0x15, 0x14, 0x19,
|
||||
0x18, 0x17, 0x1c, 0x1b, 0x1a, 0x1f, 0x1e, 0x1d, 0x22, 0x21, 0x20, 0x25,
|
||||
0x24, 0x23, 0x28, 0x27, 0x26, 0x2b, 0x2a, 0x29, 0x2e, 0x2d, 0x2c, 0x31,
|
||||
0x30, 0x2f, 0x34, 0x33, 0x32, 0x37, 0x36, 0x35, 0x3a, 0x39, 0x38, 0x3d,
|
||||
0x3c, 0x3b, 0x00, 0x3f};
|
||||
0x00, 0x7f, 0x04, 0x03, 0x02, 0x07, 0x06, 0x05, 0x0a, 0x09, 0x08,
|
||||
0x0d, 0x0c, 0x0b, 0x10, 0x0f, 0x0e, 0x13, 0x12, 0x11, 0x16, 0x15,
|
||||
0x14, 0x19, 0x18, 0x17, 0x1c, 0x1b, 0x1a, 0x1f, 0x1e, 0x1d, 0x22,
|
||||
0x21, 0x20, 0x25, 0x24, 0x23, 0x28, 0x27, 0x26, 0x2b, 0x2a, 0x29,
|
||||
0x2e, 0x2d, 0x2c, 0x31, 0x30, 0x2f, 0x34, 0x33, 0x32, 0x37, 0x36,
|
||||
0x35, 0x3a, 0x39, 0x38, 0x3d, 0x3c, 0x3b, 0x00, 0x3f};
|
||||
static const uint8_t kPermRAWToRGB24_2[64] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
|
||||
0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
|
||||
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
|
||||
0x3c, 0x3d, 0x40, 0x3f};
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
|
||||
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
|
||||
0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
|
||||
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
|
||||
0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
|
||||
0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x40, 0x3f};
|
||||
static const uint8_t kPermRAWToRGB24_3[64] = {
|
||||
0x3e, 0x43, 0x42, 0x41, 0x46, 0x45, 0x44, 0x49, 0x48, 0x47, 0x4c, 0x4b,
|
||||
0x4a, 0x4f, 0x4e, 0x4d, 0x52, 0x51, 0x50, 0x55, 0x54, 0x53, 0x58, 0x57,
|
||||
0x56, 0x5b, 0x5a, 0x59, 0x5e, 0x5d, 0x5c, 0x61, 0x60, 0x5f, 0x64, 0x63,
|
||||
0x62, 0x67, 0x66, 0x65, 0x6a, 0x69, 0x68, 0x6d, 0x6c, 0x6b, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x72, 0x71, 0x76, 0x75, 0x74, 0x79, 0x78, 0x77, 0x7c, 0x7b,
|
||||
0x7a, 0x7f, 0x7e, 0x7d};
|
||||
0x3e, 0x43, 0x42, 0x41, 0x46, 0x45, 0x44, 0x49, 0x48, 0x47, 0x4c,
|
||||
0x4b, 0x4a, 0x4f, 0x4e, 0x4d, 0x52, 0x51, 0x50, 0x55, 0x54, 0x53,
|
||||
0x58, 0x57, 0x56, 0x5b, 0x5a, 0x59, 0x5e, 0x5d, 0x5c, 0x61, 0x60,
|
||||
0x5f, 0x64, 0x63, 0x62, 0x67, 0x66, 0x65, 0x6a, 0x69, 0x68, 0x6d,
|
||||
0x6c, 0x6b, 0x70, 0x6f, 0x6e, 0x73, 0x72, 0x71, 0x76, 0x75, 0x74,
|
||||
0x79, 0x78, 0x77, 0x7c, 0x7b, 0x7a, 0x7f, 0x7e, 0x7d};
|
||||
#endif // defined(HAS_RAWTORGB24ROW_AVX512VBMI)
|
||||
|
||||
#if defined(HAS_RAWTOARGBROW_AVX512BW) || defined(HAS_RGB24TOARGBROW_AVX512BW)
|
||||
@ -450,8 +450,7 @@ LIBYUV_TARGET_AVX512BW
|
||||
void RAWToARGBRow_AVX512BW(const uint8_t* src_raw,
|
||||
uint8_t* dst_argb,
|
||||
int width) {
|
||||
RGBToARGBRow_AVX512BW(
|
||||
src_raw, dst_argb,
|
||||
RGBToARGBRow_AVX512BW(src_raw, dst_argb,
|
||||
(const uint32_t*)kShuffleMaskRAWToARGB_AVX512BW, width);
|
||||
}
|
||||
#endif // HAS_RAWTOARGBROW_AVX512BW
|
||||
@ -461,17 +460,15 @@ LIBYUV_TARGET_AVX512BW
|
||||
void RGB24ToARGBRow_AVX512BW(const uint8_t* src_rgb24,
|
||||
uint8_t* dst_argb,
|
||||
int width) {
|
||||
RGBToARGBRow_AVX512BW(
|
||||
src_rgb24, dst_argb,
|
||||
(const uint32_t*)kShuffleMaskRGB24ToARGB_AVX512BW, width);
|
||||
RGBToARGBRow_AVX512BW(src_rgb24, dst_argb,
|
||||
(const uint32_t*)kShuffleMaskRGB24ToARGB_AVX512BW,
|
||||
width);
|
||||
}
|
||||
#endif // HAS_RGB24TOARGBROW_AVX512BW
|
||||
|
||||
#ifdef HAS_RAWTORGB24ROW_AVX2
|
||||
LIBYUV_TARGET_AVX2
|
||||
void RAWToRGB24Row_AVX2(const uint8_t* src_raw,
|
||||
uint8_t* dst_rgb24,
|
||||
int width) {
|
||||
void RAWToRGB24Row_AVX2(const uint8_t* src_raw, uint8_t* dst_rgb24, int width) {
|
||||
__m256i ymm_shuf =
|
||||
_mm256_loadu_si256((const __m256i*)kShuffleMaskRAWToRGB24_AVX2);
|
||||
__m256i ymm_p0 = _mm256_loadu_si256((const __m256i*)kPermd0_AVX2);
|
||||
@ -608,8 +605,8 @@ void RAWToRGB24Row_AVX512VBMI(const uint8_t* src_raw,
|
||||
#endif // HAS_RAWTORGB24ROW_AVX512VBMI
|
||||
|
||||
#ifdef HAS_RGBTOYMATRIXROW_AVX512BW
|
||||
static const uint32_t kPermdARGBToY_AVX512BW[16] = {
|
||||
0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15};
|
||||
static const uint32_t kPermdARGBToY_AVX512BW[16] = {0, 4, 8, 12, 1, 5, 9, 13,
|
||||
2, 6, 10, 14, 3, 7, 11, 15};
|
||||
|
||||
LIBYUV_TARGET_AVX512BW
|
||||
void RGBToYMatrixRow_AVX512BW(const uint8_t* src_rgb,
|
||||
@ -631,10 +628,10 @@ void RGBToYMatrixRow_AVX512BW(const uint8_t* src_rgb,
|
||||
|
||||
__m512i zmm_80 = _mm512_set1_epi8((char)0x80);
|
||||
__m512i zmm_one = _mm512_set1_epi16(1);
|
||||
__m512i zmm_coeff = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)c->kRGBToY));
|
||||
__m512i zmm_add = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)c->kAddY));
|
||||
__m512i zmm_coeff =
|
||||
_mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)c->kRGBToY));
|
||||
__m512i zmm_add =
|
||||
_mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)c->kAddY));
|
||||
|
||||
// Compute bias adjusted for 0x80 subtraction:
|
||||
// bias = kAddY - pmaddwd(pmaddubsw(kRGBToY, 0x80), 1)
|
||||
@ -703,8 +700,10 @@ void ARGBToUVMatrixRow_AVX2(const uint8_t* src_argb,
|
||||
uint8_t* dst_v,
|
||||
int width,
|
||||
const struct ArgbConstants* c) {
|
||||
__m256i ymm_u = _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)c->kRGBToU));
|
||||
__m256i ymm_v = _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)c->kRGBToV));
|
||||
__m256i ymm_u =
|
||||
_mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)c->kRGBToU));
|
||||
__m256i ymm_v =
|
||||
_mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)c->kRGBToV));
|
||||
__m256i ymm_0101 = _mm256_set1_epi16(0x0101);
|
||||
__m256i ymm_shuf =
|
||||
_mm256_setr_epi8(0, 4, 1, 5, 2, 6, 3, 7, 8, 12, 9, 13, 10, 14, 11, 15, 0,
|
||||
@ -1509,8 +1508,10 @@ void I422ToARGBRow_AVX2(const uint8_t* src_y,
|
||||
__m256i ymm_kUVToB = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToB);
|
||||
__m256i ymm_kUVToG = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToG);
|
||||
__m256i ymm_kUVToR = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToR);
|
||||
__m256i ymm_kYToRgb = _mm256_loadu_si256((const __m256i*)yuvconstants->kYToRgb);
|
||||
__m256i ymm_kYBiasToRgb = _mm256_loadu_si256((const __m256i*)yuvconstants->kYBiasToRgb);
|
||||
__m256i ymm_kYToRgb =
|
||||
_mm256_loadu_si256((const __m256i*)yuvconstants->kYToRgb);
|
||||
__m256i ymm_kYBiasToRgb =
|
||||
_mm256_loadu_si256((const __m256i*)yuvconstants->kYBiasToRgb);
|
||||
__m256i ymm_128 = _mm256_set1_epi8((char)0x80);
|
||||
__m256i ymm_alpha = _mm256_set1_epi8((char)0xff);
|
||||
__m256i ymm_u_zero = _mm256_setzero_si256();
|
||||
@ -1585,7 +1586,8 @@ void I422ToAR30Row_AVX2(const uint8_t* src_y,
|
||||
__m256i ymm_kUVToB = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToB);
|
||||
__m256i ymm_kUVToG = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToG);
|
||||
__m256i ymm_kUVToR = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToR);
|
||||
__m256i ymm_kYToRgb = _mm256_loadu_si256((const __m256i*)yuvconstants->kYToRgb);
|
||||
__m256i ymm_kYToRgb =
|
||||
_mm256_loadu_si256((const __m256i*)yuvconstants->kYToRgb);
|
||||
__m256i ymm_kYBiasToRgb = _mm256_sub_epi16(
|
||||
_mm256_loadu_si256((const __m256i*)yuvconstants->kYBiasToRgb),
|
||||
_mm256_set1_epi16(24));
|
||||
@ -1669,8 +1671,10 @@ void NV12ToARGBRow_AVX2(const uint8_t* src_y,
|
||||
__m256i ymm_kUVToB = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToB);
|
||||
__m256i ymm_kUVToG = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToG);
|
||||
__m256i ymm_kUVToR = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToR);
|
||||
__m256i ymm_kYToRgb = _mm256_loadu_si256((const __m256i*)yuvconstants->kYToRgb);
|
||||
__m256i ymm_kYBiasToRgb = _mm256_loadu_si256((const __m256i*)yuvconstants->kYBiasToRgb);
|
||||
__m256i ymm_kYToRgb =
|
||||
_mm256_loadu_si256((const __m256i*)yuvconstants->kYToRgb);
|
||||
__m256i ymm_kYBiasToRgb =
|
||||
_mm256_loadu_si256((const __m256i*)yuvconstants->kYBiasToRgb);
|
||||
__m256i ymm_128 = _mm256_set1_epi8((char)0x80);
|
||||
__m256i ymm_alpha = _mm256_set1_epi8((char)0xff);
|
||||
__m256i ymm_u_zero = _mm256_setzero_si256();
|
||||
@ -1742,8 +1746,10 @@ void NV21ToARGBRow_AVX2(const uint8_t* src_y,
|
||||
__m256i ymm_kUVToB = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToB);
|
||||
__m256i ymm_kUVToG = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToG);
|
||||
__m256i ymm_kUVToR = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToR);
|
||||
__m256i ymm_kYToRgb = _mm256_loadu_si256((const __m256i*)yuvconstants->kYToRgb);
|
||||
__m256i ymm_kYBiasToRgb = _mm256_loadu_si256((const __m256i*)yuvconstants->kYBiasToRgb);
|
||||
__m256i ymm_kYToRgb =
|
||||
_mm256_loadu_si256((const __m256i*)yuvconstants->kYToRgb);
|
||||
__m256i ymm_kYBiasToRgb =
|
||||
_mm256_loadu_si256((const __m256i*)yuvconstants->kYBiasToRgb);
|
||||
__m256i ymm_128 = _mm256_set1_epi8((char)0x80);
|
||||
__m256i ymm_alpha = _mm256_set1_epi8((char)0xff);
|
||||
__m256i ymm_shuf_nv21 = _mm256_loadu_si256((const __m256i*)kShuffleNV21_AVX2);
|
||||
@ -1821,8 +1827,10 @@ void I422ToRGB24Row_AVX2(const uint8_t* src_y,
|
||||
__m256i ymm_kUVToB = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToB);
|
||||
__m256i ymm_kUVToG = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToG);
|
||||
__m256i ymm_kUVToR = _mm256_loadu_si256((const __m256i*)yuvconstants->kUVToR);
|
||||
__m256i ymm_kYToRgb = _mm256_loadu_si256((const __m256i*)yuvconstants->kYToRgb);
|
||||
__m256i ymm_kYBiasToRgb = _mm256_loadu_si256((const __m256i*)yuvconstants->kYBiasToRgb);
|
||||
__m256i ymm_kYToRgb =
|
||||
_mm256_loadu_si256((const __m256i*)yuvconstants->kYToRgb);
|
||||
__m256i ymm_kYBiasToRgb =
|
||||
_mm256_loadu_si256((const __m256i*)yuvconstants->kYBiasToRgb);
|
||||
__m256i ymm_128 = _mm256_set1_epi8((char)0x80);
|
||||
|
||||
__m256i ymm_shuf0 = _mm256_broadcastsi128_si256(
|
||||
@ -1973,10 +1981,8 @@ void I422ToRGB24Row_AVX2(const uint8_t* src_y,
|
||||
|
||||
#define STORERGB24_MASK_AVX512VBMI \
|
||||
int dst_bytes = width * 3; \
|
||||
__mmask64 mask_dst0 = \
|
||||
dst_bytes >= 64 ? ~0ull : (1ull << dst_bytes) - 1ull; \
|
||||
__mmask32 mask_dst1 = \
|
||||
dst_bytes > 64 ? (1u << (dst_bytes - 64)) - 1u : 0u; \
|
||||
__mmask64 mask_dst0 = dst_bytes >= 64 ? ~0ull : (1ull << dst_bytes) - 1ull; \
|
||||
__mmask32 mask_dst1 = dst_bytes > 64 ? (1u << (dst_bytes - 64)) - 1u : 0u; \
|
||||
__m512i zmm_BG = _mm512_permutex2var_epi8(zmm0, zmm_mask_BG, zmm1); \
|
||||
__m512i zmm_dst0 = _mm512_permutex2var_epi8(zmm_BG, zmm_mask_DST0, zmm2); \
|
||||
__m512i zmm_dst1 = _mm512_permutex2var_epi8(zmm_BG, zmm_mask_DST1, zmm2); \
|
||||
@ -2001,10 +2007,8 @@ void I422ToRGB24Row_AVX2(const uint8_t* src_y,
|
||||
|
||||
#define STORERGB24_MASK_AVX512BW \
|
||||
int dst_bytes = width * 3; \
|
||||
__mmask64 mask_dst0 = \
|
||||
dst_bytes >= 64 ? ~0ull : (1ull << dst_bytes) - 1ull; \
|
||||
__mmask32 mask_dst1 = \
|
||||
dst_bytes > 64 ? (1u << (dst_bytes - 64)) - 1u : 0u; \
|
||||
__mmask64 mask_dst0 = dst_bytes >= 64 ? ~0ull : (1ull << dst_bytes) - 1ull; \
|
||||
__mmask32 mask_dst1 = dst_bytes > 64 ? (1u << (dst_bytes - 64)) - 1u : 0u; \
|
||||
__m512i zmm_bg = _mm512_unpacklo_epi8(zmm0, zmm1); \
|
||||
__m512i zmm_rr = _mm512_unpacklo_epi8(zmm2, zmm2); \
|
||||
__m512i zmm_lo = _mm512_unpacklo_epi16(zmm_bg, zmm_rr); \
|
||||
@ -2030,43 +2034,49 @@ void I422ToRGB24Row_AVX512VBMI(const uint8_t* src_y,
|
||||
int width) {
|
||||
// Masks
|
||||
static const uint8_t kMaskBG[64] = {
|
||||
0x00, 0x40, 0x01, 0x41, 0x02, 0x42, 0x03, 0x43, 0x04, 0x44, 0x05, 0x45,
|
||||
0x06, 0x46, 0x07, 0x47, 0x10, 0x50, 0x11, 0x51, 0x12, 0x52, 0x13, 0x53,
|
||||
0x14, 0x54, 0x15, 0x55, 0x16, 0x56, 0x17, 0x57, 0x20, 0x60, 0x21, 0x61,
|
||||
0x22, 0x62, 0x23, 0x63, 0x24, 0x64, 0x25, 0x65, 0x26, 0x66, 0x27, 0x67,
|
||||
0x30, 0x70, 0x31, 0x71, 0x32, 0x72, 0x33, 0x73, 0x34, 0x74, 0x35, 0x75,
|
||||
0x36, 0x76, 0x37, 0x77};
|
||||
0x00, 0x40, 0x01, 0x41, 0x02, 0x42, 0x03, 0x43, 0x04, 0x44, 0x05,
|
||||
0x45, 0x06, 0x46, 0x07, 0x47, 0x10, 0x50, 0x11, 0x51, 0x12, 0x52,
|
||||
0x13, 0x53, 0x14, 0x54, 0x15, 0x55, 0x16, 0x56, 0x17, 0x57, 0x20,
|
||||
0x60, 0x21, 0x61, 0x22, 0x62, 0x23, 0x63, 0x24, 0x64, 0x25, 0x65,
|
||||
0x26, 0x66, 0x27, 0x67, 0x30, 0x70, 0x31, 0x71, 0x32, 0x72, 0x33,
|
||||
0x73, 0x34, 0x74, 0x35, 0x75, 0x36, 0x76, 0x37, 0x77};
|
||||
static const uint8_t kMaskDST0[64] = {
|
||||
0x00, 0x01, 0x40, 0x02, 0x03, 0x41, 0x04, 0x05, 0x42, 0x06, 0x07, 0x43,
|
||||
0x08, 0x09, 0x44, 0x0a, 0x0b, 0x45, 0x0c, 0x0d, 0x46, 0x0e, 0x0f, 0x47,
|
||||
0x10, 0x11, 0x50, 0x12, 0x13, 0x51, 0x14, 0x15, 0x52, 0x16, 0x17, 0x53,
|
||||
0x18, 0x19, 0x54, 0x1a, 0x1b, 0x55, 0x1c, 0x1d, 0x56, 0x1e, 0x1f, 0x57,
|
||||
0x20, 0x21, 0x60, 0x22, 0x23, 0x61, 0x24, 0x25, 0x62, 0x26, 0x27, 0x63,
|
||||
0x28, 0x29, 0x64, 0x2a};
|
||||
0x00, 0x01, 0x40, 0x02, 0x03, 0x41, 0x04, 0x05, 0x42, 0x06, 0x07,
|
||||
0x43, 0x08, 0x09, 0x44, 0x0a, 0x0b, 0x45, 0x0c, 0x0d, 0x46, 0x0e,
|
||||
0x0f, 0x47, 0x10, 0x11, 0x50, 0x12, 0x13, 0x51, 0x14, 0x15, 0x52,
|
||||
0x16, 0x17, 0x53, 0x18, 0x19, 0x54, 0x1a, 0x1b, 0x55, 0x1c, 0x1d,
|
||||
0x56, 0x1e, 0x1f, 0x57, 0x20, 0x21, 0x60, 0x22, 0x23, 0x61, 0x24,
|
||||
0x25, 0x62, 0x26, 0x27, 0x63, 0x28, 0x29, 0x64, 0x2a};
|
||||
static const uint8_t kMaskDST1[64] = {
|
||||
0x2b, 0x65, 0x2c, 0x2d, 0x66, 0x2e, 0x2f, 0x67, 0x30, 0x31, 0x70, 0x32,
|
||||
0x33, 0x71, 0x34, 0x35, 0x72, 0x36, 0x37, 0x73, 0x38, 0x39, 0x74, 0x3a,
|
||||
0x3b, 0x75, 0x3c, 0x3d, 0x76, 0x3e, 0x3f, 0x77, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00};
|
||||
0x2b, 0x65, 0x2c, 0x2d, 0x66, 0x2e, 0x2f, 0x67, 0x30, 0x31, 0x70,
|
||||
0x32, 0x33, 0x71, 0x34, 0x35, 0x72, 0x36, 0x37, 0x73, 0x38, 0x39,
|
||||
0x74, 0x3a, 0x3b, 0x75, 0x3c, 0x3d, 0x76, 0x3e, 0x3f, 0x77, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const uint64_t kSplitQuadWords[8] = {0, 2, 2, 2, 1, 2, 2, 2};
|
||||
static const uint64_t kSplitDoubleQuadWords[8] = {0, 1, 4, 4, 2, 3, 4, 4};
|
||||
|
||||
// Constants
|
||||
__m512i zmm_kUVToB = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kUVToB));
|
||||
__m512i zmm_kUVToG = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kUVToG));
|
||||
__m512i zmm_kUVToR = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kUVToR));
|
||||
__m512i zmm_kYToRgb = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kYToRgb));
|
||||
__m512i zmm_kYBiasToRgb = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kYBiasToRgb));
|
||||
__m512i zmm_kUVToB = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kUVToB));
|
||||
__m512i zmm_kUVToG = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kUVToG));
|
||||
__m512i zmm_kUVToR = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kUVToR));
|
||||
__m512i zmm_kYToRgb = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kYToRgb));
|
||||
__m512i zmm_kYBiasToRgb = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kYBiasToRgb));
|
||||
__m512i zmm_128 = _mm512_set1_epi8((char)0x80);
|
||||
|
||||
__m512i zmm_mask_BG = _mm512_loadu_si512((const __m512i*)kMaskBG);
|
||||
__m512i zmm_mask_DST0 = _mm512_loadu_si512((const __m512i*)kMaskDST0);
|
||||
__m512i zmm_mask_DST1 = _mm512_loadu_si512((const __m512i*)kMaskDST1);
|
||||
__m512i zmm_split = _mm512_loadu_si512((const __m512i*)kSplitQuadWords);
|
||||
__m512i zmm_split_y = _mm512_loadu_si512((const __m512i*)kSplitDoubleQuadWords);
|
||||
__m512i zmm_split_y =
|
||||
_mm512_loadu_si512((const __m512i*)kSplitDoubleQuadWords);
|
||||
|
||||
ptrdiff_t offset = src_v - src_u;
|
||||
|
||||
@ -2099,11 +2109,16 @@ void I422ToRGB24Row_AVX512BW(const uint8_t* src_y,
|
||||
static const uint64_t kSplitDoubleQuadWords[8] = {0, 1, 4, 4, 2, 3, 4, 4};
|
||||
|
||||
// Constants
|
||||
__m512i zmm_kUVToB = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kUVToB));
|
||||
__m512i zmm_kUVToG = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kUVToG));
|
||||
__m512i zmm_kUVToR = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kUVToR));
|
||||
__m512i zmm_kYToRgb = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kYToRgb));
|
||||
__m512i zmm_kYBiasToRgb = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kYBiasToRgb));
|
||||
__m512i zmm_kUVToB = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kUVToB));
|
||||
__m512i zmm_kUVToG = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kUVToG));
|
||||
__m512i zmm_kUVToR = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kUVToR));
|
||||
__m512i zmm_kYToRgb = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kYToRgb));
|
||||
__m512i zmm_kYBiasToRgb = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kYBiasToRgb));
|
||||
__m512i zmm_128 = _mm512_set1_epi8((char)0x80);
|
||||
|
||||
__m512i zmm_shuf0 = _mm512_broadcast_i32x4(
|
||||
@ -2113,7 +2128,8 @@ void I422ToRGB24Row_AVX512BW(const uint8_t* src_y,
|
||||
__m512i zmm_stitch0 = _mm512_loadu_si512((const __m512i*)kStitchRGB24_0);
|
||||
__m512i zmm_stitch1 = _mm512_loadu_si512((const __m512i*)kStitchRGB24_1);
|
||||
__m512i zmm_split = _mm512_loadu_si512((const __m512i*)kSplitQuadWords);
|
||||
__m512i zmm_split_y = _mm512_loadu_si512((const __m512i*)kSplitDoubleQuadWords);
|
||||
__m512i zmm_split_y =
|
||||
_mm512_loadu_si512((const __m512i*)kSplitDoubleQuadWords);
|
||||
|
||||
ptrdiff_t offset = src_v - src_u;
|
||||
|
||||
@ -2161,12 +2177,17 @@ void I422ToAR30Row_AVX512BW(const uint8_t* src_y,
|
||||
24, 56, 25, 57, 26, 58, 27, 59, 28, 60, 29, 61, 30, 62, 31, 63};
|
||||
|
||||
// Constants
|
||||
__m512i zmm_kUVToB = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kUVToB));
|
||||
__m512i zmm_kUVToG = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kUVToG));
|
||||
__m512i zmm_kUVToR = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kUVToR));
|
||||
__m512i zmm_kYToRgb = _mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kYToRgb));
|
||||
__m512i zmm_kUVToB = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kUVToB));
|
||||
__m512i zmm_kUVToG = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kUVToG));
|
||||
__m512i zmm_kUVToR = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kUVToR));
|
||||
__m512i zmm_kYToRgb = _mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kYToRgb));
|
||||
__m512i zmm_kYBiasToRgb = _mm512_sub_epi16(
|
||||
_mm512_broadcast_i32x4(_mm_loadu_si128((const __m128i*)yuvconstants->kYBiasToRgb)),
|
||||
_mm512_broadcast_i32x4(
|
||||
_mm_loadu_si128((const __m128i*)yuvconstants->kYBiasToRgb)),
|
||||
_mm512_set1_epi16(24));
|
||||
__m512i zmm_128 = _mm512_set1_epi8((char)0x80);
|
||||
__m512i zmm_3ff0 = _mm512_set1_epi16((short)0x3ff0);
|
||||
@ -2177,7 +2198,8 @@ void I422ToAR30Row_AVX512BW(const uint8_t* src_y,
|
||||
__m512i zmm_perm0 = _mm512_loadu_si512((const __m512i*)kPermAR30_0);
|
||||
__m512i zmm_perm1 = _mm512_loadu_si512((const __m512i*)kPermAR30_1);
|
||||
__m512i zmm_split = _mm512_loadu_si512((const __m512i*)kSplitQuadWords);
|
||||
__m512i zmm_split_y = _mm512_loadu_si512((const __m512i*)kSplitDoubleQuadWords);
|
||||
__m512i zmm_split_y =
|
||||
_mm512_loadu_si512((const __m512i*)kSplitDoubleQuadWords);
|
||||
|
||||
ptrdiff_t offset = src_v - src_u;
|
||||
|
||||
@ -2248,9 +2270,9 @@ void I422ToAR30Row_AVX512BW(const uint8_t* src_y,
|
||||
#endif // HAS_I422TOAR30ROW_AVX512BW
|
||||
|
||||
#ifdef HAS_ARGBBLENDROW_SSSE3
|
||||
static const uint8_t kShuffleAlpha[16] = {
|
||||
3u, 0x80, 3u, 0x80, 7u, 0x80, 7u, 0x80,
|
||||
11u, 0x80, 11u, 0x80, 15u, 0x80, 15u, 0x80};
|
||||
static const uint8_t kShuffleAlpha[16] = {3u, 0x80, 3u, 0x80, 7u, 0x80,
|
||||
7u, 0x80, 11u, 0x80, 11u, 0x80,
|
||||
15u, 0x80, 15u, 0x80};
|
||||
|
||||
void ARGBBlendRow_SSSE3(const uint8_t* src_argb,
|
||||
const uint8_t* src_argb1,
|
||||
|
||||
@ -208,7 +208,6 @@ static void ScalePlaneDown2_16(int src_width,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Scale plane, 1/4
|
||||
// This is an optimized version for scaling down a plane to 1/4 of
|
||||
// its original size.
|
||||
@ -1354,7 +1353,8 @@ static int ScalePlaneBilinearUp(int src_width,
|
||||
// 2. Swap buffer pointers (rowptr += rowstride; rowstride = -rowstride;)
|
||||
// so rowptr points to yi and (rowptr + rowstride) points to yi + 1.
|
||||
// 3. Advance src by 1 row if row yi + 2 exists ((y + 65536) < max_y),
|
||||
// otherwise clamp src at (src_height - 1) to avoid reading out of bounds.
|
||||
// otherwise clamp src at (src_height - 1) to avoid reading out of
|
||||
// bounds.
|
||||
for (j = 0; j < dst_height; ++j) {
|
||||
if (y > max_y) {
|
||||
y = max_y;
|
||||
@ -1832,7 +1832,8 @@ static int ScalePlaneBilinearUp_16(int src_width,
|
||||
// 2. Swap buffer pointers (rowptr += rowstride; rowstride = -rowstride;)
|
||||
// so rowptr points to yi and (rowptr + rowstride) points to yi + 1.
|
||||
// 3. Advance src by 1 row if row yi + 2 exists ((y + 65536) < max_y),
|
||||
// otherwise clamp src at (src_height - 1) to avoid reading out of bounds.
|
||||
// otherwise clamp src at (src_height - 1) to avoid reading out of
|
||||
// bounds.
|
||||
for (j = 0; j < dst_height; ++j) {
|
||||
if (y > max_y) {
|
||||
y = max_y;
|
||||
|
||||
@ -590,7 +590,8 @@ static int ScaleARGBBilinearUp(int src_width,
|
||||
// 2. Swap buffer pointers (rowptr += rowstride; rowstride = -rowstride;)
|
||||
// so rowptr points to yi and (rowptr + rowstride) points to yi + 1.
|
||||
// 3. Advance src by 1 row if row yi + 2 exists ((y64 + 65536) < max_y),
|
||||
// otherwise clamp src at (src_height - 1) to avoid reading out of bounds.
|
||||
// otherwise clamp src at (src_height - 1) to avoid reading out of
|
||||
// bounds.
|
||||
for (j = 0; j < dst_height; ++j) {
|
||||
if (y64 > max_y) {
|
||||
y64 = max_y;
|
||||
|
||||
@ -68,7 +68,6 @@ void ScaleRowDown2_16_C(const uint16_t* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ScaleRowDown2Linear_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
@ -105,7 +104,6 @@ void ScaleRowDown2Linear_16_C(const uint16_t* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ScaleRowDown2Box_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
@ -168,7 +166,6 @@ void ScaleRowDown2Box_16_C(const uint16_t* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ScaleRowDown4_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
|
||||
@ -489,12 +489,9 @@ void ScaleRowDown34_SSSE3(const uint8_t* src_ptr,
|
||||
"lea 0x18(%[dst_ptr]),%[dst_ptr] \n"
|
||||
"sub $0x18,%[dst_width] \n"
|
||||
"jg 1b \n"
|
||||
: [src_ptr] "+r"(src_ptr),
|
||||
[dst_ptr] "+r"(dst_ptr),
|
||||
: [src_ptr] "+r"(src_ptr), [dst_ptr] "+r"(dst_ptr),
|
||||
[dst_width] "+r"(dst_width)
|
||||
: [kShuf0] "m"(kShuf0),
|
||||
[kShuf1] "m"(kShuf1),
|
||||
[kShuf2] "m"(kShuf2)
|
||||
: [kShuf0] "m"(kShuf0), [kShuf1] "m"(kShuf1), [kShuf2] "m"(kShuf2)
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5");
|
||||
}
|
||||
|
||||
@ -541,17 +538,11 @@ void ScaleRowDown34_1_Box_SSSE3(const uint8_t* src_ptr,
|
||||
"lea 0x18(%[dst_ptr]),%[dst_ptr] \n"
|
||||
"sub $0x18,%[dst_width] \n"
|
||||
"jg 1b \n"
|
||||
: [src_ptr] "+r"(src_ptr),
|
||||
[dst_ptr] "+r"(dst_ptr),
|
||||
: [src_ptr] "+r"(src_ptr), [dst_ptr] "+r"(dst_ptr),
|
||||
[dst_width] "+r"(dst_width)
|
||||
: [src_stride] "r"(src_stride),
|
||||
[kShuf01] "m"(kShuf01),
|
||||
[kShuf11] "m"(kShuf11),
|
||||
[kShuf21] "m"(kShuf21),
|
||||
[kMadd01] "m"(kMadd01),
|
||||
[kMadd11] "m"(kMadd11),
|
||||
[kRound34] "m"(kRound34),
|
||||
[kMadd21] "m"(kMadd21)
|
||||
: [src_stride] "r"(src_stride), [kShuf01] "m"(kShuf01),
|
||||
[kShuf11] "m"(kShuf11), [kShuf21] "m"(kShuf21), [kMadd01] "m"(kMadd01),
|
||||
[kMadd11] "m"(kMadd11), [kRound34] "m"(kRound34), [kMadd21] "m"(kMadd21)
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6",
|
||||
"xmm7");
|
||||
}
|
||||
@ -602,17 +593,11 @@ void ScaleRowDown34_0_Box_SSSE3(const uint8_t* src_ptr,
|
||||
"lea 0x18(%[dst_ptr]),%[dst_ptr] \n"
|
||||
"sub $0x18,%[dst_width] \n"
|
||||
"jg 1b \n"
|
||||
: [src_ptr] "+r"(src_ptr),
|
||||
[dst_ptr] "+r"(dst_ptr),
|
||||
: [src_ptr] "+r"(src_ptr), [dst_ptr] "+r"(dst_ptr),
|
||||
[dst_width] "+r"(dst_width)
|
||||
: [src_stride] "r"(src_stride),
|
||||
[kShuf01] "m"(kShuf01),
|
||||
[kShuf11] "m"(kShuf11),
|
||||
[kShuf21] "m"(kShuf21),
|
||||
[kMadd01] "m"(kMadd01),
|
||||
[kMadd11] "m"(kMadd11),
|
||||
[kRound34] "m"(kRound34),
|
||||
[kMadd21] "m"(kMadd21)
|
||||
: [src_stride] "r"(src_stride), [kShuf01] "m"(kShuf01),
|
||||
[kShuf11] "m"(kShuf11), [kShuf21] "m"(kShuf21), [kMadd01] "m"(kMadd01),
|
||||
[kMadd11] "m"(kMadd11), [kRound34] "m"(kRound34), [kMadd21] "m"(kMadd21)
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6",
|
||||
"xmm7");
|
||||
}
|
||||
@ -677,13 +662,10 @@ void ScaleRowDown38_2_Box_SSSE3(const uint8_t* src_ptr,
|
||||
"lea 0x6(%[dst_ptr]),%[dst_ptr] \n"
|
||||
"sub $0x6,%[dst_width] \n"
|
||||
"jg 1b \n"
|
||||
: [src_ptr] "+r"(src_ptr),
|
||||
[dst_ptr] "+r"(dst_ptr),
|
||||
: [src_ptr] "+r"(src_ptr), [dst_ptr] "+r"(dst_ptr),
|
||||
[dst_width] "+r"(dst_width)
|
||||
: [src_stride] "r"(src_stride),
|
||||
[kShufAb0] "m"(kShufAb0),
|
||||
[kShufAb1] "m"(kShufAb1),
|
||||
[kShufAb2] "m"(kShufAb2),
|
||||
: [src_stride] "r"(src_stride), [kShufAb0] "m"(kShufAb0),
|
||||
[kShufAb1] "m"(kShufAb1), [kShufAb2] "m"(kShufAb2),
|
||||
[kScaleAb2] "m"(kScaleAb2)
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6");
|
||||
}
|
||||
@ -736,13 +718,10 @@ void ScaleRowDown38_3_Box_SSSE3(const uint8_t* src_ptr,
|
||||
"lea 0x6(%[dst_ptr]),%[dst_ptr] \n"
|
||||
"sub $0x6,%[dst_width] \n"
|
||||
"jg 1b \n"
|
||||
: [src_ptr] "+r"(src_ptr),
|
||||
[dst_ptr] "+r"(dst_ptr),
|
||||
: [src_ptr] "+r"(src_ptr), [dst_ptr] "+r"(dst_ptr),
|
||||
[dst_width] "+r"(dst_width)
|
||||
: [src_stride] "r"(src_stride),
|
||||
[kShufAc] "m"(kShufAc),
|
||||
[kShufAc3] "m"(kShufAc3),
|
||||
[kScaleAc33] "m"(kScaleAc33)
|
||||
: [src_stride] "r"(src_stride), [kShufAc] "m"(kShufAc),
|
||||
[kShufAc3] "m"(kShufAc3), [kScaleAc33] "m"(kScaleAc33)
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6",
|
||||
"xmm7");
|
||||
}
|
||||
@ -2914,14 +2893,9 @@ void ScaleARGBFilterCols_SSSE3(uint8_t* dst_argb,
|
||||
|
||||
LABELALIGN "99: \n"
|
||||
|
||||
: [dst_argb] "+r"(dst_argb),
|
||||
[src_argb] "+r"(src_argb),
|
||||
[dst_width] "+rm"(dst_width),
|
||||
[x0] "=&r"(x0),
|
||||
[x1] "=&r"(x1)
|
||||
: [x] "rm"(x),
|
||||
[dx] "rm"(dx),
|
||||
[kShuffleColARGB] "m"(kShuffleColARGB),
|
||||
: [dst_argb] "+r"(dst_argb), [src_argb] "+r"(src_argb),
|
||||
[dst_width] "+rm"(dst_width), [x0] "=&r"(x0), [x1] "=&r"(x1)
|
||||
: [x] "rm"(x), [dx] "rm"(dx), [kShuffleColARGB] "m"(kShuffleColARGB),
|
||||
[kShuffleFractions] "m"(kShuffleFractions)
|
||||
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6");
|
||||
}
|
||||
|
||||
@ -589,7 +589,8 @@ static int ScaleUVBilinearUp(int src_width,
|
||||
// 2. Swap buffer pointers (rowptr += rowstride; rowstride = -rowstride;)
|
||||
// so rowptr points to yi and (rowptr + rowstride) points to yi + 1.
|
||||
// 3. Advance src by 1 row if row yi + 2 exists ((y + 65536) < max_y),
|
||||
// otherwise clamp src at (src_height - 1) to avoid reading out of bounds.
|
||||
// otherwise clamp src at (src_height - 1) to avoid reading out of
|
||||
// bounds.
|
||||
for (j = 0; j < dst_height; ++j) {
|
||||
if (y > max_y) {
|
||||
y = max_y;
|
||||
|
||||
@ -1749,18 +1749,16 @@ TEST_F(LibYUVConvertTest, RotateWithARGBSource) {
|
||||
TEST_F(LibYUVConvertTest, ConvertToARGB_##FMT) { \
|
||||
const int kWidth = 64; \
|
||||
const int kHeight = 48; \
|
||||
const int kUvStride = \
|
||||
(SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvStride = (SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvHeight = SUBSAMPLE(kHeight, SUBSAMP_Y); \
|
||||
const int kSampleSize = \
|
||||
(kWidth * kHeight + kUvStride * kUvHeight) * BPC; \
|
||||
const int kSampleSize = (kWidth * kHeight + kUvStride * kUvHeight) * BPC; \
|
||||
align_buffer_page_end(src, kSampleSize); \
|
||||
align_buffer_page_end(dst, kWidth * kHeight * 4); \
|
||||
MemRandomize(src, kSampleSize); \
|
||||
memset(dst, 0, kWidth * kHeight * 4); \
|
||||
EXPECT_EQ(0, ConvertToARGB(src, kSampleSize, dst, kWidth * 4, 0, 0, \
|
||||
kWidth, kHeight, kWidth, kHeight, kRotate0, \
|
||||
FOURCC_##FMT)); \
|
||||
EXPECT_EQ( \
|
||||
0, ConvertToARGB(src, kSampleSize, dst, kWidth * 4, 0, 0, kWidth, \
|
||||
kHeight, kWidth, kHeight, kRotate0, FOURCC_##FMT)); \
|
||||
free_aligned_buffer_page_end(src); \
|
||||
free_aligned_buffer_page_end(dst); \
|
||||
}
|
||||
@ -1773,8 +1771,7 @@ TESTCONVERTTOARGBSMOKE(NV24, 1, 1, 1)
|
||||
TEST_F(LibYUVConvertTest, ConvertToARGB_##FMT##N) { \
|
||||
const int kWidth = W1280; \
|
||||
const int kHeight = benchmark_height_; \
|
||||
const int kUvStride = \
|
||||
(SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvStride = (SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvHeight = SUBSAMPLE(kHeight, SUBSAMP_Y); \
|
||||
const int kYPixels = kWidth * kHeight; \
|
||||
const int kUvPixels = kUvStride * kUvHeight; \
|
||||
@ -1793,9 +1790,9 @@ TESTCONVERTTOARGBSMOKE(NV24, 1, 1, 1)
|
||||
EXPECT_EQ(0, FMT##ToARGBMatrix(src_p, kWidth, src_p + kYPixels, kUvStride, \
|
||||
ref, kWidth * 4, &kYuvI601Constants, \
|
||||
kWidth, NEG kHeight)); \
|
||||
EXPECT_EQ(0, ConvertToARGB(src, 0, dst, kWidth * 4, 0, 0, kWidth, \
|
||||
NEG kHeight, kWidth, kHeight, kRotate0, \
|
||||
FOURCC_##FMT)); \
|
||||
EXPECT_EQ( \
|
||||
0, ConvertToARGB(src, 0, dst, kWidth * 4, 0, 0, kWidth, NEG kHeight, \
|
||||
kWidth, kHeight, kRotate0, FOURCC_##FMT)); \
|
||||
for (int i = 0; i < kWidth * kHeight * 4; ++i) { \
|
||||
ASSERT_EQ(dst[i], ref[i]); \
|
||||
} \
|
||||
@ -1808,14 +1805,14 @@ TESTCONVERTTOARGBSMOKE(NV24, 1, 1, 1)
|
||||
#define TESTCONVERTTOARGB(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y) \
|
||||
TESTCONVERTTOARGBI(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_ + 1, _Any, +) \
|
||||
TESTCONVERTTOARGBI(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_, _Invert, -) \
|
||||
TESTCONVERTTOARGBI(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_, _Opt, +)
|
||||
TESTCONVERTTOARGBI(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, \
|
||||
_Invert, -) \
|
||||
TESTCONVERTTOARGBI(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, \
|
||||
_Opt, +)
|
||||
#else
|
||||
#define TESTCONVERTTOARGB(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y) \
|
||||
TESTCONVERTTOARGBI(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_, _Opt, +)
|
||||
TESTCONVERTTOARGBI(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, \
|
||||
_Opt, +)
|
||||
#endif
|
||||
|
||||
TESTCONVERTTOARGB(P010, uint16_t, 2, 2, 2)
|
||||
@ -2910,9 +2907,10 @@ TEST_F(LibYUVConvertTest, P010ToARGBMatrixFilterOverflow) {
|
||||
align_buffer_page_end(dst_argb, dst_stride_argb * height);
|
||||
memset(src_y, 0x02, width * height * sizeof(uint16_t));
|
||||
memset(src_uv, 0x02, src_stride_uv * src_uv_height * sizeof(uint16_t));
|
||||
EXPECT_EQ(0, P010ToARGBMatrixFilter(src_y, width, src_uv, src_stride_uv, dst_argb,
|
||||
dst_stride_argb, &kYuvI601Constants,
|
||||
width, height, kFilterBilinear));
|
||||
EXPECT_EQ(
|
||||
0, P010ToARGBMatrixFilter(src_y, width, src_uv, src_stride_uv, dst_argb,
|
||||
dst_stride_argb, &kYuvI601Constants, width,
|
||||
height, kFilterBilinear));
|
||||
free_aligned_buffer_page_end_16(src_y);
|
||||
free_aligned_buffer_page_end_16(src_uv);
|
||||
free_aligned_buffer_page_end(dst_argb);
|
||||
@ -2930,9 +2928,10 @@ TEST_F(LibYUVConvertTest, P210ToARGBMatrixFilterOverflow) {
|
||||
align_buffer_page_end(dst_argb, dst_stride_argb * height);
|
||||
memset(src_y, 0x02, width * height * sizeof(uint16_t));
|
||||
memset(src_uv, 0x02, src_stride_uv * height * sizeof(uint16_t));
|
||||
EXPECT_EQ(0, P210ToARGBMatrixFilter(src_y, width, src_uv, src_stride_uv, dst_argb,
|
||||
dst_stride_argb, &kYuvI601Constants,
|
||||
width, height, kFilterBilinear));
|
||||
EXPECT_EQ(
|
||||
0, P210ToARGBMatrixFilter(src_y, width, src_uv, src_stride_uv, dst_argb,
|
||||
dst_stride_argb, &kYuvI601Constants, width,
|
||||
height, kFilterBilinear));
|
||||
free_aligned_buffer_page_end_16(src_y);
|
||||
free_aligned_buffer_page_end_16(src_uv);
|
||||
free_aligned_buffer_page_end(dst_argb);
|
||||
@ -2951,9 +2950,10 @@ TEST_F(LibYUVConvertTest, P010ToAR30MatrixFilterOverflow) {
|
||||
align_buffer_page_end(dst_argb, dst_stride_argb * height);
|
||||
memset(src_y, 0x02, width * height * sizeof(uint16_t));
|
||||
memset(src_uv, 0x02, src_stride_uv * src_uv_height * sizeof(uint16_t));
|
||||
EXPECT_EQ(0, P010ToAR30MatrixFilter(src_y, width, src_uv, src_stride_uv, dst_argb,
|
||||
dst_stride_argb, &kYuvI601Constants,
|
||||
width, height, kFilterBilinear));
|
||||
EXPECT_EQ(
|
||||
0, P010ToAR30MatrixFilter(src_y, width, src_uv, src_stride_uv, dst_argb,
|
||||
dst_stride_argb, &kYuvI601Constants, width,
|
||||
height, kFilterBilinear));
|
||||
free_aligned_buffer_page_end_16(src_y);
|
||||
free_aligned_buffer_page_end_16(src_uv);
|
||||
free_aligned_buffer_page_end(dst_argb);
|
||||
@ -2971,9 +2971,10 @@ TEST_F(LibYUVConvertTest, P210ToAR30MatrixFilterOverflow) {
|
||||
align_buffer_page_end(dst_ar30, dst_stride_ar30 * height);
|
||||
memset(src_y, 0x02, width * height * sizeof(uint16_t));
|
||||
memset(src_uv, 0x02, src_stride_uv * height * sizeof(uint16_t));
|
||||
EXPECT_EQ(0, P210ToAR30MatrixFilter(src_y, width, src_uv, src_stride_uv, dst_ar30,
|
||||
dst_stride_ar30, &kYuvI601Constants,
|
||||
width, height, kFilterBilinear));
|
||||
EXPECT_EQ(
|
||||
0, P210ToAR30MatrixFilter(src_y, width, src_uv, src_stride_uv, dst_ar30,
|
||||
dst_stride_ar30, &kYuvI601Constants, width,
|
||||
height, kFilterBilinear));
|
||||
free_aligned_buffer_page_end_16(src_y);
|
||||
free_aligned_buffer_page_end_16(src_uv);
|
||||
free_aligned_buffer_page_end(dst_ar30);
|
||||
|
||||
@ -478,8 +478,7 @@ TESTPLANARTOBP(I412, uint16_t, 2, 1, 1, P412, uint16_t, 2, 1, 1, 12)
|
||||
const int kHeight = benchmark_height_; \
|
||||
const int kHalfWidth = SUBSAMPLE(kWidth, 2); \
|
||||
const int kHalfHeight = SUBSAMPLE(kHeight, 2); \
|
||||
const int kUvStride = \
|
||||
(SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvStride = (SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvHeight = SUBSAMPLE(kHeight, SUBSAMP_Y); \
|
||||
const int kSamplePixels = kWidth * kHeight + kUvStride * kUvHeight; \
|
||||
align_buffer_page_end(src_y, kWidth * kHeight); \
|
||||
@ -494,10 +493,10 @@ TESTPLANARTOBP(I412, uint16_t, 2, 1, 1, P412, uint16_t, 2, 1, 1, 12)
|
||||
memset(ref, 1, kSamplePixels * BPC); \
|
||||
TYPE* dst_p = reinterpret_cast<TYPE*>(dst); \
|
||||
TYPE* ref_p = reinterpret_cast<TYPE*>(ref); \
|
||||
EXPECT_EQ(0, I420To##FMT(src_y, kWidth, src_u, kHalfWidth, src_v, \
|
||||
kHalfWidth, ref_p, kWidth, \
|
||||
ref_p + kWidth * kHeight, kUvStride, kWidth, \
|
||||
NEG kHeight)); \
|
||||
EXPECT_EQ(0, \
|
||||
I420To##FMT(src_y, kWidth, src_u, kHalfWidth, src_v, kHalfWidth, \
|
||||
ref_p, kWidth, ref_p + kWidth * kHeight, kUvStride, \
|
||||
kWidth, NEG kHeight)); \
|
||||
EXPECT_EQ(0, ConvertFromI420(src_y, kWidth, src_u, kHalfWidth, src_v, \
|
||||
kHalfWidth, dst, 0, kWidth, NEG kHeight, \
|
||||
FOURCC_##FMT)); \
|
||||
@ -523,8 +522,7 @@ TESTPLANARTOBP(I412, uint16_t, 2, 1, 1, P412, uint16_t, 2, 1, 1, 12)
|
||||
const int kHeight = benchmark_height_; \
|
||||
const int kHalfWidth = SUBSAMPLE(kWidth, 2); \
|
||||
const int kHalfHeight = SUBSAMPLE(kHeight, 2); \
|
||||
const int kUvStride = \
|
||||
(SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvStride = (SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvHeight = SUBSAMPLE(kHeight, SUBSAMP_Y); \
|
||||
const int kYPixels = kWidth * kHeight; \
|
||||
const int kUvPixels = kUvStride * kUvHeight; \
|
||||
@ -552,7 +550,7 @@ TESTPLANARTOBP(I412, uint16_t, 2, 1, 1, P412, uint16_t, 2, 1, 1, 12)
|
||||
ref_y, kWidth, ref_u, kHalfWidth, ref_v, \
|
||||
kHalfWidth, kWidth, NEG kHeight)); \
|
||||
EXPECT_EQ(0, ConvertToI420(src, 0, dst_y, kWidth, dst_u, kHalfWidth, \
|
||||
dst_v, kHalfWidth, 0, 0, kWidth, NEG kHeight,\
|
||||
dst_v, kHalfWidth, 0, 0, kWidth, NEG kHeight, \
|
||||
kWidth, kHeight, kRotate0, FOURCC_##FMT)); \
|
||||
for (int i = 0; i < kWidth * kHeight; ++i) { \
|
||||
ASSERT_EQ(dst_y[i], ref_y[i]); \
|
||||
@ -574,24 +572,24 @@ TESTPLANARTOBP(I412, uint16_t, 2, 1, 1, P412, uint16_t, 2, 1, 1, 12)
|
||||
#define TESTCONVERTFROMI420(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y) \
|
||||
TESTCONVERTFROMI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_ + 1, _Any, +) \
|
||||
TESTCONVERTFROMI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_, _Invert, -) \
|
||||
TESTCONVERTFROMI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_, _Opt, +)
|
||||
TESTCONVERTFROMI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, \
|
||||
_Invert, -) \
|
||||
TESTCONVERTFROMI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, \
|
||||
_Opt, +)
|
||||
#define TESTCONVERTTOI420(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y) \
|
||||
TESTCONVERTTOI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_ + 1, _Any, +) \
|
||||
TESTCONVERTTOI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_, _Invert, -) \
|
||||
TESTCONVERTTOI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_, _Opt, +)
|
||||
TESTCONVERTTOI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, \
|
||||
_Invert, -) \
|
||||
TESTCONVERTTOI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, \
|
||||
_Opt, +)
|
||||
#else
|
||||
#define TESTCONVERTFROMI420(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y) \
|
||||
TESTCONVERTFROMI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_, _Opt, +)
|
||||
TESTCONVERTFROMI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, \
|
||||
_Opt, +)
|
||||
#define TESTCONVERTTOI420(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y) \
|
||||
TESTCONVERTTOI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, \
|
||||
benchmark_width_, _Opt, +)
|
||||
TESTCONVERTTOI420I(FMT, TYPE, BPC, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, \
|
||||
_Opt, +)
|
||||
#endif
|
||||
|
||||
TESTCONVERTFROMI420(P010, uint16_t, 2, 2, 2)
|
||||
@ -605,11 +603,9 @@ TESTCONVERTTOI420(P410, uint16_t, 2, 1, 1)
|
||||
TEST_F(LibYUVConvertTest, ConvertToI420_##FMT) { \
|
||||
const int kWidth = 64; \
|
||||
const int kHeight = 48; \
|
||||
const int kUvStride = \
|
||||
(SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvStride = (SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvHeight = SUBSAMPLE(kHeight, SUBSAMP_Y); \
|
||||
const int kSampleSize = \
|
||||
(kWidth * kHeight + kUvStride * kUvHeight) * BPC; \
|
||||
const int kSampleSize = (kWidth * kHeight + kUvStride * kUvHeight) * BPC; \
|
||||
align_buffer_page_end(src, kSampleSize); \
|
||||
align_buffer_page_end(dst_y, kWidth * kHeight); \
|
||||
align_buffer_page_end(dst_u, (kWidth / 2) * (kHeight / 2)); \
|
||||
@ -618,10 +614,10 @@ TESTCONVERTTOI420(P410, uint16_t, 2, 1, 1)
|
||||
memset(dst_y, 0, kWidth * kHeight); \
|
||||
memset(dst_u, 0, (kWidth / 2) * (kHeight / 2)); \
|
||||
memset(dst_v, 0, (kWidth / 2) * (kHeight / 2)); \
|
||||
EXPECT_EQ(0, ConvertToI420(src, kSampleSize, dst_y, kWidth, dst_u, \
|
||||
kWidth / 2, dst_v, kWidth / 2, 0, 0, kWidth, \
|
||||
kHeight, kWidth, kHeight, kRotate0, \
|
||||
FOURCC_##FMT)); \
|
||||
EXPECT_EQ( \
|
||||
0, ConvertToI420(src, kSampleSize, dst_y, kWidth, dst_u, kWidth / 2, \
|
||||
dst_v, kWidth / 2, 0, 0, kWidth, kHeight, kWidth, \
|
||||
kHeight, kRotate0, FOURCC_##FMT)); \
|
||||
free_aligned_buffer_page_end(src); \
|
||||
free_aligned_buffer_page_end(dst_y); \
|
||||
free_aligned_buffer_page_end(dst_u); \
|
||||
@ -632,8 +628,7 @@ TESTCONVERTTOI420(P410, uint16_t, 2, 1, 1)
|
||||
TEST_F(LibYUVConvertTest, ConvertFromI420_##FMT) { \
|
||||
const int kWidth = 64; \
|
||||
const int kHeight = 48; \
|
||||
const int kUvStride = \
|
||||
(SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvStride = (SUBSAMP_X == 1) ? kWidth * 2 : ((kWidth + 1) & ~1); \
|
||||
const int kUvHeight = SUBSAMPLE(kHeight, SUBSAMP_Y); \
|
||||
const int kDstSize = (kWidth * kHeight + kUvStride * kUvHeight) * BPC; \
|
||||
align_buffer_page_end(src_y, kWidth * kHeight); \
|
||||
@ -1119,8 +1114,7 @@ TESTATOBPMATRIX(ARGB, 4, NV24, 1, 1)
|
||||
} \
|
||||
for (int i = 0; i < kHeightUV; ++i) { \
|
||||
for (int j = 0; j < kStrideUV * 2; ++j) { \
|
||||
ASSERT_EQ(uv_c[i * kStrideUV * 2 + j], \
|
||||
uv_opt[i * kStrideUV * 2 + j]); \
|
||||
ASSERT_EQ(uv_c[i * kStrideUV * 2 + j], uv_opt[i * kStrideUV * 2 + j]); \
|
||||
} \
|
||||
} \
|
||||
free_aligned_buffer_page_end(dst_y_c); \
|
||||
@ -1165,13 +1159,12 @@ TESTATOBP16(ARGB, 1, 4, P410, 1, 1)
|
||||
MemRandomize(src_argb, kWidth * kHeight * BPP_A); \
|
||||
\
|
||||
FMT_A##To##FMT_B##Matrix( \
|
||||
src_argb, kWidth * BPP_A, reinterpret_cast<uint16_t*>(dst_y), \
|
||||
kWidth, reinterpret_cast<uint16_t*>(dst_uv), kStrideUV * 2, \
|
||||
src_argb, kWidth * BPP_A, reinterpret_cast<uint16_t*>(dst_y), kWidth, \
|
||||
reinterpret_cast<uint16_t*>(dst_uv), kStrideUV * 2, \
|
||||
&kArgbI601Constants, kWidth, kHeight); \
|
||||
FMT_A##To##FMT_B(src_argb, kWidth * BPP_A, \
|
||||
reinterpret_cast<uint16_t*>(ref_y), kWidth, \
|
||||
reinterpret_cast<uint16_t*>(ref_uv), kStrideUV * 2, \
|
||||
kWidth, kHeight); \
|
||||
FMT_A##To##FMT_B( \
|
||||
src_argb, kWidth * BPP_A, reinterpret_cast<uint16_t*>(ref_y), kWidth, \
|
||||
reinterpret_cast<uint16_t*>(ref_uv), kStrideUV * 2, kWidth, kHeight); \
|
||||
const uint16_t* y = reinterpret_cast<const uint16_t*>(dst_y); \
|
||||
const uint16_t* y_ref = reinterpret_cast<const uint16_t*>(ref_y); \
|
||||
const uint16_t* uv = reinterpret_cast<const uint16_t*>(dst_uv); \
|
||||
|
||||
@ -1760,17 +1760,15 @@ TEST_F(LibYUVPlanarTest, TestDetileSplitUVPlane_Correctness) {
|
||||
memset(dst_v_two_stage, 0, uv_plane_size);
|
||||
memset(dst_v_opt, 0, uv_plane_size);
|
||||
|
||||
DetileSplitUVPlane(tile_uv, tile_width, dst_u_opt, uv_width / 2,
|
||||
dst_v_opt, uv_width / 2, uv_width,
|
||||
benchmark_height_, 16);
|
||||
DetileSplitUVPlane(tile_uv, tile_width, dst_u_opt, uv_width / 2, dst_v_opt,
|
||||
uv_width / 2, uv_width, benchmark_height_, 16);
|
||||
|
||||
// Benchmark 2 step conversion for comparison.
|
||||
for (j = 0; j < benchmark_iterations_; j++) {
|
||||
DetilePlane(tile_uv, tile_width, detiled_uv, uv_width,
|
||||
uv_width, benchmark_height_, 16);
|
||||
SplitUVPlane(detiled_uv, uv_width, dst_u_two_stage,
|
||||
uv_width / 2, dst_v_two_stage,
|
||||
uv_width / 2, uv_width / 2,
|
||||
DetilePlane(tile_uv, tile_width, detiled_uv, uv_width, uv_width,
|
||||
benchmark_height_, 16);
|
||||
SplitUVPlane(detiled_uv, uv_width, dst_u_two_stage, uv_width / 2,
|
||||
dst_v_two_stage, uv_width / 2, uv_width / 2,
|
||||
benchmark_height_);
|
||||
}
|
||||
|
||||
@ -1811,16 +1809,14 @@ TEST_F(LibYUVPlanarTest, TestDetileSplitUVPlane_Benchmark) {
|
||||
// Disable all optimizations.
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
|
||||
DetileSplitUVPlane(tile_uv, tile_width, dst_u_c, uv_width / 2,
|
||||
dst_v_c, uv_width / 2, uv_width,
|
||||
benchmark_height_, 16);
|
||||
DetileSplitUVPlane(tile_uv, tile_width, dst_u_c, uv_width / 2, dst_v_c,
|
||||
uv_width / 2, uv_width, benchmark_height_, 16);
|
||||
|
||||
// Enable optimizations.
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
for (j = 0; j < benchmark_iterations_; j++) {
|
||||
DetileSplitUVPlane(
|
||||
tile_uv, tile_width, dst_u_opt, uv_width / 2, dst_v_opt,
|
||||
DetileSplitUVPlane(tile_uv, tile_width, dst_u_opt, uv_width / 2, dst_v_opt,
|
||||
uv_width / 2, uv_width, benchmark_height_, 16);
|
||||
}
|
||||
|
||||
@ -3772,9 +3768,9 @@ TEST_F(LibYUVPlanarTest, MergeUVRow_16_Opt) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAS_MULTIPLYROW_16_AVX512BW) || defined(HAS_MULTIPLYROW_16_AVX2) || \
|
||||
defined(HAS_MULTIPLYROW_16_NEON) || defined(HAS_MULTIPLYROW_16_SME) || \
|
||||
defined(HAS_MULTIPLYROW_16_RVV)
|
||||
#if defined(HAS_MULTIPLYROW_16_AVX512BW) || \
|
||||
defined(HAS_MULTIPLYROW_16_AVX2) || defined(HAS_MULTIPLYROW_16_NEON) || \
|
||||
defined(HAS_MULTIPLYROW_16_SME) || defined(HAS_MULTIPLYROW_16_RVV)
|
||||
TEST_F(LibYUVPlanarTest, MultiplyRow_16_Opt) {
|
||||
// Round count up to multiple of 64
|
||||
const int kPixels = (benchmark_width_ * benchmark_height_ + 63) & ~63;
|
||||
@ -3858,8 +3854,8 @@ TEST_F(LibYUVPlanarTest, MultiplyRow_16_Opt) {
|
||||
free_aligned_buffer_page_end(dst_pixels_y_c);
|
||||
}
|
||||
|
||||
#if defined(HAS_MULTIPLYROW_16_AVX512BW) || defined(HAS_MULTIPLYROW_16_AVX2) || \
|
||||
defined(HAS_MULTIPLYROW_16_NEON)
|
||||
#if defined(HAS_MULTIPLYROW_16_AVX512BW) || \
|
||||
defined(HAS_MULTIPLYROW_16_AVX2) || defined(HAS_MULTIPLYROW_16_NEON)
|
||||
TEST_F(LibYUVPlanarTest, MultiplyRow_16_Any) {
|
||||
const int kMaxPixels = 256;
|
||||
align_buffer_page_end(src_pixels_y, kMaxPixels * 2);
|
||||
@ -3889,28 +3885,29 @@ TEST_F(LibYUVPlanarTest, MultiplyRow_16_Any) {
|
||||
|
||||
#if defined(HAS_MULTIPLYROW_16_AVX512BW)
|
||||
if (has_avx512) {
|
||||
MultiplyRow_16_Any_AVX512BW(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt),
|
||||
64, width);
|
||||
MultiplyRow_16_Any_AVX512BW(
|
||||
reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt), 64, width);
|
||||
} else
|
||||
#endif
|
||||
#if defined(HAS_MULTIPLYROW_16_AVX2)
|
||||
if (has_avx2) {
|
||||
MultiplyRow_16_Any_AVX2(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt),
|
||||
64, width);
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt), 64,
|
||||
width);
|
||||
} else
|
||||
#endif
|
||||
#if defined(HAS_MULTIPLYROW_16_NEON)
|
||||
if (has_neon) {
|
||||
MultiplyRow_16_Any_NEON(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt),
|
||||
64, width);
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt), 64,
|
||||
width);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
MultiplyRow_16_C(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt), 64, width);
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt), 64,
|
||||
width);
|
||||
}
|
||||
|
||||
for (int i = 0; i < width * 2; ++i) {
|
||||
@ -3922,7 +3919,8 @@ TEST_F(LibYUVPlanarTest, MultiplyRow_16_Any) {
|
||||
free_aligned_buffer_page_end(dst_pixels_y_opt);
|
||||
free_aligned_buffer_page_end(dst_pixels_y_c);
|
||||
}
|
||||
#endif // HAS_MULTIPLYROW_16_AVX512BW || HAS_MULTIPLYROW_16_AVX2 || HAS_MULTIPLYROW_16_NEON
|
||||
#endif // HAS_MULTIPLYROW_16_AVX512BW || HAS_MULTIPLYROW_16_AVX2 ||
|
||||
// HAS_MULTIPLYROW_16_NEON
|
||||
#endif // HAS_MULTIPLYROW_16_...
|
||||
|
||||
TEST_F(LibYUVPlanarTest, Convert16To8Plane) {
|
||||
@ -4092,8 +4090,10 @@ TEST_F(LibYUVPlanarTest, Convert16To8Row_Opt) {
|
||||
}
|
||||
#endif // HAS_CONVERT16TO8ROW_AVX2
|
||||
|
||||
#if defined(HAS_HALFWIDTHROW_16TO8_AVX2) || defined(HAS_HALFWIDTHROW_16TO8_SSSE3) || \
|
||||
defined(HAS_HALFWIDTHROW_16TO8_AVX512BW) || defined(HAS_HALFWIDTHROW_16TO8_NEON)
|
||||
#if defined(HAS_HALFWIDTHROW_16TO8_AVX2) || \
|
||||
defined(HAS_HALFWIDTHROW_16TO8_SSSE3) || \
|
||||
defined(HAS_HALFWIDTHROW_16TO8_AVX512BW) || \
|
||||
defined(HAS_HALFWIDTHROW_16TO8_NEON)
|
||||
TEST_F(LibYUVPlanarTest, HalfWidthRow_16To8_Opt) {
|
||||
const int kPixels = (benchmark_width_ * benchmark_height_ + 63) & ~63;
|
||||
align_buffer_page_end_16(src_pixels_uv, kPixels * 4);
|
||||
@ -4276,8 +4276,7 @@ TEST_F(LibYUVPlanarTest, Convert8To16Plane) {
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
Convert8To16Plane(src_pixels_y, benchmark_width_,
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_c),
|
||||
benchmark_width_, 10, benchmark_width_,
|
||||
benchmark_height_);
|
||||
benchmark_width_, 10, benchmark_width_, benchmark_height_);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
|
||||
@ -604,7 +604,8 @@ TEST_F(LibYUVScaleTest, ARGBScale_LargeHeightOverflow) {
|
||||
align_buffer_page_end(dest_pixels, src_w * 2 * 4);
|
||||
memset(orig_pixels, 128, src_w * src_h * 4);
|
||||
|
||||
// Test both vertical-only scaling (dst_w == src_w) and 2D scaling (dst_w != src_w).
|
||||
// Test both vertical-only scaling (dst_w == src_w) and 2D scaling (dst_w !=
|
||||
// src_w).
|
||||
for (int dst_w : {4, 2}) {
|
||||
int res = ARGBScale(orig_pixels, src_w * 4, src_w, src_h, dest_pixels,
|
||||
dst_w * 4, dst_w, 2, kFilterBilinear);
|
||||
|
||||
@ -14,9 +14,9 @@
|
||||
|
||||
#ifdef __linux__
|
||||
#include <ctype.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
#include "libyuv/cpu_id.h"
|
||||
@ -230,7 +230,10 @@ int main(int argc, const char* argv[]) {
|
||||
|
||||
if (sigsetjmp(vdpphps_jmpbuf, 1) == 0) {
|
||||
// VDPPHPS xmm0, xmm0, xmm0
|
||||
__asm__ volatile(".byte 0x62, 0xf2, 0x7c, 0x08, 0x52, 0xc0" : : : "xmm0");
|
||||
__asm__ volatile(".byte 0x62, 0xf2, 0x7c, 0x08, 0x52, 0xc0"
|
||||
:
|
||||
:
|
||||
: "xmm0");
|
||||
printf("Works!\n");
|
||||
} else {
|
||||
printf("Crashed (SIGILL)!\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user