Commit 99cb0d28 authored by Angie Chiang's avatar Angie Chiang
Browse files

Pass AV1_COMMON into get_scan()

This CL doesn't change coding behavior. It is to facilitate the
following implementation of adaptive scan order

Change-Id: I229963cb5185812a2da43f5c8a6506b296452a6a
parent 1e150c77
......@@ -72,7 +72,9 @@ static INLINE int get_coef_context(const int16_t *neighbors,
1;
}
static INLINE const SCAN_ORDER *get_scan(TX_SIZE tx_size, TX_TYPE tx_type) {
static INLINE const SCAN_ORDER *get_scan(const AV1_COMMON *const cm,
TX_SIZE tx_size, TX_TYPE tx_type) {
(void)cm;
return &av1_scan_orders[tx_size][tx_type];
}
......
......@@ -400,11 +400,9 @@ static void inverse_transform_block_intra(MACROBLOCKD *xd, int plane,
}
}
static void predict_and_reconstruct_intra_block(MACROBLOCKD *const xd,
aom_reader *r,
MB_MODE_INFO *const mbmi,
int plane, int row, int col,
TX_SIZE tx_size) {
static void predict_and_reconstruct_intra_block(
AV1_COMMON *cm, MACROBLOCKD *const xd, aom_reader *r,
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;
......@@ -420,7 +418,7 @@ static void predict_and_reconstruct_intra_block(MACROBLOCKD *const xd,
if (!mbmi->skip) {
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx);
const SCAN_ORDER *scan_order = get_scan(tx_size, tx_type);
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type);
const int eob = av1_decode_block_tokens(xd, plane, scan_order, col, row,
tx_size, r, mbmi->segment_id);
inverse_transform_block_intra(xd, plane, tx_type, tx_size, dst,
......@@ -428,14 +426,15 @@ static void predict_and_reconstruct_intra_block(MACROBLOCKD *const xd,
}
}
static int reconstruct_inter_block(MACROBLOCKD *const xd, aom_reader *r,
MB_MODE_INFO *const mbmi, int plane, int row,
int col, TX_SIZE tx_size) {
static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd,
aom_reader *r, MB_MODE_INFO *const mbmi,
int plane, int row, int col,
TX_SIZE tx_size) {
struct macroblockd_plane *const pd = &xd->plane[plane];
PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
int block_idx = (row << 1) + col;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx);
const SCAN_ORDER *scan_order = get_scan(tx_size, tx_type);
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type);
const int eob = av1_decode_block_tokens(xd, plane, scan_order, col, row,
tx_size, r, mbmi->segment_id);
......@@ -557,7 +556,7 @@ static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
for (row = 0; row < max_blocks_high; row += step)
for (col = 0; col < max_blocks_wide; col += step)
predict_and_reconstruct_intra_block(xd, r, mbmi, plane, row, col,
predict_and_reconstruct_intra_block(cm, xd, r, mbmi, plane, row, col,
tx_size);
}
} else {
......@@ -591,8 +590,8 @@ static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
for (row = 0; row < max_blocks_high; row += step)
for (col = 0; col < max_blocks_wide; col += step)
eobtotal +=
reconstruct_inter_block(xd, r, mbmi, plane, row, col, tx_size);
eobtotal += reconstruct_inter_block(cm, xd, r, mbmi, plane, row,
col, tx_size);
}
if (!less8x8 && eobtotal == 0)
......
......@@ -111,7 +111,7 @@ static int optimize_b(const AV1_COMMON *const cm, MACROBLOCK *mb, int plane,
const int16_t *dequant_ptr = pd->dequant;
const uint8_t *const band_translate = get_band_translate(tx_size);
TX_TYPE tx_type = get_tx_type(type, xd, block);
const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type);
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type);
const int16_t *const scan = scan_order->scan;
const int16_t *const nb = scan_order->neighbors;
int next = eob, sz = 0;
......@@ -126,7 +126,6 @@ static int optimize_b(const AV1_COMMON *const cm, MACROBLOCK *mb, int plane,
#else
const int *cat6_high_cost = av1_get_high_cost_table(8);
#endif
(void)cm;
assert((!type && !plane) || (type && plane));
assert(eob <= default_eob);
......@@ -340,7 +339,7 @@ void av1_xform_quant_fp(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
const struct macroblockd_plane *const pd = &xd->plane[plane];
PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block);
const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type);
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type);
tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
......@@ -599,7 +598,7 @@ void av1_xform_quant(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
const struct macroblockd_plane *const pd = &xd->plane[plane];
PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block);
const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type);
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type);
tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
......@@ -620,8 +619,6 @@ void av1_xform_quant(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
fwd_txfm_param.rd_transform = x->use_lp32x32fdct;
fwd_txfm_param.lossless = xd->lossless[seg_id];
(void)cm;
src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)];
#if CONFIG_AOM_HIGHBITDEPTH
......@@ -925,7 +922,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block);
const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type);
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type);
PREDICTION_MODE mode;
const int bwl = b_width_log2_lookup[plane_bsize];
const int bhl = b_height_log2_lookup[plane_bsize];
......@@ -951,8 +948,6 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
fwd_txfm_param.rd_transform = x->use_lp32x32fdct;
fwd_txfm_param.lossless = xd->lossless[seg_id];
(void)cm;
dst = &pd->dst.buf[4 * (blk_row * dst_stride + blk_col)];
src = &p->src.buf[4 * (blk_row * src_stride + blk_col)];
src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)];
......
......@@ -620,7 +620,7 @@ static void txfm_rd_in_plane(const AV1_COMMON *const cm, MACROBLOCK *x,
av1_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left);
tx_type = get_tx_type(pd->plane_type, xd, 0);
args.scan_order = get_scan(tx_size, tx_type);
args.scan_order = get_scan(cm, tx_size, tx_type);
av1_foreach_transformed_block_in_plane(xd, bsize, plane, block_rd_txfm,
&args);
......@@ -1077,7 +1077,7 @@ static int64_t rd_pick_intra4x4block(const AV1_COMP *const cpi, MACROBLOCK *x,
dst_stride, xd->bd);
if (xd->lossless[xd->mi[0]->mbmi.segment_id]) {
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const SCAN_ORDER *scan_order = get_scan(TX_4X4, tx_type);
const SCAN_ORDER *scan_order = get_scan(cm, TX_4X4, tx_type);
av1_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1);
av1_regular_quantize_b_4x4(x, 0, block, scan_order->scan,
scan_order->iscan);
......@@ -1093,7 +1093,7 @@ static int64_t rd_pick_intra4x4block(const AV1_COMP *const cpi, MACROBLOCK *x,
} else {
int64_t unused;
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const SCAN_ORDER *scan_order = get_scan(TX_4X4, tx_type);
const SCAN_ORDER *scan_order = get_scan(cm, TX_4X4, tx_type);
av1_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0);
av1_regular_quantize_b_4x4(x, 0, block, scan_order->scan,
scan_order->iscan);
......@@ -1176,7 +1176,7 @@ static int64_t rd_pick_intra4x4block(const AV1_COMP *const cpi, MACROBLOCK *x,
if (xd->lossless[xd->mi[0]->mbmi.segment_id]) {
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const SCAN_ORDER *scan_order = get_scan(TX_4X4, tx_type);
const SCAN_ORDER *scan_order = get_scan(cm, TX_4X4, tx_type);
av1_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1);
av1_regular_quantize_b_4x4(x, 0, block, scan_order->scan,
scan_order->iscan);
......@@ -1190,7 +1190,7 @@ static int64_t rd_pick_intra4x4block(const AV1_COMP *const cpi, MACROBLOCK *x,
} else {
int64_t unused;
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const SCAN_ORDER *scan_order = get_scan(TX_4X4, tx_type);
const SCAN_ORDER *scan_order = get_scan(cm, TX_4X4, tx_type);
av1_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0);
av1_regular_quantize_b_4x4(x, 0, block, scan_order->scan,
scan_order->iscan);
......@@ -2249,7 +2249,7 @@ static int64_t encode_inter_mb_segment(const AV1_COMP *const cpi, MACROBLOCK *x,
int64_t thisdistortion = 0, thissse = 0;
int thisrate = 0;
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, i);
const SCAN_ORDER *scan_order = get_scan(TX_4X4, tx_type);
const SCAN_ORDER *scan_order = get_scan(cm, TX_4X4, tx_type);
av1_build_inter_predictor_sub8x8(xd, 0, i, ir, ic, mi_row, mi_col);
......
......@@ -378,6 +378,7 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg) {
struct tokenize_b_args *const args = arg;
const AV1_COMP *cpi = args->cpi;
const AV1_COMMON *const cm = &cpi->common;
ThreadData *const td = args->td;
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
......@@ -395,7 +396,7 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
const int segment_id = mbmi->segment_id;
const int16_t *scan, *nb;
const TX_TYPE tx_type = get_tx_type(type, xd, block);
const SCAN_ORDER *const scan_order = get_scan(tx_size, tx_type);
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type);
const int ref = is_inter_block(mbmi);
unsigned int(*const counts)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
td->rd_counts.coef_counts[tx_size][type][ref];
......
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