I420ToARGB prototype added to convert_from.h

Duplicate I420ToARGB prototype from convert_argb.h into convert_from.h for webrtc
Apply clang format for white spacing consistency.

Bug: libyuv:838, b/151375918
Change-Id: I0f667ca5350192710dbb135e92e73e18b46135e5
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2446613
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
Frank Barchard 2020-10-02 10:20:09 -07:00 committed by Commit Bot
parent 0b1e6ea6c9
commit 385418a8e2
7 changed files with 48 additions and 18 deletions

View File

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

View File

@ -132,6 +132,35 @@ int I420ToUYVY(const uint8_t* src_y,
int width, int width,
int height); int height);
// The following are from convert_argb.h
// DEPRECATED: The prototypes will be removed in future. Use convert_argb.h
// Convert I420 to ARGB.
LIBYUV_API
int I420ToARGB(const uint8_t* src_y,
int src_stride_y,
const uint8_t* src_u,
int src_stride_u,
const uint8_t* src_v,
int src_stride_v,
uint8_t* dst_argb,
int dst_stride_argb,
int width,
int height);
// Convert I420 to ABGR.
LIBYUV_API
int I420ToABGR(const uint8_t* src_y,
int src_stride_y,
const uint8_t* src_u,
int src_stride_u,
const uint8_t* src_v,
int src_stride_v,
uint8_t* dst_abgr,
int dst_stride_abgr,
int width,
int height);
// Convert I420 to specified format. // Convert I420 to specified format.
// "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the // "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the
// buffer has contiguous rows. Can be negative. A multiple of 16 is optimal. // buffer has contiguous rows. Can be negative. A multiple of 16 is optimal.

View File

@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ #ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1764 #define LIBYUV_VERSION 1765
#endif // INCLUDE_LIBYUV_VERSION_H_ #endif // INCLUDE_LIBYUV_VERSION_H_

View File

@ -7146,11 +7146,8 @@ void HalfMergeUVRow_AVX2(const uint8_t* src_u,
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5"); : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5");
} }
void ClampFloatToZero_SSE2(const float* src_x, void ClampFloatToZero_SSE2(const float* src_x, float* dst_y, int width) {
float * dst_y, asm volatile(
int width) {
asm volatile(
"pxor %%xmm1,%%xmm1 \n" "pxor %%xmm1,%%xmm1 \n"
LABELALIGN LABELALIGN

View File

@ -3163,8 +3163,8 @@ void ARGBBlendRow_MSA(const uint8_t* src_argb0,
dst1 = (v16u8)__msa_pckev_b((v16i8)vec3, (v16i8)vec2); dst1 = (v16u8)__msa_pckev_b((v16i8)vec3, (v16i8)vec2);
dst2 = (v16u8)__msa_pckev_b((v16i8)vec9, (v16i8)vec8); dst2 = (v16u8)__msa_pckev_b((v16i8)vec9, (v16i8)vec8);
dst3 = (v16u8)__msa_pckev_b((v16i8)vec11, (v16i8)vec10); dst3 = (v16u8)__msa_pckev_b((v16i8)vec11, (v16i8)vec10);
dst0 = (v16u8)__msa_adds_u_b(dst0,dst2); dst0 = (v16u8)__msa_adds_u_b(dst0, dst2);
dst1 = (v16u8)__msa_adds_u_b(dst1,dst3); dst1 = (v16u8)__msa_adds_u_b(dst1, dst3);
dst0 = __msa_bmnz_v(dst0, const_255, mask); dst0 = __msa_bmnz_v(dst0, const_255, mask);
dst1 = __msa_bmnz_v(dst1, const_255, mask); dst1 = __msa_bmnz_v(dst1, const_255, mask);
ST_UB2(dst0, dst1, dst_argb, 16); ST_UB2(dst0, dst1, dst_argb, 16);

View File

@ -402,7 +402,11 @@ static void YUVHToRGBReference(int y, int u, int v, int* r, int* g, int* b) {
} }
// BT.2020 YUV to RGB reference // BT.2020 YUV to RGB reference
static void YUVRec2020ToRGBReference(int y, int u, int v, int* r, int* g, static void YUVRec2020ToRGBReference(int y,
int u,
int v,
int* r,
int* g,
int* b) { int* b) {
*r = RoundToByte((y - 16) * 1.164384 - (v - 128) * -1.67867); *r = RoundToByte((y - 16) * 1.164384 - (v - 128) * -1.67867);
*g = RoundToByte((y - 16) * 1.164384 - (u - 128) * 0.187326 - *g = RoundToByte((y - 16) * 1.164384 - (u - 128) * 0.187326 -

View File

@ -512,7 +512,7 @@ static int NV12TestFilter(int src_width,
int src_height_uv = (Abs(src_height) + 1) >> 1; int src_height_uv = (Abs(src_height) + 1) >> 1;
int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height)); int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
int64_t src_uv_plane_size = (src_width_uv) * (src_height_uv) * 2; int64_t src_uv_plane_size = (src_width_uv) * (src_height_uv)*2;
int src_stride_y = Abs(src_width); int src_stride_y = Abs(src_width);
int src_stride_uv = src_width_uv * 2; int src_stride_uv = src_width_uv * 2;
@ -530,7 +530,7 @@ static int NV12TestFilter(int src_width,
int dst_height_uv = (dst_height + 1) >> 1; int dst_height_uv = (dst_height + 1) >> 1;
int64_t dst_y_plane_size = (dst_width) * (dst_height); int64_t dst_y_plane_size = (dst_width) * (dst_height);
int64_t dst_uv_plane_size = (dst_width_uv) * (dst_height_uv) * 2; int64_t dst_uv_plane_size = (dst_width_uv) * (dst_height_uv)*2;
int dst_stride_y = dst_width; int dst_stride_y = dst_width;
int dst_stride_uv = dst_width_uv * 2; int dst_stride_uv = dst_width_uv * 2;
@ -546,17 +546,17 @@ static int NV12TestFilter(int src_width,
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization. MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
double c_time = get_time(); double c_time = get_time();
NV12Scale(src_y, src_stride_y, src_uv, src_stride_uv, NV12Scale(src_y, src_stride_y, src_uv, src_stride_uv, src_width, src_height,
src_width, src_height, dst_y_c, dst_stride_y, dst_uv_c, dst_y_c, dst_stride_y, dst_uv_c, dst_stride_uv, dst_width,
dst_stride_uv, dst_width, dst_height, f); dst_height, f);
c_time = (get_time() - c_time); c_time = (get_time() - c_time);
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization. MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
double opt_time = get_time(); double opt_time = get_time();
for (i = 0; i < benchmark_iterations; ++i) { for (i = 0; i < benchmark_iterations; ++i) {
NV12Scale(src_y, src_stride_y, src_uv, src_stride_uv, NV12Scale(src_y, src_stride_y, src_uv, src_stride_uv, src_width, src_height,
src_width, src_height, dst_y_opt, dst_stride_y, dst_uv_opt, dst_y_opt, dst_stride_y, dst_uv_opt, dst_stride_uv, dst_width,
dst_stride_uv, dst_width, dst_height, f); dst_height, f);
} }
opt_time = (get_time() - opt_time) / benchmark_iterations; opt_time = (get_time() - opt_time) / benchmark_iterations;
// Report performance of C vs OPT. // Report performance of C vs OPT.