Pass plane into get_conv_params###
This CL allows us to use different interpolation filters for
YUV planes.
Change-Id: I9446d43ae2be5a9a48b8a4cb6efcac43df6196d5
diff --git a/av1/common/convolve.h b/av1/common/convolve.h
index 88b413d..869e93b 100644
--- a/av1/common/convolve.h
+++ b/av1/common/convolve.h
@@ -32,12 +32,14 @@
int dst_stride;
int round_0;
int round_1;
+ int plane;
} ConvolveParams;
-static INLINE ConvolveParams get_conv_params(int ref) {
+static INLINE ConvolveParams get_conv_params(int ref, int plane) {
ConvolveParams conv_params;
conv_params.ref = ref;
conv_params.round = CONVOLVE_OPT_ROUND;
+ conv_params.plane = plane;
return conv_params;
}
@@ -55,7 +57,8 @@
const int subpel_y_q4, int y_step_q4,
ConvolveParams *conv_params);
-static INLINE ConvolveParams get_conv_params_no_round(int ref, int32_t *dst,
+static INLINE ConvolveParams get_conv_params_no_round(int ref, int plane,
+ int32_t *dst,
int dst_stride) {
ConvolveParams conv_params;
conv_params.ref = ref;
@@ -64,6 +67,7 @@
conv_params.round_1 = 1;
conv_params.dst = dst;
conv_params.dst_stride = dst_stride;
+ conv_params.plane = plane;
return conv_params;
}
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index 566a911..d11f638 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -631,9 +631,7 @@
#if CONFIG_SUPERTX
int wedge_offset_x, int wedge_offset_y,
#endif // CONFIG_SUPERTX
-#if CONFIG_COMPOUND_SEGMENT || CONFIG_GLOBAL_MOTION
int plane,
-#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_GLOBAL_MOTION
#if CONFIG_GLOBAL_MOTION
int is_global, int p_col, int p_row,
int ref,
@@ -650,7 +648,7 @@
#else
InterpFilter tmp_ipf = interp_filter;
#endif // CONFIG_DUAL_FILTER
- ConvolveParams conv_params = get_conv_params(0);
+ ConvolveParams conv_params = get_conv_params(0, plane);
#if CONFIG_AOM_HIGHBITDEPTH
DECLARE_ALIGNED(16, uint8_t, tmp_dst_[2 * MAX_SB_SQUARE]);
@@ -852,7 +850,7 @@
MV32 scaled_mv;
int xs, ys, subpel_x, subpel_y;
const int is_scaled = av1_is_scaled(sf);
- ConvolveParams conv_params = get_conv_params(ref);
+ ConvolveParams conv_params = get_conv_params(ref, plane);
x = x_base + idx * x_step;
y = y_base + idy * y_step;
@@ -886,9 +884,7 @@
#if CONFIG_SUPERTX
wedge_offset_x, wedge_offset_y,
#endif // CONFIG_SUPERTX
-#if CONFIG_COMPOUND_SEGMENT
plane,
-#endif // CONFIG_COMPOUND_SEGMENT
#if CONFIG_GLOBAL_MOTION
is_global[ref], (mi_x >> pd->subsampling_x) + x,
(mi_y >> pd->subsampling_y) + y, ref
@@ -971,9 +967,9 @@
#if CONFIG_CONVOLVE_ROUND
ConvolveParams conv_params =
- get_conv_params_no_round(ref, tmp_dst, MAX_SB_SIZE);
+ get_conv_params_no_round(ref, plane, tmp_dst, MAX_SB_SIZE);
#else
- ConvolveParams conv_params = get_conv_params(ref);
+ ConvolveParams conv_params = get_conv_params(ref, plane);
#endif // CONFIG_CONVOLVE_ROUND
for (ref = 0; ref < 1 + is_compound; ++ref) {
const struct scale_factors *const sf = &xd->block_refs[ref]->sf;
@@ -990,9 +986,7 @@
#if CONFIG_SUPERTX
wedge_offset_x, wedge_offset_y,
#endif // CONFIG_SUPERTX
-#if CONFIG_COMPOUND_SEGMENT || CONFIG_GLOBAL_MOTION
plane,
-#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_GLOBAL_MOTION
#if CONFIG_GLOBAL_MOTION
is_global[ref], (mi_x >> pd->subsampling_x) + x,
(mi_y >> pd->subsampling_y) + y, ref,
@@ -1035,7 +1029,7 @@
const int is_compound = has_second_ref(&mi->mbmi);
for (ref = 0; ref < 1 + is_compound; ++ref) {
- ConvolveParams conv_params = get_conv_params(ref);
+ ConvolveParams conv_params = get_conv_params(ref, plane);
const uint8_t *pre =
&pd->pre[ref].buf[(ir * pd->pre[ref].stride + ic) << 2];
#if CONFIG_AOM_HIGHBITDEPTH
@@ -2754,7 +2748,7 @@
MV32 scaled_mv;
int xs, ys, subpel_x, subpel_y;
const int is_scaled = av1_is_scaled(sf);
- ConvolveParams conv_params = get_conv_params(0);
+ ConvolveParams conv_params = get_conv_params(0, plane);
#if CONFIG_GLOBAL_MOTION
WarpedMotionParams *const wm = &xd->global_motion[mi->mbmi.ref_frame[ref]];
const int is_global =
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h
index 1349f9c..fd2e4cc 100644
--- a/av1/common/reconinter.h
+++ b/av1/common/reconinter.h
@@ -300,9 +300,7 @@
#if CONFIG_SUPERTX
int wedge_offset_x, int wedge_offset_y,
#endif // CONFIG_SUPERTX
-#if CONFIG_COMPOUND_SEGMENT || CONFIG_GLOBAL_MOTION
int plane,
-#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_GLOBAL_MOTION
#if CONFIG_GLOBAL_MOTION
int is_global, int p_col, int p_row,
int ref,
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 7a548d8..df26b60 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -5519,11 +5519,12 @@
int id = ite % 2; // Even iterations search in the first reference frame,
// odd iterations search in the second. The predictor
// found for the 'other' reference frame is factored in.
- ConvolveParams conv_params = get_conv_params(0);
+ const int plane = 0;
+ ConvolveParams conv_params = get_conv_params(0, plane);
// Initialized here because of compiler problem in Visual Studio.
- ref_yv12[0] = xd->plane[0].pre[0];
- ref_yv12[1] = xd->plane[0].pre[1];
+ ref_yv12[0] = xd->plane[plane].pre[0];
+ ref_yv12[1] = xd->plane[plane].pre[1];
#if CONFIG_DUAL_FILTER
// reload the filter types
@@ -5556,7 +5557,7 @@
#endif // CONFIG_AOM_HIGHBITDEPTH
// Do compound motion search on the current reference frame.
- if (id) xd->plane[0].pre[0] = ref_yv12[id];
+ if (id) xd->plane[plane].pre[0] = ref_yv12[id];
av1_set_mv_search_range(x, &ref_mv[id].as_mv);
// Use the mv result from the single mode as mv predictor.
@@ -5587,7 +5588,7 @@
unsigned int sse;
if (cpi->sf.use_upsampled_references) {
// Use up-sampled reference frames.
- struct macroblockd_plane *const pd = &xd->plane[0];
+ struct macroblockd_plane *const pd = &xd->plane[plane];
struct buf_2d backup_pred = pd->pre[0];
const YV12_BUFFER_CONFIG *upsampled_ref =
get_upsampled_ref(cpi, refs[id]);
@@ -5627,7 +5628,7 @@
}
// Restore the pointer to the first (possibly scaled) prediction buffer.
- if (id) xd->plane[0].pre[0] = ref_yv12[0];
+ if (id) xd->plane[plane].pre[0] = ref_yv12[0];
if (bestsme < last_besterr[id]) {
frame_mv[refs[id]].as_mv = *best_mv;
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c
index c727000..1e4c715 100644
--- a/av1/encoder/temporal_filter.c
+++ b/av1/encoder/temporal_filter.c
@@ -39,7 +39,8 @@
const MV mv = { mv_row, mv_col };
enum mv_precision mv_precision_uv;
int uv_stride;
- ConvolveParams conv_params = get_conv_params(which_mv);
+ // TODO(angiebird): change plane setting accordingly
+ ConvolveParams conv_params = get_conv_params(which_mv, 0);
#if USE_TEMPORALFILTER_12TAP
#if CONFIG_DUAL_FILTER
diff --git a/test/av1_convolve_optimz_test.cc b/test/av1_convolve_optimz_test.cc
index 586846f..a4bb7e7 100644
--- a/test/av1_convolve_optimz_test.cc
+++ b/test/av1_convolve_optimz_test.cc
@@ -73,7 +73,8 @@
filter_ = GET_PARAM(4);
subpel_ = GET_PARAM(5);
int ref = GET_PARAM(6);
- conv_params_ = get_conv_params(ref);
+ const int plane = 0;
+ conv_params_ = get_conv_params(ref, plane);
alloc_ = new uint8_t[maxBlockSize * 4];
src_ = alloc_ + (vertiOffset * maxWidth);
diff --git a/test/av1_convolve_test.cc b/test/av1_convolve_test.cc
index b75a51f..6de8539 100644
--- a/test/av1_convolve_test.cc
+++ b/test/av1_convolve_test.cc
@@ -52,11 +52,12 @@
int y_step_q4 = 16;
int subpel_x_q4 = 3;
int subpel_y_q4 = 2;
+ const int plane = 0;
int w = 1;
int h = 1;
- ConvolveParams conv_params = get_conv_params(0);
+ ConvolveParams conv_params = get_conv_params(0, plane);
setup_convolve();
@@ -102,8 +103,9 @@
int subpel_x_q4;
int subpel_y_q4;
+ const int plane = 0;
- ConvolveParams conv_params = get_conv_params(0);
+ ConvolveParams conv_params = get_conv_params(0, plane);
ASSERT_LE(filter_size, 12);
setup_convolve();
@@ -160,11 +162,12 @@
int y_step_q4 = 16;
int w = 1;
int h = 1;
+ const int plane = 0;
int subpel_x_q4;
int subpel_y_q4;
- ConvolveParams conv_params = get_conv_params(0);
+ ConvolveParams conv_params = get_conv_params(0, plane);
ASSERT_LE(filter_size_x, 12);
ASSERT_LE(filter_size_y, 12);
@@ -229,11 +232,12 @@
int w = 1;
int h = 1;
+ const int plane = 0;
int subpel_x_q4;
int subpel_y_q4;
- ConvolveParams conv_params = get_conv_params(0);
+ ConvolveParams conv_params = get_conv_params(0, plane);
setup_convolve();