Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork56.4k
Added flag to GaussianBlur for faster but not bit-exact implementation#25792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
1c62df7 tob5df286Compare671ce14 toea56bd9CompareUh oh!
There was an error while loading.Please reload this page.
asmorkalov commentedJun 21, 2024
Discussion result:
|
asmorkalov commentedJun 26, 2024
@mshabunin@opencv-alalek@vpisarev I reworked interface as discussed offline and added accuracy tests for IPP branch. Could you take a look? |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
a753443 to8fa2e47CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| cv::absdiff(dst, gt, diff); | ||
| cv::Mat flatten_diff = diff.reshape(1, diff.rows); | ||
| int nz =countNonZero(flatten_diff); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
norm is faster thancountNonZero approach.
Use relative NORM_L1/L2 and NORM_INF instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I intentionally split the check on min-max deviation and amount of different pixels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
EXPECT_LE(max_val, 2); // expectes results floating +-1
comment doesn't follow to the check anyway.
NORM_INF <=1 works perfect.
With 1-limited NORM_INF, we could use NORM_L1 + RELATIVE to define the part of pixels of different values.
Uh oh!
There was an error while loading.Please reload this page.
asmorkalov commentedJul 11, 2024
@opencv-alalek I fixed your review notes. Please take a look again. |
a47f442 toee840b5Compareee840b5 to13b6caaCompare| ALGO_APPROX =2,//!< Allow alternative approximations to get faster implementation. Behaviour and result depends on a platform | ||
| }; | ||
| /*! @brief Returns ImplementationHint selected by default, a.k.a. `IMPL_DEFAULT` defined during OpenCV compilation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
ImplementationHint
not renamed
IMPL_DEFAULT
What is that?
| */ | ||
| enum AlgorithmHint { | ||
| ALGO_DEFAULT =0,//!< Default algorithm behaviour defined during OpenCV build | ||
| ALGO_ACCURATE =1,//!< Use generic portable implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
ALGO_HINT_ then.
| #include<iostream> | ||
| #include<ostream> | ||
| #include<opencv2/core.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
To be removed.
| /*! @brief Returns ImplementationHint selected by default, a.k.a. `IMPL_DEFAULT` defined during OpenCV compilation. | ||
| */ | ||
| CV_EXPORTS_W AlgorithmHintgetDefaultAlgorithmHint(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should go toutility.hpp somewhere nearsetUseOptimized()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
setUseOptimized() should also control behavior of that:
setUseOptimized(false)disables these hints and use accurate versions.
| cv::absdiff(dst, gt, diff); | ||
| cv::Mat flatten_diff = diff.reshape(1, diff.rows); | ||
| int nz =countNonZero(flatten_diff); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
EXPECT_LE(max_val, 2); // expectes results floating +-1
comment doesn't follow to the check anyway.
NORM_INF <=1 works perfect.
With 1-limited NORM_INF, we could use NORM_L1 + RELATIVE to define the part of pixels of different values.
Added xxxApprox overloads for YUV color conversions in HAL and AlgorithmHint to cvtColor#25932The xxxApprox to implement HAL functions with less bits for arithmetic of FP.The hint was introduced in#25792 and#25911### Pull Request Readiness ChecklistSee details athttps://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- [x] The PR is proposed to the proper branch- [x] There is a reference to the original bug report and related work- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name.- [x] The feature is well documented and sample code can be built with the project CMake
Added flag to GaussianBlur for faster but not bit-exact implementationopencv#25792Rationale:Current implementation of GaussianBlur is almost always bit-exact. It helps to get predictable results according platforms, but prohibits most of approximations and optimization tricks.The patch converts `borderType` parameter to more generic `flags` and introduces `GAUSS_ALLOW_APPROXIMATIONS` flag to allow not bit-exact implementation. With the flag IPP and generic HAL implementation are called first. The flag naming and location is a subject for discussion.Replacesopencv#22073Possibly related issue:opencv#24135### Pull Request Readiness ChecklistSee details athttps://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- [x] The PR is proposed to the proper branch- [ ] There is a reference to the original bug report and related work- [x] 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
Added xxxApprox overloads for YUV color conversions in HAL and AlgorithmHint to cvtColoropencv#25932The xxxApprox to implement HAL functions with less bits for arithmetic of FP.The hint was introduced inopencv#25792 andopencv#25911### Pull Request Readiness ChecklistSee details athttps://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- [x] The PR is proposed to the proper branch- [x] There is a reference to the original bug report and related work- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name.- [x] The feature is well documented and sample code can be built with the project CMake
Added flag to GaussianBlur for faster but not bit-exact implementationopencv#25792Rationale:Current implementation of GaussianBlur is almost always bit-exact. It helps to get predictable results according platforms, but prohibits most of approximations and optimization tricks.The patch converts `borderType` parameter to more generic `flags` and introduces `GAUSS_ALLOW_APPROXIMATIONS` flag to allow not bit-exact implementation. With the flag IPP and generic HAL implementation are called first. The flag naming and location is a subject for discussion.Replacesopencv#22073Possibly related issue:opencv#24135See details athttps://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- [x] The PR is proposed to the proper branch- [ ] There is a reference to the original bug report and related work- [x] 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
Added flag to GaussianBlur for faster but not bit-exact implementationopencv#25792Rationale:Current implementation of GaussianBlur is almost always bit-exact. It helps to get predictable results according platforms, but prohibits most of approximations and optimization tricks.The patch converts `borderType` parameter to more generic `flags` and introduces `GAUSS_ALLOW_APPROXIMATIONS` flag to allow not bit-exact implementation. With the flag IPP and generic HAL implementation are called first. The flag naming and location is a subject for discussion.Replacesopencv#22073Possibly related issue:opencv#24135### Pull Request Readiness ChecklistSee details athttps://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- [x] The PR is proposed to the proper branch- [ ] There is a reference to the original bug report and related work- [x] 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
Added flag to GaussianBlur for faster but not bit-exact implementationopencv#25792Rationale:Current implementation of GaussianBlur is almost always bit-exact. It helps to get predictable results according platforms, but prohibits most of approximations and optimization tricks.The patch converts `borderType` parameter to more generic `flags` and introduces `GAUSS_ALLOW_APPROXIMATIONS` flag to allow not bit-exact implementation. With the flag IPP and generic HAL implementation are called first. The flag naming and location is a subject for discussion.Replacesopencv#22073Possibly related issue:opencv#24135### Pull Request Readiness ChecklistSee details athttps://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- [x] The PR is proposed to the proper branch- [ ] There is a reference to the original bug report and related work- [x] 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
Added flag to GaussianBlur for faster but not bit-exact implementationopencv#25792Rationale:Current implementation of GaussianBlur is almost always bit-exact. It helps to get predictable results according platforms, but prohibits most of approximations and optimization tricks.The patch converts `borderType` parameter to more generic `flags` and introduces `GAUSS_ALLOW_APPROXIMATIONS` flag to allow not bit-exact implementation. With the flag IPP and generic HAL implementation are called first. The flag naming and location is a subject for discussion.Replacesopencv#22073Possibly related issue:opencv#24135### Pull Request Readiness ChecklistSee details athttps://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- [x] The PR is proposed to the proper branch- [ ] There is a reference to the original bug report and related work- [x] 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
Added xxxApprox overloads for YUV color conversions in HAL and AlgorithmHint to cvtColoropencv#25932The xxxApprox to implement HAL functions with less bits for arithmetic of FP.The hint was introduced inopencv#25792 andopencv#25911### Pull Request Readiness ChecklistSee details athttps://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- [x] The PR is proposed to the proper branch- [x] There is a reference to the original bug report and related work- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name.- [x] The feature is well documented and sample code can be built with the project CMake
Uh oh!
There was an error while loading.Please reload this page.
Rationale:
Current implementation of GaussianBlur is almost always bit-exact. It helps to get predictable results according platforms, but prohibits most of approximations and optimization tricks.
The patch converts
borderTypeparameter to more genericflagsand introducesGAUSS_ALLOW_APPROXIMATIONSflag to allow not bit-exact implementation. With the flag IPP and generic HAL implementation are called first. The flag naming and location is a subject for discussion.Replaces#22073
Possibly related issue:#24135
Pull Request Readiness Checklist
See details athttps://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.