From db084506d8098feaec1aee0cb519cc8d207e734f Mon Sep 17 00:00:00 2001 From: Debargha Mukherjee Date: Mon, 29 Feb 2016 10:08:23 -0800 Subject: [PATCH] A build fix and some other cosmetic changes Fixes some issues introduced by a merge of two patches. Also decouples the temporal interpolation filter from the switchable filters for now for ease of experimentation with both separately. Change-Id: If1c7c08adf00e0cf818fe8d0d3656c26ea65eb32 --- vp10/common/filter.c | 48 +++++++++++++++------ vp10/common/filter.h | 7 ++-- vp10/encoder/temporal_filter.c | 77 ++++++++++++++++------------------ 3 files changed, 75 insertions(+), 57 deletions(-) diff --git a/vp10/common/filter.c b/vp10/common/filter.c index 7756729fd..2023cd6b4 100644 --- a/vp10/common/filter.c +++ b/vp10/common/filter.c @@ -32,9 +32,9 @@ DECLARE_ALIGNED(256, static const InterpKernel, { 0, 0, 0, 8, 120, 0, 0, 0 } }; -#if (CONFIG_EXT_INTERP && SWITCHABLE_FILTERS == 5) || FILTER_12TAP +#if USE_TEMPORALFILTER_12TAP DECLARE_ALIGNED(16, static const int16_t, - sub_pel_filters_12sharp[SUBPEL_SHIFTS][12]) = { + sub_pel_filters_temporalfilter_12[SUBPEL_SHIFTS][12]) = { // intfilt 0.8 {0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0}, {0, 1, -1, 3, -7, 127, 8, -4, 2, -1, 0, 0}, @@ -53,7 +53,7 @@ DECLARE_ALIGNED(16, static const int16_t, {0, 1, -2, 4, -8, 18, 124, -12, 5, -3, 1, 0}, {0, 0, -1, 2, -4, 8, 127, -7, 3, -1, 1, 0}, }; -#endif +#endif // USE_TEMPORALFILTER_12TAP #if CONFIG_EXT_INTERP DECLARE_ALIGNED(256, static const InterpKernel, @@ -143,8 +143,26 @@ DECLARE_ALIGNED(256, static const InterpKernel, #endif // SWITCHABLE_FILTERS >= 4 #if SWITCHABLE_FILTERS == 5 -// Once FILTER 12TAP is resolved move the sub_pel_filters_12sharp -// filter here. +DECLARE_ALIGNED(16, static const int16_t, + sub_pel_filters_12sharp[SUBPEL_SHIFTS][12]) = { + // intfilt 0.8 + {0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0}, + {0, 1, -1, 3, -7, 127, 8, -4, 2, -1, 0, 0}, + {0, 1, -3, 5, -12, 124, 18, -8, 4, -2, 1, 0}, + {-1, 2, -4, 8, -17, 120, 28, -11, 6, -3, 1, -1}, + {-1, 2, -4, 10, -21, 114, 38, -15, 8, -4, 2, -1}, + {-1, 3, -5, 11, -23, 107, 49, -18, 9, -5, 2, -1}, + {-1, 3, -6, 12, -25, 99, 60, -21, 11, -6, 3, -1}, + {-1, 3, -6, 12, -25, 90, 70, -23, 12, -6, 3, -1}, + {-1, 3, -6, 12, -24, 80, 80, -24, 12, -6, 3, -1}, + {-1, 3, -6, 12, -23, 70, 90, -25, 12, -6, 3, -1}, + {-1, 3, -6, 11, -21, 60, 99, -25, 12, -6, 3, -1}, + {-1, 2, -5, 9, -18, 49, 107, -23, 11, -5, 3, -1}, + {-1, 2, -4, 8, -15, 38, 114, -21, 10, -4, 2, -1}, + {-1, 1, -3, 6, -11, 28, 120, -17, 8, -4, 2, -1}, + {0, 1, -2, 4, -8, 18, 124, -12, 5, -3, 1, 0}, + {0, 0, -1, 2, -4, 8, 127, -7, 3, -1, 1, 0}, +}; #endif #else // CONFIG_EXT_INTERP @@ -246,23 +264,27 @@ vp10_interp_filter_params_list[SWITCHABLE_FILTERS + 1] = { }; #endif // CONFIG_EXT_INTERP -#if FILTER_12TAP -static const InterpFilterParams vp10_interp_filter_12tap = { - (const int16_t*)sub_pel_filters_12sharp, 12, SUBPEL_SHIFTS +#if USE_TEMPORALFILTER_12TAP +static const InterpFilterParams vp10_interp_temporalfilter_12tap = { + (const int16_t*)sub_pel_filters_temporalfilter_12, 12, SUBPEL_SHIFTS }; -#endif +#endif // USE_TEMPORALFILTER_12TAP InterpFilterParams vp10_get_interp_filter_params( const INTERP_FILTER interp_filter) { -#if FILTER_12TAP - if (interp_filter == SHARP_FILTER_12TAP) - return vp10_interp_filter_12tap; -#endif +#if USE_TEMPORALFILTER_12TAP + if (interp_filter == TEMPORALFILTER_12TAP) + return vp10_interp_temporalfilter_12tap; +#endif // USE_TEMPORALFILTER_12TAP return vp10_interp_filter_params_list[interp_filter]; } const int16_t *vp10_get_interp_filter_kernel( const INTERP_FILTER interp_filter) { +#if USE_TEMPORALFILTER_12TAP + if (interp_filter == TEMPORALFILTER_12TAP) + return vp10_interp_temporalfilter_12tap.filter_ptr; +#endif // USE_TEMPORALFILTER_12TAP return (const int16_t*) vp10_interp_filter_params_list[interp_filter].filter_ptr; } diff --git a/vp10/common/filter.h b/vp10/common/filter.h index 014dddb14..74a0c9968 100644 --- a/vp10/common/filter.h +++ b/vp10/common/filter.h @@ -41,10 +41,9 @@ extern "C" { #define SWITCHABLE_FILTERS 3 /* Number of switchable filters */ #endif // CONFIG_EXT_INTERP -// TODO(jingning): Align the experiment flags and clean this up. -#define FILTER_12TAP (!CONFIG_EXT_INTERP) -#if FILTER_12TAP -#define SHARP_FILTER_12TAP (SWITCHABLE_FILTERS + 1) +#define USE_TEMPORALFILTER_12TAP 1 +#if USE_TEMPORALFILTER_12TAP +#define TEMPORALFILTER_12TAP (SWITCHABLE_FILTERS + 1) #endif // The codec can operate in four possible inter prediction filter mode: diff --git a/vp10/encoder/temporal_filter.c b/vp10/encoder/temporal_filter.c index b4db25128..d16e4a4e2 100644 --- a/vp10/encoder/temporal_filter.c +++ b/vp10/encoder/temporal_filter.c @@ -48,15 +48,12 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, enum mv_precision mv_precision_uv; int uv_stride; -#if FILTER_12TAP - const INTERP_FILTER interp_filter = SHARP_FILTER_12TAP; - (void)xd; -#elif SWITCHABLE_FILTERS == 5 - const INTERP_FILTER interp_filter = EIGHTTAP_SHARP2; +#if USE_TEMPORALFILTER_12TAP + const INTERP_FILTER interp_filter = TEMPORALFILTER_12TAP; (void)xd; #else const INTERP_FILTER interp_filter = xd->mi[0]->mbmi.interp_filter; -#endif +#endif // USE_TEMPORALFILTER_12TAP if (uv_block_width == 8) { uv_stride = (stride + 1) >> 1; @@ -98,28 +95,28 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, } #endif // CONFIG_VP9_HIGHBITDEPTH vp10_build_inter_predictor(y_mb_ptr, stride, - &pred[0], 16, - &mv, - scale, - 16, 16, - which_mv, - interp_filter, MV_PRECISION_Q3, x, y); + &pred[0], 16, + &mv, + scale, + 16, 16, + which_mv, + interp_filter, MV_PRECISION_Q3, x, y); vp10_build_inter_predictor(u_mb_ptr, uv_stride, - &pred[256], uv_block_width, - &mv, - scale, - uv_block_width, uv_block_height, - which_mv, - interp_filter, mv_precision_uv, x, y); + &pred[256], uv_block_width, + &mv, + scale, + uv_block_width, uv_block_height, + which_mv, + interp_filter, mv_precision_uv, x, y); vp10_build_inter_predictor(v_mb_ptr, uv_stride, - &pred[512], uv_block_width, - &mv, - scale, - uv_block_width, uv_block_height, - which_mv, - interp_filter, mv_precision_uv, x, y); + &pred[512], uv_block_width, + &mv, + scale, + uv_block_width, uv_block_height, + which_mv, + interp_filter, mv_precision_uv, x, y); } void vp10_temporal_filter_init(void) { @@ -131,14 +128,14 @@ void vp10_temporal_filter_init(void) { } void vp10_temporal_filter_apply_c(uint8_t *frame1, - unsigned int stride, - uint8_t *frame2, - unsigned int block_width, - unsigned int block_height, - int strength, - int filter_weight, - unsigned int *accumulator, - uint16_t *count) { + unsigned int stride, + uint8_t *frame2, + unsigned int block_width, + unsigned int block_height, + int strength, + int filter_weight, + unsigned int *accumulator, + uint16_t *count) { unsigned int i, j, k; int modifier; int byte = 0; @@ -199,14 +196,14 @@ void vp10_temporal_filter_apply_c(uint8_t *frame1, #if CONFIG_VP9_HIGHBITDEPTH void vp10_highbd_temporal_filter_apply_c(uint8_t *frame1_8, - unsigned int stride, - uint8_t *frame2_8, - unsigned int block_width, - unsigned int block_height, - int strength, - int filter_weight, - unsigned int *accumulator, - uint16_t *count) { + unsigned int stride, + uint8_t *frame2_8, + unsigned int block_width, + unsigned int block_height, + int strength, + int filter_weight, + unsigned int *accumulator, + uint16_t *count) { uint16_t *frame1 = CONVERT_TO_SHORTPTR(frame1_8); uint16_t *frame2 = CONVERT_TO_SHORTPTR(frame2_8); unsigned int i, j, k; -- 2.49.0