Commit 7ccd7fc3 authored by Scott LaVarnway's avatar Scott LaVarnway Committed by Gerrit Code Review

Merge "Remove cm parameter from vp9_decode_block_tokens() part 2"

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