Fix H clamping for very small negative values.#21063
Merged
opencv-pushbot merged 1 commit intoopencv:3.4from Nov 19, 2021
Merged
Fix H clamping for very small negative values.#21063opencv-pushbot merged 1 commit intoopencv:3.4from
opencv-pushbot merged 1 commit intoopencv:3.4from
Conversation
4 tasks
alalek
reviewed
Nov 18, 2021
| h *= hscale; | ||
| if( h < 0 ) | ||
| do h += 6; while( h < 0 ); | ||
| else if( h >= 6 ) |
Member
There was a problem hiding this comment.
Why we can't replace else if => if + add comment to avoid replacing this back.
Proposed expression work for SIMD code (with comparison through v_select) but expression still may lead to crash of this code (with array indexes, without strong CV_Assert()).
Contributor
Author
There was a problem hiding this comment.
We can indeed remove the else, I just wanted the code to be like SIMD for consistency and also thought that the while loop might be an overkill if h is too big.
1219c93 to
4b3375d
Compare
Contributor
Author
|
Sorry I actually did not get: in the end, do you want the simple solution where I just remove the else, or the one that copies the SIMD code and that does not have two while loops ? |
Member
|
I prefer minimal changes (with removal of the else). |
0465253 to
b0fe829
Compare
Contributor
Author
|
ok, done. |
alalek
reviewed
Nov 18, 2021
b0fe829 to
1e68bc8
Compare
1e68bc8 to
d7b51e3
Compare
In case of very small negative h (e.g. -1e-40), with the current implementation, you will go through the first condition and end up with h = 6.f, and will miss the second condition.
d7b51e3 to
d4741ee
Compare
Merged
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In case of very small negative h (e.g. -1e-40), with the current implementation,
you will go through the first condition and end up with h = 6.f, and will miss
the second condition.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request