Commit b09e55cf authored by Cheng Chen's avatar Cheng Chen

Revert "JNT_COMP: turn off for one_sided_compound"

This reverts commit 060e192b.

Change-Id: I5700d351a3cbb682ec49a0efb9cca4d0e83f9a3a
parent a6a486c1
...@@ -1385,28 +1385,6 @@ static INLINE int use_compressed_header(const AV1_COMMON *cm) { ...@@ -1385,28 +1385,6 @@ static INLINE int use_compressed_header(const AV1_COMMON *cm) {
#endif // CONFIG_NEW_MULTISYMBOL #endif // CONFIG_NEW_MULTISYMBOL
} }
#if CONFIG_JNT_COMP
static INLINE int has_two_sided_comp_refs(const AV1_COMMON *cm,
const MB_MODE_INFO *mbmi) {
if (!has_second_ref(mbmi)) return 0;
const int bck_idx = cm->frame_refs[mbmi->ref_frame[0] - LAST_FRAME].idx;
const int fwd_idx = cm->frame_refs[mbmi->ref_frame[1] - LAST_FRAME].idx;
if (bck_idx < 0 || fwd_idx < 0) return 0;
const int cur_frame_index = cm->cur_frame->cur_frame_offset;
const int bck_frame_index =
cm->buffer_pool->frame_bufs[bck_idx].cur_frame_offset;
const int fwd_frame_index =
cm->buffer_pool->frame_bufs[fwd_idx].cur_frame_offset;
return ((bck_frame_index > cur_frame_index) &&
(fwd_frame_index < cur_frame_index)) ||
((bck_frame_index < cur_frame_index) &&
(fwd_frame_index > cur_frame_index));
}
#endif // CONFIG_JNT_COMP
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif
......
...@@ -115,7 +115,7 @@ static INLINE int get_comp_index_context(const AV1_COMMON *cm, ...@@ -115,7 +115,7 @@ static INLINE int get_comp_index_context(const AV1_COMMON *cm,
if (above_mi) { if (above_mi) {
const MB_MODE_INFO *above_mbmi = &above_mi->mbmi; const MB_MODE_INFO *above_mbmi = &above_mi->mbmi;
if (has_two_sided_comp_refs(cm, above_mbmi)) if (has_second_ref(above_mbmi))
above_ctx = above_mbmi->compound_idx; above_ctx = above_mbmi->compound_idx;
else if (above_mbmi->ref_frame[0] == ALTREF_FRAME) else if (above_mbmi->ref_frame[0] == ALTREF_FRAME)
above_ctx = 1; above_ctx = 1;
...@@ -123,7 +123,7 @@ static INLINE int get_comp_index_context(const AV1_COMMON *cm, ...@@ -123,7 +123,7 @@ static INLINE int get_comp_index_context(const AV1_COMMON *cm,
if (left_mi) { if (left_mi) {
const MB_MODE_INFO *left_mbmi = &left_mi->mbmi; const MB_MODE_INFO *left_mbmi = &left_mi->mbmi;
if (has_two_sided_comp_refs(cm, left_mbmi)) if (has_second_ref(left_mbmi))
left_ctx = left_mbmi->compound_idx; left_ctx = left_mbmi->compound_idx;
else if (left_mbmi->ref_frame[0] == ALTREF_FRAME) else if (left_mbmi->ref_frame[0] == ALTREF_FRAME)
left_ctx = 1; left_ctx = 1;
......
...@@ -933,11 +933,11 @@ typedef struct SubpelParams { ...@@ -933,11 +933,11 @@ typedef struct SubpelParams {
#if CONFIG_JNT_COMP #if CONFIG_JNT_COMP
void av1_jnt_comp_weight_assign(const AV1_COMMON *cm, const MB_MODE_INFO *mbmi, void av1_jnt_comp_weight_assign(const AV1_COMMON *cm, const MB_MODE_INFO *mbmi,
int order_idx, int *fwd_offset, int order_idx, int *fwd_offset, int *bck_offset,
int *bck_offset) { int is_compound) {
assert(fwd_offset != NULL && bck_offset != NULL); assert(fwd_offset != NULL && bck_offset != NULL);
if (has_two_sided_comp_refs(cm, mbmi)) { if (is_compound) {
int bck_idx = cm->frame_refs[mbmi->ref_frame[0] - LAST_FRAME].idx; int bck_idx = cm->frame_refs[mbmi->ref_frame[0] - LAST_FRAME].idx;
int fwd_idx = cm->frame_refs[mbmi->ref_frame[1] - LAST_FRAME].idx; int fwd_idx = cm->frame_refs[mbmi->ref_frame[1] - LAST_FRAME].idx;
int bck_frame_index = 0, fwd_frame_index = 0; int bck_frame_index = 0, fwd_frame_index = 0;
...@@ -1298,7 +1298,7 @@ static INLINE void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -1298,7 +1298,7 @@ static INLINE void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
get_conv_params_no_round(ref, ref, plane, tmp_dst, MAX_SB_SIZE); get_conv_params_no_round(ref, ref, plane, tmp_dst, MAX_SB_SIZE);
#if CONFIG_JNT_COMP #if CONFIG_JNT_COMP
av1_jnt_comp_weight_assign(cm, &mi->mbmi, 0, &conv_params.fwd_offset, av1_jnt_comp_weight_assign(cm, &mi->mbmi, 0, &conv_params.fwd_offset,
&conv_params.bck_offset); &conv_params.bck_offset, is_compound);
#endif // CONFIG_JNT_COMP #endif // CONFIG_JNT_COMP
#else #else
......
...@@ -559,10 +559,11 @@ void av1_build_wedge_inter_predictor_from_buf(MACROBLOCKD *xd, BLOCK_SIZE bsize, ...@@ -559,10 +559,11 @@ void av1_build_wedge_inter_predictor_from_buf(MACROBLOCKD *xd, BLOCK_SIZE bsize,
int ext_dst_stride0[3], int ext_dst_stride0[3],
uint8_t *ext_dst1[3], uint8_t *ext_dst1[3],
int ext_dst_stride1[3]); int ext_dst_stride1[3]);
#if CONFIG_JNT_COMP #if CONFIG_JNT_COMP
void av1_jnt_comp_weight_assign(const AV1_COMMON *cm, const MB_MODE_INFO *mbmi, void av1_jnt_comp_weight_assign(const AV1_COMMON *cm, const MB_MODE_INFO *mbmi,
int order_idx, int *fwd_offset, int order_idx, int *fwd_offset, int *bck_offset,
int *bck_offset); int is_compound);
#endif // CONFIG_JNT_COMP #endif // CONFIG_JNT_COMP
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -2155,7 +2155,7 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi, ...@@ -2155,7 +2155,7 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
is_compound = has_second_ref(mbmi); is_compound = has_second_ref(mbmi);
#if CONFIG_JNT_COMP #if CONFIG_JNT_COMP
if (has_two_sided_comp_refs(cm, mbmi)) { if (is_compound) {
const int comp_index_ctx = get_comp_index_context(cm, xd); const int comp_index_ctx = get_comp_index_context(cm, xd);
#if CONFIG_NEW_MULTISYMBOL #if CONFIG_NEW_MULTISYMBOL
mbmi->compound_idx = aom_read_symbol( mbmi->compound_idx = aom_read_symbol(
...@@ -2166,8 +2166,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi, ...@@ -2166,8 +2166,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
#endif // CONFIG_NEW_MULTISYMBOL #endif // CONFIG_NEW_MULTISYMBOL
if (xd->counts) if (xd->counts)
++xd->counts->compound_index[comp_index_ctx][mbmi->compound_idx]; ++xd->counts->compound_index[comp_index_ctx][mbmi->compound_idx];
} else {
mbmi->compound_idx = 1;
} }
#endif // CONFIG_JNT_COMP #endif // CONFIG_JNT_COMP
......
...@@ -1499,13 +1499,13 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row, ...@@ -1499,13 +1499,13 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#if CONFIG_JNT_COMP #if CONFIG_JNT_COMP
#if CONFIG_NEW_MULTISYMBOL #if CONFIG_NEW_MULTISYMBOL
if (has_two_sided_comp_refs(cm, mbmi)) { if (has_second_ref(mbmi)) {
const int comp_index_ctx = get_comp_index_context(cm, xd); const int comp_index_ctx = get_comp_index_context(cm, xd);
aom_write_symbol(w, mbmi->compound_idx, aom_write_symbol(w, mbmi->compound_idx,
ec_ctx->compound_index_cdf[comp_index_ctx], 2); ec_ctx->compound_index_cdf[comp_index_ctx], 2);
} }
#else #else
if (has_two_sided_comp_refs(cm, mbmi)) { if (has_second_ref(mbmi)) {
const int comp_index_ctx = get_comp_index_context(cm, xd); const int comp_index_ctx = get_comp_index_context(cm, xd);
aom_write(w, mbmi->compound_idx, aom_write(w, mbmi->compound_idx,
ec_ctx->compound_index_probs[comp_index_ctx]); ec_ctx->compound_index_probs[comp_index_ctx]);
......
...@@ -660,7 +660,7 @@ static void update_state(const AV1_COMP *const cpi, TileDataEnc *tile_data, ...@@ -660,7 +660,7 @@ static void update_state(const AV1_COMP *const cpi, TileDataEnc *tile_data,
#if CONFIG_JNT_COMP #if CONFIG_JNT_COMP
#if !CONFIG_NEW_MULTISYMBOL #if !CONFIG_NEW_MULTISYMBOL
if (has_two_sided_comp_refs(cm, mbmi)) { if (has_second_ref(mbmi)) {
const int comp_index_ctx = get_comp_index_context(cm, xd); const int comp_index_ctx = get_comp_index_context(cm, xd);
++td->counts->compound_index[comp_index_ctx][mbmi->compound_idx]; ++td->counts->compound_index[comp_index_ctx][mbmi->compound_idx];
} }
......
...@@ -5990,7 +5990,7 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x, ...@@ -5990,7 +5990,7 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
#if CONFIG_JNT_COMP #if CONFIG_JNT_COMP
const int order_idx = id != 0; const int order_idx = id != 0;
av1_jnt_comp_weight_assign(cm, mbmi, order_idx, &xd->jcp_param.fwd_offset, av1_jnt_comp_weight_assign(cm, mbmi, order_idx, &xd->jcp_param.fwd_offset,
&xd->jcp_param.bck_offset); &xd->jcp_param.bck_offset, 1);
#endif // CONFIG_JNT_COMP #endif // CONFIG_JNT_COMP
// Do compound motion search on the current reference frame. // Do compound motion search on the current reference frame.
...@@ -6706,7 +6706,7 @@ static void build_second_inter_pred(const AV1_COMP *cpi, MACROBLOCK *x, ...@@ -6706,7 +6706,7 @@ static void build_second_inter_pred(const AV1_COMP *cpi, MACROBLOCK *x,
#if CONFIG_JNT_COMP #if CONFIG_JNT_COMP
av1_jnt_comp_weight_assign(cm, mbmi, 0, &xd->jcp_param.fwd_offset, av1_jnt_comp_weight_assign(cm, mbmi, 0, &xd->jcp_param.fwd_offset,
&xd->jcp_param.bck_offset); &xd->jcp_param.bck_offset, 1);
#endif // CONFIG_JNT_COMP #endif // CONFIG_JNT_COMP
if (scaled_ref_frame) { if (scaled_ref_frame) {
...@@ -8245,7 +8245,7 @@ static int64_t handle_inter_mode(const AV1_COMP *const cpi, MACROBLOCK *x, ...@@ -8245,7 +8245,7 @@ static int64_t handle_inter_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
#endif // CONFIG_COMPOUND_SINGLEREF #endif // CONFIG_COMPOUND_SINGLEREF
#if CONFIG_JNT_COMP #if CONFIG_JNT_COMP
if (has_two_sided_comp_refs(cm, mbmi)) { if (is_comp_pred) {
const int comp_index_ctx = get_comp_index_context(cm, xd); const int comp_index_ctx = get_comp_index_context(cm, xd);
rd_stats->rate += x->comp_idx_cost[comp_index_ctx][mbmi->compound_idx]; rd_stats->rate += x->comp_idx_cost[comp_index_ctx][mbmi->compound_idx];
} }
...@@ -9975,7 +9975,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data, ...@@ -9975,7 +9975,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
#if CONFIG_JNT_COMP #if CONFIG_JNT_COMP
{ {
int cum_rate = rate2; int cum_rate = rate2;
mbmi->compound_idx = 1;
MB_MODE_INFO backup_mbmi = *mbmi; MB_MODE_INFO backup_mbmi = *mbmi;
int_mv backup_frame_mv[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME]; int_mv backup_frame_mv[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME];
...@@ -9993,7 +9992,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data, ...@@ -9993,7 +9992,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
for (int comp_idx = 0; comp_idx < 1 + has_second_ref(mbmi); for (int comp_idx = 0; comp_idx < 1 + has_second_ref(mbmi);
++comp_idx) { ++comp_idx) {
if (comp_idx == 0 && !has_two_sided_comp_refs(cm, mbmi)) continue;
RD_STATS rd_stats, rd_stats_y, rd_stats_uv; RD_STATS rd_stats, rd_stats_y, rd_stats_uv;
av1_init_rd_stats(&rd_stats); av1_init_rd_stats(&rd_stats);
av1_init_rd_stats(&rd_stats_y); av1_init_rd_stats(&rd_stats_y);
...@@ -10146,8 +10144,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data, ...@@ -10146,8 +10144,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
ref_idx = sidx; ref_idx = sidx;
if (has_second_ref(mbmi)) ref_idx /= 2; if (has_second_ref(mbmi)) ref_idx /= 2;
mbmi->compound_idx = sidx % 2; mbmi->compound_idx = sidx % 2;
if (mbmi->compound_idx == 0 && !has_two_sided_comp_refs(cm, mbmi))
continue;
#endif // CONFIG_JNT_COMP #endif // CONFIG_JNT_COMP
av1_invalid_rd_stats(&tmp_rd_stats); av1_invalid_rd_stats(&tmp_rd_stats);
......
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