Load reference frame pointer to initialize inter_params Change-Id: I0e2fab43acc82557990e33f37d364529ad5a88df
diff --git a/aom_dsp/variance.c b/aom_dsp/variance.c index 020d4fe..c0b6e38 100644 --- a/aom_dsp/variance.c +++ b/aom_dsp/variance.c
@@ -353,7 +353,7 @@ av1_init_inter_params( &inter_pred_params, width, height, mi_y >> pd->subsampling_y, mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y, - xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, filters); + xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, pre_buf, filters); // Get the inter predictor. av1_make_inter_predictor(pre, pre_buf->stride, comp_pred, width, @@ -941,7 +941,7 @@ av1_init_inter_params( &inter_pred_params, width, height, mi_y >> pd->subsampling_y, mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y, - xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, filters); + xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, pre_buf, filters); // Get the inter predictor. av1_make_inter_predictor(pre, pre_buf->stride, comp_pred8, width,
diff --git a/aom_dsp/x86/highbd_variance_sse2.c b/aom_dsp/x86/highbd_variance_sse2.c index bb25d36..502c912 100644 --- a/aom_dsp/x86/highbd_variance_sse2.c +++ b/aom_dsp/x86/highbd_variance_sse2.c
@@ -686,7 +686,7 @@ av1_init_inter_params( &inter_pred_params, width, height, mi_y >> pd->subsampling_y, mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y, - xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, filters); + xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, pre_buf, filters); // Get the inter predictor. av1_make_inter_predictor(pre, pre_buf->stride, comp_pred8, width,
diff --git a/aom_dsp/x86/variance_sse2.c b/aom_dsp/x86/variance_sse2.c index 986b3f2..ad2a93f 100644 --- a/aom_dsp/x86/variance_sse2.c +++ b/aom_dsp/x86/variance_sse2.c
@@ -563,7 +563,7 @@ av1_init_inter_params( &inter_pred_params, width, height, mi_y >> pd->subsampling_y, mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y, - xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, filters); + xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, pre_buf, filters); // Get the inter predictor. av1_make_inter_predictor(pre, pre_buf->stride, comp_pred, width,
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c index 90a87ec..86501c4 100644 --- a/av1/common/reconinter.c +++ b/av1/common/reconinter.c
@@ -61,6 +61,7 @@ int subsampling_x, int subsampling_y, int bit_depth, int use_hbd_buf, int is_intrabc, const struct scale_factors *sf, + const struct buf_2d *ref_buf, int_interpfilters interp_filters) { inter_pred_params->block_width = block_width; inter_pred_params->block_height = block_height; @@ -72,6 +73,7 @@ inter_pred_params->use_hbd_buf = use_hbd_buf; inter_pred_params->is_intrabc = is_intrabc; inter_pred_params->scale_factors = sf; + inter_pred_params->ref_frame_buf = *ref_buf; inter_pred_params->mode = UNIFORM_PRED; if (is_intrabc) {
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h index 2332c81..054b031 100644 --- a/av1/common/reconinter.h +++ b/av1/common/reconinter.h
@@ -122,6 +122,7 @@ int subsampling_x, int subsampling_y, int bit_depth, int use_hbd_buf, int is_intrabc, const struct scale_factors *sf, + const struct buf_2d *ref_buf, int_interpfilters interp_filters); void av1_init_warp_params(InterPredParams *inter_pred_params,
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 963d1fe..78c4b2c 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -756,7 +756,7 @@ &inter_pred_params, b4_w, b4_h, (mi_y >> pd->subsampling_y) + y, (mi_x >> pd->subsampling_x) + x, pd->subsampling_x, pd->subsampling_y, xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, - this_mbmi->interp_filters); + pre_buf, this_mbmi->interp_filters); av1_make_inter_predictor(pre, src_stride, dst, dst_buf->stride, &inter_pred_params, &subpel_params); @@ -816,6 +816,7 @@ &inter_pred_params.conv_params.use_dist_wtd_comp_avg, is_compound); for (ref = 0; ref < 1 + is_compound; ++ref) { + struct buf_2d *const pre_buf = is_intrabc ? dst_buf : &pd->pre[ref]; const struct scale_factors *const sf = is_intrabc ? &cm->sf_identity : xd->block_ref_scale_factors[ref]; WarpTypesAllowed warp_types; @@ -827,10 +828,11 @@ inter_pred_params.conv_params.do_average = 0; } - av1_init_inter_params( - &inter_pred_params, bw, bh, mi_y >> pd->subsampling_y, - mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y, - xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, mi->interp_filters); + av1_init_inter_params(&inter_pred_params, bw, bh, + mi_y >> pd->subsampling_y, + mi_x >> pd->subsampling_x, pd->subsampling_x, + pd->subsampling_y, xd->bd, is_cur_buf_hbd(xd), + mi->use_intrabc, sf, pre_buf, mi->interp_filters); if (!build_for_obmc) av1_init_warp_params(&inter_pred_params, &pd->pre[ref], &warp_types,
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index bbd69bb..cd66f11 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c
@@ -6927,11 +6927,6 @@ InterPredParams inter_pred_params; - av1_init_inter_params(&inter_pred_params, pw, ph, mi_col * MI_SIZE, - mi_row * MI_SIZE, 0, 0, xd->bd, is_cur_buf_hbd(xd), 0, - &cm->sf_identity, interp_filters); - inter_pred_params.conv_params = get_conv_params(0, 0, xd->bd); - // Do joint motion search in compound mode to get more accurate mv. struct buf_2d backup_yv12[2][MAX_MB_PLANE]; int last_besterr[2] = { INT_MAX, INT_MAX }; @@ -6995,6 +6990,11 @@ ref_yv12[0] = xd->plane[plane].pre[0]; ref_yv12[1] = xd->plane[plane].pre[1]; + av1_init_inter_params(&inter_pred_params, pw, ph, mi_col * MI_SIZE, + mi_row * MI_SIZE, 0, 0, xd->bd, is_cur_buf_hbd(xd), 0, + &cm->sf_identity, &ref_yv12[!id], interp_filters); + inter_pred_params.conv_params = get_conv_params(0, 0, xd->bd); + // Since we have scaled the reference frames to match the size of the // current frame we must use a unit scaling factor during mode selection. av1_build_inter_predictor(ref_yv12[!id].buf, ref_yv12[!id].stride, @@ -7540,7 +7540,8 @@ av1_init_inter_params(&inter_pred_params, pw, ph, p_col, p_row, pd->subsampling_x, pd->subsampling_y, xd->bd, - is_cur_buf_hbd(xd), 0, &sf, mbmi->interp_filters); + is_cur_buf_hbd(xd), 0, &sf, &ref_yv12, + mbmi->interp_filters); inter_pred_params.conv_params = get_conv_params(0, 0, xd->bd); // Get the prediction block from the 'other' reference frame.
diff --git a/av1/encoder/reconinter_enc.c b/av1/encoder/reconinter_enc.c index e987ff7..fcd91a5 100644 --- a/av1/encoder/reconinter_enc.c +++ b/av1/encoder/reconinter_enc.c
@@ -177,7 +177,7 @@ &inter_pred_params, b4_w, b4_h, (mi_y >> pd->subsampling_y) + y, (mi_x >> pd->subsampling_x) + x, pd->subsampling_x, pd->subsampling_y, xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, - this_mbmi->interp_filters); + pre_buf, this_mbmi->interp_filters); av1_make_inter_predictor(pre, pre_buf->stride, dst, dst_buf->stride, &inter_pred_params, &subpel_params); @@ -216,10 +216,11 @@ warp_types.global_warp_allowed = is_global[ref]; warp_types.local_warp_allowed = mi->motion_mode == WARPED_CAUSAL; - av1_init_inter_params( - &inter_pred_params, bw, bh, mi_y >> pd->subsampling_y, - mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y, - xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, mi->interp_filters); + av1_init_inter_params(&inter_pred_params, bw, bh, + mi_y >> pd->subsampling_y, + mi_x >> pd->subsampling_x, pd->subsampling_x, + pd->subsampling_y, xd->bd, is_cur_buf_hbd(xd), + mi->use_intrabc, sf, pre_buf, mi->interp_filters); if (!build_for_obmc) av1_init_warp_params(&inter_pred_params, &pd->pre[ref], &warp_types, @@ -475,10 +476,10 @@ InterPredParams inter_pred_params; - av1_init_inter_params(&inter_pred_params, bw, bh, mi_y, mi_x, - pd->subsampling_x, pd->subsampling_y, xd->bd, - is_cur_buf_hbd(xd), 0, - xd->block_ref_scale_factors[ref], mi->interp_filters); + av1_init_inter_params( + &inter_pred_params, bw, bh, mi_y, mi_x, pd->subsampling_x, + pd->subsampling_y, xd->bd, is_cur_buf_hbd(xd), 0, + xd->block_ref_scale_factors[ref], &pd->pre[ref], mi->interp_filters); inter_pred_params.conv_params = get_conv_params(0, plane, xd->bd); av1_init_warp_params(&inter_pred_params, &pd->pre[ref], &warp_types, ref, xd, mi);
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c index 556bb5a..0eee01b 100644 --- a/av1/encoder/temporal_filter.c +++ b/av1/encoder/temporal_filter.c
@@ -52,10 +52,11 @@ 0U, 991146300U }; static void temporal_filter_predictors_mb_c( - MACROBLOCKD *xd, uint8_t *y_mb_ptr, uint8_t *u_mb_ptr, uint8_t *v_mb_ptr, - int stride, int uv_block_width, int uv_block_height, int mv_row, int mv_col, - uint8_t *pred, struct scale_factors *scale, int x, int y, int num_planes, - MV *blk_mvs, int use_32x32) { + YV12_BUFFER_CONFIG *ref_frame, MACROBLOCKD *xd, uint8_t *y_mb_ptr, + uint8_t *u_mb_ptr, uint8_t *v_mb_ptr, int stride, int uv_block_width, + int uv_block_height, int mv_row, int mv_col, uint8_t *pred, + struct scale_factors *scale, int x, int y, int num_planes, MV *blk_mvs, + int use_32x32) { int uv_stride; const int_interpfilters interp_filters = av1_broadcast_interp_filter(MULTITAP_SHARP); @@ -70,9 +71,12 @@ } InterPredParams inter_pred_params; + struct buf_2d ref_buf_y = { NULL, ref_frame->y_buffer, ref_frame->y_width, + ref_frame->y_height, ref_frame->y_stride }; av1_init_inter_params(&inter_pred_params, BW, BH, x, y, 0, 0, xd->bd, - is_cur_buf_hbd(xd), 0, scale, interp_filters); + is_cur_buf_hbd(xd), 0, scale, &ref_buf_y, + interp_filters); inter_pred_params.conv_params = get_conv_params(0, 0, xd->bd); if (use_32x32) { @@ -84,14 +88,23 @@ &inter_pred_params); if (num_planes > 1) { - av1_init_inter_params(&inter_pred_params, uv_block_width, uv_block_height, - x, y, xd->plane[1].subsampling_x, - xd->plane[1].subsampling_y, xd->bd, - is_cur_buf_hbd(xd), 0, scale, interp_filters); + struct buf_2d ref_buf_uv = { NULL, ref_frame->u_buffer, + ref_frame->uv_width, ref_frame->uv_height, + ref_frame->uv_stride }; + + av1_init_inter_params( + &inter_pred_params, uv_block_width, uv_block_height, x, y, + xd->plane[1].subsampling_x, xd->plane[1].subsampling_y, xd->bd, + is_cur_buf_hbd(xd), 0, scale, &ref_buf_uv, interp_filters); inter_pred_params.conv_params = get_conv_params(0, 1, xd->bd); av1_build_inter_predictor(u_mb_ptr, uv_stride, &pred[BLK_PELS], uv_block_width, &mv, x, y, &inter_pred_params); + ref_buf_uv.buf0 = ref_frame->v_buffer; + av1_init_inter_params( + &inter_pred_params, uv_block_width, uv_block_height, x, y, + xd->plane[1].subsampling_x, xd->plane[1].subsampling_y, xd->bd, + is_cur_buf_hbd(xd), 0, scale, &ref_buf_uv, interp_filters); inter_pred_params.conv_params = get_conv_params(0, 2, xd->bd); av1_build_inter_predictor(v_mb_ptr, uv_stride, &pred[(BLK_PELS << 1)], uv_block_width, &mv, x, y, &inter_pred_params); @@ -105,7 +118,8 @@ int i, j, k = 0, ys = (BH >> 1), xs = (BW >> 1); // Y predictor av1_init_inter_params(&inter_pred_params, xs, ys, x, y, 0, 0, xd->bd, - is_cur_buf_hbd(xd), 0, scale, interp_filters); + is_cur_buf_hbd(xd), 0, scale, &ref_buf_y, + interp_filters); inter_pred_params.conv_params = get_conv_params(0, 0, xd->bd); for (i = 0; i < BH; i += ys) { for (j = 0; j < BW; j += xs) { @@ -131,16 +145,25 @@ const int uv_offset = i * uv_stride + j; const int p_offset = i * uv_block_width + j; - av1_init_inter_params(&inter_pred_params, xs, ys, x, y, - xd->plane[1].subsampling_x, - xd->plane[1].subsampling_y, xd->bd, - is_cur_buf_hbd(xd), 0, scale, interp_filters); - inter_pred_params.conv_params = get_conv_params(0, 1, xd->bd); + struct buf_2d ref_buf_uv = { NULL, ref_frame->u_buffer, + ref_frame->uv_width, ref_frame->uv_height, + ref_frame->uv_stride }; + av1_init_inter_params( + &inter_pred_params, xs, ys, x, y, xd->plane[1].subsampling_x, + xd->plane[1].subsampling_y, xd->bd, is_cur_buf_hbd(xd), 0, scale, + &ref_buf_uv, interp_filters); + inter_pred_params.conv_params = get_conv_params(0, 1, xd->bd); av1_build_inter_predictor(u_mb_ptr + uv_offset, uv_stride, &pred[BLK_PELS + p_offset], uv_block_width, &mv, x, y, &inter_pred_params); + ref_buf_uv.buf0 = ref_frame->v_buffer; + av1_init_inter_params( + &inter_pred_params, xs, ys, x, y, xd->plane[1].subsampling_x, + xd->plane[1].subsampling_y, xd->bd, is_cur_buf_hbd(xd), 0, scale, + &ref_buf_uv, interp_filters); + inter_pred_params.conv_params = get_conv_params(0, 1, xd->bd); av1_build_inter_predictor( v_mb_ptr + uv_offset, uv_stride, &pred[(BLK_PELS << 1) + p_offset], @@ -1158,7 +1181,7 @@ if (blk_fw[0] || blk_fw[1] || blk_fw[2] || blk_fw[3]) { // Construct the predictors temporal_filter_predictors_mb_c( - mbd, frames[frame]->y_buffer + mb_y_src_offset, + frames[frame], mbd, frames[frame]->y_buffer + mb_y_src_offset, frames[frame]->u_buffer + mb_uv_src_offset, frames[frame]->v_buffer + mb_uv_src_offset, frames[frame]->y_stride, mb_uv_width, mb_uv_height,
diff --git a/av1/encoder/tpl_model.c b/av1/encoder/tpl_model.c index eceea1e..9f31d5f 100644 --- a/av1/encoder/tpl_model.c +++ b/av1/encoder/tpl_model.c
@@ -240,10 +240,13 @@ motion_estimation(cpi, x, src_mb_buffer, ref_mb, src_stride, ref_stride, bsize, mi_row, mi_col); + struct buf_2d ref_buf = { NULL, ref_frame_ptr->y_buffer, + ref_frame_ptr->y_width, ref_frame_ptr->y_height, + ref_frame_ptr->y_stride }; InterPredParams inter_pred_params; av1_init_inter_params(&inter_pred_params, bw, bh, mi_col * MI_SIZE, mi_row * MI_SIZE, 0, 0, xd->bd, is_cur_buf_hbd(xd), 0, - sf, kernel); + sf, &ref_buf, kernel); inter_pred_params.conv_params = get_conv_params(0, 0, xd->bd); av1_build_inter_predictor(ref_mb, ref_stride, predictor, bw, @@ -291,13 +294,17 @@ // Final encode if (is_inter_mode(best_mode)) { + const YV12_BUFFER_CONFIG *ref_frame_ptr = ref_frame[best_rf_idx]; + InterPredParams inter_pred_params; + struct buf_2d ref_buf = { NULL, ref_frame_ptr->y_buffer, + ref_frame_ptr->y_width, ref_frame_ptr->y_height, + ref_frame_ptr->y_stride }; av1_init_inter_params(&inter_pred_params, bw, bh, mi_col * MI_SIZE, mi_row * MI_SIZE, 0, 0, xd->bd, is_cur_buf_hbd(xd), 0, - sf, kernel); + sf, &ref_buf, kernel); inter_pred_params.conv_params = get_conv_params(0, 0, xd->bd); - const YV12_BUFFER_CONFIG *ref_frame_ptr = ref_frame[best_rf_idx]; const int ref_mb_offset = mi_row * MI_SIZE * ref_frame_ptr->y_stride + mi_col * MI_SIZE; uint8_t *ref_mb = ref_frame_ptr->y_buffer + ref_mb_offset; @@ -1055,10 +1062,12 @@ ref->y_buffer + mb_y_offset_ref, src->y_stride, ref->y_stride, bsize, mi_row, mi_col); + struct buf_2d ref_buf = { NULL, ref->y_buffer, ref->y_width, + ref->y_height, ref->y_stride }; InterPredParams inter_pred_params; av1_init_inter_params(&inter_pred_params, bw, bh, mi_col * MI_SIZE, mi_row * MI_SIZE, 0, 0, xd->bd, is_cur_buf_hbd(xd), - 0, &sf, kernel); + 0, &sf, &ref_buf, kernel); inter_pred_params.conv_params = get_conv_params(0, 0, xd->bd); av1_build_inter_predictor(ref->y_buffer + mb_y_offset_ref, ref->y_stride,