Remove cm parameter from vp9_decode_block_tokens() part 2
Change-Id: Iee24b6bb095f748333223e6036fc5c9d9e7e5f1c
This commit is contained in:
parent
877fac122b
commit
8bb37dd069
@ -124,9 +124,12 @@ struct macroblockd_plane {
|
||||
int subsampling_y;
|
||||
struct buf_2d dst;
|
||||
struct buf_2d pre[2];
|
||||
const int16_t *dequant;
|
||||
ENTROPY_CONTEXT *above_context;
|
||||
ENTROPY_CONTEXT *left_context;
|
||||
int16_t seg_dequant[MAX_SEGMENTS][2];
|
||||
|
||||
// encoder
|
||||
const int16_t *dequant;
|
||||
};
|
||||
|
||||
#define BLOCK_OFFSET(x, i) ((x) + (i) * 16)
|
||||
@ -159,6 +162,9 @@ typedef struct macroblockd {
|
||||
int mb_to_top_edge;
|
||||
int mb_to_bottom_edge;
|
||||
|
||||
FRAME_CONTEXT *fc;
|
||||
int frame_parallel_decoding_mode;
|
||||
|
||||
/* pointers to reference frames */
|
||||
RefBuffer *block_refs[2];
|
||||
|
||||
|
@ -341,6 +341,14 @@ static INLINE void init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd) {
|
||||
xd->plane[i].dqcoeff = xd->dqcoeff;
|
||||
xd->above_context[i] = cm->above_context +
|
||||
i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols);
|
||||
|
||||
if (xd->plane[i].plane_type == PLANE_TYPE_Y) {
|
||||
memcpy(xd->plane[i].seg_dequant, cm->y_dequant, sizeof(cm->y_dequant));
|
||||
} else {
|
||||
memcpy(xd->plane[i].seg_dequant, cm->uv_dequant, sizeof(cm->uv_dequant));
|
||||
}
|
||||
xd->fc = cm->fc;
|
||||
xd->frame_parallel_decoding_mode = cm->frame_parallel_decoding_mode;
|
||||
}
|
||||
|
||||
xd->above_seg_context = cm->above_seg_context;
|
||||
|
@ -290,7 +290,6 @@ static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block,
|
||||
}
|
||||
|
||||
struct intra_args {
|
||||
VP9_COMMON *cm;
|
||||
MACROBLOCKD *xd;
|
||||
vp9_reader *r;
|
||||
int seg_id;
|
||||
@ -300,7 +299,6 @@ static void predict_and_reconstruct_intra_block(int plane, int block,
|
||||
BLOCK_SIZE plane_bsize,
|
||||
TX_SIZE tx_size, void *arg) {
|
||||
struct intra_args *const args = (struct intra_args *)arg;
|
||||
VP9_COMMON *const cm = args->cm;
|
||||
MACROBLOCKD *const xd = args->xd;
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
MODE_INFO *const mi = xd->mi[0];
|
||||
@ -317,7 +315,7 @@ static void predict_and_reconstruct_intra_block(int plane, int block,
|
||||
x, y, plane);
|
||||
|
||||
if (!mi->mbmi.skip) {
|
||||
const int eob = vp9_decode_block_tokens(cm, xd, plane, block,
|
||||
const int eob = vp9_decode_block_tokens(xd, plane, block,
|
||||
plane_bsize, x, y, tx_size,
|
||||
args->r, args->seg_id);
|
||||
inverse_transform_block(xd, plane, block, tx_size, dst, pd->dst.stride,
|
||||
@ -326,7 +324,6 @@ static void predict_and_reconstruct_intra_block(int plane, int block,
|
||||
}
|
||||
|
||||
struct inter_args {
|
||||
VP9_COMMON *cm;
|
||||
MACROBLOCKD *xd;
|
||||
vp9_reader *r;
|
||||
int *eobtotal;
|
||||
@ -337,12 +334,11 @@ static void reconstruct_inter_block(int plane, int block,
|
||||
BLOCK_SIZE plane_bsize,
|
||||
TX_SIZE tx_size, void *arg) {
|
||||
struct inter_args *args = (struct inter_args *)arg;
|
||||
VP9_COMMON *const cm = args->cm;
|
||||
MACROBLOCKD *const xd = args->xd;
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
int x, y, eob;
|
||||
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y);
|
||||
eob = vp9_decode_block_tokens(cm, xd, plane, block, plane_bsize,
|
||||
eob = vp9_decode_block_tokens(xd, plane, block, plane_bsize,
|
||||
x, y, tx_size, args->r, args->seg_id);
|
||||
inverse_transform_block(xd, plane, block, tx_size,
|
||||
&pd->dst.buf[4 * y * pd->dst.stride + 4 * x],
|
||||
@ -395,7 +391,7 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
|
||||
}
|
||||
|
||||
if (!is_inter_block(mbmi)) {
|
||||
struct intra_args arg = {cm, xd, r, mbmi->segment_id};
|
||||
struct intra_args arg = {xd, r, mbmi->segment_id};
|
||||
vp9_foreach_transformed_block(xd, bsize,
|
||||
predict_and_reconstruct_intra_block, &arg);
|
||||
} else {
|
||||
@ -405,7 +401,7 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
|
||||
// Reconstruction
|
||||
if (!mbmi->skip) {
|
||||
int eobtotal = 0;
|
||||
struct inter_args arg = {cm, xd, r, &eobtotal, mbmi->segment_id};
|
||||
struct inter_args arg = {xd, r, &eobtotal, mbmi->segment_id};
|
||||
vp9_foreach_transformed_block(xd, bsize, reconstruct_inter_block, &arg);
|
||||
if (!less8x8 && eobtotal == 0)
|
||||
mbmi->skip = 1; // skip loopfilter
|
||||
|
@ -46,14 +46,14 @@ static INLINE int read_coeff(const vp9_prob *probs, int n, vp9_reader *r) {
|
||||
return val;
|
||||
}
|
||||
|
||||
static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
||||
static int decode_coefs(const MACROBLOCKD *xd,
|
||||
PLANE_TYPE type,
|
||||
tran_low_t *dqcoeff, TX_SIZE tx_size, const int16_t *dq,
|
||||
int ctx, const int16_t *scan, const int16_t *nb,
|
||||
vp9_reader *r) {
|
||||
FRAME_COUNTS *counts = xd->counts;
|
||||
const int max_eob = 16 << (tx_size << 1);
|
||||
const FRAME_CONTEXT *const fc = cm->fc;
|
||||
const FRAME_CONTEXT *const fc = xd->fc;
|
||||
const int ref = is_inter_block(&xd->mi[0]->mbmi);
|
||||
int band, c = 0;
|
||||
const vp9_prob (*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
|
||||
@ -76,8 +76,8 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
||||
const uint8_t *cat6_prob;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) {
|
||||
if (cm->bit_depth == VPX_BITS_10) {
|
||||
if (xd->bd > VPX_BITS_8) {
|
||||
if (xd->bd == VPX_BITS_10) {
|
||||
cat1_prob = vp9_cat1_prob_high10;
|
||||
cat2_prob = vp9_cat2_prob_high10;
|
||||
cat3_prob = vp9_cat3_prob_high10;
|
||||
@ -163,7 +163,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
||||
break;
|
||||
case CATEGORY6_TOKEN:
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
switch (cm->bit_depth) {
|
||||
switch (xd->bd) {
|
||||
case VPX_BITS_8:
|
||||
val = CAT6_MIN_VAL + read_coeff(cat6_prob, 14, r);
|
||||
break;
|
||||
@ -187,7 +187,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
||||
#if CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
dqcoeff[scan[c]] = highbd_check_range((vp9_read_bit(r) ? -v : v),
|
||||
cm->bit_depth);
|
||||
xd->bd);
|
||||
#else
|
||||
dqcoeff[scan[c]] = check_range(vp9_read_bit(r) ? -v : v);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
@ -203,18 +203,17 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
||||
return c;
|
||||
}
|
||||
|
||||
int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||
int vp9_decode_block_tokens(MACROBLOCKD *xd,
|
||||
int plane, int block,
|
||||
BLOCK_SIZE plane_bsize, int x, int y,
|
||||
TX_SIZE tx_size, vp9_reader *r,
|
||||
int seg_id) {
|
||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
const int16_t *const dequant = (plane == 0) ? cm->y_dequant[seg_id]
|
||||
: cm->uv_dequant[seg_id];
|
||||
const int16_t *const dequant = pd->seg_dequant[seg_id];
|
||||
const int ctx = get_entropy_context(tx_size, pd->above_context + x,
|
||||
pd->left_context + y);
|
||||
const scan_order *so = get_scan(xd, tx_size, pd->plane_type, block);
|
||||
const int eob = decode_coefs(cm, xd, pd->plane_type,
|
||||
const int eob = decode_coefs(xd, pd->plane_type,
|
||||
BLOCK_OFFSET(pd->dqcoeff, block), tx_size,
|
||||
dequant, ctx, so->scan, so->neighbors, r);
|
||||
vp9_set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y);
|
||||
|
@ -19,7 +19,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||
int vp9_decode_block_tokens(MACROBLOCKD *xd,
|
||||
int plane, int block,
|
||||
BLOCK_SIZE plane_bsize, int x, int y,
|
||||
TX_SIZE tx_size, vp9_reader *r,
|
||||
|
Loading…
x
Reference in New Issue
Block a user