Skip to content

Add debug assert to check in FLANN the vectors size is multiple of th…#18085

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
pemmanuelviel:pev--add-DbgAssert-checks
Aug 20, 2020
Merged

Add debug assert to check in FLANN the vectors size is multiple of th…#18085
opencv-pushbot merged 1 commit intoopencv:3.4from
pemmanuelviel:pev--add-DbgAssert-checks

Conversation

@pemmanuelviel
Copy link
Copy Markdown
Contributor

@pemmanuelviel pemmanuelviel commented Aug 12, 2020

…e architecture word size

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under OpenCV (BSD) License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to 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

@asmorkalov
Copy link
Copy Markdown
Contributor

@vpisarev Please take a look.

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contribution!

template <typename Iterator1, typename Iterator2>
ResultType operator()(const Iterator1 a, const Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
{
CV_DbgAssert(!(size % long_word_size_) && "vectors size must be multiple of long words size (i.e. 8)");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it frequently used function (for example called from some loop)? Is overhead of this check measurable?
If not then my suggestion is to use CV_Assert() instead to keep this check in Release builds too (almost all binary packages + python bindings).
Or we need to add an upper level validation check for that (which is called once to reduce overhead).

@pemmanuelviel
Copy link
Copy Markdown
Contributor Author

pemmanuelviel commented Aug 16, 2020 via email

@opencv-pushbot opencv-pushbot merged commit 277961f into opencv:3.4 Aug 20, 2020
@alalek alalek mentioned this pull request Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants