Commit aadbb025 authored by Angie Chiang's avatar Angie Chiang

Mark SMOOTH2 filter under USE_EXTRA_FILTER flag

Change-Id: Ia9a5d818e8c2ff9b4cc41c6d7950cfe005c20bfc
parent 90dad2e4
......@@ -290,12 +290,14 @@ void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
InterpFilterParams filter_params_y =
av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]);
#if USE_EXTRA_FILTER
if (filter_params_x.interp_filter == MULTITAP_SHARP &&
filter_params_y.interp_filter == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
// This will reduce hardware implementation cost.
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
}
#endif // USE_EXTRA_FILTER
#else
InterpFilterParams filter_params_x =
av1_get_interp_filter_params(*interp_filter);
......@@ -419,12 +421,14 @@ void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
InterpFilterParams filter_params_y =
av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]);
#if USE_EXTRA_FILTER
if (filter_params_x.interp_filter == MULTITAP_SHARP &&
filter_params_y.interp_filter == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
// This will reduce hardware implementation cost.
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
}
#endif
#else
InterpFilterParams filter_params_x =
av1_get_interp_filter_params(*interp_filter);
......@@ -526,7 +530,7 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst,
temp[((MAX_SB_SIZE * 2 + 16) + 16) * MAX_SB_SIZE]);
int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16);
int filter_size;
#if CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (interp_filter[0 + 2 * conv_params->ref] == MULTITAP_SHARP &&
interp_filter[1 + 2 * conv_params->ref] == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
......@@ -559,7 +563,7 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst,
convolve_horiz(temp + (filter_size / 2 - 1), temp_stride, dst, dst_stride,
w, h, filter_params, subpel_x_q4, x_step_q4, conv_params);
} else
#endif // CONFIG_DUAL_FILTER
#endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
{
int intermediate_height;
int temp_stride = MAX_SB_SIZE;
......@@ -840,15 +844,15 @@ void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]);
InterpFilterParams filter_params_y =
av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]);
#endif
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (interp_filter[0 + 2 * ref_idx] == MULTITAP_SHARP &&
interp_filter[1 + 2 * ref_idx] == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
// This will reduce hardware implementation cost.
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
}
#endif
#if CONFIG_DUAL_FILTER
if (filter_params_y.taps < filter_params_x.taps) {
int intermediate_width;
int temp_stride = max_intermediate_size;
......@@ -871,7 +875,7 @@ void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
temp8 + (filter_size / 2 - 1), temp_stride, dst8, dst_stride, w, h,
filter_params, subpel_x_q4, x_step_q4, ref_idx, bd);
} else
#endif // CONFIG_DUAL_FILTER
#endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
{
int intermediate_height;
int temp_stride = MAX_SB_SIZE;
......
......@@ -1769,6 +1769,7 @@ static const aom_prob default_txfm_partition_probs[TXFM_PARTITION_CONTEXTS] = {
static const aom_prob default_skip_probs[SKIP_CONTEXTS] = { 192, 128, 64 };
#if CONFIG_DUAL_FILTER
#if USE_EXTRA_FILTER
static const aom_prob default_switchable_interp_prob
[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS - 1] = {
{ 235, 192, 128 }, { 36, 243, 48 }, { 34, 16, 128 },
......@@ -1779,6 +1780,15 @@ static const aom_prob default_switchable_interp_prob
{ 235, 192, 128 }, { 36, 243, 48 }, { 34, 16, 128 },
{ 34, 16, 128 }, { 149, 160, 128 },
};
#else // USE_EXTRA_FILTER
static const aom_prob default_switchable_interp_prob
[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS - 1] = {
{ 235, 162 }, { 36, 255 }, { 34, 3 }, { 149, 144 },
{ 235, 162 }, { 36, 255 }, { 34, 3 }, { 149, 144 },
{ 235, 162 }, { 36, 255 }, { 34, 3 }, { 149, 144 },
{ 235, 162 }, { 36, 255 }, { 34, 3 }, { 149, 144 },
};
#endif // USE_EXTRA_FILTER
#else // CONFIG_DUAL_FILTER
static const aom_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS - 1] = {
......@@ -2230,6 +2240,7 @@ static const aom_prob default_segment_pred_probs[PREDICTION_PROBS] = {
// clang-format on
#if CONFIG_DUAL_FILTER
#if USE_EXTRA_FILTER
static const aom_cdf_prob
default_switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS][CDF_SIZE(
SWITCHABLE_FILTERS)] = {
......@@ -2254,7 +2265,29 @@ static const aom_cdf_prob
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(27632), AOM_ICDF(32768), 0 }
};
#else
#else // USE_EXTRA_FILTER
static const aom_cdf_prob
default_switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS][CDF_SIZE(
SWITCHABLE_FILTERS)] = {
{ AOM_ICDF(30080), AOM_ICDF(31781), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(32658), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(26776), AOM_ICDF(32768), 0 },
{ AOM_ICDF(30080), AOM_ICDF(31781), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(32658), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(26776), AOM_ICDF(32768), 0 },
{ AOM_ICDF(30080), AOM_ICDF(31781), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(32658), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(26776), AOM_ICDF(32768), 0 },
{ AOM_ICDF(30080), AOM_ICDF(31781), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(32658), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(26776), AOM_ICDF(32768), 0 },
};
#endif // USE_EXTRA_FILTER
#else // CONFIG_DUAL_FILTER
static const aom_cdf_prob
default_switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS][CDF_SIZE(
SWITCHABLE_FILTERS)] = {
......@@ -2263,7 +2296,7 @@ static const aom_cdf_prob
{ AOM_ICDF(4352), AOM_ICDF(4685), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(26776), AOM_ICDF(32768), 0 },
};
#endif
#endif // CONFIG_DUAL_FILTER
static const aom_cdf_prob default_seg_tree_cdf[CDF_SIZE(MAX_SEGMENTS)] = {
AOM_ICDF(4096), AOM_ICDF(8192), AOM_ICDF(12288),
......@@ -4641,7 +4674,7 @@ void av1_set_mode_cdfs(struct AV1Common *cm) {
}
#endif // !CONFIG_EC_ADAPT
#if CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
{
-EIGHTTAP_REGULAR, 2, 4, -MULTITAP_SHARP, -EIGHTTAP_SMOOTH,
......
......@@ -48,7 +48,7 @@ DECLARE_ALIGNED(16, static const int16_t,
};
#endif // USE_TEMPORALFILTER_12TAP
#if CONFIG_DUAL_FILTER
#if USE_EXTRA_FILTER
DECLARE_ALIGNED(256, static const InterpKernel,
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
#if CONFIG_FILTER_7BIT
......@@ -229,7 +229,7 @@ DECLARE_ALIGNED(256, static const InterpKernel,
{ 0, 1, -8, 31, 100, 8, -4, 0 }, { 0, 1, -7, 24, 102, 13, -5, 0 },
#endif
};
#else // CONFIG_DUAL_FILTER
#else // USE_EXTRA_FILTER
DECLARE_ALIGNED(256, static const InterpKernel,
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
......@@ -299,7 +299,7 @@ DECLARE_ALIGNED(256, static const InterpKernel,
{ 0, -3, 2, 41, 63, 29, -2, -2 }, { 0, -3, 1, 38, 64, 32, -1, -3 }
#endif
};
#endif // CONFIG_DUAL_FILTER
#endif // USE_EXTRA_FILTER
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
......@@ -312,7 +312,7 @@ const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS] = {
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_DUAL_FILTER
#if USE_EXTRA_FILTER
static const InterpFilterParams
av1_interp_filter_params_list[SWITCHABLE_FILTERS + EXTRA_FILTERS] = {
{ (const int16_t *)sub_pel_filters_8, SUBPEL_TAPS, SUBPEL_SHIFTS,
......@@ -353,7 +353,7 @@ static const InterpFilterParams
{ (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
BILINEAR }
};
#endif // CONFIG_DUAL_FILTER
#endif // USE_EXTRA_FILTER
#if USE_TEMPORALFILTER_12TAP
static const InterpFilterParams av1_interp_temporalfilter_12tap = {
......@@ -384,11 +384,17 @@ const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter) {
InterpFilter av1_get_plane_interp_filter(InterpFilter interp_filter,
int plane) {
#if USE_TEMPORALFILTER_12TAP
#if USE_EXTRA_FILTER
assert(interp_filter <= EIGHTTAP_SHARP ||
interp_filter == TEMPORALFILTER_12TAP);
#else // USE_EXTRA_FILTER
assert(interp_filter <= SWITCHABLE_FILTERS ||
interp_filter == TEMPORALFILTER_12TAP);
#endif // USE_EXTRA_FILTER
#else
assert(interp_filter <= EIGHTTAP_SHARP);
#endif
#if USE_EXTRA_FILTER
if (plane == 0) {
return interp_filter;
} else {
......@@ -400,5 +406,9 @@ InterpFilter av1_get_plane_interp_filter(InterpFilter interp_filter,
default: return interp_filter;
}
}
#else // USE_EXTRA_FILTER
(void)plane;
return interp_filter;
#endif // USE_EXTRA_FILTER
}
#endif
......@@ -25,22 +25,23 @@ extern "C" {
#define MAX_FILTER_TAP 12
#define USE_12TAP_FILTER 0
#define USE_EXTRA_FILTER 0
typedef enum {
EIGHTTAP_REGULAR,
EIGHTTAP_SMOOTH,
MULTITAP_SHARP,
#if CONFIG_DUAL_FILTER
#if USE_EXTRA_FILTER
EIGHTTAP_SMOOTH2,
#endif // CONFIG_DUAL_FILTER
#endif // USE_EXTRA_FILTER
BILINEAR,
#if CONFIG_DUAL_FILTER
#if USE_EXTRA_FILTER
EIGHTTAP_SHARP,
FILTER_REGULAR_UV,
FILTER_SMOOTH_UV,
FILTER_SHARP_UV,
FILTER_SMOOTH2_UV,
#endif // CONFIG_DUAL_FILTER
#endif // USE_EXTRA_FILTER
INTERP_FILTERS_ALL,
SWITCHABLE_FILTERS = BILINEAR,
SWITCHABLE = SWITCHABLE_FILTERS + 1, /* the last switchable one */
......
......@@ -19,13 +19,13 @@
#define WIDTH_BOUND (16)
#define HEIGHT_BOUND (16)
#if CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
DECLARE_ALIGNED(16, static int8_t,
sub_pel_filters_12sharp_signal_dir[15][2][16]);
DECLARE_ALIGNED(16, static int8_t,
sub_pel_filters_12sharp_ver_signal_dir[15][6][16]);
#endif // CONFIG_DUAL_FILTER
#endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
#if USE_TEMPORALFILTER_12TAP
DECLARE_ALIGNED(16, static int8_t,
......@@ -39,7 +39,7 @@ typedef int8_t (*SubpelFilterCoeffs)[16];
static INLINE SubpelFilterCoeffs
get_subpel_filter_signal_dir(const InterpFilterParams p, int index) {
#if CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (p.interp_filter == MULTITAP_SHARP) {
return &sub_pel_filters_12sharp_signal_dir[index][0];
}
......@@ -56,7 +56,7 @@ get_subpel_filter_signal_dir(const InterpFilterParams p, int index) {
static INLINE SubpelFilterCoeffs
get_subpel_filter_ver_signal_dir(const InterpFilterParams p, int index) {
#if CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (p.interp_filter == MULTITAP_SHARP) {
return &sub_pel_filters_12sharp_ver_signal_dir[index][0];
}
......@@ -143,6 +143,7 @@ static void horiz_w4_ssse3(const uint8_t *src, const __m128i *f, int tapsNum,
const __m128i k_256 = _mm_set1_epi16(1 << 8);
const __m128i zero = _mm_setzero_si128();
assert(tapsNum == 10 || tapsNum == 12);
if (10 == tapsNum) {
src -= 1;
}
......@@ -470,6 +471,7 @@ static void filter_horiz_v8p_ssse3(const uint8_t *src_ptr, ptrdiff_t src_pitch,
__m128i min_x2x3, max_x2x3;
__m128i temp;
assert(tapsNum == 10 || tapsNum == 12);
if (tapsNum == 10) {
src_ptr -= 1;
}
......@@ -612,6 +614,7 @@ static void filter_horiz_v4p_ssse3(const uint8_t *src_ptr, ptrdiff_t src_pitch,
__m128i x0, x1, x2, x3, x4, x5;
__m128i min_x2x3, max_x2x3, temp;
assert(tapsNum == 10 || tapsNum == 12);
if (tapsNum == 10) {
src_ptr -= 1;
}
......@@ -982,7 +985,7 @@ typedef struct SimdFilter {
int8_t (*simd_vert_filter)[6][16];
} SimdFilter;
#if CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
#define MULTITAP_FILTER_NUM 1
SimdFilter simd_filters[MULTITAP_FILTER_NUM] = {
{ MULTITAP_SHARP, &sub_pel_filters_12sharp_signal_dir[0],
......@@ -1010,7 +1013,7 @@ void av1_lowbd_convolve_init_ssse3(void) {
temporal_simd_filter.simd_vert_filter);
}
#endif
#if CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
{
int i;
for (i = 0; i < MULTITAP_FILTER_NUM; ++i) {
......
......@@ -15,7 +15,7 @@
#include "./av1_rtcd.h"
#include "av1/common/filter.h"
#if CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
DECLARE_ALIGNED(16, static int16_t, subpel_filters_sharp[15][6][8]);
#endif
......@@ -31,7 +31,7 @@ typedef void (*TransposeSave)(int width, int pixelsNum, uint32_t *src,
static INLINE HbdSubpelFilterCoeffs
hbd_get_subpel_filter_ver_signal_dir(const InterpFilterParams p, int index) {
#if CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (p.interp_filter == MULTITAP_SHARP) {
return &subpel_filters_sharp[index][0];
}
......@@ -76,7 +76,7 @@ void av1_highbd_convolve_init_sse4_1(void) {
init_simd_filter(filter_ptr, taps, subpel_temporalfilter);
}
#endif
#if CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
{
InterpFilterParams filter_params =
av1_get_interp_filter_params(MULTITAP_SHARP);
......@@ -246,6 +246,7 @@ static void highbd_filter_horiz(const uint16_t *src, int src_stride, __m128i *f,
int tapsNum, uint32_t *buf) {
__m128i u[8], v[6];
assert(tapsNum == 10 || tapsNum == 12);
if (tapsNum == 10) {
src -= 1;
}
......@@ -412,6 +413,7 @@ static void filter_vert_horiz_parallel(const uint16_t *src, int src_stride,
int r = 0;
// TODO(luoyi) treat s[12] as a circular buffer in width = 2 case
assert(taps == 10 || taps == 12);
if (10 == taps) {
i += 1;
s[0] = zero;
......
......@@ -66,11 +66,18 @@
#endif // CONFIG_PVQ || CONFIG_DAALA_DIST
#if CONFIG_DUAL_FILTER
#define DUAL_FILTER_SET_SIZE (SWITCHABLE_FILTERS * SWITCHABLE_FILTERS)
#if USE_EXTRA_FILTER
static const int filter_sets[DUAL_FILTER_SET_SIZE][2] = {
{ 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 0 }, { 1, 1 },
{ 1, 2 }, { 1, 3 }, { 2, 0 }, { 2, 1 }, { 2, 2 }, { 2, 3 },
{ 3, 0 }, { 3, 1 }, { 3, 2 }, { 3, 3 },
};
#else // USE_EXTRA_FILTER
static const int filter_sets[DUAL_FILTER_SET_SIZE][2] = {
{ 0, 0 }, { 0, 1 }, { 0, 2 }, { 1, 0 }, { 1, 1 },
{ 1, 2 }, { 2, 0 }, { 2, 1 }, { 2, 2 },
};
#endif // USE_EXTRA_FILTER
#endif // CONFIG_DUAL_FILTER
#if CONFIG_EXT_REFS
......
......@@ -218,7 +218,7 @@ const BlockDimension kBlockDim[] = {
};
// 10/12-tap filters
const InterpFilter kFilter[] = { FILTER_REGULAR_UV, BILINEAR, MULTITAP_SHARP };
const InterpFilter kFilter[] = { EIGHTTAP_REGULAR, BILINEAR, MULTITAP_SHARP };
const int kSubpelQ4[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment