diff options
author | Frank Barchard <fbarchard@google.com> | 2019-07-02 12:46:12 -0700 |
---|---|---|
committer | Frank Barchard <fbarchard@chromium.org> | 2019-07-02 20:00:30 +0000 |
commit | f9aacffa029ff3a32f0408f78e2588663271f1b1 (patch) | |
tree | 05d8f397a858aeca5d5f6a72ef3141f27d137971 /unit_test/planar_test.cc | |
parent | c6dcbdfaac8f416bb4febea0727e731cc87f3a6f (diff) | |
download | libyuv-f9aacffa029ff3a32f0408f78e2588663271f1b1.tar.gz |
Fix arm unittest failure by removing unused FloatDivToByteRow.
Apply clang-format to fix jpeg if() for lint fix.
Change comments about 4th pixel for open source compliance.
Rename UVToVU to SwapUV for consistency with MergeUV.
BUG=b/135532289, b/136515133
Change-Id: I9ce377c57b1d4d8f8b373c4cb44cd3f836300f79
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/1685936
Reviewed-by: Chong Zhang <chz@google.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'unit_test/planar_test.cc')
-rw-r--r-- | unit_test/planar_test.cc | 85 |
1 files changed, 2 insertions, 83 deletions
diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc index 70f8966e..22e48abb 100644 --- a/unit_test/planar_test.cc +++ b/unit_test/planar_test.cc @@ -3269,88 +3269,7 @@ TEST_F(LibYUVPlanarTest, TestGaussCol_Opt) { EXPECT_EQ(dst_pixels_c[639], static_cast<uint32_t>(30704)); } -float TestFloatDivToByte(int benchmark_width, - int benchmark_height, - int benchmark_iterations, - float scale, - bool opt) { - int i, j; - // NEON does multiple of 8, so round count up - const int kPixels = (benchmark_width * benchmark_height + 7) & ~7; - align_buffer_page_end(src_weights, kPixels * 4); - align_buffer_page_end(src_values, kPixels * 4); - align_buffer_page_end(dst_out_c, kPixels); - align_buffer_page_end(dst_out_opt, kPixels); - align_buffer_page_end(dst_mask_c, kPixels); - align_buffer_page_end(dst_mask_opt, kPixels); - - // Randomize works but may contain some denormals affecting performance. - // MemRandomize(orig_y, kPixels * 4); - // large values are problematic. audio is really -1 to 1. - for (i = 0; i < kPixels; ++i) { - (reinterpret_cast<float*>(src_weights))[i] = scale; - (reinterpret_cast<float*>(src_values))[i] = - sinf(static_cast<float>(i) * 0.1f); - } - memset(dst_out_c, 0, kPixels); - memset(dst_out_opt, 1, kPixels); - memset(dst_mask_c, 2, kPixels); - memset(dst_mask_opt, 3, kPixels); - - FloatDivToByteRow_C(reinterpret_cast<float*>(src_weights), - reinterpret_cast<float*>(src_values), dst_out_c, - dst_mask_c, kPixels); - - for (j = 0; j < benchmark_iterations; j++) { - if (opt) { -#ifdef HAS_FLOATDIVTOBYTEROW_NEON - FloatDivToByteRow_NEON(reinterpret_cast<float*>(src_weights), - reinterpret_cast<float*>(src_values), dst_out_opt, - dst_mask_opt, kPixels); -#else - FloatDivToByteRow_C(reinterpret_cast<float*>(src_weights), - reinterpret_cast<float*>(src_values), dst_out_opt, - dst_mask_opt, kPixels); -#endif - } else { - FloatDivToByteRow_C(reinterpret_cast<float*>(src_weights), - reinterpret_cast<float*>(src_values), dst_out_opt, - dst_mask_opt, kPixels); - } - } - - uint8_t max_diff = 0; - for (i = 0; i < kPixels; ++i) { - uint8_t abs_diff = abs(dst_out_c[i] - dst_out_opt[i]) + - abs(dst_mask_c[i] - dst_mask_opt[i]); - if (abs_diff > max_diff) { - max_diff = abs_diff; - } - } - - free_aligned_buffer_page_end(src_weights); - free_aligned_buffer_page_end(src_values); - free_aligned_buffer_page_end(dst_out_c); - free_aligned_buffer_page_end(dst_out_opt); - free_aligned_buffer_page_end(dst_mask_c); - free_aligned_buffer_page_end(dst_mask_opt); - - return max_diff; -} - -TEST_F(LibYUVPlanarTest, TestFloatDivToByte_C) { - float diff = TestFloatDivToByte(benchmark_width_, benchmark_height_, - benchmark_iterations_, 1.2f, false); - EXPECT_EQ(0, diff); -} - -TEST_F(LibYUVPlanarTest, TestFloatDivToByte_Opt) { - float diff = TestFloatDivToByte(benchmark_width_, benchmark_height_, - benchmark_iterations_, 1.2f, true); - EXPECT_EQ(0, diff); -} - -TEST_F(LibYUVPlanarTest, UVToVURow) { +TEST_F(LibYUVPlanarTest, SwapUVRow) { const int kPixels = benchmark_width_ * benchmark_height_; align_buffer_page_end(src_pixels_vu, kPixels * 2); align_buffer_page_end(dst_pixels_uv, kPixels * 2); @@ -3358,7 +3277,7 @@ TEST_F(LibYUVPlanarTest, UVToVURow) { MemRandomize(src_pixels_vu, kPixels * 2); memset(dst_pixels_uv, 1, kPixels * 2); - UVToVURow_C(src_pixels_vu, dst_pixels_uv, kPixels); + SwapUVRow_C(src_pixels_vu, dst_pixels_uv, kPixels); for (int i = 0; i < kPixels; ++i) { EXPECT_EQ(dst_pixels_uv[i * 2 + 0], src_pixels_vu[i * 2 + 1]); |