Closed magiblot closed 2 years ago
It is good to show exact use case. Line 2771 - it is function PlaneOfBlocks::CheckMV0 called from many places. workarea is 'global' structure for current search thread. If call stack is PseudoEPZsearch - the mincost is set (conditionless/guaranteed) at least at https://github.com/pinterf/mvtools/blob/d8bdff7e02c15a28dcc6e9ef2ebeaa9d16cc1f56/Sources/PlaneOfBlocks.cpp#L934 at the start of PseudoEPZSearch after check zero-predictor before calling to CheckMV0. Same is for CheckMV in expanding search - it is in Refine() process at the end of PseudoEPZSearch.
I suppose valgrind is complaining for real, so that at least the first comparison is done against a totally uninitialized value instead of
workarea.nMinCost = verybigSAD + 1;
I don't know whether it must be done outside the loop, once, before
https://github.com/pinterf/mvtools/blob/mvtools-pfmod/Sources/PlaneOfBlocks.cpp#L3063
Or in each inner loop https://github.com/pinterf/mvtools/blob/mvtools-pfmod/Sources/PlaneOfBlocks.cpp#L3091
(And the same modification should be applied to the mv_recalc some 300 lines later)
How it can be if CheckMV0 is called after checking zero-predictor at the beginning of PseudoEPZSearch with conditionless initializing mincost with its 'startup' value for zero-mv check of current block ?
Yep, I see it now. Here. https://github.com/pinterf/mvtools/blob/mvtools-pfmod/Sources/PlaneOfBlocks.cpp#L934 Then I don't know.
Sorry. After taking a closer look at it, I realized the warning is caused by cost
because the uninitialized value comes from the video frame itself. I still don't know what exactly is causing this but I don't think it's mvtool's fault.
Excuse me for the trouble and thanks for the attention.
Valgrind complains that an uninitialized value is being used when accessing
workarea.nMinCost
.https://github.com/pinterf/mvtools/blob/d8bdff7e02c15a28dcc6e9ef2ebeaa9d16cc1f56/Sources/PlaneOfBlocks.cpp#L2771
https://github.com/pinterf/mvtools/blob/d8bdff7e02c15a28dcc6e9ef2ebeaa9d16cc1f56/Sources/PlaneOfBlocks.cpp#L2819
This member is indeed not initialized in
WorkingArea::WorkingArea
: https://github.com/pinterf/mvtools/blob/d8bdff7e02c15a28dcc6e9ef2ebeaa9d16cc1f56/Sources/PlaneOfBlocks.cpp#L3661-L3667I'm not sure what the initial value for this member should be, so I leave the fix in your hands.