return cm->frame_type == KEY_FRAME || cm->intra_only;
}
-static INLINE void update_partition_context(VP9_COMMON *cm,
- int mi_row, int mi_col,
- BLOCK_SIZE sb_type,
- BLOCK_SIZE sb_size) {
- PARTITION_CONTEXT *above_ctx = cm->above_seg_context + mi_col;
- PARTITION_CONTEXT *left_ctx = cm->left_seg_context + (mi_row & MI_MASK);
+static INLINE void update_partition_context(
+ PARTITION_CONTEXT *above_seg_context,
+ PARTITION_CONTEXT left_seg_context[8],
+ int mi_row, int mi_col,
+ BLOCK_SIZE sb_type,
+ BLOCK_SIZE sb_size) {
+ PARTITION_CONTEXT *above_ctx = above_seg_context + mi_col;
+ PARTITION_CONTEXT *left_ctx = left_seg_context + (mi_row & MI_MASK);
const int bsl = b_width_log2(sb_size), bs = (1 << bsl) / 2;
const int bwl = b_width_log2(sb_type);
vpx_memset(left_ctx, pcvalue[bhl == bsl], bs);
}
-static INLINE int partition_plane_context(const VP9_COMMON *cm,
- int mi_row, int mi_col,
- BLOCK_SIZE sb_type) {
- const PARTITION_CONTEXT *above_ctx = cm->above_seg_context + mi_col;
- const PARTITION_CONTEXT *left_ctx = cm->left_seg_context + (mi_row & MI_MASK);
+static INLINE int partition_plane_context(
+ const PARTITION_CONTEXT *above_seg_context,
+ const PARTITION_CONTEXT left_seg_context[8],
+ int mi_row, int mi_col,
+ BLOCK_SIZE sb_type) {
+ const PARTITION_CONTEXT *above_ctx = above_seg_context + mi_col;
+ const PARTITION_CONTEXT *left_ctx = left_seg_context + (mi_row & MI_MASK);
int bsl = mi_width_log2(sb_type), bs = 1 << bsl;
int above = 0, left = 0, i;
int pl;
const int idx = check_bsize_coverage(bs, cm->mi_rows, cm->mi_cols,
mi_row, mi_col);
- pl = partition_plane_context(cm, mi_row, mi_col, bsize);
+ pl = partition_plane_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row, mi_col, bsize);
// encode the partition information
if (idx == 0)
write_token(bc, vp9_partition_tree,
// update partition context
if (bsize >= BLOCK_8X8 &&
(bsize == BLOCK_8X8 || partition != PARTITION_SPLIT))
- update_partition_context(cm, mi_row, mi_col, subsize, bsize);
+ update_partition_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row, mi_col, subsize, bsize);
}
static void write_modes(VP9_COMP *cpi, vp9_writer* const bc,
c1 = BLOCK_4X4;
if (bsize >= BLOCK_8X8) {
- pl = partition_plane_context(cm, mi_row, mi_col, bsize);
+ pl = partition_plane_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row, mi_col, bsize);
c1 = *(get_sb_partitioning(x, bsize));
}
partition = partition_lookup[bsl][c1];
}
if (partition != PARTITION_SPLIT || bsize == BLOCK_8X8)
- update_partition_context(cm, mi_row, mi_col, c1, bsize);
+ update_partition_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row, mi_col, c1, bsize);
}
// Check to see if the given partition size is allowed for a specified number
pick_sb_modes(cpi, mi_row, mi_col, &none_rate, &none_dist, bsize,
get_block_context(x, bsize), INT64_MAX);
- pl = partition_plane_context(cm, mi_row, mi_col, bsize);
+ pl = partition_plane_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row, mi_col, bsize);
none_rate += x->partition_cost[pl][PARTITION_NONE];
restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
assert(0);
}
- pl = partition_plane_context(cm, mi_row, mi_col, bsize);
+ pl = partition_plane_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row, mi_col, bsize);
if (last_part_rate < INT_MAX)
last_part_rate += x->partition_cost[pl][partition];
split_rate += rt;
split_dist += dt;
- pl = partition_plane_context(cm, mi_row + y_idx, mi_col + x_idx, bsize);
+ pl = partition_plane_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row + y_idx, mi_col + x_idx, bsize);
split_rate += x->partition_cost[pl][PARTITION_NONE];
}
- pl = partition_plane_context(cm, mi_row, mi_col, bsize);
+ pl = partition_plane_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row, mi_col, bsize);
if (split_rate < INT_MAX) {
split_rate += x->partition_cost[pl][PARTITION_SPLIT];
get_block_context(x, bsize), best_rd);
if (this_rate != INT_MAX) {
if (bsize >= BLOCK_8X8) {
- pl = partition_plane_context(cm, mi_row, mi_col, bsize);
+ pl = partition_plane_context(cm->above_seg_context,
+ cm->left_seg_context,
+ mi_row, mi_col, bsize);
this_rate += x->partition_cost[pl][PARTITION_NONE];
}
sum_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_dist);
}
}
if (sum_rd < best_rd && i == 4) {
- pl = partition_plane_context(cm, mi_row, mi_col, bsize);
+ pl = partition_plane_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row, mi_col, bsize);
sum_rate += x->partition_cost[pl][PARTITION_SPLIT];
sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
if (sum_rd < best_rd) {
}
}
if (sum_rd < best_rd) {
- pl = partition_plane_context(cm, mi_row, mi_col, bsize);
+ pl = partition_plane_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row, mi_col, bsize);
sum_rate += x->partition_cost[pl][PARTITION_HORZ];
sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
if (sum_rd < best_rd) {
}
}
if (sum_rd < best_rd) {
- pl = partition_plane_context(cm, mi_row, mi_col, bsize);
+ pl = partition_plane_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row, mi_col, bsize);
sum_rate += x->partition_cost[pl][PARTITION_VERT];
sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
if (sum_rd < best_rd) {
cpi->set_ref_frame_mask = 1;
pick_sb_modes(cpi, mi_row, mi_col, &r, &d, BLOCK_64X64,
get_block_context(x, BLOCK_64X64), INT64_MAX);
- pl = partition_plane_context(cm, mi_row, mi_col, BLOCK_64X64);
+ pl = partition_plane_context(cm->above_seg_context, cm->left_seg_context,
+ mi_row, mi_col, BLOCK_64X64);
r += x->partition_cost[pl][PARTITION_NONE];
*(get_sb_partitioning(x, BLOCK_64X64)) = BLOCK_64X64;