diff options
Diffstat (limited to 'third_party/aom/av1/encoder/temporal_filter.c')
-rw-r--r-- | third_party/aom/av1/encoder/temporal_filter.c | 81 |
1 files changed, 21 insertions, 60 deletions
diff --git a/third_party/aom/av1/encoder/temporal_filter.c b/third_party/aom/av1/encoder/temporal_filter.c index d7e4f4eb3..75fdf02a5 100644 --- a/third_party/aom/av1/encoder/temporal_filter.c +++ b/third_party/aom/av1/encoder/temporal_filter.c @@ -25,6 +25,7 @@ #include "av1/encoder/mcomp.h" #include "av1/encoder/encoder.h" #include "av1/encoder/ratectrl.h" +#include "av1/encoder/reconinter_enc.h" #include "av1/encoder/segmentation.h" #include "av1/encoder/temporal_filter.h" #include "aom_dsp/aom_dsp_common.h" @@ -37,13 +38,12 @@ 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 can_use_previous) { - const int which_mv = 0; + int can_use_previous, int num_planes) { const MV mv = { mv_row, mv_col }; enum mv_precision mv_precision_uv; int uv_stride; // TODO(angiebird): change plane setting accordingly - ConvolveParams conv_params = get_conv_params(which_mv, 0, 0, xd->bd); + ConvolveParams conv_params = get_conv_params(0, 0, xd->bd); const InterpFilters interp_filters = xd->mi[0]->interp_filters; WarpTypesAllowed warp_types; memset(&warp_types, 0, sizeof(WarpTypesAllowed)); @@ -55,37 +55,21 @@ static void temporal_filter_predictors_mb_c( uv_stride = stride; mv_precision_uv = MV_PRECISION_Q3; } - - if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - av1_highbd_build_inter_predictor(y_mb_ptr, stride, &pred[0], 16, &mv, scale, - 16, 16, which_mv, interp_filters, - &warp_types, x, y, 0, MV_PRECISION_Q3, x, - y, xd, can_use_previous); - - av1_highbd_build_inter_predictor( - u_mb_ptr, uv_stride, &pred[256], uv_block_width, &mv, scale, - uv_block_width, uv_block_height, which_mv, interp_filters, &warp_types, - x, y, 1, mv_precision_uv, x, y, xd, can_use_previous); - - av1_highbd_build_inter_predictor( - v_mb_ptr, uv_stride, &pred[512], uv_block_width, &mv, scale, - uv_block_width, uv_block_height, which_mv, interp_filters, &warp_types, - x, y, 2, mv_precision_uv, x, y, xd, can_use_previous); - return; - } av1_build_inter_predictor(y_mb_ptr, stride, &pred[0], 16, &mv, scale, 16, 16, &conv_params, interp_filters, &warp_types, x, y, 0, 0, MV_PRECISION_Q3, x, y, xd, can_use_previous); - av1_build_inter_predictor(u_mb_ptr, uv_stride, &pred[256], uv_block_width, - &mv, scale, uv_block_width, uv_block_height, - &conv_params, interp_filters, &warp_types, x, y, 1, - 0, mv_precision_uv, x, y, xd, can_use_previous); + if (num_planes > 1) { + av1_build_inter_predictor( + u_mb_ptr, uv_stride, &pred[256], uv_block_width, &mv, scale, + uv_block_width, uv_block_height, &conv_params, interp_filters, + &warp_types, x, y, 1, 0, mv_precision_uv, x, y, xd, can_use_previous); - av1_build_inter_predictor(v_mb_ptr, uv_stride, &pred[512], uv_block_width, - &mv, scale, uv_block_width, uv_block_height, - &conv_params, interp_filters, &warp_types, x, y, 2, - 0, mv_precision_uv, x, y, xd, can_use_previous); + av1_build_inter_predictor( + v_mb_ptr, uv_stride, &pred[512], uv_block_width, &mv, scale, + uv_block_width, uv_block_height, &conv_params, interp_filters, + &warp_types, x, y, 2, 0, mv_precision_uv, x, y, xd, can_use_previous); + } } void av1_temporal_filter_apply_c(uint8_t *frame1, unsigned int stride, @@ -214,7 +198,8 @@ void av1_highbd_temporal_filter_apply_c( static int temporal_filter_find_matching_mb_c(AV1_COMP *cpi, uint8_t *arf_frame_buf, uint8_t *frame_ptr_buf, - int stride) { + int stride, int x_pos, + int y_pos) { MACROBLOCK *const x = &cpi->td.mb; MACROBLOCKD *const xd = &x->e_mbd; const MV_SPEED_FEATURES *const mv_sf = &cpi->sf.mv; @@ -250,11 +235,9 @@ static int temporal_filter_find_matching_mb_c(AV1_COMP *cpi, x->mvcost = x->mv_cost_stack; x->nmvjointcost = x->nmv_vec_cost; - // Use mv costing from x->mvcost directly - av1_hex_search(x, &best_ref_mv1_full, step_param, sadpb, 1, - cond_cost_list(cpi, cost_list), &cpi->fn_ptr[BLOCK_16X16], 0, - &best_ref_mv1); - + av1_full_pixel_search(cpi, x, BLOCK_16X16, &best_ref_mv1_full, step_param, + NSTEP, 1, sadpb, cond_cost_list(cpi, cost_list), + &best_ref_mv1, 0, 0, x_pos, y_pos, 0); x->mv_limits = tmp_mv_limits; // Ignore mv costing by sending NULL pointer instead of cost array @@ -370,7 +353,8 @@ static void temporal_filter_iterate_c(AV1_COMP *cpi, // Find best match in this frame by MC int err = temporal_filter_find_matching_mb_c( cpi, frames[alt_ref_index]->y_buffer + mb_y_offset, - frames[frame]->y_buffer + mb_y_offset, frames[frame]->y_stride); + frames[frame]->y_buffer + mb_y_offset, frames[frame]->y_stride, + mb_col * 16, mb_row * 16); // Assign higher weight to matching MB if it's error // score is lower. If not applying MC default behavior @@ -386,7 +370,7 @@ static void temporal_filter_iterate_c(AV1_COMP *cpi, frames[frame]->v_buffer + mb_uv_offset, frames[frame]->y_stride, mb_uv_width, mb_uv_height, mbd->mi[0]->mv[0].as_mv.row, mbd->mi[0]->mv[0].as_mv.col, predictor, scale, mb_col * 16, - mb_row * 16, cm->allow_warped_motion); + mb_row * 16, cm->allow_warped_motion, num_planes); // Apply the filter (YUV) if (mbd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { @@ -556,14 +540,6 @@ static void adjust_arnr_filter(AV1_COMP *cpi, int distance, int group_boost, strength = group_boost / 300; } - // Adjustments for second level arf in multi arf case. - if (cpi->oxcf.pass == 2 && cpi->multi_arf_allowed) { - const GF_GROUP *const gf_group = &cpi->twopass.gf_group; - if (gf_group->rf_level[gf_group->index] != GF_ARF_STD) { - strength >>= 1; - } - } - *arnr_frames = frames; *arnr_strength = strength; } @@ -593,21 +569,6 @@ void av1_temporal_filter(AV1_COMP *cpi, int distance) { int which_arf = gf_group->arf_update_idx[gf_group->index]; -#if USE_GF16_MULTI_LAYER - if (cpi->rc.baseline_gf_interval == 16) { - // Identify the index to the current ARF. - const int num_arfs_in_gf = cpi->num_extra_arfs + 1; - int arf_idx; - for (arf_idx = 0; arf_idx < num_arfs_in_gf; arf_idx++) { - if (gf_group->index == cpi->arf_pos_in_gf[arf_idx]) { - which_arf = arf_idx; - break; - } - } - assert(arf_idx < num_arfs_in_gf); - } -#endif // USE_GF16_MULTI_LAYER - // Set the temporal filtering status for the corresponding OVERLAY frame if (strength == 0 && frames_to_blur == 1) cpi->is_arf_filter_off[which_arf] = 1; |