Commit 1733f6b7 authored by Angie Chiang's avatar Angie Chiang

Merge ext_interp and dual_filter

Change-Id: I0ebd6951d2b42869ae872b33f63a07db03e99c62
parent 4be1a4d4
......@@ -49,12 +49,6 @@ typedef enum {
FRAME_TYPES,
} FRAME_TYPE;
#if CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
#define IsInterpolatingFilter(filter) (av1_is_interpolating_filter(filter))
#else
#define IsInterpolatingFilter(filter) (1)
#endif // CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
static INLINE int is_inter_mode(PREDICTION_MODE mode) {
#if CONFIG_EXT_INTER
return mode >= NEARESTMV && mode <= NEW_NEWMV;
......
......@@ -1304,11 +1304,10 @@ 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_EXT_INTERP
#if CONFIG_DUAL_FILTER
static const aom_prob
default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS - 1] = {
#if CONFIG_DUAL_FILTER
{ 235, 192, 128 }, { 36, 243, 48 },
{ 34, 16, 128 }, { 34, 16, 128 },
{ 149, 160, 128 }, { 235, 192, 128 },
......@@ -1319,30 +1318,8 @@ static const aom_prob
{ 149, 160, 128 }, { 235, 192, 128 },
{ 36, 243, 48 }, { 34, 16, 128 },
{ 34, 16, 128 }, { 149, 160, 128 },
#else
{ 235, 192, 128 }, { 36, 243, 48 },
{ 34, 16, 128 }, { 34, 16, 128 },
{ 149, 160, 128 },
#endif
};
#else // CONFIG_EXT_INTERP
#if CONFIG_DUAL_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 }, { 10, 3 },
{ 235, 162 }, { 36, 255 },
{ 34, 3 }, { 149, 144 },
{ 235, 162 }, { 36, 255 },
{ 34, 3 }, { 10, 3 },
};
#else
#else // CONFIG_DUAL_FILTER
static const aom_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS - 1] = {
{ 235, 162 },
......@@ -1350,8 +1327,7 @@ static const aom_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
{ 34, 3 },
{ 149, 144 },
};
#endif
#endif // CONFIG_EXT_INTERP
#endif // CONFIG_DUAL_FILTER
#if CONFIG_EXT_TX
/* clang-format off */
......@@ -1847,7 +1823,7 @@ void av1_set_mode_cdfs(struct AV1Common *cm) {
}
#endif
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
{
-EIGHTTAP_REGULAR, 2, 4, -MULTITAP_SHARP, -EIGHTTAP_SMOOTH,
......@@ -1856,7 +1832,7 @@ const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
#else
const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
{ -EIGHTTAP_REGULAR, 2, -EIGHTTAP_SMOOTH, -MULTITAP_SHARP };
#endif // CONFIG_EXT_INTERP
#endif // CONFIG_DUAL_FILTER
void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
int i, j;
......
......@@ -48,7 +48,7 @@ DECLARE_ALIGNED(16, static const int16_t,
};
#endif // USE_TEMPORALFILTER_12TAP
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
DECLARE_ALIGNED(256, static const InterpKernel,
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
// intfilt 0.575
......@@ -121,7 +121,7 @@ DECLARE_ALIGNED(256, static const InterpKernel,
{ 0, 1, -12, 49, 90, 5, -7, 2 }, { 1, 1, -12, 43, 92, 9, -8, 2 },
{ 0, 2, -12, 37, 94, 14, -9, 2 }, { 0, 2, -11, 31, 95, 19, -10, 2 },
};
#else // CONFIG_EXT_INTERP
#else // CONFIG_DUAL_FILTER
DECLARE_ALIGNED(256, static const InterpKernel,
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
......@@ -191,7 +191,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_EXT_INTERP
#endif // CONFIG_DUAL_FILTER
#if CONFIG_EXT_INTRA
#if CONFIG_INTRA_INTERP
......@@ -204,7 +204,7 @@ const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS] = {
#endif // CONFIG_INTRA_INTERP
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
static const InterpFilterParams
av1_interp_filter_params_list[SWITCHABLE_FILTERS + EXTRA_FILTERS] = {
{ (const int16_t *)sub_pel_filters_8, SUBPEL_TAPS, SUBPEL_SHIFTS,
......@@ -217,10 +217,8 @@ static const InterpFilterParams
EIGHTTAP_SMOOTH2 },
{ (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
BILINEAR },
#if CONFIG_DUAL_FILTER
{ (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
EIGHTTAP_SHARP },
#endif
};
#else
static const InterpFilterParams
......@@ -234,7 +232,7 @@ static const InterpFilterParams
{ (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
BILINEAR }
};
#endif // CONFIG_EXT_INTERP
#endif // CONFIG_DUAL_FILTER
#if USE_TEMPORALFILTER_12TAP
static const InterpFilterParams av1_interp_temporalfilter_12tap = {
......
......@@ -25,41 +25,38 @@ extern "C" {
#define EIGHTTAP_SMOOTH 1
#define MULTITAP_SHARP 2
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
#define EIGHTTAP_SMOOTH2 3
#define MAX_SUBPEL_TAPS 12
#define SUPPORT_NONINTERPOLATING_FILTERS 0 /* turn on for experimentation */
#define SWITCHABLE_FILTERS 4 /* Number of switchable filters */
#define SWITCHABLE_FILTERS 4 /* Number of switchable filters */
#define LOG_SWITCHABLE_FILTERS \
3 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
#else
#define EIGHTTAP_SHARP (SWITCHABLE_FILTERS + 1)
#define EXTRA_FILTERS 2
#define SWITCHABLE_FILTER_CONTEXTS ((SWITCHABLE_FILTERS + 1) * 4)
#define INTER_FILTER_COMP_OFFSET (SWITCHABLE_FILTERS + 1)
#define INTER_FILTER_DIR_OFFSET ((SWITCHABLE_FILTERS + 1) * 2)
#else // CONFIG_DUAL_FILTER
#define SWITCHABLE_FILTERS 3 /* Number of switchable filters */
#define LOG_SWITCHABLE_FILTERS \
2 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
#endif // CONFIG_EXT_INTERP
2 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
#define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
#define EXTRA_FILTERS 1
#endif // CONFIG_DUAL_FILTER
#define USE_TEMPORALFILTER_12TAP 1
#if USE_TEMPORALFILTER_12TAP
#define TEMPORALFILTER_12TAP (SWITCHABLE_FILTERS + 2)
#endif
// The codec can operate in four possible inter prediction filter mode:
// 8-tap, 8-tap-smooth, 8-tap-sharp, and switching between the three.
#define BILINEAR (SWITCHABLE_FILTERS)
#define SWITCHABLE (SWITCHABLE_FILTERS + 1) /* the last one */
#if CONFIG_DUAL_FILTER
#define EIGHTTAP_SHARP (SWITCHABLE_FILTERS + 1)
#define EXTRA_FILTERS 2
#define SWITCHABLE_FILTER_CONTEXTS ((SWITCHABLE_FILTERS + 1) * 4)
#define INTER_FILTER_COMP_OFFSET (SWITCHABLE_FILTERS + 1)
#define INTER_FILTER_DIR_OFFSET ((SWITCHABLE_FILTERS + 1) * 2)
#else
#define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
#define EXTRA_FILTERS 1
#endif
typedef uint8_t InterpFilter;
......
......@@ -56,19 +56,8 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride,
const int16_t *kernel_y =
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_y);
#endif
#if CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
if (IsInterpolatingFilter(interp_filter)) {
// Interpolating filter
sf->predict[subpel_x != 0][subpel_y != 0][ref](
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h);
} else {
sf->predict_ni[subpel_x != 0][subpel_y != 0][ref](
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h);
}
#else
sf->predict[subpel_x != 0][subpel_y != 0][ref_idx](
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h);
#endif // CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
} else {
// ref_idx > 0 means this is the second reference frame
// first reference frame's prediction result is already in dst
......@@ -115,21 +104,8 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
const int16_t *kernel_y =
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_y);
#endif // CONFIG_DUAL_FILTER
#if CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
if (IsInterpolatingFilter(interp_filter)) {
// Interpolating filter
sf->highbd_predict[subpel_x != 0][subpel_y != 0][ref](
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h,
bd);
} else {
sf->highbd_predict_ni[subpel_x != 0][subpel_y != 0][ref](
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h,
bd);
}
#else
sf->highbd_predict[subpel_x != 0][subpel_y != 0][ref](
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h, bd);
#endif // CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
} else {
// ref > 0 means this is the second reference frame
// first reference frame's prediction result is already in dst
......
......@@ -70,22 +70,12 @@ void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
sf->scale_value_y = unscaled_value;
}
// TODO(agrange): Investigate the best choice of functions to use here
// for EIGHTTAP_SMOOTH. Since it is not interpolating, need to choose what
// to do at full-pel offsets. The current selection, where the filter is
// applied in one direction only, and not at all for 0,0, seems to give the
// best quality, but it may be worth trying an additional mode that does
// do the filtering on full-pel.
#if CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
sf->predict_ni[0][0][0] = aom_convolve8_c;
sf->predict_ni[0][0][1] = aom_convolve8_avg_c;
sf->predict_ni[0][1][0] = aom_convolve8_c;
sf->predict_ni[0][1][1] = aom_convolve8_avg_c;
sf->predict_ni[1][0][0] = aom_convolve8_c;
sf->predict_ni[1][0][1] = aom_convolve8_avg_c;
sf->predict_ni[1][1][0] = aom_convolve8;
sf->predict_ni[1][1][1] = aom_convolve8_avg;
#endif // CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
// TODO(agrange): Investigate the best choice of functions to use here
// for EIGHTTAP_SMOOTH. Since it is not interpolating, need to choose what
// to do at full-pel offsets. The current selection, where the filter is
// applied in one direction only, and not at all for 0,0, seems to give the
// best quality, but it may be worth trying an additional mode that does
// do the filtering on full-pel.
if (sf->x_step_q4 == 16) {
if (sf->y_step_q4 == 16) {
// No scaling in either direction.
......@@ -129,16 +119,6 @@ void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
#if CONFIG_AOM_HIGHBITDEPTH
if (use_highbd) {
#if CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
sf->highbd_predict_ni[0][0][0] = aom_highbd_convolve8_c;
sf->highbd_predict_ni[0][0][1] = aom_highbd_convolve8_avg_c;
sf->highbd_predict_ni[0][1][0] = aom_highbd_convolve8_c;
sf->highbd_predict_ni[0][1][1] = aom_highbd_convolve8_avg_c;
sf->highbd_predict_ni[1][0][0] = aom_highbd_convolve8_c;
sf->highbd_predict_ni[1][0][1] = aom_highbd_convolve8_avg_c;
sf->highbd_predict_ni[1][1][0] = aom_highbd_convolve8;
sf->highbd_predict_ni[1][1][1] = aom_highbd_convolve8_avg;
#endif // CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
if (sf->x_step_q4 == 16) {
if (sf->y_step_q4 == 16) {
// No scaling in either direction.
......
......@@ -36,14 +36,6 @@ struct scale_factors {
#if CONFIG_AOM_HIGHBITDEPTH
highbd_convolve_fn_t highbd_predict[2][2][2]; // horiz, vert, avg
#endif // CONFIG_AOM_HIGHBITDEPTH
// Functions for non-interpolating filters (those that filter zero offsets)
#if CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
convolve_fn_t predict_ni[2][2][2]; // horiz, vert, avg
#if CONFIG_AOM_HIGHBITDEPTH
highbd_convolve_fn_t highbd_predict_ni[2][2][2]; // horiz, vert, avg
#endif // CONFIG_AOM_HIGHBITDEPTH
#endif // CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
};
MV32 av1_scale_mv(const MV *mv, int x, int y, const struct scale_factors *sf);
......
......@@ -19,13 +19,13 @@
#define WIDTH_BOUND (16)
#define HEIGHT_BOUND (16)
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_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_EXT_INTERP
#endif // CONFIG_DUAL_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_EXT_INTERP
#if CONFIG_DUAL_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_EXT_INTERP
#if CONFIG_DUAL_FILTER
if (p.interp_filter == MULTITAP_SHARP) {
return &sub_pel_filters_12sharp_ver_signal_dir[index][0];
}
......@@ -980,7 +980,7 @@ typedef struct SimdFilter {
int8_t (*simd_vert_filter)[6][16];
} SimdFilter;
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
#define MULTITAP_FILTER_NUM 1
SimdFilter simd_filters[MULTITAP_FILTER_NUM] = {
{ MULTITAP_SHARP, &sub_pel_filters_12sharp_signal_dir[0],
......@@ -1008,7 +1008,7 @@ void av1_convolve_init_ssse3(void) {
temporal_simd_filter.simd_vert_filter);
}
#endif
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
{
int i;
for (i = 0; i < MULTITAP_FILTER_NUM; ++i) {
......
......@@ -15,7 +15,7 @@
#include "./aom_config.h"
#if CONFIG_AOM_HIGHBITDEPTH
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
DECLARE_ALIGNED(16, static const int16_t,
sub_pel_filters_12sharp_highbd_ver_signal_dir[15][6][8]) = {
{
......
......@@ -24,7 +24,7 @@ typedef void (*TransposeSave)(const int width, int pixelsNum, uint32_t *src,
static INLINE HbdSubpelFilterCoeffs
hbd_get_subpel_filter_ver_signal_dir(const InterpFilterParams p, int index) {
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
if (p.interp_filter == MULTITAP_SHARP) {
return &sub_pel_filters_12sharp_highbd_ver_signal_dir[index][0];
}
......
......@@ -1110,12 +1110,6 @@ static INLINE void read_mb_interp_filter(AV1_COMMON *const cm,
mbmi->interp_filter[3] = mbmi->interp_filter[1];
}
#else // CONFIG_DUAL_FILTER
#if CONFIG_EXT_INTERP
if (!av1_is_interp_needed(xd)) {
mbmi->interp_filter = EIGHTTAP_REGULAR;
return;
}
#endif // CONFIG_EXT_INTERP
if (cm->interp_filter != SWITCHABLE) {
mbmi->interp_filter = cm->interp_filter;
} else {
......@@ -1661,9 +1655,9 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
}
#endif
#if !CONFIG_EXT_INTERP && !CONFIG_DUAL_FILTER && !CONFIG_WARPED_MOTION
#if !CONFIG_DUAL_FILTER && !CONFIG_WARPED_MOTION
read_mb_interp_filter(cm, xd, mbmi, r);
#endif // !CONFIG_EXT_INTERP && !CONFIG_DUAL_FILTER && !CONFIG_WARPED_MOTION
#endif // !CONFIG_DUAL_FILTER && !CONFIG_WARPED_MOTION
if (bsize < BLOCK_8X8 && !unify_bsize) {
const int num_4x4_w = 1 << xd->bmode_blocks_wl;
......@@ -1903,9 +1897,9 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
#if CONFIG_WARPED_MOTION
if (mbmi->motion_mode != WARPED_CAUSAL) {
#endif // CONFIG_WARPED_MOTION
#if CONFIG_DUAL_FILTER || CONFIG_EXT_INTERP || CONFIG_WARPED_MOTION
#if CONFIG_DUAL_FILTER || CONFIG_WARPED_MOTION
read_mb_interp_filter(cm, xd, mbmi, r);
#endif // CONFIG_DUAL_FILTER || CONFIG_EXT_INTERP || CONFIG_WARPED_MOTION
#endif // CONFIG_DUAL_FILTER || CONFIG_WARPED_MOTION
#if CONFIG_WARPED_MOTION
} else {
#if CONFIG_DUAL_FILTER
......
......@@ -181,7 +181,7 @@ void av1_encode_token_init(void) {
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_EC_MULTISYMBOL
/* This hack is necessary when CONFIG_EXT_INTERP is enabled because the five
/* This hack is necessary when CONFIG_DUAL_FILTER is enabled because the five
SWITCHABLE_FILTERS are not consecutive, e.g., 0, 1, 2, 3, 4, when doing
an in-order traversal of the av1_switchable_interp_tree structure. */
av1_indices_from_tree(av1_switchable_interp_ind, av1_switchable_interp_inv,
......@@ -1076,24 +1076,12 @@ static void write_mb_interp_filter(AV1_COMP *cpi, const MACROBLOCKD *xd,
int dir;
#endif
if (cm->interp_filter == SWITCHABLE) {
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
if (!av1_is_interp_needed(xd)) {
assert(mbmi->interp_filter[0] == EIGHTTAP_REGULAR);
return;
}
#else
if (!av1_is_interp_needed(xd)) {
#if CONFIG_DUAL_FILTER
assert(mbmi->interp_filter[0] == EIGHTTAP_REGULAR);
assert(mbmi->interp_filter[1] == EIGHTTAP_REGULAR);
#else
assert(mbmi->interp_filter == EIGHTTAP_REGULAR);
#endif
return;
}
#endif // CONFIG_DUAL_FILTER
#endif // CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
for (dir = 0; dir < 2; ++dir) {
if (has_subpel_mv_component(xd->mi[0], xd, dir) ||
......@@ -1428,9 +1416,9 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
}
}
#if !CONFIG_EXT_INTERP && !CONFIG_DUAL_FILTER && !CONFIG_WARPED_MOTION
#if !CONFIG_DUAL_FILTER && !CONFIG_WARPED_MOTION
write_mb_interp_filter(cpi, xd, w);
#endif // !CONFIG_EXT_INTERP && !CONFIG_DUAL_FILTER && !CONFIG_WARPED_MOTION
#endif // !CONFIG_DUAL_FILTER && !CONFIG_WARPED_MOTION
if (bsize < BLOCK_8X8 && !unify_bsize) {
const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
......@@ -1647,9 +1635,9 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
#if CONFIG_WARPED_MOTION
if (mbmi->motion_mode != WARPED_CAUSAL)
#endif // CONFIG_WARPED_MOTION
#if CONFIG_EXT_INTERP || CONFIG_DUAL_FILTER || CONFIG_WARPED_MOTION
#if CONFIG_DUAL_FILTER || CONFIG_WARPED_MOTION
write_mb_interp_filter(cpi, xd, w);
#endif // CONFIG_EXT_INTERP || CONFIG_DUAL_FILTE || CONFIG_WARPED_MOTION
#endif // CONFIG_DUAL_FILTE || CONFIG_WARPED_MOTION
}
write_tx_type(cm, mbmi,
......@@ -1865,12 +1853,12 @@ static void write_modes_b(AV1_COMP *cpi, const TileInfo *const tile,
xd->left_txfm_context =
xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK);
#endif
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
// av1_is_interp_needed needs the ref frame buffers set up to look
// up if they are scaled. av1_is_interp_needed is in turn needed by
// write_switchable_interp_filter, which is called by pack_inter_mode_mvs.
set_ref_ptrs(cm, xd, m->mbmi.ref_frame[0], m->mbmi.ref_frame[1]);
#endif // CONFIG_EXT_INTERP
#endif // CONFIG_DUAL_FILTER
#if 0
// NOTE(zoeliu): For debug
if (cm->current_video_frame == FRAME_TO_CHECK && cm->show_frame == 1) {
......
......@@ -1191,7 +1191,7 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td,
}
#endif // CONFIG_GLOBAL_MOTION
if (cm->interp_filter == SWITCHABLE
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
&& av1_is_interp_needed(xd)
#endif
#if CONFIG_WARPED_MOTION
......@@ -1371,7 +1371,7 @@ static void update_state_supertx(const AV1_COMP *const cpi, ThreadData *td,
#endif // CONFIG_GLOBAL_MOTION
if (cm->interp_filter == SWITCHABLE
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
&& av1_is_interp_needed(xd)
#endif
) {
......
......@@ -849,15 +849,10 @@ int av1_get_switchable_rate(const AV1_COMP *cpi, const MACROBLOCKD *xd) {
int av1_get_switchable_rate(const AV1_COMP *cpi, const MACROBLOCKD *xd) {
const AV1_COMMON *const cm = &cpi->common;
if (cm->interp_filter == SWITCHABLE) {
#if CONFIG_EXT_INTERP
if (av1_is_interp_needed(xd))
#endif
{
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const int ctx = av1_get_pred_context_switchable_interp(xd);
return SWITCHABLE_INTERP_RATE_FACTOR *
cpi->switchable_interp_costs[ctx][mbmi->interp_filter];
}
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const int ctx = av1_get_pred_context_switchable_interp(xd);
return SWITCHABLE_INTERP_RATE_FACTOR *
cpi->switchable_interp_costs[ctx][mbmi->interp_filter];
}
return 0;
}
......
......@@ -57,18 +57,11 @@
#endif
#if CONFIG_DUAL_FILTER
#define DUAL_FILTER_SET_SIZE (SWITCHABLE_FILTERS * SWITCHABLE_FILTERS)
#if CONFIG_EXT_INTERP
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 // CONFIG_EXT_INTERP
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 // CONFIG_EXT_INTERP
#endif // CONFIG_DUAL_FILTER
#if CONFIG_EXT_REFS
......@@ -7441,7 +7434,7 @@ static int64_t handle_inter_mode(
assign_filter =
predict_interp_filter(cpi, x, bsize, mi_row, mi_col, single_filter);
#endif
#if CONFIG_EXT_INTERP || CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER
if (!av1_is_interp_needed(xd)) assign_filter = EIGHTTAP_REGULAR;
#endif
} else {
......@@ -7535,7 +7528,7 @@ static int64_t handle_inter_mode(
mbmi->interp_filter = best_filter;
#endif
} else {
#if !CONFIG_EXT_INTERP && !CONFIG_DUAL_FILTER
#if !CONFIG_DUAL_FILTER
int tmp_rs;
InterpFilter best_filter = mbmi->interp_filter;
rs = av1_get_switchable_rate(cpi, xd);
......@@ -7843,16 +7836,12 @@ static int64_t handle_inter_mode(
av1_cost_bit(cm->fc->interintra_prob[size_group_lookup[bsize]], 0);
}
#if CONFIG_EXT_INTERP
if (!av1_is_interp_needed(xd) && cm->interp_filter == SWITCHABLE) {
#if CONFIG_DUAL_FILTER
if (!av1_is_interp_needed(xd) && cm->interp_filter == SWITCHABLE) {
for (i = 0; i < 4; ++i) mbmi->interp_filter[i] = EIGHTTAP_REGULAR;
#else
mbmi->interp_filter = EIGHTTAP_REGULAR;
#endif
pred_exists = 0;
}
#endif // CONFIG_EXT_INTERP
#endif // CONFIG_DUAL_FILTER
if (pred_exists == 0) {
int tmp_rate;
int64_t tmp_dist;
......@@ -7946,19 +7935,15 @@ static int64_t handle_inter_mode(
#else
tmp_rate2 = rate2_nocoeff - rate_mv + tmp_rate_mv;
#endif // CONFIG_EXT_INTER
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
if (!has_subpel_mv_component(xd->mi[0], xd, 0))
mbmi->interp_filter[0] = EIGHTTAP_REGULAR;
if (!has_subpel_mv_component(xd->mi[0], xd, 1))
mbmi->interp_filter[1] = EIGHTTAP_REGULAR;
#else
if (!av1_is_interp_needed(xd)) mbmi->interp_filter = EIGHTTAP_REGULAR;
#endif // CONFIG_DUAL_FILTER
// This is not quite correct with CONFIG_DUAL_FILTER when a filter
// is needed in only one direction
if (!av1_is_interp_needed(xd)) tmp_rate2 -= rs;
#endif // CONFIG_EXT_INTERP
#endif // CONFIG_DUAL_FILTER
av1_build_inter_predictors_sb(xd, mi_row, mi_col, &orig_dst, bsize);
#if CONFIG_EXT_INTER
} else {
......@@ -10387,9 +10372,9 @@ void av1_rd_pick_inter_mode_sb_seg_skip(const AV1_COMP *cpi,
if (cm->interp_filter != BILINEAR) {
best_filter = EIGHTTAP_REGULAR;
if (cm->interp_filter == SWITCHABLE &&
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
av1_is_interp_needed(xd) &&
#endif // CONFIG_EXT_INTERP
#endif // CONFIG_DUAL_FILTER
x->source_variance >= cpi->sf.disable_filter_search_var_thresh) {
int rs;
int best_rs = INT_MAX;
......@@ -10901,18 +10886,12 @@ void av1_rd_pick_inter_mode_sub8x8(const struct AV1_COMP *cpi,
compound_seg_newmvs,
#endif // CONFIG_EXT_INTER
bsi, switchable_filter_index, mi_row, mi_col);
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
if (!av1_is_interp_needed(xd) && cm->interp_filter == SWITCHABLE &&
(mbmi->interp_filter[0] != EIGHTTAP_REGULAR ||
mbmi->interp_filter[1] != EIGHTTAP_REGULAR)) // invalid config
continue;
#else
if (!av1_is_interp_needed(xd) && cm->interp_filter == SWITCHABLE &&
mbmi->interp_filter != EIGHTTAP_REGULAR) // invalid config
continue;
#endif
#endif // CONFIG_EXT_INTERP
#endif // CONFIG_DUAL_FILTER
if (tmp_rd == INT64_MAX) continue;
rs = av1_get_switchable_rate(cpi, xd);
rs_rd = RDCOST(x->rdmult, x->rddiv, rs, 0);
......@@ -10986,7 +10965,6 @@ void av1_rd_pick_inter_mode_sub8x8(const struct AV1_COMP *cpi,
compound_seg_newmvs,
#endif // CONFIG_EXT_INTER
bsi, 0, mi_row, mi_col);
#if CONFIG_EXT_INTERP
#if CONFIG_DUAL_FILTER
if (!av1_is_interp_needed(xd) && cm->interp_filter == SWITCHABLE &&
(mbmi->interp_filter[0] != EIGHTTAP_REGULAR ||
......@@ -10994,12 +10972,7 @@ void av1_rd_pick_inter_mode_sub8x8(const struct AV1_COMP *cpi,
mbmi->interp_filter[0] = EIGHTTAP_REGULAR;
mbmi->interp_filter[1] = EIGHTTAP_REGULAR;
}
#else
if (!av1_is_interp_needed(xd) && cm->interp_filter == SWITCHABLE &&
mbmi->interp_filter != EIGHTTAP_REGULAR)
mbmi->interp_filter = EIGHTTAP_REGULAR;
#endif // CONFIG_DUAL_FILTER
#endif // CONFIG_EXT_INTERP
if (tmp_rd == INT64_MAX) continue;
} else {
total_sse = tmp_best_sse;
......
......@@ -201,7 +201,7 @@ TEST_P(AV1ConvolveOptimzTest, VerticalBitExactCheck) {
using std::tr1::make_tuple;
#if (HAVE_SSSE3 || HAVE_SSE4_1) && CONFIG_EXT_INTERP
#if (HAVE_SSSE3 || HAVE_SSE4_1) && CONFIG_DUAL_FILTER
const BlockDimension kBlockDim[] = {