From 10ad97bc55288b1c23c1a00fa57b8a796f021268 Mon Sep 17 00:00:00 2001 From: Angie Chiang Date: Mon, 1 Feb 2016 12:49:15 -0800 Subject: [PATCH] Pass filter type instead of filter array Change-Id: I25f2149ddaa332722f7ab82e8f832a253c4b6ab3 --- vp10/common/reconinter.c | 27 +++++++++++---------- vp10/common/reconinter.h | 11 +++++---- vp10/decoder/decodeframe.c | 43 ++++++++++++++++++---------------- vp10/encoder/rdopt.c | 8 +++---- vp10/encoder/temporal_filter.c | 18 +++++++------- 5 files changed, 57 insertions(+), 50 deletions(-) diff --git a/vp10/common/reconinter.c b/vp10/common/reconinter.c index 241b9aa7e..60592fd70 100644 --- a/vp10/common/reconinter.c +++ b/vp10/common/reconinter.c @@ -25,7 +25,7 @@ void vp10_highbd_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 InterpKernel *kernel, + const INTERP_FILTER interp_filter, enum mv_precision precision, int x, int y, int bd) { const int is_q4 = precision == MV_PRECISION_Q4; @@ -38,7 +38,8 @@ void vp10_highbd_build_inter_predictor(const uint8_t *src, int src_stride, src += (mv.row >> SUBPEL_BITS) * src_stride + (mv.col >> SUBPEL_BITS); high_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, - sf, w, h, ref, kernel, sf->x_step_q4, sf->y_step_q4, bd); + sf, w, h, ref, interp_filter, sf->x_step_q4, + sf->y_step_q4, bd); } #endif // CONFIG_VP9_HIGHBITDEPTH @@ -47,7 +48,7 @@ void vp10_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 InterpKernel *kernel, + const INTERP_FILTER interp_filter, enum mv_precision precision, int x, int y) { const int is_q4 = precision == MV_PRECISION_Q4; @@ -60,7 +61,7 @@ void vp10_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, kernel, sf->x_step_q4, sf->y_step_q4); + sf, w, h, ref, interp_filter, sf->x_step_q4, sf->y_step_q4); } void build_inter_predictors(MACROBLOCKD *xd, int plane, int block, @@ -70,7 +71,7 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane, int block, struct macroblockd_plane *const pd = &xd->plane[plane]; const MODE_INFO *mi = xd->mi[0]; const int is_compound = has_second_ref(&mi->mbmi); - const InterpKernel *kernel = vp10_filter_kernels[mi->mbmi.interp_filter]; + const INTERP_FILTER interp_filter = mi->mbmi.interp_filter; int ref; for (ref = 0; ref < 1 + is_compound; ++ref) { @@ -115,15 +116,15 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane, int block, #if CONFIG_VP9_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { high_inter_predictor(pre, pre_buf->stride, dst, dst_buf->stride, - subpel_x, subpel_y, sf, w, h, ref, kernel, xs, ys, - xd->bd); + subpel_x, subpel_y, sf, w, h, ref, + interp_filter, xs, ys, xd->bd); } else { inter_predictor(pre, pre_buf->stride, dst, dst_buf->stride, - subpel_x, subpel_y, sf, w, h, ref, kernel, xs, ys); + subpel_x, subpel_y, sf, w, h, ref, interp_filter, xs, ys); } #else inter_predictor(pre, pre_buf->stride, dst, dst_buf->stride, - subpel_x, subpel_y, sf, w, h, ref, kernel, xs, ys); + subpel_x, subpel_y, sf, w, h, ref, interp_filter, xs, ys); #endif // CONFIG_VP9_HIGHBITDEPTH } } @@ -140,7 +141,7 @@ void vp10_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, uint8_t *const dst = &pd->dst.buf[(ir * pd->dst.stride + ic) << 2]; int ref; const int is_compound = has_second_ref(&mi->mbmi); - const InterpKernel *kernel = vp10_filter_kernels[mi->mbmi.interp_filter]; + const INTERP_FILTER interp_filter = mi->mbmi.interp_filter; for (ref = 0; ref < 1 + is_compound; ++ref) { const uint8_t *pre = @@ -151,7 +152,7 @@ void vp10_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, dst, pd->dst.stride, &mi->bmi[i].as_mv[ref].as_mv, &xd->block_refs[ref]->sf, width, height, - ref, kernel, MV_PRECISION_Q3, + ref, interp_filter, MV_PRECISION_Q3, mi_col * MI_SIZE + 4 * ic, mi_row * MI_SIZE + 4 * ir, xd->bd); } else { @@ -159,7 +160,7 @@ void vp10_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, dst, pd->dst.stride, &mi->bmi[i].as_mv[ref].as_mv, &xd->block_refs[ref]->sf, width, height, ref, - kernel, MV_PRECISION_Q3, + interp_filter, MV_PRECISION_Q3, mi_col * MI_SIZE + 4 * ic, mi_row * MI_SIZE + 4 * ir); } @@ -168,7 +169,7 @@ void vp10_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, dst, pd->dst.stride, &mi->bmi[i].as_mv[ref].as_mv, &xd->block_refs[ref]->sf, width, height, ref, - kernel, MV_PRECISION_Q3, + interp_filter, MV_PRECISION_Q3, mi_col * MI_SIZE + 4 * ic, mi_row * MI_SIZE + 4 * ir); #endif // CONFIG_VP9_HIGHBITDEPTH diff --git a/vp10/common/reconinter.h b/vp10/common/reconinter.h index 0575dd260..d868b2569 100644 --- a/vp10/common/reconinter.h +++ b/vp10/common/reconinter.h @@ -14,7 +14,6 @@ #include "vp10/common/filter.h" #include "vp10/common/onyxc_int.h" #include "vpx/vpx_integer.h" -#include "vpx_dsp/vpx_filter.h" #ifdef __cplusplus extern "C" { @@ -26,8 +25,9 @@ static INLINE 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 InterpKernel *kernel, + const INTERP_FILTER interp_filter, int xs, int ys) { + const InterpKernel *kernel = vp10_filter_kernels[interp_filter]; #if CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS if (kernel[0][SUBPEL_TAPS / 2 - 1] == 128) { // Interpolating filter @@ -53,8 +53,9 @@ static INLINE void high_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 InterpKernel *kernel, + const INTERP_FILTER interp_filter, int xs, int ys, int bd) { + const InterpKernel *kernel = vp10_filter_kernels[interp_filter]; #if CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS if (kernel[0][SUBPEL_TAPS / 2 - 1] == 128) { // Interpolating filter @@ -192,7 +193,7 @@ void vp10_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 InterpKernel *kernel, + const INTERP_FILTER interp_filter, enum mv_precision precision, int x, int y); @@ -202,7 +203,7 @@ void vp10_highbd_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 InterpKernel *kernel, + const INTERP_FILTER interp_filter, enum mv_precision precision, int x, int y, int bd); #endif diff --git a/vp10/decoder/decodeframe.c b/vp10/decoder/decodeframe.c index d0c9ffbc2..57e7a7150 100644 --- a/vp10/decoder/decodeframe.c +++ b/vp10/decoder/decodeframe.c @@ -586,7 +586,7 @@ static void extend_and_predict(const uint8_t *buf_ptr1, int pre_buf_stride, int border_offset, uint8_t *const dst, int dst_buf_stride, int subpel_x, int subpel_y, - const InterpKernel *kernel, + const INTERP_FILTER interp_filter, const struct scale_factors *sf, MACROBLOCKD *xd, int w, int h, int ref, int xs, int ys) { @@ -605,10 +605,11 @@ static void extend_and_predict(const uint8_t *buf_ptr1, int pre_buf_stride, if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { high_inter_predictor(buf_ptr, b_w, dst, dst_buf_stride, subpel_x, - subpel_y, sf, w, h, ref, kernel, xs, ys, xd->bd); + subpel_y, sf, w, h, ref, interp_filter, + xs, ys, xd->bd); } else { inter_predictor(buf_ptr, b_w, dst, dst_buf_stride, subpel_x, - subpel_y, sf, w, h, ref, kernel, xs, ys); + subpel_y, sf, w, h, ref, interp_filter, xs, ys); } } @@ -620,7 +621,7 @@ static void extend_and_predict(const uint8_t *buf_ptr1, int pre_buf_stride, int border_offset, uint8_t *const dst, int dst_buf_stride, int subpel_x, int subpel_y, - const InterpKernel *kernel, + const INTERP_FILTER interp_filter, const struct scale_factors *sf, int w, int h, int ref, int xs, int ys) { DECLARE_ALIGNED(16, uint8_t, mc_buf[80 * 2 * 80 * 2]); @@ -631,14 +632,14 @@ static void extend_and_predict(const uint8_t *buf_ptr1, int pre_buf_stride, buf_ptr = mc_buf + border_offset; inter_predictor(buf_ptr, b_w, dst, dst_buf_stride, subpel_x, - subpel_y, sf, w, h, ref, kernel, xs, ys); + subpel_y, sf, w, h, ref, interp_filter, xs, ys); } #endif // CONFIG_VP9_HIGHBITDEPTH static void dec_build_inter_predictors(VP10Decoder *const pbi, MACROBLOCKD *xd, int plane, int bw, int bh, int x, int y, int w, int h, int mi_x, int mi_y, - const InterpKernel *kernel, + const INTERP_FILTER interp_filter, const struct scale_factors *sf, struct buf_2d *pre_buf, struct buf_2d *dst_buf, const MV* mv, @@ -772,7 +773,7 @@ static void dec_build_inter_predictors(VP10Decoder *const pbi, MACROBLOCKD *xd, frame_width, frame_height, border_offset, dst, dst_buf->stride, subpel_x, subpel_y, - kernel, sf, + interp_filter, sf, #if CONFIG_VP9_HIGHBITDEPTH xd, #endif @@ -791,14 +792,15 @@ static void dec_build_inter_predictors(VP10Decoder *const pbi, MACROBLOCKD *xd, #if CONFIG_VP9_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { high_inter_predictor(buf_ptr, buf_stride, dst, dst_buf->stride, subpel_x, - subpel_y, sf, w, h, ref, kernel, xs, ys, xd->bd); + subpel_y, sf, w, h, ref, interp_filter, + xs, ys, xd->bd); } else { inter_predictor(buf_ptr, buf_stride, dst, dst_buf->stride, subpel_x, - subpel_y, sf, w, h, ref, kernel, xs, ys); + subpel_y, sf, w, h, ref, interp_filter, xs, ys); } #else inter_predictor(buf_ptr, buf_stride, dst, dst_buf->stride, subpel_x, - subpel_y, sf, w, h, ref, kernel, xs, ys); + subpel_y, sf, w, h, ref, interp_filter, xs, ys); #endif // CONFIG_VP9_HIGHBITDEPTH } @@ -809,7 +811,7 @@ static void dec_build_inter_predictors_sb(VP10Decoder *const pbi, const int mi_x = mi_col * MI_SIZE; const int mi_y = mi_row * MI_SIZE; const MODE_INFO *mi = xd->mi[0]; - const InterpKernel *kernel = vp10_filter_kernels[mi->mbmi.interp_filter]; + const INTERP_FILTER interp_filter = mi->mbmi.interp_filter; const BLOCK_SIZE sb_type = mi->mbmi.sb_type; const int is_compound = has_second_ref(&mi->mbmi); @@ -844,16 +846,17 @@ static void dec_build_inter_predictors_sb(VP10Decoder *const pbi, for (x = 0; x < num_4x4_w; ++x) { const MV mv = average_split_mvs(pd, mi, ref, y * 2 + x); dec_build_inter_predictors(pbi, xd, plane, n4w_x4, n4h_x4, - 4 * x, 4 * y, pw, ph, mi_x, mi_y, kernel, - sf, pre_buf, dst_buf, &mv, - ref_frame_buf, is_scaled, ref); + 4 * x, 4 * y, pw, ph, mi_x, mi_y, + interp_filter, sf, pre_buf, dst_buf, + &mv, ref_frame_buf, is_scaled, ref); } } } else { const MV mv = mi->mbmi.mv[ref].as_mv; dec_build_inter_predictors(pbi, xd, plane, n4w_x4, n4h_x4, - 0, 0, n4w_x4, n4h_x4, mi_x, mi_y, kernel, - sf, pre_buf, dst_buf, &mv, ref_frame_buf, + 0, 0, n4w_x4, n4h_x4, mi_x, mi_y, + interp_filter, sf, pre_buf, dst_buf, + &mv, ref_frame_buf, is_scaled, ref); } } @@ -870,7 +873,7 @@ static void dec_build_inter_predictors_sb_sub8x8(VP10Decoder *const pbi, const int mi_x = mi_col * MI_SIZE; const int mi_y = mi_row * MI_SIZE; const MODE_INFO *mi = xd->mi[0]; - const InterpKernel *kernel = vp10_filter_kernels[mi->mbmi.interp_filter]; + const INTERP_FILTER interp_filter = mi->mbmi.interp_filter; const int is_compound = has_second_ref(&mi->mbmi); // For sub8x8 uv: @@ -896,9 +899,9 @@ static void dec_build_inter_predictors_sb_sub8x8(VP10Decoder *const pbi, const int is_scaled = vp10_is_scaled(sf); const MV mv = average_split_mvs(pd, mi, ref, block); dec_build_inter_predictors(pbi, xd, plane, n4w_x4, n4h_x4, - 0, 0, n4w_x4, n4h_x4, mi_x, mi_y, kernel, - sf, pre_buf, dst_buf, &mv, ref_frame_buf, - is_scaled, ref); + 0, 0, n4w_x4, n4h_x4, mi_x, mi_y, + interp_filter, sf, pre_buf, dst_buf, + &mv, ref_frame_buf, is_scaled, ref); } } } diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c index 809153927..1a6e6c541 100644 --- a/vp10/encoder/rdopt.c +++ b/vp10/encoder/rdopt.c @@ -3702,7 +3702,7 @@ static void joint_motion_search(VP10_COMP *cpi, MACROBLOCK *x, mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1]}; int_mv ref_mv[2]; int ite, ref; - const InterpKernel *kernel = vp10_filter_kernels[mbmi->interp_filter]; + const INTERP_FILTER interp_filter = mbmi->interp_filter; struct scale_factors sf; // Do joint motion search in compound mode to get more accurate mv. @@ -3784,7 +3784,7 @@ static void joint_motion_search(VP10_COMP *cpi, MACROBLOCK *x, second_pred, pw, &frame_mv[refs[!id]].as_mv, &sf, pw, ph, 0, - kernel, MV_PRECISION_Q3, + interp_filter, MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE, xd->bd); } else { @@ -3794,7 +3794,7 @@ static void joint_motion_search(VP10_COMP *cpi, MACROBLOCK *x, second_pred, pw, &frame_mv[refs[!id]].as_mv, &sf, pw, ph, 0, - kernel, MV_PRECISION_Q3, + interp_filter, MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE); } #else @@ -3803,7 +3803,7 @@ static void joint_motion_search(VP10_COMP *cpi, MACROBLOCK *x, second_pred, pw, &frame_mv[refs[!id]].as_mv, &sf, pw, ph, 0, - kernel, MV_PRECISION_Q3, + interp_filter, MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE); #endif // CONFIG_VP9_HIGHBITDEPTH diff --git a/vp10/encoder/temporal_filter.c b/vp10/encoder/temporal_filter.c index 4dc212225..035b66abf 100644 --- a/vp10/encoder/temporal_filter.c +++ b/vp10/encoder/temporal_filter.c @@ -45,8 +45,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, int x, int y) { const int which_mv = 0; const MV mv = { mv_row, mv_col }; - const InterpKernel *const kernel = - vp10_filter_kernels[xd->mi[0]->mbmi.interp_filter]; + const INTERP_FILTER interp_filter = xd->mi[0]->mbmi.interp_filter; enum mv_precision mv_precision_uv; int uv_stride; @@ -66,7 +65,8 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, scale, 16, 16, which_mv, - kernel, MV_PRECISION_Q3, x, y, xd->bd); + interp_filter, + MV_PRECISION_Q3, x, y, xd->bd); vp10_highbd_build_inter_predictor(u_mb_ptr, uv_stride, &pred[256], uv_block_width, @@ -74,7 +74,8 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, scale, uv_block_width, uv_block_height, which_mv, - kernel, mv_precision_uv, x, y, xd->bd); + interp_filter, + mv_precision_uv, x, y, xd->bd); vp10_highbd_build_inter_predictor(v_mb_ptr, uv_stride, &pred[512], uv_block_width, @@ -82,7 +83,8 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, scale, uv_block_width, uv_block_height, which_mv, - kernel, mv_precision_uv, x, y, xd->bd); + interp_filter, + mv_precision_uv, x, y, xd->bd); return; } #endif // CONFIG_VP9_HIGHBITDEPTH @@ -92,7 +94,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, scale, 16, 16, which_mv, - kernel, MV_PRECISION_Q3, x, y); + interp_filter, MV_PRECISION_Q3, x, y); vp10_build_inter_predictor(u_mb_ptr, uv_stride, &pred[256], uv_block_width, @@ -100,7 +102,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, scale, uv_block_width, uv_block_height, which_mv, - kernel, mv_precision_uv, x, y); + interp_filter, mv_precision_uv, x, y); vp10_build_inter_predictor(v_mb_ptr, uv_stride, &pred[512], uv_block_width, @@ -108,7 +110,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, scale, uv_block_width, uv_block_height, which_mv, - kernel, mv_precision_uv, x, y); + interp_filter, mv_precision_uv, x, y); } void vp10_temporal_filter_init(void) { -- 2.40.0