Skip to content

Fix missing intrin.hpp header in dis_flow.cpp - #13115

Merged
alalek merged 1 commit into
opencv:masterfrom
catree:fix_dis_flow_intrin
Nov 12, 2018
Merged

alalek merged 1 commit into
opencv:masterfrom
catree:fix_dis_flow_intrin

Conversation

@catree

@catree catree commented Nov 11, 2018

Copy link
Copy Markdown
Contributor

resolves opencv/opencv_contrib#1894

Geometric mean (ms)

Name of Test before after before vs after (x-factor)
perf::DenseOpticalFlow_DIS::("PRESET_FAST", 640x480) 14.602 13.442 1.09
perf::DenseOpticalFlow_DIS::("PRESET_FAST", 1280x720) 40.623 36.206 1.12
perf::DenseOpticalFlow_DIS::("PRESET_FAST", 1920x1080) 86.579 77.698 1.11
perf::DenseOpticalFlow_DIS::("PRESET_MEDIUM", 640x480) 53.288 41.514 1.28
perf::DenseOpticalFlow_DIS::("PRESET_MEDIUM", 1280x720) 177.925 137.496 1.29
perf::DenseOpticalFlow_DIS::("PRESET_MEDIUM", 1920x1080) 436.096 332.447 1.31
perf::DenseOpticalFlow_DIS::("PRESET_ULTRAFAST", 640x480) 7.564 6.485 1.17
perf::DenseOpticalFlow_DIS::("PRESET_ULTRAFAST", 1280x720) 23.024 19.151 1.20
perf::DenseOpticalFlow_DIS::("PRESET_ULTRAFAST", 1920x1080) 49.114 38.910 1.26
perf::OCL_DenseOpticalFlow_DIS::("PRESET_FAST", 640x480) 15.049 14.310 1.05
perf::OCL_DenseOpticalFlow_DIS::("PRESET_FAST", 1280x720) 40.428 36.169 1.12
perf::OCL_DenseOpticalFlow_DIS::("PRESET_FAST", 1920x1080) 84.386 76.711 1.10
perf::OCL_DenseOpticalFlow_DIS::("PRESET_MEDIUM", 640x480) 48.509 37.854 1.28
perf::OCL_DenseOpticalFlow_DIS::("PRESET_MEDIUM", 1280x720) 156.342 123.468 1.27
perf::OCL_DenseOpticalFlow_DIS::("PRESET_MEDIUM", 1920x1080) 390.009 288.881 1.35
perf::OCL_DenseOpticalFlow_DIS::("PRESET_ULTRAFAST", 640x480) 10.223 9.721 1.05
perf::OCL_DenseOpticalFlow_DIS::("PRESET_ULTRAFAST", 1280x720) 28.411 23.203 1.22
perf::OCL_DenseOpticalFlow_DIS::("PRESET_ULTRAFAST", 1920x1080) 58.171 48.353 1.20

@tompollok

tompollok commented Nov 11, 2018 •

Copy link
Copy Markdown
Contributor

@catree @alalek I checked also a little bit on this and thought about whether there could be also other algorithms in opencv that lack in the inclusion of "opencv2/core/hal/intrin.hpp"

So in core module intrin.hpp is included via precomp.hpp
See: https://github.com/opencv/opencv/blob/master/modules/core/src/precomp.hpp

On the other hand in video module intrin.hpp is not included by precomp (every module has its own precomp.hpp for some reason)
https://github.com/opencv/opencv/blob/master/modules/video/src/precomp.hpp

I checked all modules of opencv and opencv_contrib and actually only the precomp.hpp of core includes "opencv2/core/hal/intrin.hpp"
Other than that "opencv2/core/hal/intrin.hpp" is only included by specific algorithms cpp file.

Does it make sense to include by all other precomp.hpp of all other modules or should it specifically only be included by the actual cpp implemention files that make use of them? Because if we would do so then this kind of bug would never bother us anymore. I dont know it there is a significant impact on the compile time to not do it.

@alalek

alalek commented Nov 11, 2018 •

Copy link
Copy Markdown
Member

include by all other precomp.hpp

No

be included by the actual cpp implemention files that make use of them

Yes

this kind of bug would never bother us anymore

Need to change:

-#ifdef CV_SIMD128
+#if CV_SIMD128

anywhere.

"ifdef" approach in "dis_optflow.cpp" and "variational_refinement.cpp" is invalid.

@tompollok

Copy link
Copy Markdown
Contributor

Thank you.

I added a PR for opencv_contrib 3.4 branch.

Am I assuming right that all cpp implementation files that use CV_AVX2, CV_SIMD, CV_VSX, CV_NEON, CV_SSE need an inclusion of #include "opencv2/core/hal/intrin.hpp" except for the core module implementations as they get it from precomp.hpp?

Fix #ifdef CV_SIMD128, should be #if CV_SIMD128.
@catree
catree force-pushed the fix_dis_flow_intrin branch from e743f6a to c96850b Compare November 11, 2018 22:34

@alalek alalek left a comment

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.

Thank you 👍

@alalek
alalek merged commit 326be0d into opencv:master Nov 12, 2018
@tompollok

tompollok commented Nov 12, 2018 •

Copy link
Copy Markdown
Contributor

@catree

catree commented Nov 13, 2018

Copy link
Copy Markdown
Contributor Author

If it can helps, with Visual Studio:

There is an include to #include "opencv2/imgproc.hpp" in layers/elementwise_layers.cpp#L48 that looks not necessary. Removing it and the module still builds successfully.

@tompollok

Copy link
Copy Markdown
Contributor

Thanks for answering and providing a pr. I was busy the last days.

SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
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.

A way to use SIMD in dis optical flow

3 participants