From d80d63f477a8a20a72365a20fee1acb55b50cd7c Mon Sep 17 00:00:00 2001 From: Debargha Mukherjee Date: Wed, 17 May 2017 15:53:27 -0700 Subject: [PATCH] Fixes a mv pred issue introduced in a prior patch Fixes a baseline BDRATE drop issue introduced in 0743857c1a01d40a369c89af27bb1c819253e0d9. Partially reverts the above patch. BUG=aomedia:544 Change-Id: Ia7cd89330cab189d22b58e183951fc6429021f42 --- av1/encoder/rd.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c index 3ac935349..ff2532d5c 100644 --- a/av1/encoder/rd.c +++ b/av1/encoder/rd.c @@ -742,24 +742,19 @@ void av1_mv_pred(const AV1_COMP *cpi, MACROBLOCK *x, uint8_t *ref_y_buffer, int max_mv = 0; uint8_t *src_y_ptr = x->plane[0].src.buf; uint8_t *ref_y_ptr; - int num_mv_refs = 0; MV pred_mv[MAX_MV_REF_CANDIDATES + 1]; - if (cpi->sf.adaptive_motion_search && block_size < x->max_partition_size) { - pred_mv[num_mv_refs] = x->pred_mv[ref_frame]; - num_mv_refs++; - } - if (x->mbmi_ext->ref_mv_count[ref_frame] > 0) { - pred_mv[num_mv_refs] = x->mbmi_ext->ref_mvs[ref_frame][0].as_mv; - num_mv_refs++; - } - if (x->mbmi_ext->ref_mv_count[ref_frame] > 1) { - if (x->mbmi_ext->ref_mvs[ref_frame][0].as_int != - x->mbmi_ext->ref_mvs[ref_frame][1].as_int) { - pred_mv[num_mv_refs] = x->mbmi_ext->ref_mvs[ref_frame][1].as_mv; - num_mv_refs++; - } + int num_mv_refs = 0; + + pred_mv[num_mv_refs++] = x->mbmi_ext->ref_mvs[ref_frame][0].as_mv; + if (x->mbmi_ext->ref_mvs[ref_frame][0].as_int != + x->mbmi_ext->ref_mvs[ref_frame][1].as_int) { + pred_mv[num_mv_refs++] = x->mbmi_ext->ref_mvs[ref_frame][1].as_mv; } + if (cpi->sf.adaptive_motion_search && block_size < x->max_partition_size) + pred_mv[num_mv_refs++] = x->pred_mv[ref_frame]; + assert(num_mv_refs <= (int)(sizeof(pred_mv) / sizeof(pred_mv[0]))); + // Get the sad for each candidate reference mv. for (i = 0; i < num_mv_refs; ++i) { const MV *this_mv = &pred_mv[i]; -- GitLab