core:add OPENCV_IPP_MEAN/MINMAX/SUM option to enable IPP optimizations#24179
core:add OPENCV_IPP_MEAN/MINMAX/SUM option to enable IPP optimizations#24179opencv-alalek merged 5 commits intoopencv:4.xfrom
Conversation
opencv-alalek
left a comment
There was a problem hiding this comment.
Thank you for contribution!
BTW, It make sense to think about something like OPENCV_IPP_ENABLE_ALL in the future.
modules/core/CMakeLists.txt
Outdated
| endif() | ||
|
|
||
| # https://github.com/opencv/opencv/issues/24145 | ||
| ocv_check_environment_variables(OPENCV_IPP_MEAN) |
There was a problem hiding this comment.
Lets guard this block by if(HAVE_IPP)
There was a problem hiding this comment.
I agree with you, thank you!
And I tried with raspi(arm32, not intel), OPENCV_IPP_GAUSSIAN_BLUR is shown in cmake gui. So I added fot it also.
modules/core/CMakeLists.txt
Outdated
| ocv_check_environment_variables(OPENCV_IPP_MEAN) | ||
| option(OPENCV_IPP_MEAN "Enable IPP optimizations for mean (+200Kb in binary size)" OFF) | ||
| if(OPENCV_IPP_MEAN) | ||
| add_definitions(-DOPENCV_IPP_MEAN=1) |
There was a problem hiding this comment.
It is better to apply definition to the specific file:
ocv_append_source_file_compile_definitions(${CMAKE_CURRENT_SOURCE_DIR}/src/mean.dispatch.cpp "OPENCV_IPP_MEAN=1")
There was a problem hiding this comment.
Thank you for yor review, this is more better fix. I fix with it.
|
Hello, thank you for your review.
In cmake, it seems to be a complicated to link multiple options. To simplify selecting to optimization with ipp, there are 3 ideas.
In particular, in an environment where IPP can be used, even if the library size increases by several MiB, there may be almost no effect on operation. In this case, Idea C is better than other idea. |
|
I mean something like this: https://github.com/opencv/opencv/blob/4.8.0/CMakeLists.txt#L218-L225 Idea is using |
|
I was over-considered the problem.It is clearly, Thank you very much! I'll try it tomorrow. |
modules/core/CMakeLists.txt
Outdated
|
|
||
| # https://github.com/opencv/opencv/issues/24145 | ||
| if(HAVE_IPP) | ||
| OCV_OPTION(OPENCV_IPP_ENABLE_ALL "Force to enable all ipp optimization" OFF) |
There was a problem hiding this comment.
ipp => IPP
all => available ?
some implementations are still disabled due to accuracy or performance issues
There was a problem hiding this comment.
Thank you for your comment!
I would like to make fix based on the Description of OPENCV_FORCE_3RDPARTY_BUILD.
OCV_OPTION(OPENCV_IPP_ENABLE_ALL "Enable all OPENCV_IPP_ options at once" OFF)
https://docs.opencv.org/4.x/db/d05/tutorial_config_reference.html
* core:add OPENCV_IPP_MEAN/MINMAX/SUM option to enable IPP optimizations * fix: to use guard HAVE_IPP and ocv_append_source_file_compile_definitions() macro. * support OPENCV_IPP_ENABLE_ALL * add document for OPENCV_IPP_ENABLE_ALL * fix OPENCV_IPP_ENABLE_ALL comment
* core:add OPENCV_IPP_MEAN/MINMAX/SUM option to enable IPP optimizations * fix: to use guard HAVE_IPP and ocv_append_source_file_compile_definitions() macro. * support OPENCV_IPP_ENABLE_ALL * add document for OPENCV_IPP_ENABLE_ALL * fix OPENCV_IPP_ENABLE_ALL comment
fix #24145
fix #24146
relates #13085
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.