Commit baaaa161 authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Yaowu Xu

Centralize EC_MULTISYMBOL error checking.

The EC_ADAPT experiment cannot work unless EC_MULTISYMBOL is also
 enabled.
This patch replaces all individual checks with a centralized check in
 both the bitreader.h and bitwriter.h.

Change-Id: I418852d95c5012cc074ed65cd24997e08bc2aadd
parent 0575e6c2
......@@ -16,6 +16,10 @@
#include <limits.h>
#include "./aom_config.h"
#if CONFIG_EC_ADAPT && !CONFIG_EC_MULTISYMBOL
#error "CONFIG_EC_ADAPT is enabled without enabling CONFIG_EC_MULTISYMBOL."
#endif
#include "aom/aomdx.h"
#include "aom/aom_integer.h"
#if CONFIG_ANS
......
......@@ -14,6 +14,10 @@
#include <assert.h>
#include "./aom_config.h"
#if CONFIG_EC_ADAPT && !CONFIG_EC_MULTISYMBOL
#error "CONFIG_EC_ADAPT is enabled without enabling CONFIG_EC_MULTISYMBOL"
#endif
#if CONFIG_ANS
#include "aom_dsp/buf_ans.h"
#elif CONFIG_DAALA_EC
......
......@@ -115,7 +115,7 @@ static TX_MODE read_tx_mode(struct aom_read_bit_buffer *rb) {
return aom_rb_read_bit(rb) ? TX_MODE_SELECT : aom_rb_read_literal(rb, 2);
}
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
static void read_switchable_interp_probs(FRAME_CONTEXT *fc, aom_reader *r) {
int i, j;
for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j) {
......@@ -141,7 +141,7 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
#endif // CONFIG_EXT_INTER
#else
int j;
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
for (i = 0; i < INTER_MODE_CONTEXTS; ++i) {
for (j = 0; j < INTER_MODES - 1; ++j)
av1_diff_update_prob(r, &fc->inter_mode_probs[i][j], ACCT_STR);
......@@ -150,7 +150,7 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
#endif
}
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
#if CONFIG_EXT_INTER
static void read_inter_compound_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
int i, j;
......@@ -3748,7 +3748,7 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
av1_diff_update_prob(&r, &fc->delta_q_prob[k], ACCT_STR);
#endif
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
if (cm->seg.enabled && cm->seg.update_map) {
if (cm->seg.temporal_update) {
for (k = 0; k < PREDICTION_PROBS; k++)
......@@ -3786,7 +3786,7 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#if CONFIG_DAALA_EC
av1_copy(cm->kf_y_cdf, av1_kf_y_mode_cdf);
#endif
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
for (k = 0; k < INTRA_MODES; k++)
for (j = 0; j < INTRA_MODES; j++)
for (i = 0; i < INTRA_MODES - 1; ++i)
......@@ -3832,7 +3832,7 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
}
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
if (cm->interp_filter == SWITCHABLE) read_switchable_interp_probs(fc, &r);
#endif
......@@ -3844,7 +3844,7 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
read_frame_reference_mode_probs(cm, &r);
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
for (j = 0; j < BLOCK_SIZE_GROUPS; j++) {
for (i = 0; i < INTRA_MODES - 1; ++i)
av1_diff_update_prob(&r, &fc->y_mode_prob[j][i], ACCT_STR);
......@@ -3857,7 +3857,7 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#else
read_mv_probs(nmvc, cm->allow_high_precision_mv, &r);
#endif
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
read_ext_tx_probs(fc, &r);
#endif // EC_ADAPT, DAALA_EC
#if CONFIG_SUPERTX
......
......@@ -314,6 +314,7 @@ static void encode_unsigned_max(struct aom_write_bit_buffer *wb, int data,
aom_wb_write_literal(wb, data, get_unsigned_bits(max));
}
#if !CONFIG_EC_ADAPT
static void prob_diff_update(const aom_tree_index *tree,
aom_prob probs[/*n - 1*/],
const unsigned int counts[/*n - 1*/], int n,
......@@ -329,7 +330,6 @@ static void prob_diff_update(const aom_tree_index *tree,
av1_cond_prob_diff_update(w, &probs[i], branch_ct[i], probwt);
}
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
static int prob_diff_update_savings(const aom_tree_index *tree,
aom_prob probs[/*n - 1*/],
const unsigned int counts[/*n - 1*/], int n,
......@@ -552,7 +552,7 @@ static void update_skip_probs(AV1_COMMON *cm, aom_writer *w,
}
}
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
static void update_switchable_interp_probs(AV1_COMMON *cm, aom_writer *w,
FRAME_COUNTS *counts) {
int j;
......@@ -627,7 +627,7 @@ static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) {
}
#else
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) {
const int savings_thresh = av1_cost_one(GROUP_DIFF_UPDATE_PROB) -
......@@ -2885,7 +2885,7 @@ static void encode_segmentation(AV1_COMMON *cm, MACROBLOCKD *xd,
}
}
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
static void update_seg_probs(AV1_COMP *cpi, aom_writer *w) {
AV1_COMMON *cm = &cpi->common;
#if CONFIG_TILE_GROUPS
......@@ -3726,7 +3726,7 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
#if CONFIG_DELTA_Q
update_delta_q_probs(cm, header_bc, counts);
#endif
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
update_seg_probs(cpi, header_bc);
for (i = 0; i < INTRA_MODES; ++i) {
......@@ -3760,18 +3760,18 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
av1_copy(cm->kf_y_cdf, av1_kf_y_mode_cdf);
#endif
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
for (i = 0; i < INTRA_MODES; ++i)
for (j = 0; j < INTRA_MODES; ++j)
prob_diff_update(av1_intra_mode_tree, cm->kf_y_prob[i][j],
counts->kf_y_mode[i][j], INTRA_MODES, probwt,
header_bc);
#endif // CONFIG_EC_ADAPT, CONFIG_DAALA_EC
#endif // CONFIG_EC_ADAPT
} else {
#if CONFIG_REF_MV
update_inter_mode_probs(cm, header_bc, counts);
#else
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
for (i = 0; i < INTER_MODE_CONTEXTS; ++i) {
prob_diff_update(av1_inter_mode_tree, cm->fc->inter_mode_probs[i],
counts->inter_mode[i], INTER_MODES, probwt, header_bc);
......@@ -3812,7 +3812,7 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
prob_diff_update(av1_motion_mode_tree, fc->motion_mode_prob[i],
counts->motion_mode[i], MOTION_MODES, probwt, header_bc);
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
if (cm->interp_filter == SWITCHABLE)
update_switchable_interp_probs(cm, header_bc, counts);
#endif
......@@ -3857,7 +3857,7 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
}
}
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) {
prob_diff_update(av1_intra_mode_tree, cm->fc->y_mode_prob[i],
counts->y_mode[i], INTRA_MODES, probwt, header_bc);
......@@ -3874,7 +3874,7 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
av1_tree_to_cdf(av1_mv_joint_tree, cm->fc->nmvc.joints,
cm->fc->nmvc.joint_cdf);
#endif
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if !CONFIG_EC_ADAPT
update_ext_tx_probs(cm, header_bc);
#endif
#if CONFIG_SUPERTX
......
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