diff --git a/modules/core/perf/perf_arithm.cpp b/modules/core/perf/perf_arithm.cpp index 6cc25a3476..b9decbfd4e 100644 --- a/modules/core/perf/perf_arithm.cpp +++ b/modules/core/perf/perf_arithm.cpp @@ -706,22 +706,27 @@ INSTANTIATE_TEST_CASE_P(/*nothing*/ , ArithmMixedTest, ) ); -typedef Size_MatType InvSqrtFixture; -PERF_TEST_P(InvSqrtFixture, InvSqrt, testing::Combine( - testing::Values(TYPICAL_MAT_SIZES), - testing::Values(CV_32FC1, CV_64FC1))) -{ +typedef perf::TestBaseWithParam> SqrtFixture; +PERF_TEST_P_(SqrtFixture, Sqrt) { Size sz = get<0>(GetParam()); int type = get<1>(GetParam()); + bool inverse = get<2>(GetParam()); Mat src(sz, type), dst(sz, type); randu(src, FLT_EPSILON, 1000); declare.in(src).out(dst); - TEST_CYCLE() cv::pow(src, -0.5, dst); + TEST_CYCLE() cv::pow(src, inverse ? -0.5 : 0.5, dst); SANITY_CHECK_NOTHING(); } +INSTANTIATE_TEST_CASE_P(/*nothing*/ , SqrtFixture, + testing::Combine( + testing::Values(TYPICAL_MAT_SIZES), + testing::Values(CV_32FC1, CV_64FC1), + testing::Bool() + ) +); ///////////// Rotate //////////////////////// @@ -815,4 +820,29 @@ INSTANTIATE_TEST_CASE_P(/*nothing*/ , PatchNaNsFixture, ) ); +//////////////EXP//////////// + +typedef Size_MatType ExpFixture; + +PERF_TEST_P(ExpFixture, Exp, + testing::Combine(testing::Values(TYPICAL_MAT_SIZES), testing::Values(CV_32F, CV_64F))) +{ + cv::Size size = std::get<0>(GetParam()); + int type = std::get<1>(GetParam()); + + cv::Mat src(size, type); + cv::Mat dst(size, type); + + declare.in(src).out(dst); + + cv::randu(src, -5.0, 5.0); + + TEST_CYCLE() + { + cv::exp(src, dst); + } + + SANITY_CHECK_NOTHING(); +} + } // namespace diff --git a/modules/core/src/mathfuncs_core.simd.hpp b/modules/core/src/mathfuncs_core.simd.hpp index 3fa3cba1b8..f92234f140 100644 --- a/modules/core/src/mathfuncs_core.simd.hpp +++ b/modules/core/src/mathfuncs_core.simd.hpp @@ -396,7 +396,7 @@ void sqrt32f(const float* src, float* dst, int len) int i = 0; -#if CV_SIMD +#if (CV_SIMD || CV_SIMD_SCALABLE) const int VECSZ = VTraits::vlanes(); for( ; i < len; i += VECSZ*2 ) { @@ -425,7 +425,7 @@ void sqrt64f(const double* src, double* dst, int len) int i = 0; -#if CV_SIMD_64F +#if (CV_SIMD_64F || CV_SIMD_SCALABLE_64F) const int VECSZ = VTraits::vlanes(); for( ; i < len; i += VECSZ*2 ) { @@ -527,7 +527,7 @@ void exp32f( const float *_x, float *y, int n ) float maxval = (float)(exp_max_val/exp_prescale); float postscale = (float)exp_postscale; -#if CV_SIMD +#if (CV_SIMD || CV_SIMD_SCALABLE) const int VECSZ = VTraits::vlanes(); const v_float32 vprescale = vx_setall_f32((float)exp_prescale); const v_float32 vpostscale = vx_setall_f32((float)exp_postscale); @@ -641,7 +641,7 @@ void exp64f( const double *_x, double *y, int n ) double minval = (-exp_max_val/exp_prescale); double maxval = (exp_max_val/exp_prescale); -#if CV_SIMD_64F +#if (CV_SIMD_64F || CV_SIMD_SCALABLE_64F) const int VECSZ = VTraits::vlanes(); const v_float64 vprescale = vx_setall_f64(exp_prescale); const v_float64 vpostscale = vx_setall_f64(exp_postscale);