av1/encoder/mcomp.c
// Returns the cost of using the current mv during the motion search. This is
// only used during full pixel motion search when sad is used as the error
// metric.
Returns the cost of using the current mv during the motion search. This is
only used during full pixel motion search when sad is used as the error
metric.
Returns the cost of using the current mv during the motion search . This is only used during full pixel motion search when sad is used as the error metric .
static int mvsad_err_cost(const MACROBLOCK *x, const FULLPEL_MV *mv,
                          const FULLPEL_MV *ref_mv, int sad_per_bit) {
  const MV diff = { GET_MV_SUBPEL(mv->row - ref_mv->row),
                    GET_MV_SUBPEL(mv->col - ref_mv->col) };
  const MV_COST_TYPE mv_cost_type = x->mv_cost_type;
  switch (mv_cost_type) {
    case MV_COST_ENTROPY:
      return ROUND_POWER_OF_TWO(
          (unsigned)mv_cost(&diff, x->nmv_vec_cost,
                            CONVERT_TO_CONST_MVCOST(x->mv_cost_stack)) *
              sad_per_bit,
          AV1_PROB_COST_SHIFT);
    case MV_COST_L1_LOWRES:
      return (SAD_LAMBDA_LOWRES * (abs(diff.row) + abs(diff.col))) >> 3;
    case MV_COST_L1_MIDRES:
      return (SAD_LAMBDA_MIDRES * (abs(diff.row) + abs(diff.col))) >> 3;
    case MV_COST_L1_HDRES:
      return (SAD_LAMBDA_HDRES * (abs(diff.row) + abs(diff.col))) >> 3;
    case MV_COST_NONE: return 0;
    default: assert(0 && "Invalid rd_cost_type"); return 0;
  }
}
static int mvsad_err_cost ( const MACROBLOCK * x , const FULLPEL_MV * mv , const FULLPEL_MV * ref_mv , int sad_per_bit ) { const MV diff = { GET_MV_SUBPEL ( mv -> row - ref_mv -> row ) , GET_MV_SUBPEL ( mv -> col - ref_mv -> col ) } ; const MV_COST_TYPE mv_cost_type = x -> mv_cost_type ; switch ( mv_cost_type ) { case MV_COST_ENTROPY : return ROUND_POWER_OF_TWO ( ( unsigned ) mv_cost ( & diff , x -> nmv_vec_cost , CONVERT_TO_CONST_MVCOST ( x -> mv_cost_stack ) ) * sad_per_bit , AV1_PROB_COST_SHIFT ) ; case MV_COST_L1_LOWRES : return ( SAD_LAMBDA_LOWRES * ( abs ( diff . row ) + abs ( diff . col ) ) ) >> 3 ; case MV_COST_L1_MIDRES : return ( SAD_LAMBDA_MIDRES * ( abs ( diff . row ) + abs ( diff . col ) ) ) >> 3 ; case MV_COST_L1_HDRES : return ( SAD_LAMBDA_HDRES * ( abs ( diff . row ) + abs ( diff . col ) ) ) >> 3 ; case MV_COST_NONE : return 0 ; default : assert ( 0 && " " ) ; return 0 ; } }
Returns the cost of using the current mv during the motion search.
Returns the cost of using the current mv during the motion search .