Remove subframe_prob_update experiment

The coding gain from this experiment can be mostly obtained
from ec-adapt.

BUG=aomedia:450

Change-Id: Ia7f9df9b2c13d8cdb962eeb39624f3e4e3f036ba
This commit is contained in:
hui su 2017-04-27 16:02:49 -07:00 коммит произвёл sebastien alaiwan
Родитель cd167c4e91
Коммит ed5a30f2c4
11 изменённых файлов: 1 добавлений и 228 удалений

Просмотреть файл

@ -6141,14 +6141,7 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
unsigned int update_factor) {
const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
av1_coeff_probs_model *const probs = cm->fc->coef_probs[tx_size];
#if CONFIG_SUBFRAME_PROB_UPDATE
const av1_coeff_probs_model *const pre_probs =
cm->partial_prob_update
? (const av1_coeff_probs_model *)cm->starting_coef_probs[tx_size]
: pre_fc->coef_probs[tx_size];
#else
const av1_coeff_probs_model *const pre_probs = pre_fc->coef_probs[tx_size];
#endif // CONFIG_SUBFRAME_PROB_UPDATE
const av1_coeff_count_model *const counts =
(const av1_coeff_count_model *)cm->counts.coef[tx_size];
const unsigned int(*eob_counts)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] =
@ -6209,9 +6202,6 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
update_factor = COEF_MAX_UPDATE_FACTOR;
count_sat = COEF_COUNT_SAT;
}
#if CONFIG_SUBFRAME_PROB_UPDATE
if (cm->partial_prob_update == 1) update_factor = COEF_MAX_UPDATE_FACTOR;
#endif // CONFIG_SUBFRAME_PROB_UPDATE
#if CONFIG_LV_MAP
av1_adapt_txb_probs(cm, count_sat, update_factor);
@ -6222,18 +6212,6 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
#endif
}
#if CONFIG_SUBFRAME_PROB_UPDATE
void av1_partial_adapt_probs(AV1_COMMON *cm, int mi_row, int mi_col) {
(void)mi_row;
(void)mi_col;
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
cm->partial_prob_update = 1;
av1_adapt_coef_probs(cm);
}
}
#endif // CONFIG_SUBFRAME_PROB_UPDATE
#if CONFIG_EC_ADAPT
static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr,
int cdf_size, const int num_tiles) {

Просмотреть файл

@ -32,10 +32,6 @@ extern "C" {
#define QCTX_BINS (1 << QCTX_BIN_BITS)
#endif // CONFIG_Q_ADAPT_PROBS
#if CONFIG_SUBFRAME_PROB_UPDATE
#define COEF_PROBS_BUFS 16
#endif // CONFIG_SUBFRAME_PROB_UPDATE
// Coefficient token alphabet
#define ZERO_TOKEN 0 // 0 Extra Bits 0+0
#define ONE_TOKEN 1 // 1 Extra Bits 0+1
@ -199,9 +195,6 @@ void av1_adapt_coef_probs(struct AV1Common *cm);
#if CONFIG_EC_ADAPT
void av1_adapt_coef_cdfs(struct AV1Common *cm, struct frame_contexts *pre_fc);
#endif
#if CONFIG_SUBFRAME_PROB_UPDATE
void av1_partial_adapt_probs(struct AV1Common *cm, int mi_row, int mi_col);
#endif // CONFIG_SUBFRAME_PROB_UPDATE
// This is the index in the scan order beyond which all coefficients for
// 8x8 transform and above are in the top band.

Просмотреть файл

@ -334,18 +334,6 @@ typedef struct AV1Common {
unsigned int frame_context_idx; /* Context to use/update */
FRAME_COUNTS counts;
#if CONFIG_SUBFRAME_PROB_UPDATE
// The initial probabilities for a frame, before any subframe backward update,
// and after forward update.
av1_coeff_probs_model starting_coef_probs[TX_SIZES][PLANE_TYPES];
// Number of subframe backward updates already done
uint8_t coef_probs_update_idx;
// Signal if the backward update is subframe or end-of-frame
uint8_t partial_prob_update;
// Frame level flag to turn on/off subframe backward update
uint8_t do_subframe_update;
#endif // CONFIG_SUBFRAME_PROB_UPDATE
unsigned int current_video_frame;
BITSTREAM_PROFILE profile;

Просмотреть файл

@ -3437,10 +3437,6 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
#endif // CONFIG_EXT_TILE
int tile_row, tile_col;
#if CONFIG_SUBFRAME_PROB_UPDATE
cm->do_subframe_update = n_tiles == 1;
#endif // CONFIG_SUBFRAME_PROB_UPDATE
if (cm->lf.filter_level && !cm->skip_loop_filter &&
pbi->lf_worker.data1 == NULL) {
CHECK_MEM_ERROR(cm, pbi->lf_worker.data1,
@ -3592,19 +3588,6 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
if (pbi->mb.corrupted)
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Failed to decode tile data");
#if CONFIG_SUBFRAME_PROB_UPDATE
if (cm->do_subframe_update &&
cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
const int mi_rows_per_update =
MI_SIZE * AOMMAX(cm->mi_rows / MI_SIZE / COEF_PROBS_BUFS, 1);
if ((mi_row + MI_SIZE) % mi_rows_per_update == 0 &&
mi_row + MI_SIZE < cm->mi_rows &&
cm->coef_probs_update_idx < COEF_PROBS_BUFS - 1) {
av1_partial_adapt_probs(cm, mi_row, mi_col);
++cm->coef_probs_update_idx;
}
}
#endif // CONFIG_SUBFRAME_PROB_UPDATE
}
}
@ -5059,11 +5042,6 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
av1_frameworker_unlock_stats(worker);
}
#if CONFIG_SUBFRAME_PROB_UPDATE
av1_copy(cm->starting_coef_probs, cm->fc->coef_probs);
cm->coef_probs_update_idx = 0;
#endif // CONFIG_SUBFRAME_PROB_UPDATE
if (pbi->max_threads > 1 && !CONFIG_CB4X4 &&
#if CONFIG_EXT_TILE
pbi->dec_tile_col < 0 && // Decoding all columns
@ -5111,10 +5089,6 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
sizeof(&pbi->tile_data[0].tctx.partition_cdf[0][0]));
make_update_tile_list_dec(pbi, cm->tile_rows, cm->tile_cols, tile_ctxs);
#endif
#if CONFIG_SUBFRAME_PROB_UPDATE
cm->partial_prob_update = 0;
#endif // CONFIG_SUBFRAME_PROB_UPDATE
av1_adapt_coef_probs(cm);
av1_adapt_intra_frame_probs(cm);
#if CONFIG_EC_ADAPT

Просмотреть файл

@ -4785,32 +4785,6 @@ static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
INT64_MAX, pc_root);
}
}
#if CONFIG_SUBFRAME_PROB_UPDATE
if (cm->do_subframe_update &&
cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
const int mi_rows_per_update =
MI_SIZE * AOMMAX(cm->mi_rows / MI_SIZE / COEF_PROBS_BUFS, 1);
if ((mi_row + MI_SIZE) % mi_rows_per_update == 0 &&
mi_row + MI_SIZE < cm->mi_rows &&
cm->coef_probs_update_idx < COEF_PROBS_BUFS - 1) {
TX_SIZE t;
SUBFRAME_STATS *subframe_stats = &cpi->subframe_stats;
for (t = 0; t < TX_SIZES; ++t)
av1_full_to_model_counts(cpi->td.counts->coef[t],
cpi->td.rd_counts.coef_counts[t]);
av1_partial_adapt_probs(cm, mi_row, mi_col);
++cm->coef_probs_update_idx;
av1_copy(subframe_stats->coef_probs_buf[cm->coef_probs_update_idx],
cm->fc->coef_probs);
av1_copy(subframe_stats->coef_counts_buf[cm->coef_probs_update_idx],
cpi->td.rd_counts.coef_counts);
av1_copy(subframe_stats->eob_counts_buf[cm->coef_probs_update_idx],
cm->counts.eob_branch);
av1_fill_token_costs(x->token_costs, cm->fc->coef_probs);
}
}
#endif // CONFIG_SUBFRAME_PROB_UPDATE
}
static void init_encode_frame_mb_context(AV1_COMP *cpi) {

Просмотреть файл

@ -4097,18 +4097,9 @@ static void encode_without_recode_loop(AV1_COMP *cpi) {
av1_set_quantizer(cm, q);
av1_set_variance_partition_thresholds(cpi, q);
setup_frame(cpi);
#if CONFIG_SUBFRAME_PROB_UPDATE
cm->do_subframe_update = cm->tile_cols == 1 && cm->tile_rows == 1;
av1_copy(cm->starting_coef_probs, cm->fc->coef_probs);
av1_copy(cpi->subframe_stats.enc_starting_coef_probs, cm->fc->coef_probs);
cm->coef_probs_update_idx = 0;
av1_copy(cpi->subframe_stats.coef_probs_buf[0], cm->fc->coef_probs);
#endif // CONFIG_SUBFRAME_PROB_UPDATE
suppress_active_map(cpi);
// Variance adaptive and in frame q adjustment experiments are mutually
// exclusive.
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
@ -4229,26 +4220,6 @@ static void encode_with_recode_loop(AV1_COMP *cpi, size_t *size,
}
#endif // CONFIG_Q_ADAPT_PROBS
#if CONFIG_SUBFRAME_PROB_UPDATE
cm->do_subframe_update = cm->tile_cols == 1 && cm->tile_rows == 1;
if (loop_count == 0 || frame_is_intra_only(cm) ||
cm->error_resilient_mode) {
av1_copy(cm->starting_coef_probs, cm->fc->coef_probs);
av1_copy(cpi->subframe_stats.enc_starting_coef_probs, cm->fc->coef_probs);
} else {
if (cm->do_subframe_update) {
av1_copy(cm->fc->coef_probs,
cpi->subframe_stats.enc_starting_coef_probs);
av1_copy(cm->starting_coef_probs,
cpi->subframe_stats.enc_starting_coef_probs);
av1_zero(cpi->subframe_stats.coef_counts_buf);
av1_zero(cpi->subframe_stats.eob_counts_buf);
}
}
cm->coef_probs_update_idx = 0;
av1_copy(cpi->subframe_stats.coef_probs_buf[0], cm->fc->coef_probs);
#endif // CONFIG_SUBFRAME_PROB_UPDATE
// Variance adaptive and in frame q adjustment experiments are mutually
// exclusive.
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
@ -5039,9 +5010,6 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
av1_accumulate_frame_counts(&aggregate_fc, &cm->counts);
#endif // CONFIG_ENTROPY_STATS
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
#if CONFIG_SUBFRAME_PROB_UPDATE
cm->partial_prob_update = 0;
#endif // CONFIG_SUBFRAME_PROB_UPDATE
av1_adapt_coef_probs(cm);
av1_adapt_intra_frame_probs(cm);
#if CONFIG_EC_ADAPT

Просмотреть файл

@ -350,16 +350,6 @@ typedef struct {
YV12_BUFFER_CONFIG buf;
} EncRefCntBuffer;
#if CONFIG_SUBFRAME_PROB_UPDATE
typedef struct SUBFRAME_STATS {
av1_coeff_probs_model coef_probs_buf[COEF_PROBS_BUFS][TX_SIZES][PLANE_TYPES];
av1_coeff_count coef_counts_buf[COEF_PROBS_BUFS][TX_SIZES][PLANE_TYPES];
unsigned int eob_counts_buf[COEF_PROBS_BUFS][TX_SIZES][PLANE_TYPES][REF_TYPES]
[COEF_BANDS][COEFF_CONTEXTS];
av1_coeff_probs_model enc_starting_coef_probs[TX_SIZES][PLANE_TYPES];
} SUBFRAME_STATS;
#endif // CONFIG_SUBFRAME_PROB_UPDATE
typedef struct TileBufferEnc {
uint8_t *data;
size_t size;
@ -654,12 +644,6 @@ typedef struct AV1_COMP {
AVxWorker *workers;
struct EncWorkerData *tile_thr_data;
AV1LfSync lf_row_sync;
#if CONFIG_SUBFRAME_PROB_UPDATE
SUBFRAME_STATS subframe_stats;
// TODO(yaowu): minimize the size of count buffers
SUBFRAME_STATS wholeframe_stats;
av1_coeff_stats branch_ct_buf[COEF_PROBS_BUFS][TX_SIZES][PLANE_TYPES];
#endif // CONFIG_SUBFRAME_PROB_UPDATE
#if CONFIG_ANS
struct BufAnsCoder buf_ans;
#endif

Просмотреть файл

@ -179,83 +179,6 @@ int av1_prob_diff_update_savings_search_model(const unsigned int *ct,
return bestsavings;
}
#if CONFIG_SUBFRAME_PROB_UPDATE
static int get_cost(unsigned int ct[][2], aom_prob p, int n) {
int i, p0 = p;
unsigned int total_ct[2] = { 0, 0 };
int cost = 0;
for (i = 0; i <= n; ++i) {
cost += cost_branch256(ct[i], p);
total_ct[0] += ct[i][0];
total_ct[1] += ct[i][1];
if (i < n)
p = av1_merge_probs(p0, total_ct, COEF_COUNT_SAT, COEF_MAX_UPDATE_FACTOR);
}
return cost;
}
int av1_prob_update_search_subframe(unsigned int ct[][2], aom_prob oldp,
aom_prob *bestp, aom_prob upd, int n) {
const int old_b = get_cost(ct, oldp, n);
int bestsavings = 0;
const int upd_cost = av1_cost_one(upd) - av1_cost_zero(upd);
aom_prob newp, bestnewp = oldp;
const int step = *bestp > oldp ? -1 : 1;
for (newp = *bestp; newp != oldp; newp += step) {
const int new_b = get_cost(ct, newp, n);
const int update_b = prob_diff_update_cost(newp, oldp) + upd_cost;
const int savings = old_b - new_b - update_b;
if (savings > bestsavings) {
bestsavings = savings;
bestnewp = newp;
}
}
*bestp = bestnewp;
return bestsavings;
}
int av1_prob_update_search_model_subframe(
unsigned int ct[ENTROPY_NODES][COEF_PROBS_BUFS][2], const aom_prob *oldp,
aom_prob *bestp, aom_prob upd, int stepsize, int n) {
int i, old_b, new_b, update_b, savings, bestsavings;
int newp;
const int step_sign = *bestp > oldp[PIVOT_NODE] ? -1 : 1;
const int step = stepsize * step_sign;
const int upd_cost = av1_cost_one(upd) - av1_cost_zero(upd);
aom_prob bestnewp, newplist[ENTROPY_NODES], oldplist[ENTROPY_NODES];
av1_model_to_full_probs(oldp, oldplist);
memcpy(newplist, oldp, sizeof(aom_prob) * UNCONSTRAINED_NODES);
for (i = UNCONSTRAINED_NODES, old_b = 0; i < ENTROPY_NODES; ++i)
old_b += get_cost(ct[i], oldplist[i], n);
old_b += get_cost(ct[PIVOT_NODE], oldplist[PIVOT_NODE], n);
bestsavings = 0;
bestnewp = oldp[PIVOT_NODE];
assert(stepsize > 0);
for (newp = *bestp; (newp - oldp[PIVOT_NODE]) * step_sign < 0; newp += step) {
if (newp < 1 || newp > 255) continue;
newplist[PIVOT_NODE] = newp;
av1_model_to_full_probs(newplist, newplist);
for (i = UNCONSTRAINED_NODES, new_b = 0; i < ENTROPY_NODES; ++i)
new_b += get_cost(ct[i], newplist[i], n);
new_b += get_cost(ct[PIVOT_NODE], newplist[PIVOT_NODE], n);
update_b = prob_diff_update_cost(newp, oldp[PIVOT_NODE]) + upd_cost;
savings = old_b - new_b - update_b;
if (savings > bestsavings) {
bestsavings = savings;
bestnewp = newp;
}
}
*bestp = bestnewp;
return bestsavings;
}
#endif // CONFIG_SUBFRAME_PROB_UPDATE
void av1_cond_prob_diff_update(aom_writer *w, aom_prob *oldp,
const unsigned int ct[2], int probwt) {
const aom_prob upd = DIFF_UPDATE_PROB;

Просмотреть файл

@ -35,13 +35,6 @@ int av1_prob_diff_update_savings_search_model(const unsigned int *ct,
int av1_cond_prob_diff_update_savings(aom_prob *oldp, const unsigned int ct[2],
int probwt);
#if CONFIG_SUBFRAME_PROB_UPDATE
int av1_prob_update_search_subframe(unsigned int ct[][2], aom_prob oldp,
aom_prob *bestp, aom_prob upd, int n);
int av1_prob_update_search_model_subframe(
unsigned int ct[ENTROPY_NODES][COEF_PROBS_BUFS][2], const aom_prob *oldp,
aom_prob *bestp, aom_prob upd, int stepsize, int n);
#endif // CONFIG_SUBFRAME_PROB_UPDATE
#ifdef __cplusplus
} // extern "C"
#endif

Просмотреть файл

@ -124,7 +124,6 @@ set(CONFIG_MOTION_VAR 0 CACHE BOOL "Internal flag.")
set(CONFIG_NCOBMC 0 CACHE BOOL "Internal flag.")
set(CONFIG_WARPED_MOTION 0 CACHE BOOL "Internal flag.")
set(CONFIG_Q_ADAPT_PROBS 0 CACHE BOOL "Internal flag.")
set(CONFIG_SUBFRAME_PROB_UPDATE 0 CACHE BOOL "Internal flag.")
set(CONFIG_BITSTREAM_DEBUG 0 CACHE BOOL "Internal flag.")
set(CONFIG_ALT_INTRA 1 CACHE BOOL "Internal flag.")
set(CONFIG_PALETTE 1 CACHE BOOL "Internal flag.")

1
configure поставляемый
Просмотреть файл

@ -280,7 +280,6 @@ EXPERIMENT_LIST="
ncobmc
warped_motion
q_adapt_probs
subframe_prob_update
bitstream_debug
alt_intra
palette