AOMedia AV1 Codec
macroblockd Struct Reference

Variables related to current coding block. More...

#include <blockd.h>

Data Fields

int mi_stride
 
bool is_chroma_ref
 
struct macroblockd_plane plane [3]
 
TileInfo tile
 
MB_MODE_INFO ** mi
 
bool up_available
 
bool left_available
 
bool chroma_up_available
 
bool chroma_left_available
 
MB_MODE_INFOleft_mbmi
 
MB_MODE_INFOabove_mbmi
 
MB_MODE_INFOchroma_left_mbmi
 
MB_MODE_INFOchroma_above_mbmi
 
uint8_t * tx_type_map
 
int tx_type_map_stride
 
const struct scale_factors * block_ref_scale_factors [2]
 
const YV12_BUFFER_CONFIGcur_buf
 
ENTROPY_CONTEXT * above_entropy_context [3]
 
ENTROPY_CONTEXT left_entropy_context [3][MAX_MIB_SIZE]
 
PARTITION_CONTEXT * above_partition_context
 
PARTITION_CONTEXT left_partition_context [MAX_MIB_SIZE]
 
TXFM_CONTEXT * above_txfm_context
 
TXFM_CONTEXT * left_txfm_context
 
TXFM_CONTEXT left_txfm_context_buffer [MAX_MIB_SIZE]
 
CANDIDATE_MV ref_mv_stack [MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE]
 
uint16_t weight [MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE]
 
bool is_last_vertical_rect
 
bool is_first_horizontal_rect
 
uint8_t neighbors_ref_counts [REF_FRAMES]
 
FRAME_CONTEXT * tile_ctx
 
int bd
 
int qindex [8]
 
int lossless [8]
 
int current_base_qindex
 
int cur_frame_force_integer_mv
 
struct aom_internal_error_info * error_info
 
const WarpedMotionParams * global_motion
 
int8_t delta_lf_from_base
 
int8_t delta_lf [FRAME_LF_COUNT]
 
bool cdef_transmitted [4]
 
uint8_t * seg_mask
 
CFL_CTX cfl
 
uint16_t color_index_map_offset [2]
 
CONV_BUF_TYPE * tmp_conv_dst
 
uint8_t * tmp_obmc_bufs [2]
 
Position of current macroblock in mi units
int mi_row
 
int mi_col
 
Distance of this macroblock from frame edges in 1/8th pixel units.
int mb_to_left_edge
 
int mb_to_right_edge
 
int mb_to_top_edge
 
int mb_to_bottom_edge
 
Default values for the two restoration filters for each plane.

Default values for the two restoration filters for each plane. These values are used as reference values when writing the bitstream. That is, we transmit the delta between the actual values in cm->rst_info[plane].unit_info[unit_idx] and these reference values.

WienerInfo wiener_info [3]
 
SgrprojInfo sgrproj_info [3]
 
Block dimensions in MB_MODE_INFO units.
uint8_t width
 
uint8_t height
 

Detailed Description

Variables related to current coding block.

This is a common set of variables used by both encoder and decoder. Most/all of the pointers are mere pointers to actual arrays are allocated elsewhere. This is mostly for coding convenience.

Field Documentation

◆ mi_row

◆ mi_col

◆ mi_stride

int macroblockd::mi_stride

Same as cm->mi_params.mi_stride, copied here for convenience.

◆ is_chroma_ref

bool macroblockd::is_chroma_ref

True if current block transmits chroma information. More detail: Smallest supported block size for both luma and chroma plane is 4x4. Hence, in case of subsampled chroma plane (YUV 4:2:0 or YUV 4:2:2), multiple luma blocks smaller than 8x8 maybe combined into one chroma block. For example, for YUV 4:2:0, let's say an 8x8 area is split into four 4x4 luma blocks. Then, a single chroma block of size 4x4 will cover the area of these four luma blocks. This is implemented in bitstream as follows:

  • There are four MB_MODE_INFO structs for the four luma blocks.
  • First 3 MB_MODE_INFO have is_chroma_ref = false, and so do not transmit any information for chroma planes.
  • Last block will have is_chroma_ref = true and transmits chroma information for the 4x4 chroma block that covers whole 8x8 area covered by four luma blocks. Similar logic applies for chroma blocks that cover 2 or 3 luma blocks.

Referenced by av1_rd_pick_intra_mode_sb(), av1_rd_pick_intra_sbuv_mode(), and search_intra_modes_in_interframe().

◆ plane

◆ tile

TileInfo macroblockd::tile

Tile related info.

Referenced by rd_pick_intrabc_mode_sb().

◆ mi

◆ up_available

bool macroblockd::up_available

True if 4x4 block above the current block is available.

◆ left_available

bool macroblockd::left_available

True if 4x4 block to the left of the current block is available.

◆ chroma_up_available

bool macroblockd::chroma_up_available

True if the above chrome reference block is available.

◆ chroma_left_available

bool macroblockd::chroma_left_available

True if the left chrome reference block is available.

◆ left_mbmi

MB_MODE_INFO* macroblockd::left_mbmi

MB_MODE_INFO for 4x4 block to the left of the current block, if left_available == true; otherwise NULL.

Referenced by av1_nonrd_pick_intra_mode(), and av1_rd_pick_intra_sby_mode().

◆ above_mbmi

MB_MODE_INFO* macroblockd::above_mbmi

MB_MODE_INFO for 4x4 block above the current block, if up_available == true; otherwise NULL.

Referenced by av1_nonrd_pick_intra_mode(), and av1_rd_pick_intra_sby_mode().

◆ chroma_left_mbmi

MB_MODE_INFO* macroblockd::chroma_left_mbmi

Above chroma reference block if is_chroma_ref == true for the current block and chroma_up_available == true; otherwise NULL. See also: the special case logic when current chroma block covers more than one luma blocks in set_mi_row_col().

◆ chroma_above_mbmi

MB_MODE_INFO* macroblockd::chroma_above_mbmi

Left chroma reference block if is_chroma_ref == true for the current block and chroma_left_available == true; otherwise NULL. See also: the special case logic when current chroma block covers more than one luma blocks in set_mi_row_col().

◆ tx_type_map

◆ tx_type_map_stride

int macroblockd::tx_type_map_stride

Stride for 'tx_type_map'. Note that this may / may not be same as 'mi_stride', depending on which actual array 'tx_type_map' points to.

Referenced by pick_sb_modes(), and pick_sb_modes_nonrd().

◆ mb_to_left_edge

int macroblockd::mb_to_left_edge

Distance from left edge

◆ mb_to_right_edge

int macroblockd::mb_to_right_edge

Distance from right edge

◆ mb_to_top_edge

int macroblockd::mb_to_top_edge

Distance from top edge

◆ mb_to_bottom_edge

int macroblockd::mb_to_bottom_edge

Distance from bottom edge

◆ block_ref_scale_factors

const struct scale_factors* macroblockd::block_ref_scale_factors[2]

Scale factors for reference frames of the current block. These are pointers into 'cm->ref_scale_factors'.

Referenced by av1_nonrd_pick_inter_mode_sb(), and search_filter_ref().

◆ cur_buf

const YV12_BUFFER_CONFIG* macroblockd::cur_buf
  • On encoder side: points to cpi->source, which is the buffer containing the current source frame (maybe filtered).
  • On decoder side: points to cm->cur_frame->buf, which is the buffer into which current frame is being decoded.

Referenced by rd_pick_intrabc_mode_sb().

◆ above_entropy_context

ENTROPY_CONTEXT* macroblockd::above_entropy_context[3]

Entropy contexts for the above blocks. above_entropy_context[i][j] corresponds to above entropy context for ith plane and jth mi column of this frame, wrt current 'mi_row'. These are pointers into 'cm->above_contexts.entropy'.

◆ left_entropy_context

ENTROPY_CONTEXT macroblockd::left_entropy_context[3][MAX_MIB_SIZE]

Entropy contexts for the left blocks. left_entropy_context[i][j] corresponds to left entropy context for ith plane and jth mi row of this superblock, wrt current 'mi_col'. Note: These contain actual data, NOT pointers.

◆ above_partition_context

PARTITION_CONTEXT* macroblockd::above_partition_context

Partition contexts for the above blocks. above_partition_context[i] corresponds to above partition context for ith mi column of this frame, wrt current 'mi_row'. This is a pointer into 'cm->above_contexts.partition'.

◆ left_partition_context

PARTITION_CONTEXT macroblockd::left_partition_context[MAX_MIB_SIZE]

Partition contexts for the left blocks. left_partition_context[i] corresponds to left partition context for ith mi row of this superblock, wrt current 'mi_col'. Note: These contain actual data, NOT pointers.

◆ above_txfm_context

TXFM_CONTEXT* macroblockd::above_txfm_context

Transform contexts for the above blocks. above_txfm_context[i] corresponds to above transform context for ith mi col from the current position (mi row and mi column) for this frame. This is a pointer into 'cm->above_contexts.txfm'.

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

◆ left_txfm_context

TXFM_CONTEXT* macroblockd::left_txfm_context

Transform contexts for the left blocks. left_txfm_context[i] corresponds to left transform context for ith mi row from the current position (mi_row and mi_col) for this superblock. This is a pointer into 'left_txfm_context_buffer'.

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

◆ left_txfm_context_buffer

TXFM_CONTEXT macroblockd::left_txfm_context_buffer[MAX_MIB_SIZE]

left_txfm_context_buffer[i] is the left transform context for ith mi_row in this superblock. Behaves like an internal actual buffer which 'left_txt_context' points to, and never accessed directly except to fill in initial default values.

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

◆ wiener_info

WienerInfo macroblockd::wiener_info[3]

Defaults for Wiener filter

◆ sgrproj_info

SgrprojInfo macroblockd::sgrproj_info[3]

Defaults for SGR filter

◆ width

uint8_t macroblockd::width

◆ height

uint8_t macroblockd::height

Block height in MB_MODE_INFO units

Referenced by handle_inter_mode(), motion_mode_rd(), and rd_pick_intrabc_mode_sb().

◆ ref_mv_stack

CANDIDATE_MV macroblockd::ref_mv_stack[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE]

Contains the motion vector candidates found during motion vector prediction process. ref_mv_stack[i] contains the candidates for ith type of reference frame (single/compound). The actual number of candidates found in ref_mv_stack[i] is stored in either dcb->ref_mv_count[i] (decoder side) or mbmi_ext->ref_mv_count[i] (encoder side).

Referenced by find_predictors(), and rd_pick_intrabc_mode_sb().

◆ weight

uint16_t macroblockd::weight[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE]

weight[i][j] is the weight for ref_mv_stack[i][j] and used to compute the DRL (dynamic reference list) mode contexts.

Referenced by find_predictors(), and rd_pick_intrabc_mode_sb().

◆ is_last_vertical_rect

bool macroblockd::is_last_vertical_rect

True if this is the last vertical rectangular block in a VERTICAL or VERTICAL_4 partition.

◆ is_first_horizontal_rect

bool macroblockd::is_first_horizontal_rect

True if this is the 1st horizontal rectangular block in a HORIZONTAL or HORIZONTAL_4 partition.

◆ neighbors_ref_counts

uint8_t macroblockd::neighbors_ref_counts[REF_FRAMES]

Counts of each reference frame in the above and left neighboring blocks. NOTE: Take into account both single and comp references.

◆ tile_ctx

FRAME_CONTEXT* macroblockd::tile_ctx

Current CDFs of all the symbols for the current tile.

Referenced by encode_sb(), and encode_sb_row().

◆ bd

int macroblockd::bd

Bit depth: copied from cm->seq_params->bit_depth for convenience.

Referenced by av1_apply_temporal_filter_c(), av1_nonrd_pick_inter_mode_sb(), tf_build_predictor(), and tf_motion_search().

◆ qindex

int macroblockd::qindex[8]

Quantizer index for each segment (base qindex + delta for each segment).

Referenced by encode_frame_internal().

◆ lossless

int macroblockd::lossless[8]

◆ current_base_qindex

int macroblockd::current_base_qindex

Q index for the coding blocks in this superblock will be stored in mbmi->current_qindex. Now, when cm->delta_q_info.delta_q_present_flag is true, mbmi->current_qindex is computed by taking 'current_base_qindex' as the base, and adding any transmitted delta qindex on top of it. Precisely, this is the latest qindex used by the first coding block of a non-skip superblock in the current tile; OR same as cm->quant_params.base_qindex (if not explicitly set yet). Note: This is 'CurrentQIndex' in the AV1 spec.

Referenced by encode_b(), encode_sb_row(), and setup_delta_q().

◆ cur_frame_force_integer_mv

int macroblockd::cur_frame_force_integer_mv

Same as cm->features.cur_frame_force_integer_mv.

Referenced by encode_sb_row().

◆ error_info

struct aom_internal_error_info* macroblockd::error_info

◆ global_motion

const WarpedMotionParams* macroblockd::global_motion

Same as cm->global_motion.

Referenced by encode_b(), motion_mode_rd(), and prune_zero_mv_with_sse().

◆ delta_lf_from_base

int8_t macroblockd::delta_lf_from_base

Since actual frame level loop filtering level value is not available at the beginning of the tile (only available during actual filtering) at encoder side.we record the delta_lf (against the frame level loop filtering level) and code the delta between previous superblock's delta lf and current delta lf. It is equivalent to the delta between previous superblock's actual lf and current lf.

Referenced by encode_b().

◆ delta_lf

int8_t macroblockd::delta_lf[FRAME_LF_COUNT]

We have four frame filter levels for different plane and direction. So, to support the per superblock update, we need to add a few more params:

  1. delta loop filter level for y plane vertical
  2. delta loop filter level for y plane horizontal
  3. delta loop filter level for u plane
  4. delta loop filter level for v plane To make it consistent with the reference to each filter level in segment, we need to -1, since
  • SEG_LVL_ALT_LF_Y_V = 1;
  • SEG_LVL_ALT_LF_Y_H = 2;
  • SEG_LVL_ALT_LF_U = 3;
  • SEG_LVL_ALT_LF_V = 4;

Referenced by encode_b().

◆ cdef_transmitted

bool macroblockd::cdef_transmitted[4]

cdef_transmitted[i] is true if CDEF strength for ith CDEF unit in the current superblock has already been read from (decoder) / written to (encoder) the bitstream; and false otherwise. More detail:

  1. CDEF strength is transmitted only once per CDEF unit, in the 1st non-skip coding block. So, we need this array to keep track of whether CDEF strengths for the given CDEF units have been transmitted yet or not.
  2. Superblock size can be either 128x128 or 64x64, but CDEF unit size is fixed to be 64x64. So, there may be 4 CDEF units within a superblock (if superblock size is 128x128). Hence the array size is 4.
  3. In the current implementation, CDEF strength for this CDEF unit is stored in the MB_MODE_INFO of the 1st block in this CDEF unit (inside cm->mi_params.mi_grid_base).

◆ seg_mask

uint8_t* macroblockd::seg_mask

Mask for this block used for compound prediction.

◆ cfl

CFL_CTX macroblockd::cfl

CFL (chroma from luma) related parameters.

Referenced by av1_rd_pick_intra_sbuv_mode(), and cfl_rd_pick_alpha().

◆ color_index_map_offset

uint16_t macroblockd::color_index_map_offset[2]

Offset to plane[p].color_index_map. Currently:

  • On encoder side, this is always 0 as 'color_index_map' is allocated per coding block there.
  • On decoder side, this may be non-zero, as 'color_index_map' is a (static) memory pointing to the base of a superblock there, and we need an offset to it to get the color index map for current coding block.

◆ tmp_conv_dst

CONV_BUF_TYPE* macroblockd::tmp_conv_dst

Temporary buffer used for convolution in case of compound reference only for (weighted or uniform) averaging operation. There are pointers to actual buffers allocated elsewhere: e.g.

  • In decoder, 'pbi->td.tmp_conv_dst' or 'pbi->thread_data[t].td->xd.tmp_conv_dst' and
  • In encoder, 'x->tmp_conv_dst' or 'cpi->tile_thr_data[t].td->mb.tmp_conv_dst'.

◆ tmp_obmc_bufs

uint8_t* macroblockd::tmp_obmc_bufs[2]

Temporary buffers used to build OBMC prediction by above (index 0) and left (index 1) predictors respectively. tmp_obmc_bufs[i][p * MAX_SB_SQUARE] is the buffer used for plane 'p'. There are pointers to actual buffers allocated elsewhere: e.g.

  • In decoder, 'pbi->td.tmp_obmc_bufs' or 'pbi->thread_data[t].td->xd.tmp_conv_dst' and -In encoder, 'x->tmp_pred_bufs' or 'cpi->tile_thr_data[t].td->mb.tmp_pred_bufs'.

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