Skip to content

Commit f4c2e4f

Browse files
authored
Merge pull request opencv#26061 from penghuiho:fix-pow-bug
Fixed the simd bugs of iPow8u and iPow16u opencv#26061 Add the following cases in opencv_perf_core: * OCL_PowFixture_iPow.iPow/0, where GetParam() = (640x480, 8UC1) * OCL_PowFixture_iPow.iPow/2, where GetParam() = (640x480, 16UC1) iPow8u and iPow16u failed to call to simd accelerating while executing. Fix the bug by changing the input type of iPow_SIMD function. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
1 parent e5b871f commit f4c2e4f

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

modules/core/perf/opencl/perf_arithm.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,24 @@ OCL_PERF_TEST_P(PowFixture, Pow, ::testing::Combine(
688688
SANITY_CHECK(dst, 1.5e-6, ERROR_RELATIVE);
689689
}
690690

691+
///////////// iPow ////////////////////////
692+
OCL_PERF_TEST_P(PowFixture, iPow, ::testing::Combine(
693+
OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8UC1, CV_8SC1,CV_16UC1,CV_16SC1,CV_32SC1)))
694+
{
695+
const Size_MatType_t params = GetParam();
696+
const Size srcSize = get<0>(params);
697+
const int type = get<1>(params);
698+
699+
checkDeviceMaxMemoryAllocSize(srcSize, type);
700+
701+
UMat src(srcSize, type), dst(srcSize, type);
702+
randu(src, 0, 100);
703+
declare.in(src).out(dst);
704+
705+
OCL_TEST_CYCLE() cv::pow(src, 7.0, dst);
706+
707+
SANITY_CHECK_NOTHING();
708+
}
691709
///////////// AddWeighted////////////////////////
692710

693711
typedef Size_MatType AddWeightedFixture;

modules/core/src/mathfuncs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ struct iPow_SIMD
791791
#if (CV_SIMD || CV_SIMD_SCALABLE)
792792

793793
template <>
794-
struct iPow_SIMD<uchar, int>
794+
struct iPow_SIMD<uchar, unsigned>
795795
{
796796
int operator() ( const uchar * src, uchar * dst, int len, int power )
797797
{
@@ -871,7 +871,7 @@ struct iPow_SIMD<schar, int>
871871
};
872872

873873
template <>
874-
struct iPow_SIMD<ushort, int>
874+
struct iPow_SIMD<ushort, unsigned>
875875
{
876876
int operator() ( const ushort * src, ushort * dst, int len, int power)
877877
{

0 commit comments

Comments
 (0)