Commit 005feb6b authored by Luc Trudeau's avatar Luc Trudeau

Add get_plane_type() helper function.

Adds the static inline function get_plane_type to convert a plane number
to the corresponding PLANE_TYPE.

There's no change to the bitstream, it only encapsulates the logic to
get the PLANE_TYPE.

Change-Id: I1199db3a32c89437d9c029ab5b2b2e62582a13a2
parent d59fa2ae
...@@ -244,7 +244,7 @@ void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) { ...@@ -244,7 +244,7 @@ void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
int i; int i;
for (i = 0; i < MAX_MB_PLANE; 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_x = i ? ss_x : 0;
xd->plane[i].subsampling_y = i ? ss_y : 0; xd->plane[i].subsampling_y = i ? ss_y : 0;
} }
......
...@@ -1123,6 +1123,10 @@ static INLINE int is_nontrans_global_motion(const MACROBLOCKD *xd) { ...@@ -1123,6 +1123,10 @@ static INLINE int is_nontrans_global_motion(const MACROBLOCKD *xd) {
} }
#endif // CONFIG_GLOBAL_MOTION #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 #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif
......
...@@ -496,7 +496,7 @@ static void predict_and_reconstruct_intra_block( ...@@ -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) { MB_MODE_INFO *const mbmi, int plane, int row, int col, TX_SIZE tx_size) {
struct macroblockd_plane *const pd = &xd->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane];
PREDICTION_MODE mode = (plane == 0) ? mbmi->mode : mbmi->uv_mode; 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; uint8_t *dst;
const int block_idx = (row << 1) + col; const int block_idx = (row << 1) + col;
#if CONFIG_PVQ #if CONFIG_PVQ
...@@ -555,7 +555,7 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd, ...@@ -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 (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
if (tx_size == plane_tx_size) { 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; int block_idx = (blk_row << 1) + blk_col;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, plane_tx_size); 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); 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, ...@@ -599,7 +599,7 @@ static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd,
aom_reader *const r, int segment_id, aom_reader *const r, int segment_id,
int plane, int row, int col, int plane, int row, int col,
TX_SIZE tx_size) { 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; int block_idx = (row << 1) + col;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size); TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size);
#if CONFIG_PVQ #if CONFIG_PVQ
......
...@@ -503,7 +503,7 @@ void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block, ...@@ -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 macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane];
#endif #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); 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); 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); 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, ...@@ -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 macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane];
tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); 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 int block_raster_idx = av1_block_index_to_raster_order(tx_size, block);
const TX_TYPE tx_type = const TX_TYPE tx_type =
get_tx_type(plane_type, xd, block_raster_idx, tx_size); get_tx_type(plane_type, xd, block_raster_idx, tx_size);
......
...@@ -1294,7 +1294,7 @@ static void dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane, int block, ...@@ -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]); DECLARE_ALIGNED(16, uint8_t, recon[MAX_TX_SQUARE]);
#endif // CONFIG_AOM_HIGHBITDEPTH #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; INV_TXFM_PARAM inv_txfm_param;
const int block_raster_idx = 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, ...@@ -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]; struct macroblockd_plane *const pd = &xd->plane[plane];
int64_t tmp; int64_t tmp;
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); 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); TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
const SCAN_ORDER *const scan_order = const SCAN_ORDER *const scan_order =
get_scan(cm, tx_size, tx_type, is_inter_block(&xd->mi[0]->mbmi)); get_scan(cm, tx_size, tx_type, is_inter_block(&xd->mi[0]->mbmi));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment