Store elapsed times in int64_t variables aom_usec_timer_elapsed() returns int64_t. If we store its return value in int64_t variables, then we don't need to add typecasts or worry about overflowing an int. Fix the Visual C++ warning test\cdef_test.cc(130): warning C4244: '+=': conversion from 'int64_t' to 'unsigned int', possible loss of data Change-Id: I684e81f6ad63f9cc5b676ce2dd72ef8071c349f7
diff --git a/test/cdef_test.cc b/test/cdef_test.cc index 1a184e9..2c29585 100644 --- a/test/cdef_test.cc +++ b/test/cdef_test.cc
@@ -61,10 +61,10 @@ typedef CDEFBlockTest CDEFSpeedTest; GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CDEFSpeedTest); -int test_cdef(int bsize, int iterations, cdef_filter_block_func cdef, - cdef_filter_block_func ref_cdef, int boundary, int depth) { +int64_t test_cdef(int bsize, int iterations, cdef_filter_block_func cdef, + cdef_filter_block_func ref_cdef, int boundary, int depth) { aom_usec_timer ref_timer; - unsigned int ref_elapsed_time = 0; + int64_t ref_elapsed_time = 0; const int size = 8; const int ysize = size + 2 * CDEF_VBORDER; ACMRandom rnd(ACMRandom::DeterministicSeed()); @@ -175,10 +175,11 @@ void test_cdef_speed(int bsize, int iterations, cdef_filter_block_func cdef, cdef_filter_block_func ref_cdef, int boundary, int depth) { - int ref_elapsed_time = + int64_t ref_elapsed_time = test_cdef(bsize, iterations, ref_cdef, ref_cdef, boundary, depth); - int elapsed_time = test_cdef(bsize, iterations, cdef, cdef, boundary, depth); + int64_t elapsed_time = + test_cdef(bsize, iterations, cdef, cdef, boundary, depth); std::cout << "C time: " << ref_elapsed_time << " us" << std::endl << "SIMD time: " << elapsed_time << " us" << std::endl; @@ -265,12 +266,12 @@ aom_usec_timer_start(&ref_timer); test_finddir(ref_finddir, ref_finddir); aom_usec_timer_mark(&ref_timer); - int ref_elapsed_time = (int)aom_usec_timer_elapsed(&ref_timer); + int64_t ref_elapsed_time = aom_usec_timer_elapsed(&ref_timer); aom_usec_timer_start(&timer); test_finddir(finddir, finddir); aom_usec_timer_mark(&timer); - int elapsed_time = (int)aom_usec_timer_elapsed(&timer); + int64_t elapsed_time = aom_usec_timer_elapsed(&timer); EXPECT_GT(ref_elapsed_time, elapsed_time) << "Error: CDEFFindDirSpeedTest, SIMD slower than C." << std::endl