Skip to content

Rework RLOF by using HAL universal instructions #2476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9ca3bf2
Merge pull request #2 from opencv/master
tsenst Jul 9, 2019
a1f1f3b
Merge pull request #3 from opencv/master
tsenst Jul 29, 2019
1576a4c
Merge remote-tracking branch 'upstream/master'
Sep 13, 2019
c622e7a
Merge remote-tracking branch 'remotes/upstream/master'
Nov 29, 2019
59e8660
Merge branch 'master' of https://github.com/tsenst/opencv_contrib
Nov 29, 2019
2a9b971
Merge remote-tracking branch 'upstream/master'
Feb 6, 2020
fa871f4
* distinguish between SSE2 and SSE 4.1 support
Feb 7, 2020
7bec9bc
* add interface function do enable disable M-estimator framework
Feb 7, 2020
27afa6a
* make use of _mm_store and _mm_load functions in blendv_ps and blend…
Feb 9, 2020
222380a
* implement substitute of _mm_cvtepi8_epi16 and _mm_cvtepi16_epi32 wh…
Feb 9, 2020
4cd6635
* implement substitute of _mm_abs_epi16 when compiling with less than…
Feb 9, 2020
07b1f50
Merge branch 'optimize_performance_rlof' of https://github.com/tsenst…
Feb 9, 2020
cafa250
* move _mm_abs_epi16 to SSE4 req.
Feb 9, 2020
efc5ba9
* add HAL intrinsic functions for RLOF ICA
Mar 20, 2020
c6482cc
* HAL intrinsic functions -> RLOF ICA is ready now
Mar 20, 2020
d7775a7
* add HAL functions for RLOF illumination model
Mar 20, 2020
4ad97ee
* add HAL for PLK ILL
Mar 21, 2020
e0d79d6
* add HAL functions for plk ica
Mar 21, 2020
5401ece
* commit HAL functions for beplk ica
Mar 22, 2020
c0e24c2
* add HAL functions for berlof ica
Mar 22, 2020
1302745
* add HAL functions for BEPLK ILL
Mar 22, 2020
cf5ac7d
*remove unused #ifdef
Mar 22, 2020
73505d4
* remove white spaces and unused variables
Mar 23, 2020
44090d6
* remove not used variables
Mar 23, 2020
4d5f7fe
+ remove get4BitMask function which contained pure SEE instructions
Mar 23, 2020
56a29f6
* remove buffIdx which has not been used but initialized
Mar 23, 2020
653e1e7
* fix replacement of #ifdef CV_SIMD128 with #if CV_SIMD128
Mar 25, 2020
d3fa5e8
*remove whitespace
Mar 25, 2020
688f0f5
* remove unused variable abss
Mar 31, 2020
7a54005
* remove unused value
Mar 31, 2020
67f533c
* rename W_BITS1 to W_BITS since they contain same value
Mar 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions modules/optflow/include/opencv2/optflow/rlofflow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ class CV_EXPORTS_W RLOFOpticalFlowParameter{
RLOFOpticalFlowParameter()
:solverType(ST_BILINEAR)
,supportRegionType(SR_CROSS)
,normSigma0(3.2f)
,normSigma1(7.f)
,normSigma0(std::numeric_limits<float>::max())
,normSigma1(std::numeric_limits<float>::max())
,smallWinSize(9)
,largeWinSize(21)
,crossSegmentationThreshold(25)
,maxLevel(5)
,maxLevel(4)
,useInitialFlow(false)
,useIlluminationModel(true)
,useGlobalMotionPrior(true)
Expand All @@ -90,13 +90,13 @@ class CV_EXPORTS_W RLOFOpticalFlowParameter{
*/

float normSigma0;
/**< &sigma paramter of the shrinked Hampel norm introduced in @cite Senst2012. If
/**< &sigma parameter of the shrinked Hampel norm introduced in @cite Senst2012. If
* &sigma = std::numeric_limist<float>::max() the least-square estimator will be used
* instead of the M-estimator. Althoug M-estimator is more robust against outlier in the support
* region the least-square can be fast in computation.
*/
float normSigma1;
/**< &sigma paramter of the shrinked Hampel norm introduced in @cite Senst2012. If
/**< &sigma parameter of the shrinked Hampel norm introduced in @cite Senst2012. If
* &sigma = std::numeric_limist<float>::max() the least-square estimator will be used
* instead of the M-estimator. Althoug M-estimator is more robust against outlier in the support
* region the least-square can be fast in computation.
Expand Down Expand Up @@ -151,6 +151,14 @@ class CV_EXPORTS_W RLOFOpticalFlowParameter{
* See @cite Senst2016 for more details.
*/

//! @brief Enable M-estimator or disable and use least-square estimator.
/** Enables M-estimator by setting sigma parameters to (3.2, 7.0). Disabling M-estimator can reduce
* runtime, while enabling can improve the accuracy.
* @param val If true M-estimator is used. If false least-square estimator is used.
* @see setNormSigma0, setNormSigma1
*/
CV_WRAP void setUseMEstimator(bool val);

CV_WRAP void setSolverType(SolverType val);
CV_WRAP SolverType getSolverType() const;

Expand Down Expand Up @@ -216,9 +224,8 @@ class CV_EXPORTS_W RLOFOpticalFlowParameter{
* For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details.
* Parameters have been described in @cite Senst2012 @cite Senst2013 @cite Senst2014 and @cite Senst2016.
*
* @note SIMD parallelization is only available when compiling with SSE4.1. If the grid size is set to (1,1) and the
* forward backward threshold <= 0 that the dense optical flow field is purely.
* computed with the RLOF.
* @note If the grid size is set to (1,1) and the forward backward threshold <= 0 than pixelwise dense optical flow field is
* computed by RLOF without using interpolation.
*
* @see optflow::calcOpticalFlowDenseRLOF(), optflow::RLOFOpticalFlowParameter
*/
Expand Down
4 changes: 3 additions & 1 deletion modules/optflow/perf/perf_rlof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ typedef tuple<std::string, int> INTERP_GRID_Dense_t;
typedef TestBaseWithParam<INTERP_GRID_Dense_t> INTERP_GRID_Dense;
PERF_TEST_P(INTERP_GRID_Dense, OpticalFlow_DenseRLOF,
testing::Combine(
testing::Values<std::string>("INTERP_EPIC", "INTERP_GEO"),
testing::Values<std::string>("INTERP_EPIC", "INTERP_GEO", "INTERP_RIC"),
testing::Values<int>(4,10))
)
{
Expand All @@ -63,6 +63,8 @@ PERF_TEST_P(INTERP_GRID_Dense, OpticalFlow_DenseRLOF,
interp_type = INTERP_EPIC;
if (get<0>(GetParam()) == "INTERP_GEO")
interp_type = INTERP_GEO;
if (get<0>(GetParam()) == "INTERP_RIC")
interp_type = INTERP_RIC;
PERF_SAMPLE_BEGIN()
calcOpticalFlowDenseRLOF(frame1, frame2,flow, param, 1.0f, Size(get<1>(GetParam()), get<1>(GetParam())), interp_type);
PERF_SAMPLE_END()
Expand Down
2,090 changes: 1,231 additions & 859 deletions modules/optflow/src/rlof/berlof_invoker.hpp

Large diffs are not rendered by default.

595 changes: 151 additions & 444 deletions modules/optflow/src/rlof/plk_invoker.hpp

Large diffs are not rendered by default.

846 changes: 274 additions & 572 deletions modules/optflow/src/rlof/rlof_invoker.hpp

Large diffs are not rendered by default.

Loading