summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorAdrian Grange <agrange@google.com>2015-03-20 07:49:54 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2015-03-20 07:49:54 -0700
commitfc0589761912e414ac1ab6e81f5cab48c894a805 (patch)
tree8ad749ac64743426d495bed3994a8b7b1b077ea4 /vp9
parent094a0faf88998f89e7b431415ee75a8ce214f92f (diff)
parent12d946df893a5abaf762d776603de4a3f0bd9949 (diff)
downloadlibvpx-fc0589761912e414ac1ab6e81f5cab48c894a805.tar
libvpx-fc0589761912e414ac1ab6e81f5cab48c894a805.tar.gz
libvpx-fc0589761912e414ac1ab6e81f5cab48c894a805.tar.bz2
libvpx-fc0589761912e414ac1ab6e81f5cab48c894a805.zip
Merge "Restore first ref frame pointer to the correct value"
Diffstat (limited to 'vp9')
-rw-r--r--vp9/encoder/vp9_rdopt.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 6a3632efa..09512df18 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1544,8 +1544,8 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
const int ph = 4 * num_4x4_blocks_high_lookup[bsize];
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
- const int refs[2] = { mbmi->ref_frame[0],
- mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1] };
+ const int refs[2] = {mbmi->ref_frame[0],
+ mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1]};
int_mv ref_mv[2];
int ite, ref;
// Prediction buffer from second frame.
@@ -1559,7 +1559,6 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
// Do joint motion search in compound mode to get more accurate mv.
struct buf_2d backup_yv12[2][MAX_MB_PLANE];
- struct buf_2d scaled_first_yv12 = xd->plane[0].pre[0];
int last_besterr[2] = {INT_MAX, INT_MAX};
const YV12_BUFFER_CONFIG *const scaled_ref_frame[2] = {
vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[0]),
@@ -1592,8 +1591,8 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
frame_mv[refs[ref]].as_int = single_newmv[refs[ref]].as_int;
}
- // Allow joint search multiple times iteratively for each ref frame
- // and break out the search loop if it couldn't find better mv.
+ // Allow joint search multiple times iteratively for each reference frame
+ // and break out of the search loop if it couldn't find a better mv.
for (ite = 0; ite < 4; ite++) {
struct buf_2d ref_yv12[2];
int bestsme = INT_MAX;
@@ -1605,13 +1604,15 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
int tmp_col_max = x->mv_col_max;
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
- int id = ite % 2;
+ int id = ite % 2; // Even iterations search in the first reference frame,
+ // odd iterations search in the second. The predictor
+ // found for the 'other' reference frame is factored in.
// Initialized here because of compiler problem in Visual Studio.
ref_yv12[0] = xd->plane[0].pre[0];
ref_yv12[1] = xd->plane[0].pre[1];
- // Get pred block from second frame.
+ // Get the prediction block from the 'other' reference frame.
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
vp9_highbd_build_inter_predictor(ref_yv12[!id].buf,
@@ -1644,18 +1645,18 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
mi_col * MI_SIZE, mi_row * MI_SIZE);
#endif // CONFIG_VP9_HIGHBITDEPTH
- // Compound motion search on first ref frame.
+ // Do compound motion search on the current reference frame.
if (id)
xd->plane[0].pre[0] = ref_yv12[id];
vp9_set_mv_search_range(x, &ref_mv[id].as_mv);
- // Use mv result from single mode as mvp.
+ // Use the mv result from the single mode as mv predictor.
tmp_mv = frame_mv[refs[id]].as_mv;
tmp_mv.col >>= 3;
tmp_mv.row >>= 3;
- // Small-range full-pixel motion search
+ // Small-range full-pixel motion search.
bestsme = vp9_refining_search_8p_c(x, &tmp_mv, sadpb,
search_range,
&cpi->fn_ptr[bsize],
@@ -1685,8 +1686,9 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
pw, ph);
}
+ // Restore the pointer to the first (possibly scaled) prediction buffer.
if (id)
- xd->plane[0].pre[0] = scaled_first_yv12;
+ xd->plane[0].pre[0] = ref_yv12[0];
if (bestsme < last_besterr[id]) {
frame_mv[refs[id]].as_mv = tmp_mv;
@@ -1700,7 +1702,7 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
for (ref = 0; ref < 2; ++ref) {
if (scaled_ref_frame[ref]) {
- // restore the predictor
+ // Restore the prediction frame pointers to their unscaled versions.
int i;
for (i = 0; i < MAX_MB_PLANE; i++)
xd->plane[i].pre[ref] = backup_yv12[ref][i];