From 8691565441beb0e8693ad28655ec5c4841432813 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Fri, 24 Jan 2014 17:06:26 -0800 Subject: [PATCH] Removing subpix_fn_table struct. We don't use different filter kernels for x and y, it is always one kernel for both directions. Change-Id: Iefcbb02ec74bf46ea20d9dca672a3efd5d631517 --- vp9/common/vp9_blockd.h | 2 +- vp9/common/vp9_filter.h | 5 ----- vp9/common/vp9_reconinter.c | 15 +++++++-------- vp9/common/vp9_reconinter.h | 3 +-- vp9/decoder/vp9_decodeframe.c | 3 +-- vp9/encoder/vp9_encodemb.c | 7 +++---- vp9/encoder/vp9_rdopt.c | 6 +++--- vp9/encoder/vp9_temporal_filter.c | 6 +++--- 8 files changed, 19 insertions(+), 28 deletions(-) diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index 39ea4922b..9e16d8f78 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -252,7 +252,7 @@ typedef struct macroblockd { /* Inverse transform function pointers. */ void (*itxm_add)(const int16_t *input, uint8_t *dest, int stride, int eob); - struct subpix_fn_table subpix; + const interp_kernel *interp_kernel; int corrupted; diff --git a/vp9/common/vp9_filter.h b/vp9/common/vp9_filter.h index c8a0b6130..b611e304c 100644 --- a/vp9/common/vp9_filter.h +++ b/vp9/common/vp9_filter.h @@ -35,11 +35,6 @@ typedef enum { typedef int16_t interp_kernel[SUBPEL_TAPS]; -struct subpix_fn_table { - const interp_kernel *filter_x; - const interp_kernel *filter_y; -}; - const interp_kernel *vp9_get_interp_kernel(INTERP_FILTER filter); extern const interp_kernel vp9_bilinear_filters[SUBPEL_SHIFTS]; diff --git a/vp9/common/vp9_reconinter.c b/vp9/common/vp9_reconinter.c index b5a9248c3..d554cc0ed 100644 --- a/vp9/common/vp9_reconinter.c +++ b/vp9/common/vp9_reconinter.c @@ -69,13 +69,11 @@ static void inter_predictor(const uint8_t *src, int src_stride, const int subpel_y, const struct scale_factors *sf, int w, int h, int ref, - const struct subpix_fn_table *subpix, + const interp_kernel *kernel, int xs, int ys) { sf->predict[subpel_x != 0][subpel_y != 0][ref]( src, src_stride, dst, dst_stride, - subpix->filter_x[subpel_x], xs, - subpix->filter_y[subpel_y], ys, - w, h); + kernel[subpel_x], xs, kernel[subpel_y], ys, w, h); } void vp9_build_inter_predictor(const uint8_t *src, int src_stride, @@ -83,7 +81,7 @@ void vp9_build_inter_predictor(const uint8_t *src, int src_stride, const MV *src_mv, const struct scale_factors *sf, int w, int h, int ref, - const struct subpix_fn_table *subpix, + const interp_kernel *kernel, enum mv_precision precision, int x, int y) { const int is_q4 = precision == MV_PRECISION_Q4; @@ -96,7 +94,7 @@ void vp9_build_inter_predictor(const uint8_t *src, int src_stride, src += (mv.row >> SUBPEL_BITS) * src_stride + (mv.col >> SUBPEL_BITS); inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, - sf, w, h, ref, subpix, sf->x_step_q4, sf->y_step_q4); + sf, w, h, ref, kernel, sf->x_step_q4, sf->y_step_q4); } static INLINE int round_mv_comp_q4(int value) { @@ -198,7 +196,8 @@ static void build_inter_predictors(MACROBLOCKD *xd, int plane, int block, + (scaled_mv.col >> SUBPEL_BITS); inter_predictor(pre, pre_buf->stride, dst, dst_buf->stride, - subpel_x, subpel_y, sf, w, h, ref, &xd->subpix, xs, ys); + subpel_x, subpel_y, sf, w, h, ref, xd->interp_kernel, + xs, ys); } } @@ -367,7 +366,7 @@ static void dec_build_inter_predictors(MACROBLOCKD *xd, int plane, int block, } inter_predictor(buf_ptr, buf_stride, dst, dst_buf->stride, subpel_x, - subpel_y, sf, w, h, ref, &xd->subpix, xs, ys); + subpel_y, sf, w, h, ref, xd->interp_kernel, xs, ys); } } diff --git a/vp9/common/vp9_reconinter.h b/vp9/common/vp9_reconinter.h index 58f4b417e..10e16580e 100644 --- a/vp9/common/vp9_reconinter.h +++ b/vp9/common/vp9_reconinter.h @@ -18,7 +18,6 @@ extern "C" { #endif -struct subpix_fn_table; void vp9_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col, BLOCK_SIZE bsize); @@ -36,7 +35,7 @@ void vp9_build_inter_predictor(const uint8_t *src, int src_stride, const MV *mv_q3, const struct scale_factors *sf, int w, int h, int do_avg, - const struct subpix_fn_table *subpix, + const interp_kernel *kernel, enum mv_precision precision, int x, int y); diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 466b1808f..1d9be5322 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -421,8 +421,7 @@ static void decode_modes_b(VP9_COMMON *const cm, MACROBLOCKD *const xd, if (has_second_ref(mbmi)) set_ref(cm, xd, 1, mi_row, mi_col); - xd->subpix.filter_x = xd->subpix.filter_y = - vp9_get_interp_kernel(mbmi->interp_filter); + xd->interp_kernel = vp9_get_interp_kernel(mbmi->interp_filter); // Prediction vp9_dec_build_inter_predictors_sb(xd, mi_row, mi_col, bsize); diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index d1485307d..5ea75c314 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -37,10 +37,9 @@ void vp9_setup_interp_filters(MACROBLOCKD *xd, INTERP_FILTER filter, set_ref_ptrs(cm, xd, -1, -1); } - xd->subpix.filter_x = xd->subpix.filter_y = - vp9_get_interp_kernel(filter == SWITCHABLE ? EIGHTTAP : filter); - - assert(((intptr_t)xd->subpix.filter_x & 0xff) == 0); + xd->interp_kernel = vp9_get_interp_kernel(filter == SWITCHABLE ? EIGHTTAP + : filter); + assert(((intptr_t)xd->interp_kernel & 0xff) == 0); } void vp9_subtract_block_c(int rows, int cols, diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 3be79f46b..ebe5f80f2 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -1517,8 +1517,8 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi, vp9_build_inter_predictor(pre, pd->pre[ref].stride, dst, pd->dst.stride, &mi->bmi[i].as_mv[ref].as_mv, - &xd->block_refs[ref]->sf, - width, height, ref, &xd->subpix, MV_PRECISION_Q3, + &xd->block_refs[ref]->sf, width, height, ref, + xd->interp_kernel, MV_PRECISION_Q3, mi_col * MI_SIZE + 4 * (i % 2), mi_row * MI_SIZE + 4 * (i / 2)); } @@ -2536,7 +2536,7 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x, &frame_mv[refs[!id]].as_mv, &xd->block_refs[!id]->sf, pw, ph, 0, - &xd->subpix, MV_PRECISION_Q3, + xd->interp_kernel, MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE); // Compound motion search on first ref frame. diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c index c2eea0aaa..c9a424648 100644 --- a/vp9/encoder/vp9_temporal_filter.c +++ b/vp9/encoder/vp9_temporal_filter.c @@ -60,7 +60,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, scale, 16, 16, which_mv, - &xd->subpix, MV_PRECISION_Q3, x, y); + xd->interp_kernel, MV_PRECISION_Q3, x, y); vp9_build_inter_predictor(u_mb_ptr, uv_stride, &pred[256], uv_block_size, @@ -68,7 +68,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, scale, uv_block_size, uv_block_size, which_mv, - &xd->subpix, mv_precision_uv, x, y); + xd->interp_kernel, mv_precision_uv, x, y); vp9_build_inter_predictor(v_mb_ptr, uv_stride, &pred[512], uv_block_size, @@ -76,7 +76,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, scale, uv_block_size, uv_block_size, which_mv, - &xd->subpix, mv_precision_uv, x, y); + xd->interp_kernel, mv_precision_uv, x, y); } void vp9_temporal_filter_apply_c(uint8_t *frame1, -- 2.40.0