Commit 27e90295 authored by Rupert Swarbrick's avatar Rupert Swarbrick

Pack InterpFilters into a single integer

Before this patch, if CONFIG_DUAL_FILTER was true then an MB_MODE_INFO
stored its filter choices as an array of four numbers, each of which
was between 0 and 10. It also seems that elements 2 and 3 of the array
were always the same as elements 0 and 1 when used.

This patch defines a new type(def) called InterpFilters together with
constructor and extractor functions. When CONFIG_DUAL_FILTER is zero,
InterpFilters is a synonym for InterpFilter and the constructor and
extractor functions should compile away to nothing. When it is
nonzero, InterpFilters is a uint32_t which stores the x filter in the
high part and the y filter in the low part (this looks strange, but
matches the old numbering).

Making this change allows us to get rid of lots of special case code
that was dependent on CONFIG_DUAL_FILTER. The uniform
extract/make/broadcast interface also actually shortens code in
general.

Change-Id: I6b24a61bac3e4b220d8d46d0b27cfe865dcfba81
parent 26ad0b22
......@@ -378,12 +378,8 @@ typedef struct MB_MODE_INFO {
uint8_t use_intrabc;
#endif // CONFIG_INTRABC
// Only for INTER blocks
#if CONFIG_DUAL_FILTER
InterpFilter interp_filter[4];
#else
InterpFilter interp_filter;
#endif
// Only for INTER blocks
InterpFilters interp_filters;
MV_REFERENCE_FRAME ref_frame[2];
TX_TYPE tx_type;
#if CONFIG_TXK_SEL
......
This diff is collapsed.
......@@ -47,15 +47,49 @@ static INLINE ConvolveParams get_conv_params(int ref, int do_average,
conv_params.do_post_rounding = 0;
return conv_params;
}
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
static INLINE void av1_convolve_filter_params_fixup_1212(
const InterpFilterParams *params_x, InterpFilterParams *params_y) {
if (params_x->interp_filter == MULTITAP_SHARP &&
params_y->interp_filter == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
// This will reduce hardware implementation cost.
*params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
}
}
#endif
static INLINE void av1_get_convolve_filter_params(
InterpFilters interp_filters, int avoid_1212, InterpFilterParams *params_x,
InterpFilterParams *params_y) {
#if CONFIG_DUAL_FILTER
InterpFilter filter_x = av1_extract_interp_filter(interp_filters, 1);
InterpFilter filter_y = av1_extract_interp_filter(interp_filters, 0);
#else
InterpFilter filter_x = av1_extract_interp_filter(interp_filters, 0);
InterpFilter filter_y = av1_extract_interp_filter(interp_filters, 0);
#endif
*params_x = av1_get_interp_filter_params(filter_x);
*params_y = av1_get_interp_filter_params(filter_y);
if (avoid_1212) {
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
convolve_filter_params_fixup_1212(params_x, params_y);
#endif
}
}
struct AV1Common;
void av1_convolve_init(struct AV1Common *cm);
#if CONFIG_CONVOLVE_ROUND
void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
int dst_stride, int w, int h,
const InterpFilter *interp_filter,
const int subpel_x_q4, int x_step_q4,
const int subpel_y_q4, int y_step_q4, int scaled,
ConvolveParams *conv_params);
InterpFilters interp_filters, const int subpel_x_q4,
int x_step_q4, const int subpel_y_q4, int y_step_q4,
int scaled, ConvolveParams *conv_params);
static INLINE ConvolveParams get_conv_params_no_round(int ref, int do_average,
int plane, int32_t *dst,
......@@ -80,7 +114,7 @@ static INLINE ConvolveParams get_conv_params_no_round(int ref, int do_average,
#if CONFIG_HIGHBITDEPTH
void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
uint8_t *dst, int dst_stride, int w, int h,
const InterpFilter *interp_filter,
InterpFilters interp_filters,
const int subpel_x_q4, int x_step_q4,
const int subpel_y_q4, int y_step_q4,
int scaled, ConvolveParams *conv_params,
......@@ -89,55 +123,33 @@ void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
#endif // CONFIG_CONVOLVE_ROUND
void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
int dst_stride, int w, int h,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif
int dst_stride, int w, int h, InterpFilters interp_filters,
const int subpel_x, int xstep, const int subpel_y, int ystep,
ConvolveParams *conv_params);
void av1_convolve_c(const uint8_t *src, int src_stride, uint8_t *dst,
int dst_stride, int w, int h,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif
int dst_stride, int w, int h, InterpFilters interp_filters,
const int subpel_x, int xstep, const int subpel_y,
int ystep, ConvolveParams *conv_params);
void av1_convolve_scale(const uint8_t *src, int src_stride, uint8_t *dst,
int dst_stride, int w, int h,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif
const int subpel_x, int xstep, const int subpel_y,
int ystep, ConvolveParams *conv_params);
InterpFilters interp_filters, const int subpel_x,
int xstep, const int subpel_y, int ystep,
ConvolveParams *conv_params);
#if CONFIG_HIGHBITDEPTH
void av1_highbd_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
int dst_stride, int w, int h,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif
const int subpel_x, int xstep, const int subpel_y,
int ystep, int avg, int bd);
InterpFilters interp_filters, const int subpel_x,
int xstep, const int subpel_y, int ystep, int avg,
int bd);
void av1_highbd_convolve_scale(const uint8_t *src, int src_stride, uint8_t *dst,
int dst_stride, int w, int h,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif // CONFIG_DUAL_FILTER
const int subpel_x, int xstep,
const int subpel_y, int ystep, int avg, int bd);
InterpFilters interp_filters, const int subpel_x,
int xstep, const int subpel_y, int ystep,
int avg, int bd);
#endif // CONFIG_HIGHBITDEPTH
#ifdef __cplusplus
......
......@@ -12,6 +12,8 @@
#ifndef AV1_COMMON_FILTER_H_
#define AV1_COMMON_FILTER_H_
#include <assert.h>
#include "./aom_config.h"
#include "aom/aom_integer.h"
#include "aom_dsp/aom_filter.h"
......@@ -51,6 +53,46 @@ typedef enum {
#endif
} InterpFilter;
// With CONFIG_DUAL_FILTER, pack two InterpFilter's into a uint32_t: since
// there are at most 10 filters, we can use 16 bits for each and have more than
// enough space. This reduces argument passing and unifies the operation of
// setting a (pair of) filters.
//
// Without CONFIG_DUAL_FILTER,
#if CONFIG_DUAL_FILTER
typedef uint32_t InterpFilters;
static INLINE InterpFilter av1_extract_interp_filter(InterpFilters filters,
int x_filter) {
return (InterpFilter)((filters >> (x_filter ? 16 : 0)) & 0xffff);
}
static INLINE InterpFilters av1_make_interp_filters(InterpFilter y_filter,
InterpFilter x_filter) {
uint16_t y16 = y_filter & 0xffff;
uint16_t x16 = x_filter & 0xffff;
return y16 | ((uint32_t)x16 << 16);
}
static INLINE InterpFilters av1_broadcast_interp_filter(InterpFilter filter) {
return av1_make_interp_filters(filter, filter);
}
#else
typedef InterpFilter InterpFilters;
static INLINE InterpFilter av1_extract_interp_filter(InterpFilters filters,
int x_filter) {
assert(!x_filter);
return filters;
}
static INLINE InterpFilters av1_broadcast_interp_filter(InterpFilter filter) {
return filter;
}
#endif
static INLINE InterpFilter av1_unswitchable_filter(InterpFilter filter) {
return filter == SWITCHABLE ? EIGHTTAP_REGULAR : filter;
}
#if USE_EXTRA_FILTER
#define LOG_SWITCHABLE_FILTERS \
3 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
......
......@@ -22,19 +22,16 @@
static InterpFilter get_ref_filter_type(const MODE_INFO *mi,
const MACROBLOCKD *xd, int dir,
MV_REFERENCE_FRAME ref_frame) {
InterpFilter ref_type = SWITCHABLE_FILTERS;
const MB_MODE_INFO *ref_mbmi = &mi->mbmi;
int use_subpel[2] = {
has_subpel_mv_component(mi, xd, dir),
has_subpel_mv_component(mi, xd, dir + 2),
};
if (ref_mbmi->ref_frame[0] == ref_frame && use_subpel[0])
ref_type = ref_mbmi->interp_filter[(dir & 0x01)];
else if (ref_mbmi->ref_frame[1] == ref_frame && use_subpel[1])
ref_type = ref_mbmi->interp_filter[(dir & 0x01) + 2];
return ref_type;
return (((ref_mbmi->ref_frame[0] == ref_frame && use_subpel[0]) ||
(ref_mbmi->ref_frame[1] == ref_frame && use_subpel[1]))
? av1_extract_interp_filter(ref_mbmi->interp_filters, dir & 0x01)
: SWITCHABLE_FILTERS);
}
int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd, int dir) {
......@@ -79,13 +76,15 @@ int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
// left of the entries corresponding to real macroblocks.
// The prediction flags in these dummy entries are initialized to 0.
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
const int left_type = xd->left_available && is_inter_block(left_mbmi)
? left_mbmi->interp_filter
: SWITCHABLE_FILTERS;
const int left_type =
xd->left_available && is_inter_block(left_mbmi)
? av1_extract_interp_filter(left_mbmi->interp_filters, 0)
: SWITCHABLE_FILTERS;
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
const int above_type = xd->up_available && is_inter_block(above_mbmi)
? above_mbmi->interp_filter
: SWITCHABLE_FILTERS;
const int above_type =
xd->up_available && is_inter_block(above_mbmi)
? av1_extract_interp_filter(above_mbmi->interp_filters, 0)
: SWITCHABLE_FILTERS;
if (left_type == above_type) {
return left_type;
......@@ -110,11 +109,7 @@ static INTRA_FILTER get_ref_intra_filter(const MB_MODE_INFO *ref_mbmi) {
if (ref_mbmi->sb_type >= BLOCK_8X8) {
const PREDICTION_MODE mode = ref_mbmi->mode;
if (is_inter_block(ref_mbmi)) {
#if CONFIG_DUAL_FILTER
switch (ref_mbmi->interp_filter[0]) {
#else
switch (ref_mbmi->interp_filter) {
#endif
switch (av1_extract_interp_filter(ref_mbmi->interp_filters, 0)) {
case EIGHTTAP_REGULAR: ref_type = INTRA_FILTER_8TAP; break;
case EIGHTTAP_SMOOTH: ref_type = INTRA_FILTER_8TAP_SMOOTH; break;
case MULTITAP_SHARP: ref_type = INTRA_FILTER_8TAP_SHARP; break;
......
......@@ -130,12 +130,7 @@ static INLINE int allow_warp(const MODE_INFO *const mi,
static INLINE void av1_make_inter_predictor(
const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
const int subpel_x, const int subpel_y, const struct scale_factors *sf,
int w, int h, ConvolveParams *conv_params,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif
int w, int h, ConvolveParams *conv_params, InterpFilters interp_filters,
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
const WarpTypesAllowed *warp_types, int p_col, int p_row, int plane,
int ref,
......@@ -202,13 +197,13 @@ static INLINE void av1_make_inter_predictor(
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
highbd_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y,
sf, w, h, conv_params, interp_filter, xs, ys,
sf, w, h, conv_params, interp_filters, xs, ys,
xd->bd);
return;
}
#endif // CONFIG_HIGHBITDEPTH
inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, sf, w,
h, conv_params, interp_filter, xs, ys);
h, conv_params, interp_filters, xs, ys);
}
#define NSMOOTHERS 1
......@@ -946,26 +941,19 @@ static void build_masked_compound_highbd(
#endif // CONFIG_HIGHBITDEPTH
#endif // CONFIG_SUPERTX
void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
uint8_t *dst, int dst_stride,
const int subpel_x, const int subpel_y,
const struct scale_factors *sf, int w,
int h, ConvolveParams *conv_params,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif
int xs, int ys,
void av1_make_masked_inter_predictor(
const uint8_t *pre, int pre_stride, uint8_t *dst, int dst_stride,
const int subpel_x, const int subpel_y, const struct scale_factors *sf,
int w, int h, ConvolveParams *conv_params, InterpFilters interp_filters,
int xs, int ys,
#if CONFIG_SUPERTX
int wedge_offset_x, int wedge_offset_y,
int wedge_offset_x, int wedge_offset_y,
#endif // CONFIG_SUPERTX
int plane,
int plane,
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
const WarpTypesAllowed *warp_types,
int p_col, int p_row, int ref,
const WarpTypesAllowed *warp_types, int p_col, int p_row, int ref,
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
MACROBLOCKD *xd) {
MACROBLOCKD *xd) {
const MODE_INFO *mi = xd->mi[0];
const INTERINTER_COMPOUND_DATA comp_data = {
......@@ -1024,7 +1012,7 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
// This will generate a prediction in tmp_buf for the second reference
av1_make_inter_predictor(pre, pre_stride, tmp_dst, MAX_SB_SIZE, subpel_x,
subpel_y, sf, w, h, conv_params, interp_filter,
subpel_y, sf, w, h, conv_params, interp_filters,
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
warp_types, p_col, p_row, plane, ref,
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
......@@ -1103,7 +1091,6 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
#endif // CONFIG_HIGHBITDEPTH
build_masked_compound(dst, dst_stride, dst, dst_stride, tmp_dst,
MAX_SB_SIZE, &comp_data, mi->mbmi.sb_type, h, w);
#if CONFIG_CONVOLVE_ROUND
}
#endif // CONFIG_CONVOLVE_ROUND
......@@ -1121,11 +1108,7 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
void av1_highbd_build_inter_predictor(
const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
const MV *src_mv, const struct scale_factors *sf, int w, int h, int ref,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif
InterpFilters interp_filters,
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
const WarpTypesAllowed *warp_types, int p_col, int p_row,
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
......@@ -1145,7 +1128,7 @@ void av1_highbd_build_inter_predictor(
(mv.col >> SCALE_SUBPEL_BITS);
av1_make_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y,
sf, w, h, &conv_params, interp_filter,
sf, w, h, &conv_params, interp_filters,
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
warp_types, p_col, p_row, plane, ref,
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
......@@ -1160,11 +1143,7 @@ void av1_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst,
int dst_stride, const MV *src_mv,
const struct scale_factors *sf, int w, int h,
ConvolveParams *conv_params,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif
InterpFilters interp_filters,
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
const WarpTypesAllowed *warp_types, int p_col,
int p_row, int plane, int ref,
......@@ -1184,7 +1163,7 @@ void av1_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst,
(mv.col >> SCALE_SUBPEL_BITS);
av1_make_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y,
sf, w, h, conv_params, interp_filter,
sf, w, h, conv_params, interp_filters,
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
warp_types, p_col, p_row, plane, ref,
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
......@@ -1391,7 +1370,7 @@ static INLINE void build_inter_predictors(
if (ref && is_masked_compound_type(mi->mbmi.interinter_compound_type))
av1_make_masked_inter_predictor(
pre, pre_buf->stride, dst, dst_buf->stride, subpel_x, subpel_y,
sf, b4_w, b4_h, &conv_params, mi->mbmi.interp_filter, xs, ys,
sf, b4_w, b4_h, &conv_params, mi->mbmi.interp_filters, xs, ys,
#if CONFIG_SUPERTX
wedge_offset_x, wedge_offset_y,
#endif // CONFIG_SUPERTX
......@@ -1404,7 +1383,7 @@ static INLINE void build_inter_predictors(
else
av1_make_inter_predictor(
pre, pre_buf->stride, dst, dst_buf->stride, subpel_x, subpel_y,
sf, b4_w, b4_h, &conv_params, this_mbmi->interp_filter,
sf, b4_w, b4_h, &conv_params, this_mbmi->interp_filters,
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
&warp_types, (mi_x >> pd->subsampling_x) + x,
(mi_y >> pd->subsampling_y) + y, plane, ref,
......@@ -1585,7 +1564,7 @@ static INLINE void build_inter_predictors(
av1_make_masked_inter_predictor(
pre[ref], pre_buf->stride, dst, dst_buf->stride,
subpel_params[ref].subpel_x, subpel_params[ref].subpel_y, sf, w, h,
&conv_params, mi->mbmi.interp_filter, subpel_params[ref].xs,
&conv_params, mi->mbmi.interp_filters, subpel_params[ref].xs,
subpel_params[ref].ys,
#if CONFIG_SUPERTX
wedge_offset_x, wedge_offset_y,
......@@ -1600,7 +1579,7 @@ static INLINE void build_inter_predictors(
av1_make_inter_predictor(
pre[ref], pre_buf->stride, dst, dst_buf->stride,
subpel_params[ref].subpel_x, subpel_params[ref].subpel_y, sf, w, h,
&conv_params, mi->mbmi.interp_filter,
&conv_params, mi->mbmi.interp_filters,
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
&warp_types, (mi_x >> pd->subsampling_x) + x,
(mi_y >> pd->subsampling_y) + y, plane, ref,
......@@ -3267,7 +3246,7 @@ static void build_inter_predictors_single_buf(MACROBLOCKD *xd, int plane,
av1_make_inter_predictor(pre, pre_buf->stride, dst, ext_dst_stride, subpel_x,
subpel_y, sf, w, h, &conv_params,
mi->mbmi.interp_filter,
mi->mbmi.interp_filters,
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
&warp_types, (mi_x >> pd->subsampling_x) + x,
(mi_y >> pd->subsampling_y) + y, plane, ref,
......
......@@ -40,27 +40,8 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride,
uint8_t *dst, int dst_stride, int subpel_x,
int subpel_y, const struct scale_factors *sf,
int w, int h, ConvolveParams *conv_params,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif
int xs, int ys) {
#if CONFIG_DUAL_FILTER
const InterpFilter filter_x = av1_get_plane_interp_filter(
interp_filter[1 + 2 * conv_params->ref], conv_params->plane);
const InterpFilter filter_y = av1_get_plane_interp_filter(
interp_filter[0 + 2 * conv_params->ref], conv_params->plane);
const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(filter_x);
const InterpFilterParams interp_filter_params_y =
av1_get_interp_filter_params(filter_y);
#else
const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(interp_filter);
const InterpFilterParams interp_filter_params_y = interp_filter_params_x;
#endif
InterpFilters interp_filters, int xs,
int ys) {
assert(conv_params->do_average == 0 || conv_params->do_average == 1);
assert(sf);
if (has_scale(xs, ys)) {
......@@ -69,19 +50,15 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride,
if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
#if CONFIG_CONVOLVE_ROUND
av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
#if CONFIG_DUAL_FILTER
interp_filter,
#else // CONFIG_DUAL_FILTER
&interp_filter,
#endif // CONFIG_DUAL_FILTER
subpel_x, xs, subpel_y, ys, 1, conv_params);
interp_filters, subpel_x, xs, subpel_y, ys, 1,
conv_params);
conv_params->do_post_rounding = 1;
#else
assert(0);
#endif // CONFIG_CONVOLVE_ROUND
} else {
assert(conv_params->round == CONVOLVE_OPT_ROUND);
av1_convolve_scale(src, src_stride, dst, dst_stride, w, h, interp_filter,
av1_convolve_scale(src, src_stride, dst, dst_stride, w, h, interp_filters,
subpel_x, xs, subpel_y, ys, conv_params);
}
} else {
......@@ -96,31 +73,32 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride,
if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
#if CONFIG_CONVOLVE_ROUND
av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
#if CONFIG_DUAL_FILTER
interp_filter,
#else // CONFIG_DUAL_FILTER
&interp_filter,
#endif // CONFIG_DUAL_FILTER
subpel_x, xs, subpel_y, ys, 0, conv_params);
interp_filters, subpel_x, xs, subpel_y, ys, 0,
conv_params);
conv_params->do_post_rounding = 1;
#else
assert(0);
#endif // CONFIG_CONVOLVE_ROUND
} else {
assert(conv_params->round == CONVOLVE_OPT_ROUND);
InterpFilterParams filter_params_x, filter_params_y;
av1_get_convolve_filter_params(interp_filters, 0, &filter_params_x,
&filter_params_y);
if (w <= 2 || h <= 2) {
av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filter,
av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filters,
subpel_x, xs, subpel_y, ys, conv_params);
} else if (interp_filter_params_x.taps == SUBPEL_TAPS &&
interp_filter_params_y.taps == SUBPEL_TAPS) {
const int16_t *kernel_x = av1_get_interp_filter_subpel_kernel(
interp_filter_params_x, subpel_x);
const int16_t *kernel_y = av1_get_interp_filter_subpel_kernel(
interp_filter_params_y, subpel_y);
} else if (filter_params_x.taps == SUBPEL_TAPS &&
filter_params_y.taps == SUBPEL_TAPS) {
const int16_t *kernel_x =
av1_get_interp_filter_subpel_kernel(filter_params_x, subpel_x);
const int16_t *kernel_y =
av1_get_interp_filter_subpel_kernel(filter_params_y, subpel_y);
sf->predict[subpel_x != 0][subpel_y != 0][conv_params->do_average](
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h);
} else {
av1_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter,
av1_convolve(src, src_stride, dst, dst_stride, w, h, interp_filters,
subpel_x, xs, subpel_y, ys, conv_params);
}
}
......@@ -133,44 +111,24 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
int subpel_x, int subpel_y,
const struct scale_factors *sf, int w,
int h, ConvolveParams *conv_params,
#if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter,
#else
const InterpFilter interp_filter,
#endif
int xs, int ys, int bd) {
InterpFilters interp_filters, int xs,
int ys, int bd) {
const int avg = conv_params->do_average;
assert(avg == 0 || avg == 1);
#if CONFIG_DUAL_FILTER
const int ref = conv_params->ref;
const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(interp_filter[1 + 2 * ref]);
const InterpFilterParams interp_filter_params_y =
av1_get_interp_filter_params(interp_filter[0 + 2 * ref]);
#else
const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(interp_filter);
const InterpFilterParams interp_filter_params_y = interp_filter_params_x;
#endif
if (has_scale(xs, ys)) {
if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
#if CONFIG_CONVOLVE_ROUND
av1_highbd_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
#if CONFIG_DUAL_FILTER
interp_filter,
#else // CONFIG_DUAL_FILTER
&interp_filter,
#endif // CONFIG_DUAL_FILTER
subpel_x, xs, subpel_y, ys, 1, conv_params,
bd);
interp_filters, subpel_x, xs, subpel_y, ys,
1, conv_params, bd);
conv_params->do_post_rounding = 1;
#else
assert(0);
#endif // CONFIG_CONVOLVE_ROUND
} else {
av1_highbd_convolve_scale(src, src_stride, dst, dst_stride, w, h,
interp_filter, subpel_x, xs, subpel_y, ys, avg,
interp_filters, subpel_x, xs, subpel_y, ys, avg,
bd);
}
} else {
......@@ -185,30 +143,30 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
#if CONFIG_CONVOLVE_ROUND
av1_highbd_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
#if CONFIG_DUAL_FILTER
interp_filter,
#else // CONFIG_DUAL_FILTER
&interp_filter,
#endif // CONFIG_DUAL_FILTER
subpel_x, xs, subpel_y, ys, 0, conv_params,
bd);
interp_filters, subpel_x, xs, subpel_y, ys,
0, conv_params, bd);
conv_params->do_post_rounding = 1;
#else
assert(0);
#endif // CONFIG_CONVOLVE_ROUND
} else {
if (interp_filter_params_x.taps == SUBPEL_TAPS &&
interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2) {
const int16_t *kernel_x = av1_get_interp_filter_subpel_kernel(
interp_filter_params_x, subpel_x);
const int16_t *kernel_y = av1_get_interp_filter_subpel_kernel(
interp_filter_params_y, subpel_y);
InterpFilterParams filter_params_x, filter_params_y;
av1_get_convolve_filter_params(interp_filters, 0, &filter_params_x,
&filter_params_y);
if (filter_params_x.taps == SUBPEL_TAPS &&
filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2) {
const int16_t *kernel_x =
av1_get_interp_filter_subpel_kernel(filter_params_x, subpel_x);
const int16_t *kernel_y =
av1_get_interp_filter_subpel_kernel(filter_params_y, subpel_y);
sf->highbd_predict[subpel_x != 0][subpel_y != 0][avg](
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h,
bd);
} else {
av1_highbd_convolve(src, src_stride, dst, dst_stride, w, h,
interp_filter, subpel_x, xs, subpel_y, ys, avg, bd);
interp_filters, subpel_x, xs, subpel_y, ys, avg,
bd);
}
}
}
......@@ -320,26 +278,19 @@ void build_compound_seg_mask_highbd(uint8_t *mask, SEG_MASK_TYPE mask_type,
#endif // CONFIG_HIGHBITDEPTH
#endif // CONFIG_COMPOUND_SEGMENT
void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
uint8_t *dst, int dst_stride,
const int subpel_x, const int subpel_y,
const struct scale_factors *sf, int w,