mirror of
https://github.com/opencv/opencv.git
synced 2026-09-11 04:43:22 -05:00
e24dc1ff4c4fbb5fac70dbd8f58e61492125aff7
The generated cv_cpu_helper.h sets CV_TRY_<OPT> to 1 both when <OPT> is a dispatch target and when it is part of the baseline, but an opt_<OPT> namespace is only emitted for the dispatch case: __ocv_add_dispatched_file() guards it with CPU_DISPATCH_FINAL, and a baseline optimization is deliberately kept out of that list. Code that hand-rolls "#if CV_TRY_<OPT> ... opt_<OPT>::fn" therefore fails to compile as soon as the optimization lands in the baseline, e.g. with -DCPU_BASELINE=AVX512_ICL or -march=native on an ICL capable CPU: lut.dispatch.cpp:22:16: error: 'opt_AVX512_ICL' has not been declared CV_CPU_CALL_<OPT>() already handles the namespace selection for a call. Add the same thing for code that needs the function pointer instead: CV_CPU_GET_FN_PTR_<OPT>(fn) per optimization CV_CPU_GET_FN_PTR_BASELINE(fn) chain terminator CV_CPU_DISPATCH_FN(fn, modes) full chain, mirrors CV_CPU_DISPATCH() In the baseline case it resolves to cpu_baseline::fn, which is the <OPT> build of the kernel, so no implementation is lost and no second copy is emitted. In the dispatch case it keeps the cv::checkHardwareSupport() test and returns opt_<OPT>::fn, and it compiles out when the optimization is unavailable. Use it in the two places that hit this, which also removes the hand-written preprocessor blocks. Generated code for the dispatch configuration is unchanged (byte-identical .text with -DCPU_BASELINE=SSE3 -DCPU_DISPATCH=AVX512_ICL). Fixes #29694
OpenCV: Open Source Computer Vision Library
Resources
- Homepage: https://opencv.org
- Courses: https://opencv.org/courses
- Docs: https://docs.opencv.org/4.x/
- Q&A forum: https://forum.opencv.org
- previous forum (read only): https://answers.opencv.org
- Issue tracking: https://github.com/opencv/opencv/issues
- Additional OpenCV functionality: https://github.com/opencv/opencv_contrib
- Donate to OpenCV: https://opencv.org/support/
Contributing
Please read the contribution guidelines before starting work on a pull request.
Summary of the guidelines:
- One pull request per issue;
- Choose the right base branch;
- Include tests and documentation;
- Clean up "oops" commits before submitting;
- Follow the coding style guide.
Additional Resources
- Submit your OpenCV-based project for inclusion in Community Friday on opencv.org
- Subscribe to the OpenCV YouTube Channel featuring OpenCV Live, an hour-long streaming show
- Follow OpenCV on LinkedIn for daily posts showing the state-of-the-art in computer vision & AI
- Apply to be an OpenCV Volunteer to help organize events and online campaigns as well as amplify them
- Follow OpenCV on Mastodon in the Fediverse
- Follow OpenCV on Twitter
- OpenCV.ai: Computer Vision and AI development services from the OpenCV team.
Description
Languages
C++
87.6%
C
3.2%
Python
2.9%
CMake
2%
Java
1.5%
Other
2.6%