summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2013-10-30 15:14:18 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-10-30 15:14:18 -0700
commitca39a008224239230e73176df0d088b37ba0b05e (patch)
tree22d22afcd2e40c818b76a8fb82fcda684a2c6e19
parent6761872e49d59e62472015ee42bf02703a195c81 (diff)
parent2901bf2d000392096579cc662f1ed0bed2c1e643 (diff)
downloadlibvpx-ca39a008224239230e73176df0d088b37ba0b05e.tar
libvpx-ca39a008224239230e73176df0d088b37ba0b05e.tar.gz
libvpx-ca39a008224239230e73176df0d088b37ba0b05e.tar.bz2
libvpx-ca39a008224239230e73176df0d088b37ba0b05e.zip
Merge "Reducing the number of recursive calls."
-rw-r--r--vp9/decoder/vp9_decodframe.c86
1 files changed, 39 insertions, 47 deletions
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index 34029bb87..bf3a10159 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -382,15 +382,11 @@ static void set_ref(VP9_COMMON *const cm, MACROBLOCKD *const xd,
static void decode_modes_b(VP9_COMMON *const cm, MACROBLOCKD *const xd,
const TileInfo *const tile,
int mi_row, int mi_col,
- vp9_reader *r, BLOCK_SIZE bsize, int index) {
+ vp9_reader *r, BLOCK_SIZE bsize) {
const int less8x8 = bsize < BLOCK_8X8;
MB_MODE_INFO *mbmi;
int eobtotal;
- if (less8x8)
- if (index > 0)
- return;
-
set_offsets(cm, xd, tile, bsize, mi_row, mi_col);
vp9_read_mode_info(cm, xd, tile, mi_row, mi_col, r);
@@ -448,54 +444,50 @@ static PARTITION_TYPE read_partition(int hbs, int mi_rows, int mi_cols,
static void decode_modes_sb(VP9_COMMON *const cm, MACROBLOCKD *const xd,
const TileInfo *const tile,
int mi_row, int mi_col,
- vp9_reader* r, BLOCK_SIZE bsize, int index) {
+ vp9_reader* r, BLOCK_SIZE bsize) {
const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2;
- PARTITION_TYPE partition = PARTITION_NONE;
+ PARTITION_TYPE partition;
BLOCK_SIZE subsize;
+ int ctx;
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return;
- if (bsize < BLOCK_8X8) {
- if (index > 0)
- return;
- } else {
- const int ctx = partition_plane_context(xd->above_seg_context,
- xd->left_seg_context,
- mi_row, mi_col, bsize);
- partition = read_partition(hbs, cm->mi_rows, cm->mi_cols, mi_row, mi_col,
- cm->fc.partition_prob[cm->frame_type][ctx], r);
-
- if (!cm->frame_parallel_decoding_mode)
- ++cm->counts.partition[ctx][partition];
- }
+ ctx = partition_plane_context(xd->above_seg_context, xd->left_seg_context,
+ mi_row, mi_col, bsize);
+ partition = read_partition(hbs, cm->mi_rows, cm->mi_cols, mi_row, mi_col,
+ cm->fc.partition_prob[cm->frame_type][ctx], r);
- subsize = get_subsize(bsize, partition);
+ if (!cm->frame_parallel_decoding_mode)
+ ++cm->counts.partition[ctx][partition];
- switch (partition) {
- case PARTITION_NONE:
- decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, 0);
- break;
- case PARTITION_HORZ:
- decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, 0);
- if (mi_row + hbs < cm->mi_rows)
- decode_modes_b(cm, xd, tile, mi_row + hbs, mi_col, r, subsize, 1);
- break;
- case PARTITION_VERT:
- decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, 0);
- if (mi_col + hbs < cm->mi_cols)
- decode_modes_b(cm, xd, tile, mi_row, mi_col + hbs, r, subsize, 1);
- break;
- case PARTITION_SPLIT: {
- int n;
- for (n = 0; n < 4; n++) {
- const int j = n >> 1, i = n & 1;
- decode_modes_sb(cm, xd, tile, mi_row + j * hbs, mi_col + i * hbs,
- r, subsize, n);
- }
- } break;
- default:
- assert(!"Invalid partition type");
+ subsize = get_subsize(bsize, partition);
+ if (subsize < BLOCK_8X8) {
+ decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize);
+ } else {
+ switch (partition) {
+ case PARTITION_NONE:
+ decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize);
+ break;
+ case PARTITION_HORZ:
+ decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize);
+ if (mi_row + hbs < cm->mi_rows)
+ decode_modes_b(cm, xd, tile, mi_row + hbs, mi_col, r, subsize);
+ break;
+ case PARTITION_VERT:
+ decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize);
+ if (mi_col + hbs < cm->mi_cols)
+ decode_modes_b(cm, xd, tile, mi_row, mi_col + hbs, r, subsize);
+ break;
+ case PARTITION_SPLIT:
+ decode_modes_sb(cm, xd, tile, mi_row, mi_col, r, subsize);
+ decode_modes_sb(cm, xd, tile, mi_row, mi_col + hbs, r, subsize);
+ decode_modes_sb(cm, xd, tile, mi_row + hbs, mi_col, r, subsize);
+ decode_modes_sb(cm, xd, tile, mi_row + hbs, mi_col + hbs, r, subsize);
+ break;
+ default:
+ assert(!"Invalid partition type");
+ }
}
// update partition context
@@ -780,7 +772,7 @@ static void decode_tile(VP9D_COMP *pbi, const TileInfo *const tile,
vp9_zero(xd->left_seg_context);
for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
mi_col += MI_BLOCK_SIZE)
- decode_modes_sb(cm, xd, tile, mi_row, mi_col, r, BLOCK_64X64, 0);
+ decode_modes_sb(cm, xd, tile, mi_row, mi_col, r, BLOCK_64X64);
if (pbi->do_loopfilter_inline) {
const int lf_start = mi_row - MI_BLOCK_SIZE;
@@ -935,7 +927,7 @@ static int tile_worker_hook(void *arg1, void *arg2) {
for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
mi_col += MI_BLOCK_SIZE)
decode_modes_sb(tile_data->cm, &tile_data->xd, tile,
- mi_row, mi_col, &tile_data->bit_reader, BLOCK_64X64, 0);
+ mi_row, mi_col, &tile_data->bit_reader, BLOCK_64X64);
}
return !tile_data->xd.corrupted;
}