av1/encoder/intra_mode_search.c
// Run RD calculation with given luma intra prediction angle., and return
// the RD cost. Update the best mode info. if the RD cost is the best so far.
Run RD calculation with given luma intra prediction angle., and return
the RD cost. Update the best mode info. if the RD cost is the best so far.
Run RD calculation with given luma intra prediction angle . and return the RD cost . Update the best mode info . if the RD cost is the best so far .
static int64_t calc_rd_given_intra_angle(
    const AV1_COMP *const cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int mode_cost,
    int64_t best_rd_in, int8_t angle_delta, int max_angle_delta, int *rate,
    RD_STATS *rd_stats, int *best_angle_delta, TX_SIZE *best_tx_size,
    int64_t *best_rd, int64_t *best_model_rd, uint8_t *best_tx_type_map,
    uint8_t *best_blk_skip, int skip_model_rd) {
  RD_STATS tokenonly_rd_stats;
  int64_t this_rd;
  MACROBLOCKD *xd = &x->e_mbd;
  MB_MODE_INFO *mbmi = xd->mi[0];
  const int n4 = bsize_to_num_blk(bsize);
  assert(!is_inter_block(mbmi));
  mbmi->angle_delta[PLANE_TYPE_Y] = angle_delta;
  if (!skip_model_rd) {
    if (model_intra_yrd_and_prune(cpi, x, bsize, mode_cost, best_model_rd)) {
      return INT64_MAX;
    }
  }
  av1_super_block_yrd(cpi, x, &tokenonly_rd_stats, bsize, best_rd_in);
  if (tokenonly_rd_stats.rate == INT_MAX) return INT64_MAX;
  int this_rate =
      mode_cost + tokenonly_rd_stats.rate +
      x->angle_delta_cost[mbmi->mode - V_PRED][max_angle_delta + angle_delta];
  this_rd = RDCOST(x->rdmult, this_rate, tokenonly_rd_stats.dist);
  if (this_rd < *best_rd) {
    memcpy(best_blk_skip, x->blk_skip, sizeof(best_blk_skip[0]) * n4);
    av1_copy_array(best_tx_type_map, xd->tx_type_map, n4);
    *best_rd = this_rd;
    *best_angle_delta = mbmi->angle_delta[PLANE_TYPE_Y];
    *best_tx_size = mbmi->tx_size;
    *rate = this_rate;
    rd_stats->rate = tokenonly_rd_stats.rate;
    rd_stats->dist = tokenonly_rd_stats.dist;
    rd_stats->skip = tokenonly_rd_stats.skip;
  }
  return this_rd;
}
static int64_t calc_rd_given_intra_angle ( const AV1_COMP * const cpi , MACROBLOCK * x , BLOCK_SIZE bsize , int mode_cost , int64_t best_rd_in , int8_t angle_delta , int max_angle_delta , int * rate , RD_STATS * rd_stats , int * best_angle_delta , TX_SIZE * best_tx_size , int64_t * best_rd , int64_t * best_model_rd , uint8_t * best_tx_type_map , uint8_t * best_blk_skip , int skip_model_rd ) { RD_STATS tokenonly_rd_stats ; int64_t this_rd ; MACROBLOCKD * xd = & x -> e_mbd ; MB_MODE_INFO * mbmi = xd -> mi [ 0 ] ; const int n4 = bsize_to_num_blk ( bsize ) ; assert ( ! is_inter_block ( mbmi ) ) ; mbmi -> angle_delta [ PLANE_TYPE_Y ] = angle_delta ; if ( ! skip_model_rd ) { if ( model_intra_yrd_and_prune ( cpi , x , bsize , mode_cost , best_model_rd ) ) { return INT64_MAX ; } } av1_super_block_yrd ( cpi , x , & tokenonly_rd_stats , bsize , best_rd_in ) ; if ( tokenonly_rd_stats . rate == INT_MAX ) return INT64_MAX ; int this_rate = mode_cost + tokenonly_rd_stats . rate + x -> angle_delta_cost [ mbmi -> mode - V_PRED ] [ max_angle_delta + angle_delta ] ; this_rd = RDCOST ( x -> rdmult , this_rate , tokenonly_rd_stats . dist ) ; if ( this_rd < * best_rd ) { memcpy ( best_blk_skip , x -> blk_skip , sizeof ( best_blk_skip [ 0 ] ) * n4 ) ; av1_copy_array ( best_tx_type_map , xd -> tx_type_map , n4 ) ; * best_rd = this_rd ; * best_angle_delta = mbmi -> angle_delta [ PLANE_TYPE_Y ] ; * best_tx_size = mbmi -> tx_size ; * rate = this_rate ; rd_stats -> rate = tokenonly_rd_stats . rate ; rd_stats -> dist = tokenonly_rd_stats . dist ; rd_stats -> skip = tokenonly_rd_stats . skip ; } return this_rd ; }
Run RD calculation with given luma intra prediction angle., and return
the RD cost.
Run RD calculation with given luma intra prediction angle . and return the RD cost .