av1/encoder/intra_mode_search.c
// Return 1 if an filter intra mode is selected; return 0 otherwise.
Return 1 if an filter intra mode is selected; return 0 otherwise.
Return 1 if an filter intra mode is selected ; return 0 otherwise .
static int rd_pick_filter_intra_sby(const AV1_COMP *const cpi, MACROBLOCK *x,
                                    int *rate, int *rate_tokenonly,
                                    int64_t *distortion, int *skippable,
                                    BLOCK_SIZE bsize, int mode_cost,
                                    int64_t *best_rd, int64_t *best_model_rd,
                                    PICK_MODE_CONTEXT *ctx) {
  MACROBLOCKD *const xd = &x->e_mbd;
  MB_MODE_INFO *mbmi = xd->mi[0];
  int filter_intra_selected_flag = 0;
  FILTER_INTRA_MODE mode;
  TX_SIZE best_tx_size = TX_8X8;
  FILTER_INTRA_MODE_INFO filter_intra_mode_info;
  uint8_t best_tx_type_map[MAX_MIB_SIZE * MAX_MIB_SIZE];
  (void)ctx;
  av1_zero(filter_intra_mode_info);
  mbmi->filter_intra_mode_info.use_filter_intra = 1;
  mbmi->mode = DC_PRED;
  mbmi->palette_mode_info.palette_size[0] = 0;
  for (mode = 0; mode < FILTER_INTRA_MODES; ++mode) {
    int64_t this_rd;
    RD_STATS tokenonly_rd_stats;
    mbmi->filter_intra_mode_info.filter_intra_mode = mode;
    if (model_intra_yrd_and_prune(cpi, x, bsize, mode_cost, best_model_rd)) {
      continue;
    }
    av1_super_block_yrd(cpi, x, &tokenonly_rd_stats, bsize, *best_rd);
    if (tokenonly_rd_stats.rate == INT_MAX) continue;
    const int this_rate =
        tokenonly_rd_stats.rate +
        intra_mode_info_cost_y(cpi, x, mbmi, bsize, mode_cost);
    this_rd = RDCOST(x->rdmult, this_rate, tokenonly_rd_stats.dist);
    const int txfm_search_done = 1;
    store_winner_mode_stats(
        &cpi->common, x, mbmi, NULL, NULL, NULL, 0, NULL, bsize, this_rd,
        cpi->sf.winner_mode_sf.enable_multiwinner_mode_process,
        txfm_search_done);
    if (this_rd < *best_rd) {
      *best_rd = this_rd;
      best_tx_size = mbmi->tx_size;
      filter_intra_mode_info = mbmi->filter_intra_mode_info;
      av1_copy_array(best_tx_type_map, xd->tx_type_map, ctx->num_4x4_blk);
      memcpy(ctx->blk_skip, x->blk_skip,
             sizeof(x->blk_skip[0]) * ctx->num_4x4_blk);
      *rate = this_rate;
      *rate_tokenonly = tokenonly_rd_stats.rate;
      *distortion = tokenonly_rd_stats.dist;
      *skippable = tokenonly_rd_stats.skip;
      filter_intra_selected_flag = 1;
    }
  }
  if (filter_intra_selected_flag) {
    mbmi->mode = DC_PRED;
    mbmi->tx_size = best_tx_size;
    mbmi->filter_intra_mode_info = filter_intra_mode_info;
    av1_copy_array(ctx->tx_type_map, best_tx_type_map, ctx->num_4x4_blk);
    return 1;
  } else {
    return 0;
  }
}
static int rd_pick_filter_intra_sby ( const AV1_COMP * const cpi , MACROBLOCK * x , int * rate , int * rate_tokenonly , int64_t * distortion , int * skippable , BLOCK_SIZE bsize , int mode_cost , int64_t * best_rd , int64_t * best_model_rd , PICK_MODE_CONTEXT * ctx ) { MACROBLOCKD * const xd = & x -> e_mbd ; MB_MODE_INFO * mbmi = xd -> mi [ 0 ] ; int filter_intra_selected_flag = 0 ; FILTER_INTRA_MODE mode ; TX_SIZE best_tx_size = TX_8X8 ; FILTER_INTRA_MODE_INFO filter_intra_mode_info ; uint8_t best_tx_type_map [ MAX_MIB_SIZE * MAX_MIB_SIZE ] ; ( void ) ctx ; av1_zero ( filter_intra_mode_info ) ; mbmi -> filter_intra_mode_info . use_filter_intra = 1 ; mbmi -> mode = DC_PRED ; mbmi -> palette_mode_info . palette_size [ 0 ] = 0 ; for ( mode = 0 ; mode < FILTER_INTRA_MODES ; ++ mode ) { int64_t this_rd ; RD_STATS tokenonly_rd_stats ; mbmi -> filter_intra_mode_info . filter_intra_mode = mode ; if ( model_intra_yrd_and_prune ( cpi , x , bsize , mode_cost , best_model_rd ) ) { continue ; } av1_super_block_yrd ( cpi , x , & tokenonly_rd_stats , bsize , * best_rd ) ; if ( tokenonly_rd_stats . rate == INT_MAX ) continue ; const int this_rate = tokenonly_rd_stats . rate + intra_mode_info_cost_y ( cpi , x , mbmi , bsize , mode_cost ) ; this_rd = RDCOST ( x -> rdmult , this_rate , tokenonly_rd_stats . dist ) ; const int txfm_search_done = 1 ; store_winner_mode_stats ( & cpi -> common , x , mbmi , NULL , NULL , NULL , 0 , NULL , bsize , this_rd , cpi -> sf . winner_mode_sf . enable_multiwinner_mode_process , txfm_search_done ) ; if ( this_rd < * best_rd ) { * best_rd = this_rd ; best_tx_size = mbmi -> tx_size ; filter_intra_mode_info = mbmi -> filter_intra_mode_info ; av1_copy_array ( best_tx_type_map , xd -> tx_type_map , ctx -> num_4x4_blk ) ; memcpy ( ctx -> blk_skip , x -> blk_skip , sizeof ( x -> blk_skip [ 0 ] ) * ctx -> num_4x4_blk ) ; * rate = this_rate ; * rate_tokenonly = tokenonly_rd_stats . rate ; * distortion = tokenonly_rd_stats . dist ; * skippable = tokenonly_rd_stats . skip ; filter_intra_selected_flag = 1 ; } } if ( filter_intra_selected_flag ) { mbmi -> mode = DC_PRED ; mbmi -> tx_size = best_tx_size ; mbmi -> filter_intra_mode_info = filter_intra_mode_info ; av1_copy_array ( ctx -> tx_type_map , best_tx_type_map , ctx -> num_4x4_blk ) ; return 1 ; } else { return 0 ; } }
Return 1 if an filter intra mode is selected; return 0 otherwise.
Return 1 if an filter intra mode is selected ; return 0 otherwise .
// Collect mode stats for multiwinner mode processing