Remove counts param
Moved to MACROBLOCKD. Change-Id: Icce765b334f2755f4fe2a4c39fb2ae2d7660d004
This commit is contained in:
parent
71e88f903d
commit
f779dba405
@ -141,7 +141,7 @@ typedef struct RefBuffer {
|
|||||||
|
|
||||||
typedef struct macroblockd {
|
typedef struct macroblockd {
|
||||||
struct macroblockd_plane plane[MAX_MB_PLANE];
|
struct macroblockd_plane plane[MAX_MB_PLANE];
|
||||||
|
FRAME_COUNTS *counts;
|
||||||
int mi_stride;
|
int mi_stride;
|
||||||
|
|
||||||
MODE_INFO **mi;
|
MODE_INFO **mi;
|
||||||
|
@ -292,7 +292,6 @@ static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block,
|
|||||||
struct intra_args {
|
struct intra_args {
|
||||||
VP9_COMMON *cm;
|
VP9_COMMON *cm;
|
||||||
MACROBLOCKD *xd;
|
MACROBLOCKD *xd;
|
||||||
FRAME_COUNTS *counts;
|
|
||||||
vp9_reader *r;
|
vp9_reader *r;
|
||||||
int seg_id;
|
int seg_id;
|
||||||
};
|
};
|
||||||
@ -318,7 +317,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, args->counts, plane, block,
|
const int eob = vp9_decode_block_tokens(cm, 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,
|
||||||
@ -330,7 +329,6 @@ struct inter_args {
|
|||||||
VP9_COMMON *cm;
|
VP9_COMMON *cm;
|
||||||
MACROBLOCKD *xd;
|
MACROBLOCKD *xd;
|
||||||
vp9_reader *r;
|
vp9_reader *r;
|
||||||
FRAME_COUNTS *counts;
|
|
||||||
int *eobtotal;
|
int *eobtotal;
|
||||||
int seg_id;
|
int seg_id;
|
||||||
};
|
};
|
||||||
@ -344,7 +342,7 @@ static void reconstruct_inter_block(int plane, int block,
|
|||||||
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, 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);
|
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],
|
||||||
@ -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,
|
static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
const TileInfo *const tile,
|
const TileInfo *const tile,
|
||||||
int mi_row, int mi_col,
|
int mi_row, int mi_col,
|
||||||
vp9_reader *r, BLOCK_SIZE bsize) {
|
vp9_reader *r, BLOCK_SIZE bsize) {
|
||||||
VP9_COMMON *const cm = &pbi->common;
|
VP9_COMMON *const cm = &pbi->common;
|
||||||
const int less8x8 = bsize < BLOCK_8X8;
|
const int less8x8 = bsize < BLOCK_8X8;
|
||||||
MB_MODE_INFO *mbmi = set_offsets(cm, xd, tile, bsize, mi_row, mi_col);
|
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)
|
if (less8x8)
|
||||||
bsize = BLOCK_8X8;
|
bsize = BLOCK_8X8;
|
||||||
@ -398,7 +395,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, counts, r, mbmi->segment_id};
|
struct intra_args arg = {cm, 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 {
|
||||||
@ -408,7 +405,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, 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);
|
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
|
||||||
@ -419,13 +416,14 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PARTITION_TYPE read_partition(VP9_COMMON *cm, MACROBLOCKD *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,
|
int mi_row, int mi_col, BLOCK_SIZE bsize,
|
||||||
vp9_reader *r) {
|
vp9_reader *r) {
|
||||||
const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
|
const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
|
||||||
const vp9_prob *const probs = get_partition_probs(cm, ctx);
|
const vp9_prob *const probs = get_partition_probs(cm, ctx);
|
||||||
const int has_rows = (mi_row + hbs) < cm->mi_rows;
|
const int has_rows = (mi_row + hbs) < cm->mi_rows;
|
||||||
const int has_cols = (mi_col + hbs) < cm->mi_cols;
|
const int has_cols = (mi_col + hbs) < cm->mi_cols;
|
||||||
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
PARTITION_TYPE p;
|
PARTITION_TYPE p;
|
||||||
|
|
||||||
if (has_rows && has_cols)
|
if (has_rows && has_cols)
|
||||||
@ -437,14 +435,13 @@ static PARTITION_TYPE read_partition(VP9_COMMON *cm, MACROBLOCKD *xd,
|
|||||||
else
|
else
|
||||||
p = PARTITION_SPLIT;
|
p = PARTITION_SPLIT;
|
||||||
|
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
if (counts)
|
||||||
++counts->partition[ctx][p];
|
++counts->partition[ctx][p];
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void decode_partition(VP9Decoder *const pbi, MACROBLOCKD *const xd,
|
static void decode_partition(VP9Decoder *const pbi, MACROBLOCKD *const xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
const TileInfo *const tile,
|
const TileInfo *const tile,
|
||||||
int mi_row, int mi_col,
|
int mi_row, int mi_col,
|
||||||
vp9_reader* r, BLOCK_SIZE bsize) {
|
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)
|
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
|
||||||
return;
|
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);
|
subsize = get_subsize(bsize, partition);
|
||||||
uv_subsize = ss_size_lookup[subsize][cm->subsampling_x][cm->subsampling_y];
|
uv_subsize = ss_size_lookup[subsize][cm->subsampling_x][cm->subsampling_y];
|
||||||
if (subsize >= BLOCK_8X8 && uv_subsize == BLOCK_INVALID)
|
if (subsize >= BLOCK_8X8 && uv_subsize == BLOCK_INVALID)
|
||||||
vpx_internal_error(xd->error_info,
|
vpx_internal_error(xd->error_info,
|
||||||
VPX_CODEC_CORRUPT_FRAME, "Invalid block size.");
|
VPX_CODEC_CORRUPT_FRAME, "Invalid block size.");
|
||||||
if (subsize < BLOCK_8X8) {
|
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 {
|
} else {
|
||||||
switch (partition) {
|
switch (partition) {
|
||||||
case PARTITION_NONE:
|
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;
|
break;
|
||||||
case PARTITION_HORZ:
|
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)
|
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;
|
break;
|
||||||
case PARTITION_VERT:
|
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)
|
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;
|
break;
|
||||||
case PARTITION_SPLIT:
|
case PARTITION_SPLIT:
|
||||||
decode_partition(pbi, xd, counts, tile, mi_row, mi_col, r, subsize);
|
decode_partition(pbi, xd, tile, mi_row, mi_col, r, subsize);
|
||||||
decode_partition(pbi, xd, counts, tile, mi_row, mi_col + hbs, r,
|
decode_partition(pbi, xd, tile, mi_row, mi_col + hbs, r, subsize);
|
||||||
subsize);
|
decode_partition(pbi, xd, tile, mi_row + hbs, mi_col, r, subsize);
|
||||||
decode_partition(pbi, xd, counts, tile, mi_row + hbs, mi_col, r,
|
decode_partition(pbi, xd, tile, mi_row + hbs, mi_col + hbs, r, subsize);
|
||||||
subsize);
|
|
||||||
decode_partition(pbi, xd, counts, tile, mi_row + hbs, mi_col + hbs, r,
|
|
||||||
subsize);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0 && "Invalid partition type");
|
assert(0 && "Invalid partition type");
|
||||||
@ -981,6 +975,8 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
|
|||||||
tile_data->cm = cm;
|
tile_data->cm = cm;
|
||||||
tile_data->xd = pbi->mb;
|
tile_data->xd = pbi->mb;
|
||||||
tile_data->xd.corrupted = 0;
|
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);
|
vp9_tile_init(&tile, tile_data->cm, tile_row, tile_col);
|
||||||
setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
|
setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
|
||||||
&tile_data->bit_reader, pbi->decrypt_cb,
|
&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);
|
vp9_zero(tile_data->xd.left_seg_context);
|
||||||
for (mi_col = tile.mi_col_start; mi_col < tile.mi_col_end;
|
for (mi_col = tile.mi_col_start; mi_col < tile.mi_col_end;
|
||||||
mi_col += MI_BLOCK_SIZE) {
|
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);
|
mi_col, &tile_data->bit_reader, BLOCK_64X64);
|
||||||
}
|
}
|
||||||
pbi->mb.corrupted |= tile_data->xd.corrupted;
|
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);
|
vp9_zero(tile_data->xd.left_seg_context);
|
||||||
for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
|
for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
|
||||||
mi_col += MI_BLOCK_SIZE) {
|
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,
|
tile, mi_row, mi_col, &tile_data->bit_reader,
|
||||||
BLOCK_64X64);
|
BLOCK_64X64);
|
||||||
}
|
}
|
||||||
@ -1200,6 +1196,8 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
|
|||||||
tile_data->pbi = pbi;
|
tile_data->pbi = pbi;
|
||||||
tile_data->xd = pbi->mb;
|
tile_data->xd = pbi->mb;
|
||||||
tile_data->xd.corrupted = 0;
|
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);
|
vp9_tile_init(tile, cm, 0, buf->col);
|
||||||
setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
|
setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
|
||||||
&tile_data->bit_reader, pbi->decrypt_cb,
|
&tile_data->bit_reader, pbi->decrypt_cb,
|
||||||
|
@ -27,30 +27,33 @@ static PREDICTION_MODE read_intra_mode(vp9_reader *r, const vp9_prob *p) {
|
|||||||
return (PREDICTION_MODE)vp9_read_tree(r, vp9_intra_mode_tree, p);
|
return (PREDICTION_MODE)vp9_read_tree(r, vp9_intra_mode_tree, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PREDICTION_MODE read_intra_mode_y(VP9_COMMON *cm, FRAME_COUNTS *counts,
|
static PREDICTION_MODE read_intra_mode_y(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||||
vp9_reader *r, int size_group) {
|
vp9_reader *r, int size_group) {
|
||||||
const PREDICTION_MODE y_mode =
|
const PREDICTION_MODE y_mode =
|
||||||
read_intra_mode(r, cm->fc->y_mode_prob[size_group]);
|
read_intra_mode(r, cm->fc->y_mode_prob[size_group]);
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
|
if (counts)
|
||||||
++counts->y_mode[size_group][y_mode];
|
++counts->y_mode[size_group][y_mode];
|
||||||
return y_mode;
|
return y_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PREDICTION_MODE read_intra_mode_uv(VP9_COMMON *cm, FRAME_COUNTS *counts,
|
static PREDICTION_MODE read_intra_mode_uv(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||||
vp9_reader *r,
|
vp9_reader *r,
|
||||||
PREDICTION_MODE y_mode) {
|
PREDICTION_MODE y_mode) {
|
||||||
const PREDICTION_MODE uv_mode = read_intra_mode(r,
|
const PREDICTION_MODE uv_mode = read_intra_mode(r,
|
||||||
cm->fc->uv_mode_prob[y_mode]);
|
cm->fc->uv_mode_prob[y_mode]);
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
|
if (counts)
|
||||||
++counts->uv_mode[y_mode][uv_mode];
|
++counts->uv_mode[y_mode][uv_mode];
|
||||||
return uv_mode;
|
return uv_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PREDICTION_MODE read_inter_mode(VP9_COMMON *cm, FRAME_COUNTS *counts,
|
static PREDICTION_MODE read_inter_mode(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||||
vp9_reader *r, int ctx) {
|
vp9_reader *r, int ctx) {
|
||||||
const int mode = vp9_read_tree(r, vp9_inter_mode_tree,
|
const int mode = vp9_read_tree(r, vp9_inter_mode_tree,
|
||||||
cm->fc->inter_mode_probs[ctx]);
|
cm->fc->inter_mode_probs[ctx]);
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
|
if (counts)
|
||||||
++counts->inter_mode[ctx][mode];
|
++counts->inter_mode[ctx][mode];
|
||||||
|
|
||||||
return NEARESTMV + mode;
|
return NEARESTMV + mode;
|
||||||
@ -61,8 +64,8 @@ static int read_segment_id(vp9_reader *r, const struct segmentation *seg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static TX_SIZE read_selected_tx_size(VP9_COMMON *cm, MACROBLOCKD *xd,
|
static TX_SIZE read_selected_tx_size(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
TX_SIZE max_tx_size, vp9_reader *r) {
|
TX_SIZE max_tx_size, vp9_reader *r) {
|
||||||
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
const int ctx = vp9_get_tx_size_context(xd);
|
const int ctx = vp9_get_tx_size_context(xd);
|
||||||
const vp9_prob *tx_probs = get_tx_probs(max_tx_size, ctx, &cm->fc->tx_probs);
|
const vp9_prob *tx_probs = get_tx_probs(max_tx_size, ctx, &cm->fc->tx_probs);
|
||||||
int tx_size = vp9_read(r, tx_probs[0]);
|
int tx_size = vp9_read(r, tx_probs[0]);
|
||||||
@ -72,19 +75,18 @@ static TX_SIZE read_selected_tx_size(VP9_COMMON *cm, MACROBLOCKD *xd,
|
|||||||
tx_size += vp9_read(r, tx_probs[2]);
|
tx_size += vp9_read(r, tx_probs[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
if (counts)
|
||||||
++get_tx_counts(max_tx_size, ctx, &counts->tx)[tx_size];
|
++get_tx_counts(max_tx_size, ctx, &counts->tx)[tx_size];
|
||||||
return (TX_SIZE)tx_size;
|
return (TX_SIZE)tx_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static TX_SIZE read_tx_size(VP9_COMMON *cm, MACROBLOCKD *xd,
|
static TX_SIZE read_tx_size(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
int allow_select, vp9_reader *r) {
|
int allow_select, vp9_reader *r) {
|
||||||
TX_MODE tx_mode = cm->tx_mode;
|
TX_MODE tx_mode = cm->tx_mode;
|
||||||
BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
|
BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
|
||||||
const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
|
const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
|
||||||
if (allow_select && tx_mode == TX_MODE_SELECT && bsize >= BLOCK_8X8)
|
if (allow_select && tx_mode == TX_MODE_SELECT && bsize >= BLOCK_8X8)
|
||||||
return read_selected_tx_size(cm, xd, counts, max_tx_size, r);
|
return read_selected_tx_size(cm, xd, max_tx_size, r);
|
||||||
else
|
else
|
||||||
return MIN(max_tx_size, tx_mode_to_biggest_tx_size[tx_mode]);
|
return MIN(max_tx_size, tx_mode_to_biggest_tx_size[tx_mode]);
|
||||||
}
|
}
|
||||||
@ -174,14 +176,14 @@ static int read_inter_segment_id(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int read_skip(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
static int read_skip(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
int segment_id, vp9_reader *r) {
|
int segment_id, vp9_reader *r) {
|
||||||
if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) {
|
if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
const int ctx = vp9_get_skip_context(xd);
|
const int ctx = vp9_get_skip_context(xd);
|
||||||
const int skip = vp9_read(r, cm->fc->skip_probs[ctx]);
|
const int skip = vp9_read(r, cm->fc->skip_probs[ctx]);
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
|
if (counts)
|
||||||
++counts->skip[ctx][skip];
|
++counts->skip[ctx][skip];
|
||||||
return skip;
|
return skip;
|
||||||
}
|
}
|
||||||
@ -189,7 +191,6 @@ static int read_skip(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
|||||||
|
|
||||||
static void read_intra_frame_mode_info(VP9_COMMON *const cm,
|
static void read_intra_frame_mode_info(VP9_COMMON *const cm,
|
||||||
MACROBLOCKD *const xd,
|
MACROBLOCKD *const xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
int mi_row, int mi_col, vp9_reader *r) {
|
int mi_row, int mi_col, vp9_reader *r) {
|
||||||
MODE_INFO *const mi = xd->mi[0];
|
MODE_INFO *const mi = xd->mi[0];
|
||||||
MB_MODE_INFO *const mbmi = &mi->mbmi;
|
MB_MODE_INFO *const mbmi = &mi->mbmi;
|
||||||
@ -199,8 +200,8 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
mbmi->segment_id = read_intra_segment_id(cm, bsize, mi_row, mi_col, r);
|
mbmi->segment_id = read_intra_segment_id(cm, bsize, mi_row, mi_col, r);
|
||||||
mbmi->skip = read_skip(cm, xd, counts, mbmi->segment_id, r);
|
mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r);
|
||||||
mbmi->tx_size = read_tx_size(cm, xd, counts, 1, r);
|
mbmi->tx_size = read_tx_size(cm, xd, 1, r);
|
||||||
mbmi->ref_frame[0] = INTRA_FRAME;
|
mbmi->ref_frame[0] = INTRA_FRAME;
|
||||||
mbmi->ref_frame[1] = NONE;
|
mbmi->ref_frame[1] = NONE;
|
||||||
|
|
||||||
@ -285,13 +286,13 @@ static INLINE void read_mv(vp9_reader *r, MV *mv, const MV *ref,
|
|||||||
|
|
||||||
static REFERENCE_MODE read_block_reference_mode(VP9_COMMON *cm,
|
static REFERENCE_MODE read_block_reference_mode(VP9_COMMON *cm,
|
||||||
const MACROBLOCKD *xd,
|
const MACROBLOCKD *xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
vp9_reader *r) {
|
vp9_reader *r) {
|
||||||
if (cm->reference_mode == REFERENCE_MODE_SELECT) {
|
if (cm->reference_mode == REFERENCE_MODE_SELECT) {
|
||||||
const int ctx = vp9_get_reference_mode_context(cm, xd);
|
const int ctx = vp9_get_reference_mode_context(cm, xd);
|
||||||
const REFERENCE_MODE mode =
|
const REFERENCE_MODE mode =
|
||||||
(REFERENCE_MODE)vp9_read(r, cm->fc->comp_inter_prob[ctx]);
|
(REFERENCE_MODE)vp9_read(r, cm->fc->comp_inter_prob[ctx]);
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
|
if (counts)
|
||||||
++counts->comp_inter[ctx][mode];
|
++counts->comp_inter[ctx][mode];
|
||||||
return mode; // SINGLE_REFERENCE or COMPOUND_REFERENCE
|
return mode; // SINGLE_REFERENCE or COMPOUND_REFERENCE
|
||||||
} else {
|
} else {
|
||||||
@ -301,34 +302,35 @@ static REFERENCE_MODE read_block_reference_mode(VP9_COMMON *cm,
|
|||||||
|
|
||||||
// Read the referncence frame
|
// Read the referncence frame
|
||||||
static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
||||||
FRAME_COUNTS *counts, vp9_reader *r,
|
vp9_reader *r,
|
||||||
int segment_id, MV_REFERENCE_FRAME ref_frame[2]) {
|
int segment_id, MV_REFERENCE_FRAME ref_frame[2]) {
|
||||||
FRAME_CONTEXT *const fc = cm->fc;
|
FRAME_CONTEXT *const fc = cm->fc;
|
||||||
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
|
|
||||||
if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
|
if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
|
||||||
ref_frame[0] = (MV_REFERENCE_FRAME)vp9_get_segdata(&cm->seg, segment_id,
|
ref_frame[0] = (MV_REFERENCE_FRAME)vp9_get_segdata(&cm->seg, segment_id,
|
||||||
SEG_LVL_REF_FRAME);
|
SEG_LVL_REF_FRAME);
|
||||||
ref_frame[1] = NONE;
|
ref_frame[1] = NONE;
|
||||||
} else {
|
} else {
|
||||||
const REFERENCE_MODE mode = read_block_reference_mode(cm, xd, counts, r);
|
const REFERENCE_MODE mode = read_block_reference_mode(cm, xd, r);
|
||||||
// FIXME(rbultje) I'm pretty sure this breaks segmentation ref frame coding
|
// FIXME(rbultje) I'm pretty sure this breaks segmentation ref frame coding
|
||||||
if (mode == COMPOUND_REFERENCE) {
|
if (mode == COMPOUND_REFERENCE) {
|
||||||
const int idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref];
|
const int idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref];
|
||||||
const int ctx = vp9_get_pred_context_comp_ref_p(cm, xd);
|
const int ctx = vp9_get_pred_context_comp_ref_p(cm, xd);
|
||||||
const int bit = vp9_read(r, fc->comp_ref_prob[ctx]);
|
const int bit = vp9_read(r, fc->comp_ref_prob[ctx]);
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
if (counts)
|
||||||
++counts->comp_ref[ctx][bit];
|
++counts->comp_ref[ctx][bit];
|
||||||
ref_frame[idx] = cm->comp_fixed_ref;
|
ref_frame[idx] = cm->comp_fixed_ref;
|
||||||
ref_frame[!idx] = cm->comp_var_ref[bit];
|
ref_frame[!idx] = cm->comp_var_ref[bit];
|
||||||
} else if (mode == SINGLE_REFERENCE) {
|
} else if (mode == SINGLE_REFERENCE) {
|
||||||
const int ctx0 = vp9_get_pred_context_single_ref_p1(xd);
|
const int ctx0 = vp9_get_pred_context_single_ref_p1(xd);
|
||||||
const int bit0 = vp9_read(r, fc->single_ref_prob[ctx0][0]);
|
const int bit0 = vp9_read(r, fc->single_ref_prob[ctx0][0]);
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
if (counts)
|
||||||
++counts->single_ref[ctx0][0][bit0];
|
++counts->single_ref[ctx0][0][bit0];
|
||||||
if (bit0) {
|
if (bit0) {
|
||||||
const int ctx1 = vp9_get_pred_context_single_ref_p2(xd);
|
const int ctx1 = vp9_get_pred_context_single_ref_p2(xd);
|
||||||
const int bit1 = vp9_read(r, fc->single_ref_prob[ctx1][1]);
|
const int bit1 = vp9_read(r, fc->single_ref_prob[ctx1][1]);
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
if (counts)
|
||||||
++counts->single_ref[ctx1][1][bit1];
|
++counts->single_ref[ctx1][1][bit1];
|
||||||
ref_frame[0] = bit1 ? ALTREF_FRAME : GOLDEN_FRAME;
|
ref_frame[0] = bit1 ? ALTREF_FRAME : GOLDEN_FRAME;
|
||||||
} else {
|
} else {
|
||||||
@ -345,18 +347,19 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
|||||||
|
|
||||||
static INLINE INTERP_FILTER read_switchable_interp_filter(
|
static INLINE INTERP_FILTER read_switchable_interp_filter(
|
||||||
VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
||||||
FRAME_COUNTS *counts, vp9_reader *r) {
|
vp9_reader *r) {
|
||||||
const int ctx = vp9_get_pred_context_switchable_interp(xd);
|
const int ctx = vp9_get_pred_context_switchable_interp(xd);
|
||||||
const INTERP_FILTER type =
|
const INTERP_FILTER type =
|
||||||
(INTERP_FILTER)vp9_read_tree(r, vp9_switchable_interp_tree,
|
(INTERP_FILTER)vp9_read_tree(r, vp9_switchable_interp_tree,
|
||||||
cm->fc->switchable_interp_prob[ctx]);
|
cm->fc->switchable_interp_prob[ctx]);
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
|
if (counts)
|
||||||
++counts->switchable_interp[ctx][type];
|
++counts->switchable_interp[ctx][type];
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_intra_block_mode_info(VP9_COMMON *const cm,
|
static void read_intra_block_mode_info(VP9_COMMON *const cm,
|
||||||
FRAME_COUNTS *counts, MODE_INFO *mi,
|
MACROBLOCKD *const xd, MODE_INFO *mi,
|
||||||
vp9_reader *r) {
|
vp9_reader *r) {
|
||||||
MB_MODE_INFO *const mbmi = &mi->mbmi;
|
MB_MODE_INFO *const mbmi = &mi->mbmi;
|
||||||
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
|
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
|
||||||
@ -368,26 +371,26 @@ static void read_intra_block_mode_info(VP9_COMMON *const cm,
|
|||||||
switch (bsize) {
|
switch (bsize) {
|
||||||
case BLOCK_4X4:
|
case BLOCK_4X4:
|
||||||
for (i = 0; i < 4; ++i)
|
for (i = 0; i < 4; ++i)
|
||||||
mi->bmi[i].as_mode = read_intra_mode_y(cm, counts, r, 0);
|
mi->bmi[i].as_mode = read_intra_mode_y(cm, xd, r, 0);
|
||||||
mbmi->mode = mi->bmi[3].as_mode;
|
mbmi->mode = mi->bmi[3].as_mode;
|
||||||
break;
|
break;
|
||||||
case BLOCK_4X8:
|
case BLOCK_4X8:
|
||||||
mi->bmi[0].as_mode = mi->bmi[2].as_mode = read_intra_mode_y(cm, counts,
|
mi->bmi[0].as_mode = mi->bmi[2].as_mode = read_intra_mode_y(cm, xd,
|
||||||
r, 0);
|
r, 0);
|
||||||
mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode =
|
mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode =
|
||||||
read_intra_mode_y(cm, counts, r, 0);
|
read_intra_mode_y(cm, xd, r, 0);
|
||||||
break;
|
break;
|
||||||
case BLOCK_8X4:
|
case BLOCK_8X4:
|
||||||
mi->bmi[0].as_mode = mi->bmi[1].as_mode = read_intra_mode_y(cm, counts,
|
mi->bmi[0].as_mode = mi->bmi[1].as_mode = read_intra_mode_y(cm, xd,
|
||||||
r, 0);
|
r, 0);
|
||||||
mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode =
|
mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode =
|
||||||
read_intra_mode_y(cm, counts, r, 0);
|
read_intra_mode_y(cm, xd, r, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mbmi->mode = read_intra_mode_y(cm, counts, r, size_group_lookup[bsize]);
|
mbmi->mode = read_intra_mode_y(cm, xd, r, size_group_lookup[bsize]);
|
||||||
}
|
}
|
||||||
|
|
||||||
mbmi->uv_mode = read_intra_mode_uv(cm, counts, r, mbmi->mode);
|
mbmi->uv_mode = read_intra_mode_uv(cm, xd, r, mbmi->mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE int is_mv_valid(const MV *mv) {
|
static INLINE int is_mv_valid(const MV *mv) {
|
||||||
@ -395,7 +398,7 @@ static INLINE int is_mv_valid(const MV *mv) {
|
|||||||
mv->col > MV_LOW && mv->col < MV_UPP;
|
mv->col > MV_LOW && mv->col < MV_UPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE int assign_mv(VP9_COMMON *cm, FRAME_COUNTS *counts,
|
static INLINE int assign_mv(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||||
PREDICTION_MODE mode,
|
PREDICTION_MODE mode,
|
||||||
int_mv mv[2], int_mv ref_mv[2],
|
int_mv mv[2], int_mv ref_mv[2],
|
||||||
int_mv nearest_mv[2], int_mv near_mv[2],
|
int_mv nearest_mv[2], int_mv near_mv[2],
|
||||||
@ -405,8 +408,8 @@ static INLINE int assign_mv(VP9_COMMON *cm, FRAME_COUNTS *counts,
|
|||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case NEWMV: {
|
case NEWMV: {
|
||||||
nmv_context_counts *const mv_counts = cm->frame_parallel_decoding_mode ?
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
NULL : &counts->mv;
|
nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
|
||||||
for (i = 0; i < 1 + is_compound; ++i) {
|
for (i = 0; i < 1 + is_compound; ++i) {
|
||||||
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc->nmvc, mv_counts,
|
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc->nmvc, mv_counts,
|
||||||
allow_hp);
|
allow_hp);
|
||||||
@ -440,7 +443,6 @@ static INLINE int assign_mv(VP9_COMMON *cm, FRAME_COUNTS *counts,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int read_is_inter_block(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
static int read_is_inter_block(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
int segment_id, vp9_reader *r) {
|
int segment_id, vp9_reader *r) {
|
||||||
if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
|
if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
|
||||||
return vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) !=
|
return vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) !=
|
||||||
@ -448,7 +450,8 @@ static int read_is_inter_block(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
|||||||
} else {
|
} else {
|
||||||
const int ctx = vp9_get_intra_inter_context(xd);
|
const int ctx = vp9_get_intra_inter_context(xd);
|
||||||
const int is_inter = vp9_read(r, cm->fc->intra_inter_prob[ctx]);
|
const int is_inter = vp9_read(r, cm->fc->intra_inter_prob[ctx]);
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
|
if (counts)
|
||||||
++counts->intra_inter[ctx][is_inter];
|
++counts->intra_inter[ctx][is_inter];
|
||||||
return is_inter;
|
return is_inter;
|
||||||
}
|
}
|
||||||
@ -462,7 +465,6 @@ static void fpm_sync(void *const data, int mi_row) {
|
|||||||
|
|
||||||
static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
||||||
MACROBLOCKD *const xd,
|
MACROBLOCKD *const xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
const TileInfo *const tile,
|
const TileInfo *const tile,
|
||||||
MODE_INFO *const mi,
|
MODE_INFO *const mi,
|
||||||
int mi_row, int mi_col, vp9_reader *r) {
|
int mi_row, int mi_col, vp9_reader *r) {
|
||||||
@ -473,7 +475,7 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
|||||||
int_mv nearestmv[2], nearmv[2];
|
int_mv nearestmv[2], nearmv[2];
|
||||||
int inter_mode_ctx, ref, is_compound;
|
int inter_mode_ctx, ref, is_compound;
|
||||||
|
|
||||||
read_ref_frames(cm, xd, counts, r, mbmi->segment_id, mbmi->ref_frame);
|
read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame);
|
||||||
is_compound = has_second_ref(mbmi);
|
is_compound = has_second_ref(mbmi);
|
||||||
|
|
||||||
for (ref = 0; ref < 1 + is_compound; ++ref) {
|
for (ref = 0; ref < 1 + is_compound; ++ref) {
|
||||||
@ -500,7 +502,7 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (bsize >= BLOCK_8X8)
|
if (bsize >= BLOCK_8X8)
|
||||||
mbmi->mode = read_inter_mode(cm, counts, r, inter_mode_ctx);
|
mbmi->mode = read_inter_mode(cm, xd, r, inter_mode_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
|
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
|
||||||
@ -511,7 +513,7 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mbmi->interp_filter = (cm->interp_filter == SWITCHABLE)
|
mbmi->interp_filter = (cm->interp_filter == SWITCHABLE)
|
||||||
? read_switchable_interp_filter(cm, xd, counts, r)
|
? read_switchable_interp_filter(cm, xd, r)
|
||||||
: cm->interp_filter;
|
: cm->interp_filter;
|
||||||
|
|
||||||
if (bsize < BLOCK_8X8) {
|
if (bsize < BLOCK_8X8) {
|
||||||
@ -524,7 +526,7 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
|||||||
for (idx = 0; idx < 2; idx += num_4x4_w) {
|
for (idx = 0; idx < 2; idx += num_4x4_w) {
|
||||||
int_mv block[2];
|
int_mv block[2];
|
||||||
const int j = idy * 2 + idx;
|
const int j = idy * 2 + idx;
|
||||||
b_mode = read_inter_mode(cm, counts, r, inter_mode_ctx);
|
b_mode = read_inter_mode(cm, xd, r, inter_mode_ctx);
|
||||||
|
|
||||||
if (b_mode == NEARESTMV || b_mode == NEARMV)
|
if (b_mode == NEARESTMV || b_mode == NEARMV)
|
||||||
for (ref = 0; ref < 1 + is_compound; ++ref)
|
for (ref = 0; ref < 1 + is_compound; ++ref)
|
||||||
@ -532,7 +534,7 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
|||||||
&nearest_sub8x8[ref],
|
&nearest_sub8x8[ref],
|
||||||
&near_sub8x8[ref]);
|
&near_sub8x8[ref]);
|
||||||
|
|
||||||
if (!assign_mv(cm, counts, b_mode, block, nearestmv,
|
if (!assign_mv(cm, xd, b_mode, block, nearestmv,
|
||||||
nearest_sub8x8, near_sub8x8,
|
nearest_sub8x8, near_sub8x8,
|
||||||
is_compound, allow_hp, r)) {
|
is_compound, allow_hp, r)) {
|
||||||
xd->corrupted |= 1;
|
xd->corrupted |= 1;
|
||||||
@ -555,14 +557,13 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
|
|||||||
mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
|
mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
|
||||||
mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
|
mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
|
||||||
} else {
|
} else {
|
||||||
xd->corrupted |= !assign_mv(cm, counts, mbmi->mode, mbmi->mv, nearestmv,
|
xd->corrupted |= !assign_mv(cm, xd, mbmi->mode, mbmi->mv, nearestmv,
|
||||||
nearestmv, nearmv, is_compound, allow_hp, r);
|
nearestmv, nearmv, is_compound, allow_hp, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_inter_frame_mode_info(VP9Decoder *const pbi,
|
static void read_inter_frame_mode_info(VP9Decoder *const pbi,
|
||||||
MACROBLOCKD *const xd,
|
MACROBLOCKD *const xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
const TileInfo *const tile,
|
const TileInfo *const tile,
|
||||||
int mi_row, int mi_col, vp9_reader *r) {
|
int mi_row, int mi_col, vp9_reader *r) {
|
||||||
VP9_COMMON *const cm = &pbi->common;
|
VP9_COMMON *const cm = &pbi->common;
|
||||||
@ -573,18 +574,17 @@ static void read_inter_frame_mode_info(VP9Decoder *const pbi,
|
|||||||
mbmi->mv[0].as_int = 0;
|
mbmi->mv[0].as_int = 0;
|
||||||
mbmi->mv[1].as_int = 0;
|
mbmi->mv[1].as_int = 0;
|
||||||
mbmi->segment_id = read_inter_segment_id(cm, xd, mi_row, mi_col, r);
|
mbmi->segment_id = read_inter_segment_id(cm, xd, mi_row, mi_col, r);
|
||||||
mbmi->skip = read_skip(cm, xd, counts, mbmi->segment_id, r);
|
mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r);
|
||||||
inter_block = read_is_inter_block(cm, xd, counts, mbmi->segment_id, r);
|
inter_block = read_is_inter_block(cm, xd, mbmi->segment_id, r);
|
||||||
mbmi->tx_size = read_tx_size(cm, xd, counts, !mbmi->skip || !inter_block, r);
|
mbmi->tx_size = read_tx_size(cm, xd, !mbmi->skip || !inter_block, r);
|
||||||
|
|
||||||
if (inter_block)
|
if (inter_block)
|
||||||
read_inter_block_mode_info(pbi, xd, counts, tile, mi, mi_row, mi_col, r);
|
read_inter_block_mode_info(pbi, xd, tile, mi, mi_row, mi_col, r);
|
||||||
else
|
else
|
||||||
read_intra_block_mode_info(cm, counts, mi, r);
|
read_intra_block_mode_info(cm, xd, mi, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_read_mode_info(VP9Decoder *const pbi, MACROBLOCKD *xd,
|
void vp9_read_mode_info(VP9Decoder *const pbi, MACROBLOCKD *xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
const TileInfo *const tile,
|
const TileInfo *const tile,
|
||||||
int mi_row, int mi_col, vp9_reader *r) {
|
int mi_row, int mi_col, vp9_reader *r) {
|
||||||
VP9_COMMON *const cm = &pbi->common;
|
VP9_COMMON *const cm = &pbi->common;
|
||||||
@ -597,9 +597,9 @@ void vp9_read_mode_info(VP9Decoder *const pbi, MACROBLOCKD *xd,
|
|||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
if (frame_is_intra_only(cm))
|
if (frame_is_intra_only(cm))
|
||||||
read_intra_frame_mode_info(cm, xd, counts, mi_row, mi_col, r);
|
read_intra_frame_mode_info(cm, xd, mi_row, mi_col, r);
|
||||||
else
|
else
|
||||||
read_inter_frame_mode_info(pbi, xd, counts, tile, mi_row, mi_col, r);
|
read_inter_frame_mode_info(pbi, xd, tile, mi_row, mi_col, r);
|
||||||
|
|
||||||
for (h = 0; h < y_mis; ++h) {
|
for (h = 0; h < y_mis; ++h) {
|
||||||
MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols;
|
MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols;
|
||||||
|
@ -21,7 +21,6 @@ extern "C" {
|
|||||||
struct TileInfo;
|
struct TileInfo;
|
||||||
|
|
||||||
void vp9_read_mode_info(VP9Decoder *const pbi, MACROBLOCKD *xd,
|
void vp9_read_mode_info(VP9Decoder *const pbi, MACROBLOCKD *xd,
|
||||||
FRAME_COUNTS *counts,
|
|
||||||
const struct TileInfo *const tile,
|
const struct TileInfo *const tile,
|
||||||
int mi_row, int mi_col, vp9_reader *r);
|
int mi_row, int mi_col, vp9_reader *r);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#define INCREMENT_COUNT(token) \
|
#define INCREMENT_COUNT(token) \
|
||||||
do { \
|
do { \
|
||||||
if (!cm->frame_parallel_decoding_mode) \
|
if (counts) \
|
||||||
++coef_counts[band][ctx][token]; \
|
++coef_counts[band][ctx][token]; \
|
||||||
} while (0)
|
} 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,
|
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,
|
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;
|
||||||
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 = cm->fc;
|
||||||
const int ref = is_inter_block(&xd->mi[0]->mbmi);
|
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;
|
int val = -1;
|
||||||
band = *band_translate++;
|
band = *band_translate++;
|
||||||
prob = coef_probs[band][ctx];
|
prob = coef_probs[band][ctx];
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
if (counts)
|
||||||
++eob_branch_count[band][ctx];
|
++eob_branch_count[band][ctx];
|
||||||
if (!vp9_read(r, prob[EOB_CONTEXT_NODE])) {
|
if (!vp9_read(r, prob[EOB_CONTEXT_NODE])) {
|
||||||
INCREMENT_COUNT(EOB_MODEL_TOKEN);
|
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,
|
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,
|
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) {
|
||||||
@ -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,
|
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, counts, pd->plane_type,
|
const int eob = decode_coefs(cm, 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);
|
||||||
|
@ -20,7 +20,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int vp9_decode_block_tokens(VP9_COMMON *cm, 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,
|
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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user