• David Barker's avatar
    Add 'do_average' to ConvolveParams structure · e64d51a9
    David Barker authored
    The 'ref' member of ConvolveParams currently serves two purposes:
    * To indicate which component of a compound we're currently predicting,
      eg. for fetching interpolation filters with dual-filter enabled.
    * To determine whether we should average into the destination buffer.
    But there are two cases where we want to separate these out:
    * In joint_motion_search, we want to try combining a fixed second
      prediction with various first predictions.
    * When searching masked interinter compounds, we want to predict
      each component separately then try different combinations.
    In these cases, we set 'ref' to 0 and use temporary variables to
    make sure we use the correct interpolation filters. But this is
    quite fragile.
    This patch separates out the two uses into separate members.
    This allows us to remove some temporary variables, but more
    importantly gives easy fixes to two bugs in
    build_inter_predictors_single_buf (used by rdopt):
    * We previously set ref=0 but didn't fix up the interpolation filters
    * For ZERO_ZEROMV modes, the second component would accidentally
      average into the (uninitialized!) second prediction buffer
    Change-Id: Ibc31d1ac701a029ea5efaa1197dd402bc4b7af1e
rdopt.c 398 KB