Commit e862c6f9 authored by Adrian Grange's avatar Adrian Grange Committed by Gerrit Code Review
Browse files

Merge "Simplify handling of sub-partition motion vectors"

parents 6f0f0e49 be700e14
......@@ -858,7 +858,7 @@ static void set_block_size(VP9_COMMON * const cm, MODE_INFO *m,
int bhl = b_height_log2(bsize);
int bsl = (bwl > bhl ? bwl : bhl);
int bs = (1 << bsl) / 2; //
int bs = (1 << bsl) / 2; // Block size in units of 8 pels.
MODE_INFO *m2 = m + mi_row * mis + mi_col;
for (row = 0; row < bs; row++) {
for (col = 0; col < bs; col++) {
......@@ -1459,9 +1459,8 @@ static void rd_pick_partition(VP9_COMP *cpi, TOKENEXTRA **tp, int mi_row,
save_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
// PARTITION_SPLIT
if (!cpi->sf.use_partitions_greater_than
|| (cpi->sf.use_partitions_greater_than
&& bsize > cpi->sf.greater_than_block_size)) {
if (!cpi->sf.use_partitions_greater_than ||
bsize > cpi->sf.greater_than_block_size) {
if (bsize > BLOCK_SIZE_SB8X8) {
int r4 = 0;
int64_t d4 = 0, sum_rd = 0;
......@@ -1519,26 +1518,21 @@ static void rd_pick_partition(VP9_COMP *cpi, TOKENEXTRA **tp, int mi_row,
((use_8x8 && bsize == BLOCK_SIZE_MB16X16) ||
bsize == BLOCK_SIZE_SB32X32 || bsize == BLOCK_SIZE_SB64X64)) {
int ref0 = 0, ref1 = 0, ref2 = 0, ref3 = 0;
PICK_MODE_CONTEXT *block_context = NULL;
if (bsize == BLOCK_SIZE_MB16X16) {
ref0 = x->sb8x8_context[xd->sb_index][xd->mb_index][0].mic.mbmi.
ref_frame[0];
ref1 = x->sb8x8_context[xd->sb_index][xd->mb_index][1].mic.mbmi.
ref_frame[0];
ref2 = x->sb8x8_context[xd->sb_index][xd->mb_index][2].mic.mbmi.
ref_frame[0];
ref3 = x->sb8x8_context[xd->sb_index][xd->mb_index][3].mic.mbmi.
ref_frame[0];
block_context = x->sb8x8_context[xd->sb_index][xd->mb_index];
} else if (bsize == BLOCK_SIZE_SB32X32) {
ref0 = x->mb_context[xd->sb_index][0].mic.mbmi.ref_frame[0];
ref1 = x->mb_context[xd->sb_index][1].mic.mbmi.ref_frame[0];
ref2 = x->mb_context[xd->sb_index][2].mic.mbmi.ref_frame[0];
ref3 = x->mb_context[xd->sb_index][3].mic.mbmi.ref_frame[0];
block_context = x->mb_context[xd->sb_index];
} else if (bsize == BLOCK_SIZE_SB64X64) {
ref0 = x->sb32_context[0].mic.mbmi.ref_frame[0];
ref1 = x->sb32_context[1].mic.mbmi.ref_frame[0];
ref2 = x->sb32_context[2].mic.mbmi.ref_frame[0];
ref3 = x->sb32_context[3].mic.mbmi.ref_frame[0];
block_context = x->sb32_context;
}
if (block_context) {
ref0 = block_context[0].mic.mbmi.ref_frame[0];
ref1 = block_context[1].mic.mbmi.ref_frame[0];
ref2 = block_context[2].mic.mbmi.ref_frame[0];
ref3 = block_context[3].mic.mbmi.ref_frame[0];
}
// Currently, only consider 4 inter ref frames.
......@@ -1548,42 +1542,14 @@ static void rd_pick_partition(VP9_COMP *cpi, TOKENEXTRA **tp, int mi_row,
int d01, d23, d02, d13; // motion vector distance between 2 blocks
// Get each subblock's motion vectors.
if (bsize == BLOCK_SIZE_MB16X16) {
mvr0 = x->sb8x8_context[xd->sb_index][xd->mb_index][0].mic.mbmi.mv[0].
as_mv.row;
mvc0 = x->sb8x8_context[xd->sb_index][xd->mb_index][0].mic.mbmi.mv[0].
as_mv.col;
mvr1 = x->sb8x8_context[xd->sb_index][xd->mb_index][1].mic.mbmi.mv[0].
as_mv.row;
mvc1 = x->sb8x8_context[xd->sb_index][xd->mb_index][1].mic.mbmi.mv[0].
as_mv.col;
mvr2 = x->sb8x8_context[xd->sb_index][xd->mb_index][2].mic.mbmi.mv[0].
as_mv.row;
mvc2 = x->sb8x8_context[xd->sb_index][xd->mb_index][2].mic.mbmi.mv[0].
as_mv.col;
mvr3 = x->sb8x8_context[xd->sb_index][xd->mb_index][3].mic.mbmi.mv[0].
as_mv.row;
mvc3 = x->sb8x8_context[xd->sb_index][xd->mb_index][3].mic.mbmi.mv[0].
as_mv.col;
} else if (bsize == BLOCK_SIZE_SB32X32) {
mvr0 = x->mb_context[xd->sb_index][0].mic.mbmi.mv[0].as_mv.row;
mvc0 = x->mb_context[xd->sb_index][0].mic.mbmi.mv[0].as_mv.col;
mvr1 = x->mb_context[xd->sb_index][1].mic.mbmi.mv[0].as_mv.row;
mvc1 = x->mb_context[xd->sb_index][1].mic.mbmi.mv[0].as_mv.col;
mvr2 = x->mb_context[xd->sb_index][2].mic.mbmi.mv[0].as_mv.row;
mvc2 = x->mb_context[xd->sb_index][2].mic.mbmi.mv[0].as_mv.col;
mvr3 = x->mb_context[xd->sb_index][3].mic.mbmi.mv[0].as_mv.row;
mvc3 = x->mb_context[xd->sb_index][3].mic.mbmi.mv[0].as_mv.col;
} else if (bsize == BLOCK_SIZE_SB64X64) {
mvr0 = x->sb32_context[0].mic.mbmi.mv[0].as_mv.row;
mvc0 = x->sb32_context[0].mic.mbmi.mv[0].as_mv.col;
mvr1 = x->sb32_context[1].mic.mbmi.mv[0].as_mv.row;
mvc1 = x->sb32_context[1].mic.mbmi.mv[0].as_mv.col;
mvr2 = x->sb32_context[2].mic.mbmi.mv[0].as_mv.row;
mvc2 = x->sb32_context[2].mic.mbmi.mv[0].as_mv.col;
mvr3 = x->sb32_context[3].mic.mbmi.mv[0].as_mv.row;
mvc3 = x->sb32_context[3].mic.mbmi.mv[0].as_mv.col;
}
mvr0 = block_context[0].mic.mbmi.mv[0].as_mv.row;
mvc0 = block_context[0].mic.mbmi.mv[0].as_mv.col;
mvr1 = block_context[1].mic.mbmi.mv[0].as_mv.row;
mvc1 = block_context[1].mic.mbmi.mv[0].as_mv.col;
mvr2 = block_context[2].mic.mbmi.mv[0].as_mv.row;
mvc2 = block_context[2].mic.mbmi.mv[0].as_mv.col;
mvr3 = block_context[3].mic.mbmi.mv[0].as_mv.row;
mvc3 = block_context[3].mic.mbmi.mv[0].as_mv.col;
// Adjust sign if ref is alt_ref
if (cm->ref_frame_sign_bias[ref0]) {
......@@ -1635,9 +1601,8 @@ static void rd_pick_partition(VP9_COMP *cpi, TOKENEXTRA **tp, int mi_row,
}
}
if (!cpi->sf.use_partitions_less_than
|| (cpi->sf.use_partitions_less_than
&& bsize <= cpi->sf.less_than_block_size)) {
if (!cpi->sf.use_partitions_less_than ||
bsize <= cpi->sf.less_than_block_size) {
int larger_is_better = 0;
// PARTITION_NONE
if ((mi_row + (ms >> 1) < cm->mi_rows) &&
......
......@@ -3334,12 +3334,12 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
ref_frame = vp9_mode_order[mode_index].ref_frame;
second_ref_frame = vp9_mode_order[mode_index].second_ref_frame;
// Slip modes that have been masked off but always consider first mode.
// Skip modes that have been masked off but always consider first mode.
if ( mode_index && (bsize > cpi->sf.unused_mode_skip_lvl) &&
(cpi->unused_mode_skip_mask & (1 << mode_index)) )
continue;
// Skip if the current refernce frame has been masked off
// Skip if the current reference frame has been masked off
if (cpi->sf.reference_masking && !cpi->set_ref_frame_mask &&
(cpi->ref_frame_mask & (1 << ref_frame)))
continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment