Merge "copy partitioning from last fame"

This commit is contained in:
Jim Bankoski 2013-06-20 09:32:43 -07:00 коммит произвёл Gerrit Code Review
Родитель db938c2988 f033b44e74
Коммит fbcce4dd6f
1 изменённых файлов: 32 добавлений и 26 удалений

Просмотреть файл

@ -896,6 +896,17 @@ static void set_partitioning(VP9_COMP *cpi, MODE_INFO *m,
} }
} }
} }
static void copy_partitioning(VP9_COMP *cpi, MODE_INFO *m, MODE_INFO *p) {
VP9_COMMON *const cm = &cpi->common;
const int mis = cm->mode_info_stride;
int block_row, block_col;
for (block_row = 0; block_row < 8; ++block_row) {
for (block_col = 0; block_col < 8; ++block_col) {
m[block_row * mis + block_col].mbmi.sb_type =
p[block_row * mis + block_col].mbmi.sb_type;
}
}
}
static void set_block_size(VP9_COMMON *const cm, static void set_block_size(VP9_COMMON *const cm,
MODE_INFO *m, BLOCK_SIZE_TYPE bsize, int mis, MODE_INFO *m, BLOCK_SIZE_TYPE bsize, int mis,
@ -1109,7 +1120,6 @@ static void rd_use_partition(VP9_COMP *cpi, MODE_INFO *m, TOKENEXTRA **tp,
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return; return;
// parse the partition type // parse the partition type
if ((bwl == bsl) && (bhl == bsl)) if ((bwl == bsl) && (bhl == bsl))
partition = PARTITION_NONE; partition = PARTITION_NONE;
@ -1124,18 +1134,15 @@ static void rd_use_partition(VP9_COMP *cpi, MODE_INFO *m, TOKENEXTRA **tp,
subsize = get_subsize(bsize, partition); subsize = get_subsize(bsize, partition);
// TODO(JBB): this restriction is here because pick_sb_modes can return if (bsize < BLOCK_SIZE_SB8X8) {
// r's that are INT_MAX meaning we can't select a mode / mv for this block. if (xd->ab_index != 0) {
// when the code is made to work for less than sb8x8 we need to come up with *rate = 0;
// a solution to this problem. *dist = 0;
assert(subsize >= BLOCK_SIZE_SB8X8); return;
}
if (bsize >= BLOCK_SIZE_SB8X8) { } else {
xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK);
xd->above_seg_context = cm->above_seg_context + mi_col;
*(get_sb_partitioning(x, bsize)) = subsize; *(get_sb_partitioning(x, bsize)) = subsize;
} }
pl = partition_plane_context(xd, bsize); pl = partition_plane_context(xd, bsize);
save_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize); save_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
switch (partition) { switch (partition) {
@ -1206,17 +1213,6 @@ static void rd_use_partition(VP9_COMP *cpi, MODE_INFO *m, TOKENEXTRA **tp,
assert(0); assert(0);
} }
// update partition context
#if CONFIG_AB4X4
if (bsize >= BLOCK_SIZE_SB8X8 &&
(bsize == BLOCK_SIZE_SB8X8 || partition != PARTITION_SPLIT)) {
#else
if (bsize > BLOCK_SIZE_SB8X8
&& (bsize == BLOCK_SIZE_MB16X16 || partition != PARTITION_SPLIT)) {
#endif
set_partition_seg_context(cm, xd, mi_row, mi_col);
update_partition_context(xd, subsize, bsize);
}
restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize); restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
if (r < INT_MAX && d < INT_MAX) if (r < INT_MAX && d < INT_MAX)
@ -1407,10 +1403,20 @@ static void encode_sb_row(VP9_COMP *cpi, int mi_row,
} else { } else {
const int idx_str = cm->mode_info_stride * mi_row + mi_col; const int idx_str = cm->mode_info_stride * mi_row + mi_col;
MODE_INFO *m = cm->mi + idx_str; MODE_INFO *m = cm->mi + idx_str;
// set_partitioning(cpi, m, BLOCK_SIZE_SB64X64); MODE_INFO *p = cm->prev_mi + idx_str;
choose_partitioning(cpi, cm->mi, mi_row, mi_col);
rd_use_partition(cpi, m, tp, mi_row, mi_col, BLOCK_SIZE_SB64X64, if ((cpi->common.current_video_frame & 1) == 0 || cm->prev_mi == 0 ||
&dummy_rate, &dummy_dist); cpi->is_src_frame_alt_ref) {
rd_pick_partition(cpi, tp, mi_row, mi_col, BLOCK_SIZE_SB64X64,
&dummy_rate, &dummy_dist);
} else {
// set_partitioning(cpi, m, BLOCK_SIZE_SB64X64);
// choose_partitioning(cpi, cm->mi, mi_row, mi_col);
copy_partitioning(cpi, m, p);
rd_use_partition(cpi, m, tp, mi_row, mi_col, BLOCK_SIZE_SB64X64,
&dummy_rate, &dummy_dist);
}
} }
} }
} }