summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHui Su <huisu@google.com>2019-01-30 18:17:05 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-01-30 18:17:05 +0000
commit6796c0cfc3e51a181b0afec442a66dfaa5010ba6 (patch)
tree70d130c7899b540a6586471ec65035d5aaa224d1
parent735ac5547ff5331fa0e2eb8ea975b249d3c56e6a (diff)
parent82648835eb5bdac612cbbaa49b9df2113f3f28c7 (diff)
downloadlibvpx-6796c0cfc3e51a181b0afec442a66dfaa5010ba6.tar
libvpx-6796c0cfc3e51a181b0afec442a66dfaa5010ba6.tar.gz
libvpx-6796c0cfc3e51a181b0afec442a66dfaa5010ba6.tar.bz2
libvpx-6796c0cfc3e51a181b0afec442a66dfaa5010ba6.zip
Merge "Reuse simple motion search results"
-rw-r--r--vp9/encoder/vp9_context_tree.h3
-rw-r--r--vp9/encoder/vp9_encodeframe.c25
2 files changed, 22 insertions, 6 deletions
diff --git a/vp9/encoder/vp9_context_tree.h b/vp9/encoder/vp9_context_tree.h
index d2cdb1010..4e301cc17 100644
--- a/vp9/encoder/vp9_context_tree.h
+++ b/vp9/encoder/vp9_context_tree.h
@@ -91,6 +91,9 @@ typedef struct PC_TREE {
struct PC_TREE *split[4];
PICK_MODE_CONTEXT *leaf_split[4];
};
+ // Obtained from a simple motion search. Used by the ML based partition search
+ // speed feature.
+ MV mv;
} PC_TREE;
void vp9_setup_pc_tree(struct VP9Common *cm, struct ThreadData *td);
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index 679a62b5a..0edd02e5d 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -3484,8 +3484,9 @@ static void simple_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
// input features.
#define FEATURES 6
static void ml_predict_var_rd_paritioning(VP9_COMP *cpi, MACROBLOCK *x,
- BLOCK_SIZE bsize, int mi_row,
- int mi_col, int *none, int *split) {
+ PC_TREE *pc_tree, BLOCK_SIZE bsize,
+ int mi_row, int mi_col, int *none,
+ int *split) {
VP9_COMMON *const cm = &cpi->common;
const NN_CONFIG *nn_config = NULL;
#if CONFIG_VP9_HIGHBITDEPTH
@@ -3530,10 +3531,17 @@ static void ml_predict_var_rd_paritioning(VP9_COMP *cpi, MACROBLOCK *x,
// Do a simple single motion search to find a prediction for current block.
// The variance of the residue will be used as input features.
{
- const MV ref_mv = { 0, 0 };
+ MV ref_mv;
const MV_REFERENCE_FRAME ref =
cpi->rc.is_src_frame_alt_ref ? ALTREF_FRAME : LAST_FRAME;
+ // If bsize is 64x64, use zero MV as reference; otherwise, use MV result
+ // of previous(larger) block as reference.
+ if (bsize == BLOCK_64X64)
+ ref_mv.row = ref_mv.col = 0;
+ else
+ ref_mv = pc_tree->mv;
simple_motion_search(cpi, x, bsize, mi_row, mi_col, ref_mv, ref, pred_buf);
+ pc_tree->mv = x->e_mbd.mi[0]->mv[0].as_mv;
}
vpx_clear_system_state();
@@ -3828,14 +3836,19 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td,
pc_tree->partitioning = PARTITION_NONE;
- if (cpi->sf.ml_var_partition_pruning) {
+ if (cpi->sf.ml_var_partition_pruning && !frame_is_intra_only(cm)) {
const int do_ml_var_partition_pruning =
- !frame_is_intra_only(cm) && partition_none_allowed && do_split &&
+ partition_none_allowed && do_split &&
mi_row + num_8x8_blocks_high_lookup[bsize] <= cm->mi_rows &&
mi_col + num_8x8_blocks_wide_lookup[bsize] <= cm->mi_cols;
if (do_ml_var_partition_pruning) {
- ml_predict_var_rd_paritioning(cpi, x, bsize, mi_row, mi_col,
+ ml_predict_var_rd_paritioning(cpi, x, pc_tree, bsize, mi_row, mi_col,
&partition_none_allowed, &do_split);
+ } else {
+ vp9_zero(pc_tree->mv);
+ }
+ if (bsize > BLOCK_8X8) { // Store MV result as reference for subblocks.
+ for (i = 0; i < 4; ++i) pc_tree->split[i]->mv = pc_tree->mv;
}
}