Apply clang format to libyuv source

Bug: None
Change-Id: Ifd16b59d7f0dbf4402dd5741bb89d1ec06dfaac8
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2131868
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Hsiu Wang <hsiu@google.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
Frank Barchard 2020-04-01 05:55:49 -07:00 committed by Commit Bot
parent 59b29c5f4d
commit 7e05059557
10 changed files with 1481 additions and 1375 deletions

View File

@ -1,6 +1,6 @@
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 1747
Version: 1748
License: BSD
License File: LICENSE

View File

@ -319,11 +319,11 @@ int ARGBMirror(const uint8_t* src_argb,
// RGB24 mirror.
LIBYUV_API
int RGB24Mirror(const uint8_t* src_rgb24,
int src_stride_rgb24,
uint8_t* dst_rgb24,
int dst_stride_rgb24,
int width,
int height);
int src_stride_rgb24,
uint8_t* dst_rgb24,
int dst_stride_rgb24,
int width,
int height);
// Mirror a plane of data.
LIBYUV_API

View File

@ -83,20 +83,6 @@ int NV12ToI420Rotate(const uint8_t* src_y,
int height,
enum RotationMode mode);
// Rotate NV12 input and store in NV12.
LIBYUV_API
int NV12Rotate(const uint8_t* src_y,
int src_stride_y,
const uint8_t* src_uv,
int src_stride_uv,
uint8_t* dst_y,
int dst_stride_y,
uint8_t* dst_uv,
int dst_stride_uv,
int width,
int height,
enum RotationMode mode);
// Rotate a plane by 0, 90, 180, or 270.
LIBYUV_API
int RotatePlane(const uint8_t* src,

View File

@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1747
#define LIBYUV_VERSION 1748
#endif // INCLUDE_LIBYUV_VERSION_H_

View File

@ -986,8 +986,12 @@ int YUY2ToY(const uint8_t* src_yuy2,
// Mirror a plane of data.
// See Also I400Mirror
LIBYUV_API
void MirrorPlane(const uint8_t* src_y, int src_stride_y, uint8_t* dst_y,
int dst_stride_y, int width, int height) {
void MirrorPlane(const uint8_t* src_y,
int src_stride_y,
uint8_t* dst_y,
int dst_stride_y,
int width,
int height) {
int y;
void (*MirrorRow)(const uint8_t* src, uint8_t* dst, int width) = MirrorRow_C;
// Negative height means invert the image.
@ -1182,11 +1186,11 @@ int ARGBMirror(const uint8_t* src_argb,
// RGB24 mirror.
LIBYUV_API
int RGB24Mirror(const uint8_t* src_rgb24,
int src_stride_rgb24,
uint8_t* dst_rgb24,
int dst_stride_rgb24,
int width,
int height) {
int src_stride_rgb24,
uint8_t* dst_rgb24,
int dst_stride_rgb24,
int width,
int height) {
int y;
void (*RGB24MirrorRow)(const uint8_t* src, uint8_t* dst, int width) =
RGB24MirrorRow_C;
@ -3101,14 +3105,11 @@ int GaussPlane_F32(const float* src,
int width,
int height) {
int y;
void (*GaussCol_F32)(const float* src0,
const float* src1,
const float* src2,
const float* src3,
const float* src4,
float* dst,
void (*GaussCol_F32)(const float* src0, const float* src1, const float* src2,
const float* src3, const float* src4, float* dst,
int width) = GaussCol_F32_C;
void (*GaussRow_F32)(const float* src, float* dst, int width) = GaussRow_F32_C;
void (*GaussRow_F32)(const float* src, float* dst, int width) =
GaussRow_F32_C;
if (!src || !dst || width <= 0 || height == 0) {
return -1;
}
@ -3139,10 +3140,9 @@ int GaussPlane_F32(const float* src,
const float* src1 = src;
const float* src2 = src;
const float* src3 = src2 + ((height > 1) ? src_stride : 0);
const float* src4 = src3 + ((height > 2) ? src_stride: 0);
const float* src4 = src3 + ((height > 2) ? src_stride : 0);
for (y = 0; y < height; ++y) {
GaussCol_F32(src0, src1, src2, src3, src4, row, width);
// Extrude edge by 2 floats

View File

@ -2201,8 +2201,7 @@ void ARGBMirrorRow_C(const uint8_t* src, uint8_t* dst, int width) {
}
}
void RGB24MirrorRow_C(const uint8_t* src_rgb24, uint8_t* dst_rgb24,
int width) {
void RGB24MirrorRow_C(const uint8_t* src_rgb24, uint8_t* dst_rgb24, int width) {
int x;
src_rgb24 += width * 3 - 3;
for (x = 0; x < width; ++x) {

View File

@ -3266,14 +3266,15 @@ void MirrorUVRow_SSSE3(const uint8_t* src,
// Shuffle first 5 pixels to last 5 mirrored. first byte zero
static const uvec8 kShuffleMirrorRGB0 = {128u, 12u, 13u, 14u, 9u, 10u, 11u, 6u,
7u, 8u, 3u, 4u, 5u, 0u, 1u, 2u};
7u, 8u, 3u, 4u, 5u, 0u, 1u, 2u};
// Shuffle last 5 pixels to first 5 mirrored. last byte zero
static const uvec8 kShuffleMirrorRGB1 = {13u, 14u, 15u, 10u, 11u, 12u, 7u,
8u, 9u, 4u, 5u, 6u, 1u, 2u, 3u, 128u};
static const uvec8 kShuffleMirrorRGB1 = {
13u, 14u, 15u, 10u, 11u, 12u, 7u, 8u, 9u, 4u, 5u, 6u, 1u, 2u, 3u, 128u};
// Shuffle 5 pixels at a time (15 bytes)
void RGB24MirrorRow_SSSE3(const uint8_t* src_rgb24, uint8_t* dst_rgb24,
void RGB24MirrorRow_SSSE3(const uint8_t* src_rgb24,
uint8_t* dst_rgb24,
int width) {
intptr_t temp_width = (intptr_t)(width);
src_rgb24 += width * 3 - 48;
@ -3292,21 +3293,21 @@ void RGB24MirrorRow_SSSE3(const uint8_t* src_rgb24, uint8_t* dst_rgb24,
"pshufb %%xmm4,%%xmm2 \n"
"pshufb %%xmm5,%%xmm3 \n"
"lea -0x30(%0),%0 \n"
"movdqu %%xmm0,32(%1) \n" // last 5
"movdqu %%xmm1,17(%1) \n" // next 5
"movdqu %%xmm2,2(%1) \n" // next 5
"movlpd %%xmm3,0(%1) \n" // first 1
"movdqu %%xmm0,32(%1) \n" // last 5
"movdqu %%xmm1,17(%1) \n" // next 5
"movdqu %%xmm2,2(%1) \n" // next 5
"movlpd %%xmm3,0(%1) \n" // first 1
"lea 0x30(%1),%1 \n"
"sub $0x10,%2 \n"
"jg 1b \n"
: "+r"(src_rgb24), // %0
"+r"(dst_rgb24), // %1
"+r"(temp_width) // %2
: "m"(kShuffleMirrorRGB0), // %3
"m"(kShuffleMirrorRGB1) // %4
: "+r"(src_rgb24), // %0
"+r"(dst_rgb24), // %1
"+r"(temp_width) // %2
: "m"(kShuffleMirrorRGB0), // %3
"m"(kShuffleMirrorRGB1) // %4
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5");
}
#endif // HAS_RGB24MIRRORROW_SSSE3
#endif // HAS_RGB24MIRRORROW_SSSE3
#ifdef HAS_ARGBMIRRORROW_SSE2

File diff suppressed because it is too large Load Diff

View File

@ -726,24 +726,29 @@ void MirrorUVRow_NEON(const uint8_t* src_uv,
: "cc", "memory", "r12", "q0");
}
void ARGBMirrorRow_NEON(const uint8_t* src, uint8_t* dst, int width) {
src += width * 4 - 16;
void ARGBMirrorRow_NEON(const uint8_t* src_argb, uint8_t* dst_argb, int width) {
asm volatile(
"add %0, %0, %2, lsl #2 \n"
"sub %0, #32 \n"
"1: \n"
"vld1.8 {q0}, [%0], %3 \n" // src -= 16
"subs %2, #4 \n" // 4 pixels per loop.
"vrev64.32 q0, q0 \n"
"vst1.8 {d1}, [%1]! \n" // dst += 16
"vst1.8 {d0}, [%1]! \n"
"vld4.8 {d0, d1, d2, d3}, [%0], %3 \n" // src -= 32
"subs %2, #8 \n" // 8 pixels per loop.
"vrev64.8 d0, d0 \n"
"vrev64.8 d1, d1 \n"
"vrev64.8 d2, d2 \n"
"vrev64.8 d3, d3 \n"
"vst4.8 {d0, d1, d2, d3}, [%1]! \n" // dst += 32
"bgt 1b \n"
: "+r"(src), // %0
"+r"(dst), // %1
"+r"(width) // %2
: "r"(-16) // %3
: "cc", "memory", "q0");
: "+r"(src_argb), // %0
"+r"(dst_argb), // %1
"+r"(width) // %2
: "r"(-32) // %3
: "cc", "memory", "d0", "d1", "d2", "d3");
}
void RGB24MirrorRow_NEON(const uint8_t* src_rgb24, uint8_t* dst_rgb24,
void RGB24MirrorRow_NEON(const uint8_t* src_rgb24,
uint8_t* dst_rgb24,
int width) {
src_rgb24 += width * 3 - 24;
asm volatile(
@ -762,7 +767,8 @@ void RGB24MirrorRow_NEON(const uint8_t* src_rgb24, uint8_t* dst_rgb24,
: "cc", "memory", "d0", "d1", "d2");
}
void RGB24ToARGBRow_NEON(const uint8_t* src_rgb24, uint8_t* dst_argb,
void RGB24ToARGBRow_NEON(const uint8_t* src_rgb24,
uint8_t* dst_argb,
int width) {
asm volatile(
"vmov.u8 d4, #255 \n" // Alpha

View File

@ -265,6 +265,8 @@ void I422ToRGB24Row_NEON(const uint8_t* src_y,
"sri v0.8h, v21.8h, #5 \n" /* RG */ \
"sri v0.8h, v20.8h, #11 \n" /* RGB */
// clang-format off
void I422ToRGB565Row_NEON(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
@ -272,15 +274,15 @@ void I422ToRGB565Row_NEON(const uint8_t* src_y,
const struct YuvConstants* yuvconstants,
int width) {
asm volatile(
YUVTORGB_SETUP
"1: \n" READYUV422 YUVTORGB(
v22, v21,
v20) "subs %w4, %w4, #8 \n" ARGBTORGB565
"st1 {v0.8h}, [%3], #16 \n" // store 8 pixels
// RGB565.
"prfm pldl1keep, [%0, 448] \n" // prefetch 7
// lines ahead
"b.gt 1b \n"
YUVTORGB_SETUP
"1: \n"
READYUV422
YUVTORGB(v22, v21, v20)
"subs %w4, %w4, #8 \n"
ARGBTORGB565
"st1 {v0.8h}, [%3], #16 \n" // store 8 pixels RGB565.
"prfm pldl1keep, [%0, 448] \n" // prefetch 7 lines ahead
"b.gt 1b \n"
: "+r"(src_y), // %0
"+r"(src_u), // %1
"+r"(src_v), // %2
@ -310,16 +312,16 @@ void I422ToARGB1555Row_NEON(const uint8_t* src_y,
const struct YuvConstants* yuvconstants,
int width) {
asm volatile(
YUVTORGB_SETUP
"movi v23.8b, #255 \n"
"1: \n" READYUV422 YUVTORGB(
v22, v21,
v20) "subs %w4, %w4, #8 \n" ARGBTOARGB1555
"st1 {v0.8h}, [%3], #16 \n" // store 8 pixels
// RGB565.
"prfm pldl1keep, [%0, 448] \n" // prefetch 7
// lines ahead
"b.gt 1b \n"
YUVTORGB_SETUP
"movi v23.8b, #255 \n"
"1: \n"
READYUV422
YUVTORGB(v22, v21, v20)
"subs %w4, %w4, #8 \n"
ARGBTOARGB1555
"st1 {v0.8h}, [%3], #16 \n" // store 8 pixels RGB565.
"prfm pldl1keep, [%0, 448] \n" // prefetch 7 lines ahead
"b.gt 1b \n"
: "+r"(src_y), // %0
"+r"(src_u), // %1
"+r"(src_v), // %2
@ -332,6 +334,7 @@ void I422ToARGB1555Row_NEON(const uint8_t* src_y,
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v20",
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30");
}
// clang-format on
#define ARGBTOARGB4444 \
/* Input v20.8b<=B, v21.8b<=G, v22.8b<=R, v23.8b<=A, v4.8b<=0x0f */ \
@ -786,8 +789,7 @@ void MirrorUVRow_NEON(const uint8_t* src_uv,
: "cc", "memory", "v0", "v1");
}
void ARGBMirrorRow_NEON(const uint8_t* src_argb, uint8_t* dst_argb,
int width) {
void ARGBMirrorRow_NEON(const uint8_t* src_argb, uint8_t* dst_argb, int width) {
asm volatile(
"ld1 {v4.16b}, [%4] \n" // shuffler
"add %0, %0, %w2, sxtw #2 \n" // Start at end of row.
@ -801,23 +803,26 @@ void ARGBMirrorRow_NEON(const uint8_t* src_argb, uint8_t* dst_argb,
"tbl v3.16b, {v3.16b}, v4.16b \n"
"st4 {v0.16b, v1.16b, v2.16b, v3.16b}, [%1], #64 \n" // dst += 64
"b.gt 1b \n"
: "+r"(src_argb), // %0
"+r"(dst_argb), // %1
: "+r"(src_argb), // %0
"+r"(dst_argb), // %1
"+r"(width) // %2
: "r"((ptrdiff_t)-64), // %3
"r"(&kShuffleMirror) // %4
: "cc", "memory", "v0", "v1", "v2", "v3", "v4");
}
void RGB24MirrorRow_NEON(const uint8_t* src_rgb24, uint8_t* dst_rgb24,
void RGB24MirrorRow_NEON(const uint8_t* src_rgb24,
uint8_t* dst_rgb24,
int width) {
src_rgb24 += width * 3 - 48;
asm volatile(
"ld1 {v3.16b}, [%4] \n" // shuffler
"add %0, %0, %w2, sxtw #1 \n" // Start at end of row.
"add %0, %0, %w2, sxtw \n"
"sub %0, %0, #48 \n"
"1: \n"
"ld3 {v0.16b, v1.16b, v2.16b}, [%0], %3\n" // src -= 48
"subs %w2, %w2, #16 \n" // 16 pixels per loop.
"subs %w2, %w2, #16 \n" // 16 pixels per loop.
"tbl v0.16b, {v0.16b}, v3.16b \n"
"tbl v1.16b, {v1.16b}, v3.16b \n"
"tbl v2.16b, {v2.16b}, v3.16b \n"
@ -2211,11 +2216,9 @@ void RAWToYJRow_NEON(const uint8_t* src_raw, uint8_t* dst_yj, int width) {
"umull v0.8h, v0.8b, v4.8b \n" // B
"umlal v0.8h, v1.8b, v5.8b \n" // G
"umlal v0.8h, v2.8b, v6.8b \n" // R
"prfm pldl1keep, [%0, 448] \n" // prefetch 7 cache lines
// ahead
"prfm pldl1keep, [%0, 448] \n" // prefetch 7 lines ahead
"uqrshrn v0.8b, v0.8h, #8 \n" // 16 bit to 8 bit Y
"st1 {v0.8b}, [%1], #8 \n" // store 8 pixels Y.
"prfm pldl1keep, [%0, 448] \n" // prefetch 7 lines ahead
"b.gt 1b \n"
: "+r"(src_raw), // %0
"+r"(dst_yj), // %1
@ -2369,7 +2372,6 @@ void ARGBAttenuateRow_NEON(const uint8_t* src_argb,
"uqrshrn v1.8b, v5.8h, #8 \n" // g >>= 8
"uqrshrn v2.8b, v6.8h, #8 \n" // r >>= 8
"st4 {v0.8b,v1.8b,v2.8b,v3.8b}, [%1], #32 \n" // store 8 ARGB
// pixels
"prfm pldl1keep, [%0, 448] \n" // prefetch 7 lines ahead
"b.gt 1b \n"
: "+r"(src_argb), // %0