}
}
-#if HAVE_MSA
-// TODO(any) MSA optimizations doesn't work with 4-tap interp filter. Need to be
-// fixed.
-const int kNumFilterBanks = 4;
-#else
const int kNumFilterBanks = 5;
-#endif
const int kNumFilters = 16;
TEST(ConvolveTest, FiltersWontSaturateWhenAddedPairwise) {
#include "vpx_dsp/mips/convolve_common_dspr2.h"
#include "vpx_dsp/vpx_convolve.h"
#include "vpx_dsp/vpx_dsp_common.h"
+#include "vpx_dsp/vpx_filter.h"
#include "vpx_ports/mem.h"
#if HAVE_DSPR2
assert(y_step_q4 == 16);
assert(((const int32_t *)filter_y)[1] != 0x800000);
- if (((const int32_t *)filter_y)[0] == 0) {
+ if (vpx_get_filter_taps(filter_y) == 2) {
vpx_convolve2_avg_vert_dspr2(src, src_stride, dst, dst_stride, filter,
x0_q4, x_step_q4, y0_q4, y_step_q4, w, h);
} else {
#include "vpx_dsp/mips/convolve_common_dspr2.h"
#include "vpx_dsp/vpx_convolve.h"
#include "vpx_dsp/vpx_dsp_common.h"
+#include "vpx_dsp/vpx_filter.h"
#include "vpx_ports/mem.h"
#if HAVE_DSPR2
assert(x_step_q4 == 16);
assert(((const int32_t *)filter_x)[1] != 0x800000);
- if (((const int32_t *)filter_x)[0] == 0) {
+ if (vpx_get_filter_taps(filter_x) == 2) {
vpx_convolve2_avg_horiz_dspr2(src, src_stride, dst, dst_stride, filter,
x0_q4, x_step_q4, y0_q4, y_step_q4, w, h);
} else {
if (filter_x[3] == 0x80) {
copy_horiz_transposed(src - src_stride * 3, src_stride, temp,
intermediate_height, w, intermediate_height);
- } else if (((const int32_t *)filter_x)[0] == 0) {
+ } else if (vpx_get_filter_taps(filter_x) == 2) {
vpx_convolve2_dspr2(src - src_stride * 3, src_stride, temp,
intermediate_height, filter_x, w, intermediate_height);
} else {
/* copy the src to dst */
if (filter_y[3] == 0x80) {
copy_horiz_transposed(temp + 3, intermediate_height, dst, dst_stride, h, w);
- } else if (((const int32_t *)filter_y)[0] == 0) {
+ } else if (vpx_get_filter_taps(filter_y) == 2) {
vpx_convolve2_dspr2(temp + 3, intermediate_height, dst, dst_stride,
filter_y, h, w);
} else {
assert(x_step_q4 == 16);
assert(((const int32_t *)filter_x)[1] != 0x800000);
- if (((const int32_t *)filter_x)[0] == 0) {
+ if (vpx_get_filter_taps(filter_x) == 2) {
vpx_convolve2_horiz_dspr2(src, src_stride, dst, dst_stride, filter, x0_q4,
x_step_q4, y0_q4, y_step_q4, w, h);
} else {
assert(y_step_q4 == 16);
assert(((const int32_t *)filter_y)[1] != 0x800000);
- if (((const int32_t *)filter_y)[0] == 0) {
+ if (vpx_get_filter_taps(filter_y) == 2) {
vpx_convolve2_vert_dspr2(src, src_stride, dst, dst_stride, filter, x0_q4,
x_step_q4, y0_q4, y_step_q4, w, h);
} else {
filt_hor[cnt] = filter_x[cnt];
}
- if (((const int32_t *)filter_x)[0] == 0) {
+ if (vpx_get_filter_taps(filter_x) == 2) {
switch (w) {
case 4:
common_hz_2t_and_aver_dst_4w_msa(src, (int32_t)src_stride, dst,
filt_ver[cnt] = filter_y[cnt];
}
- if (((const int32_t *)filter_x)[0] == 0 &&
- ((const int32_t *)filter_y)[0] == 0) {
+ if (vpx_get_filter_taps(filter_x) == 2 &&
+ vpx_get_filter_taps(filter_y) == 2) {
switch (w) {
case 4:
common_hv_2ht_2vt_and_aver_dst_4w_msa(src, (int32_t)src_stride, dst,
x_step_q4, y0_q4, y_step_q4, w, h);
break;
}
- } else if (((const int32_t *)filter_x)[0] == 0 ||
- ((const int32_t *)filter_y)[0] == 0) {
+ } else if (vpx_get_filter_taps(filter_x) == 2 ||
+ vpx_get_filter_taps(filter_y) == 2) {
vpx_convolve8_avg_c(src, src_stride, dst, dst_stride, filter, x0_q4,
x_step_q4, y0_q4, y_step_q4, w, h);
} else {
filt_ver[cnt] = filter_y[cnt];
}
- if (((const int32_t *)filter_y)[0] == 0) {
+ if (vpx_get_filter_taps(filter_y) == 2) {
switch (w) {
case 4:
common_vt_2t_and_aver_dst_4w_msa(src, (int32_t)src_stride, dst,
filt_hor[cnt] = filter_x[cnt];
}
- if (((const int32_t *)filter_x)[0] == 0) {
+ if (vpx_get_filter_taps(filter_x) == 2) {
switch (w) {
case 4:
common_hz_2t_4w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
filt_ver[cnt] = filter_y[cnt];
}
- if (((const int32_t *)filter_x)[0] == 0 &&
- ((const int32_t *)filter_y)[0] == 0) {
+ if (vpx_get_filter_taps(filter_x) == 2 &&
+ vpx_get_filter_taps(filter_y) == 2) {
switch (w) {
case 4:
common_hv_2ht_2vt_4w_msa(src, (int32_t)src_stride, dst,
x_step_q4, y0_q4, y_step_q4, w, h);
break;
}
- } else if (((const int32_t *)filter_x)[0] == 0 ||
- ((const int32_t *)filter_y)[0] == 0) {
+ } else if (vpx_get_filter_taps(filter_x) == 2 ||
+ vpx_get_filter_taps(filter_y) == 2) {
vpx_convolve8_c(src, src_stride, dst, dst_stride, filter, x0_q4, x_step_q4,
y0_q4, y_step_q4, w, h);
} else {
filt_ver[cnt] = filter_y[cnt];
}
- if (((const int32_t *)filter_y)[0] == 0) {
+ if (vpx_get_filter_taps(filter_y) == 2) {
switch (w) {
case 4:
common_vt_2t_4w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
#ifndef VPX_VPX_DSP_VPX_FILTER_H_
#define VPX_VPX_DSP_VPX_FILTER_H_
+#include <assert.h>
#include "vpx/vpx_integer.h"
#ifdef __cplusplus
typedef int16_t InterpKernel[SUBPEL_TAPS];
+static INLINE int vpx_get_filter_taps(const int16_t *const filter) {
+ assert(filter[3] != 128);
+ if (!filter[0] && !filter[1] && !filter[2])
+ return 2;
+ else
+ return 8;
+}
+
#ifdef __cplusplus
} // extern "C"
#endif