JNT_COMP: refactor if statements
Refactor if statement that use frame_offset == -1 to indicate
jnt_comp is not chosen, as distance now can not be negative.
Instead, add a variable use_jnt_comp_avg for the same functionality.
Change-Id: Ie6b9c6ab36131b48bc9e066babada17046729cd8
diff --git a/av1/encoder/mcomp.c b/av1/encoder/mcomp.c
index 463252e..bb50f0f 100644
--- a/av1/encoder/mcomp.c
+++ b/av1/encoder/mcomp.c
@@ -189,7 +189,7 @@
src_address, src_stride, second_pred, mask, \
mask_stride, invert_mask, &sse); \
} else { \
- if (xd->jcp_param.fwd_offset != -1 && xd->jcp_param.bck_offset != -1) \
+ if (xd->jcp_param.use_jnt_comp_avg) \
thismse = vfp->jsvaf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
src_address, src_stride, &sse, second_pred, \
&xd->jcp_param); \
@@ -384,7 +384,7 @@
mask, mask_stride, invert_mask);
} else {
#if CONFIG_JNT_COMP
- if (xd->jcp_param.fwd_offset != -1 && xd->jcp_param.bck_offset != -1)
+ if (xd->jcp_param.use_jnt_comp_avg)
aom_jnt_comp_avg_pred(comp_pred, second_pred, w, h, y + offset,
y_stride, &xd->jcp_param);
else
@@ -407,7 +407,7 @@
mask, mask_stride, invert_mask);
} else {
#if CONFIG_JNT_COMP
- if (xd->jcp_param.fwd_offset != -1 && xd->jcp_param.bck_offset != -1)
+ if (xd->jcp_param.use_jnt_comp_avg)
aom_jnt_comp_avg_pred(comp_pred, second_pred, w, h, y + offset,
y_stride, &xd->jcp_param);
else
@@ -712,7 +712,7 @@
mask_stride, invert_mask);
} else {
#if CONFIG_JNT_COMP
- if (xd->jcp_param.fwd_offset != -1 && xd->jcp_param.bck_offset != -1)
+ if (xd->jcp_param.use_jnt_comp_avg)
aom_jnt_comp_avg_upsampled_pred(pred, second_pred, w, h, subpel_x_q3,
subpel_y_q3, y, y_stride,
&xd->jcp_param);
@@ -823,8 +823,7 @@
mask_stride, invert_mask, &sse);
} else {
#if CONFIG_JNT_COMP
- if (xd->jcp_param.fwd_offset != -1 &&
- xd->jcp_param.bck_offset != -1)
+ if (xd->jcp_param.use_jnt_comp_avg)
thismse =
vfp->jsvaf(pre_address, y_stride, sp(tc), sp(tr), src_address,
src_stride, &sse, second_pred, &xd->jcp_param);
@@ -875,7 +874,7 @@
mask_stride, invert_mask, &sse);
} else {
#if CONFIG_JNT_COMP
- if (xd->jcp_param.fwd_offset != -1 && xd->jcp_param.bck_offset != -1)
+ if (xd->jcp_param.use_jnt_comp_avg)
thismse =
vfp->jsvaf(pre_address, y_stride, sp(tc), sp(tr), src_address,
src_stride, &sse, second_pred, &xd->jcp_param);
@@ -1458,7 +1457,7 @@
unsigned int unused;
#if CONFIG_JNT_COMP
- if (xd->jcp_param.fwd_offset != -1 && xd->jcp_param.bck_offset != -1)
+ if (xd->jcp_param.use_jnt_comp_avg)
return vfp->jsvaf(get_buf_from_mv(in_what, best_mv), in_what->stride, 0, 0,
what->buf, what->stride, &unused, second_pred,
&xd->jcp_param) +
@@ -2482,7 +2481,7 @@
mvsad_err_cost(x, best_mv, &fcenter_mv, error_per_bit);
} else {
#if CONFIG_JNT_COMP
- if (xd->jcp_param.fwd_offset != -1 && xd->jcp_param.bck_offset != -1)
+ if (xd->jcp_param.use_jnt_comp_avg)
best_sad = fn_ptr->jsdaf(what->buf, what->stride,
get_buf_from_mv(in_what, best_mv),
in_what->stride, second_pred, &xd->jcp_param) +
@@ -2510,7 +2509,7 @@
second_pred, mask, mask_stride, invert_mask);
} else {
#if CONFIG_JNT_COMP
- if (xd->jcp_param.fwd_offset != -1 && xd->jcp_param.bck_offset != -1)
+ if (xd->jcp_param.use_jnt_comp_avg)
sad = fn_ptr->jsdaf(what->buf, what->stride,
get_buf_from_mv(in_what, &mv), in_what->stride,
second_pred, &xd->jcp_param);
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 416171e..7734d59 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -5894,7 +5894,8 @@
#if CONFIG_JNT_COMP
const int order_idx = id != 0;
av1_jnt_comp_weight_assign(cm, mbmi, order_idx, &xd->jcp_param.fwd_offset,
- &xd->jcp_param.bck_offset, 1);
+ &xd->jcp_param.bck_offset,
+ &xd->jcp_param.use_jnt_comp_avg, 1);
#endif // CONFIG_JNT_COMP
// Do compound motion search on the current reference frame.
@@ -6537,7 +6538,8 @@
#if CONFIG_JNT_COMP
av1_jnt_comp_weight_assign(cm, mbmi, 0, &xd->jcp_param.fwd_offset,
- &xd->jcp_param.bck_offset, 1);
+ &xd->jcp_param.bck_offset,
+ &xd->jcp_param.use_jnt_comp_avg, 1);
#endif // CONFIG_JNT_COMP
if (scaled_ref_frame) {