Commit 17be4d8b authored by Yunqing Wang's avatar Yunqing Wang

Add is_compound in ConvolveParams

Added is_compound in ConvolveParams, so that later we could handle
single ref and compound ref differently in optimization.

Change-Id: If36d1634c5dbd9e6e1962c8017db470bf78738fa
parent feb1ebe9
......@@ -35,6 +35,7 @@ typedef struct ConvolveParams {
int round_1;
int plane;
int do_post_rounding;
int is_compound;
#if CONFIG_JNT_COMP
int use_jnt_comp_avg;
int fwd_offset;
......@@ -107,13 +108,17 @@ void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
static INLINE ConvolveParams get_conv_params_no_round(int ref, int do_average,
int plane, int32_t *dst,
int dst_stride) {
int dst_stride,
int is_compound) {
ConvolveParams conv_params;
conv_params.ref = ref;
conv_params.do_average = do_average;
conv_params.round = CONVOLVE_OPT_NO_ROUND;
conv_params.round_0 = 5;
conv_params.round_1 = 0;
conv_params.is_compound = is_compound;
// TODO(yunqing): The following dst should only be valid while
// is_compound = 1;
conv_params.dst = dst;
conv_params.dst_stride = dst_stride;
conv_params.plane = plane;
......
......@@ -1019,8 +1019,8 @@ static INLINE void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
DECLARE_ALIGNED(16, int32_t, tmp_dst[8 * 8]);
int tmp_dst_stride = 8;
assert(w <= 8 && h <= 8);
ConvolveParams conv_params =
get_conv_params_no_round(0, 0, plane, tmp_dst, tmp_dst_stride);
ConvolveParams conv_params = get_conv_params_no_round(
0, 0, plane, tmp_dst, tmp_dst_stride, is_compound);
#if CONFIG_JNT_COMP
conv_params.use_jnt_comp_avg = 0;
#endif // CONFIG_JNT_COMP
......@@ -1219,8 +1219,8 @@ static INLINE void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
}
}
ConvolveParams conv_params =
get_conv_params_no_round(ref, ref, plane, tmp_dst, MAX_SB_SIZE);
ConvolveParams conv_params = get_conv_params_no_round(
ref, ref, plane, tmp_dst, MAX_SB_SIZE, is_compound);
#if CONFIG_JNT_COMP
av1_jnt_comp_weight_assign(cm, &mi->mbmi, 0, &conv_params.fwd_offset,
&conv_params.bck_offset,
......
......@@ -71,9 +71,9 @@ void AV1Convolve2DTest::RunCheckOutput(convolve_2d_func test_impl) {
av1_get_interp_filter_params((InterpFilter)vfilter);
const int do_average = rnd_.Rand8() & 1;
ConvolveParams conv_params1 =
get_conv_params_no_round(0, do_average, 0, output, MAX_SB_SIZE);
get_conv_params_no_round(0, do_average, 0, output, MAX_SB_SIZE, 1);
ConvolveParams conv_params2 =
get_conv_params_no_round(0, do_average, 0, output2, MAX_SB_SIZE);
get_conv_params_no_round(0, do_average, 0, output2, MAX_SB_SIZE, 1);
for (subx = 0; subx < 16; ++subx)
for (suby = 0; suby < 16; ++suby) {
......@@ -87,12 +87,12 @@ void AV1Convolve2DTest::RunCheckOutput(convolve_2d_func test_impl) {
// Choose random locations within the source block
int offset_r = 3 + rnd_.PseudoUniform(h - out_h - 7);
int offset_c = 3 + rnd_.PseudoUniform(w - out_w - 7);
av1_convolve_2d_c(input + offset_r * w + offset_c, w, NULL,
MAX_SB_SIZE, out_w, out_h, &filter_params_x,
&filter_params_y, subx, suby, &conv_params1);
test_impl(input + offset_r * w + offset_c, w, NULL, MAX_SB_SIZE,
out_w, out_h, &filter_params_x, &filter_params_y, subx,
suby, &conv_params2);
av1_convolve_2d_c(input + offset_r * w + offset_c, w, NULL, 0,
out_w, out_h, &filter_params_x, &filter_params_y,
subx, suby, &conv_params1);
test_impl(input + offset_r * w + offset_c, w, NULL, 0, out_w, out_h,
&filter_params_x, &filter_params_y, subx, suby,
&conv_params2);
for (j = 0; j < out_h; ++j)
for (k = 0; k < out_w; ++k) {
......@@ -135,9 +135,9 @@ void AV1Convolve2DTest::RunCheckOutput2(convolve_2d_func test_impl) {
av1_get_interp_filter_params((InterpFilter)vfilter);
const int do_average = rnd_.Rand8() & 1;
ConvolveParams conv_params1 =
get_conv_params_no_round(0, do_average, 0, output, MAX_SB_SIZE);
get_conv_params_no_round(0, do_average, 0, output, MAX_SB_SIZE, 1);
ConvolveParams conv_params2 =
get_conv_params_no_round(0, do_average, 0, output2, MAX_SB_SIZE);
get_conv_params_no_round(0, do_average, 0, output2, MAX_SB_SIZE, 1);
// Test special case where fwd and bck offsets are -1
conv_params1.use_jnt_comp_avg = 0;
......@@ -155,12 +155,12 @@ void AV1Convolve2DTest::RunCheckOutput2(convolve_2d_func test_impl) {
// Choose random locations within the source block
int offset_r = 3 + rnd_.PseudoUniform(h - out_h - 7);
int offset_c = 3 + rnd_.PseudoUniform(w - out_w - 7);
av1_jnt_convolve_2d_c(input + offset_r * w + offset_c, w, NULL,
MAX_SB_SIZE, out_w, out_h, &filter_params_x,
av1_jnt_convolve_2d_c(input + offset_r * w + offset_c, w, NULL, 0,
out_w, out_h, &filter_params_x,
&filter_params_y, subx, suby, &conv_params1);
test_impl(input + offset_r * w + offset_c, w, NULL, MAX_SB_SIZE,
out_w, out_h, &filter_params_x, &filter_params_y, subx,
suby, &conv_params2);
test_impl(input + offset_r * w + offset_c, w, NULL, 0, out_w, out_h,
&filter_params_x, &filter_params_y, subx, suby,
&conv_params2);
for (j = 0; j < out_h; ++j)
for (k = 0; k < out_w; ++k) {
......@@ -197,12 +197,12 @@ void AV1Convolve2DTest::RunCheckOutput2(convolve_2d_func test_impl) {
int offset_r = 3 + rnd_.PseudoUniform(h - out_h - 7);
int offset_c = 3 + rnd_.PseudoUniform(w - out_w - 7);
av1_jnt_convolve_2d_c(input + offset_r * w + offset_c, w, NULL,
MAX_SB_SIZE, out_w, out_h,
&filter_params_x, &filter_params_y, subx,
suby, &conv_params1);
test_impl(input + offset_r * w + offset_c, w, NULL, MAX_SB_SIZE,
out_w, out_h, &filter_params_x, &filter_params_y,
subx, suby, &conv_params2);
0, out_w, out_h, &filter_params_x,
&filter_params_y, subx, suby,
&conv_params1);
test_impl(input + offset_r * w + offset_c, w, NULL, 0, out_w,
out_h, &filter_params_x, &filter_params_y, subx, suby,
&conv_params2);
for (j = 0; j < out_h; ++j)
for (k = 0; k < out_w; ++k) {
......@@ -275,9 +275,9 @@ void AV1HighbdConvolve2DTest::RunCheckOutput(
InterpFilterParams filter_params_y =
av1_get_interp_filter_params((InterpFilter)vfilter);
ConvolveParams conv_params1 =
get_conv_params_no_round(0, 0, 0, output, MAX_SB_SIZE);
get_conv_params_no_round(0, 0, 0, output, MAX_SB_SIZE, 1);
ConvolveParams conv_params2 =
get_conv_params_no_round(0, 0, 0, output2, MAX_SB_SIZE);
get_conv_params_no_round(0, 0, 0, output2, MAX_SB_SIZE, 1);
for (subx = 0; subx < 16; ++subx)
for (suby = 0; suby < 16; ++suby) {
......
......@@ -255,7 +255,8 @@ class ConvolveScaleTestBase : public ::testing::Test {
filter_x_.set(ntaps_x_, false);
filter_y_.set(ntaps_y_, true);
convolve_params_ = get_conv_params_no_round(0, avg_ != false, 0, NULL, 0);
convolve_params_ =
get_conv_params_no_round(0, avg_ != false, 0, NULL, 0, 1);
delete image_;
image_ = new TestImage<SrcPixel>(width_, height_, bd_);
......
......@@ -140,7 +140,7 @@ void AV1WarpFilterTest::RunCheckOutput(warp_affine_func test_impl) {
dsta[j] = v;
dstb[j] = v;
}
conv_params = get_conv_params_no_round(0, 0, 0, dsta, out_w);
conv_params = get_conv_params_no_round(0, 0, 0, dsta, out_w, 1);
} else {
conv_params = get_conv_params(0, 0, 0);
}
......@@ -158,7 +158,7 @@ void AV1WarpFilterTest::RunCheckOutput(warp_affine_func test_impl) {
out_h, out_w, sub_x, sub_y, &conv_params, alpha,
beta, gamma, delta);
if (use_no_round) {
conv_params = get_conv_params_no_round(0, 0, 0, dstb, out_w);
conv_params = get_conv_params_no_round(0, 0, 0, dstb, out_w, 1);
}
#if CONFIG_JNT_COMP
if (jj >= 4) {
......@@ -332,7 +332,7 @@ void AV1HighbdWarpFilterTest::RunCheckOutput(
dsta[j] = v;
dstb[j] = v;
}
conv_params = get_conv_params_no_round(0, 0, 0, dsta, out_w);
conv_params = get_conv_params_no_round(0, 0, 0, dsta, out_w, 1);
} else {
conv_params = get_conv_params(0, 0, 0);
}
......@@ -351,7 +351,7 @@ void AV1HighbdWarpFilterTest::RunCheckOutput(
if (use_no_round) {
// TODO(angiebird): Change this to test_impl once we have SIMD
// implementation
conv_params = get_conv_params_no_round(0, 0, 0, dstb, out_w);
conv_params = get_conv_params_no_round(0, 0, 0, dstb, out_w, 1);
}
#if CONFIG_JNT_COMP
if (jj >= 4) {
......
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