summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorAngie Chiang <angiebird@google.com>2019-02-05 14:45:09 -0800
committerAngie Chiang <angiebird@google.com>2019-02-05 18:10:06 -0800
commite43f0a4bef8475149c75186ad0d76bf4b1d6ae80 (patch)
treeac6ffb9d8428c2a00faa99318920b61040c6d5c3 /vp9/encoder
parentce4336c2ab60d185b431345987b2188511760e54 (diff)
downloadlibvpx-e43f0a4bef8475149c75186ad0d76bf4b1d6ae80.tar
libvpx-e43f0a4bef8475149c75186ad0d76bf4b1d6ae80.tar.gz
libvpx-e43f0a4bef8475149c75186ad0d76bf4b1d6ae80.tar.bz2
libvpx-e43f0a4bef8475149c75186ad0d76bf4b1d6ae80.zip
Compute future_rd_diff in predict_mv_mode
The future_rd_diff computes the future rd difference between new mv mode and ref mv mode. Change-Id: I4bf9e2ad34257ba9cfec95419c2c5eca469584e9
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_encoder.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 362077a6c..4a9b6d0a7 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -6251,7 +6251,7 @@ static void predict_mv_mode(VP9_COMP *cpi, MACROBLOCK *x,
GF_PICTURE *gf_picture, int frame_idx,
TplDepFrame *tpl_frame, int rf_idx,
BLOCK_SIZE bsize, int mi_row, int mi_col,
- double *rd) {
+ double *future_rd_diff) {
const int mi_height = num_8x8_blocks_high_lookup[bsize];
const int mi_width = num_8x8_blocks_wide_lookup[bsize];
int tmp_mv_mode_arr[kMvPreCheckSize];
@@ -6261,6 +6261,8 @@ static void predict_mv_mode(VP9_COMP *cpi, MACROBLOCK *x,
int stride = tpl_frame->stride;
double new_mv_rd = 0;
double no_new_mv_rd = 0;
+ double this_new_mv_rd = 0;
+ double this_no_new_mv_rd = 0;
int idx;
int tmp_idx;
assert(kMvPreCheckSize == (kMvPreCheckLines * (kMvPreCheckLines + 1)) >> 1);
@@ -6280,6 +6282,9 @@ static void predict_mv_mode(VP9_COMP *cpi, MACROBLOCK *x,
mv_mode_arr[nb_row * stride + nb_col] =
find_best_ref_mv_mode(cpi, x, gf_picture, frame_idx, tpl_frame,
rf_idx, bsize, nb_row, nb_col, &this_rd, mv);
+ if (r == 0 && c == 0) {
+ this_no_new_mv_rd = this_rd;
+ }
no_new_mv_rd += this_rd;
tmp_mv_mode_arr[tmp_idx] = mv_mode_arr[nb_row * stride + nb_col];
tmp_select_mv_arr[tmp_idx] = select_mv_arr[nb_row * stride + nb_col];
@@ -6290,9 +6295,10 @@ static void predict_mv_mode(VP9_COMP *cpi, MACROBLOCK *x,
// new mv
mv_mode_arr[mi_row * stride + mi_col] = NEW_MV_MODE;
- new_mv_rd = eval_mv_mode(NEW_MV_MODE, cpi, x, gf_picture, frame_idx,
- tpl_frame, rf_idx, bsize, mi_row, mi_col,
- &select_mv_arr[mi_row * stride + mi_col]);
+ this_new_mv_rd = eval_mv_mode(NEW_MV_MODE, cpi, x, gf_picture, frame_idx,
+ tpl_frame, rf_idx, bsize, mi_row, mi_col,
+ &select_mv_arr[mi_row * stride + mi_col]);
+ new_mv_rd = this_new_mv_rd;
// We start from idx = 1 because idx = 0 is evaluated as NEW_MV_MODE
// beforehand.
for (idx = 1; idx < kMvPreCheckLines; ++idx) {
@@ -6315,7 +6321,6 @@ static void predict_mv_mode(VP9_COMP *cpi, MACROBLOCK *x,
// update best_mv_mode
tmp_idx = 0;
if (no_new_mv_rd < new_mv_rd) {
- *rd = no_new_mv_rd;
for (idx = 0; idx < kMvPreCheckLines; ++idx) {
int r;
for (r = 0; r <= idx; ++r) {
@@ -6329,8 +6334,10 @@ static void predict_mv_mode(VP9_COMP *cpi, MACROBLOCK *x,
}
}
}
+ *future_rd_diff = 0;
} else {
- *rd = new_mv_rd;
+ *future_rd_diff =
+ (no_new_mv_rd - this_no_new_mv_rd) - (new_mv_rd - this_new_mv_rd);
}
}
@@ -6347,7 +6354,7 @@ void predict_mv_mode_arr(VP9_COMP *cpi, MACROBLOCK *x, GF_PICTURE *gf_picture,
int r;
for (r = VPXMAX(idx - unit_cols + 1, 0); r <= VPXMIN(idx, unit_rows - 1);
++r) {
- double rd; // TODO(angiebird): Use this information later.
+ double future_rd_diff; // TODO(angiebird): Use this information later.
int c = idx - r;
int mi_row = r * mi_height;
int mi_col = c * mi_width;
@@ -6355,7 +6362,7 @@ void predict_mv_mode_arr(VP9_COMP *cpi, MACROBLOCK *x, GF_PICTURE *gf_picture,
assert(mi_row >= 0 && mi_row < tpl_frame->mi_rows);
assert(mi_col >= 0 && mi_col < tpl_frame->mi_cols);
predict_mv_mode(cpi, x, gf_picture, frame_idx, tpl_frame, rf_idx, bsize,
- mi_row, mi_col, &rd);
+ mi_row, mi_col, &future_rd_diff);
}
}
}