cvRound optimization (Patch included) (Feature #1123)


Added by Eugene Khvedchenya almost 14 years ago. Updated over 13 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:-
Difficulty: Pull request:

Description

Hi

I'm using OpenCV on iPhone and while profiling my app i noticed huge slowdown in SURF descriptor extraction.
After digging into source code i noticed that all floating point calculations in surf is done in floats, while the cvRound accepts only doubles. Therefore implicit float to double occurs. I've added single precision floating point cvRound overload and fixed some compilation errors also.

Performed tests tells that optimized cvRound(float) increases extraction of SURF descriptors on 25% (in comparison to cvRound(double). All tests were done on real device (iPhone 3Gs, Graffity patter image).

More information can be found here: http://computer-vision-talks.com/2011/06/a-few-thoughts-about-cvround/

Patch included.


opencv-cvround-float-patch.diff - Patch - added overload for cvRound(float) (3.5 kB) Eugene Khvedchenya, 2011-06-07 09:55 pm


Associated revisions

Revision bc78e87a
Added by Andrey Pavlenko over 11 years ago

Merge pull request #1123 from bitwangyaoyao:2.4_fix

History

Updated by Vadim Pisarevsky over 13 years ago

the patch in the current form can not be applied.

- First, cvRound() is declared in a C-compliant OpenCV header, not C++, where overload functions are not allowed. it should at least be put into #ifdef +cplusplus #endif statement.

- Then, in some places the float variant of lrint is called lrintf: http://pubs.opengroup.org/onlinepubs/009695399/functions/lrint.html

- The rest of the patch, where cvRound() is simply dropped, can not be accepted either. It's clearly a change that will affects the computed results. Besides, in most cases, like the changes in color.cpp or stereobm.cpp, the modified code is clearly not a bottleneck, it's initialization, so the change will hardly increase performance significantly.

  • Status changed from Open to Done
  • (deleted custom field) set to invalid

Also available in: Atom PDF