mirror of
https://github.com/opencv/opencv.git
synced 2025-08-05 22:19:14 +08:00
Fixed static analyzer warnings in DISOpticalFlow
This commit is contained in:
parent
2e0150e601
commit
388ccda85d
@ -226,9 +226,11 @@ DISOpticalFlowImpl::DISOpticalFlowImpl()
|
||||
border_size = 16;
|
||||
use_mean_normalization = true;
|
||||
use_spatial_propagation = true;
|
||||
coarsest_scale = 10;
|
||||
|
||||
/* Use separate variational refinement instances for different scales to avoid repeated memory allocation: */
|
||||
int max_possible_scales = 10;
|
||||
ws = hs = w = h = 0;
|
||||
for (int i = 0; i < max_possible_scales; i++)
|
||||
variational_refinement_processors.push_back(VariationalRefinement::create());
|
||||
}
|
||||
@ -1035,6 +1037,7 @@ void DISOpticalFlowImpl::Densification_ParBody::operator()(const Range &range) c
|
||||
sum_Uy += coef * Sy_ptr[is * dis->ws + js];
|
||||
sum_coef += coef;
|
||||
}
|
||||
CV_DbgAssert(sum_coef != 0);
|
||||
Ux_ptr[i * dis->w + j] = sum_Ux / sum_coef;
|
||||
Uy_ptr[i * dis->w + j] = sum_Uy / sum_coef;
|
||||
}
|
||||
|
@ -93,6 +93,7 @@ class VariationalRefinementImpl CV_FINAL : public VariationalRefinement
|
||||
int red_even_len, red_odd_len;
|
||||
int black_even_len, black_odd_len;
|
||||
|
||||
RedBlackBuffer();
|
||||
void create(Size s);
|
||||
void release();
|
||||
};
|
||||
@ -366,6 +367,10 @@ void VariationalRefinementImpl::updateRepeatedBorders(RedBlackBuffer &dst)
|
||||
}
|
||||
}
|
||||
|
||||
VariationalRefinementImpl::RedBlackBuffer::RedBlackBuffer()
|
||||
{
|
||||
release();
|
||||
}
|
||||
void VariationalRefinementImpl::RedBlackBuffer::create(Size s)
|
||||
{
|
||||
/* Allocate enough memory to include borders */
|
||||
@ -386,6 +391,7 @@ void VariationalRefinementImpl::RedBlackBuffer::release()
|
||||
{
|
||||
red.release();
|
||||
black.release();
|
||||
red_even_len = red_odd_len = black_even_len = black_odd_len = 0;
|
||||
}
|
||||
|
||||
VariationalRefinementImpl::ParallelOp_ParBody::ParallelOp_ParBody(VariationalRefinementImpl &_var, vector<Op> _ops,
|
||||
|
Loading…
Reference in New Issue
Block a user