Commit f779dba4 authored by Scott LaVarnway's avatar Scott LaVarnway

Remove counts param

Moved to MACROBLOCKD.

Change-Id: Icce765b334f2755f4fe2a4c39fb2ae2d7660d004
parent 71e88f90
......@@ -141,7 +141,7 @@ typedef struct RefBuffer {
typedef struct macroblockd {
struct macroblockd_plane plane[MAX_MB_PLANE];
FRAME_COUNTS *counts;
int mi_stride;
MODE_INFO **mi;
......
......@@ -292,7 +292,6 @@ static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block,
struct intra_args {
VP9_COMMON *cm;
MACROBLOCKD *xd;
FRAME_COUNTS *counts;
vp9_reader *r;
int seg_id;
};
......@@ -318,7 +317,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, args->counts, plane, block,
const int eob = vp9_decode_block_tokens(cm, 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,
......@@ -330,7 +329,6 @@ struct inter_args {
VP9_COMMON *cm;
MACROBLOCKD *xd;
vp9_reader *r;
FRAME_COUNTS *counts;
int *eobtotal;
int seg_id;
};
......@@ -344,7 +342,7 @@ static void reconstruct_inter_block(int plane, int block,
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, args->counts, plane, block, plane_bsize,
eob = vp9_decode_block_tokens(cm, 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],
......@@ -381,14 +379,13 @@ static MB_MODE_INFO *set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd,
}
static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
FRAME_COUNTS *counts,
const TileInfo *const tile,
int mi_row, int mi_col,
vp9_reader *r, BLOCK_SIZE bsize) {
VP9_COMMON *const cm = &pbi->common;
const int less8x8 = bsize < BLOCK_8X8;
MB_MODE_INFO *mbmi = set_offsets(cm, xd, tile, bsize, mi_row, mi_col);
vp9_read_mode_info(pbi, xd, counts, tile, mi_row, mi_col, r);
vp9_read_mode_info(pbi, xd, tile, mi_row, mi_col, r);
if (less8x8)
bsize = BLOCK_8X8;
......@@ -398,7 +395,7 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
}
if (!is_inter_block(mbmi)) {
struct intra_args arg = {cm, xd, counts, r, mbmi->segment_id};
struct intra_args arg = {cm, xd, r, mbmi->segment_id};
vp9_foreach_transformed_block(xd, bsize,
predict_and_reconstruct_intra_block, &arg);
} else {
......@@ -408,7 +405,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, counts, &eobtotal, mbmi->segment_id};
struct inter_args arg = {cm, 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
......@@ -419,13 +416,14 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
}
static PARTITION_TYPE read_partition(VP9_COMMON *cm, MACROBLOCKD *xd,
FRAME_COUNTS *counts, int hbs,
int hbs,
int mi_row, int mi_col, BLOCK_SIZE bsize,
vp9_reader *r) {
const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
const vp9_prob *const probs = get_partition_probs(cm, ctx);
const int has_rows = (mi_row + hbs) < cm->mi_rows;
const int has_cols = (mi_col + hbs) < cm->mi_cols;
FRAME_COUNTS *counts = xd->counts;
PARTITION_TYPE p;
if (has_rows && has_cols)
......@@ -437,14 +435,13 @@ static PARTITION_TYPE read_partition(VP9_COMMON *cm, MACROBLOCKD *xd,
else
p = PARTITION_SPLIT;
if (!cm->frame_parallel_decoding_mode)
if (counts)
++counts->partition[ctx][p];
return p;
}
static void decode_partition(VP9Decoder *const pbi, MACROBLOCKD *const xd,
FRAME_COUNTS *counts,
const TileInfo *const tile,
int mi_row, int mi_col,
vp9_reader* r, BLOCK_SIZE bsize) {
......@@ -456,37 +453,34 @@ static void decode_partition(VP9Decoder *const pbi, MACROBLOCKD *const xd,
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return;
partition = read_partition(cm, xd, counts, hbs, mi_row, mi_col, bsize, r);
partition = read_partition(cm, xd, hbs, mi_row, mi_col, bsize, r);
subsize = get_subsize(bsize, partition);
uv_subsize = ss_size_lookup[subsize][cm->subsampling_x][cm->subsampling_y];
if (subsize >= BLOCK_8X8 && uv_subsize == BLOCK_INVALID)
vpx_internal_error(xd->error_info,
VPX_CODEC_CORRUPT_FRAME, "Invalid block size.");
if (subsize < BLOCK_8X8) {
decode_block(pbi, xd, counts, tile, mi_row, mi_col, r, subsize);
decode_block(pbi, xd, tile, mi_row, mi_col, r, subsize);
} else {
switch (partition) {
case PARTITION_NONE:
decode_block(pbi, xd, counts, tile, mi_row, mi_col, r, subsize);
decode_block(pbi, xd, tile, mi_row, mi_col, r, subsize);
break;
case PARTITION_HORZ:
decode_block(pbi, xd, counts, tile, mi_row, mi_col, r, subsize);
decode_block(pbi, xd, tile, mi_row, mi_col, r, subsize);
if (mi_row + hbs < cm->mi_rows)
decode_block(pbi, xd, counts, tile, mi_row + hbs, mi_col, r, subsize);
decode_block(pbi, xd, tile, mi_row + hbs, mi_col, r, subsize);
break;
case PARTITION_VERT:
decode_block(pbi, xd, counts, tile, mi_row, mi_col, r, subsize);
decode_block(pbi, xd, tile, mi_row, mi_col, r, subsize);
if (mi_col + hbs < cm->mi_cols)
decode_block(pbi, xd, counts, tile, mi_row, mi_col + hbs, r, subsize);
decode_block(pbi, xd, tile, mi_row, mi_col + hbs, r, subsize);
break;
case PARTITION_SPLIT:
decode_partition(pbi, xd, counts, tile, mi_row, mi_col, r, subsize);
decode_partition(pbi, xd, counts, tile, mi_row, mi_col + hbs, r,
subsize);
decode_partition(pbi, xd, counts, tile, mi_row + hbs, mi_col, r,
subsize);
decode_partition(pbi, xd, counts, tile, mi_row + hbs, mi_col + hbs, r,
subsize);
decode_partition(pbi, xd, tile, mi_row, mi_col, r, subsize);
decode_partition(pbi, xd, tile, mi_row, mi_col + hbs, r, subsize);
decode_partition(pbi, xd, tile, mi_row + hbs, mi_col, r, subsize);
decode_partition(pbi, xd, tile, mi_row + hbs, mi_col + hbs, r, subsize);
break;
default:
assert(0 && "Invalid partition type");
......@@ -981,6 +975,8 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
tile_data->cm = cm;
tile_data->xd = pbi->mb;
tile_data->xd.corrupted = 0;
tile_data->xd.counts = cm->frame_parallel_decoding_mode ?
NULL : &cm->counts;
vp9_tile_init(&tile, tile_data->cm, tile_row, tile_col);
setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
&tile_data->bit_reader, pbi->decrypt_cb,
......@@ -1003,7 +999,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
vp9_zero(tile_data->xd.left_seg_context);
for (mi_col = tile.mi_col_start; mi_col < tile.mi_col_end;
mi_col += MI_BLOCK_SIZE) {
decode_partition(pbi, &tile_data->xd, &cm->counts, &tile, mi_row,
decode_partition(pbi, &tile_data->xd, &tile, mi_row,
mi_col, &tile_data->bit_reader, BLOCK_64X64);
}
pbi->mb.corrupted |= tile_data->xd.corrupted;
......@@ -1076,7 +1072,7 @@ static int tile_worker_hook(TileWorkerData *const tile_data,
vp9_zero(tile_data->xd.left_seg_context);
for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
mi_col += MI_BLOCK_SIZE) {
decode_partition(tile_data->pbi, &tile_data->xd, &tile_data->counts,
decode_partition(tile_data->pbi, &tile_data->xd,
tile, mi_row, mi_col, &tile_data->bit_reader,
BLOCK_64X64);
}
......@@ -1200,6 +1196,8 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
tile_data->pbi = pbi;
tile_data->xd = pbi->mb;
tile_data->xd.corrupted = 0;
tile_data->xd.counts = cm->frame_parallel_decoding_mode ?
0 : &tile_data->counts;
vp9_tile_init(tile, cm, 0, buf->col);
setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
&tile_data->bit_reader, pbi->decrypt_cb,
......
This diff is collapsed.
......@@ -21,7 +21,6 @@ extern "C" {
struct TileInfo;
void vp9_read_mode_info(VP9Decoder *const pbi, MACROBLOCKD *xd,
FRAME_COUNTS *counts,
const struct TileInfo *const tile,
int mi_row, int mi_col, vp9_reader *r);
......
......@@ -35,7 +35,7 @@
#define INCREMENT_COUNT(token) \
do { \
if (!cm->frame_parallel_decoding_mode) \
if (counts) \
++coef_counts[band][ctx][token]; \
} while (0)
......@@ -47,10 +47,11 @@ static INLINE int read_coeff(const vp9_prob *probs, int n, vp9_reader *r) {
}
static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
FRAME_COUNTS *counts, PLANE_TYPE type,
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 int ref = is_inter_block(&xd->mi[0]->mbmi);
......@@ -112,7 +113,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
int val = -1;
band = *band_translate++;
prob = coef_probs[band][ctx];
if (!cm->frame_parallel_decoding_mode)
if (counts)
++eob_branch_count[band][ctx];
if (!vp9_read(r, prob[EOB_CONTEXT_NODE])) {
INCREMENT_COUNT(EOB_MODEL_TOKEN);
......@@ -203,7 +204,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
}
int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
FRAME_COUNTS *counts, int plane, int block,
int plane, int block,
BLOCK_SIZE plane_bsize, int x, int y,
TX_SIZE tx_size, vp9_reader *r,
int seg_id) {
......@@ -213,7 +214,7 @@ int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
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, counts, pd->plane_type,
const int eob = decode_coefs(cm, 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);
......
......@@ -20,7 +20,7 @@ extern "C" {
#endif
int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
FRAME_COUNTS *counts, int plane, int block,
int plane, int block,
BLOCK_SIZE plane_bsize, int x, int y,
TX_SIZE tx_size, vp9_reader *r,
int seg_id);
......
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