diff options
Diffstat (limited to 'files/unit_test/rotate_argb_test.cc')
-rw-r--r-- | files/unit_test/rotate_argb_test.cc | 116 |
1 files changed, 53 insertions, 63 deletions
diff --git a/files/unit_test/rotate_argb_test.cc b/files/unit_test/rotate_argb_test.cc index 9c83c356..d2003895 100644 --- a/files/unit_test/rotate_argb_test.cc +++ b/files/unit_test/rotate_argb_test.cc @@ -10,14 +10,16 @@ #include <stdlib.h> +#include "../unit_test/unit_test.h" #include "libyuv/cpu_id.h" #include "libyuv/rotate_argb.h" -#include "../unit_test/unit_test.h" namespace libyuv { -void TestRotateBpp(int src_width, int src_height, - int dst_width, int dst_height, +void TestRotateBpp(int src_width, + int src_height, + int dst_width, + int dst_height, libyuv::RotationMode mode, int benchmark_iterations, int disable_cpu_flags, @@ -51,26 +53,22 @@ void TestRotateBpp(int src_width, int src_height, if (kBpp == 1) { MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization. - RotatePlane(src_argb, src_stride_argb, - dst_argb_c, dst_stride_argb, + RotatePlane(src_argb, src_stride_argb, dst_argb_c, dst_stride_argb, src_width, src_height, mode); MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization. for (int i = 0; i < benchmark_iterations; ++i) { - RotatePlane(src_argb, src_stride_argb, - dst_argb_opt, dst_stride_argb, + RotatePlane(src_argb, src_stride_argb, dst_argb_opt, dst_stride_argb, src_width, src_height, mode); } } else if (kBpp == 4) { MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization. - ARGBRotate(src_argb, src_stride_argb, - dst_argb_c, dst_stride_argb, + ARGBRotate(src_argb, src_stride_argb, dst_argb_c, dst_stride_argb, src_width, src_height, mode); MaskCpuFlags(benchmark_cpu_info); // Enable all CPU optimization. for (int i = 0; i < benchmark_iterations; ++i) { - ARGBRotate(src_argb, src_stride_argb, - dst_argb_opt, dst_stride_argb, + ARGBRotate(src_argb, src_stride_argb, dst_argb_opt, dst_stride_argb, src_width, src_height, mode); } } @@ -85,112 +83,104 @@ void TestRotateBpp(int src_width, int src_height, free_aligned_buffer_page_end(src_argb); } -static void ARGBTestRotate(int src_width, int src_height, - int dst_width, int dst_height, +static void ARGBTestRotate(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) { - TestRotateBpp(src_width, src_height, - dst_width, dst_height, - mode, benchmark_iterations, - disable_cpu_flags, benchmark_cpu_info, 4); + TestRotateBpp(src_width, src_height, dst_width, dst_height, mode, + benchmark_iterations, disable_cpu_flags, benchmark_cpu_info, 4); } TEST_F(LibYUVRotateTest, ARGBRotate0_Opt) { - ARGBTestRotate(benchmark_width_, benchmark_height_, - benchmark_width_, benchmark_height_, - kRotate0, benchmark_iterations_, + ARGBTestRotate(benchmark_width_, benchmark_height_, benchmark_width_, + benchmark_height_, kRotate0, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); } TEST_F(LibYUVRotateTest, ARGBRotate90_Opt) { - ARGBTestRotate(benchmark_width_, benchmark_height_, - benchmark_height_, benchmark_width_, - kRotate90, benchmark_iterations_, + ARGBTestRotate(benchmark_width_, benchmark_height_, benchmark_height_, + benchmark_width_, kRotate90, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); } TEST_F(LibYUVRotateTest, ARGBRotate180_Opt) { - ARGBTestRotate(benchmark_width_, benchmark_height_, - benchmark_width_, benchmark_height_, - kRotate180, benchmark_iterations_, + ARGBTestRotate(benchmark_width_, benchmark_height_, benchmark_width_, + benchmark_height_, kRotate180, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); } TEST_F(LibYUVRotateTest, ARGBRotate270_Opt) { - ARGBTestRotate(benchmark_width_, benchmark_height_, - benchmark_height_, benchmark_width_, - kRotate270, benchmark_iterations_, + ARGBTestRotate(benchmark_width_, benchmark_height_, benchmark_height_, + benchmark_width_, kRotate270, benchmark_iterations_, disable_cpu_flags_, benchmark_cpu_info_); } -static void TestRotatePlane(int src_width, int src_height, - int dst_width, int dst_height, +static void TestRotatePlane(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) { - TestRotateBpp(src_width, src_height, - dst_width, dst_height, - mode, benchmark_iterations, - disable_cpu_flags, benchmark_cpu_info, 1); + TestRotateBpp(src_width, src_height, dst_width, dst_height, mode, + benchmark_iterations, disable_cpu_flags, benchmark_cpu_info, 1); } TEST_F(LibYUVRotateTest, RotatePlane0_Opt) { - TestRotatePlane(benchmark_width_, benchmark_height_, - benchmark_width_, benchmark_height_, - kRotate0, benchmark_iterations_, - disable_cpu_flags_, benchmark_cpu_info_); + TestRotatePlane(benchmark_width_, benchmark_height_, benchmark_width_, + benchmark_height_, kRotate0, benchmark_iterations_, + disable_cpu_flags_, benchmark_cpu_info_); } TEST_F(LibYUVRotateTest, RotatePlane90_Opt) { - TestRotatePlane(benchmark_width_, benchmark_height_, - benchmark_height_, benchmark_width_, - kRotate90, benchmark_iterations_, - disable_cpu_flags_, benchmark_cpu_info_); + TestRotatePlane(benchmark_width_, benchmark_height_, benchmark_height_, + benchmark_width_, kRotate90, benchmark_iterations_, + disable_cpu_flags_, benchmark_cpu_info_); } TEST_F(LibYUVRotateTest, RotatePlane180_Opt) { - TestRotatePlane(benchmark_width_, benchmark_height_, - benchmark_width_, benchmark_height_, - kRotate180, benchmark_iterations_, - disable_cpu_flags_, benchmark_cpu_info_); + TestRotatePlane(benchmark_width_, benchmark_height_, benchmark_width_, + benchmark_height_, kRotate180, benchmark_iterations_, + disable_cpu_flags_, benchmark_cpu_info_); } TEST_F(LibYUVRotateTest, RotatePlane270_Opt) { - TestRotatePlane(benchmark_width_, benchmark_height_, - benchmark_height_, benchmark_width_, - kRotate270, benchmark_iterations_, - disable_cpu_flags_, benchmark_cpu_info_); + TestRotatePlane(benchmark_width_, benchmark_height_, benchmark_height_, + benchmark_width_, kRotate270, benchmark_iterations_, + disable_cpu_flags_, benchmark_cpu_info_); } TEST_F(LibYUVRotateTest, DISABLED_RotatePlane0_Odd) { TestRotatePlane(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_RotatePlane90_Odd) { TestRotatePlane(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_RotatePlane180_Odd) { TestRotatePlane(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_RotatePlane270_Odd) { TestRotatePlane(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_); } } // namespace libyuv |