cvRound optimization (Patch included) (Feature #1123)
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.
Associated revisions
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