Commit 365e644a authored by Sebastien Alaiwan's avatar Sebastien Alaiwan

Remove compile guards for CONFIG_EXT_REFS

This experiment has been adopted, we can simplify the code
by dropping the associated preprocessor conditionals.

Change-Id: I4705652ac8231ee25f960e8096dc97c2aeed1d20
parent 259d4422
......@@ -412,7 +412,6 @@ enum aome_enc_control_id {
/*!\brief Codec control function to enable automatic set and use
* bwd-pred frames.
*
* Experiment: EXT_REFS
*/
AOME_SET_ENABLEAUTOBWDREF,
......
......@@ -28,9 +28,7 @@
struct av1_extracfg {
int cpu_used; // available cpu percentage in 1/16
unsigned int enable_auto_alt_ref;
#if CONFIG_EXT_REFS
unsigned int enable_auto_bwd_ref;
#endif // CONFIG_EXT_REFS
unsigned int noise_sensitivity;
unsigned int sharpness;
unsigned int static_thresh;
......@@ -93,14 +91,12 @@ struct av1_extracfg {
static struct av1_extracfg default_extra_cfg = {
0, // cpu_used
1, // enable_auto_alt_ref
#if CONFIG_EXT_REFS
0, // enable_auto_bwd_ref
#endif // CONFIG_EXT_REFS
0, // noise_sensitivity
0, // sharpness
0, // static_thresh
0, // tile_columns
0, // tile_rows
0, // enable_auto_bwd_ref
0, // noise_sensitivity
0, // sharpness
0, // static_thresh
0, // tile_columns
0, // tile_rows
#if CONFIG_DEPENDENT_HORZTILES
0, // Dependent Horizontal tiles
#endif
......@@ -275,9 +271,7 @@ static aom_codec_err_t validate_config(aom_codec_alg_priv_t *ctx,
RANGE_CHECK_HI(extra_cfg, motion_vector_unit_test, 2);
RANGE_CHECK_HI(extra_cfg, enable_auto_alt_ref, 2);
#if CONFIG_EXT_REFS
RANGE_CHECK_HI(extra_cfg, enable_auto_bwd_ref, 2);
#endif // CONFIG_EXT_REFS
RANGE_CHECK(extra_cfg, cpu_used, 0, 8);
RANGE_CHECK_HI(extra_cfg, noise_sensitivity, 6);
RANGE_CHECK(extra_cfg, superblock_size, AOM_SUPERBLOCK_SIZE_64X64,
......@@ -561,9 +555,7 @@ static aom_codec_err_t set_encoder_config(
oxcf->speed = extra_cfg->cpu_used;
oxcf->enable_auto_arf = extra_cfg->enable_auto_alt_ref;
#if CONFIG_EXT_REFS
oxcf->enable_auto_brf = extra_cfg->enable_auto_bwd_ref;
#endif // CONFIG_EXT_REFS
oxcf->noise_sensitivity = extra_cfg->noise_sensitivity;
oxcf->sharpness = extra_cfg->sharpness;
......@@ -741,14 +733,12 @@ static aom_codec_err_t ctrl_set_enable_auto_alt_ref(aom_codec_alg_priv_t *ctx,
return update_extra_cfg(ctx, &extra_cfg);
}
#if CONFIG_EXT_REFS
static aom_codec_err_t ctrl_set_enable_auto_bwd_ref(aom_codec_alg_priv_t *ctx,
va_list args) {
struct av1_extracfg extra_cfg = ctx->extra_cfg;
extra_cfg.enable_auto_bwd_ref = CAST(AOME_SET_ENABLEAUTOBWDREF, args);
return update_extra_cfg(ctx, &extra_cfg);
}
#endif // CONFIG_EXT_REFS
static aom_codec_err_t ctrl_set_noise_sensitivity(aom_codec_alg_priv_t *ctx,
va_list args) {
......@@ -1163,17 +1153,8 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
// TODO(jzern) the checks related to cpi's validity should be treated as a
// failure condition, encoder setup is done fully in init() currently.
if (res == AOM_CODEC_OK) {
#if CONFIG_EXT_REFS
size_t data_sz = ALIGN_POWER_OF_TWO(ctx->cfg.g_w, 5) *
ALIGN_POWER_OF_TWO(ctx->cfg.g_h, 5) * get_image_bps(img);
#else
// There's no codec control for multiple alt-refs so check the encoder
// instance for its status to determine the compressed data size.
size_t data_sz = ALIGN_POWER_OF_TWO(ctx->cfg.g_w, 5) *
ALIGN_POWER_OF_TWO(ctx->cfg.g_h, 5) *
get_image_bps(img) / 8 *
(cpi->multi_arf_allowed ? 8 : 2);
#endif // CONFIG_EXT_REFS
if (data_sz < kMinCompressedSize) data_sz = kMinCompressedSize;
if (ctx->cx_data == NULL || ctx->cx_data_sz < data_sz) {
ctx->cx_data_sz = data_sz;
......@@ -1558,9 +1539,7 @@ static aom_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{ AOME_SET_SCALEMODE, ctrl_set_scale_mode },
{ AOME_SET_CPUUSED, ctrl_set_cpuused },
{ AOME_SET_ENABLEAUTOALTREF, ctrl_set_enable_auto_alt_ref },
#if CONFIG_EXT_REFS
{ AOME_SET_ENABLEAUTOBWDREF, ctrl_set_enable_auto_bwd_ref },
#endif // CONFIG_EXT_REFS
{ AOME_SET_SHARPNESS, ctrl_set_sharpness },
{ AOME_SET_STATIC_THRESHOLD, ctrl_set_static_thresh },
{ AV1E_SET_TILE_COLUMNS, ctrl_set_tile_columns },
......
......@@ -50,8 +50,8 @@ struct loopfilter {
uint8_t mode_ref_delta_enabled;
uint8_t mode_ref_delta_update;
// 0 = Intra, Last, Last2+Last3(CONFIG_EXT_REFS),
// GF, BRF(CONFIG_EXT_REFS), ARF2(CONFIG_EXT_REFS), ARF
// 0 = Intra, Last, Last2+Last3,
// GF, BRF, ARF2, ARF
int8_t ref_deltas[TOTAL_REFS_PER_FRAME];
int8_t last_ref_deltas[TOTAL_REFS_PER_FRAME];
......
......@@ -2339,11 +2339,9 @@ void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
#if CONFIG_NEW_MULTISYMBOL
AVERAGE_TILE_CDFS(comp_inter_cdf)
#if CONFIG_EXT_REFS
AVERAGE_TILE_CDFS(comp_ref_cdf)
AVERAGE_TILE_CDFS(comp_bwdref_cdf)
#endif
#endif
#if CONFIG_NEW_MULTISYMBOL
AVERAGE_TILE_CDFS(single_ref_cdf)
......
......@@ -1844,7 +1844,6 @@ static const aom_cdf_prob
#endif // CONFIG_NEW_MULTISYMBOL
#endif // CONFIG_EXT_COMP_REFS
#if CONFIG_EXT_REFS
static const aom_prob default_comp_ref_p[REF_CONTEXTS][FWD_REFS - 1] = {
{ 28, 10, 8 },
{ 77, 27, 26 },
......@@ -1892,39 +1891,17 @@ static const aom_cdf_prob
};
#endif // CONFIG_NEW_MULTISYMBOL
#else // !CONFIG_EXT_REFS
static const aom_prob default_comp_ref_p[REF_CONTEXTS][COMP_REFS - 1] = {
{ 43 }, { 100 }, { 137 }, { 212 }, { 229 },
};
#if CONFIG_NEW_MULTISYMBOL
static const aom_cdf_prob
default_comp_ref_cdf[REF_CONTEXTS][COMP_REFS - 1][CDF_SIZE(2)] = {
{ { AOM_ICDF(43 * 128), AOM_ICDF(32768), 0 } },
{ { AOM_ICDF(100 * 128), AOM_ICDF(32768), 0 } },
{ { AOM_ICDF(137 * 128), AOM_ICDF(32768), 0 } },
{ { AOM_ICDF(212 * 128), AOM_ICDF(32768), 0 } },
{ { AOM_ICDF(229 * 128), AOM_ICDF(32768), 0 } }
};
#endif // CONFIG_NEW_MULTISYMBOL
#endif // CONFIG_EXT_REFS
static const aom_prob default_single_ref_p[REF_CONTEXTS][SINGLE_REFS - 1] = {
#if CONFIG_EXT_REFS
{ 36, 16, 32, 57, 11, 14 },
{ 68, 128, 73, 128, 49, 124 },
{ 136, 236, 127, 170, 81, 238 },
{ 128, 128, 191, 211, 115, 128 },
{ 224, 128, 230, 242, 208, 128 }
#else // !CONFIG_EXT_REFS
{ 31, 25 }, { 72, 80 }, { 147, 148 }, { 197, 191 }, { 235, 247 },
#endif // CONFIG_EXT_REFS
};
#if CONFIG_NEW_MULTISYMBOL
static const aom_cdf_prob
default_single_ref_cdf[REF_CONTEXTS][SINGLE_REFS - 1][CDF_SIZE(2)] = {
#if CONFIG_EXT_REFS
{ { AOM_ICDF(4623), AOM_ICDF(32768), 0 },
{ AOM_ICDF(2110), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4132), AOM_ICDF(32768), 0 },
......@@ -1955,18 +1932,6 @@ static const aom_cdf_prob
{ AOM_ICDF(30969), AOM_ICDF(32768), 0 },
{ AOM_ICDF(26676), AOM_ICDF(32768), 0 },
{ AOM_ICDF(32768), AOM_ICDF(32768), 0 } }
#else // !CONFIG_EXT_REFS
{ { AOM_ICDF(31 * 128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(25 * 128), AOM_ICDF(32768), 0 } },
{ { AOM_ICDF(72 * 128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(80 * 128), AOM_ICDF(32768), 0 } },
{ { AOM_ICDF(147 * 128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(148 * 128), AOM_ICDF(32768), 0 } },
{ { AOM_ICDF(197 * 128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(191 * 128), AOM_ICDF(32768), 0 } },
{ { AOM_ICDF(235 * 128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(247 * 128), AOM_ICDF(32768), 0 } }
#endif // CONFIG_EXT_REFS
};
#endif // CONFIG_NEW_MULTISYMBOL
......@@ -6526,12 +6491,10 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_init_txb_probs(fc);
#endif // LV_MAP_PROB
#endif
#if CONFIG_EXT_REFS
av1_copy(fc->comp_bwdref_prob, default_comp_bwdref_p);
#if CONFIG_NEW_MULTISYMBOL
av1_copy(fc->comp_bwdref_cdf, default_comp_bwdref_cdf);
#endif
#endif // CONFIG_EXT_REFS
av1_copy(fc->single_ref_prob, default_single_ref_p);
#if CONFIG_NEW_MULTISYMBOL
av1_copy(fc->single_ref_cdf, default_single_ref_cdf);
......@@ -6685,7 +6648,6 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
pre_fc->uni_comp_ref_prob[i][j], counts->uni_comp_ref[i][j]);
#endif // CONFIG_EXT_COMP_REFS
#if CONFIG_EXT_REFS
for (i = 0; i < REF_CONTEXTS; i++)
for (j = 0; j < (FWD_REFS - 1); j++)
fc->comp_ref_prob[i][j] = mode_mv_merge_probs(pre_fc->comp_ref_prob[i][j],
......@@ -6694,12 +6656,6 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
for (j = 0; j < (BWD_REFS - 1); j++)
fc->comp_bwdref_prob[i][j] = mode_mv_merge_probs(
pre_fc->comp_bwdref_prob[i][j], counts->comp_bwdref[i][j]);
#else
for (i = 0; i < REF_CONTEXTS; i++)
for (j = 0; j < (COMP_REFS - 1); j++)
fc->comp_ref_prob[i][j] = mode_mv_merge_probs(pre_fc->comp_ref_prob[i][j],
counts->comp_ref[i][j]);
#endif // CONFIG_EXT_REFS
for (i = 0; i < REF_CONTEXTS; i++)
for (j = 0; j < (SINGLE_REFS - 1); j++)
......@@ -6920,15 +6876,11 @@ static void set_default_lf_deltas(struct loopfilter *lf) {
lf->ref_deltas[INTRA_FRAME] = 1;
lf->ref_deltas[LAST_FRAME] = 0;
#if CONFIG_EXT_REFS
lf->ref_deltas[LAST2_FRAME] = lf->ref_deltas[LAST_FRAME];
lf->ref_deltas[LAST3_FRAME] = lf->ref_deltas[LAST_FRAME];
lf->ref_deltas[BWDREF_FRAME] = lf->ref_deltas[LAST_FRAME];
#endif // CONFIG_EXT_REFS
lf->ref_deltas[GOLDEN_FRAME] = -1;
#if CONFIG_EXT_REFS
lf->ref_deltas[ALTREF2_FRAME] = -1;
#endif // CONFIG_EXT_REFS
lf->ref_deltas[ALTREF_FRAME] = -1;
lf->mode_deltas[0] = 0;
......
......@@ -294,19 +294,11 @@ typedef struct frame_contexts {
#endif // CONFIG_NEW_MULTISYMBOL
#endif // CONFIG_EXT_COMP_REFS
aom_prob single_ref_prob[REF_CONTEXTS][SINGLE_REFS - 1];
#if CONFIG_EXT_REFS
aom_prob comp_ref_prob[REF_CONTEXTS][FWD_REFS - 1];
aom_prob comp_bwdref_prob[REF_CONTEXTS][BWD_REFS - 1];
#else
aom_prob comp_ref_prob[REF_CONTEXTS][COMP_REFS - 1];
#endif // CONFIG_EXT_REFS
#if CONFIG_NEW_MULTISYMBOL
#if CONFIG_EXT_REFS
aom_cdf_prob comp_ref_cdf[REF_CONTEXTS][FWD_REFS - 1][CDF_SIZE(2)];
aom_cdf_prob comp_bwdref_cdf[REF_CONTEXTS][BWD_REFS - 1][CDF_SIZE(2)];
#else
aom_cdf_prob comp_ref_cdf[REF_CONTEXTS][COMP_REFS - 1][CDF_SIZE(2)];
#endif // CONFIG_EXT_REFS
#endif
#if CONFIG_COMPOUND_SINGLEREF
aom_prob comp_inter_mode_prob[COMP_INTER_MODE_CONTEXTS];
......@@ -505,12 +497,8 @@ typedef struct FRAME_COUNTS {
unsigned int uni_comp_ref[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1][2];
#endif // CONFIG_EXT_COMP_REFS
unsigned int single_ref[REF_CONTEXTS][SINGLE_REFS - 1][2];
#if CONFIG_EXT_REFS
unsigned int comp_ref[REF_CONTEXTS][FWD_REFS - 1][2];
unsigned int comp_bwdref[REF_CONTEXTS][BWD_REFS - 1][2];
#else
unsigned int comp_ref[REF_CONTEXTS][COMP_REFS - 1][2];
#endif // CONFIG_EXT_REFS
#if CONFIG_COMPOUND_SINGLEREF
unsigned int comp_inter_mode[COMP_INTER_MODE_CONTEXTS][2];
#endif // CONFIG_COMPOUND_SINGLEREF
......
......@@ -389,7 +389,6 @@ typedef enum {
typedef enum {
AOM_LAST_FLAG = 1 << 0,
#if CONFIG_EXT_REFS
AOM_LAST2_FLAG = 1 << 1,
AOM_LAST3_FLAG = 1 << 2,
AOM_GOLD_FLAG = 1 << 3,
......@@ -397,11 +396,6 @@ typedef enum {
AOM_ALT2_FLAG = 1 << 5,
AOM_ALT_FLAG = 1 << 6,
AOM_REFFRAME_ALL = (1 << 7) - 1
#else // !CONFIG_EXT_REFS
AOM_GOLD_FLAG = 1 << 1,
AOM_ALT_FLAG = 1 << 2,
AOM_REFFRAME_ALL = (1 << 3) - 1
#endif // CONFIG_EXT_REFS
} AOM_REFFRAME;
#if CONFIG_EXT_COMP_REFS
......@@ -686,7 +680,6 @@ typedef uint8_t TXFM_CONTEXT;
#define INTRA_FRAME 0
#define LAST_FRAME 1
#if CONFIG_EXT_REFS
#define LAST2_FRAME 2
#define LAST3_FRAME 3
#define GOLDEN_FRAME 4
......@@ -694,23 +687,14 @@ typedef uint8_t TXFM_CONTEXT;
#define ALTREF2_FRAME 6
#define ALTREF_FRAME 7
#define LAST_REF_FRAMES (LAST3_FRAME - LAST_FRAME + 1)
#else // !CONFIG_EXT_REFS
#define GOLDEN_FRAME 2
#define ALTREF_FRAME 3
#endif // CONFIG_EXT_REFS
#define INTER_REFS_PER_FRAME (ALTREF_FRAME - LAST_FRAME + 1)
#define TOTAL_REFS_PER_FRAME (ALTREF_FRAME - INTRA_FRAME + 1)
#define FWD_REFS (GOLDEN_FRAME - LAST_FRAME + 1)
#define FWD_RF_OFFSET(ref) (ref - LAST_FRAME)
#if CONFIG_EXT_REFS
#define BWD_REFS (ALTREF_FRAME - BWDREF_FRAME + 1)
#define BWD_RF_OFFSET(ref) (ref - BWDREF_FRAME)
#else
#define BWD_REFS 1
#define BWD_RF_OFFSET(ref) (ref - ALTREF_FRAME)
#endif // CONFIG_EXT_REFS
#define SINGLE_REFS (FWD_REFS + BWD_REFS)
#if CONFIG_EXT_COMP_REFS
......
......@@ -1534,12 +1534,10 @@ void av1_setup_frame_buf_refs(AV1_COMMON *cm) {
int lst_buf_idx = cm->frame_refs[LAST_FRAME - LAST_FRAME].idx;
int gld_buf_idx = cm->frame_refs[GOLDEN_FRAME - LAST_FRAME].idx;
#if CONFIG_EXT_REFS
int lst2_buf_idx = cm->frame_refs[LAST2_FRAME - LAST_FRAME].idx;
int lst3_buf_idx = cm->frame_refs[LAST3_FRAME - LAST_FRAME].idx;
int bwd_buf_idx = cm->frame_refs[BWDREF_FRAME - LAST_FRAME].idx;
int alt2_buf_idx = cm->frame_refs[ALTREF2_FRAME - LAST_FRAME].idx;
#endif
if (alt_buf_idx >= 0)
cm->cur_frame->alt_frame_offset =
......@@ -1553,7 +1551,6 @@ void av1_setup_frame_buf_refs(AV1_COMMON *cm) {
cm->cur_frame->gld_frame_offset =
cm->buffer_pool->frame_bufs[gld_buf_idx].cur_frame_offset;
#if CONFIG_EXT_REFS
if (lst2_buf_idx >= 0)
cm->cur_frame->lst2_frame_offset =
cm->buffer_pool->frame_bufs[lst2_buf_idx].cur_frame_offset;
......@@ -1569,7 +1566,6 @@ void av1_setup_frame_buf_refs(AV1_COMMON *cm) {
if (alt2_buf_idx >= 0)
cm->cur_frame->alt2_frame_offset =
cm->buffer_pool->frame_bufs[alt2_buf_idx].cur_frame_offset;
#endif
}
#if CONFIG_FRAME_SIGN_BIAS
......@@ -1643,10 +1639,8 @@ static uint32_t mv_sign_reverse(int_mv ref) {
void av1_setup_motion_field(AV1_COMMON *cm) {
int cur_frame_index = cm->cur_frame->cur_frame_offset;
int lst_frame_index = 0, alt_frame_index = 0, gld_frame_index = 0;
#if CONFIG_EXT_REFS
int lst2_frame_index = 0, lst3_frame_index = 0;
int bwd_frame_index = 0, alt2_frame_index = 0;
#endif
TPL_MV_REF *tpl_mvs_base = cm->tpl_mvs;
for (int ref_frame = 0; ref_frame < INTER_REFS_PER_FRAME; ++ref_frame) {
......@@ -1660,12 +1654,10 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
int alt_buf_idx = cm->frame_refs[ALTREF_FRAME - LAST_FRAME].idx;
int lst_buf_idx = cm->frame_refs[LAST_FRAME - LAST_FRAME].idx;
int gld_buf_idx = cm->frame_refs[GOLDEN_FRAME - LAST_FRAME].idx;
#if CONFIG_EXT_REFS
int lst2_buf_idx = cm->frame_refs[LAST2_FRAME - LAST_FRAME].idx;
int lst3_buf_idx = cm->frame_refs[LAST3_FRAME - LAST_FRAME].idx;
int bwd_buf_idx = cm->frame_refs[BWDREF_FRAME - LAST_FRAME].idx;
int alt2_buf_idx = cm->frame_refs[ALTREF2_FRAME - LAST_FRAME].idx;
#endif
if (alt_buf_idx >= 0)
alt_frame_index = cm->buffer_pool->frame_bufs[alt_buf_idx].cur_frame_offset;
......@@ -1676,7 +1668,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
if (gld_buf_idx >= 0)
gld_frame_index = cm->buffer_pool->frame_bufs[gld_buf_idx].cur_frame_offset;
#if CONFIG_EXT_REFS
if (lst2_buf_idx >= 0)
lst2_frame_index =
cm->buffer_pool->frame_bufs[lst2_buf_idx].cur_frame_offset;
......@@ -1691,7 +1682,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
if (alt2_buf_idx >= 0)
alt2_frame_index =
cm->buffer_pool->frame_bufs[alt2_buf_idx].cur_frame_offset;
#endif
if (alt_frame_index < cur_frame_index) return;
......@@ -1706,7 +1696,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
cm->buffer_pool->frame_bufs[lst_buf_idx].alt_frame_offset;
const int gld_frame_idx =
cm->buffer_pool->frame_bufs[lst_buf_idx].gld_frame_offset;
#if CONFIG_EXT_REFS
const int lst2_frame_idx =
cm->buffer_pool->frame_bufs[lst_buf_idx].lst2_frame_offset;
const int lst3_frame_idx =
......@@ -1715,7 +1704,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
cm->buffer_pool->frame_bufs[lst_buf_idx].bwd_frame_offset;
const int alt2_frame_idx =
cm->buffer_pool->frame_bufs[lst_buf_idx].alt2_frame_offset;
#endif
int alt_offset = AOMMAX(1, alt_frame_idx - lst_frame_index);
int lst_offset = AOMMAX(1, lst_frame_index - lst_frame_idx);
......@@ -1724,7 +1712,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
int cur_to_alt = alt_frame_index - cur_frame_index;
int cur_to_gld = cur_frame_index - gld_frame_index;
#if CONFIG_EXT_REFS
int bwd_offset = AOMMAX(1, bwd_frame_idx - lst_frame_index);
int alt2_offset = AOMMAX(1, alt2_frame_idx - lst_frame_index);
int lst2_offset = AOMMAX(1, lst_frame_index - lst2_frame_idx);
......@@ -1733,17 +1720,12 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
int cur_to_lst3 = cur_frame_index - lst3_frame_index;
int cur_to_bwd = bwd_frame_index - cur_frame_index;
int cur_to_alt2 = alt2_frame_index - cur_frame_index;
#endif
const int is_lst_overlay = (alt_frame_idx == gld_frame_index);
// clang-format off
const int ref_frame_offset_buffer[TOTAL_REFS_PER_FRAME] = {
#if CONFIG_EXT_REFS
0, lst_offset, lst2_offset, lst3_offset, gld_offset,
bwd_offset, alt2_offset, alt_offset
#else
0, lst_offset, gld_offset, alt_offset
#endif
};
// clang-format on
......@@ -1774,7 +1756,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(LAST_FRAME)][0].as_int =
this_mv.as_int;
#if CONFIG_EXT_REFS
get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_lst2,
ref_frame_offset);
tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(LAST2_FRAME)][0].as_int =
......@@ -1784,7 +1765,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
ref_frame_offset);
tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(LAST3_FRAME)][0].as_int =
this_mv.as_int;
#endif
get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_gld,
ref_frame_offset);
tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(GOLDEN_FRAME)]
......@@ -1813,7 +1793,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(ALTREF_FRAME)]
[0].as_int = this_mv.as_int;
#if CONFIG_EXT_REFS
get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_bwd,
ref_frame_offset);
tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(BWDREF_FRAME)]
......@@ -1822,7 +1801,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
ref_frame_offset);
tpl_mvs_base[mi_offset].mfmv[FWD_RF_OFFSET(ALTREF2_FRAME)]
[0].as_int = this_mv.as_int;
#endif
}
}
}
......@@ -1838,7 +1816,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
cm->buffer_pool->frame_bufs[alt_buf_idx].lst_frame_offset;
const int gld_frame_idx =
cm->buffer_pool->frame_bufs[alt_buf_idx].gld_frame_offset;
#if CONFIG_EXT_REFS
const int lst2_frame_idx =
cm->buffer_pool->frame_bufs[alt_buf_idx].lst2_frame_offset;
const int lst3_frame_idx =
......@@ -1847,14 +1824,12 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
cm->buffer_pool->frame_bufs[alt_buf_idx].bwd_frame_offset;
const int alt2_frame_idx =
cm->buffer_pool->frame_bufs[alt_buf_idx].alt2_frame_offset;
#endif
int lst_offset = AOMMAX(1, alt_frame_index - lst_frame_idx);
int gld_offset = AOMMAX(1, alt_frame_index - gld_frame_idx);
int cur_to_alt = alt_frame_index - cur_frame_index;
int cur_to_lst = cur_frame_index - lst_frame_index;
int cur_to_gld = cur_frame_index - gld_frame_index;
#if CONFIG_EXT_REFS
int bwd_offset = AOMMAX(1, alt_frame_index - bwd_frame_idx);
int alt2_offset = AOMMAX(1, alt_frame_index - alt2_frame_idx);
int lst2_offset = AOMMAX(1, alt_frame_index - lst2_frame_idx);
......@@ -1863,16 +1838,11 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
int cur_to_lst3 = cur_frame_index - lst3_frame_index;
int cur_to_bwd = bwd_frame_index - cur_frame_index;
int cur_to_alt2 = alt2_frame_index - cur_frame_index;
#endif
const int ref_stamp = FWD_RF_OFFSET(ALTREF_FRAME);
// clang-format off
const int ref_frame_offset_buffer[TOTAL_REFS_PER_FRAME] = {
#if CONFIG_EXT_REFS
0, lst_offset, lst2_offset, lst3_offset, gld_offset,
bwd_offset, alt2_offset, 0,
#else
0, lst_offset, gld_offset, 0,
#endif
};
// clang-format on
const int mvs_rows = (cm->mi_rows + 1) >> 1;
......@@ -1908,7 +1878,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
.mfmv[FWD_RF_OFFSET(LAST_FRAME)][ref_stamp]
.as_int = this_mv.as_int;
#if CONFIG_EXT_REFS
get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_bwd,
ref_frame_offset);
tpl_mvs_base[mi_offset]
......@@ -1936,7 +1905,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
.mfmv[FWD_RF_OFFSET(LAST3_FRAME)][ref_stamp]
.as_int = this_mv.as_int;
}
#endif
if (ref_frame[0] >= GOLDEN_FRAME) {
get_mv_projection(&this_mv.as_mv, fwd_mv, cur_to_gld,
ref_frame_offset);
......@@ -1950,10 +1918,9 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
}
}
// ==========================================
// Process BWD reference frame
// ==========================================
#if CONFIG_EXT_REFS
// ==========================================
// Process BWD reference frame
// ==========================================
if (bwd_buf_idx >= 0) {
MV_REF *mv_ref_base = cm->buffer_pool->frame_bufs[bwd_buf_idx].mvs;
const int lst_frame_idx =
......@@ -2053,7 +2020,6 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
}
}
}
#endif
}
#endif // CONFIG_MFMV
......
......@@ -309,7 +309,6 @@ static INLINE int8_t av1_ref_frame_type(const MV_REFERENCE_FRAME *const rf) {
// clang-format off
static MV_REFERENCE_FRAME ref_frame_map[COMP_REFS][2] = {
#if CONFIG_EXT_REFS
{ LAST_FRAME, BWDREF_FRAME }, { LAST2_FRAME, BWDREF_FRAME },
{ LAST3_FRAME, BWDREF_FRAME }, { GOLDEN_FRAME, BWDREF_FRAME },
......@@ -326,9 +325,6 @@ static MV_REFERENCE_FRAME ref_frame_map[COMP_REFS][2] = {
// TODO(zoeliu): When ALTREF2 is enabled, we may add:
// {BWDREF_FRAME, ALTREF2_FRAME}
#endif // CONFIG_EXT_COMP_REFS
#else // !CONFIG_EXT_REFS
{ LAST_FRAME, ALTREF_FRAME }, { GOLDEN_FRAME, ALTREF_FRAME }
#endif // CONFIG_EXT_REFS
};
// clang-format on
......
......@@ -72,11 +72,7 @@ extern "C" {
#define FRAME_CONTEXT_DEFAULTS (FRAME_CONTEXTS - 1)
#else
#if CONFIG_EXT_REFS
#define FRAME_CONTEXTS_LOG2 3
#else
#define FRAME_CONTEXTS_LOG2 2
#endif
#define FRAME_CONTEXTS (1 << FRAME_CONTEXTS_LOG2)
#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING
......@@ -133,12 +129,10 @@ typedef struct {
int lst_frame_offset;
int alt_frame_offset;
int gld_frame_offset;
#if CONFIG_EXT_REFS
int lst2_frame_offset;
int lst3_frame_offset;
int bwd_frame_offset;
int alt2_frame_offset;
#endif
#endif // CONFIG_FRAME_MARKER
MV_REF *mvs;
......@@ -262,10 +256,8 @@ typedef struct AV1Common {
int show_frame;
int last_show_frame;
int show_existing_frame;
#if CONFIG_EXT_REFS
// Flag for a frame used as a reference - not written to the bitstream
int is_reference_frame;
#endif // CONFIG_EXT_REFS
// Flag signaling that the frame is encoded using only INTRA modes.
uint8_t intra_only;
......@@ -393,14 +385,9 @@ typedef struct AV1Common {
int reduced_tx_set_used;
#endif // CONFIG_EXT_TX
// Context probabilities for reference frame prediction
#if CONFIG_EXT_REFS
// Context probabilities for reference frame prediction
MV_REFERENCE_FRAME comp_fwd_ref[FWD_REFS];
MV_REFERENCE_FRAME comp_bwd_ref[BWD_REFS];
#else
MV_REFERENCE_FRAME comp_fixed_ref;
MV_REFERENCE_FRAME comp_var_ref[COMP_REFS];
#endif // CONFIG_EXT_REFS
REFERENCE_MODE reference_mode;
FRAME_CONTEXT *fc; /* this frame entropy */
......
This diff is collapsed.
......@@ -185,7 +185,6 @@ static INLINE aom_prob av1_get_pred_prob_comp_ref_p(const AV1_COMMON *cm,
return cm->fc->comp_ref_prob[pred_context][0];
}
#if CONFIG_EXT_REFS
int av1_get_pred_context_comp_ref_p1(const AV1_COMMON *cm,
const MACROBLOCKD *xd);
......@@ -253,7 +252,6 @@ static INLINE aom_prob av1_get_pred_prob_comp_bwdref_p1(const AV1_COMMON *cm,
const int pred_context = av1_get_pred_context_comp_bwdref_p1(cm, xd);
return cm->fc->comp_bwdref_prob[pred_context][1];
}
#endif // CONFIG_EXT_REFS
int av1_get_pred_context_single_ref_p1(const MACROBLOCKD *xd);
......@@ -269,7 +267,6 @@ static INLINE aom_prob av1_get_pred_prob_single_ref_p2(const AV1_COMMON *cm,
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p2(xd)][1];
}
#if CONFIG_EXT_REFS
int av1_get_pred_context_single_ref_p3(const MACROBLOCKD *xd);
static INLINE aom_prob av1_get_pred_prob_single_ref_p3(const AV1_COMMON *cm,
......@@ -297,7 +294,6 @@ static INLINE aom_prob av1_get_pred_prob_single_ref_p6(const AV1_COMMON *cm,
const MACROBLOCKD *xd) {
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p6(xd)][5];
}
#endif // CONFIG_EXT_REFS
#if CONFIG_NEW_MULTISYMBOL
static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p1(
......@@ -312,7 +308,6 @@ static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p2(
return xd->tile_ctx
->single_ref_cdf[av1_get_pred_context_single_ref_p2(xd)][1];
}
#if CONFIG_EXT_REFS
static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p3(
const AV1_COMMON *cm, const MACROBLOCKD *xd) {
(void)cm;
......@@ -337,7 +332,6 @@ static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p6(
return xd->tile_ctx
->single_ref_cdf[av1_get_pred_context_single_ref_p6(xd)][5];
}
#endif // CONFIG_EXT_REFS
#endif // CONFIG_NEW_MULTISYMBOL
#if CONFIG_COMPOUND_SINGLEREF
......
......@@ -120,7 +120,6 @@ static int is_compound_reference_allowed(const AV1_COMMON *cm) {
}
static void setup_compound_reference_mode(AV1_COMMON *cm) {
#if CONFIG_EXT_REFS
cm->comp_fwd_ref[0] = LAST_FRAME;
cm->comp_fwd_ref[1] = LAST2_FRAME;
cm->comp_fwd_ref[2] = LAST3_FRAME;
......@@ -129,23 +128,6 @@ static void setup_compound_reference_mode(AV1_COMMON *cm) {
cm->comp_bwd_ref[0] = BWDREF_FRAME;
cm->comp_bwd_ref[1] = ALTREF2_FRAME;
cm->comp_bwd_ref[2] = ALTREF_FRAME;
#else // !CONFIG_EXT_REFS
if (cm->ref_frame_sign_bias[LAST_FRAME] ==
cm->ref_frame_sign_bias[GOLDEN_FRAME]) {
cm->comp_fixed_ref = ALTREF_FRAME;
cm->comp_var_ref[0] = LAST_FRAME;
cm->comp_var_ref[1] = GOLDEN_FRAME;
} else if (cm->ref_frame_sign_bias[LAST_FRAME] ==
cm->ref_frame_sign_bias[ALTREF_FRAME]) {
cm->comp_fixed_ref = GOLDEN_FRAME;
cm->comp_var_ref[0] = LAST_FRAME;
cm->comp_var_ref[1] = ALTREF_FRAME;
} else {
cm->comp_fixed_ref = LAST_FRAME;
cm->comp_var_ref[0] = GOLDEN_FRAME;
cm->comp_var_ref[1] = ALTREF_FRAME;
}
#endif // CONFIG_EXT_REFS
}
static int read_is_valid(const uint8_t *start, size_t len, const uint8_t *end) {
......@@ -237,15 +219,10 @@ static void read_frame_reference_mode_probs(AV1_COMMON *cm, aom_reader *r) {
for (i = 0; i < REF_CONTEXTS; ++i) {
int j;
#if CONFIG_EXT_REFS
for (j = 0; j < (FWD_REFS - 1); ++j)
av1_diff_update_prob(r, &fc->comp_ref_prob[i][j], ACCT_STR);
for (j = 0; j < (BWD_REFS - 1); ++j)
av1_diff_update_prob(r, &fc->comp_bwdref_prob[i][j], ACCT_STR);
#else
for (j = 0; j < (COMP_REFS - 1); ++j)
av1_diff_update_prob(r, &fc->comp_ref_prob[i][j], ACCT_STR);
#endif // CONFIG_EXT_REFS
}
}
}
......@@ -4678,10 +4655,8 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
cm->last_frame_type = cm->frame_type;
cm->last_intra_only = cm->intra_only;
#if CONFIG_EXT_REFS
// NOTE: By default all coded frames to be used as a reference
cm->is_reference_frame = 1;
#endif // CONFIG_EXT_REFS
#if !CONFIG_OBU
if (aom_rb_read_literal(rb, 2) != AOM_FRAME_MARKER)
......@@ -4897,13 +4872,11 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
pbi->refresh_frame_flags = aom_rb_read_literal(rb, REF_FRAMES);
#endif
#if CONFIG_EXT_REFS
if (!pbi->refresh_frame_flags) {
// NOTE: "pbi->refresh_frame_flags == 0" indicates that the coded frame
// will not be used as a reference
cm->is_reference_frame = 0;
}
#endif // CONFIG_EXT_REFS
for (i = 0; i < INTER_REFS_PER_FRAME; ++i) {
const int ref = aom_rb_read_literal(rb, REF_FRAMES_LOG2);
......@@ -5192,7 +5165,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
if (cm->use_adapt_scan == 0) av1_init_scan_order(cm);