CONFIG_OPTFLOW_REFINEMENT: Concern about use_opfl_refine_all not checking all optical flow conditions
How was the issue detected?
What version / commit were you testing with?
What steps will reproduce the problem?
We are making verification streams for CONFIG_OPTFLOW_REFINEMENT, but have found a concern in the reference code.
The concern relates to the REFINE_ALL option.
This is used in use_opfl_refine_all:
/ Return 1 if current frame is REFINE_ALL and the current block uses optical
// flow refinement, i.e., inter mode is in {NEAR_NEARMV, NEAR_NEWMV,
// NEW_NEARMV, NEW_NEWMV}, and compound type is simple compound average.
static INLINE int use_opfl_refine_all(const AV1_COMMON *cm,
const MB_MODE_INFO *mbmi) {
return cm->features.opfl_refine_type == REFINE_ALL &&
mbmi->mode >= COMP_INTER_MODE_START &&
mbmi->mode < COMP_OPTFLOW_MODE_START &&
mbmi->mode != GLOBAL_GLOBALMV &&
mbmi->interinter_comp.type == COMPOUND_AVERAGE;
}
This function is used to determine whether interpolation filters need to be used.
However, a slightly different test is used to determine whether to use optical flow:
const int use_optflow_refinement =
(mi->mode >= NEAR_NEARMV_OPTFLOW ||
(cm->features.opfl_refine_type == REFINE_ALL &&
mi->mode != GLOBAL_GLOBALMV &&
mi->interinter_comp.type == COMPOUND_AVERAGE)) &&
is_compound && is_opfl_refine_allowed(cm, mi);
In particular, if is_opfl_refine_allowed returns false, then use_optflow_refinement can disagree with the result of use_opfl_refine_all.
This results in blocks which do not use optical flow, but also are not permitted to read the interpolation filters.
Is this intentional?