Distance Weighted Compound: cleanup.
Remove unused part of an array and an unused argument in a function.
Change-Id: I1218673923d4155305ec8db653783df2d460c1d5
diff --git a/av1/common/common_data.h b/av1/common/common_data.h
index 402845c..38e1471 100644
--- a/av1/common/common_data.h
+++ b/av1/common/common_data.h
@@ -434,9 +434,12 @@
static const int quant_dist_weight[4][2] = {
{ 2, 3 }, { 2, 5 }, { 2, 7 }, { 1, MAX_FRAME_DISTANCE }
};
-static const int quant_dist_lookup_table[2][4][2] = {
- { { 9, 7 }, { 11, 5 }, { 12, 4 }, { 13, 3 } },
- { { 7, 9 }, { 5, 11 }, { 4, 12 }, { 3, 13 } },
+
+static const int quant_dist_lookup_table[4][2] = {
+ { 9, 7 },
+ { 11, 5 },
+ { 12, 4 },
+ { 13, 3 },
};
#ifdef __cplusplus
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index f4f8e82..70f4c6d 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -713,8 +713,8 @@
}
void av1_dist_wtd_comp_weight_assign(const AV1_COMMON *cm,
- const MB_MODE_INFO *mbmi, int order_idx,
- int *fwd_offset, int *bck_offset,
+ const MB_MODE_INFO *mbmi, int *fwd_offset,
+ int *bck_offset,
int *use_dist_wtd_comp_avg,
int is_compound) {
assert(fwd_offset != NULL && bck_offset != NULL);
@@ -744,8 +744,8 @@
const int order = d0 <= d1;
if (d0 == 0 || d1 == 0) {
- *fwd_offset = quant_dist_lookup_table[order_idx][3][order];
- *bck_offset = quant_dist_lookup_table[order_idx][3][1 - order];
+ *fwd_offset = quant_dist_lookup_table[3][order];
+ *bck_offset = quant_dist_lookup_table[3][1 - order];
return;
}
@@ -758,8 +758,8 @@
if ((d0 > d1 && d0_c0 < d1_c1) || (d0 <= d1 && d0_c0 > d1_c1)) break;
}
- *fwd_offset = quant_dist_lookup_table[order_idx][i][order];
- *bck_offset = quant_dist_lookup_table[order_idx][i][1 - order];
+ *fwd_offset = quant_dist_lookup_table[i][order];
+ *bck_offset = quant_dist_lookup_table[i][1 - order];
}
// True if the following hold:
@@ -911,7 +911,7 @@
ref, plane, xd->tmp_conv_dst, MAX_SB_SIZE, is_compound, xd->bd);
av1_dist_wtd_comp_weight_assign(
- cm, mi, 0, &inter_pred_params.conv_params.fwd_offset,
+ cm, mi, &inter_pred_params.conv_params.fwd_offset,
&inter_pred_params.conv_params.bck_offset,
&inter_pred_params.conv_params.use_dist_wtd_comp_avg, is_compound);
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h
index c869616..056dc67 100644
--- a/av1/common/reconinter.h
+++ b/av1/common/reconinter.h
@@ -368,8 +368,8 @@
}
void av1_dist_wtd_comp_weight_assign(const AV1_COMMON *cm,
- const MB_MODE_INFO *mbmi, int order_idx,
- int *fwd_offset, int *bck_offset,
+ const MB_MODE_INFO *mbmi, int *fwd_offset,
+ int *bck_offset,
int *use_dist_wtd_comp_avg,
int is_compound);
diff --git a/av1/encoder/compound_type.c b/av1/encoder/compound_type.c
index 4acd6bc..00fa389 100644
--- a/av1/encoder/compound_type.c
+++ b/av1/encoder/compound_type.c
@@ -1341,7 +1341,7 @@
if (have_newmv_in_inter_mode(this_mode)) {
InterPredParams inter_pred_params;
av1_dist_wtd_comp_weight_assign(
- &cpi->common, mbmi, 0, &inter_pred_params.conv_params.fwd_offset,
+ &cpi->common, mbmi, &inter_pred_params.conv_params.fwd_offset,
&inter_pred_params.conv_params.bck_offset,
&inter_pred_params.conv_params.use_dist_wtd_comp_avg, 1);
int mask_value = inter_pred_params.conv_params.fwd_offset * 4;
diff --git a/test/av1_convolve_scale_test.cc b/test/av1_convolve_scale_test.cc
index a1c5746..6530014 100644
--- a/test/av1_convolve_scale_test.cc
+++ b/test/av1_convolve_scale_test.cc
@@ -293,8 +293,8 @@
convolve_params_.do_average = do_average;
} else {
convolve_params_.use_dist_wtd_comp_avg = use_dist_wtd_comp_avg;
- convolve_params_.fwd_offset = quant_dist_lookup_table[i][j][0];
- convolve_params_.bck_offset = quant_dist_lookup_table[i][j][1];
+ convolve_params_.fwd_offset = quant_dist_lookup_table[j][i];
+ convolve_params_.bck_offset = quant_dist_lookup_table[j][1 - i];
convolve_params_.is_compound = is_compound;
convolve_params_.do_average = do_average;
}
diff --git a/test/av1_convolve_test.cc b/test/av1_convolve_test.cc
index 0c90280..4d61f02 100644
--- a/test/av1_convolve_test.cc
+++ b/test/av1_convolve_test.cc
@@ -1172,8 +1172,8 @@
result.push_back(CompoundParam(false, 0, 0));
for (int k = 0; k < 2; ++k) {
for (int l = 0; l < 4; ++l) {
- result.push_back(CompoundParam(true, quant_dist_lookup_table[k][l][0],
- quant_dist_lookup_table[k][l][1]));
+ result.push_back(CompoundParam(true, quant_dist_lookup_table[l][k],
+ quant_dist_lookup_table[l][1 - k]));
}
}
return result;
diff --git a/test/comp_avg_pred_test.h b/test/comp_avg_pred_test.h
index 7f73312..f2fee6d 100644
--- a/test/comp_avg_pred_test.h
+++ b/test/comp_avg_pred_test.h
@@ -117,8 +117,8 @@
for (int ii = 0; ii < 2; ii++) {
for (int jj = 0; jj < 4; jj++) {
- dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
- dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
+ dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[jj][ii];
+ dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[jj][1 - ii];
const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
@@ -160,8 +160,8 @@
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
- dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
- dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
+ dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0];
+ dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][1];
const int num_loops = 1000000000 / (in_w + in_h);
aom_usec_timer timer;
@@ -226,10 +226,9 @@
for (sub_y_q3 = 0; sub_y_q3 < 8; ++sub_y_q3) {
for (int ii = 0; ii < 2; ii++) {
for (int jj = 0; jj < 4; jj++) {
- dist_wtd_comp_params.fwd_offset =
- quant_dist_lookup_table[ii][jj][0];
+ dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[jj][ii];
dist_wtd_comp_params.bck_offset =
- quant_dist_lookup_table[ii][jj][1];
+ quant_dist_lookup_table[jj][1 - ii];
const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
@@ -282,8 +281,8 @@
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
- dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
- dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
+ dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0];
+ dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][1];
int sub_x_q3 = 0;
int sub_y_q3 = 0;
@@ -351,8 +350,8 @@
for (int ii = 0; ii < 2; ii++) {
for (int jj = 0; jj < 4; jj++) {
- dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
- dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
+ dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[jj][ii];
+ dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[jj][1 - ii];
const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
@@ -398,8 +397,8 @@
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
- dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
- dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
+ dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0];
+ dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][1];
const int num_loops = 1000000000 / (in_w + in_h);
aom_usec_timer timer;
@@ -466,10 +465,9 @@
for (sub_y_q3 = 0; sub_y_q3 < 8; ++sub_y_q3) {
for (int ii = 0; ii < 2; ii++) {
for (int jj = 0; jj < 4; jj++) {
- dist_wtd_comp_params.fwd_offset =
- quant_dist_lookup_table[ii][jj][0];
+ dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[jj][ii];
dist_wtd_comp_params.bck_offset =
- quant_dist_lookup_table[ii][jj][1];
+ quant_dist_lookup_table[jj][1 - ii];
const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
@@ -524,8 +522,8 @@
DIST_WTD_COMP_PARAMS dist_wtd_comp_params;
dist_wtd_comp_params.use_dist_wtd_comp_avg = 1;
- dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
- dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
+ dist_wtd_comp_params.fwd_offset = quant_dist_lookup_table[0][0];
+ dist_wtd_comp_params.bck_offset = quant_dist_lookup_table[0][1];
int sub_x_q3 = 0;
int sub_y_q3 = 0;
const int num_loops = 1000000000 / (in_w + in_h);
diff --git a/test/sad_test.cc b/test/sad_test.cc
index f428b3e..037ed24 100644
--- a/test/sad_test.cc
+++ b/test/sad_test.cc
@@ -564,8 +564,8 @@
void CheckCompAvg() {
for (int j = 0; j < 2; ++j) {
for (int i = 0; i < 4; ++i) {
- jcp_param_.fwd_offset = quant_dist_lookup_table[j][i][0];
- jcp_param_.bck_offset = quant_dist_lookup_table[j][i][1];
+ jcp_param_.fwd_offset = quant_dist_lookup_table[i][j];
+ jcp_param_.bck_offset = quant_dist_lookup_table[i][1 - j];
ReferenceDistWtdCompAvg(0);
dist_wtd_comp_avg(0);
@@ -632,8 +632,8 @@
void CheckSAD() {
for (int j = 0; j < 2; ++j) {
for (int i = 0; i < 4; ++i) {
- jcp_param_.fwd_offset = quant_dist_lookup_table[j][i][0];
- jcp_param_.bck_offset = quant_dist_lookup_table[j][i][1];
+ jcp_param_.fwd_offset = quant_dist_lookup_table[i][j];
+ jcp_param_.bck_offset = quant_dist_lookup_table[i][1 - j];
const unsigned int reference_sad = ReferenceDistWtdSADavg(0);
const unsigned int exp_sad = dist_wtd_SAD_avg(0);
diff --git a/test/variance_test.cc b/test/variance_test.cc
index fa90305..6bb96ce 100644
--- a/test/variance_test.cc
+++ b/test/variance_test.cc
@@ -1004,8 +1004,8 @@
for (int y0 = 0; y0 < 4; ++y0) {
uint32_t sse1, sse2;
uint32_t var1, var2;
- jcp_param_.fwd_offset = quant_dist_lookup_table[x0][y0][0];
- jcp_param_.bck_offset = quant_dist_lookup_table[x0][y0][1];
+ jcp_param_.fwd_offset = quant_dist_lookup_table[y0][x0];
+ jcp_param_.bck_offset = quant_dist_lookup_table[y0][1 - x0];
ASM_REGISTER_STATE_CHECK(var1 = params_.func(ref_, width() + 0, x, y,
src_, width(), &sse1,
sec_, &jcp_param_));
diff --git a/test/warp_filter_test_util.cc b/test/warp_filter_test_util.cc
index 07a2e3f..0e6e8b1 100644
--- a/test/warp_filter_test_util.cc
+++ b/test/warp_filter_test_util.cc
@@ -226,8 +226,8 @@
conv_params.use_dist_wtd_comp_avg = 0;
} else {
conv_params.use_dist_wtd_comp_avg = 1;
- conv_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
- conv_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
+ conv_params.fwd_offset = quant_dist_lookup_table[jj][ii];
+ conv_params.bck_offset = quant_dist_lookup_table[jj][1 - ii];
}
av1_warp_affine_c(mat, input, w, h, stride, output, 32, 32, out_w,
out_h, out_w, sub_x, sub_y, &conv_params, alpha,
@@ -240,8 +240,8 @@
conv_params.use_dist_wtd_comp_avg = 0;
} else {
conv_params.use_dist_wtd_comp_avg = 1;
- conv_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
- conv_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
+ conv_params.fwd_offset = quant_dist_lookup_table[jj][ii];
+ conv_params.bck_offset = quant_dist_lookup_table[jj][1 - ii];
}
test_impl(mat, input, w, h, stride, output2, 32, 32, out_w, out_h,
out_w, sub_x, sub_y, &conv_params, alpha, beta, gamma,
@@ -424,8 +424,8 @@
conv_params.use_dist_wtd_comp_avg = 0;
} else {
conv_params.use_dist_wtd_comp_avg = 1;
- conv_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
- conv_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
+ conv_params.fwd_offset = quant_dist_lookup_table[jj][ii];
+ conv_params.bck_offset = quant_dist_lookup_table[jj][1 - ii];
}
av1_highbd_warp_affine_c(mat, input, w, h, stride, output, 32, 32,
@@ -441,8 +441,8 @@
conv_params.use_dist_wtd_comp_avg = 0;
} else {
conv_params.use_dist_wtd_comp_avg = 1;
- conv_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
- conv_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
+ conv_params.fwd_offset = quant_dist_lookup_table[jj][ii];
+ conv_params.bck_offset = quant_dist_lookup_table[jj][1 - ii];
}
test_impl(mat, input, w, h, stride, output2, 32, 32, out_w, out_h,
out_w, sub_x, sub_y, bd, &conv_params, alpha, beta,