summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2013-12-05 17:54:44 -0800
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-12-05 17:54:44 -0800
commitd72c847fe80a1546e4dcf863e197523904e82642 (patch)
tree2b54fdf30dd733dfec8625b17921ee9d449e107e
parent8de1d8bfe34cdbe1cb467b2a260febb49d393441 (diff)
parent377fa8aff8d7dd965566969a84d30a9b20f73e01 (diff)
downloadlibvpx-d72c847fe80a1546e4dcf863e197523904e82642.tar
libvpx-d72c847fe80a1546e4dcf863e197523904e82642.tar.gz
libvpx-d72c847fe80a1546e4dcf863e197523904e82642.tar.bz2
libvpx-d72c847fe80a1546e4dcf863e197523904e82642.zip
Merge "Renaming PREV_COEF_CONTEXTS to COEFF_CONTEXTS."
-rw-r--r--vp9/common/vp9_entropy.c6
-rw-r--r--vp9/common/vp9_entropy.h12
-rw-r--r--vp9/common/vp9_onyxc_int.h2
-rw-r--r--vp9/decoder/vp9_decodeframe.c13
-rw-r--r--vp9/decoder/vp9_detokenize.c6
-rw-r--r--vp9/encoder/vp9_bitstream.c27
-rw-r--r--vp9/encoder/vp9_block.h2
-rw-r--r--vp9/encoder/vp9_onyx_if.c10
-rw-r--r--vp9/encoder/vp9_rdopt.c12
9 files changed, 38 insertions, 52 deletions
diff --git a/vp9/common/vp9_entropy.c b/vp9/common/vp9_entropy.c
index 285a9c262..cce05d0e5 100644
--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -760,7 +760,7 @@ static void adapt_coef_probs(VP9_COMMON *cm, TX_SIZE tx_size,
vp9_coeff_probs_model *dst_coef_probs = cm->fc.coef_probs[tx_size];
const vp9_coeff_probs_model *pre_coef_probs = pre_fc->coef_probs[tx_size];
vp9_coeff_count_model *coef_counts = cm->counts.coef[tx_size];
- unsigned int (*eob_branch_count)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] =
+ unsigned int (*eob_branch_count)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] =
cm->counts.eob_branch[tx_size];
int i, j, k, l, m;
unsigned int branch_ct[UNCONSTRAINED_NODES][2];
@@ -768,9 +768,7 @@ static void adapt_coef_probs(VP9_COMMON *cm, TX_SIZE tx_size,
for (i = 0; i < BLOCK_TYPES; ++i)
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
- for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
- if (l >= 3 && k == 0)
- continue;
+ for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
vp9_tree_probs_from_distribution(vp9_coefmodel_tree, branch_ct,
coef_counts[i][j][k][l]);
branch_ct[0][1] = eob_branch_count[i][j][k][l] - branch_ct[0][0];
diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h
index bd037d793..4560bf8b8 100644
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -82,13 +82,14 @@ extern const vp9_extra_bit vp9_extra_bits[ENTROPY_TOKENS];
coefficient band (and since zigzag positions 0, 1, and 2 are in
distinct bands). */
-#define PREV_COEF_CONTEXTS 6
+#define COEFF_CONTEXTS 6
+#define BAND_COEFF_CONTEXTS(band) ((band) == 0 ? 3 : COEFF_CONTEXTS)
// #define ENTROPY_STATS
-typedef unsigned int vp9_coeff_count[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
+typedef unsigned int vp9_coeff_count[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[ENTROPY_TOKENS];
-typedef unsigned int vp9_coeff_stats[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
+typedef unsigned int vp9_coeff_stats[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[ENTROPY_NODES][2];
#define SUBEXP_PARAM 4 /* Subexponential code parameter */
@@ -137,11 +138,10 @@ static const uint8_t *get_band_translate(TX_SIZE tx_size) {
extern const vp9_prob vp9_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES];
typedef vp9_prob vp9_coeff_probs_model[REF_TYPES][COEF_BANDS]
- [PREV_COEF_CONTEXTS]
- [UNCONSTRAINED_NODES];
+ [COEFF_CONTEXTS][UNCONSTRAINED_NODES];
typedef unsigned int vp9_coeff_count_model[REF_TYPES][COEF_BANDS]
- [PREV_COEF_CONTEXTS]
+ [COEFF_CONTEXTS]
[UNCONSTRAINED_NODES + 1];
void vp9_model_to_full_probs(const vp9_prob *model, vp9_prob *full);
diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h
index 2c410669a..dc6d1b997 100644
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -66,7 +66,7 @@ typedef struct {
unsigned int partition[PARTITION_CONTEXTS][PARTITION_TYPES];
vp9_coeff_count_model coef[TX_SIZES][BLOCK_TYPES];
unsigned int eob_branch[TX_SIZES][BLOCK_TYPES][REF_TYPES]
- [COEF_BANDS][PREV_COEF_CONTEXTS];
+ [COEF_BANDS][COEFF_CONTEXTS];
unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS];
unsigned int inter_mode[INTER_MODE_CONTEXTS][INTER_MODES];
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c
index 516aa88cb..c5ed6c894 100644
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -537,13 +537,12 @@ static void read_coef_probs_common(vp9_coeff_probs_model *coef_probs,
int i, j, k, l, m;
if (vp9_read_bit(r))
- for (i = 0; i < BLOCK_TYPES; i++)
- for (j = 0; j < REF_TYPES; j++)
- for (k = 0; k < COEF_BANDS; k++)
- for (l = 0; l < PREV_COEF_CONTEXTS; l++)
- if (k > 0 || l < 3)
- for (m = 0; m < UNCONSTRAINED_NODES; m++)
- vp9_diff_update_prob(r, &coef_probs[i][j][k][l][m]);
+ for (i = 0; i < BLOCK_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 (m = 0; m < UNCONSTRAINED_NODES; ++m)
+ vp9_diff_update_prob(r, &coef_probs[i][j][k][l][m]);
}
static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode,
diff --git a/vp9/decoder/vp9_detokenize.c b/vp9/decoder/vp9_detokenize.c
index 7f68e5b2c..63f1731de 100644
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -87,12 +87,12 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, int block,
FRAME_COUNTS *const counts = &cm->counts;
const int ref = is_inter_block(&xd->mi_8x8[0]->mbmi);
int band, c = 0;
- const vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES] =
+ const vp9_prob (*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
fc->coef_probs[tx_size][type][ref];
const vp9_prob *prob;
- unsigned int (*coef_counts)[PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES + 1] =
+ unsigned int (*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] =
counts->coef[tx_size][type][ref];
- unsigned int (*eob_branch_count)[PREV_COEF_CONTEXTS] =
+ unsigned int (*eob_branch_count)[COEFF_CONTEXTS] =
counts->eob_branch[tx_size][type][ref];
uint8_t token_cache[32 * 32];
const uint8_t *cat6;
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index 97717fb9c..276bb13c7 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -553,7 +553,7 @@ static void write_modes(VP9_COMP *cpi, const TileInfo *const tile,
static void build_tree_distribution(VP9_COMP *cpi, TX_SIZE tx_size) {
vp9_coeff_probs_model *coef_probs = cpi->frame_coef_probs[tx_size];
vp9_coeff_count *coef_counts = cpi->coef_counts[tx_size];
- unsigned int (*eob_branch_ct)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] =
+ unsigned int (*eob_branch_ct)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] =
cpi->common.counts.eob_branch[tx_size];
vp9_coeff_stats *coef_branch_ct = cpi->frame_branch_ct[tx_size];
int i, j, k, l, m;
@@ -561,9 +561,7 @@ static void build_tree_distribution(VP9_COMP *cpi, TX_SIZE tx_size) {
for (i = 0; i < BLOCK_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) {
- for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
- if (l >= 3 && k == 0)
- continue;
+ for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
vp9_tree_probs_from_distribution(vp9_coef_tree,
coef_branch_ct[i][j][k][l],
coef_counts[i][j][k][l]);
@@ -606,15 +604,12 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
for (i = 0; i < BLOCK_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) {
- for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
+ for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
for (t = 0; t < entropy_nodes_update; ++t) {
vp9_prob newp = new_frame_coef_probs[i][j][k][l][t];
const vp9_prob oldp = old_frame_coef_probs[i][j][k][l][t];
int s;
int u = 0;
-
- if (l >= 3 && k == 0)
- continue;
if (t == PIVOT_NODE)
s = vp9_prob_diff_update_savings_search_model(
frame_branch_ct[i][j][k][l][0],
@@ -645,7 +640,7 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
for (i = 0; i < BLOCK_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) {
- for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
+ for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
// calc probs and branch cts for this frame only
for (t = 0; t < entropy_nodes_update; ++t) {
vp9_prob newp = new_frame_coef_probs[i][j][k][l][t];
@@ -653,8 +648,6 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
const vp9_prob upd = DIFF_UPDATE_PROB;
int s;
int u = 0;
- if (l >= 3 && k == 0)
- continue;
if (t == PIVOT_NODE)
s = vp9_prob_diff_update_savings_search_model(
frame_branch_ct[i][j][k][l][0],
@@ -686,25 +679,23 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
case 1:
case 2: {
const int prev_coef_contexts_to_update =
- (cpi->sf.use_fast_coef_updates == 2 ?
- PREV_COEF_CONTEXTS >> 1 : PREV_COEF_CONTEXTS);
+ cpi->sf.use_fast_coef_updates == 2 ? COEFF_CONTEXTS >> 1
+ : COEFF_CONTEXTS;
const int coef_band_to_update =
- (cpi->sf.use_fast_coef_updates == 2 ?
- COEF_BANDS >> 1 : COEF_BANDS);
+ cpi->sf.use_fast_coef_updates == 2 ? COEF_BANDS >> 1
+ : COEF_BANDS;
int updates = 0;
int noupdates_before_first = 0;
for (i = 0; i < BLOCK_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) {
- for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
+ for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
// calc probs and branch cts for this frame only
for (t = 0; t < entropy_nodes_update; ++t) {
vp9_prob newp = new_frame_coef_probs[i][j][k][l][t];
vp9_prob *oldp = old_frame_coef_probs[i][j][k][l] + t;
int s;
int u = 0;
- if (l >= 3 && k == 0)
- continue;
if (l >= prev_coef_contexts_to_update ||
k >= coef_band_to_update) {
u = 0;
diff --git a/vp9/encoder/vp9_block.h b/vp9/encoder/vp9_block.h
index a34a92917..f9a0226d8 100644
--- a/vp9/encoder/vp9_block.h
+++ b/vp9/encoder/vp9_block.h
@@ -87,7 +87,7 @@ struct macroblock_plane {
/* The [2] dimension is for whether we skip the EOB node (i.e. if previous
* coefficient in this block was zero) or not. */
typedef unsigned int vp9_coeff_cost[BLOCK_TYPES][REF_TYPES][COEF_BANDS][2]
- [PREV_COEF_CONTEXTS][ENTROPY_TOKENS];
+ [COEFF_CONTEXTS][ENTROPY_TOKENS];
typedef struct macroblock MACROBLOCK;
struct macroblock {
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index 4632b0758..d40fc6673 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -2593,17 +2593,15 @@ static void full_to_model_count(unsigned int *model_count,
model_count[EOB_MODEL_TOKEN] = full_count[EOB_TOKEN];
}
-static void full_to_model_counts(
- vp9_coeff_count_model *model_count, vp9_coeff_count *full_count) {
+static void full_to_model_counts(vp9_coeff_count_model *model_count,
+ vp9_coeff_count *full_count) {
int i, j, k, l;
+
for (i = 0; i < BLOCK_TYPES; ++i)
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
- for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
- if (l >= 3 && k == 0)
- continue;
+ for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l)
full_to_model_count(model_count[i][j][k][l], full_count[i][j][k][l]);
- }
}
#if 0 && CONFIG_INTERNAL_STATS
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 71a3650fe..399c534ec 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -154,11 +154,11 @@ static void fill_token_costs(vp9_coeff_cost *c,
vp9_coeff_probs_model (*p)[BLOCK_TYPES]) {
int i, j, k, l;
TX_SIZE t;
- for (t = TX_4X4; t <= TX_32X32; t++)
- for (i = 0; i < BLOCK_TYPES; i++)
- for (j = 0; j < REF_TYPES; j++)
- for (k = 0; k < COEF_BANDS; k++)
- for (l = 0; l < PREV_COEF_CONTEXTS; l++) {
+ for (t = TX_4X4; t <= TX_32X32; ++t)
+ for (i = 0; i < BLOCK_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) {
vp9_prob probs[ENTROPY_NODES];
vp9_model_to_full_probs(p[t][i][j][k][l], probs);
vp9_cost_tokens((int *)c[t][i][j][k][0][l], probs,
@@ -528,7 +528,7 @@ static INLINE int cost_coeffs(MACROBLOCK *x,
const int eob = p->eobs[block];
const int16_t *const qcoeff_ptr = BLOCK_OFFSET(p->qcoeff, block);
const int ref = mbmi->ref_frame[0] != INTRA_FRAME;
- unsigned int (*token_costs)[2][PREV_COEF_CONTEXTS][ENTROPY_TOKENS] =
+ unsigned int (*token_costs)[2][COEFF_CONTEXTS][ENTROPY_TOKENS] =
x->token_costs[tx_size][type][ref];
const ENTROPY_CONTEXT above_ec = !!*A, left_ec = !!*L;
uint8_t *p_tok = x->token_cache;