Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1209)

Unified Diff: unit_test/planar_test.cc

Issue 2424233004: Half float neon port, enable O2 for neon, and denormal test. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unit_test/planar_test.cc
diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc
index 722074f73c73e0e661b298637a15d7440fe73875..e4f1dc6cb2cf60430471a578a130815c528c06ca 100644
--- a/unit_test/planar_test.cc
+++ b/unit_test/planar_test.cc
@@ -2121,6 +2121,49 @@ TEST_F(LibYUVPlanarTest, TestHalfFloatPlane) {
free_aligned_buffer_page_end(dst_opt);
}
+// 5 bit exponent with bias of 15 will underflow to a denormal if scale causes
+// exponent to be less than 0. 15 - log2(65536) = -1/ This shouldnt normally
+// happen sicne scale is 1/(1<<bits) where bits is 9, 10 or 12.
hubbe 2016/10/18 22:40:42 s/sicne/since/ Also, some people at intel are wor
+TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_denormal) {
+ int i, j;
+ const int y_plane_size = benchmark_width_ * benchmark_height_ * 2;
+
+ align_buffer_page_end(orig_y, y_plane_size);
+ align_buffer_page_end(dst_c, y_plane_size);
+ align_buffer_page_end(dst_opt, y_plane_size);
+ MemRandomize(orig_y, y_plane_size);
+ memset(dst_c, 0, y_plane_size);
+ memset(dst_opt, 1, y_plane_size);
+
+ // Disable all optimizations.
+ MaskCpuFlags(disable_cpu_flags_);
+ double c_time = get_time();
+ for (j = 0; j < benchmark_iterations_; j++) {
+ HalfFloatPlane((uint16*)orig_y, benchmark_width_ * 2,
+ (uint16*)dst_c, benchmark_width_ * 2,
+ 1.0f / 65536.0f, benchmark_width_, benchmark_height_);
+ }
+ c_time = (get_time() - c_time) / benchmark_iterations_;
+
+ // Enable optimizations.
+ MaskCpuFlags(benchmark_cpu_info_);
+ double opt_time = get_time();
+ for (j = 0; j < benchmark_iterations_; j++) {
+ HalfFloatPlane((uint16*)orig_y, benchmark_width_ * 2,
+ (uint16*)dst_opt, benchmark_width_ * 2,
+ 1.0f / 65536.0f, benchmark_width_, benchmark_height_);
+ }
+ opt_time = (get_time() - opt_time) / benchmark_iterations_;
+
+ for (i = 0; i < y_plane_size; ++i) {
+ EXPECT_EQ(dst_c[i], dst_opt[i]);
+ }
+
+ free_aligned_buffer_page_end(orig_y);
+ free_aligned_buffer_page_end(dst_c);
+ free_aligned_buffer_page_end(dst_opt);
+}
+
TEST_F(LibYUVPlanarTest, TestARGBLumaColorTable) {
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698