diff --git a/av1/common/blockd.c b/av1/common/blockd.c index a689b8159f10409fe9a84725abcd1f20876aa044..526d237edc7d441bef8dbee9d298ede64ce6a5ac 100644 --- a/av1/common/blockd.c +++ b/av1/common/blockd.c @@ -244,7 +244,7 @@ void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) { int i; for (i = 0; i < MAX_MB_PLANE; i++) { - xd->plane[i].plane_type = i ? PLANE_TYPE_UV : PLANE_TYPE_Y; + xd->plane[i].plane_type = get_plane_type(i); xd->plane[i].subsampling_x = i ? ss_x : 0; xd->plane[i].subsampling_y = i ? ss_y : 0; } diff --git a/av1/common/blockd.h b/av1/common/blockd.h index ee0f26485ba0e4d0eb1f74fdc2e3ab575b48e50d..e7725ea7c086e37915b8bcf9bdad1926f8db7c39 100644 --- a/av1/common/blockd.h +++ b/av1/common/blockd.h @@ -1123,6 +1123,10 @@ static INLINE int is_nontrans_global_motion(const MACROBLOCKD *xd) { } #endif // CONFIG_GLOBAL_MOTION +static INLINE PLANE_TYPE get_plane_type(const int plane) { + return (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; +} + #ifdef __cplusplus } // extern "C" #endif diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 8447606b7d2114ba783f015a295f0ff75d51ab07..37e8e161bdfd4f75707307edf4d32246d4918fd7 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c @@ -496,7 +496,7 @@ static void predict_and_reconstruct_intra_block( MB_MODE_INFO *const mbmi, int plane, int row, int col, TX_SIZE tx_size) { struct macroblockd_plane *const pd = &xd->plane[plane]; PREDICTION_MODE mode = (plane == 0) ? mbmi->mode : mbmi->uv_mode; - PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; + PLANE_TYPE plane_type = get_plane_type(plane); uint8_t *dst; const int block_idx = (row << 1) + col; #if CONFIG_PVQ @@ -555,7 +555,7 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd, if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return; if (tx_size == plane_tx_size) { - PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; + PLANE_TYPE plane_type = get_plane_type(plane); int block_idx = (blk_row << 1) + blk_col; TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, plane_tx_size); const SCAN_ORDER *sc = get_scan(cm, plane_tx_size, tx_type, 1); @@ -599,7 +599,7 @@ static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd, aom_reader *const r, int segment_id, int plane, int row, int col, TX_SIZE tx_size) { - PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; + PLANE_TYPE plane_type = get_plane_type(plane); int block_idx = (row << 1) + col; TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size); #if CONFIG_PVQ diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c index 12a000408f54a3279a00875f4e1675324a3d8961..2368294d81dce197954d818d0b91abe6502da96c 100644 --- a/av1/encoder/encodemb.c +++ b/av1/encoder/encodemb.c @@ -503,7 +503,7 @@ void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block, struct macroblock_plane *const p = &x->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane]; #endif - PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; + PLANE_TYPE plane_type = get_plane_type(plane); const int block_raster_idx = av1_block_index_to_raster_order(tx_size, block); TX_TYPE tx_type = get_tx_type(plane_type, xd, block_raster_idx, tx_size); const int is_inter = is_inter_block(&xd->mi[0]->mbmi); @@ -976,7 +976,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col, struct macroblock_plane *const p = &x->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane]; tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); - PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; + PLANE_TYPE plane_type = get_plane_type(plane); const int block_raster_idx = av1_block_index_to_raster_order(tx_size, block); const TX_TYPE tx_type = get_tx_type(plane_type, xd, block_raster_idx, tx_size); diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index 0484479c46e8416405dfa515fb33b0c4ffe6e5b1..9daa6c96cf51f2dc0164040a0bd56e75babb2088 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c @@ -1294,7 +1294,7 @@ static void dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane, int block, DECLARE_ALIGNED(16, uint8_t, recon[MAX_TX_SQUARE]); #endif // CONFIG_AOM_HIGHBITDEPTH - const PLANE_TYPE plane_type = plane == 0 ? PLANE_TYPE_Y : PLANE_TYPE_UV; + const PLANE_TYPE plane_type = get_plane_type(plane); INV_TXFM_PARAM inv_txfm_param; const int block_raster_idx = @@ -3770,7 +3770,7 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size, struct macroblockd_plane *const pd = &xd->plane[plane]; int64_t tmp; tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); - PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; + PLANE_TYPE plane_type = get_plane_type(plane); TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size); const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, is_inter_block(&xd->mi[0]->mbmi));