mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
update libyuv to hash 5a699df5 from https://chromium.googlesource.com/libyuv/libyuv/
This commit is contained in:
committed by
Andrey Volk
parent
a714dacd7f
commit
5a924d5ef3
@@ -10,17 +10,20 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../unit_test/unit_test.h"
|
||||
#include "libyuv/cpu_id.h"
|
||||
#include "libyuv/rotate.h"
|
||||
#include "../unit_test/unit_test.h"
|
||||
|
||||
namespace libyuv {
|
||||
|
||||
static void I420TestRotate(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
static void I420TestRotate(int src_width,
|
||||
int src_height,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
libyuv::RotationMode mode,
|
||||
int benchmark_iterations,
|
||||
int disable_cpu_flags, int benchmark_cpu_info) {
|
||||
int disable_cpu_flags,
|
||||
int benchmark_cpu_info) {
|
||||
if (src_width < 1) {
|
||||
src_width = 1;
|
||||
}
|
||||
@@ -50,26 +53,21 @@ static void I420TestRotate(int src_width, int src_height,
|
||||
memset(dst_i420_opt, 3, dst_i420_size);
|
||||
|
||||
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
|
||||
I420Rotate(src_i420, src_width,
|
||||
src_i420 + src_i420_y_size, (src_width + 1) / 2,
|
||||
src_i420 + src_i420_y_size + src_i420_uv_size, (src_width + 1) / 2,
|
||||
dst_i420_c, dst_width,
|
||||
I420Rotate(src_i420, src_width, src_i420 + src_i420_y_size,
|
||||
(src_width + 1) / 2, src_i420 + src_i420_y_size + src_i420_uv_size,
|
||||
(src_width + 1) / 2, dst_i420_c, dst_width,
|
||||
dst_i420_c + dst_i420_y_size, (dst_width + 1) / 2,
|
||||
dst_i420_c + dst_i420_y_size + dst_i420_uv_size,
|
||||
(dst_width + 1) / 2,
|
||||
src_width, src_height, mode);
|
||||
(dst_width + 1) / 2, src_width, src_height, mode);
|
||||
|
||||
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
I420Rotate(src_i420, src_width,
|
||||
src_i420 + src_i420_y_size, (src_width + 1) / 2,
|
||||
src_i420 + src_i420_y_size + src_i420_uv_size,
|
||||
(src_width + 1) / 2,
|
||||
dst_i420_opt, dst_width,
|
||||
dst_i420_opt + dst_i420_y_size, (dst_width + 1) / 2,
|
||||
dst_i420_opt + dst_i420_y_size + dst_i420_uv_size,
|
||||
(dst_width + 1) / 2,
|
||||
src_width, src_height, mode);
|
||||
I420Rotate(
|
||||
src_i420, src_width, src_i420 + src_i420_y_size, (src_width + 1) / 2,
|
||||
src_i420 + src_i420_y_size + src_i420_uv_size, (src_width + 1) / 2,
|
||||
dst_i420_opt, dst_width, dst_i420_opt + dst_i420_y_size,
|
||||
(dst_width + 1) / 2, dst_i420_opt + dst_i420_y_size + dst_i420_uv_size,
|
||||
(dst_width + 1) / 2, src_width, src_height, mode);
|
||||
}
|
||||
|
||||
// Rotation should be exact.
|
||||
@@ -83,30 +81,26 @@ static void I420TestRotate(int src_width, int src_height,
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, I420Rotate0_Opt) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_,
|
||||
I420TestRotate(benchmark_width_, benchmark_height_, benchmark_width_,
|
||||
benchmark_height_, kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, I420Rotate90_Opt) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_,
|
||||
I420TestRotate(benchmark_width_, benchmark_height_, benchmark_height_,
|
||||
benchmark_width_, kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, I420Rotate180_Opt) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_,
|
||||
I420TestRotate(benchmark_width_, benchmark_height_, benchmark_width_,
|
||||
benchmark_height_, kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, I420Rotate270_Opt) {
|
||||
I420TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_,
|
||||
I420TestRotate(benchmark_width_, benchmark_height_, benchmark_height_,
|
||||
benchmark_width_, kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
@@ -115,37 +109,40 @@ TEST_F(LibYUVRotateTest, I420Rotate270_Opt) {
|
||||
// tested by passing an odd width command line or environment variable.
|
||||
TEST_F(LibYUVRotateTest, DISABLED_I420Rotate0_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
benchmark_width_ - 3, benchmark_height_ - 1, kRotate0,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, DISABLED_I420Rotate90_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
benchmark_height_ - 1, benchmark_width_ - 3, kRotate90,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, DISABLED_I420Rotate180_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
benchmark_width_ - 3, benchmark_height_ - 1, kRotate180,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, DISABLED_I420Rotate270_Odd) {
|
||||
I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
benchmark_height_ - 1, benchmark_width_ - 3, kRotate270,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
static void NV12TestRotate(int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
static void NV12TestRotate(int src_width,
|
||||
int src_height,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
libyuv::RotationMode mode,
|
||||
int benchmark_iterations,
|
||||
int disable_cpu_flags, int benchmark_cpu_info) {
|
||||
int disable_cpu_flags,
|
||||
int benchmark_cpu_info) {
|
||||
if (src_width < 1) {
|
||||
src_width = 1;
|
||||
}
|
||||
@@ -176,23 +173,19 @@ static void NV12TestRotate(int src_width, int src_height,
|
||||
memset(dst_i420_opt, 3, dst_i420_size);
|
||||
|
||||
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
|
||||
NV12ToI420Rotate(src_nv12, src_width,
|
||||
src_nv12 + src_nv12_y_size, (src_width + 1) & ~1,
|
||||
dst_i420_c, dst_width,
|
||||
NV12ToI420Rotate(src_nv12, src_width, src_nv12 + src_nv12_y_size,
|
||||
(src_width + 1) & ~1, dst_i420_c, dst_width,
|
||||
dst_i420_c + dst_i420_y_size, (dst_width + 1) / 2,
|
||||
dst_i420_c + dst_i420_y_size + dst_i420_uv_size,
|
||||
(dst_width + 1) / 2,
|
||||
src_width, src_height, mode);
|
||||
(dst_width + 1) / 2, src_width, src_height, mode);
|
||||
|
||||
MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization.
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
NV12ToI420Rotate(src_nv12, src_width,
|
||||
src_nv12 + src_nv12_y_size, (src_width + 1) & ~1,
|
||||
dst_i420_opt, dst_width,
|
||||
NV12ToI420Rotate(src_nv12, src_width, src_nv12 + src_nv12_y_size,
|
||||
(src_width + 1) & ~1, dst_i420_opt, dst_width,
|
||||
dst_i420_opt + dst_i420_y_size, (dst_width + 1) / 2,
|
||||
dst_i420_opt + dst_i420_y_size + dst_i420_uv_size,
|
||||
(dst_width + 1) / 2,
|
||||
src_width, src_height, mode);
|
||||
(dst_width + 1) / 2, src_width, src_height, mode);
|
||||
}
|
||||
|
||||
// Rotation should be exact.
|
||||
@@ -206,91 +199,79 @@ static void NV12TestRotate(int src_width, int src_height,
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate0_Opt) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_,
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_, benchmark_width_,
|
||||
benchmark_height_, kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate90_Opt) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_,
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_, benchmark_height_,
|
||||
benchmark_width_, kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate180_Opt) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_,
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_, benchmark_width_,
|
||||
benchmark_height_, kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate270_Opt) {
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_,
|
||||
NV12TestRotate(benchmark_width_, benchmark_height_, benchmark_height_,
|
||||
benchmark_width_, kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, DISABLED_NV12Rotate0_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
benchmark_width_ - 3, benchmark_height_ - 1, kRotate0,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, DISABLED_NV12Rotate90_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
benchmark_height_ - 1, benchmark_width_ - 3, kRotate90,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, DISABLED_NV12Rotate180_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
benchmark_width_ - 3, benchmark_height_ - 1, kRotate180,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, DISABLED_NV12Rotate270_Odd) {
|
||||
NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1,
|
||||
benchmark_height_ - 1, benchmark_width_ - 3,
|
||||
kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
benchmark_height_ - 1, benchmark_width_ - 3, kRotate270,
|
||||
benchmark_iterations_, disable_cpu_flags_,
|
||||
benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate0_Invert) {
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate0, benchmark_iterations_,
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_, benchmark_width_,
|
||||
benchmark_height_, kRotate0, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate90_Invert) {
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate90, benchmark_iterations_,
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_, benchmark_height_,
|
||||
benchmark_width_, kRotate90, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate180_Invert) {
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_,
|
||||
benchmark_width_, benchmark_height_,
|
||||
kRotate180, benchmark_iterations_,
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_, benchmark_width_,
|
||||
benchmark_height_, kRotate180, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVRotateTest, NV12Rotate270_Invert) {
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_,
|
||||
benchmark_height_, benchmark_width_,
|
||||
kRotate270, benchmark_iterations_,
|
||||
NV12TestRotate(benchmark_width_, -benchmark_height_, benchmark_height_,
|
||||
benchmark_width_, kRotate270, benchmark_iterations_,
|
||||
disable_cpu_flags_, benchmark_cpu_info_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace libyuv
|
||||
|
Reference in New Issue
Block a user