Skip to content

Commit 7bceef7

Browse files
committed
test: fix mulSpectrums error tolerance
1 parent 26fbaad commit 7bceef7

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

modules/core/test/test_dxt.cpp

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -787,41 +787,27 @@ class CxCore_MulSpectrumsTest : public CxCore_DXTBaseTest
787787
protected:
788788
void run_func();
789789
void prepare_to_validation( int test_case_idx );
790-
#if defined(__aarch64__) && defined(NDEBUG)
791790
double get_success_error_level( int test_case_idx, int i, int j );
792-
#endif
793791
};
794792

795793

796794
CxCore_MulSpectrumsTest::CxCore_MulSpectrumsTest() : CxCore_DXTBaseTest( true, true, true )
797795
{
798796
}
799797

800-
#if defined(__aarch64__) && defined(NDEBUG)
801798
double CxCore_MulSpectrumsTest::get_success_error_level( int test_case_idx, int i, int j )
802799
{
800+
(void)test_case_idx;
801+
CV_Assert(i == OUTPUT);
802+
CV_Assert(j == 0);
803803
int elem_depth = CV_MAT_DEPTH(cvGetElemType(test_array[i][j]));
804-
if( elem_depth <= CV_32F )
805-
{
806-
return ArrayTest::get_success_error_level( test_case_idx, i, j );
807-
}
808-
switch( test_case_idx )
809-
{
810-
// Usual threshold is too strict for these test cases due to the difference of fmsub and fsub
811-
case 399:
812-
case 420:
813-
return DBL_EPSILON * 20000;
814-
case 65:
815-
case 161:
816-
case 287:
817-
case 351:
818-
case 458:
819-
return DBL_EPSILON * 10000;
820-
default:
821-
return ArrayTest::get_success_error_level( test_case_idx, i, j );
822-
}
804+
CV_Assert(elem_depth == CV_32F || elem_depth == CV_64F);
805+
806+
element_wise_relative_error = false;
807+
double maxInputValue = 1000; // ArrayTest::get_minmax_bounds
808+
double err = 8 * maxInputValue; // result = A*B + C*D
809+
return (elem_depth == CV_32F ? FLT_EPSILON : DBL_EPSILON) * err;
823810
}
824-
#endif
825811

826812
void CxCore_MulSpectrumsTest::run_func()
827813
{

0 commit comments

Comments
 (0)