Correct ref frame buffer in scaled subpixel simple_motion_search
Previously simple_motion_search used scaled reference for both fullpixel
and subpixel motion search, which is not the correct behavior. This
changes it so that the correct frame buffer is used.
Change-Id: Ic3de9ba9bbd59a2650e2fc97fce0ef82934bbcb4
diff --git a/av1/encoder/mcomp.c b/av1/encoder/mcomp.c
index c9573bd..f077a4e 100644
--- a/av1/encoder/mcomp.c
+++ b/av1/encoder/mcomp.c
@@ -3102,13 +3102,13 @@
const int ref_idx = 0;
int var;
+ av1_setup_pre_planes(xd, ref_idx, yv12, mi_row, mi_col,
+ get_ref_scale_factors(cm, ref), num_planes);
+ set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]);
if (scaled_ref_frame) {
backup_yv12 = xd->plane[AOM_PLANE_Y].pre[ref_idx];
av1_setup_pre_planes(xd, ref_idx, scaled_ref_frame, mi_row, mi_col, NULL,
num_planes);
- } else {
- av1_setup_pre_planes(xd, ref_idx, yv12, mi_row, mi_col,
- get_ref_scale_factors(cm, ref), num_planes);
}
// This overwrites the mv_limits so we will need to restore it later.
@@ -3122,6 +3122,9 @@
const int use_subpel_search =
var < INT_MAX && !cpi->common.cur_frame_force_integer_mv && use_subpixel;
+ if (scaled_ref_frame) {
+ xd->plane[AOM_PLANE_Y].pre[ref_idx] = backup_yv12;
+ }
if (use_subpel_search) {
int not_used = 0;
if (cpi->sf.use_accurate_subpel_search) {
@@ -3151,7 +3154,6 @@
mbmi->mv[0].as_mv = x->best_mv.as_mv;
// Get a copy of the prediction output
- set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]);
av1_enc_build_inter_predictor(cm, xd, mi_row, mi_col, NULL, bsize,
AOM_PLANE_Y, AOM_PLANE_Y);