/* * Copyright (c) 2016, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
/* For keyframes, intra block modes are predicted by the (already decoded) modes for the Y blocks to the left and above us; for interframes, there
is a single probability table. */
typedefstruct { // Value of base colors for Y, U, and V
uint16_t palette_colors[3 * PALETTE_MAX_SIZE]; // Number of base colors for Y (0) and UV (1)
uint8_t palette_size[2];
} PALETTE_MODE_INFO;
typedefstruct RD_STATS { int rate; int zero_rate;
int64_t dist; // Please be careful of using rdcost, it's not guaranteed to be set all the // time. // TODO(angiebird): Create a set of functions to manipulate the RD_STATS. In // these functions, make sure rdcost is always up-to-date according to // rate/dist.
int64_t rdcost;
int64_t sse;
uint8_t skip_txfm; // sse should equal to dist when skip_txfm == 1 #if CONFIG_RD_DEBUG int txb_coeff_cost[MAX_MB_PLANE]; #endif// CONFIG_RD_DEBUG
} RD_STATS;
// This struct is used to group function args that are commonly // sent together in functions related to interinter compound modes typedefstruct {
uint8_t *seg_mask;
int8_t wedge_index;
int8_t wedge_sign;
DIFFWTD_MASK_TYPE mask_type;
COMPOUND_TYPE type;
} INTERINTER_COMPOUND_DATA;
/*! \brief Stores the prediction/txfm mode of the current coding block
*/ typedefstruct MB_MODE_INFO { /***************************************************************************** * \name General Info of the Coding Block
****************************************************************************/ /**@{*/ /*! \brief The block size of the current coding block */
BLOCK_SIZE bsize; /*! \brief The partition type of the current coding block. */
PARTITION_TYPE partition; /*! \brief The prediction mode used */
PREDICTION_MODE mode; /*! \brief The UV mode when intra is used */
UV_PREDICTION_MODE uv_mode; /*! \brief The q index for the current coding block. */ int current_qindex; /**@}*/
/***************************************************************************** * \name Inter Mode Info
****************************************************************************/ /**@{*/ /*! \brief The motion vectors used by the current inter mode */
int_mv mv[2]; /*! \brief The reference frames for the MV */
MV_REFERENCE_FRAME ref_frame[2]; /*! \brief Filter used in subpel interpolation. */
int_interpfilters interp_filters; /*! \brief The motion mode used by the inter prediction. */
MOTION_MODE motion_mode; /*! \brief Number of samples used by warp causal */
uint8_t num_proj_ref; /*! \brief The number of overlapped neighbors above/left for obmc/warp motion
* mode. */
uint8_t overlappable_neighbors; /*! \brief The parameters used in warp motion mode. */
WarpedMotionParams wm_params; /*! \brief The type of intra mode used by inter-intra */
INTERINTRA_MODE interintra_mode; /*! \brief The type of wedge used in interintra mode. */
int8_t interintra_wedge_index; /*! \brief Struct that stores the data used in interinter compound mode. */
INTERINTER_COMPOUND_DATA interinter_comp; /**@}*/
/***************************************************************************** * \name Intra Mode Info
****************************************************************************/ /**@{*/ /*! \brief Directional mode delta: the angle is base angle + (angle_delta *
* step). */
int8_t angle_delta[PLANE_TYPES]; /*! \brief The type of filter intra mode used (if applicable). */
FILTER_INTRA_MODE_INFO filter_intra_mode_info; /*! \brief Chroma from Luma: Joint sign of alpha Cb and alpha Cr */
int8_t cfl_alpha_signs; /*! \brief Chroma from Luma: Index of the alpha Cb and alpha Cr combination */
uint8_t cfl_alpha_idx; /*! \brief Stores the size and colors of palette mode */
PALETTE_MODE_INFO palette_mode_info; /**@}*/
/***************************************************************************** * \name Transform Info
****************************************************************************/ /**@{*/ /*! \brief Whether to skip transforming and sending. */
uint8_t skip_txfm; /*! \brief Transform size when fixed size txfm is used (e.g. intra modes). */
TX_SIZE tx_size; /*! \brief Transform size when recursive txfm tree is on. */
TX_SIZE inter_tx_size[INTER_TX_SIZE_BUF_LEN]; /**@}*/
/***************************************************************************** * \name Bitfield for Memory Reduction
****************************************************************************/ /**@{*/ /*! \brief The segment id */
uint8_t segment_id : 3; /*! \brief Only valid when temporal update if off. */
uint8_t seg_id_predicted : 1; /*! \brief Which ref_mv to use */
uint8_t ref_mv_idx : 2; /*! \brief Inter skip mode */
uint8_t skip_mode : 1; /*! \brief Whether intrabc is used. */
uint8_t use_intrabc : 1; /*! \brief Indicates if masked compound is used(1) or not (0). */
uint8_t comp_group_idx : 1; /*! \brief Indicates whether dist_wtd_comp(0) is used or not (0). */
uint8_t compound_idx : 1; /*! \brief Whether to use interintra wedge */
uint8_t use_wedge_interintra : 1; /*! \brief CDEF strength per BLOCK_64X64 */
int8_t cdef_strength : 4; /**@}*/
#if CONFIG_RD_DEBUG /*! \brief RD info used for debugging */
RD_STATS rd_stats; /*! \brief The current row in unit of 4x4 blocks for debugging */ int mi_row; /*! \brief The current col in unit of 4x4 blocks for debugging */ int mi_col; #endif #if CONFIG_INSPECTION /*! \brief Whether we are skipping the current rows or columns. */
int16_t tx_skip[TXK_TYPE_BUF_LEN]; #endif
} MB_MODE_INFO;
typedefstruct macroblockd_plane {
PLANE_TYPE plane_type; int subsampling_x; int subsampling_y; struct buf_2d dst; struct buf_2d pre[2];
ENTROPY_CONTEXT *above_entropy_context;
ENTROPY_CONTEXT *left_entropy_context;
// The dequantizers below are true dequantizers used only in the // dequantization process. They have the same coefficient // shift/scale as TX.
int16_t seg_dequant_QTX[MAX_SEGMENTS][2]; // Pointer to color index map of: // - Current coding block, on encoder side. // - Current superblock, on decoder side.
uint8_t *color_index_map;
/*!\brief Parameters related to Sgrproj Filter */ typedefstruct { /*! * Parameter index.
*/ int ep;
/*! * Weights for linear combination of filtered versions
*/ int xqd[2];
} SgrprojInfo;
/*!\cond */
#define CFL_MAX_BLOCK_SIZE (BLOCK_32X32) #define CFL_BUF_LINE (32) #define CFL_BUF_LINE_I128 (CFL_BUF_LINE >> 3) #define CFL_BUF_LINE_I256 (CFL_BUF_LINE >> 4) #define CFL_BUF_SQUARE (CFL_BUF_LINE * CFL_BUF_LINE) typedefstruct cfl_ctx { // Q3 reconstructed luma pixels (only Q2 is required, but Q3 is used to avoid // shifts)
uint16_t recon_buf_q3[CFL_BUF_SQUARE]; // Q3 AC contributions (reconstructed luma pixels - tx block avg)
int16_t ac_buf_q3[CFL_BUF_SQUARE];
// Cache the DC_PRED when performing RDO, so it does not have to be recomputed // for every scaling parameter bool dc_pred_is_cached[CFL_PRED_PLANES]; // Whether the DC_PRED cache is enabled. The DC_PRED cache is disabled when // decoding. bool use_dc_pred_cache; // Only cache the first row of the DC_PRED
int16_t dc_pred_cache[CFL_PRED_PLANES][CFL_BUF_LINE];
// Height and width currently used in the CfL prediction buffer. int buf_height, buf_width;
int are_parameters_computed;
// Chroma subsampling int subsampling_x, subsampling_y;
// Whether the reconstructed luma pixels need to be stored int store_y;
} CFL_CTX;
typedefstruct dist_wtd_comp_params { int use_dist_wtd_comp_avg; int fwd_offset; int bck_offset;
} DIST_WTD_COMP_PARAMS;
struct scale_factors;
/*!\endcond */
/*! \brief 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.
*/ typedefstruct macroblockd { /** * \name Position of current macroblock in mi units
*/ /**@{*/ int mi_row; /*!< Row position in mi units. */ int mi_col; /*!< Column position in mi units. */ /**@}*/
/*! * Same as cm->mi_params.mi_stride, copied here for convenience.
*/ int mi_stride;
/*! * 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.
*/ bool is_chroma_ref;
/*! * Info specific to each plane.
*/ struct macroblockd_plane plane[MAX_MB_PLANE];
/*! * Tile related info.
*/
TileInfo tile;
/*! * Appropriate offset inside cm->mi_params.mi_grid_base based on current * mi_row and mi_col.
*/
MB_MODE_INFO **mi;
/*! * True if 4x4 block above the current block is available.
*/ bool up_available; /*! * True if 4x4 block to the left of the current block is available.
*/ bool left_available; /*! * True if the above chrome reference block is available.
*/ bool chroma_up_available; /*! * True if the left chrome reference block is available.
*/ bool chroma_left_available;
/*! * MB_MODE_INFO for 4x4 block to the left of the current block, if * left_available == true; otherwise NULL.
*/
MB_MODE_INFO *left_mbmi; /*! * MB_MODE_INFO for 4x4 block above the current block, if * up_available == true; otherwise NULL.
*/
MB_MODE_INFO *above_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().
*/
MB_MODE_INFO *chroma_left_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().
*/
MB_MODE_INFO *chroma_above_mbmi;
/*! * Appropriate offset based on current 'mi_row' and 'mi_col', inside * 'tx_type_map' in one of 'CommonModeInfoParams', 'PICK_MODE_CONTEXT' or * 'MACROBLOCK' structs.
*/
uint8_t *tx_type_map; /*! * 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.
*/ int tx_type_map_stride;
/** * \name Distance of this macroblock from frame edges in 1/8th pixel units.
*/ /**@{*/ int mb_to_left_edge; /*!< Distance from left edge */ int mb_to_right_edge; /*!< Distance from right edge */ int mb_to_top_edge; /*!< Distance from top edge */ int mb_to_bottom_edge; /*!< Distance from bottom edge */ /**@}*/
/*! * Scale factors for reference frames of the current block. * These are pointers into 'cm->ref_scale_factors'.
*/ conststruct scale_factors *block_ref_scale_factors[2];
/*! * - 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*.
*/ const YV12_BUFFER_CONFIG *cur_buf;
/*! * 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'.
*/
ENTROPY_CONTEXT *above_entropy_context[MAX_MB_PLANE]; /*! * 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.
*/
ENTROPY_CONTEXT left_entropy_context[MAX_MB_PLANE][MAX_MIB_SIZE];
/*! * 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'.
*/
PARTITION_CONTEXT *above_partition_context; /*! * 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.
*/
PARTITION_CONTEXT left_partition_context[MAX_MIB_SIZE];
/*! * 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'.
*/
TXFM_CONTEXT *above_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'.
*/
TXFM_CONTEXT *left_txfm_context; /*! * 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.
*/
TXFM_CONTEXT left_txfm_context_buffer[MAX_MIB_SIZE];
/** * \name 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[MAX_MB_PLANE]; /*!< Defaults for Wiener filter*/
SgrprojInfo sgrproj_info[MAX_MB_PLANE]; /*!< Defaults for SGR filter */ /**@}*/
/** * \name Block dimensions in MB_MODE_INFO units.
*/ /**@{*/
uint8_t width; /*!< Block width in MB_MODE_INFO units */
uint8_t height; /*!< Block height in MB_MODE_INFO units */ /**@}*/
/*! * 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).
*/
CANDIDATE_MV ref_mv_stack[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.
*/
uint16_t weight[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE];
/*! * True if this is the last vertical rectangular block in a VERTICAL or * VERTICAL_4 partition.
*/ bool is_last_vertical_rect; /*! * True if this is the 1st horizontal rectangular block in a HORIZONTAL or * HORIZONTAL_4 partition.
*/ bool is_first_horizontal_rect;
/*! * Counts of each reference frame in the above and left neighboring blocks. * NOTE: Take into account both single and comp references.
*/
uint8_t neighbors_ref_counts[REF_FRAMES];
/*! * Current CDFs of all the symbols for the current tile.
*/
FRAME_CONTEXT *tile_ctx;
/*! * Bit depth: copied from cm->seq_params->bit_depth for convenience.
*/ int bd;
/*! * Quantizer index for each segment (base qindex + delta for each segment).
*/ int qindex[MAX_SEGMENTS]; /*! * lossless[s] is true if segment 's' is coded losslessly.
*/ int lossless[MAX_SEGMENTS]; /*! * 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.
*/ int current_base_qindex;
/*! * Same as cm->features.cur_frame_force_integer_mv.
*/ int cur_frame_force_integer_mv;
/*! * Pointer to cm->error.
*/ struct aom_internal_error_info *error_info;
/*! * Same as cm->global_motion.
*/ const WarpedMotionParams *global_motion;
/*! * 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.
*/
int8_t delta_lf_from_base; /*! * 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: * 0. delta loop filter level for y plane vertical * 1. delta loop filter level for y plane horizontal * 2. delta loop filter level for u plane * 3. 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;
*/
int8_t delta_lf[FRAME_LF_COUNT]; /*! * 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).
*/ bool cdef_transmitted[4];
/*! * Mask for this block used for compound prediction.
*/
uint8_t *seg_mask;
/*! * CFL (chroma from luma) related parameters.
*/
CFL_CTX cfl;
/*! * 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.
*/
uint16_t color_index_map_offset[2];
/*! * 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'.
*/
CONV_BUF_TYPE *tmp_conv_dst; /*! * 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'.
*/
uint8_t *tmp_obmc_bufs[2];
} MACROBLOCKD;
typedefstruct BitDepthInfo { int bit_depth; /*! Is the image buffer high bit depth? * Low bit depth buffer uses uint8_t. * High bit depth buffer uses uint16_t. * Equivalent to cm->seq_params->use_highbitdepth
*/ int use_highbitdepth_buf;
} BitDepthInfo;
staticinlineint get_sqr_bsize_idx(BLOCK_SIZE bsize) { switch (bsize) { case BLOCK_4X4: return 0; case BLOCK_8X8: return 1; case BLOCK_16X16: return 2; case BLOCK_32X32: return 3; case BLOCK_64X64: return 4; case BLOCK_128X128: return 5; default: return SQR_BLOCK_SIZES;
}
}
// For a square block size 'bsize', returns the size of the sub-blocks used by // the given partition type. If the partition produces sub-blocks of different // sizes, then the function returns the largest sub-block size. // Implements the Partition_Subsize lookup table in the spec (Section 9.3. // Conversion tables). // Note: the input block size should be square. // Otherwise it's considered invalid. staticinline BLOCK_SIZE get_partition_subsize(BLOCK_SIZE bsize,
PARTITION_TYPE partition) { if (partition == PARTITION_INVALID) { return BLOCK_INVALID;
} else { constint sqr_bsize_idx = get_sqr_bsize_idx(bsize); return sqr_bsize_idx >= SQR_BLOCK_SIZES
? BLOCK_INVALID
: subsize_lookup[partition][sqr_bsize_idx];
}
}
// Converts block_index for given transform size to index of the block in raster // order. staticinlineint av1_block_index_to_raster_order(TX_SIZE tx_size, int block_idx) { // For transform size 4x8, the possible block_idx values are 0 & 2, because // block_idx values are incremented in steps of size 'tx_width_unit x // tx_height_unit'. But, for this transform size, block_idx = 2 corresponds to // block number 1 in raster order, inside an 8x8 MI block. // For any other transform size, the two indices are equivalent. return (tx_size == TX_4X8 && block_idx == 2) ? 1 : block_idx;
}
// Inverse of above function. // Note: only implemented for transform sizes 4x4, 4x8 and 8x4 right now. staticinlineint av1_raster_order_to_block_index(TX_SIZE tx_size, int raster_order) {
assert(tx_size == TX_4X4 || tx_size == TX_4X8 || tx_size == TX_8X4); // We ensure that block indices are 0 & 2 if tx size is 4x8 or 8x4. return (tx_size == TX_4X4) ? raster_order : (raster_order > 0) ? 2 : 0;
}
constint txw = tx_size_wide_unit[tx_size]; constint txh = tx_size_high_unit[tx_size]; // The 16x16 unit is due to the constraint from tx_64x64 which sets the // maximum tx size for chroma as 32x32. Coupled with 4x1 transform block // size, the constraint takes effect in 32x16 / 16x32 size too. To solve // the intricacy, cover all the 16x16 units inside a 64 level transform. if (txw == tx_size_wide_unit[TX_64X64] ||
txh == tx_size_high_unit[TX_64X64]) { constint tx_unit = tx_size_wide_unit[TX_16X16]; for (int idy = 0; idy < txh; idy += tx_unit) { for (int idx = 0; idx < txw; idx += tx_unit) {
xd->tx_type_map[(blk_row + idy) * stride + blk_col + idx] = tx_type;
}
}
}
}
staticinline TX_TYPE av1_get_tx_type(const MACROBLOCKD *xd,
PLANE_TYPE plane_type, int blk_row, int blk_col, TX_SIZE tx_size, int reduced_tx_set) { const MB_MODE_INFO *const mbmi = xd->mi[0]; if (xd->lossless[mbmi->segment_id] || txsize_sqr_up_map[tx_size] > TX_32X32) { return DCT_DCT;
}
TX_TYPE tx_type; if (plane_type == PLANE_TYPE_Y) {
tx_type = xd->tx_type_map[blk_row * xd->tx_type_map_stride + blk_col];
} else { if (is_inter_block(mbmi)) { // scale back to y plane's coordinate conststruct macroblockd_plane *const pd = &xd->plane[plane_type];
blk_row <<= pd->subsampling_y;
blk_col <<= pd->subsampling_x;
tx_type = xd->tx_type_map[blk_row * xd->tx_type_map_stride + blk_col];
} else { // In intra mode, uv planes don't share the same prediction mode as y // plane, so the tx_type should not be shared
tx_type = intra_mode_to_tx_type(mbmi, PLANE_TYPE_UV);
} const TxSetType tx_set_type =
av1_get_ext_tx_set_type(tx_size, is_inter_block(mbmi), reduced_tx_set); if (!av1_ext_tx_used[tx_set_type][tx_type]) tx_type = DCT_DCT;
}
assert(tx_type < TX_TYPES);
assert(av1_ext_tx_used[av1_get_ext_tx_set_type(tx_size, is_inter_block(mbmi),
reduced_tx_set)][tx_type]); return tx_type;
}
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y, constint num_planes);
typedefvoid (*foreach_transformed_block_visitor)(int plane, int block, int blk_row, int blk_col,
BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, void *arg);
void av1_set_entropy_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd, int plane,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob, int aoff, int loff);
staticinlineint is_interintra_allowed_bsize_group(int group) { int i; for (i = 0; i < BLOCK_SIZES_ALL; i++) { if (size_group_lookup[i] == group &&
is_interintra_allowed_bsize((BLOCK_SIZE)i)) { return 1;
}
} return 0;
}
// Returns sub-sampled dimensions of the given block. // The output values for 'rows_within_bounds' and 'cols_within_bounds' will // differ from 'height' and 'width' when part of the block is outside the // right // and/or bottom image boundary. staticinlinevoid av1_get_block_dimensions(BLOCK_SIZE bsize, int plane, const MACROBLOCKD *xd, int *width, int *height, int *rows_within_bounds, int *cols_within_bounds) { constint block_height = block_size_high[bsize]; constint block_width = block_size_wide[bsize]; constint block_rows = (xd->mb_to_bottom_edge >= 0)
? block_height
: (xd->mb_to_bottom_edge >> 3) + block_height; constint block_cols = (xd->mb_to_right_edge >= 0)
? block_width
: (xd->mb_to_right_edge >> 3) + block_width; conststruct macroblockd_plane *const pd = &xd->plane[plane];
assert(IMPLIES(plane == PLANE_TYPE_Y, pd->subsampling_x == 0));
assert(IMPLIES(plane == PLANE_TYPE_Y, pd->subsampling_y == 0));
assert(block_width >= block_cols);
assert(block_height >= block_rows); constint plane_block_width = block_width >> pd->subsampling_x; constint plane_block_height = block_height >> pd->subsampling_y; // Special handling for chroma sub8x8. constint is_chroma_sub8_x = plane > 0 && plane_block_width < 4; constint is_chroma_sub8_y = plane > 0 && plane_block_height < 4; if (width) {
*width = plane_block_width + 2 * is_chroma_sub8_x;
assert(*width >= 0);
} if (height) {
*height = plane_block_height + 2 * is_chroma_sub8_y;
assert(*height >= 0);
} if (rows_within_bounds) {
*rows_within_bounds =
(block_rows >> pd->subsampling_y) + 2 * is_chroma_sub8_y;
assert(*rows_within_bounds >= 0);
} if (cols_within_bounds) {
*cols_within_bounds =
(block_cols >> pd->subsampling_x) + 2 * is_chroma_sub8_x;
assert(*cols_within_bounds >= 0);
}
}
/* clang-format off */ // Pointer to a three-dimensional array whose first dimension is PALETTE_SIZES. typedef aom_cdf_prob (*MapCdf)[PALETTE_COLOR_INDEX_CONTEXTS]
[CDF_SIZE(PALETTE_COLORS)]; // Pointer to a const three-dimensional array whose first dimension is // PALETTE_SIZES. typedefconstint (*ColorCost)[PALETTE_COLOR_INDEX_CONTEXTS][PALETTE_COLORS]; /* clang-format on */
typedefstruct { int rows; int cols; int n_colors; int plane_width; int plane_height;
uint8_t *color_map;
MapCdf map_cdf;
ColorCost color_cost;
} Av1ColorMapParam;
staticinlineint is_nontrans_global_motion(const MACROBLOCKD *xd, const MB_MODE_INFO *mbmi) { int ref;
// First check if all modes are GLOBALMV if (mbmi->mode != GLOBALMV && mbmi->mode != GLOBAL_GLOBALMV) return 0;
if (AOMMIN(mi_size_wide[mbmi->bsize], mi_size_high[mbmi->bsize]) < 2) return 0;
// Now check if all global motion is non translational for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { if (xd->global_motion[mbmi->ref_frame[ref]].wmtype == TRANSLATION) return 0;
} return 1;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.