Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
asmorkalov merged 8 commits intoopencv:4.xfromasmorkalov:as/HAL_fast_GaussianBlur
Jul 12, 2024

Conversation

@asmorkalov
Copy link
Contributor

@asmorkalovasmorkalov commentedJun 20, 2024
edited
Loading

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 convertsborderType parameter to more genericflags and introducesGAUSS_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.

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

  • I agree to contribute to the project under Apache 2 License.
  • 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

@asmorkalovasmorkalov added this to the4.11.0 milestoneJun 20, 2024
@asmorkalovasmorkalovforce-pushed theas/HAL_fast_GaussianBlur branch 2 times, most recently from1c62df7 tob5df286CompareJune 20, 2024 10:16
@asmorkalovasmorkalov changed the titleAdded flag to GaussianBlur for faster but not bit-exact implementation.Added flag to GaussianBlur for faster but not bit-exact implementationJun 20, 2024
@asmorkalovasmorkalovforce-pushed theas/HAL_fast_GaussianBlur branch 2 times, most recently from671ce14 toea56bd9CompareJune 20, 2024 12:37
@asmorkalovasmorkalov added the pr: needs testNew functionality requires minimal tests set labelJun 20, 2024
@asmorkalov
Copy link
ContributorAuthor

Discussion result:

  • move enum to core
  • dedicated parameter for perf hint, do not mix with border type.
  • check python and java bindings

@asmorkalovasmorkalov added category: core test and removed pr: Discussion Required pr: needs testNew functionality requires minimal tests set labelsJun 25, 2024
@asmorkalov
Copy link
ContributorAuthor

@mshabunin@opencv-alalek@vpisarev I reworked interface as discussed offline and added accuracy tests for IPP branch. Could you take a look?

@asmorkalovasmorkalovforce-pushed theas/HAL_fast_GaussianBlur branch froma753443 to8fa2e47CompareJuly 10, 2024 11:49
@vpisarevvpisarev self-requested a reviewJuly 10, 2024 19:22
cv::absdiff(dst, gt, diff);
cv::Mat flatten_diff = diff.reshape(1, diff.rows);

int nz =countNonZero(flatten_diff);
Copy link
Contributor

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.

Copy link
ContributorAuthor

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.

Copy link
Contributor

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.

@asmorkalovasmorkalov added feature and removed RFC labelsJul 11, 2024
@asmorkalov
Copy link
ContributorAuthor

@opencv-alalek I fixed your review notes. Please take a look again.

@asmorkalovasmorkalovforce-pushed theas/HAL_fast_GaussianBlur branch froma47f442 toee840b5CompareJuly 11, 2024 09:48
@asmorkalovasmorkalovforce-pushed theas/HAL_fast_GaussianBlur branch fromee840b5 to13b6caaCompareJuly 11, 2024 11:04
@asmorkalovasmorkalov merged commit15783d6 intoopencv:4.xJul 12, 2024
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.
Copy link
Contributor

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
Copy link
Contributor

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>
Copy link
Contributor

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();
Copy link
Contributor

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()

Copy link
Contributor

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);
Copy link
Contributor

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.

asmorkalov added a commit that referenced this pull requestAug 6, 2024
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
fengyuentau pushed a commit to fengyuentau/opencv that referenced this pull requestAug 15, 2024
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
fengyuentau pushed a commit to fengyuentau/opencv that referenced this pull requestAug 15, 2024
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
savuor pushed a commit to savuor/opencv that referenced this pull requestNov 1, 2024
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
@savuorsavuor mentioned this pull requestNov 1, 2024
6 tasks
savuor pushed a commit to savuor/opencv that referenced this pull requestNov 5, 2024
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
savuor pushed a commit to savuor/opencv that referenced this pull requestNov 8, 2024
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
savuor pushed a commit to savuor/opencv that referenced this pull requestNov 21, 2024
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
thewoz pushed a commit to CobbsLab/OPENCV that referenced this pull requestFeb 13, 2025
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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mshabuninmshabuninmshabunin left review comments

@opencv-alalekopencv-alalekopencv-alalek left review comments

@vpisarevvpisarevvpisarev approved these changes

Assignees

No one assigned

Projects

Status: Done

Milestone

4.11.0

Development

Successfully merging this pull request may close these issues.

4 participants

@asmorkalov@vpisarev@mshabunin@opencv-alalek

[8]ページ先頭

©2009-2025 Movatter.jp