Commit e3a4c1c7 authored by Angie Chiang's avatar Angie Chiang
Browse files

Pass plane into get_conv_params###

This CL allows us to use different interpolation filters for
YUV planes.

Change-Id: I9446d43ae2be5a9a48b8a4cb6efcac43df6196d5
parent 6f938489
......@@ -32,12 +32,14 @@ typedef struct ConvolveParams {
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 @@ void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
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 @@ static INLINE ConvolveParams get_conv_params_no_round(int ref, int32_t *dst,
conv_params.round_1 = 1;
conv_params.dst = dst;
conv_params.dst_stride = dst_stride;
conv_params.plane = plane;
return conv_params;
}
......
......@@ -631,9 +631,7 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
#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 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
#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 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
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 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#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 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#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 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#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 @@ void av1_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, int i, int ir,
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 @@ static void build_inter_predictors_single_buf(MACROBLOCKD *xd, int plane,
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 =
......
......@@ -300,9 +300,7 @@ void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
#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,
......
......@@ -5519,11 +5519,12 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
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 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
#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 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
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 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
}
// 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;
......
......@@ -39,7 +39,8 @@ static void temporal_filter_predictors_mb_c(
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
......
......@@ -73,7 +73,8 @@ class AV1ConvolveOptimzTest : public ::testing::TestWithParam<ConvParams> {
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);
......
......@@ -52,11 +52,12 @@ TEST(AV1ConvolveTest, av1_convolve8) {
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 @@ TEST(AV1ConvolveTest, av1_convolve) {
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 @@ TEST(AV1ConvolveTest, av1_convolve_vert_first) {
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 @@ TEST(AV1ConvolveTest, av1_convolve_avg) {
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();
......
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