av1/encoder/intra_mode_search.c
// Model based RD estimation for luma intra blocks.
Model based RD estimation for luma intra blocks.
Model based RD estimation for luma intra blocks .
static int64_t intra_model_yrd(const AV1_COMP *const cpi, MACROBLOCK *const x,
                               BLOCK_SIZE bsize, int mode_cost) {
  const AV1_COMMON *cm = &cpi->common;
  MACROBLOCKD *const xd = &x->e_mbd;
  MB_MODE_INFO *const mbmi = xd->mi[0];
  assert(!is_inter_block(mbmi));
  RD_STATS this_rd_stats;
  int row, col;
  int64_t temp_sse, this_rd;
  TX_SIZE tx_size = tx_size_from_tx_mode(bsize, x->tx_mode_search_type);
  const int stepr = tx_size_high_unit[tx_size];
  const int stepc = tx_size_wide_unit[tx_size];
  const int max_blocks_wide = max_block_wide(xd, bsize, 0);
  const int max_blocks_high = max_block_high(xd, bsize, 0);
  mbmi->tx_size = tx_size;
  for (row = 0; row < max_blocks_high; row += stepr) {
    for (col = 0; col < max_blocks_wide; col += stepc) {
      av1_predict_intra_block_facade(cm, xd, 0, col, row, tx_size);
    }
  }
  model_rd_sb_fn[cpi->sf.rt_sf.use_simple_rd_model ? MODELRD_LEGACY
                                                   : MODELRD_TYPE_INTRA](
      cpi, bsize, x, xd, 0, 0, &this_rd_stats.rate, &this_rd_stats.dist,
      &this_rd_stats.skip, &temp_sse, NULL, NULL, NULL);
  if (av1_is_directional_mode(mbmi->mode) && av1_use_angle_delta(bsize)) {
    mode_cost +=
        x->angle_delta_cost[mbmi->mode - V_PRED]
                           [MAX_ANGLE_DELTA + mbmi->angle_delta[PLANE_TYPE_Y]];
  }
  if (mbmi->mode == DC_PRED &&
      av1_filter_intra_allowed_bsize(cm, mbmi->sb_type)) {
    if (mbmi->filter_intra_mode_info.use_filter_intra) {
      const int mode = mbmi->filter_intra_mode_info.filter_intra_mode;
      mode_cost += x->filter_intra_cost[mbmi->sb_type][1] +
                   x->filter_intra_mode_cost[mode];
    } else {
      mode_cost += x->filter_intra_cost[mbmi->sb_type][0];
    }
  }
  this_rd =
      RDCOST(x->rdmult, this_rd_stats.rate + mode_cost, this_rd_stats.dist);
  return this_rd;
}
static int64_t intra_model_yrd ( const AV1_COMP * const cpi , MACROBLOCK * const x , BLOCK_SIZE bsize , int mode_cost ) { const AV1_COMMON * cm = & cpi -> common ; MACROBLOCKD * const xd = & x -> e_mbd ; MB_MODE_INFO * const mbmi = xd -> mi [ 0 ] ; assert ( ! is_inter_block ( mbmi ) ) ; RD_STATS this_rd_stats ; int row , col ; int64_t temp_sse , this_rd ; TX_SIZE tx_size = tx_size_from_tx_mode ( bsize , x -> tx_mode_search_type ) ; const int stepr = tx_size_high_unit [ tx_size ] ; const int stepc = tx_size_wide_unit [ tx_size ] ; const int max_blocks_wide = max_block_wide ( xd , bsize , 0 ) ; const int max_blocks_high = max_block_high ( xd , bsize , 0 ) ; mbmi -> tx_size = tx_size ; for ( row = 0 ; row < max_blocks_high ; row += stepr ) { for ( col = 0 ; col < max_blocks_wide ; col += stepc ) { av1_predict_intra_block_facade ( cm , xd , 0 , col , row , tx_size ) ; } } model_rd_sb_fn [ cpi -> sf . rt_sf . use_simple_rd_model ? MODELRD_LEGACY : MODELRD_TYPE_INTRA ] ( cpi , bsize , x , xd , 0 , 0 , & this_rd_stats . rate , & this_rd_stats . dist , & this_rd_stats . skip , & temp_sse , NULL , NULL , NULL ) ; if ( av1_is_directional_mode ( mbmi -> mode ) && av1_use_angle_delta ( bsize ) ) { mode_cost += x -> angle_delta_cost [ mbmi -> mode - V_PRED ] [ MAX_ANGLE_DELTA + mbmi -> angle_delta [ PLANE_TYPE_Y ] ] ; } if ( mbmi -> mode == DC_PRED && av1_filter_intra_allowed_bsize ( cm , mbmi -> sb_type ) ) { if ( mbmi -> filter_intra_mode_info . use_filter_intra ) { const int mode = mbmi -> filter_intra_mode_info . filter_intra_mode ; mode_cost += x -> filter_intra_cost [ mbmi -> sb_type ] [ 1 ] + x -> filter_intra_mode_cost [ mode ] ; } else { mode_cost += x -> filter_intra_cost [ mbmi -> sb_type ] [ 0 ] ; } } this_rd = RDCOST ( x -> rdmult , this_rd_stats . rate + mode_cost , this_rd_stats . dist ) ; return this_rd ; }
Model based RD estimation for luma intra blocks.
Model based RD estimation for luma intra blocks .
// Prediction. // RD estimation.