Refactor nonrd_use_partition coding process

This commit integrates the non-RD mode decision process and the
encoding process into a single recursion scheme.

Change-Id: I6a7e72a0b84d567554801ebbe01ec75d54c1f77d
This commit is contained in:
Jingning Han 2014-11-06 11:53:18 -08:00
parent caaf63b2c4
commit 754b05a4de

View File

@ -3125,6 +3125,7 @@ static void nonrd_use_partition(VP9_COMP *cpi,
BLOCK_SIZE bsize, int output_enabled,
RD_COST *rd_cost, PC_TREE *pc_tree) {
VP9_COMMON *const cm = &cpi->common;
TileInfo *tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4;
@ -3140,6 +3141,11 @@ static void nonrd_use_partition(VP9_COMP *cpi,
subsize = (bsize >= BLOCK_8X8) ? mi[0].src_mi->mbmi.sb_type : BLOCK_4X4;
partition = partition_lookup[bsl][subsize];
if (output_enabled && bsize != BLOCK_4X4) {
int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
cm->counts.partition[ctx][partition]++;
}
switch (partition) {
case PARTITION_NONE:
pc_tree->none.pred_pixel_ready = 1;
@ -3148,6 +3154,8 @@ static void nonrd_use_partition(VP9_COMP *cpi,
pc_tree->none.mic.mbmi = xd->mi[0].src_mi->mbmi;
pc_tree->none.skip_txfm[0] = x->skip_txfm[0];
pc_tree->none.skip = x->skip;
encode_b_rt(cpi, tile_info, tp, mi_row, mi_col, output_enabled, subsize,
&pc_tree->none);
break;
case PARTITION_VERT:
pc_tree->vertical[0].pred_pixel_ready = 1;
@ -3156,6 +3164,8 @@ static void nonrd_use_partition(VP9_COMP *cpi,
pc_tree->vertical[0].mic.mbmi = xd->mi[0].src_mi->mbmi;
pc_tree->vertical[0].skip_txfm[0] = x->skip_txfm[0];
pc_tree->vertical[0].skip = x->skip;
encode_b_rt(cpi, tile_info, tp, mi_row, mi_col, output_enabled, subsize,
&pc_tree->vertical[0]);
if (mi_col + hbs < cm->mi_cols) {
pc_tree->vertical[1].pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, mi_row, mi_col + hbs,
@ -3163,6 +3173,9 @@ static void nonrd_use_partition(VP9_COMP *cpi,
pc_tree->vertical[1].mic.mbmi = xd->mi[0].src_mi->mbmi;
pc_tree->vertical[1].skip_txfm[0] = x->skip_txfm[0];
pc_tree->vertical[1].skip = x->skip;
encode_b_rt(cpi, tile_info, tp, mi_row, mi_col + hbs,
output_enabled, subsize, &pc_tree->vertical[1]);
if (this_rdc.rate != INT_MAX && this_rdc.dist != INT64_MAX &&
rd_cost->rate != INT_MAX && rd_cost->dist != INT64_MAX) {
rd_cost->rate += this_rdc.rate;
@ -3177,6 +3190,9 @@ static void nonrd_use_partition(VP9_COMP *cpi,
pc_tree->horizontal[0].mic.mbmi = xd->mi[0].src_mi->mbmi;
pc_tree->horizontal[0].skip_txfm[0] = x->skip_txfm[0];
pc_tree->horizontal[0].skip = x->skip;
encode_b_rt(cpi, tile_info, tp, mi_row, mi_col, output_enabled, subsize,
&pc_tree->horizontal[0]);
if (mi_row + hbs < cm->mi_rows) {
pc_tree->horizontal[1].pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, mi_row + hbs, mi_col,
@ -3184,6 +3200,9 @@ static void nonrd_use_partition(VP9_COMP *cpi,
pc_tree->horizontal[1].mic.mbmi = xd->mi[0].src_mi->mbmi;
pc_tree->horizontal[1].skip_txfm[0] = x->skip_txfm[0];
pc_tree->horizontal[1].skip = x->skip;
encode_b_rt(cpi, tile_info, tp, mi_row + hbs, mi_col,
output_enabled, subsize, &pc_tree->horizontal[1]);
if (this_rdc.rate != INT_MAX && this_rdc.dist != INT64_MAX &&
rd_cost->rate != INT_MAX && rd_cost->dist != INT64_MAX) {
rd_cost->rate += this_rdc.rate;
@ -3226,9 +3245,8 @@ static void nonrd_use_partition(VP9_COMP *cpi,
break;
}
if (bsize == BLOCK_64X64 && output_enabled)
encode_sb_rt(cpi, &tile_data->tile_info, tp, mi_row, mi_col,
1, bsize, pc_tree);
if (partition != PARTITION_SPLIT || bsize == BLOCK_8X8)
update_partition_context(xd, mi_row, mi_col, subsize, bsize);
}
static void encode_nonrd_sb_row(VP9_COMP *cpi,