AOMedia AV1 Codec
|
Functions | |
int64_t | av1_interpolation_filter_search (MACROBLOCK *const x, const AV1_COMP *const cpi, const TileDataEnc *tile_data, BLOCK_SIZE bsize, const BUFFER_SET *const tmp_dst, const BUFFER_SET *const orig_dst, int64_t *const rd, int *const switchable_rate, int *skip_build_pred, HandleInterModeArgs *args, int64_t ref_best_rd) |
AV1 interpolation filter search. | |
void | av1_rd_pick_inter_mode (struct AV1_COMP *cpi, struct TileDataEnc *tile_data, struct macroblock *x, struct RD_STATS *rd_cost, BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx, int64_t best_rd_so_far) |
AV1 inter mode selection. | |
static int64_t | motion_mode_rd (const AV1_COMP *const cpi, TileDataEnc *tile_data, MACROBLOCK *const x, BLOCK_SIZE bsize, RD_STATS *rd_stats, RD_STATS *rd_stats_y, RD_STATS *rd_stats_uv, HandleInterModeArgs *const args, int64_t ref_best_rd, int64_t *ref_skip_rd, int *rate_mv, const BUFFER_SET *orig_dst, int64_t *best_est_rd, int do_tx_search, InterModesInfo *inter_modes_info, int eval_motion_mode, int64_t *yrd) |
AV1 motion mode search. | |
static int | process_compound_inter_mode (AV1_COMP *const cpi, MACROBLOCK *x, HandleInterModeArgs *args, int64_t ref_best_rd, int_mv *cur_mv, BLOCK_SIZE bsize, int *compmode_interinter_cost, const CompoundTypeRdBuffers *rd_buffers, const BUFFER_SET *orig_dst, const BUFFER_SET *tmp_dst, int *rate_mv, RD_STATS *rd_stats, int64_t *skip_rd, int *skip_build_pred) |
High level function to select parameters for compound mode. | |
static int | prune_zero_mv_with_sse (const aom_variance_fn_ptr_t *fn_ptr, const MACROBLOCK *x, BLOCK_SIZE bsize, const HandleInterModeArgs *args, int prune_zero_mv_with_sse) |
Prunes ZeroMV Search Using Best NEWMV's SSE. | |
static bool | fast_interp_search (const AV1_COMP *cpi, MACROBLOCK *x, int mi_row, int mi_col, BLOCK_SIZE bsize) |
Searches for interpolation filter in realtime mode during winner eval. | |
static int64_t | handle_inter_mode (AV1_COMP *const cpi, TileDataEnc *tile_data, MACROBLOCK *x, BLOCK_SIZE bsize, RD_STATS *rd_stats, RD_STATS *rd_stats_y, RD_STATS *rd_stats_uv, HandleInterModeArgs *args, int64_t ref_best_rd, uint8_t *const tmp_buf, const CompoundTypeRdBuffers *rd_buffers, int64_t *best_est_rd, const int do_tx_search, InterModesInfo *inter_modes_info, motion_mode_candidate *motion_mode_cand, int64_t *skip_rd, PruneInfoFromTpl *inter_cost_info_from_tpl, int64_t *yrd) |
AV1 inter mode RD computation. | |
This module describes inter mode search algorithm in AV1. More details will be added.
int64_t av1_interpolation_filter_search | ( | MACROBLOCK *const | x, |
const AV1_COMP *const | cpi, | ||
const TileDataEnc * | tile_data, | ||
BLOCK_SIZE | bsize, | ||
const BUFFER_SET *const | tmp_dst, | ||
const BUFFER_SET *const | orig_dst, | ||
int64_t *const | rd, | ||
int *const | switchable_rate, | ||
int * | skip_build_pred, | ||
HandleInterModeArgs * | args, | ||
int64_t | ref_best_rd ) |
AV1 interpolation filter search.
[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 struc holding all the data for the current macroblock. |
[in] | bsize | Current block size. |
[in] | tmp_dst | A temporary prediction buffer to hold a computed prediction. |
[in,out] | orig_dst | A prediction buffer to hold a computed prediction. This will eventually hold the final prediction, and the tmp_dst info will be copied here. |
[in,out] | rd | The RD cost associated with the selected interpolation filter parameters. |
[in,out] | switchable_rate | The rate associated with using a SWITCHABLE filter mode. |
[in,out] | skip_build_pred | Indicates whether or not to build the inter predictor. If this is 0, the inter predictor has already been built and thus we can avoid repeating computation. |
[in] | args | HandleInterModeArgs struct holding miscellaneous arguments for inter mode search. See the documentation for this struct for a description of each member. |
[in] | ref_best_rd | Best RD found so far for this block. It is used for early termination of this search if the RD exceeds this value. |
< Y (Luminance) plane
< Y (Luminance) plane
< U (Chroma) plane
< V (Chroma) plane
< Y (Luminance) plane
< Y (Luminance) plane
References AOM_PLANE_U, AOM_PLANE_V, AOM_PLANE_Y, av1_pick_recursive_tx_size_type_yrd(), AV1_COMP::common, InterpSearchFlags::default_interp_skip_flags, macroblock::e_mbd, AV1Common::features, FeatureFlags::interp_filter, MB_MODE_INFO::interp_filters, AV1_COMP::interp_search_flags, SPEED_FEATURES::interp_sf, macroblockd::mi, macroblockd::mi_col, macroblockd::mi_row, MB_MODE_INFO::mode, macroblock::pred_sse, macroblock::rdmult, macroblock::recalc_luma_mc_data, MB_MODE_INFO::ref_frame, MB_MODE_INFO::ref_mv_idx, AV1Common::seq_params, and AV1_COMP::sf.
Referenced by handle_inter_mode().
void av1_rd_pick_inter_mode | ( | struct AV1_COMP * | cpi, |
struct TileDataEnc * | tile_data, | ||
struct macroblock * | x, | ||
struct RD_STATS * | rd_cost, | ||
BLOCK_SIZE | bsize, | ||
PICK_MODE_CONTEXT * | ctx, | ||
int64_t | best_rd_so_far ) |
AV1 inter mode selection.
Top level function for inter mode selection. This function will loop over all possible inter modes and select the best one for the current block by computing the RD cost. The mode search and RD are computed in handle_inter_mode(), which is called from this function within the main loop.
[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] | rd_cost | Struct to keep track of the RD information |
[in] | bsize | Current block size |
[in] | ctx | Structure to hold snapshot of coding context during the mode picking process |
[in] | best_rd_so_far | Best RD seen for this block so far |
References AV1EncoderConfig::algo_cfg, FeatureFlags::allow_screen_content_tools, MB_MODE_INFO::angle_delta, av1_restore_uv_color_map(), av1_search_palette_mode(), TxfmSearchInfo::blk_skip, MB_MODE_INFO::bsize, AV1_COMP::common, ModeCosts::comp_inter_cost, macroblock::comp_rd_buffer, AV1Common::cur_frame, AV1Common::current_frame, macroblock::e_mbd, AlgoCfg::enable_tpl_model, AV1Common::features, MB_MODE_INFO::filter_intra_mode_info, handle_inter_mode(), AV1Common::height, macroblock::inter_modes_info, SPEED_FEATURES::inter_sf, FeatureFlags::interp_filter, MB_MODE_INFO::interp_filters, SPEED_FEATURES::intra_sf, macroblockd::mi, macroblockd::mi_col, macroblockd::mi_row, MB_MODE_INFO::mode, macroblock::mode_costs, MB_MODE_INFO::mv, inter_modes_info::num, WARP_SAMPLE_INFO::num, AV1_COMP::oxcf, MB_MODE_INFO::palette_mode_info, MB_MODE_INFO::partition, macroblockd::plane, macroblock::pred_sse, macroblock::qindex, AV1_COMP::rc, macroblock::rdmult, MB_MODE_INFO::ref_mv_idx, search_intra_modes_in_interframe(), AV1Common::seg, MB_MODE_INFO::segment_id, AV1Common::seq_params, AV1_COMP::sf, motion_mode_candidate::skip_motion_mode, MB_MODE_INFO::skip_txfm, TxfmSearchInfo::skip_txfm, AV1_COMP::speed, macroblock::thresh_freq_fact, macroblock::tmp_pred_bufs, macroblock::tpl_keep_ref_frame, macroblockd::tx_type_map, macroblock::txfm_search_info, macroblock::warp_sample_info, AV1Common::width, macroblock::winner_mode_count, SPEED_FEATURES::winner_mode_sf, and macroblock::winner_mode_stats.
Referenced by pick_sb_modes().
|
static |
AV1 motion mode search.
Function to search over and determine the motion mode. It will update mbmi->motion_mode to one of SIMPLE_TRANSLATION, OBMC_CAUSAL, or WARPED_CAUSAL and determine any necessary side information for the selected motion mode. It will also perform the full transform search, unless the input parameter do_tx_search indicates to do an estimation of the RD rather than an RD corresponding to a full transform search. It will return the RD for the final motion_mode. Do the RD search for a given inter mode and compute all information relevant to the input mode. It will compute the best MV, compound parameters (if the mode is a compound mode) and interpolation filter 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 struct holding all the data for the current macroblock. |
[in] | bsize | Current block size. |
[in,out] | rd_stats | Struct to keep track of the overall RD information. |
[in,out] | rd_stats_y | Struct to keep track of the RD information for only the Y plane. |
[in,out] | rd_stats_uv | Struct to keep track of the RD information for only the UV planes. |
[in] | args | HandleInterModeArgs struct holding miscellaneous arguments for inter mode search. See the documentation for this struct for a description of each member. |
[in] | ref_best_rd | Best RD found so far for this block. It is used for early termination of this search if the RD exceeds this value. |
[in,out] | ref_skip_rd | A length 2 array, where skip_rd[0] is the best total RD for a skip mode so far, and skip_rd[1] is the best RD for a skip mode so far in luma. This is used as a speed feature to skip the transform search if the computed skip RD for the current mode is not better than the best skip_rd so far. |
[in,out] | rate_mv | The rate associated with the motion vectors. This will be modified if a motion search is done in the motion mode search. |
[in,out] | orig_dst | A prediction buffer to hold a computed prediction. This will eventually hold the final prediction, and the tmp_dst info will be copied here. |
[in,out] | best_est_rd | Estimated RD for motion mode search if do_tx_search (see below) is 0. |
[in] | do_tx_search | Parameter to indicate whether or not to do a full transform search. This will compute an estimated RD for the modes without the transform search and later perform the full transform search on the best candidates. |
[in] | inter_modes_info | InterModesInfo struct to hold inter mode information to perform a full transform search only on winning candidates searched with an estimate for transform coding RD. |
[in] | eval_motion_mode | Boolean whether or not to evaluate motion motion modes other than SIMPLE_TRANSLATION. |
[out] | yrd | Stores the rdcost corresponding to encoding the luma plane. |
References FeatureFlags::allow_warped_motion, av1_txfm_search(), TxfmSearchInfo::blk_skip, MB_MODE_INFO::bsize, AV1_COMP::common, MB_MODE_INFO::compound_idx, AV1Common::current_frame, macroblock::e_mbd, AV1Common::features, AV1_PRIMARY::frame_probs, AV1_COMP::gf_frame_index, AV1_PRIMARY::gf_group, macroblockd::global_motion, macroblockd::height, SPEED_FEATURES::inter_sf, ModeCosts::interintra_cost, FeatureFlags::interp_filter, MB_MODE_INFO::interp_filters, macroblockd::mi, macroblockd::mi_col, macroblockd::mi_row, MB_MODE_INFO::mode, macroblock::mode_costs, MB_MODE_INFO::motion_mode, ModeCosts::motion_mode_cost, ModeCosts::motion_mode_cost1, MB_MODE_INFO::mv, MvCosts::mv_cost_stack, macroblock::mv_costs, SPEED_FEATURES::mv_sf, MvCosts::nmv_joint_cost, WARP_SAMPLE_INFO::num, MB_MODE_INFO::num_proj_ref, FrameProbInfo::obmc_probs, AV1_COMP::oxcf, AV1_COMP::ppi, WARP_SAMPLE_INFO::pts, WARP_SAMPLE_INFO::pts_inref, macroblock::rdmult, MB_MODE_INFO::ref_frame, MB_MODE_INFO::ref_mv_idx, SPEED_FEATURES::rt_sf, AV1Common::seq_params, AV1_COMP::sf, MB_MODE_INFO::skip_txfm, TxfmSearchInfo::skip_txfm, ModeCosts::skip_txfm_cost, FeatureFlags::switchable_motion_mode, macroblockd::tx_type_map, macroblock::txfm_search_info, macroblock::warp_sample_info, macroblockd::width, and MB_MODE_INFO::wm_params.
Referenced by handle_inter_mode().
|
static |
High level function to select parameters for compound mode.
The main search functionality is done in the call to av1_compound_type_rd().
[in] | cpi | Top-level encoder structure. |
[in] | x | Pointer to struct holding all the data for the current macroblock. |
[in] | args | HandleInterModeArgs struct holding miscellaneous arguments for inter mode search. See the documentation for this struct for a description of each member. |
[in] | ref_best_rd | Best RD found so far for this block. It is used for early termination of this search if the RD exceeds this value. |
[in,out] | cur_mv | Current motion vector. |
[in] | bsize | Current block size. |
[in,out] | compmode_interinter_cost | RD of the selected interinter compound mode. |
[in,out] | rd_buffers | CompoundTypeRdBuffers struct to hold all allocated buffers for the compound predictors and masks in the compound type search. |
[in,out] | orig_dst | A prediction buffer to hold a computed prediction. This will eventually hold the final prediction, and the tmp_dst info will be copied here. |
[in] | tmp_dst | A temporary prediction buffer to hold a computed prediction. |
[in,out] | rate_mv | The rate associated with the motion vectors. This will be modified if a motion search is done in the motion mode search. |
[in,out] | rd_stats | Struct to keep track of the overall RD information. |
[in,out] | skip_rd | An array of length 2 where skip_rd[0] is the best total RD for a skip mode so far, and skip_rd[1] is the best RD for a skip mode so far in luma. This is used as a speed feature to skip the transform search if the computed skip RD for the current mode is not better than the best skip_rd so far. |
[in,out] | skip_build_pred | Indicates whether or not to build the inter predictor. If this is 0, the inter predictor has already been built and thus we can avoid repeating computation. |
< U (Chroma) plane
References AOM_PLANE_U, AV1_COMP::common, macroblock::e_mbd, AV1Common::features, MB_MODE_INFO::interinter_comp, FeatureFlags::interp_filter, macroblockd::mi, macroblockd::mi_col, macroblockd::mi_row, and AV1Common::seq_params.
Referenced by handle_inter_mode().
|
inlinestatic |
Prunes ZeroMV Search Using Best NEWMV's SSE.
Compares the sse of zero mv and the best sse found in single new_mv. If the sse of the zero_mv is higher, returns 1 to signal zero_mv can be skipped. Else returns 0.
Note that the sse of here comes from single_motion_search. So it is interpolated with the filter in motion search, not the actual interpolation filter used in encoding.
[in] | fn_ptr | A table of function pointers to compute SSE. |
[in] | x | Pointer to struct holding all the data for the current macroblock. |
[in] | bsize | The current block_size. |
[in] | args | The args to handle_inter_mode, used to track the best SSE. |
[in] | prune_zero_mv_with_sse | The argument holds speed feature prune_zero_mv_with_sse value |
< Y (Luminance) plane
References AOM_PLANE_Y, macroblock::e_mbd, macroblockd::global_motion, macroblockd::mi, MB_MODE_INFO::mv, macroblock::plane, macroblockd::plane, prune_zero_mv_with_sse(), MB_MODE_INFO::ref_frame, and macroblock_plane::src.
Referenced by handle_inter_mode(), and prune_zero_mv_with_sse().
|
inlinestatic |
Searches for interpolation filter in realtime mode during winner eval.
Does a simple interpolation filter search during winner mode evaluation. This is currently only used by realtime mode as av1_interpolation_filter_search is not called during realtime encoding.
This function only searches over two possible filters. EIGHTTAP_REGULAR is always search. For lowres clips (<= 240p), MULTITAP_SHARP is also search. For higher res slips (>240p), EIGHTTAP_SMOOTH is also searched.
[in] | cpi | Pointer to the compressor. Used for feature flags. |
[in,out] | x | Pointer to macroblock. This is primarily used to access the buffers. |
[in] | mi_row | The current row in mi unit (4X4 pixels). |
[in] | mi_col | The current col in mi unit (4X4 pixels). |
[in] | bsize | The current block_size. |
< Y (Luminance) plane
< Y (Luminance) plane
< Y (Luminance) plane
< Y (Luminance) plane
< Y (Luminance) plane
< Y (Luminance) plane
< Y (Luminance) plane
< Y (Luminance) plane
< Y (Luminance) plane
< Y (Luminance) plane
< Y (Luminance) plane
< Y (Luminance) plane
< U (Chroma) plane
< V (Chroma) plane
References AOM_PLANE_U, AOM_PLANE_V, AOM_PLANE_Y, AV1_COMP::common, macroblock::e_mbd, AV1Common::features, AV1Common::height, FeatureFlags::interp_filter, MB_MODE_INFO::interp_filters, macroblockd::mi, MB_MODE_INFO::mode, MB_MODE_INFO::motion_mode, macroblockd::plane, SPEED_FEATURES::rt_sf, AV1Common::seq_params, AV1_COMP::sf, macroblock::tmp_pred_bufs, and AV1Common::width.
|
static |
AV1 inter mode RD computation.
Do the RD search for a given inter mode and compute all information relevant to the input mode. It will compute the best MV, compound parameters (if the mode is a compound mode) and interpolation filter 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] | bsize | Current block size. |
[in,out] | rd_stats | Struct to keep track of the overall RD information. |
[in,out] | rd_stats_y | Struct to keep track of the RD information for only the Y plane. |
[in,out] | rd_stats_uv | Struct to keep track of the RD information for only the UV planes. |
[in] | args | HandleInterModeArgs struct holding miscellaneous arguments for inter mode search. See the documentation for this struct for a description of each member. |
[in] | ref_best_rd | Best RD found so far for this block. It is used for early termination of this search if the RD exceeds this value. |
[in] | tmp_buf | Temporary buffer used to hold predictors built in this search. |
[in,out] | rd_buffers | CompoundTypeRdBuffers struct to hold all allocated buffers for the compound predictors and masks in the compound type search. |
[in,out] | best_est_rd | Estimated RD for motion mode search if do_tx_search (see below) is 0. |
[in] | do_tx_search | Parameter to indicate whether or not to do a full transform search. This will compute an estimated RD for the modes without the transform search and later perform the full transform search on the best candidates. |
[in,out] | inter_modes_info | InterModesInfo struct to hold inter mode information to perform a full transform search only on winning candidates searched with an estimate for transform coding RD. |
[in,out] | motion_mode_cand | A motion_mode_candidate struct to store motion mode information used in a speed feature to search motion modes other than SIMPLE_TRANSLATION only on winning candidates. |
[in,out] | skip_rd | A length 2 array, where skip_rd[0] is the best total RD for a skip mode so far, and skip_rd[1] is the best RD for a skip mode so far in luma. This is used as a speed feature to skip the transform search if the computed skip RD for the current mode is not better than the best skip_rd so far. |
[in] | inter_cost_info_from_tpl | A PruneInfoFromTpl struct used to narrow down the search based on data collected in the TPL model. |
[out] | yrd | Stores the rdcost corresponding to encoding the luma plane. |
References av1_interpolation_filter_search(), TxfmSearchInfo::blk_skip, AV1_COMP::common, MB_MODE_INFO::comp_group_idx, MB_MODE_INFO::compound_idx, ModeCosts::drl_mode_cost0, macroblock::e_mbd, AV1_PRIMARY::fn_ptr, AV1_COMP::gf_frame_index, SPEED_FEATURES::gm_sf, macroblockd::height, SPEED_FEATURES::inter_sf, MB_MODE_INFO::interinter_comp, macroblock::mbmi_ext, macroblockd::mi, macroblockd::mi_col, CommonModeInfoParams::mi_cols, AV1Common::mi_params, macroblockd::mi_row, CommonModeInfoParams::mi_rows, MB_MODE_INFO::mode, MB_MODE_INFO_EXT::mode_context, macroblock::mode_costs, MB_MODE_INFO::motion_mode, motion_mode_rd(), MB_MODE_INFO::mv, MB_MODE_INFO::num_proj_ref, macroblockd::plane, AV1_COMP::ppi, macroblock::pred_sse, process_compound_inter_mode(), prune_zero_mv_with_sse(), motion_mode_candidate::rate2_nocoeff, motion_mode_candidate::rate_mv, macroblock::rdmult, MB_MODE_INFO::ref_frame, MB_MODE_INFO::ref_mv_idx, SPEED_FEATURES::rt_sf, AV1_COMP::sf, TxfmSearchInfo::skip_txfm, AV1_PRIMARY::tpl_data, macroblockd::tx_type_map, macroblock::txfm_search_info, macroblockd::width, and SPEED_FEATURES::winner_mode_sf.
Referenced by av1_rd_pick_inter_mode().