![]() |
AOMedia AV1 Codec
|
Functions | |
void | av1_nonrd_pick_intra_mode (AV1_COMP *cpi, MACROBLOCK *x, RD_STATS *rd_cost, BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx) |
AV1 intra mode selection based on Non-RD optimized model. More... | |
void | av1_nonrd_pick_inter_mode_sb (struct AV1_COMP *cpi, struct TileDataEnc *tile_data, struct macroblock *x, struct RD_STATS *rd_cost, BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx) |
AV1 inter mode selection based on Non-RD optimized model. More... | |
static void | find_predictors (AV1_COMP *cpi, MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame, int_mv frame_mv[MB_MODE_COUNT][REF_FRAMES], TileDataEnc *tile_data, struct buf_2d yv12_mb[8][3], BLOCK_SIZE bsize, int force_skip_low_temp_var, int skip_pred_mv) |
Finds predicted motion vectors for a block. More... | |
static int | combined_motion_search (AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row, int mi_col, int_mv *tmp_mv, int *rate_mv, int64_t best_rd_sofar, int use_base_mv) |
Runs Motion Estimation for a specific block and specific ref frame. More... | |
static int | search_new_mv (AV1_COMP *cpi, MACROBLOCK *x, int_mv frame_mv[][REF_FRAMES], MV_REFERENCE_FRAME ref_frame, int gf_temporal_ref, BLOCK_SIZE bsize, int mi_row, int mi_col, int *rate_mv, RD_STATS *best_rdc) |
Searches for the best New Motion Vector. More... | |
void | av1_block_yrd (const AV1_COMP *const cpi, MACROBLOCK *x, int mi_row, int mi_col, RD_STATS *this_rdc, int *skippable, BLOCK_SIZE bsize, TX_SIZE tx_size, TX_TYPE tx_type, int is_inter_mode) |
Calculates RD Cost using Hadamard transform. More... | |
static void | estimate_block_intra (int plane, int block, int row, int col, BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg) |
Estimation of RD cost of an intra mode for Non-RD optimized case. More... | |
static void | search_filter_ref (AV1_COMP *cpi, MACROBLOCK *x, RD_STATS *this_rdc, int mi_row, int mi_col, PRED_BUFFER *tmp, BLOCK_SIZE bsize, int reuse_inter_pred, PRED_BUFFER **this_mode_pred, int *this_early_term, int use_model_yrd_large, int64_t best_sse) |
Searches for the best intrpolation filter. More... | |
static void | estimate_intra_mode (AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int use_modeled_non_rd_cost, int best_early_term, unsigned int ref_cost_intra, int reuse_prediction, struct buf_2d *orig_dst, PRED_BUFFER *tmp_buffers, PRED_BUFFER **this_mode_pred, RD_STATS *best_rdc, BEST_PICKMODE *best_pickmode, PICK_MODE_CONTEXT *ctx) |
Estimates best intra mode for inter mode search. More... | |
This module describes NonRD Optimized Mode Search used in Real-Time mode. More details will be added.
void av1_nonrd_pick_intra_mode | ( | AV1_COMP * | cpi, |
MACROBLOCK * | x, | ||
RD_STATS * | rd_cost, | ||
BLOCK_SIZE | bsize, | ||
PICK_MODE_CONTEXT * | ctx | ||
) |
AV1 intra mode selection based on Non-RD optimized model.
Top level function for Non-RD optimized intra mode selection. This finction will loop over subset of intra modes and select the best one based on calculated modelled RD cost. Only 4 intra modes are checked as specified in intra_mode_list
. When calculating RD cost Hadamard transform of residual is used to calculate rate. Estmation of RD cost is performed in estimate_block_intra
which is called from this function
[in] | cpi | Top-level encoder structure |
[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 |
References macroblockd::above_mbmi, TxfmSearchInfo::blk_skip, macroblock::e_mbd, estimate_block_intra(), macroblockd::left_mbmi, macroblockd::mi, MB_MODE_INFO::mode, macroblock::mode_costs, MB_MODE_INFO::mv, macroblock::rdmult, ModeCosts::skip_txfm_cost, TxfmSearchParams::tx_mode_search_type, MB_MODE_INFO::tx_size, macroblock::txfm_search_info, macroblock::txfm_search_params, MB_MODE_INFO::uv_mode, and ModeCosts::y_mode_costs.
Referenced by hybrid_intra_mode_search().
void av1_nonrd_pick_inter_mode_sb | ( | struct AV1_COMP * | cpi, |
struct TileDataEnc * | tile_data, | ||
struct macroblock * | x, | ||
struct RD_STATS * | rd_cost, | ||
BLOCK_SIZE | bsize, | ||
PICK_MODE_CONTEXT * | ctx | ||
) |
AV1 inter mode selection based on Non-RD optimized model.
Top level function for Non-RD optimized inter mode selection. This finction will loop over subset of inter modes and select the best one based on calculated modelled RD cost. While making decisions which modes to check, this function applies heuristics based on previously checked modes, block residual variance, block size, and other factors to prune certain modes and reference frames. Currently only single reference frame modes are checked. Additional heuristics are applied to decide if intra modes need to be checked.
[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 |
< U (Chroma) plane
< U (Chroma) plane
< V (Chroma) plane
< V (Chroma) plane
References macroblock::e_mbd, AV1Common::features, FeatureFlags::interp_filter, macroblockd::mi, macroblockd::plane, MB_MODE_INFO::segment_id, and macroblock::thresh_freq_fact.
Referenced by pick_sb_modes_nonrd().
|
inlinestatic |
Finds predicted motion vectors for a block.
Finds predicted motion vectors for a block from a certain reference frame. First, it fills reference MV stack, then picks the test from the stack and predicts the final MV for a block for each mode.
[in] | cpi | Top-level encoder structure |
[in] | x | Pointer to structure holding all the data for the current macroblock |
[in] | ref_frame | Reference frame for which to find ref MVs |
[in] | frame_mv | Predicted MVs for a block |
[in] | tile_data | Pointer to struct holding adaptive data/contexts/models for the tile during encoding |
[in] | yv12_mb | Buffer to hold predicted block |
[in] | bsize | Current block size |
[in] | force_skip_low_temp_var | Flag indicating possible mode search prune for low temporal variance block |
[in] | skip_pred_mv | Flag indicating to skip av1_mv_pred |
frame_mv
array References FeatureFlags::allow_high_precision_mv, macroblock::e_mbd, AV1Common::features, MB_MODE_INFO_EXT::global_mvs, macroblock::mbmi_ext, macroblockd::mi, MB_MODE_INFO_EXT::mode_context, MB_MODE_INFO::num_proj_ref, macroblock::pred_mv0_sad, macroblock::pred_mv1_sad, macroblock::pred_mv_sad, MB_MODE_INFO_EXT::ref_mv_count, macroblockd::ref_mv_stack, and macroblockd::weight.
|
static |
Runs Motion Estimation for a specific block and specific ref frame.
Finds the best Motion Vector by running Motion Estimation for a specific block and a specific reference frame. Exits early if RDCost of Full Pel part exceeds best RD Cost fund so far
[in] | cpi | Top-level encoder structure |
[in] | x | Pointer to structure holding all the data for the current macroblock |
[in] | bsize | Current block size |
[in] | mi_row | Row index in 4x4 units |
[in] | mi_col | Column index in 4x4 units |
[in] | tmp_mv | Pointer to best found New MV |
[in] | rate_mv | Pointer to Rate of the best new MV |
[in] | best_rd_sofar | RD Cost of the best mode found so far |
[in] | use_base_mv | Flag, indicating that tmp_mv holds specific MV to start the search with |
tmp_mv
. Rate estimation for this vector is placed to rate_mv
References macroblock::e_mbd, macroblockd::mi, MvCosts::mv_cost_stack, macroblock::mv_costs, MvCosts::nmv_joint_cost, macroblockd::plane, macroblock::pred_sse, macroblock::rdmult, MB_MODE_INFO::ref_frame, and MB_MODE_INFO::ref_mv_idx.
Referenced by search_new_mv().
|
static |
Searches for the best New Motion Vector.
Finds the best Motion Vector by doing Motion Estimation. Uses reduced complexity ME for non-LAST frames or calls combined_motion_search
for LAST reference frame
[in] | cpi | Top-level encoder structure |
[in] | x | Pointer to structure holding all the data for the current macroblock |
[in] | frame_mv | Array that holds MVs for all modes and ref frames |
[in] | ref_frame | Reference frame for which to find the best New MVs |
[in] | gf_temporal_ref | Flag, indicating temporal reference for GOLDEN frame |
[in] | bsize | Current block size |
[in] | mi_row | Row index in 4x4 units |
[in] | mi_col | Column index in 4x4 units |
[in] | rate_mv | Pointer to Rate of the best new MV |
[in] | best_rdc | Pointer to the RD Cost for the best mode found so far |
frame_mv
array, Rate estimation for this vector is placed to rate_mv
References AOM_CBR, combined_motion_search(), macroblock::e_mbd, macroblock::mbmi_ext, macroblockd::mi, MB_MODE_INFO::mv, MvCosts::mv_cost_stack, macroblock::mv_costs, MvCosts::nmv_joint_cost, macroblock::pred_mv_sad, macroblock::pred_sse, and MB_MODE_INFO_EXT::ref_mv_stack.
void av1_block_yrd | ( | const AV1_COMP *const | cpi, |
MACROBLOCK * | x, | ||
int | mi_row, | ||
int | mi_col, | ||
RD_STATS * | this_rdc, | ||
int * | skippable, | ||
BLOCK_SIZE | bsize, | ||
TX_SIZE | tx_size, | ||
TX_TYPE | tx_type, | ||
int | is_inter_mode | ||
) |
Calculates RD Cost using Hadamard transform.
Calculates RD Cost using Hadamard transform. For low bit depth this function uses low-precision set of functions (16-bit) and 32 bit for high bit depth
[in] | cpi | Top-level encoder structure |
[in] | x | Pointer to structure holding all the data for the current macroblock |
[in] | mi_row | Row index in 4x4 units |
[in] | mi_col | Column index in 4x4 units |
[in] | this_rdc | Pointer to calculated RD Cost |
[in] | skippable | Pointer to a flag indicating possible tx skip |
[in] | bsize | Current block size |
[in] | tx_size | Transform size |
[in] | tx_type | Transform kernel type |
[in] | is_inter_mode | Flag to indicate inter mode |
this_rdc
. skippable
flag is set if there is no non-zero quantized coefficients for Hadamard transform References macroblockd::above_mbmi, macroblock_plane::coeff, macroblock::color_sensitivity, macroblock_plane::dequant_QTX, macroblock_plane::dqcoeff, macroblock::e_mbd, AV1Common::features, MB_MODE_INFO::filter_intra_mode_info, ModeCosts::inter_compound_mode_cost, MB_MODE_INFO::interintra_mode, FeatureFlags::interp_filter, macroblockd::left_mbmi, macroblockd::mb_to_bottom_edge, macroblockd::mb_to_right_edge, macroblock::mbmi_ext, macroblockd::mi, MB_MODE_INFO::mode, MB_MODE_INFO::motion_mode, MB_MODE_INFO::mv, ModeCosts::newmv_mode_cost, MB_MODE_INFO::num_proj_ref, MB_MODE_INFO::palette_mode_info, macroblockd::plane, macroblock::plane, macroblock_plane::qcoeff, macroblock_plane::quant_fp_QTX, macroblock_plane::quant_shift_QTX, macroblock::rdmult, MB_MODE_INFO::ref_frame, MB_MODE_INFO::ref_mv_idx, ModeCosts::refmv_mode_cost, macroblock_plane::round_fp_QTX, TxfmSearchInfo::skip_txfm, macroblock_plane::src, macroblock_plane::src_diff, macroblock::txfm_search_info, MB_MODE_INFO::uv_mode, macroblock_plane::zbin_QTX, and ModeCosts::zeromv_mode_cost.
Referenced by estimate_block_intra().
|
static |
Estimation of RD cost of an intra mode for Non-RD optimized case.
Calculates RD Cost for an intra mode for a single TX block using Hadamard transform.
[in] | plane | Color plane |
[in] | block | Index of a TX block in a prediction block |
[in] | row | Row of a current TX block |
[in] | col | Column of a current TX block |
[in] | plane_bsize | Block size of a current prediction block |
[in] | tx_size | Transform size |
[in] | arg | Pointer to a structure that holds paramaters for intra mode search |
args->rdc
and args->mode
References av1_block_yrd(), macroblock::e_mbd, macroblockd::plane, macroblock::plane, and macroblock_plane::src.
Referenced by av1_nonrd_pick_intra_mode().
|
static |
Searches for the best intrpolation filter.
Iterates through subset of possible interpolation filters (EIGHTTAP_REGULAR, EIGTHTAP_SMOOTH, MULTITAP_SHARP, depending on FILTER_SEARCH_SIZE) and selects the one that gives lowest RD cost. RD cost is calculated using curvfit model. Support for dual filters (different filters in the x & y directions) is allowed if sf.interp_sf.disable_dual_filter = 0.
[in] | cpi | Top-level encoder structure |
[in] | x | Pointer to structure holding all the data for the current macroblock |
[in] | this_rdc | Pointer to calculated RD Cost |
[in] | mi_row | Row index in 4x4 units |
[in] | mi_col | Column index in 4x4 units |
[in] | tmp | Pointer to a temporary buffer for prediction re-use |
[in] | bsize | Current block size |
[in] | reuse_inter_pred | Flag, indicating prediction re-use |
[out] | this_mode_pred | Pointer to store prediction buffer for prediction re-use |
[out] | this_early_term | Flag, indicating that transform can be skipped |
[in] | use_model_yrd_large | Flag, indicating special logic to handle large blocks |
[in] | best_sse | Best sse so far. |
this_rdc
and best filter is placed to mi->interp_filters
. In case reuse_inter_pred
flag is set, this function also ouputs this_mode_pred
. Also this_early_temp
is set if transform can be skipped References macroblock::e_mbd, AV1Common::features, FeatureFlags::interp_filter, MB_MODE_INFO::interp_filters, macroblockd::mi, macroblockd::plane, macroblock::rdmult, AV1Common::seq_params, and MB_MODE_INFO::tx_size.
|
static |
Estimates best intra mode for inter mode search.
Using heuristics based on best inter mode, block size, and other decides whether to check intra modes. If so, estimates and selects best intra mode from the reduced set of intra modes (max 4 intra modes checked)
[in] | cpi | Top-level encoder structure |
[in] | x | Pointer to structure holding all the data for the current macroblock |
[in] | bsize | Current block size |
[in] | use_modeled_non_rd_cost | Flag, indicating usage of curvfit model for RD cost |
[in] | best_early_term | Flag, indicating that TX for the best inter mode was skipped |
[in] | ref_cost_intra | Cost of signalling intra mode |
[in] | reuse_prediction | Flag, indicating prediction re-use |
[in] | orig_dst | Original destination buffer |
[in] | tmp_buffers | Pointer to a temporary buffers for prediction re-use |
[out] | this_mode_pred | Pointer to store prediction buffer for prediction re-use |
[in] | best_rdc | Pointer to RD cost for the best selected intra mode |
[in] | best_pickmode | Pointer to a structure containing best mode picked so far |
[in] | ctx | Pointer to structure holding coding contexts and modes for the block |
best_rdc
and best selected mode is placed to best_pickmode
References CommonQuantParams::base_qindex, macroblock::content_state_sb, macroblock::e_mbd, macroblockd::mi, macroblockd::mi_col, macroblockd::mi_row, MB_MODE_INFO::mv, macroblockd::plane, AV1Common::quant_params, macroblock::rdmult, MB_MODE_INFO::segment_id, AV1Common::seq_params, macroblock::source_variance, macroblock::thresh_freq_fact, TxfmSearchParams::tx_mode_search_type, macroblock::txfm_search_params, and CommonQuantParams::y_dc_delta_q.