Commit c6b17d82 authored by Zoe Liu's avatar Zoe Liu
Browse files

Remove redundant macro USE_UNI_COMP_REFS

USE_UNI_COMP_REFS is always true when ext-comp-refs is enabled and is
always false otherwise.

Change-Id: Ic6061a4ab88a2ebfeb11f178872ab13909060c0b
parent 38427e8e
...@@ -413,15 +413,11 @@ typedef enum ATTRIBUTE_PACKED { ...@@ -413,15 +413,11 @@ typedef enum ATTRIBUTE_PACKED {
} AOM_REFFRAME; } AOM_REFFRAME;
#if CONFIG_EXT_COMP_REFS #if CONFIG_EXT_COMP_REFS
#define USE_UNI_COMP_REFS 1
typedef enum ATTRIBUTE_PACKED { typedef enum ATTRIBUTE_PACKED {
UNIDIR_COMP_REFERENCE, UNIDIR_COMP_REFERENCE,
BIDIR_COMP_REFERENCE, BIDIR_COMP_REFERENCE,
COMP_REFERENCE_TYPES, COMP_REFERENCE_TYPES,
} COMP_REFERENCE_TYPE; } COMP_REFERENCE_TYPE;
#else // !CONFIG_EXT_COMP_REFS
#define USE_UNI_COMP_REFS 0
#endif // CONFIG_EXT_COMP_REFS #endif // CONFIG_EXT_COMP_REFS
typedef enum ATTRIBUTE_PACKED { typedef enum ATTRIBUTE_PACKED {
......
...@@ -287,10 +287,6 @@ static INLINE int8_t av1_ref_frame_type(const MV_REFERENCE_FRAME *const rf) { ...@@ -287,10 +287,6 @@ static INLINE int8_t av1_ref_frame_type(const MV_REFERENCE_FRAME *const rf) {
if (rf[1] > INTRA_FRAME) { if (rf[1] > INTRA_FRAME) {
#if CONFIG_EXT_COMP_REFS #if CONFIG_EXT_COMP_REFS
int8_t uni_comp_ref_idx = av1_uni_comp_ref_idx(rf); int8_t uni_comp_ref_idx = av1_uni_comp_ref_idx(rf);
#if !USE_UNI_COMP_REFS
// NOTE: uni-directional comp refs disabled
assert(uni_comp_ref_idx < 0);
#endif // !USE_UNI_COMP_REFS
if (uni_comp_ref_idx >= 0) { if (uni_comp_ref_idx >= 0) {
assert((TOTAL_REFS_PER_FRAME + FWD_REFS * BWD_REFS + uni_comp_ref_idx) < assert((TOTAL_REFS_PER_FRAME + FWD_REFS * BWD_REFS + uni_comp_ref_idx) <
MODE_CTX_REF_FRAMES); MODE_CTX_REF_FRAMES);
......
...@@ -584,11 +584,6 @@ int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm, ...@@ -584,11 +584,6 @@ int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm,
if ((CHECK_LAST_OR_LAST2(frfa) && CHECK_LAST_OR_LAST2(frfl))) { if ((CHECK_LAST_OR_LAST2(frfa) && CHECK_LAST_OR_LAST2(frfl))) {
pred_context = 4; pred_context = 4;
} else { } else {
// NOTE(zoeliu): Following assert may be removed once confirmed.
#if !USE_UNI_COMP_REFS
// TODO(zoeliu): To further study the UNIDIR scenario
assert(CHECK_GOLDEN_OR_LAST3(frfa) || CHECK_GOLDEN_OR_LAST3(frfl));
#endif // !USE_UNI_COMP_REFS
pred_context = 2; pred_context = 2;
} }
} }
......
...@@ -1472,7 +1472,6 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(AV1_COMMON *cm, ...@@ -1472,7 +1472,6 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(AV1_COMMON *cm,
const MACROBLOCKD *xd, const MACROBLOCKD *xd,
aom_reader *r) { aom_reader *r) {
const int ctx = av1_get_comp_reference_type_context(xd); const int ctx = av1_get_comp_reference_type_context(xd);
#if USE_UNI_COMP_REFS
COMP_REFERENCE_TYPE comp_ref_type; COMP_REFERENCE_TYPE comp_ref_type;
#if CONFIG_VAR_REFS #if CONFIG_VAR_REFS
if ((L_OR_L2(cm) || L3_OR_G(cm)) && BWD_OR_ALT(cm)) { if ((L_OR_L2(cm) || L3_OR_G(cm)) && BWD_OR_ALT(cm)) {
...@@ -1494,10 +1493,6 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(AV1_COMMON *cm, ...@@ -1494,10 +1493,6 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(AV1_COMMON *cm,
comp_ref_type = UNIDIR_COMP_REFERENCE; comp_ref_type = UNIDIR_COMP_REFERENCE;
} }
#endif // CONFIG_VAR_REFS #endif // CONFIG_VAR_REFS
#else // !USE_UNI_COMP_REFS
// TODO(zoeliu): Temporarily turn off uni-directional comp refs
const COMP_REFERENCE_TYPE comp_ref_type = BIDIR_COMP_REFERENCE;
#endif // USE_UNI_COMP_REFS
FRAME_COUNTS *counts = xd->counts; FRAME_COUNTS *counts = xd->counts;
if (counts) ++counts->comp_ref_type[ctx][comp_ref_type]; if (counts) ++counts->comp_ref_type[ctx][comp_ref_type];
return comp_ref_type; // UNIDIR_COMP_REFERENCE or BIDIR_COMP_REFERENCE return comp_ref_type; // UNIDIR_COMP_REFERENCE or BIDIR_COMP_REFERENCE
...@@ -1512,11 +1507,9 @@ static void update_comp_reference_type(AV1_COMMON *cm, const MACROBLOCKD *xd, ...@@ -1512,11 +1507,9 @@ static void update_comp_reference_type(AV1_COMMON *cm, const MACROBLOCKD *xd,
comp_ref_type == BIDIR_COMP_REFERENCE); comp_ref_type == BIDIR_COMP_REFERENCE);
(void)cm; (void)cm;
const int ctx = av1_get_comp_reference_type_context(xd); const int ctx = av1_get_comp_reference_type_context(xd);
#if USE_UNI_COMP_REFS
#if CONFIG_NEW_MULTISYMBOL #if CONFIG_NEW_MULTISYMBOL
update_cdf(xd->tile_ctx->comp_ref_type_cdf[ctx], comp_ref_type, 2); update_cdf(xd->tile_ctx->comp_ref_type_cdf[ctx], comp_ref_type, 2);
#endif // CONFIG_NEW_MULTISYMBOL #endif // CONFIG_NEW_MULTISYMBOL
#endif // USE_UNI_COMP_REFS
FRAME_COUNTS *counts = xd->counts; FRAME_COUNTS *counts = xd->counts;
if (counts) ++counts->comp_ref_type[ctx][comp_ref_type]; if (counts) ++counts->comp_ref_type[ctx][comp_ref_type];
} }
...@@ -1604,11 +1597,6 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd, ...@@ -1604,11 +1597,6 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
const COMP_REFERENCE_TYPE comp_ref_type = const COMP_REFERENCE_TYPE comp_ref_type =
read_comp_reference_type(cm, xd, r); read_comp_reference_type(cm, xd, r);
#if !USE_UNI_COMP_REFS
// TODO(zoeliu): Temporarily turn off uni-directional comp refs
assert(comp_ref_type == BIDIR_COMP_REFERENCE);
#endif // !USE_UNI_COMP_REFS
if (comp_ref_type == UNIDIR_COMP_REFERENCE) { if (comp_ref_type == UNIDIR_COMP_REFERENCE) {
const int ctx = av1_get_pred_context_uni_comp_ref_p(xd); const int ctx = av1_get_pred_context_uni_comp_ref_p(xd);
int bit; int bit;
...@@ -2360,15 +2348,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi, ...@@ -2360,15 +2348,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
} }
#endif // CONFIG_JNT_COMP #endif // CONFIG_JNT_COMP
#if CONFIG_EXT_COMP_REFS
#if !USE_UNI_COMP_REFS
// NOTE: uni-directional comp refs disabled
if (is_compound)
assert(mbmi->ref_frame[0] < BWDREF_FRAME &&
mbmi->ref_frame[1] >= BWDREF_FRAME);
#endif // !USE_UNI_COMP_REFS
#endif // CONFIG_EXT_COMP_REFS
#if CONFIG_COMPOUND_SINGLEREF #if CONFIG_COMPOUND_SINGLEREF
if (!is_compound) if (!is_compound)
is_singleref_comp_mode = is_singleref_comp_mode =
......
...@@ -829,7 +829,6 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd, ...@@ -829,7 +829,6 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
const COMP_REFERENCE_TYPE comp_ref_type = has_uni_comp_refs(mbmi) const COMP_REFERENCE_TYPE comp_ref_type = has_uni_comp_refs(mbmi)
? UNIDIR_COMP_REFERENCE ? UNIDIR_COMP_REFERENCE
: BIDIR_COMP_REFERENCE; : BIDIR_COMP_REFERENCE;
#if USE_UNI_COMP_REFS
#if CONFIG_VAR_REFS #if CONFIG_VAR_REFS
if ((L_OR_L2(cm) || L3_OR_G(cm)) && BWD_OR_ALT(cm)) if ((L_OR_L2(cm) || L3_OR_G(cm)) && BWD_OR_ALT(cm))
if (L_AND_L2(cm) || L_AND_L3(cm) || L_AND_G(cm) || BWD_AND_ALT(cm)) if (L_AND_L2(cm) || L_AND_L3(cm) || L_AND_G(cm) || BWD_AND_ALT(cm))
...@@ -846,10 +845,6 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd, ...@@ -846,10 +845,6 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
else else
assert(comp_ref_type == UNIDIR_COMP_REFERENCE); assert(comp_ref_type == UNIDIR_COMP_REFERENCE);
#endif // CONFIG_VAR_REFS #endif // CONFIG_VAR_REFS
#else // !USE_UNI_COMP_REFS
// NOTE: uni-directional comp refs disabled
assert(comp_ref_type == BIDIR_COMP_REFERENCE);
#endif // USE_UNI_COMP_REFS
if (comp_ref_type == UNIDIR_COMP_REFERENCE) { if (comp_ref_type == UNIDIR_COMP_REFERENCE) {
const int bit = mbmi->ref_frame[0] == BWDREF_FRAME; const int bit = mbmi->ref_frame[0] == BWDREF_FRAME;
......
...@@ -1087,10 +1087,6 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row, ...@@ -1087,10 +1087,6 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
const COMP_REFERENCE_TYPE comp_ref_type = has_uni_comp_refs(mbmi) const COMP_REFERENCE_TYPE comp_ref_type = has_uni_comp_refs(mbmi)
? UNIDIR_COMP_REFERENCE ? UNIDIR_COMP_REFERENCE
: BIDIR_COMP_REFERENCE; : BIDIR_COMP_REFERENCE;
#if !USE_UNI_COMP_REFS
// TODO(zoeliu): Temporarily turn off uni-directional comp refs
assert(comp_ref_type == BIDIR_COMP_REFERENCE);
#endif // !USE_UNI_COMP_REFS
counts->comp_ref_type[av1_get_comp_reference_type_context(xd)] counts->comp_ref_type[av1_get_comp_reference_type_context(xd)]
[comp_ref_type]++; [comp_ref_type]++;
......
...@@ -6526,11 +6526,7 @@ static void estimate_ref_frame_costs( ...@@ -6526,11 +6526,7 @@ static void estimate_ref_frame_costs(
ref_bicomp_costs[LAST_FRAME] = ref_bicomp_costs[LAST2_FRAME] = ref_bicomp_costs[LAST_FRAME] = ref_bicomp_costs[LAST2_FRAME] =
ref_bicomp_costs[LAST3_FRAME] = ref_bicomp_costs[GOLDEN_FRAME] = ref_bicomp_costs[LAST3_FRAME] = ref_bicomp_costs[GOLDEN_FRAME] =
#if USE_UNI_COMP_REFS
base_cost + av1_cost_bit(comp_ref_type_p, 1); base_cost + av1_cost_bit(comp_ref_type_p, 1);
#else
base_cost;
#endif // USE_UNI_COMP_REFS
ref_bicomp_costs[BWDREF_FRAME] = ref_bicomp_costs[ALTREF2_FRAME] = 0; ref_bicomp_costs[BWDREF_FRAME] = ref_bicomp_costs[ALTREF2_FRAME] = 0;
ref_bicomp_costs[ALTREF_FRAME] = 0; ref_bicomp_costs[ALTREF_FRAME] = 0;
...@@ -9874,34 +9870,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data, ...@@ -9874,34 +9870,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
(ref_frame_skip_mask[1] & (1 << AOMMAX(0, second_ref_frame)))) (ref_frame_skip_mask[1] & (1 << AOMMAX(0, second_ref_frame))))
continue; continue;
#if CONFIG_EXT_COMP_REFS
// TODO(zoeliu): Following toggle between #if 0/1 and the bug will manifest
// itself.
#if 0
if (!(cpi->ref_frame_flags & flag_list[ref_frame]) ||
(second_ref_frame > INTRA_FRAME &&
(!(cpi->ref_frame_flags & flag_list[second_ref_frame]))))
printf("Frame=%d, bsize=%d, (mi_row,mi_col)=(%d,%d), ref_frame=%d, "
"second_ref_frame=%d\n", cm->current_video_frame, bsize, mi_row,
mi_col, ref_frame, second_ref_frame);
if (!(cpi->ref_frame_flags & flag_list[ref_frame])) continue;
if (second_ref_frame > INTRA_FRAME &&
(!(cpi->ref_frame_flags & flag_list[second_ref_frame])))
continue;
#endif // 0
#if !USE_UNI_COMP_REFS
// NOTE(zoeliu): Temporarily disable uni-directional comp refs
if (second_ref_frame > INTRA_FRAME) {
if (!((ref_frame < BWDREF_FRAME) ^ (second_ref_frame < BWDREF_FRAME)))
continue;
}
assert(second_ref_frame <= INTRA_FRAME ||
((ref_frame < BWDREF_FRAME) ^ (second_ref_frame < BWDREF_FRAME)));
#endif // !USE_UNI_COMP_REFS
#endif // CONFIG_EXT_COMP_REFS
if (mode_skip_mask[ref_frame] & (1 << this_mode)) continue; if (mode_skip_mask[ref_frame] & (1 << this_mode)) continue;
// Test best rd so far against threshold for trying this mode. // Test best rd so far against threshold for trying this mode.
......
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