diff --git a/modules/core/perf/perf_addWeighted.cpp b/modules/core/perf/perf_addWeighted.cpp index 2822bc61e7..7328e4d632 100644 --- a/modules/core/perf/perf_addWeighted.cpp +++ b/modules/core/perf/perf_addWeighted.cpp @@ -4,7 +4,7 @@ namespace opencv_test { using namespace perf; -#define TYPICAL_MAT_TYPES_ADWEIGHTED CV_8UC1, CV_8UC4, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1 +#define TYPICAL_MAT_TYPES_ADWEIGHTED CV_8UC1, CV_8UC4, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1, CV_32FC1 #define TYPICAL_MATS_ADWEIGHTED testing::Combine(testing::Values(szVGA, sz720p, sz1080p), testing::Values(TYPICAL_MAT_TYPES_ADWEIGHTED)) PERF_TEST_P(Size_MatType, addWeighted, TYPICAL_MATS_ADWEIGHTED) @@ -31,7 +31,10 @@ PERF_TEST_P(Size_MatType, addWeighted, TYPICAL_MATS_ADWEIGHTED) TEST_CYCLE() cv::addWeighted( src1, alpha, src2, beta, gamma, dst, dst.type() ); - SANITY_CHECK(dst, depth == CV_32S ? 4 : 1); + if (depth == CV_32F) + SANITY_CHECK(dst, 1e-4, ERROR_RELATIVE); + else + SANITY_CHECK(dst, depth == CV_32S ? 4 : 1); } } // namespace diff --git a/modules/core/src/arithm.simd.hpp b/modules/core/src/arithm.simd.hpp index 00e3fe21a4..97cc98ce4d 100644 --- a/modules/core/src/arithm.simd.hpp +++ b/modules/core/src/arithm.simd.hpp @@ -1566,7 +1566,7 @@ void mul_loop_d(const double* src1, size_t step1, const doubl DEFINE_SIMD_FUN(fun, _T1, v_float64, _OP) DEFINE_SIMD_SAT(mul, mul_loop) -DEFINE_SIMD_F32(mul, mul_loop_d) +DEFINE_SIMD_F32(mul, mul_loop) DEFINE_SIMD_S32(mul, mul_loop_d) DEFINE_SIMD_F64(mul, mul_loop_d) @@ -1834,7 +1834,7 @@ void add_weighted_loop_d(const double* src1, size_t step1, co DEFINE_SIMD_SAT(addWeighted, add_weighted_loop) DEFINE_SIMD_S32(addWeighted, add_weighted_loop_d) -DEFINE_SIMD_F32(addWeighted, add_weighted_loop_d) +DEFINE_SIMD_F32(addWeighted, add_weighted_loop) DEFINE_SIMD_F64(addWeighted, add_weighted_loop_d) //======================================= diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index 76c0c74dd3..e79e879e77 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -185,6 +185,10 @@ struct AddWeightedOp : public BaseAddOp int dtype = (flags & MIXED_TYPE) ? dst.type() : -1; cv::addWeighted(src[0], alpha, src[1], beta, gamma[0], dst, dtype); } + double getMaxErr(int depth) + { + return depth < CV_32F ? 1 : depth == CV_32F ? 1e-4 : 1e-12; + } }; struct MulOp : public BaseElemWiseOp