| AOMedia AV1 Codec

Functions
Partition Search
Encoder Algorithm

## Functions
static void | encode_nonrd_sb (AV1_COMP *cpi, ThreadData *td, TileDataEnc *tile_data, TokenExtra **tp, const int mi_row, const int mi_col, const int seg_skip)
| Encode a superblock (minimal RD search involved)
static void | encode_rd_sb (AV1_COMP *cpi, ThreadData *td, TileDataEnc *tile_data, TokenExtra **tp, const int mi_row, const int mi_col, const int seg_skip)
| CONFIG_REALTIME_ONLY.
static uint64_t | get_sb_source_sad (const AV1_COMP *cpi, int mi_row, int mi_col)
| Calculate source SAD at superblock level using 64x64 block source SAD.
static bool | is_calc_src_content_needed (AV1_COMP *cpi, MACROBLOCK *const x, int mi_row, int mi_col)
| Determine whether grading content can be skipped based on sad stat.
static void | grade_source_content_sb (AV1_COMP *cpi, MACROBLOCK *const x, TileDataEnc *tile_data, int mi_row, int mi_col)
| Determine whether grading content is needed based on sf and frame stat.
static void | encode_sb_row (AV1_COMP *cpi, ThreadData *td, TileDataEnc *tile_data, int mi_row, TokenExtra **tp)
| Encode a superblock row by breaking it into superblocks.
void | av1_encode_sb_row (AV1_COMP *cpi, ThreadData *td, int tile_row, int tile_col, int mi_row)
| Encode a superblock row.
void | av1_encode_tile (AV1_COMP *cpi, ThreadData *td, int tile_row, int tile_col)
| Encode a tile.
static void | encode_tiles (AV1_COMP *cpi)
| Break one frame into tiles and encode the tiles.
static void | pick_sb_modes (AV1_COMP *const cpi, TileDataEnc *tile_data, MACROBLOCK *const x, int mi_row, int mi_col, RD_STATS *rd_cost, PARTITION_TYPE partition, BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx, RD_STATS best_rd)
| Interface for AV1 mode search for an individual coding block.
static void | encode_b (const AV1_COMP *const cpi, TileDataEnc *tile_data, ThreadData *td, TokenExtra **tp, int mi_row, int mi_col, RUN_TYPE dry_run, BLOCK_SIZE bsize, PARTITION_TYPE partition, PICK_MODE_CONTEXT *const ctx, int *rate)
| Reconstructs an individual coding block.
static void | encode_sb (const AV1_COMP *const cpi, ThreadData *td, TileDataEnc *tile_data, TokenExtra **tp, int mi_row, int mi_col, RUN_TYPE dry_run, BLOCK_SIZE bsize, PC_TREE *pc_tree, int *rate)
| Reconstructs a partition (may contain multiple coding blocks)
void | av1_rd_use_partition (AV1_COMP *cpi, ThreadData *td, TileDataEnc *tile_data, MB_MODE_INFO **mib, TokenExtra **tp, int mi_row, int mi_col, BLOCK_SIZE bsize, int *rate, int64_t *dist, int do_recon, PC_TREE *pc_tree)
| AV1 block partition search (partition estimation and partial search).
static void | pick_sb_modes_nonrd (AV1_COMP *const cpi, TileDataEnc *tile_data, MACROBLOCK *const x, int mi_row, int mi_col, RD_STATS *rd_cost, BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx)
| Top level function to pick block mode for non-RD optimized case.
void | av1_nonrd_use_partition (AV1_COMP *cpi, ThreadData *td, TileDataEnc *tile_data, MB_MODE_INFO **mib, TokenExtra **tp, int mi_row, int mi_col, BLOCK_SIZE bsize, PC_TREE *pc_tree)
| AV1 block partition application (minimal RD search).
bool | av1_rd_pick_partition (AV1_COMP *const cpi, ThreadData *td, TileDataEnc *tile_data, TokenExtra **tp, int mi_row, int mi_col, BLOCK_SIZE bsize, RD_STATS *rd_cost, RD_STATS best_rdc, PC_TREE *pc_tree, SIMPLE_MOTION_DATA_TREE *sms_tree, int64_t *none_rd, SB_MULTI_PASS_MODE multi_pass_mode, RD_RECT_PART_WIN_INFO *rect_part_win_info)
| AV1 block partition search (full search).

## Detailed Description

For and overview of the partition search see Block Partition Search

## Function Documentation

## ◆ encode_nonrd_sb()

static void encode_nonrd_sb | ( | AV1_COMP * | cpi,
|  | ThreadData * | td,
|  | TileDataEnc * | tile_data,
|  | TokenExtra ** | tp,
|  | const int | mi_row,
|  | const int | mi_col,
|  | const int | seg_skip )
| inline static

Encode a superblock (minimal RD search involved)

Encodes the superblock by a pre-determined partition pattern, only minor rd-based searches are allowed to adjust the initial pattern. It is only used by realtime encoding.

References av1_choose_var_based_partitioning(), av1_nonrd_use_partition(), MB_MODE_INFO::cdef_strength, AV1_COMP::common, macroblock::content_state_sb, LAYER_CONTEXT::is_key_frame, SVC::layer_context, CommonModeInfoParams::mi_grid_base, AV1Common::mi_params, CommonModeInfoParams::mi_stride, SPEED_FEATURES::part_sf, AV1_COMP::ppi, SPEED_FEATURES::rt_sf, macroblock::sb_force_fixed_part, AV1Common::seq_params, AV1_COMP::sf, AV1_COMP::svc, and AV1_PRIMARY::use_svc.

Referenced by encode_sb_row().

## ◆ encode_rd_sb()

static void encode_rd_sb | ( | AV1_COMP * | cpi,
|  | ThreadData * | td,
|  | TileDataEnc * | tile_data,
|  | TokenExtra ** | tp,
|  | const int | mi_row,
|  | const int | mi_col,
|  | const int | seg_skip )
| inline static

CONFIG_REALTIME_ONLY.

Encode a superblock (RD-search-based)

Conducts partition search for a superblock, based on rate-distortion costs, from scratch or adjusting from a pre-calculated partition pattern.

References AOM_CODEC_MEM_ERROR, av1_choose_var_based_partitioning(), av1_rd_pick_partition(), av1_rd_use_partition(), CommonTileParams::cols, AV1_COMP::common, MB_MODE_INFO::current_qindex, AV1Common::delta_q_info, macroblock::delta_qindex, macroblock::e_mbd, macroblockd::error_info, AV1_COMP::ext_part_controller, has_no_stats_stage(), SPEED_FEATURES::inter_sf, CommonModeInfoParams::mi_alloc, CommonModeInfoParams::mi_grid_base, AV1Common::mi_params, AV1_COMP::oxcf, SPEED_FEATURES::part_sf, macroblock::rdmult, macroblock::rdmult_delta_qindex, CommonTileParams::rows, macroblock::sb_enc, AV1Common::seq_params, AV1_COMP::sf, AV1Common::tiles, and SuperBlockEnc::tpl_data_count.

Referenced by encode_sb_row().

## ◆ encode_sb_row()

static void encode_sb_row | ( | AV1_COMP * | cpi,
|  | ThreadData * | td,
|  | TileDataEnc * | tile_data,
|  | int | mi_row,
|  | TokenExtra ** | tp )
| inline static

Encode a superblock row by breaking it into superblocks.

Do partition and mode search for an sb row: one row of superblocks filling up the width of the current tile.

References av1_get_cb_coeff_buffer(), CommonQuantParams::base_qindex, macroblock::color_palette_thresh, macroblock::color_sensitivity, macroblock::color_sensitivity_sb, macroblock::color_sensitivity_sb_alt, macroblock::color_sensitivity_sb_g, AV1_COMP::common, macroblock::content_state_sb, FeatureFlags::cur_frame_force_integer_mv, macroblockd::cur_frame_force_integer_mv, macroblockd::current_base_qindex, AV1Common::delta_q_info, macroblock::e_mbd, MultiThreadInfo::enc_row_mt, AV1_COMP::enc_seg, encode_nonrd_sb(), encode_rd_sb(), AV1Common::features, macroblock::force_zeromv_skip_for_sb, grade_source_content_sb(), macroblock::intra_sb_rdmult_modifier, AV1Common::last_frame_seg_map, EncSegmentationInfo::map, AV1Common::mi_params, AV1_COMP::mt_info, AV1EncRowMultiThreadInfo::mutex_, macroblock::nonrd_prune_ref_frame_search, AV1_COMP::oxcf, AV1Common::quant_params, macroblock::row_ctx, MultiThreadInfo::row_mt_enabled, AV1EncRowMultiThreadInfo::row_mt_exit, SPEED_FEATURES::rt_sf, macroblock::sb_force_fixed_part, macroblock::sb_me_block, macroblock::sb_me_mv, macroblock::sb_me_partition, AV1Common::seg, AV1Common::seq_params, AV1_COMP::sf, macroblock::source_variance, macroblock::src_var_info_of_4x4_sub_blocks, AV1EncRowMultiThreadInfo::sync_read_ptr, AV1EncRowMultiThreadInfo::sync_write_ptr, and macroblockd::tile_ctx.

Referenced by av1_encode_sb_row().

## ◆ encode_tiles()

static void encode_tiles | ( | AV1_COMP * | cpi | ) |
| inline static

Break one frame into tiles and encode the tiles.

Parameters

  [in] | cpi | Top-level encoder structure

References AV1_COMP::allocated_tiles, av1_encode_tile(), CommonTileParams::cols, AV1_COMP::common, AV1_COMP::deltaq_used, AV1_COMP::intrabc_used, AV1_COMP::palette_pixel_num, CommonTileParams::rows, AV1_COMP::td, AV1_COMP::tile_data, and AV1Common::tiles.

Referenced by encode_frame_internal().

## ◆ pick_sb_modes()

static void pick_sb_modes | ( | AV1_COMP *const | cpi,
|  | TileDataEnc * | tile_data,
|  | MACROBLOCK *const | x,
|  | int | mi_row,
|  | int | mi_col,
|  | RD_STATS * | rd_cost,
|  | PARTITION_TYPE | partition,
|  | BLOCK_SIZE | bsize,
|  | PICK_MODE_CONTEXT * | ctx,
|  | RD_STATS | best_rd )
| static

Interface for AV1 mode search for an individual coding block.

Searches prediction modes, transform, and coefficient coding modes for an individual coding block. This function is the top-level interface that directs the encoder to the proper mode search function, among these implemented for inter/intra + rd/non-rd + non-skip segment/skip segment.

Parameters

  [in] | cpi | Top-level encoder structure
  [in] | tile_data | Pointer to struct holding adaptive data/contexts/models for the tile during encoding
  [in] | x | Pointer to structure holding all the data for the current macroblock
  [in] | mi_row | Row coordinate of the block in a step size of MI_SIZE
  [in] | mi_col | Column coordinate of the block in a step size of MI_SIZE
  [in] | rd_cost | Pointer to structure holding rate and distortion stats for the current block
  [in] | partition | Partition mode of the parent block
  [in] | bsize | Current block size
  [in] | ctx | Pointer to structure holding coding contexts and chosen modes for the current block
  [in] | best_rd | Upper bound of rd cost of a valid partition

Remarks
  Nothing is returned. Instead, the chosen modes and contexts necessary for reconstruction are stored in ctx, the rate-distortion stats are stored in rd_cost. If no valid mode leading to rd_cost <= best_rd, the status will be signalled by an INT64_MAX rd_cost->rdcost.

< Y (Luminance) plane

References AOM_PLANE_Y, av1_rd_pick_inter_mode(), av1_rd_pick_intra_mode_sb(), MB_MODE_INFO::bsize, macroblock_plane::coeff, AV1_COMP::common, macroblock_plane::dqcoeff, macroblock::e_mbd, MultiThreadInfo::enc_row_mt, macroblock_plane::eobs, macroblock::errorperbit, macroblockd::mi, AV1_COMP::mt_info, AV1_COMP::oxcf, SPEED_FEATURES::part_sf, MB_MODE_INFO::partition, macroblock::plane, macroblockd::plane, macroblock_plane::qcoeff, macroblock::rdmult, AV1Common::seg, MB_MODE_INFO::segment_id, AV1Common::seq_params, AV1_COMP::sf, MB_MODE_INFO::skip_mode, MB_MODE_INFO::skip_txfm, macroblock::source_variance, macroblock_plane::src, macroblockd::tx_type_map, TxfmSearchInfo::tx_type_map_, macroblockd::tx_type_map_stride, macroblock_plane::txb_entropy_ctx, and macroblock::txfm_search_info.

Referenced by av1_rd_use_partition().

## ◆ encode_b()

static void encode_b | ( | const AV1_COMP *const | cpi,
|  | TileDataEnc * | tile_data,
|  | ThreadData * | td,
|  | TokenExtra ** | tp,
|  | int | mi_row,
|  | int | mi_col,
|  | RUN_TYPE | dry_run,
|  | BLOCK_SIZE | bsize,
|  | PARTITION_TYPE | partition,
|  | PICK_MODE_CONTEXT *const | ctx,
|  | int * | rate )
| static

Reconstructs an individual coding block.

Reconstructs an individual coding block by applying the chosen modes stored in ctx, also updates mode counts and entropy models.

Parameters

  [in] | cpi | Top-level encoder structure
  [in] | tile_data | Pointer to struct holding adaptive data/contexts/models for the tile during encoding
  [in] | td | Pointer to thread data
  [in] | tp | Pointer to the starting token
  [in] | mi_row | Row coordinate of the block in a step size of MI_SIZE
  [in] | mi_col | Column coordinate of the block in a step size of MI_SIZE
  [in] | dry_run | A code indicating whether it is part of the final pass for reconstructing the superblock
  [in] | bsize | Current block size
  [in] | partition | Partition mode of the parent block
  [in] | ctx | Pointer to structure holding coding contexts and the chosen modes for the current block
  [in] | rate | Pointer to the total rate for the current block

Remarks
  Nothing is returned. Instead, reconstructions (w/o in-loop filters) will be updated in the pixel buffers in td->mb.e_mbd. Also, the chosen modes will be stored in the MB_MODE_INFO buffer td->mb.e_mbd.mi[0].

References FeatureFlags::allow_warped_motion, macroblock::cb_offset, MB_MODE_INFO_EXT_FRAME::cb_offset, AV1_COMP::common, MB_MODE_INFO::comp_group_idx, MB_MODE_INFO::compound_idx, macroblockd::current_base_qindex, AV1Common::current_frame, MB_MODE_INFO::current_qindex, macroblockd::delta_lf, MB_MODE_INFO::delta_lf, macroblockd::delta_lf_from_base, MB_MODE_INFO::delta_lf_from_base, AV1Common::delta_q_info, macroblock::e_mbd, AV1Common::features, macroblockd::global_motion, SPEED_FEATURES::inter_sf, MB_MODE_INFO::interinter_comp, macroblock::mbmi_ext, macroblock::mbmi_ext_frame, macroblockd::mi, MB_MODE_INFO::motion_mode, MB_MODE_INFO::partition, macroblock::rdmult, MB_MODE_INFO::ref_frame, AV1Common::seg, MB_MODE_INFO::segment_id, AV1Common::seq_params, AV1_COMP::sf, MB_MODE_INFO::skip_mode, MB_MODE_INFO::skip_txfm, and FeatureFlags::switchable_motion_mode.

Referenced by encode_sb().

## ◆ encode_sb()

static void encode_sb | ( | const AV1_COMP *const | cpi,
|  | ThreadData * | td,
|  | TileDataEnc * | tile_data,
|  | TokenExtra ** | tp,
|  | int | mi_row,
|  | int | mi_col,
|  | RUN_TYPE | dry_run,
|  | BLOCK_SIZE | bsize,
|  | PC_TREE * | pc_tree,
|  | int * | rate )
| static

Reconstructs a partition (may contain multiple coding blocks)

Reconstructs a sub-partition of the superblock by applying the chosen modes and partition trees stored in pc_tree.

Parameters

  [in] | cpi | Top-level encoder structure
  [in] | td | Pointer to thread data
  [in] | tile_data | Pointer to struct holding adaptive data/contexts/models for the tile during encoding
  [in] | tp | Pointer to the starting token
  [in] | mi_row | Row coordinate of the block in a step size of MI_SIZE
  [in] | mi_col | Column coordinate of the block in a step size of MI_SIZE
  [in] | dry_run | A code indicating whether it is part of the final pass for reconstructing the superblock
  [in] | bsize | Current block size
  [in] | pc_tree | Pointer to the PC_TREE node storing the picked partitions and mode info for the current block
  [in] | rate | Pointer to the total rate for the current block

Remarks
  Nothing is returned. Instead, reconstructions (w/o in-loop filters) will be updated in the pixel buffers in td->mb.e_mbd.

References AV1_COMP::common, macroblock::e_mbd, encode_b(), encode_sb(), CommonModeInfoParams::mi_cols, AV1Common::mi_params, CommonModeInfoParams::mi_rows, and macroblockd::tile_ctx.

Referenced by av1_rd_pick_partition(), av1_rd_use_partition(), and encode_sb().

## ◆ av1_rd_use_partition()

void av1_rd_use_partition | ( | AV1_COMP * | cpi,
|  | ThreadData * | td,
|  | TileDataEnc * | tile_data,
|  | MB_MODE_INFO ** | mib,
|  | TokenExtra ** | tp,
|  | int | mi_row,
|  | int | mi_col,
|  | BLOCK_SIZE | bsize,
|  | int * | rate,
|  | int64_t * | dist,
|  | int | do_recon,
|  | PC_TREE * | pc_tree )

AV1 block partition search (partition estimation and partial search).

Encode the block by applying pre-calculated partition patterns that are represented by coding block sizes stored in the mbmi array. Minor partition adjustments are tested and applied if they lead to lower rd costs. The partition types are limited to a basic set: none, horz, vert, and split.

Parameters

  [in] | cpi | Top-level encoder structure
  [in] | td | Pointer to thread data
  [in] | tile_data | Pointer to struct holding adaptive data/contexts/models for the tile during encoding
  [in] | mib | Array representing MB_MODE_INFO pointers for mi blocks starting from the first pixel of the current block
  [in] | tp | Pointer to the starting token
  [in] | mi_row | Row coordinate of the block in a step size of MI_SIZE
  [in] | mi_col | Column coordinate of the block in a step size of MI_SIZE
  [in] | bsize | Current block size
  [in] | rate | Pointer to the final rate for encoding the current block
  [in] | dist | Pointer to the final distortion of the current block
  [in] | do_recon | Whether the reconstruction function needs to be run, either for finalizing a superblock or providing reference for future sub-partitions
  [in] | pc_tree | Pointer to the PC_TREE node holding the picked partitions and mode info for the current block

Remarks
  Nothing is returned. The pc_tree struct is modified to store the picked partition and modes. The rate and dist are also updated with those corresponding to the best partition found.

References AV1Common::above_contexts, macroblockd::above_txfm_context, AOM_CODEC_MEM_ERROR, av1_rd_use_partition(), MB_MODE_INFO::bsize, macroblock::cb_offset, AV1_COMP::common, macroblock::e_mbd, encode_sb(), macroblockd::error_info, macroblockd::left_txfm_context, macroblockd::left_txfm_context_buffer, macroblock::mb_energy, CommonModeInfoParams::mi_cols, AV1Common::mi_params, CommonModeInfoParams::mi_rows, CommonModeInfoParams::mi_stride, macroblock::mode_costs, SPEED_FEATURES::part_sf, ModeCosts::partition_cost, pick_sb_modes(), macroblock::rdmult, AV1Common::seq_params, AV1_COMP::sf, macroblock::try_merge_partition, CommonContexts::txfm, and AV1_COMP::vaq_refresh.

Referenced by av1_rd_use_partition(), and encode_rd_sb().

## ◆ pick_sb_modes_nonrd()

static void pick_sb_modes_nonrd | ( | AV1_COMP *const | cpi,
|  | TileDataEnc * | tile_data,
|  | MACROBLOCK *const | x,
|  | int | mi_row,
|  | int | mi_col,
|  | RD_STATS * | rd_cost,
|  | BLOCK_SIZE | bsize,
|  | PICK_MODE_CONTEXT * | ctx )
| static

Top level function to pick block mode for non-RD optimized case.

Searches prediction modes, transform, and coefficient coding modes for an individual coding block. This function is the top-level function that is used for non-RD optimized mode search (controlled by `cpi->sf.rt_sf.use_nonrd_pick_mode`). Depending on frame type it calls inter/skip/hybrid-intra mode search functions

Parameters

  [in] | cpi | Top-level encoder structure
  [in] | tile_data | Pointer to struct holding adaptive data/contexts/models for the tile during encoding
  [in] | x | Pointer to structure holding all the data for the current macroblock
  [in] | mi_row | Row coordinate of the block in a step size of MI_SIZE
  [in] | mi_col | Column coordinate of the block in a step size of MI_SIZE
  [in] | rd_cost | Pointer to structure holding rate and distortion stats for the current block
  [in] | bsize | Current block size
  [in] | ctx | Pointer to structure holding coding contexts and chosen modes for the current block

Remarks
  Nothing is returned. Instead, the chosen modes and contexts necessary for reconstruction are stored in ctx, the rate-distortion stats are stored in rd_cost. If no valid mode leading to rd_cost <= best_rd, the status will be signalled by an INT64_MAX rd_cost->rdcost.

< Y (Luminance) plane

< U (Chroma) plane

< V (Chroma) plane

References AOM_PLANE_U, AOM_PLANE_V, AOM_PLANE_Y, av1_nonrd_pick_inter_mode_sb(), MB_MODE_INFO::cdef_strength, macroblock_plane::coeff, COLOR_SENS_IDX, macroblock::color_sensitivity, AV1_COMP::common, macroblock_plane::dqcoeff, macroblock::e_mbd, MultiThreadInfo::enc_row_mt, macroblock_plane::eobs, macroblock::errorperbit, macroblock::force_zeromv_skip_for_blk, AV1Common::height, hybrid_intra_mode_search(), macroblock::last_set_offsets_loc, macroblockd::mi, CommonModeInfoParams::mi_grid_base, AV1Common::mi_params, MB_MODE_INFO::mode, AV1_COMP::mt_info, AV1_COMP::oxcf, macroblock::plane, macroblockd::plane, macroblock_plane::qcoeff, AV1_COMP::rc, macroblock::rdmult, SPEED_FEATURES::rt_sf, AV1Common::seg, MB_MODE_INFO::segment_id, AV1Common::seq_params, AV1_COMP::sf, macroblock::source_variance, macroblock_plane::src, macroblockd::tx_type_map, TxfmSearchInfo::tx_type_map_, macroblockd::tx_type_map_stride, macroblock_plane::txb_entropy_ctx, macroblock::txfm_search_info, and AV1Common::width.

Referenced by av1_nonrd_use_partition().

## ◆ av1_nonrd_use_partition()

void av1_nonrd_use_partition | ( | AV1_COMP * | cpi,
|  | ThreadData * | td,
|  | TileDataEnc * | tile_data,
|  | MB_MODE_INFO ** | mib,
|  | TokenExtra ** | tp,
|  | int | mi_row,
|  | int | mi_col,
|  | BLOCK_SIZE | bsize,
|  | PC_TREE * | pc_tree )

AV1 block partition application (minimal RD search).

Encode the block by applying pre-calculated partition patterns that are represented by coding block sizes stored in the mbmi array. The only partition adjustment allowed is merging leaf split nodes if it leads to a lower rd cost. The partition types are limited to a basic set: none, horz, vert, and split. This function is only used in the real-time mode.

Parameters

  [in] | cpi | Top-level encoder structure
  [in] | td | Pointer to thread data
  [in] | tile_data | Pointer to struct holding adaptive data/contexts/models for the tile during encoding
  [in] | mib | Array representing MB_MODE_INFO pointers for mi blocks starting from the first pixel of the current block
  [in] | tp | Pointer to the starting token
  [in] | mi_row | Row coordinate of the block in a step size of MI_SIZE
  [in] | mi_col | Column coordinate of the block in a step size of MI_SIZE
  [in] | bsize | Current block size
  [in] | pc_tree | Pointer to the PC_TREE node holding the picked partitions and mode info for the current block

Remarks
  Nothing is returned. The pc_tree struct is modified to store the picked partition and modes.

References AV1Common::above_contexts, macroblockd::above_txfm_context, AOM_CODEC_MEM_ERROR, av1_nonrd_use_partition(), AV1_COMP::common, macroblock::e_mbd, macroblockd::error_info, macroblockd::left_txfm_context, macroblockd::left_txfm_context_buffer, CommonModeInfoParams::mi_cols, AV1Common::mi_params, CommonModeInfoParams::mi_rows, CommonModeInfoParams::mi_stride, macroblock::mode_costs, ModeCosts::partition_cost, pick_sb_modes_nonrd(), macroblock::reuse_inter_pred, SPEED_FEATURES::rt_sf, AV1_COMP::sf, and CommonContexts::txfm.

Referenced by av1_nonrd_use_partition(), and encode_nonrd_sb().

## ◆ av1_rd_pick_partition()

bool av1_rd_pick_partition | ( | AV1_COMP *const | cpi,
|  | ThreadData * | td,
|  | TileDataEnc * | tile_data,
|  | TokenExtra ** | tp,
|  | int | mi_row,
|  | int | mi_col,
|  | BLOCK_SIZE | bsize,
|  | RD_STATS * | rd_cost,
|  | RD_STATS | best_rdc,
|  | PC_TREE * | pc_tree,
|  | SIMPLE_MOTION_DATA_TREE * | sms_tree,
|  | int64_t * | none_rd,
|  | SB_MULTI_PASS_MODE | multi_pass_mode,
|  | RD_RECT_PART_WIN_INFO * | rect_part_win_info )

AV1 block partition search (full search).

Searches for the best partition pattern for a block based on the rate-distortion cost, and returns a bool value to indicate whether a valid partition pattern is found. The partition can recursively go down to the smallest block size.

Parameters

  [in] | cpi | Top-level encoder structure
  [in] | td | Pointer to thread data
  [in] | tile_data | Pointer to struct holding adaptive data/contexts/models for the tile during encoding
  [in] | tp | Pointer to the starting token
  [in] | mi_row | Row coordinate of the block in a step size of MI_SIZE
  [in] | mi_col | Column coordinate of the block in a step size of MI_SIZE
  [in] | bsize | Current block size
  [in] | rd_cost | Pointer to the final rd cost of the block
  [in] | best_rdc | Upper bound of rd cost of a valid partition
  [in] | pc_tree | Pointer to the PC_TREE node storing the picked partitions and mode info for the current block
  [in] | sms_tree | Pointer to struct holding simple motion search data for the current block
  [in] | none_rd | Pointer to the rd cost in the case of not splitting the current block
  [in] | multi_pass_mode | SB_SINGLE_PASS/SB_DRY_PASS/SB_WET_PASS
  [in] | rect_part_win_info | Pointer to struct storing whether horz/vert partition outperforms previously tested partitions

Returns
  A bool value is returned indicating if a valid partition is found. The pc_tree struct is modified to store the picked partition and modes. The rd_cost struct is also updated with the RD stats corresponding to the best partition found.

< Y (Luminance) plane

References AV1Common::above_contexts, macroblockd::above_txfm_context, AOM_PLANE_Y, TxfmSearchInfo::blk_skip, macroblock::cb_offset, AV1_COMP::common, AV1Common::current_frame, macroblock::e_mbd, encode_sb(), AV1_COMP::gf_frame_index, AV1_PRIMARY::gf_group, macroblock::intra_sb_rdmult_modifier, macroblockd::left_txfm_context, macroblockd::left_txfm_context_buffer, SuperBlockEnc::max_partition_size, macroblock::mb_energy, macroblock::must_find_valid_partition, AV1_COMP::oxcf, SPEED_FEATURES::part_sf, macroblock::plane, AV1_COMP::ppi, macroblock::qindex, macroblock::rdmult, AV1_COMP::sb_counter, macroblock::sb_enc, AV1Common::seq_params, AV1_COMP::sf, AV1Common::show_frame, AV1_COMP::source, macroblock_plane::src, CommonContexts::txfm, macroblock::txfm_search_info, and AV1_COMP::vaq_refresh.

Referenced by encode_rd_sb().