mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-08 01:36:47 +08:00
add mergeuv test
Add test for SplitUVPlane and MergeUVPlane Add public methods SplitUVPlanes and MergeUVPlanes based on the optimized assembly functions that already exists. TEST=SplitUVPlane unittest BUG=libyuv:629 R=braveyao@chromium.org Review URL: https://codereview.chromium.org/2279603002 .
This commit is contained in:
parent
c244a3e9a0
commit
dc3a1295be
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1614
|
||||
Version: 1615
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 1614
|
||||
#define LIBYUV_VERSION 1615
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -2358,4 +2358,99 @@ TEST_F(LibYUVPlanarTest, SetPlane_Opt) {
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, MergeUVPlane_Opt) {
|
||||
const int kPixels = benchmark_width_ * benchmark_height_;
|
||||
align_buffer_page_end(src_pixels, kPixels * 2);
|
||||
align_buffer_page_end(tmp_pixels_u, kPixels);
|
||||
align_buffer_page_end(tmp_pixels_v, kPixels);
|
||||
align_buffer_page_end(dst_pixels_opt, kPixels * 2);
|
||||
align_buffer_page_end(dst_pixels_c, kPixels * 2);
|
||||
|
||||
MemRandomize(src_pixels, kPixels * 2);
|
||||
MemRandomize(tmp_pixels_u, kPixels);
|
||||
MemRandomize(tmp_pixels_v, kPixels);
|
||||
MemRandomize(dst_pixels_opt, kPixels * 2);
|
||||
MemRandomize(dst_pixels_c, kPixels * 2);
|
||||
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
SplitUVPlane(src_pixels, benchmark_width_ * 2,
|
||||
tmp_pixels_u, benchmark_width_,
|
||||
tmp_pixels_v, benchmark_width_,
|
||||
benchmark_width_, benchmark_height_);
|
||||
MergeUVPlane(tmp_pixels_u, benchmark_width_,
|
||||
tmp_pixels_v, benchmark_width_,
|
||||
dst_pixels_c, benchmark_width_ * 2,
|
||||
benchmark_width_, benchmark_height_);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
SplitUVPlane(src_pixels, benchmark_width_ * 2,
|
||||
tmp_pixels_u, benchmark_width_,
|
||||
tmp_pixels_v, benchmark_width_,
|
||||
benchmark_width_, benchmark_height_);
|
||||
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
MergeUVPlane(tmp_pixels_u, benchmark_width_,
|
||||
tmp_pixels_v, benchmark_width_,
|
||||
dst_pixels_opt, benchmark_width_ * 2,
|
||||
benchmark_width_, benchmark_height_);
|
||||
}
|
||||
|
||||
for (int i = 0; i < kPixels * 2; ++i) {
|
||||
EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]);
|
||||
}
|
||||
|
||||
free_aligned_buffer_page_end(src_pixels);
|
||||
free_aligned_buffer_page_end(tmp_pixels_u);
|
||||
free_aligned_buffer_page_end(tmp_pixels_v);
|
||||
free_aligned_buffer_page_end(dst_pixels_opt);
|
||||
free_aligned_buffer_page_end(dst_pixels_c);
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, SplitUVPlane_Opt) {
|
||||
const int kPixels = benchmark_width_ * benchmark_height_;
|
||||
align_buffer_page_end(src_pixels, kPixels * 2);
|
||||
align_buffer_page_end(tmp_pixels_u, kPixels);
|
||||
align_buffer_page_end(tmp_pixels_v, kPixels);
|
||||
align_buffer_page_end(dst_pixels_opt, kPixels * 2);
|
||||
align_buffer_page_end(dst_pixels_c, kPixels * 2);
|
||||
|
||||
MemRandomize(src_pixels, kPixels * 2);
|
||||
MemRandomize(tmp_pixels_u, kPixels);
|
||||
MemRandomize(tmp_pixels_v, kPixels);
|
||||
MemRandomize(dst_pixels_opt, kPixels * 2);
|
||||
MemRandomize(dst_pixels_c, kPixels * 2);
|
||||
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
SplitUVPlane(src_pixels, benchmark_width_ * 2,
|
||||
tmp_pixels_u, benchmark_width_,
|
||||
tmp_pixels_v, benchmark_width_,
|
||||
benchmark_width_, benchmark_height_);
|
||||
MergeUVPlane(tmp_pixels_u, benchmark_width_,
|
||||
tmp_pixels_v, benchmark_width_,
|
||||
dst_pixels_c, benchmark_width_ * 2,
|
||||
benchmark_width_, benchmark_height_);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
SplitUVPlane(src_pixels, benchmark_width_ * 2,
|
||||
tmp_pixels_u, benchmark_width_,
|
||||
tmp_pixels_v, benchmark_width_,
|
||||
benchmark_width_, benchmark_height_);
|
||||
}
|
||||
MergeUVPlane(tmp_pixels_u, benchmark_width_,
|
||||
tmp_pixels_v, benchmark_width_,
|
||||
dst_pixels_opt, benchmark_width_ * 2,
|
||||
benchmark_width_, benchmark_height_);
|
||||
|
||||
for (int i = 0; i < kPixels * 2; ++i) {
|
||||
EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]);
|
||||
}
|
||||
|
||||
free_aligned_buffer_page_end(src_pixels);
|
||||
free_aligned_buffer_page_end(tmp_pixels_u);
|
||||
free_aligned_buffer_page_end(tmp_pixels_v);
|
||||
free_aligned_buffer_page_end(dst_pixels_opt);
|
||||
free_aligned_buffer_page_end(dst_pixels_c);
|
||||
}
|
||||
|
||||
} // namespace libyuv
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user