Use 8-tap interp filter in temporal filtering
Used 8-tap interp filter in temporal filtering to achieve more accurate
motion search result. AWCY result showed 0.0468% PSNR gain and 0.1019%
SSIM gain.
PSNR | PSNR Cb | PSNR Cr | PSNR HVS | SSIM | MS SSIM | CIEDE 2000
-0.0468 | -0.0342 | -0.0121 | -0.1053 | -0.1019 | -0.1479 | -0.0605
No encoder speed difference was seen.
STATS_CHANGED
Change-Id: I0e7ea528e716809f00c0b00bdf0e36986d297ebc
diff --git a/av1/common/filter.h b/av1/common/filter.h
index 44d8d20..d7ef5c9 100644
--- a/av1/common/filter.h
+++ b/av1/common/filter.h
@@ -218,12 +218,13 @@
static INLINE const InterpFilterParams *av1_get_filter(int subpel_search) {
assert(subpel_search >= USE_2_TAPS);
- return (subpel_search == USE_2_TAPS)
- ? get_4tap_interp_filter_params(BILINEAR)
- : ((subpel_search == USE_4_TAPS)
- ? get_4tap_interp_filter_params(EIGHTTAP_REGULAR)
- : av1_get_interp_filter_params_with_block_size(
- EIGHTTAP_REGULAR, 8));
+
+ switch (subpel_search) {
+ case USE_2_TAPS: return get_4tap_interp_filter_params(BILINEAR);
+ case USE_4_TAPS: return get_4tap_interp_filter_params(EIGHTTAP_REGULAR);
+ case USE_8_TAPS: return &av1_interp_filter_params_list[EIGHTTAP_REGULAR];
+ default: assert(0); return NULL;
+ }
}
#ifdef __cplusplus
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c
index 35e520d..6fa88b7 100644
--- a/av1/encoder/temporal_filter.c
+++ b/av1/encoder/temporal_filter.c
@@ -263,7 +263,7 @@
cpi->common.allow_high_precision_mv, x->errorperbit,
&cpi->fn_ptr[BLOCK_16X16], 0, mv_sf->subpel_iters_per_step,
cond_cost_list(cpi, cost_list), NULL, NULL, &distortion, &sse, NULL,
- NULL, 0, 0, 16, 16, USE_2_TAPS_ORIG, 1);
+ NULL, 0, 0, 16, 16, USE_8_TAPS, 1);
}
x->e_mbd.mi[0]->mv[0] = x->best_mv;
@@ -278,8 +278,7 @@
static void temporal_filter_iterate_c(AV1_COMP *cpi,
YV12_BUFFER_CONFIG **frames,
int frame_count, int alt_ref_index,
- int strength,
- struct scale_factors *scale) {
+ int strength, RefBuffer *ref_buf) {
const AV1_COMMON *cm = &cpi->common;
const int num_planes = av1_num_planes(cm);
int byte;
@@ -310,6 +309,9 @@
predictor = predictor8;
}
+ mbd->block_refs[0] = ref_buf;
+ mbd->block_refs[1] = ref_buf;
+
for (i = 0; i < num_planes; i++) input_buffer[i] = mbd->plane[i].pre[0].buf;
for (mb_row = 0; mb_row < mb_rows; mb_row++) {
@@ -373,7 +375,7 @@
frames[frame]->u_buffer + mb_uv_offset,
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,
+ mbd->mi[0]->mv[0].as_mv.col, predictor, &ref_buf->sf, mb_col * 16,
mb_row * 16, cm->allow_warped_motion, num_planes);
// Apply the filter (YUV)
@@ -661,7 +663,11 @@
int strength;
int frames_to_blur_backward;
int frames_to_blur_forward;
- struct scale_factors sf;
+ RefBuffer ref_buf;
+ ref_buf.idx = INVALID_IDX;
+ ref_buf.idx = INVALID_IDX;
+ ref_buf.buf = NULL;
+
YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS] = { NULL };
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
int rdmult = 0;
@@ -705,7 +711,7 @@
// supported.
// ARF is produced at the native frame size and resized when coded.
av1_setup_scale_factors_for_frame(
- &sf, frames[0]->y_crop_width, frames[0]->y_crop_height,
+ &ref_buf.sf, frames[0]->y_crop_width, frames[0]->y_crop_height,
frames[0]->y_crop_width, frames[0]->y_crop_height);
}
@@ -717,5 +723,5 @@
av1_initialize_cost_tables(&cpi->common, &cpi->td.mb);
temporal_filter_iterate_c(cpi, frames, frames_to_blur,
- frames_to_blur_backward, strength, &sf);
+ frames_to_blur_backward, strength, &ref_buf);
}