Commit 911c964a authored by Jingning Han's avatar Jingning Han

Fix compiler warnings on config_subframe_prob_update

Remove the unused codes under the experimental flag.

Change-Id: I4e1c176d13a58f6677f32d52bbfaa7f0aad4249d
parent afe71d9d
......@@ -3249,235 +3249,12 @@ static void update_coef_probs_common(aom_writer *const bc, AV1_COMP *cpi,
}
}
#endif
#if CONFIG_SUBFRAME_PROB_UPDATE
// Calculate the token counts between subsequent subframe updates.
static void get_coef_counts_diff(
AV1_COMP *cpi, int index,
av1_coeff_count coef_counts[TX_SIZES][PLANE_TYPES],
unsigned int eob_counts[TX_SIZES][PLANE_TYPES][REF_TYPES][COEF_BANDS]
[COEFF_CONTEXTS]) {
int i, j, k, l, m, tx_size, val;
const int max_idx = cpi->common.coef_probs_update_idx;
const TX_MODE tx_mode = cpi->common.tx_mode;
const int max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
const SUBFRAME_STATS *subframe_stats = &cpi->subframe_stats;
assert(max_idx < COEF_PROBS_BUFS);
for (tx_size = 0; tx_size <= max_tx_size; ++tx_size)
for (i = 0; i < PLANE_TYPES; ++i)
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
if (index == max_idx) {
val =
cpi->common.counts.eob_branch[tx_size][i][j][k][l] -
subframe_stats->eob_counts_buf[max_idx][tx_size][i][j][k][l];
} else {
val = subframe_stats
->eob_counts_buf[index + 1][tx_size][i][j][k][l] -
subframe_stats->eob_counts_buf[index][tx_size][i][j][k][l];
}
assert(val >= 0);
eob_counts[tx_size][i][j][k][l] = val;
for (m = 0; m < ENTROPY_TOKENS; ++m) {
if (index == max_idx) {
val = cpi->td.rd_counts.coef_counts[tx_size][i][j][k][l][m] -
subframe_stats
->coef_counts_buf[max_idx][tx_size][i][j][k][l][m];
} else {
val = subframe_stats
->coef_counts_buf[index + 1][tx_size][i][j][k][l][m] -
subframe_stats
->coef_counts_buf[index][tx_size][i][j][k][l][m];
}
assert(val >= 0);
coef_counts[tx_size][i][j][k][l][m] = val;
}
}
}
static void update_coef_probs_subframe(
aom_writer *const bc, AV1_COMP *cpi, TX_SIZE tx_size,
av1_coeff_stats branch_ct[COEF_PROBS_BUFS][TX_SIZES][PLANE_TYPES],
av1_coeff_probs_model *new_coef_probs) {
av1_coeff_probs_model *old_coef_probs = cpi->common.fc->coef_probs[tx_size];
const aom_prob upd = DIFF_UPDATE_PROB;
const int entropy_nodes_update = UNCONSTRAINED_NODES;
int i, j, k, l, t;
int stepsize = cpi->sf.coeff_prob_appx_step;
const int max_idx = cpi->common.coef_probs_update_idx;
int idx;
unsigned int this_branch_ct[ENTROPY_NODES][COEF_PROBS_BUFS][2];
switch (cpi->sf.use_fast_coef_updates) {
case TWO_LOOP: {
/* dry run to see if there is any update at all needed */
int savings = 0;
int update[2] = { 0, 0 };
for (i = 0; i < PLANE_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) {
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
for (t = 0; t < ENTROPY_NODES; ++t) {
for (idx = 0; idx <= max_idx; ++idx) {
memcpy(this_branch_ct[t][idx],
branch_ct[idx][tx_size][i][j][k][l][t],
2 * sizeof(this_branch_ct[t][idx][0]));
}
}
for (t = 0; t < entropy_nodes_update; ++t) {
aom_prob newp = new_coef_probs[i][j][k][l][t];
const aom_prob oldp = old_coef_probs[i][j][k][l][t];
int s, u = 0;
if (t == PIVOT_NODE)
s = av1_prob_update_search_model_subframe(
this_branch_ct, old_coef_probs[i][j][k][l], &newp, upd,
stepsize, max_idx);
else
s = av1_prob_update_search_subframe(this_branch_ct[t], oldp,
&newp, upd, max_idx);
if (s > 0 && newp != oldp) u = 1;
if (u)
savings += s - (int)(av1_cost_zero(upd));
else
savings -= (int)(av1_cost_zero(upd));
update[u]++;
}
}
}
}
}
/* Is coef updated at all */
if (update[1] == 0 || savings < 0) {
aom_write_bit(bc, 0);
return;
}
aom_write_bit(bc, 1);
for (i = 0; i < PLANE_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) {
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
for (t = 0; t < ENTROPY_NODES; ++t) {
for (idx = 0; idx <= max_idx; ++idx) {
memcpy(this_branch_ct[t][idx],
branch_ct[idx][tx_size][i][j][k][l][t],
2 * sizeof(this_branch_ct[t][idx][0]));
}
}
for (t = 0; t < entropy_nodes_update; ++t) {
aom_prob newp = new_coef_probs[i][j][k][l][t];
aom_prob *oldp = old_coef_probs[i][j][k][l] + t;
int s;
int u = 0;
if (t == PIVOT_NODE)
s = av1_prob_update_search_model_subframe(
this_branch_ct, old_coef_probs[i][j][k][l], &newp, upd,
stepsize, max_idx);
else
s = av1_prob_update_search_subframe(this_branch_ct[t], *oldp,
&newp, upd, max_idx);
if (s > 0 && newp != *oldp) u = 1;
aom_write(bc, u, upd);
if (u) {
/* send/use new probability */
av1_write_prob_diff_update(bc, newp, *oldp);
*oldp = newp;
}
}
}
}
}
}
return;
}
case ONE_LOOP_REDUCED: {
int updates = 0;
int noupdates_before_first = 0;
for (i = 0; i < PLANE_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) {
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
for (t = 0; t < ENTROPY_NODES; ++t) {
for (idx = 0; idx <= max_idx; ++idx) {
memcpy(this_branch_ct[t][idx],
branch_ct[idx][tx_size][i][j][k][l][t],
2 * sizeof(this_branch_ct[t][idx][0]));
}
}
for (t = 0; t < entropy_nodes_update; ++t) {
aom_prob newp = new_coef_probs[i][j][k][l][t];
aom_prob *oldp = old_coef_probs[i][j][k][l] + t;
int s;
int u = 0;
if (t == PIVOT_NODE)
s = av1_prob_update_search_model_subframe(
this_branch_ct, old_coef_probs[i][j][k][l], &newp, upd,
stepsize, max_idx);
else
s = av1_prob_update_search_subframe(this_branch_ct[t], *oldp,
&newp, upd, max_idx);
if (s > 0 && newp != *oldp) u = 1;
updates += u;
if (u == 0 && updates == 0) {
noupdates_before_first++;
continue;
}
if (u == 1 && updates == 1) {
int v;
// first update
aom_write_bit(bc, 1);
for (v = 0; v < noupdates_before_first; ++v)
aom_write(bc, 0, upd);
}
aom_write(bc, u, upd);
if (u) {
/* send/use new probability */
av1_write_prob_diff_update(bc, newp, *oldp);
*oldp = newp;
}
}
}
}
}
}
if (updates == 0) {
aom_write_bit(bc, 0); // no updates
}
return;
}
default: assert(0);
}
}
#endif // CONFIG_SUBFRAME_PROB_UPDATE
#if !(CONFIG_EC_ADAPT && CONFIG_NEW_TOKENSET)
static void update_coef_probs(AV1_COMP *cpi, aom_writer *w) {
const TX_MODE tx_mode = cpi->common.tx_mode;
const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
TX_SIZE tx_size;
#if CONFIG_SUBFRAME_PROB_UPDATE
AV1_COMMON *cm = &cpi->common;
SUBFRAME_STATS *subframe_stats = &cpi->subframe_stats;
int i;
av1_coeff_probs_model dummy_frame_coef_probs[PLANE_TYPES];
if (cm->do_subframe_update &&
cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
av1_copy(cpi->common.fc->coef_probs,
subframe_stats->enc_starting_coef_probs);
for (i = 0; i <= cpi->common.coef_probs_update_idx; ++i) {
get_coef_counts_diff(cpi, i, cpi->wholeframe_stats.coef_counts_buf[i],
cpi->wholeframe_stats.eob_counts_buf[i]);
}
}
#endif // CONFIG_SUBFRAME_PROB_UPDATE
for (tx_size = 0; tx_size <= max_tx_size; ++tx_size) {
av1_coeff_stats frame_branch_ct[PLANE_TYPES];
......@@ -3486,61 +3263,11 @@ static void update_coef_probs(AV1_COMP *cpi, aom_writer *w) {
(tx_size >= TX_16X16 && cpi->sf.tx_size_search_method == USE_TX_8X8)) {
aom_write_bit(w, 0);
} else {
#if CONFIG_SUBFRAME_PROB_UPDATE
if (cm->do_subframe_update &&
cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
unsigned int this_eob_counts_copy[PLANE_TYPES][REF_TYPES][COEF_BANDS]
[COEFF_CONTEXTS];
av1_coeff_count coef_counts_copy[PLANE_TYPES];
av1_copy(this_eob_counts_copy, cpi->common.counts.eob_branch[tx_size]);
av1_copy(coef_counts_copy, cpi->td.rd_counts.coef_counts[tx_size]);
build_tree_distribution(cpi, tx_size, frame_branch_ct,
frame_coef_probs);
for (i = 0; i <= cpi->common.coef_probs_update_idx; ++i) {
av1_copy(cpi->common.counts.eob_branch[tx_size],
cpi->wholeframe_stats.eob_counts_buf[i][tx_size]);
av1_copy(cpi->td.rd_counts.coef_counts[tx_size],
cpi->wholeframe_stats.coef_counts_buf[i][tx_size]);
build_tree_distribution(cpi, tx_size, cpi->branch_ct_buf[i][tx_size],
dummy_frame_coef_probs);
}
av1_copy(cpi->common.counts.eob_branch[tx_size], this_eob_counts_copy);
av1_copy(cpi->td.rd_counts.coef_counts[tx_size], coef_counts_copy);
update_coef_probs_subframe(w, cpi, tx_size, cpi->branch_ct_buf,
frame_coef_probs);
} else {
#endif // CONFIG_SUBFRAME_PROB_UPDATE
build_tree_distribution(cpi, tx_size, frame_branch_ct,
frame_coef_probs);
update_coef_probs_common(w, cpi, tx_size, frame_branch_ct,
frame_coef_probs);
#if CONFIG_SUBFRAME_PROB_UPDATE
}
#endif // CONFIG_SUBFRAME_PROB_UPDATE
}
}
#if CONFIG_SUBFRAME_PROB_UPDATE
av1_copy(cm->starting_coef_probs, cm->fc->coef_probs);
av1_copy(subframe_stats->coef_probs_buf[0], cm->fc->coef_probs);
if (cm->do_subframe_update &&
cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
unsigned int eob_counts_copy[TX_SIZES][PLANE_TYPES][REF_TYPES][COEF_BANDS]
[COEFF_CONTEXTS];
av1_copy(eob_counts_copy, cm->counts.eob_branch);
for (i = 1; i <= cpi->common.coef_probs_update_idx; ++i) {
for (tx_size = 0; tx_size <= max_tx_size; ++tx_size)
av1_full_to_model_counts(cm->counts.coef[tx_size],
subframe_stats->coef_counts_buf[i][tx_size]);
av1_copy(cm->counts.eob_branch, subframe_stats->eob_counts_buf[i]);
av1_partial_adapt_probs(cm, 0, 0);
av1_copy(subframe_stats->coef_probs_buf[i], cm->fc->coef_probs);
build_tree_distribution(cpi, tx_size, frame_branch_ct, frame_coef_probs);
update_coef_probs_common(w, cpi, tx_size, frame_branch_ct,
frame_coef_probs);
}
av1_copy(cm->fc->coef_probs, subframe_stats->coef_probs_buf[0]);
av1_copy(cm->counts.eob_branch, eob_counts_copy);
}
#endif // CONFIG_SUBFRAME_PROB_UPDATE
}
#endif // !(CONFIG_EC_ADAPT && CONFIG_NEW_TOKENSET)
#endif // !CONFIG_EC_ADAPT
......
......@@ -472,14 +472,8 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
unsigned int(*const counts)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
td->rd_counts.coef_counts[txsize_sqr_map[tx_size]][type][ref];
#if !CONFIG_NEW_TOKENSET
#if CONFIG_SUBFRAME_PROB_UPDATE
const aom_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
cpi->subframe_stats.coef_probs_buf[cpi->common.coef_probs_update_idx]
[txsize_sqr_map[tx_size]][type][ref];
#else
aom_prob(*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
cpi->common.fc->coef_probs[txsize_sqr_map[tx_size]][type][ref];
#endif // CONFIG_SUBFRAME_PROB_UPDATE
#endif // !CONFIG_NEW_TOKENSET
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
......
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