Commit 9de916eb authored by Jingning Han's avatar Jingning Han

Fix dual filter type for high bit-depth

This commit fixes the compiler error in high bit-depth inter
predictor when dual filter type experiment is turned on.

Change-Id: I404a76a246477f2fcffc38a3275007d5dfe229cd
parent df56fcdf
......@@ -185,9 +185,18 @@ TEST(VP10ConvolveTest, vp10_convolve_avg) {
#if CONFIG_VP9_HIGHBITDEPTH
TEST(VP10ConvolveTest, vp10_highbd_convolve) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
#if CONFIG_DUAL_FILTER
INTERP_FILTER interp_filter[4] = {
EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
EIGHTTAP_REGULAR, EIGHTTAP_REGULAR
};
InterpFilterParams filter_params =
vp10_get_interp_filter_params(interp_filter[0]);
#else
INTERP_FILTER interp_filter = EIGHTTAP_REGULAR;
InterpFilterParams filter_params =
vp10_get_interp_filter_params(interp_filter);
#endif
ptrdiff_t filter_size = filter_params.taps;
int filter_center = filter_size / 2 - 1;
uint16_t src[12 * 12];
......@@ -212,7 +221,7 @@ TEST(VP10ConvolveTest, vp10_highbd_convolve) {
for (subpel_y_q4 = 0; subpel_y_q4 < 16; subpel_y_q4++) {
vp10_highbd_convolve(
CONVERT_TO_BYTEPTR(src + src_stride * filter_center + filter_center),
src_stride, CONVERT_TO_BYTEPTR(dst), dst_stride, w, h, filter_params,
src_stride, CONVERT_TO_BYTEPTR(dst), dst_stride, w, h, interp_filter,
subpel_x_q4, x_step_q4, subpel_y_q4, y_step_q4, avg, bd);
const int16_t* x_filter =
......@@ -239,9 +248,18 @@ TEST(VP10ConvolveTest, vp10_highbd_convolve) {
TEST(VP10ConvolveTest, vp10_highbd_convolve_avg) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
#if CONFIG_DUAL_FILTER
INTERP_FILTER interp_filter[4] = {
EIGHTTAP_REGULAR, EIGHTTAP_REGULAR,
EIGHTTAP_REGULAR, EIGHTTAP_REGULAR
};
InterpFilterParams filter_params =
vp10_get_interp_filter_params(interp_filter[0]);
#else
INTERP_FILTER interp_filter = EIGHTTAP_REGULAR;
InterpFilterParams filter_params =
vp10_get_interp_filter_params(interp_filter);
#endif
ptrdiff_t filter_size = filter_params.taps;
int filter_center = filter_size / 2 - 1;
uint16_t src0[12 * 12];
......@@ -274,23 +292,23 @@ TEST(VP10ConvolveTest, vp10_highbd_convolve_avg) {
avg = 0;
vp10_highbd_convolve(CONVERT_TO_BYTEPTR(src0 + offset), src_stride,
CONVERT_TO_BYTEPTR(dst0), dst_stride, w, h,
filter_params, subpel_x_q4, x_step_q4, subpel_y_q4,
interp_filter, subpel_x_q4, x_step_q4, subpel_y_q4,
y_step_q4, avg, bd);
avg = 0;
vp10_highbd_convolve(CONVERT_TO_BYTEPTR(src1 + offset), src_stride,
CONVERT_TO_BYTEPTR(dst1), dst_stride, w, h,
filter_params, subpel_x_q4, x_step_q4, subpel_y_q4,
interp_filter, subpel_x_q4, x_step_q4, subpel_y_q4,
y_step_q4, avg, bd);
avg = 0;
vp10_highbd_convolve(CONVERT_TO_BYTEPTR(src0 + offset), src_stride,
CONVERT_TO_BYTEPTR(dst), dst_stride, w, h,
filter_params, subpel_x_q4, x_step_q4, subpel_y_q4,
interp_filter, subpel_x_q4, x_step_q4, subpel_y_q4,
y_step_q4, avg, bd);
avg = 1;
vp10_highbd_convolve(CONVERT_TO_BYTEPTR(src1 + offset), src_stride,
CONVERT_TO_BYTEPTR(dst), dst_stride, w, h,
filter_params, subpel_x_q4, x_step_q4, subpel_y_q4,
interp_filter, subpel_x_q4, x_step_q4, subpel_y_q4,
y_step_q4, avg, bd);
EXPECT_EQ(dst[0], ROUND_POWER_OF_TWO(dst0[0] + dst1[0], 1));
......
......@@ -538,7 +538,11 @@ void vp10_highbd_build_inter_predictor(const uint8_t *src, int src_stride,
const MV *src_mv,
const struct scale_factors *sf,
int w, int h, int ref,
#if CONFIG_DUAL_FILTER
const INTERP_FILTER *interp_filter,
#else
const INTERP_FILTER interp_filter,
#endif
enum mv_precision precision,
int x, int y, int bd) {
const int is_q4 = precision == MV_PRECISION_Q4;
......@@ -551,8 +555,8 @@ void vp10_highbd_build_inter_predictor(const uint8_t *src, int src_stride,
src += (mv.row >> SUBPEL_BITS) * src_stride + (mv.col >> SUBPEL_BITS);
highbd_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y,
sf, w, h, ref, interp_filter, sf->x_step_q4,
sf->y_step_q4, bd);
sf, w, h, ref, interp_filter, sf->x_step_q4,
sf->y_step_q4, bd);
}
#endif // CONFIG_VP9_HIGHBITDEPTH
......
......@@ -88,15 +88,36 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
const int subpel_y,
const struct scale_factors *sf,
int w, int h, int ref,
#if CONFIG_DUAL_FILTER
const INTERP_FILTER *interp_filter,
#else
const INTERP_FILTER interp_filter,
#endif
int xs, int ys, int bd) {
#if CONFIG_DUAL_FILTER
InterpFilterParams interp_filter_params_x =
vp10_get_interp_filter_params(interp_filter[1 + 2 * ref]);
InterpFilterParams interp_filter_params_y =
vp10_get_interp_filter_params(interp_filter[0 + 2 * ref]);
#else
InterpFilterParams interp_filter_params =
vp10_get_interp_filter_params(interp_filter);
#endif
#if CONFIG_DUAL_FILTER
if (interp_filter_params_x.taps == SUBPEL_TAPS &&
interp_filter_params_y.taps == SUBPEL_TAPS) {
const int16_t *kernel_x =
vp10_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x);
const int16_t *kernel_y =
vp10_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y);
#else
if (interp_filter_params.taps == SUBPEL_TAPS) {
const int16_t *kernel_x =
vp10_get_interp_filter_subpel_kernel(interp_filter_params, subpel_x);
const int16_t *kernel_y =
vp10_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
......@@ -119,7 +140,7 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
// therefore we need to average the first and second results
int avg = ref > 0;
vp10_highbd_convolve(src, src_stride, dst, dst_stride, w, h,
interp_filter_params, subpel_x, xs, subpel_y, ys, avg,
interp_filter, subpel_x, xs, subpel_y, ys, avg,
bd);
}
}
......@@ -326,7 +347,11 @@ void vp10_highbd_build_inter_predictor(const uint8_t *src, int src_stride,
const MV *mv_q3,
const struct scale_factors *sf,
int w, int h, int do_avg,
#if CONFIG_DUAL_FILTER
const INTERP_FILTER *interp_filter,
#else
const INTERP_FILTER interp_filter,
#endif
enum mv_precision precision,
int x, int y, int bd);
#endif
......
......@@ -263,13 +263,16 @@ static void highbd_convolve_copy(const uint16_t *src, int src_stride,
void vp10_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
int dst_stride, int w, int h,
const InterpFilterParams filter_params,
#if CONFIG_DUAL_FILTER
const INTERP_FILTER *interp_filter,
#else
const INTERP_FILTER interp_filter,
#endif
const int subpel_x_q4, int x_step_q4,
const int subpel_y_q4, int y_step_q4, int avg,
const int subpel_y_q4, int y_step_q4, int ref_idx,
int bd) {
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
int filter_size = filter_params.taps;
int ignore_horiz = x_step_q4 == 16 && subpel_x_q4 == 0;
int ignore_vert = y_step_q4 == 16 && subpel_y_q4 == 0;
......@@ -277,16 +280,29 @@ void vp10_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
assert(h <= MAX_BLOCK_HEIGHT);
assert(y_step_q4 <= MAX_STEP);
assert(x_step_q4 <= MAX_STEP);
assert(filter_params.taps <= MAX_FILTER_TAP);
if (ignore_horiz && ignore_vert) {
highbd_convolve_copy(src, src_stride, dst, dst_stride, w, h, avg, bd);
highbd_convolve_copy(src, src_stride, dst, dst_stride, w, h, ref_idx, bd);
} else if (ignore_vert) {
#if CONFIG_DUAL_FILTER
InterpFilterParams filter_params =
vp10_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]);
#else
InterpFilterParams filter_params =
vp10_get_interp_filter_params(interp_filter);
#endif
highbd_convolve_horiz(src, src_stride, dst, dst_stride, w, h, filter_params,
subpel_x_q4, x_step_q4, avg, bd);
subpel_x_q4, x_step_q4, ref_idx, bd);
} else if (ignore_horiz) {
#if CONFIG_DUAL_FILTER
InterpFilterParams filter_params =
vp10_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]);
#else
InterpFilterParams filter_params =
vp10_get_interp_filter_params(interp_filter);
#endif
highbd_convolve_vert(src, src_stride, dst, dst_stride, w, h, filter_params,
subpel_y_q4, y_step_q4, avg, bd);
subpel_y_q4, y_step_q4, ref_idx, bd);
} else {
// temp's size is set to (maximum possible intermediate_height) *
// MAX_BLOCK_WIDTH
......@@ -295,15 +311,33 @@ void vp10_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
MAX_BLOCK_WIDTH];
int temp_stride = MAX_BLOCK_WIDTH;
#if CONFIG_DUAL_FILTER
InterpFilterParams filter_params =
vp10_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]);
#else
InterpFilterParams filter_params =
vp10_get_interp_filter_params(interp_filter);
#endif
int filter_size = filter_params.taps;
int intermediate_height =
(((h - 1) * y_step_q4 + subpel_y_q4) >> SUBPEL_BITS) + filter_size;
highbd_convolve_horiz(src - src_stride * (filter_size / 2 - 1), src_stride,
temp, temp_stride, w, intermediate_height,
filter_params, subpel_x_q4, x_step_q4, 0, bd);
#if CONFIG_DUAL_FILTER
filter_params = vp10_get_interp_filter_params(interp_filter[2 * ref_idx]);
#else
filter_params = vp10_get_interp_filter_params(interp_filter);
#endif
filter_size = filter_params.taps;
assert(filter_params.taps <= MAX_FILTER_TAP);
highbd_convolve_vert(temp + temp_stride * (filter_size / 2 - 1),
temp_stride, dst, dst_stride, w, h, filter_params,
subpel_y_q4, y_step_q4, avg, bd);
subpel_y_q4, y_step_q4, ref_idx, bd);
}
}
#endif // CONFIG_VP9_HIGHBITDEPTH
......@@ -22,7 +22,11 @@ void vp10_convolve(const uint8_t *src, int src_stride,
void vp10_highbd_convolve(const uint8_t *src, int src_stride,
uint8_t *dst, int dst_stride,
int w, int h,
const InterpFilterParams filter_params,
#if CONFIG_DUAL_FILTER
const INTERP_FILTER *interp_filter,
#else
const INTERP_FILTER interp_filter,
#endif
const int subpel_x,
const int subpel_y,
int xstep, int ystep, int avg, int 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