Commit 30edaf46 authored by Angie Chiang's avatar Angie Chiang
Browse files

Cleanup inter_predictor and highbd_inter_predictor

Change-Id: Ieeb044d2b008c409faf7fa5d7253ad2d8f326ca4
parent 1a19a5f2
...@@ -32,11 +32,12 @@ ...@@ -32,11 +32,12 @@
extern "C" { extern "C" {
#endif #endif
static INLINE int has_scale(int xs, int ys) { return xs != 16 || ys != 16; }
static INLINE void inter_predictor(const uint8_t *src, int src_stride, static INLINE void inter_predictor(const uint8_t *src, int src_stride,
uint8_t *dst, int dst_stride, uint8_t *dst, int dst_stride, int subpel_x,
const int subpel_x, const int subpel_y, int subpel_y, const struct scale_factors *sf,
const struct scale_factors *sf, int w, int h, int w, int h, ConvolveParams *conv_params,
ConvolveParams *conv_params,
#if CONFIG_DUAL_FILTER #if CONFIG_DUAL_FILTER
const InterpFilter *interp_filter, const InterpFilter *interp_filter,
#else #else
...@@ -44,63 +45,52 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride, ...@@ -44,63 +45,52 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride,
#endif #endif
int xs, int ys) { int xs, int ys) {
#if CONFIG_DUAL_FILTER #if CONFIG_DUAL_FILTER
InterpFilter filter_x = av1_get_plane_interp_filter( const InterpFilter filter_x = av1_get_plane_interp_filter(
interp_filter[1 + 2 * conv_params->ref], conv_params->plane); interp_filter[1 + 2 * conv_params->ref], conv_params->plane);
InterpFilter filter_y = av1_get_plane_interp_filter( const InterpFilter filter_y = av1_get_plane_interp_filter(
interp_filter[0 + 2 * conv_params->ref], conv_params->plane); interp_filter[0 + 2 * conv_params->ref], conv_params->plane);
InterpFilterParams interp_filter_params_x = const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(filter_x); av1_get_interp_filter_params(filter_x);
InterpFilterParams interp_filter_params_y = const InterpFilterParams interp_filter_params_y =
av1_get_interp_filter_params(filter_y); av1_get_interp_filter_params(filter_y);
#else #else
InterpFilterParams interp_filter_params = const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(interp_filter); av1_get_interp_filter_params(interp_filter);
const InterpFilterParams interp_filter_params_y = interp_filter_params_x;
#endif #endif
assert(sf); assert(sf);
#if CONFIG_DUAL_FILTER if (has_scale(xs, ys)) {
if (interp_filter_params_x.taps == SUBPEL_TAPS && av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filter,
interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2 && subpel_x, xs, subpel_y, ys, conv_params);
conv_params->round == CONVOLVE_OPT_ROUND && xs == 16 && ys == 16) { } else if (conv_params->round == CONVOLVE_OPT_NO_ROUND) {
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 (interp_filter_params.taps == SUBPEL_TAPS && w > 2 && h > 2 &&
conv_params->round == CONVOLVE_OPT_ROUND && xs == 16 && ys == 16) {
const int16_t *kernel_x =
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_x);
const int16_t *kernel_y =
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_y);
#endif
sf->predict[subpel_x != 0][subpel_y != 0][conv_params->ref](
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h);
} else {
// ref_idx > 0 means this is the second reference frame
// first reference frame's prediction result is already in dst
// therefore we need to average the first and second results
#if CONFIG_CONVOLVE_ROUND #if CONFIG_CONVOLVE_ROUND
if (conv_params->round == CONVOLVE_OPT_NO_ROUND && xs == 16 && ys == 16) av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
#if CONFIG_DUAL_FILTER #if CONFIG_DUAL_FILTER
interp_filter, interp_filter,
#else // CONFIG_DUAL_FILTER
&interp_filter,
#endif // CONFIG_DUAL_FILTER
subpel_x, xs, subpel_y, ys, conv_params);
#else #else
&interp_filter, assert(0);
#endif #endif // CONFIG_CONVOLVE_ROUND
subpel_x, xs, subpel_y, ys, conv_params); } else {
else assert(conv_params->round == CONVOLVE_OPT_ROUND);
#endif if (w <= 2 || h <= 2) {
{ av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filter,
if (xs == 16 && ys == 16) {
av1_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter,
subpel_x, xs, subpel_y, ys, conv_params); subpel_x, xs, subpel_y, ys, conv_params);
} else { } else if (interp_filter_params_x.taps == SUBPEL_TAPS &&
// If xs == 16 || ys == 16 scaling is happening and the SSE2 interp_filter_params_y.taps == SUBPEL_TAPS) {
// instructions don't support scaling; use the C versions to be safe. const int16_t *kernel_x =
av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filter, av1_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x);
subpel_x, xs, subpel_y, ys, conv_params); const int16_t *kernel_y =
} av1_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y);
sf->predict[subpel_x != 0][subpel_y != 0][conv_params->ref](
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,
subpel_x, xs, subpel_y, ys, conv_params);
} }
} }
} }
...@@ -119,36 +109,29 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride, ...@@ -119,36 +109,29 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
#endif #endif
int xs, int ys, int bd) { int xs, int ys, int bd) {
#if CONFIG_DUAL_FILTER #if CONFIG_DUAL_FILTER
InterpFilterParams interp_filter_params_x = const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(interp_filter[1 + 2 * ref]); av1_get_interp_filter_params(interp_filter[1 + 2 * ref]);
InterpFilterParams interp_filter_params_y = const InterpFilterParams interp_filter_params_y =
av1_get_interp_filter_params(interp_filter[0 + 2 * ref]); av1_get_interp_filter_params(interp_filter[0 + 2 * ref]);
#else #else
InterpFilterParams interp_filter_params = const InterpFilterParams interp_filter_params_x =
av1_get_interp_filter_params(interp_filter); av1_get_interp_filter_params(interp_filter);
const InterpFilterParams interp_filter_params_y = interp_filter_params_x;
#endif #endif
#if CONFIG_DUAL_FILTER
if (interp_filter_params_x.taps == SUBPEL_TAPS && if (interp_filter_params_x.taps == SUBPEL_TAPS &&
interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2) { interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2) {
const int16_t *kernel_x = const int16_t *kernel_x =
av1_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x); av1_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x);
const int16_t *kernel_y = const int16_t *kernel_y =
av1_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y); av1_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y);
#else
if (interp_filter_params.taps == SUBPEL_TAPS && w > 2 && h > 2) {
const int16_t *kernel_x =
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_x);
const int16_t *kernel_y =
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_y);
#endif // CONFIG_DUAL_FILTER
sf->highbd_predict[subpel_x != 0][subpel_y != 0][ref]( 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); src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h, bd);
} else { } else {
// ref > 0 means this is the second reference frame // ref > 0 means this is the second reference frame
// first reference frame's prediction result is already in dst // first reference frame's prediction result is already in dst
// therefore we need to average the first and second results // therefore we need to average the first and second results
int avg = ref > 0; const int avg = ref > 0;
av1_highbd_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter, av1_highbd_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter,
subpel_x, xs, subpel_y, ys, avg, bd); subpel_x, xs, subpel_y, ys, avg, bd);
} }
......
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