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

Unified Diff: unit_test/planar_test.cc

Issue 2478313004: HalfFloat neon armv7 fix for destination pointer. (Closed)
Patch Set: fix vmovl.u16 to expand shorts to ints Created 4 years, 1 month 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 | « source/row_neon.cc ('k') | 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 c017c26a3b3fea8745abae7e9eed91973a853016..be35b12b8c188ab6d3b3cabb1b947060d1c78c26 100644
--- a/unit_test/planar_test.cc
+++ b/unit_test/planar_test.cc
@@ -2130,15 +2130,48 @@ int TestHalfFloatPlane(int benchmark_width, int benchmark_height,
return diff;
}
+#if defined(__arm__)
+static void EnableFlushDenormalToZero(void) {
+ uint32_t cw;
+ __asm__ __volatile__ (
+ "vmrs %0, fpscr \n"
+ "orr %0, %0, #0x1000000 \n"
+ "vmsr fpscr, %0 \n"
+ : "=r"(cw) :: "memory");
+}
+#endif
+
// 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 since scale is 1/(1<<bits) where bits is 9, 10 or 12.
-#define MAXHALFDIFF 0
+
+#define MAXHALFDENORMALDIFF 0
TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_16bit_denormal) {
+// 32 bit arm rounding on denormal is case is off by 1 compared to C.
wangcheng 2016/11/05 00:25:02 remove "is" in the comment
fbarchard1 2016/11/07 17:43:51 Done.
+#if defined(__arm__)
+ EnableFlushDenormalToZero();
+#endif
int diff = TestHalfFloatPlane(benchmark_width_, benchmark_height_,
benchmark_iterations_,
disable_cpu_flags_, benchmark_cpu_info_,
1.0f / 65536.0f, 65535);
+ EXPECT_LE(diff, MAXHALFDENORMALDIFF);
+}
+
+#define MAXHALFDIFF 0
+TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_16bit_One) {
+ int diff = TestHalfFloatPlane(benchmark_width_, benchmark_height_,
+ benchmark_iterations_,
+ disable_cpu_flags_, benchmark_cpu_info_,
+ 1.0f, 65535);
+ EXPECT_LE(diff, MAXHALFDIFF);
+}
+
+TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_16bit_Opt) {
+ int diff = TestHalfFloatPlane(benchmark_width_, benchmark_height_,
+ benchmark_iterations_,
+ disable_cpu_flags_, benchmark_cpu_info_,
+ 1.0f / 4096.0f, 65535);
EXPECT_LE(diff, MAXHALFDIFF);
}
« no previous file with comments | « source/row_neon.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698