AOMedia AV1 Codec
macroblock Struct Reference

Encoder's parameters related to the current coding block. More...

#include <block.h>

Data Fields

int try_merge_partition
 Prediction for ML based partition.
 
Block4x4VarInfo * src_var_info_of_4x4_sub_blocks
 Pointer to buffer which caches sub-block variances in a superblock.
 
SetOffsetsLoc last_set_offsets_loc
 A hash to make sure av1_set_offsets is called.
 
int palette_pixels
 Number of pixels in current thread that choose palette mode in the fast encoding stage for screen content tool detemination.
 
struct SB_FIRST_PASS_STATS * sb_stats_cache
 Pointer to the structure which stores the statistics used by sb-level multi-pass encoding.
 
struct SB_FIRST_PASS_STATS * sb_fp_stats
 Pointer to the structure which stores the statistics used by first-pass when superblock is searched twice consecutively.
 
Source, Buffers and Decoder
struct macroblock_plane plane [3]
 Each of the encoding plane.
 
MACROBLOCKD e_mbd
 Decoder's view of current coding block.
 
MB_MODE_INFO_EXT mbmi_ext
 Derived coding information.
 
MB_MODE_INFO_EXT_FRAMEmbmi_ext_frame
 Finalized mbmi_ext for the whole frame.
 
FRAME_CONTEXT * row_ctx
 Entropy context for the current row.
 
FRAME_CONTEXT * tile_pb_ctx
 Entropy context for the current tile.
 
CB_COEFF_BUFFERcb_coef_buff
 Buffer of transformed coefficients.
 
uint16_t cb_offset [PLANE_TYPES]
 Offset of current coding block's coeff buffer relative to the sb.
 
OBMCBuffer obmc_buffer
 Modified source and masks used for fast OBMC search.
 
PALETTE_BUFFERpalette_buffer
 Buffer to store the best palette map.
 
CompoundTypeRdBuffers comp_rd_buffer
 Buffer used for compound_type_rd().
 
CONV_BUF_TYPE * tmp_conv_dst
 Buffer to store convolution during averaging process in compound mode.
 
uint8_t * tmp_pred_bufs [2]
 Temporary buffer to hold prediction.
 
Rdopt Costs
int qindex
 Quantization index for the current partition block.
 
int delta_qindex
 Difference between frame-level qindex and current qindex.
 
int rdmult_delta_qindex
 Difference between frame-level qindex and qindex used to compute rdmult (lambda).
 
int rdmult_cur_qindex
 Current qindex (before being adjusted by delta_q_res) used to derive rdmult_delta_qindex.
 
int rdmult
 Rate-distortion multiplier.
 
int intra_sb_rdmult_modifier
 Intra only, per sb rd adjustment.
 
double rb
 Superblock level distortion propagation factor.
 
int mb_energy
 Energy in the current source coding block. Used to calculate rdmult.
 
int sb_energy_level
 Energy in the current source superblock. Used to calculate rdmult.
 
ModeCosts mode_costs
 The rate needed to signal a mode to the bitstream.
 
MvCostsmv_costs
 
IntraBCMVCostsdv_costs
 
CoeffCosts coeff_costs
 The rate needed to signal the txfm coefficients to the bitstream.
 
Rate to Distortion Multipliers
int errorperbit
 A multiplier that converts mv cost to l2 error.
 
int sadperbit
 A multiplier that converts mv cost to l1 error.
 
Segmentation
int seg_skip_block
 Skip mode for the segment.
 
int actual_num_seg1_blocks
 Number of segment 1 blocks Actual number of (4x4) blocks that were applied delta-q, for segment 1.
 
int actual_num_seg2_blocks
 Number of segment 2 blocks Actual number of (4x4) blocks that were applied delta-q, for segment 2.
 
int cnt_zeromv
 Number of zero motion vectors.
 
int force_zeromv_skip_for_sb
 Flag to force zeromv-skip at superblock level, for nonrd path.
 
int force_zeromv_skip_for_blk
 Flag to force zeromv-skip at block level, for nonrd path.
 
int prev_segment_id
 Previous segment id for which qmatrices were updated. This is used to bypass setting of qmatrices if no change in qindex.
 
Superblock
SuperBlockEnc sb_enc
 Information on a whole superblock level.
 
CONTENT_STATE_SB content_state_sb
 Characteristics of the current superblock.
 
Reference Frame Search
int pred_mv_sad [REF_FRAMES]
 Sum absolute distortion of the predicted mv for each ref frame.
 
int best_pred_mv_sad [2]
 The minimum of pred_mv_sad.
 
int pred_mv0_sad [REF_FRAMES]
 The sad of the 1st mv ref (nearest).
 
int pred_mv1_sad [REF_FRAMES]
 The sad of the 2nd mv ref (near).
 
uint8_t tpl_keep_ref_frame [REF_FRAMES]
 Disables certain ref frame pruning based on tpl.
 
WARP_SAMPLE_INFO warp_sample_info [REF_FRAMES]
 Warp motion samples buffer.
 
int picked_ref_frames_mask [MAX_MIB_SIZE *MAX_MIB_SIZE]
 Reference frames picked by the square subblocks in a superblock.
 
int nonrd_prune_ref_frame_search
 Prune ref frames in real-time mode.
 
Partition Search
PartitionSearchInfo part_search_info
 Stores some partition-search related buffers.
 
int must_find_valid_partition
 Whether to disable some features to force a mode in current block.
 
Prediction Mode Search
int skip_mode
 Inter skip mode.
 
int thresh_freq_fact [BLOCK_SIZES_ALL][MAX_MODES]
 Factors used for rd-thresholding.
 
WinnerModeStatswinner_mode_stats
 Tracks the winner modes in the current coding block.
 
int winner_mode_count
 Tracks how many winner modes there are.
 
TXFM_RD_MODEL rd_model
 The model used for rd-estimation to avoid txfm.
 
struct inter_modes_infointer_modes_info
 Stores the inter mode information needed to build an rd model.
 
uint8_t compound_idx
 How to blend the compound predictions.
 
COMP_RD_STATS comp_rd_stats [64]
 A caches of results of compound type search so they can be reused later.
 
int comp_rd_stats_idx
 The idx for the latest compound mode in the cache comp_rd_stats.
 
int recalc_luma_mc_data
 Whether to recompute the luma prediction.
 
IntraBCHashInfo intrabc_hash_info
 Data structure to speed up intrabc search.
 
int use_mb_mode_cache
 Whether to reuse the mode stored in mb_mode_cache.
 
const MB_MODE_INFOmb_mode_cache
 The mode to reuse during av1_rd_pick_intra_mode_sb and av1_rd_pick_inter_mode.
 
PixelLevelGradientInfo * pixel_gradient_info
 Pointer to the buffer which caches gradient information.
 
bool is_sb_gradient_cached [PLANE_TYPES]
 Flags indicating the availability of cached gradient info.
 
bool reuse_inter_pred
 Flag to reuse predicted samples of inter block.
 
MV Search
unsigned int max_mv_context [REF_FRAMES]
 Context used to determine the initial step size in motion search.
 
FullMvLimits mv_limits
 Limit for the range of motion vectors.
 
search_site_config search_site_cfg_buf [NUM_DISTINCT_SEARCH_METHODS]
 Buffer for storing the search site config.
 
Txfm Search
TxfmSearchParams txfm_search_params
 Parameters that control how motion search is done.
 
TxfmSearchInfo txfm_search_info
 Results of the txfm searches that have been done.
 
uint8_t color_sensitivity_sb [3 - 1]
 Whether there is a strong color activity.
 
uint8_t color_sensitivity_sb_g [3 - 1]
 Color sensitivity flag for the superblock for golden reference.
 
uint8_t color_sensitivity_sb_alt [3 - 1]
 Color sensitivity flag for the superblock for altref reference.
 
uint8_t color_sensitivity [3 - 1]
 Color sensitivity flag for the coding block.
 
int64_t min_dist_inter_uv
 Coding block distortion value for uv/color, minimum over the inter modes.
 
int color_palette_thresh
 Threshold on the number of colors for testing palette mode.
 
tran_low_t * dqcoeff_buf
 The buffer used by search_tx_type() to swap dqcoeff in macroblockd_plane.
 
Misc
unsigned int source_variance
 Variance of the source frame.
 
int block_is_zero_sad
 Flag to indicate coding block is zero sad.
 
int sb_me_partition
 Flag to indicate superblock ME in variance partition is determined to be.
 
int sb_me_block
 Flag to indicate to test the superblock MV for the coding block in the.
 
int_mv sb_me_mv
 Motion vector from superblock MV derived from int_pro_motion() in.
 
int sb_force_fixed_part
 Flag to indicate if a fixed partition should be used, only if the.
 
unsigned int pred_sse [REF_FRAMES]
 SSE of the current predictor.
 

Detailed Description

Encoder's parameters related to the current coding block.

This struct contains most of the information the encoder needs to encode the current coding block. This includes the src and pred buffer, a copy of the decoder's view of the current block, the txfm coefficients. This struct also contains various buffers and data used to speed up the encoding process.

Field Documentation

◆ plane

struct macroblock_plane macroblock::plane[3]

Each of the encoding plane.

An array holding the src buffer for each of plane of the current block. It also contains the txfm and quantized txfm coefficients.

Referenced by av1_rd_pick_partition(), pick_sb_modes(), pick_sb_modes_nonrd(), prune_zero_mv_with_sse(), and tf_motion_search().

◆ e_mbd

◆ mbmi_ext

MB_MODE_INFO_EXT macroblock::mbmi_ext

Derived coding information.

Contains extra information not transmitted in the bitstream but are derived. For example, this contains the stack of ref_mvs.

Referenced by av1_nonrd_pick_inter_mode_sb(), av1_rd_pick_intra_mode_sb(), encode_b(), find_predictors(), handle_inter_mode(), rd_pick_intrabc_mode_sb(), and search_new_mv().

◆ mbmi_ext_frame

MB_MODE_INFO_EXT_FRAME* macroblock::mbmi_ext_frame

Finalized mbmi_ext for the whole frame.

Contains the finalized info in mbmi_ext that gets used at the frame level for bitstream packing.

Referenced by encode_b().

◆ tile_pb_ctx

FRAME_CONTEXT* macroblock::tile_pb_ctx

Entropy context for the current tile.

This context will be used to update color_map_cdf pointer which would be used during pack bitstream. For single thread and tile-multithreading case this pointer will be same as xd->tile_ctx, but for the case of row-mt: xd->tile_ctx will point to a temporary context while tile_pb_ctx will point to the accurate tile context.

◆ cb_coef_buff

CB_COEFF_BUFFER* macroblock::cb_coef_buff

Buffer of transformed coefficients.

Points to cb_coef_buff in the AV1_COMP struct, which contains the finalized coefficients. This is here to conveniently copy the best coefficients to frame level for bitstream packing. Since CB_COEFF_BUFFER is allocated on a superblock level, we need to combine it with cb_offset to get the proper position for the current coding block.

◆ tmp_pred_bufs

uint8_t* macroblock::tmp_pred_bufs[2]

Temporary buffer to hold prediction.

Points to a buffer that is used to hold temporary prediction results. This is used in two ways:

  • This is a temporary buffer used to ping-pong the prediction in handle_inter_mode.
  • xd->tmp_obmc_bufs also points to this buffer, and is used in ombc prediction.

Referenced by av1_rd_pick_inter_mode(), and fast_interp_search().

◆ qindex

int macroblock::qindex

Quantization index for the current partition block.

This is used to as the index to find quantization parameter for luma and chroma transformed coefficients.

Referenced by av1_rd_pick_inter_mode(), and av1_rd_pick_partition().

◆ delta_qindex

int macroblock::delta_qindex

Difference between frame-level qindex and current qindex.

This is used to track whether a non-zero delta for qindex is used at least once in the current frame.

Referenced by encode_rd_sb(), and setup_delta_q().

◆ rdmult_delta_qindex

int macroblock::rdmult_delta_qindex

Difference between frame-level qindex and qindex used to compute rdmult (lambda).

rdmult_delta_qindex is assigned the same as delta_qindex before qp sweep. During qp sweep, delta_qindex is changed and used to calculate the actual quant params, while rdmult_delta_qindex remains the same, and is used to calculate the rdmult in "set_deltaq_rdmult".

Referenced by encode_rd_sb(), and setup_delta_q().

◆ rdmult

int macroblock::rdmult

◆ mv_costs

MvCosts* macroblock::mv_costs

The rate needed to encode a new motion vector to the bitstream and some multipliers for motion search.

Referenced by combined_motion_search(), motion_mode_rd(), and search_new_mv().

◆ dv_costs

IntraBCMVCosts* macroblock::dv_costs

The rate needed to encode a new motion vector to the bitstream in intrabc mode.

Referenced by rd_pick_intrabc_mode_sb().

◆ seg_skip_block

int macroblock::seg_skip_block

Skip mode for the segment.

A syntax element of the segmentation mode. In skip_block mode, all mvs are set 0 and all txfms are skipped.

◆ force_zeromv_skip_for_sb

int macroblock::force_zeromv_skip_for_sb

Flag to force zeromv-skip at superblock level, for nonrd path.

0/1 imply zeromv-skip is disabled/enabled. 2 implies that the blocks in the superblock may be marked as zeromv-skip at block level.

Referenced by encode_sb_row().

◆ content_state_sb

CONTENT_STATE_SB macroblock::content_state_sb

Characteristics of the current superblock.

Characteristics like whether the block has high sad, low sad, etc. This is only used by av1 realtime mode.

Referenced by av1_nonrd_pick_inter_mode_sb(), encode_nonrd_sb(), encode_sb_row(), grade_source_content_sb(), and is_calc_src_content_needed().

◆ pred_mv_sad

int macroblock::pred_mv_sad[REF_FRAMES]

Sum absolute distortion of the predicted mv for each ref frame.

This is used to measure how viable a reference frame is.

Referenced by av1_nonrd_pick_inter_mode_sb(), find_predictors(), and search_new_mv().

◆ best_pred_mv_sad

int macroblock::best_pred_mv_sad[2]

The minimum of pred_mv_sad.

Index 0 stores the minimum pred_mv_sad across past reference frames. Index 1 stores the minimum pred_mv_sad across future reference frames.

◆ tpl_keep_ref_frame

uint8_t macroblock::tpl_keep_ref_frame[REF_FRAMES]

Disables certain ref frame pruning based on tpl.

Determines whether a given ref frame is "good" based on data from the TPL model. If so, this stops selective_ref frame from pruning the given ref frame at block level.

Referenced by av1_rd_pick_inter_mode().

◆ warp_sample_info

WARP_SAMPLE_INFO macroblock::warp_sample_info[REF_FRAMES]

Warp motion samples buffer.

Store the motion samples used for warp motion.

Referenced by av1_rd_pick_inter_mode(), and motion_mode_rd().

◆ picked_ref_frames_mask

int macroblock::picked_ref_frames_mask[MAX_MIB_SIZE *MAX_MIB_SIZE]

Reference frames picked by the square subblocks in a superblock.

Keeps track of ref frames that are selected by square partition blocks within a superblock, in MI resolution. They can be used to prune ref frames for rectangular blocks.

◆ nonrd_prune_ref_frame_search

int macroblock::nonrd_prune_ref_frame_search

Prune ref frames in real-time mode.

Determines whether to prune reference frames in real-time mode. For the most part, this is the same as nonrd_prune_ref_frame_search in cpi->sf.rt_sf.nonrd_prune_ref_frame_search, but this can be selectively turned off if the only frame available is GOLDEN_FRAME.

Referenced by encode_sb_row().

◆ must_find_valid_partition

int macroblock::must_find_valid_partition

Whether to disable some features to force a mode in current block.

In some cases, our speed features can be overly aggressive and remove all modes search in the superblock. When this happens, we set must_find_valid_partition to 1 to reduce the number of speed features, and recode the superblock again.

Referenced by av1_rd_pick_partition().

◆ skip_mode

int macroblock::skip_mode

Inter skip mode.

Skip mode tries to use the closest forward and backward references for inter prediction. Skip here means to skip transmitting the reference frames, not to be confused with skip_txfm.

◆ thresh_freq_fact

int macroblock::thresh_freq_fact[BLOCK_SIZES_ALL][MAX_MODES]

Factors used for rd-thresholding.

Determines a rd threshold to determine whether to continue searching the current mode. If the current best rd is already <= threshold, then we skip the current mode.

Referenced by av1_rd_pick_inter_mode().

◆ winner_mode_stats

WinnerModeStats* macroblock::winner_mode_stats

Tracks the winner modes in the current coding block.

Winner mode is a two-pass strategy to find the best prediction mode. In the first pass, we search the prediction modes with a limited set of txfm options, and keep the top modes. These modes are called the winner modes. In the second pass, we retry the winner modes with more thorough txfm options.

Referenced by av1_rd_pick_inter_mode(), and av1_rd_pick_intra_sby_mode().

◆ rd_model

TXFM_RD_MODEL macroblock::rd_model

The model used for rd-estimation to avoid txfm.

These are for inter_mode_rd_model_estimation, which is another two pass approach. In this speed feature, we collect data in the first couple frames to build an rd model to estimate the rdcost of a prediction model based on the residue error. Once enough data is collected, this speed feature uses the estimated rdcost to find the most performant prediction mode. Then we follow up with a second pass find the best transform for the mode. Determines if one would go with reduced complexity transform block search model to select prediction modes, or full complexity model to select transform kernel.

◆ inter_modes_info

struct inter_modes_info* macroblock::inter_modes_info

Stores the inter mode information needed to build an rd model.

These are for inter_mode_rd_model_estimation, which is another two pass approach. In this speed feature, we collect data in the first couple frames to build an rd model to estimate the rdcost of a prediction model based on the residue error. Once enough data is collected, this speed feature uses the estimated rdcost to find the most performant prediction mode. Then we follow up with a second pass find the best transform for the mode.

Referenced by av1_rd_pick_inter_mode().

◆ recalc_luma_mc_data

int macroblock::recalc_luma_mc_data

Whether to recompute the luma prediction.

In interpolation search, we can usually skip recalculating the luma prediction because it is already calculated by a previous predictor. This flag signifies that some modes might have been skipped, so we need to rebuild the prediction.

Referenced by av1_interpolation_filter_search().

◆ intrabc_hash_info

IntraBCHashInfo macroblock::intrabc_hash_info

Data structure to speed up intrabc search.

Contains the hash table, hash function, and buffer used for intrabc.

Referenced by encode_frame_internal(), and rd_pick_intrabc_mode_sb().

◆ pixel_gradient_info

PixelLevelGradientInfo* macroblock::pixel_gradient_info

Pointer to the buffer which caches gradient information.

Pointer to the array of structures to store gradient information of each pixel in a superblock. The buffer constitutes of MAX_SB_SQUARE pixel level structures for each of the plane types (PLANE_TYPE_Y and PLANE_TYPE_UV).

◆ max_mv_context

unsigned int macroblock::max_mv_context[REF_FRAMES]

Context used to determine the initial step size in motion search.

This context is defined as the \(l_\inf\) norm of the best ref_mvs for each frame.

◆ mv_limits

FullMvLimits macroblock::mv_limits

Limit for the range of motion vectors.

These define limits to motion vector components to prevent them from extending outside the UMV borders

Referenced by av1_tf_do_filtering_row().

◆ search_site_cfg_buf

search_site_config macroblock::search_site_cfg_buf[NUM_DISTINCT_SEARCH_METHODS]

Buffer for storing the search site config.

When resize mode or super resolution mode is on, the stride of the reference frame does not always match what's specified in MotionVectorSearchParams::search_site_cfg. When his happens, we update the search_sine_config buffer here and use it for motion search.

◆ txfm_search_params

TxfmSearchParams macroblock::txfm_search_params

Parameters that control how motion search is done.

Stores various txfm search related parameters such as txfm_type, txfm_size, trellis eob search, etc.

Referenced by av1_nonrd_pick_inter_mode_sb(), and av1_nonrd_pick_intra_mode().

◆ txfm_search_info

◆ color_sensitivity_sb

uint8_t macroblock::color_sensitivity_sb[3 - 1]

Whether there is a strong color activity.

Used in REALTIME coding mode to enhance the visual quality at the boundary of moving color objects.

Referenced by encode_sb_row().

◆ try_merge_partition

int macroblock::try_merge_partition

Prediction for ML based partition.

NONE partition evaluated for merge.

In variance based partitioning scheme, NONE & SPLIT partitions are evaluated to check the SPLIT can be merged as NONE. This flag signifies the partition is evaluated in the scheme.

Referenced by av1_rd_use_partition().

◆ src_var_info_of_4x4_sub_blocks

Block4x4VarInfo* macroblock::src_var_info_of_4x4_sub_blocks

Pointer to buffer which caches sub-block variances in a superblock.

Pointer to the array of structures to store source variance information of each 4x4 sub-block in a superblock. Block4x4VarInfo structure is used to store source variance and log of source variance of each 4x4 sub-block.

Referenced by encode_sb_row().


The documentation for this struct was generated from the following file: