Commit 10e1da9a authored by Thomas Daede's avatar Thomas Daede

Store pre_fc in AV1_COMMON rather than computing it on the spot.

Prep work for changing how frame contexts are signaled.

Change-Id: I0db8ec631fc2d616d16fabaf72eac5663ffe3630
parent 9fa02487
......@@ -6139,7 +6139,7 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
unsigned int count_sat,
unsigned int update_factor) {
const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
const FRAME_CONTEXT *pre_fc = cm->pre_fc;
av1_coeff_probs_model *const probs = cm->fc->coef_probs[tx_size];
const av1_coeff_probs_model *const pre_probs = pre_fc->coef_probs[tx_size];
const av1_coeff_count_model *const counts =
......
......@@ -3455,7 +3455,7 @@ const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
int i, j;
FRAME_CONTEXT *fc = cm->fc;
const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
const FRAME_CONTEXT *pre_fc = cm->pre_fc;
const FRAME_COUNTS *counts = &cm->counts;
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
......@@ -3586,7 +3586,7 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
void av1_adapt_intra_frame_probs(AV1_COMMON *cm) {
int i, j;
FRAME_CONTEXT *fc = cm->fc;
const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
const FRAME_CONTEXT *pre_fc = cm->pre_fc;
const FRAME_COUNTS *counts = &cm->counts;
if (cm->tx_mode == TX_MODE_SELECT) {
......
......@@ -235,20 +235,19 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
#if CONFIG_REF_MV
int idx;
for (idx = 0; idx < NMV_CONTEXTS; ++idx) {
nmv_context *fc = &cm->fc->nmvc[idx];
const nmv_context *pre_fc =
&cm->frame_contexts[cm->frame_context_idx].nmvc[idx];
nmv_context *nmvc = &cm->fc->nmvc[idx];
const nmv_context *pre_nmvc = &cm->pre_fc->nmvc[idx];
const nmv_context_counts *counts = &cm->counts.mv[idx];
#else
nmv_context *fc = &cm->fc->nmvc;
const nmv_context *pre_fc = &cm->frame_contexts[cm->frame_context_idx].nmvc;
nmv_context *nmvc = &cm->fc->nmvc;
const nmv_context *pre_nmvc = &cm->pre_fc.nmvc;
const nmv_context_counts *counts = &cm->counts.mv;
#endif // CONFIG_REF_MV
aom_tree_merge_probs(av1_mv_joint_tree, pre_fc->joints, counts->joints,
fc->joints);
aom_tree_merge_probs(av1_mv_joint_tree, pre_nmvc->joints, counts->joints,
nmvc->joints);
for (i = 0; i < 2; ++i) {
nmv_component *comp = &fc->comps[i];
const nmv_component *pre_comp = &pre_fc->comps[i];
nmv_component *comp = &nmvc->comps[i];
const nmv_component *pre_comp = &pre_nmvc->comps[i];
const nmv_component_counts *c = &counts->comps[i];
comp->sign = av1_mode_mv_merge_probs(pre_comp->sign, c->sign);
......
......@@ -331,6 +331,7 @@ typedef struct AV1Common {
FRAME_CONTEXT *fc; /* this frame entropy */
FRAME_CONTEXT *frame_contexts; // FRAME_CONTEXTS
FRAME_CONTEXT *pre_fc; // Context referenced in this frame
unsigned int frame_context_idx; /* Context to use/update */
FRAME_COUNTS counts;
......
......@@ -6606,7 +6606,7 @@ static INLINE int clamp_64(int64_t value, int low, int high) {
static void update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type,
int rate_16) {
FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
FRAME_CONTEXT *pre_fc = cm->pre_fc;
uint32_t *prev_non_zero_prob = get_non_zero_prob(pre_fc, tx_size, tx_type);
uint32_t *non_zero_prob = get_non_zero_prob(cm->fc, tx_size, tx_type);
uint32_t *non_zero_count = get_non_zero_counts(&cm->counts, tx_size, tx_type);
......
......@@ -98,7 +98,7 @@ const int16_t av1_coeff_band_32x32[1024] = {
void av1_adapt_txb_probs(AV1_COMMON *cm, unsigned int count_sat,
unsigned int update_factor) {
FRAME_CONTEXT *fc = cm->fc;
const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
const FRAME_CONTEXT *pre_fc = cm->pre_fc;
const FRAME_COUNTS *counts = &cm->counts;
TX_SIZE tx_size;
int plane, ctx, level;
......
......@@ -5007,6 +5007,7 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
av1_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y);
*cm->fc = cm->frame_contexts[cm->frame_context_idx];
cm->pre_fc = &cm->frame_contexts[cm->frame_context_idx];
if (!cm->fc->initialized)
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Uninitialized entropy context.");
......
......@@ -341,6 +341,7 @@ static void setup_frame(AV1_COMP *cpi) {
}
#endif
#endif
cm->pre_fc = &cm->frame_contexts[cm->frame_context_idx];
cpi->vaq_refresh = 0;
......
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