Merge "Cleaning up vp9_entropy.h file."

This commit is contained in:
Dmitry Kovalev 2013-12-04 16:46:41 -08:00 коммит произвёл Gerrit Code Review
Родитель 97b36b26e0 8e89e2f2e0
Коммит 3712b58c2f
11 изменённых файлов: 83 добавлений и 85 удалений

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

@ -26,8 +26,9 @@
#include "vp9/common/vp9_seg_common.h" #include "vp9/common/vp9_seg_common.h"
#include "vp9/common/vp9_treecoder.h" #include "vp9/common/vp9_treecoder.h"
#define BLOCK_SIZE_GROUPS 4 #define BLOCK_SIZE_GROUPS 4
#define MBSKIP_CONTEXTS 3 #define MBSKIP_CONTEXTS 3
#define INTER_MODE_CONTEXTS 7
/* Segment Feature Masks */ /* Segment Feature Masks */
#define MAX_MV_REF_CANDIDATES 2 #define MAX_MV_REF_CANDIDATES 2

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

@ -109,13 +109,13 @@ DECLARE_ALIGNED(16, const uint8_t, vp9_coefband_trans_4x4[16]) = {
0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5,
}; };
DECLARE_ALIGNED(16, const uint8_t, vp9_pt_energy_class[MAX_ENTROPY_TOKENS]) = { DECLARE_ALIGNED(16, const uint8_t, vp9_pt_energy_class[ENTROPY_TOKENS]) = {
0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5 0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5
}; };
const vp9_tree_index vp9_coefmodel_tree[6] = { const vp9_tree_index vp9_coefmodel_tree[TREE_SIZE(UNCONSTRAINED_NODES + 1)] = {
-DCT_EOB_MODEL_TOKEN, 2, /* 0 = EOB */ -EOB_MODEL_TOKEN, 2,
-ZERO_TOKEN, 4, /* 1 = ZERO */ -ZERO_TOKEN, 4,
-ONE_TOKEN, -TWO_TOKEN, -ONE_TOKEN, -TWO_TOKEN,
}; };

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

@ -21,30 +21,27 @@
#define DIFF_UPDATE_PROB 252 #define DIFF_UPDATE_PROB 252
/* Coefficient token alphabet */ // Coefficient token alphabet
#define ZERO_TOKEN 0 // 0 Extra Bits 0+0
#define ONE_TOKEN 1 // 1 Extra Bits 0+1
#define TWO_TOKEN 2 // 2 Extra Bits 0+1
#define THREE_TOKEN 3 // 3 Extra Bits 0+1
#define FOUR_TOKEN 4 // 4 Extra Bits 0+1
#define CATEGORY1_TOKEN 5 // 5-6 Extra Bits 1+1
#define CATEGORY2_TOKEN 6 // 7-10 Extra Bits 2+1
#define CATEGORY3_TOKEN 7 // 11-18 Extra Bits 3+1
#define CATEGORY4_TOKEN 8 // 19-34 Extra Bits 4+1
#define CATEGORY5_TOKEN 9 // 35-66 Extra Bits 5+1
#define CATEGORY6_TOKEN 10 // 67+ Extra Bits 14+1
#define EOB_TOKEN 11 // EOB Extra Bits 0+0
#define ZERO_TOKEN 0 /* 0 Extra Bits 0+0 */ #define ENTROPY_TOKENS 12
#define ONE_TOKEN 1 /* 1 Extra Bits 0+1 */
#define TWO_TOKEN 2 /* 2 Extra Bits 0+1 */
#define THREE_TOKEN 3 /* 3 Extra Bits 0+1 */
#define FOUR_TOKEN 4 /* 4 Extra Bits 0+1 */
#define DCT_VAL_CATEGORY1 5 /* 5-6 Extra Bits 1+1 */
#define DCT_VAL_CATEGORY2 6 /* 7-10 Extra Bits 2+1 */
#define DCT_VAL_CATEGORY3 7 /* 11-18 Extra Bits 3+1 */
#define DCT_VAL_CATEGORY4 8 /* 19-34 Extra Bits 4+1 */
#define DCT_VAL_CATEGORY5 9 /* 35-66 Extra Bits 5+1 */
#define DCT_VAL_CATEGORY6 10 /* 67+ Extra Bits 14+1 */
#define DCT_EOB_TOKEN 11 /* EOB Extra Bits 0+0 */
#define MAX_ENTROPY_TOKENS 12
#define ENTROPY_NODES 11
#define EOSB_TOKEN 127 /* Not signalled, encoder only */
#define INTER_MODE_CONTEXTS 7 #define ENTROPY_NODES 11
extern DECLARE_ALIGNED(16, const uint8_t, extern DECLARE_ALIGNED(16, const uint8_t, vp9_pt_energy_class[ENTROPY_TOKENS]);
vp9_pt_energy_class[MAX_ENTROPY_TOKENS]);
#define DCT_EOB_MODEL_TOKEN 3 /* EOB Extra Bits 0+0 */ #define EOB_MODEL_TOKEN 3
extern const vp9_tree_index vp9_coefmodel_tree[]; extern const vp9_tree_index vp9_coefmodel_tree[];
typedef struct { typedef struct {
@ -55,7 +52,7 @@ typedef struct {
} vp9_extra_bit; } vp9_extra_bit;
// indexed by token value // indexed by token value
extern const vp9_extra_bit vp9_extra_bits[MAX_ENTROPY_TOKENS]; extern const vp9_extra_bit vp9_extra_bits[ENTROPY_TOKENS];
#define MAX_PROB 255 #define MAX_PROB 255
#define DCT_MAX_VALUE 16384 #define DCT_MAX_VALUE 16384
@ -90,7 +87,7 @@ extern const vp9_extra_bit vp9_extra_bits[MAX_ENTROPY_TOKENS];
// #define ENTROPY_STATS // #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][PREV_COEF_CONTEXTS]
[MAX_ENTROPY_TOKENS]; [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][PREV_COEF_CONTEXTS]
[ENTROPY_NODES][2]; [ENTROPY_NODES][2];

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

@ -116,7 +116,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
if (!cm->frame_parallel_decoding_mode) if (!cm->frame_parallel_decoding_mode)
++eob_branch_count[band][pt]; ++eob_branch_count[band][pt];
if (!vp9_read(r, prob[EOB_CONTEXT_NODE])) { if (!vp9_read(r, prob[EOB_CONTEXT_NODE])) {
INCREMENT_COUNT(DCT_EOB_MODEL_TOKEN); INCREMENT_COUNT(EOB_MODEL_TOKEN);
break; break;
} }
@ -156,12 +156,12 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
if (!vp9_read(r, prob[CAT_ONE_CONTEXT_NODE])) { if (!vp9_read(r, prob[CAT_ONE_CONTEXT_NODE])) {
val = CAT1_MIN_VAL; val = CAT1_MIN_VAL;
ADJUST_COEF(CAT1_PROB0, 0); ADJUST_COEF(CAT1_PROB0, 0);
WRITE_COEF_CONTINUE(val, DCT_VAL_CATEGORY1); WRITE_COEF_CONTINUE(val, CATEGORY1_TOKEN);
} }
val = CAT2_MIN_VAL; val = CAT2_MIN_VAL;
ADJUST_COEF(CAT2_PROB1, 1); ADJUST_COEF(CAT2_PROB1, 1);
ADJUST_COEF(CAT2_PROB0, 0); ADJUST_COEF(CAT2_PROB0, 0);
WRITE_COEF_CONTINUE(val, DCT_VAL_CATEGORY2); WRITE_COEF_CONTINUE(val, CATEGORY2_TOKEN);
} }
if (!vp9_read(r, prob[CAT_THREEFOUR_CONTEXT_NODE])) { if (!vp9_read(r, prob[CAT_THREEFOUR_CONTEXT_NODE])) {
@ -170,14 +170,14 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
ADJUST_COEF(CAT3_PROB2, 2); ADJUST_COEF(CAT3_PROB2, 2);
ADJUST_COEF(CAT3_PROB1, 1); ADJUST_COEF(CAT3_PROB1, 1);
ADJUST_COEF(CAT3_PROB0, 0); ADJUST_COEF(CAT3_PROB0, 0);
WRITE_COEF_CONTINUE(val, DCT_VAL_CATEGORY3); WRITE_COEF_CONTINUE(val, CATEGORY3_TOKEN);
} }
val = CAT4_MIN_VAL; val = CAT4_MIN_VAL;
ADJUST_COEF(CAT4_PROB3, 3); ADJUST_COEF(CAT4_PROB3, 3);
ADJUST_COEF(CAT4_PROB2, 2); ADJUST_COEF(CAT4_PROB2, 2);
ADJUST_COEF(CAT4_PROB1, 1); ADJUST_COEF(CAT4_PROB1, 1);
ADJUST_COEF(CAT4_PROB0, 0); ADJUST_COEF(CAT4_PROB0, 0);
WRITE_COEF_CONTINUE(val, DCT_VAL_CATEGORY4); WRITE_COEF_CONTINUE(val, CATEGORY4_TOKEN);
} }
if (!vp9_read(r, prob[CAT_FIVE_CONTEXT_NODE])) { if (!vp9_read(r, prob[CAT_FIVE_CONTEXT_NODE])) {
@ -187,7 +187,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
ADJUST_COEF(CAT5_PROB2, 2); ADJUST_COEF(CAT5_PROB2, 2);
ADJUST_COEF(CAT5_PROB1, 1); ADJUST_COEF(CAT5_PROB1, 1);
ADJUST_COEF(CAT5_PROB0, 0); ADJUST_COEF(CAT5_PROB0, 0);
WRITE_COEF_CONTINUE(val, DCT_VAL_CATEGORY5); WRITE_COEF_CONTINUE(val, CATEGORY5_TOKEN);
} }
val = 0; val = 0;
cat6 = cat6_prob; cat6 = cat6_prob;
@ -195,7 +195,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
val = (val << 1) | vp9_read(r, *cat6++); val = (val << 1) | vp9_read(r, *cat6++);
val += CAT6_MIN_VAL; val += CAT6_MIN_VAL;
WRITE_COEF_CONTINUE(val, DCT_VAL_CATEGORY6); WRITE_COEF_CONTINUE(val, CATEGORY6_TOKEN);
} }
return c; return c;

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

@ -176,7 +176,7 @@ static void pack_mb_tokens(vp9_writer* const w,
// is split into two treed writes. The first treed write takes care of the // is split into two treed writes. The first treed write takes care of the
// unconstrained nodes. The second treed write takes care of the // unconstrained nodes. The second treed write takes care of the
// constrained nodes. // constrained nodes.
if (t >= TWO_TOKEN && t < DCT_EOB_TOKEN) { if (t >= TWO_TOKEN && t < EOB_TOKEN) {
int len = UNCONSTRAINED_NODES - p->skip_eob_node; int len = UNCONSTRAINED_NODES - p->skip_eob_node;
int bits = v >> (n - len); int bits = v >> (n - len);
treed_write(w, vp9_coef_tree, p->context_tree, bits, len, i); treed_write(w, vp9_coef_tree, p->context_tree, bits, len, i);
@ -576,10 +576,10 @@ static void build_tree_distribution(VP9_COMP *cpi, TX_SIZE tx_size) {
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
if (!cpi->dummy_packing) { if (!cpi->dummy_packing) {
int t; int t;
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t) for (t = 0; t < ENTROPY_TOKENS; ++t)
context_counters[tx_size][i][j][k][l][t] += context_counters[tx_size][i][j][k][l][t] +=
coef_counts[i][j][k][l][t]; coef_counts[i][j][k][l][t];
context_counters[tx_size][i][j][k][l][MAX_ENTROPY_TOKENS] += context_counters[tx_size][i][j][k][l][ENTROPY_TOKENS] +=
eob_branch_ct[i][j][k][l]; eob_branch_ct[i][j][k][l];
} }
#endif #endif

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

@ -87,7 +87,7 @@ struct macroblock_plane {
/* The [2] dimension is for whether we skip the EOB node (i.e. if previous /* The [2] dimension is for whether we skip the EOB node (i.e. if previous
* coefficient in this block was zero) or not. */ * coefficient in this block was zero) or not. */
typedef unsigned int vp9_coeff_cost[BLOCK_TYPES][REF_TYPES][COEF_BANDS][2] typedef unsigned int vp9_coeff_cost[BLOCK_TYPES][REF_TYPES][COEF_BANDS][2]
[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS]; [PREV_COEF_CONTEXTS][ENTROPY_TOKENS];
typedef struct macroblock MACROBLOCK; typedef struct macroblock MACROBLOCK;
struct macroblock { struct macroblock {

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

@ -176,7 +176,7 @@ static void optimize_b(MACROBLOCK *mb,
tokens[eob][0].rate = 0; tokens[eob][0].rate = 0;
tokens[eob][0].error = 0; tokens[eob][0].error = 0;
tokens[eob][0].next = default_eob; tokens[eob][0].next = default_eob;
tokens[eob][0].token = DCT_EOB_TOKEN; tokens[eob][0].token = EOB_TOKEN;
tokens[eob][0].qc = 0; tokens[eob][0].qc = 0;
*(tokens[eob] + 1) = *(tokens[eob] + 0); *(tokens[eob] + 1) = *(tokens[eob] + 0);
next = eob; next = eob;
@ -243,21 +243,19 @@ static void optimize_b(MACROBLOCK *mb,
/* If we reduced this coefficient to zero, check to see if /* If we reduced this coefficient to zero, check to see if
* we need to move the EOB back here. * we need to move the EOB back here.
*/ */
t0 = tokens[next][0].token == DCT_EOB_TOKEN ? t0 = tokens[next][0].token == EOB_TOKEN ? EOB_TOKEN : ZERO_TOKEN;
DCT_EOB_TOKEN : ZERO_TOKEN; t1 = tokens[next][1].token == EOB_TOKEN ? EOB_TOKEN : ZERO_TOKEN;
t1 = tokens[next][1].token == DCT_EOB_TOKEN ?
DCT_EOB_TOKEN : ZERO_TOKEN;
} else { } else {
t0 = t1 = (vp9_dct_value_tokens_ptr + x)->token; t0 = t1 = (vp9_dct_value_tokens_ptr + x)->token;
} }
if (next < default_eob) { if (next < default_eob) {
band = band_translate[i + 1]; band = band_translate[i + 1];
if (t0 != DCT_EOB_TOKEN) { if (t0 != EOB_TOKEN) {
pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache); pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache);
rate0 += mb->token_costs[tx_size][type][ref][band][!x][pt] rate0 += mb->token_costs[tx_size][type][ref][band][!x][pt]
[tokens[next][0].token]; [tokens[next][0].token];
} }
if (t1 != DCT_EOB_TOKEN) { if (t1 != EOB_TOKEN) {
pt = trellis_get_coeff_context(scan, nb, i, t1, token_cache); pt = trellis_get_coeff_context(scan, nb, i, t1, token_cache);
rate1 += mb->token_costs[tx_size][type][ref][band][!x][pt] rate1 += mb->token_costs[tx_size][type][ref][band][!x][pt]
[tokens[next][1].token]; [tokens[next][1].token];
@ -289,12 +287,12 @@ static void optimize_b(MACROBLOCK *mb,
t0 = tokens[next][0].token; t0 = tokens[next][0].token;
t1 = tokens[next][1].token; t1 = tokens[next][1].token;
/* Update the cost of each path if we're past the EOB token. */ /* Update the cost of each path if we're past the EOB token. */
if (t0 != DCT_EOB_TOKEN) { if (t0 != EOB_TOKEN) {
tokens[next][0].rate += tokens[next][0].rate +=
mb->token_costs[tx_size][type][ref][band][1][0][t0]; mb->token_costs[tx_size][type][ref][band][1][0][t0];
tokens[next][0].token = ZERO_TOKEN; tokens[next][0].token = ZERO_TOKEN;
} }
if (t1 != DCT_EOB_TOKEN) { if (t1 != EOB_TOKEN) {
tokens[next][1].rate += tokens[next][1].rate +=
mb->token_costs[tx_size][type][ref][band][1][0][t1]; mb->token_costs[tx_size][type][ref][band][1][0][t1];
tokens[next][1].token = ZERO_TOKEN; tokens[next][1].token = ZERO_TOKEN;

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

@ -2609,9 +2609,9 @@ static void full_to_model_count(unsigned int *model_count,
model_count[ZERO_TOKEN] = full_count[ZERO_TOKEN]; model_count[ZERO_TOKEN] = full_count[ZERO_TOKEN];
model_count[ONE_TOKEN] = full_count[ONE_TOKEN]; model_count[ONE_TOKEN] = full_count[ONE_TOKEN];
model_count[TWO_TOKEN] = full_count[TWO_TOKEN]; model_count[TWO_TOKEN] = full_count[TWO_TOKEN];
for (n = THREE_TOKEN; n < DCT_EOB_TOKEN; ++n) for (n = THREE_TOKEN; n < EOB_TOKEN; ++n)
model_count[TWO_TOKEN] += full_count[n]; model_count[TWO_TOKEN] += full_count[n];
model_count[DCT_EOB_MODEL_TOKEN] = full_count[DCT_EOB_TOKEN]; model_count[EOB_MODEL_TOKEN] = full_count[EOB_TOKEN];
} }
static void full_to_model_counts( static void full_to_model_counts(

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

@ -165,8 +165,8 @@ static void fill_token_costs(vp9_coeff_cost *c,
vp9_coef_tree); vp9_coef_tree);
vp9_cost_tokens_skip((int *)c[t][i][j][k][1][l], probs, vp9_cost_tokens_skip((int *)c[t][i][j][k][1][l], probs,
vp9_coef_tree); vp9_coef_tree);
assert(c[t][i][j][k][0][l][DCT_EOB_TOKEN] == assert(c[t][i][j][k][0][l][EOB_TOKEN] ==
c[t][i][j][k][1][l][DCT_EOB_TOKEN]); c[t][i][j][k][1][l][EOB_TOKEN]);
} }
} }
@ -528,7 +528,7 @@ static INLINE int cost_coeffs(MACROBLOCK *x,
const int eob = p->eobs[block]; const int eob = p->eobs[block];
const int16_t *const qcoeff_ptr = BLOCK_OFFSET(p->qcoeff, block); const int16_t *const qcoeff_ptr = BLOCK_OFFSET(p->qcoeff, block);
const int ref = mbmi->ref_frame[0] != INTRA_FRAME; const int ref = mbmi->ref_frame[0] != INTRA_FRAME;
unsigned int (*token_costs)[2][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS] = unsigned int (*token_costs)[2][PREV_COEF_CONTEXTS][ENTROPY_TOKENS] =
x->token_costs[tx_size][type][ref]; x->token_costs[tx_size][type][ref];
const ENTROPY_CONTEXT above_ec = !!*A, left_ec = !!*L; const ENTROPY_CONTEXT above_ec = !!*A, left_ec = !!*L;
uint8_t *p_tok = x->token_cache; uint8_t *p_tok = x->token_cache;
@ -541,7 +541,7 @@ static INLINE int cost_coeffs(MACROBLOCK *x,
if (eob == 0) { if (eob == 0) {
// single eob token // single eob token
cost = token_costs[0][0][pt][DCT_EOB_TOKEN]; cost = token_costs[0][0][pt][EOB_TOKEN];
c = 0; c = 0;
} else { } else {
int band_left = *band_count++; int band_left = *band_count++;
@ -573,7 +573,7 @@ static INLINE int cost_coeffs(MACROBLOCK *x,
// eob token // eob token
if (band_left) { if (band_left) {
pt = get_coef_context(nb, p_tok, c); pt = get_coef_context(nb, p_tok, c);
cost += (*token_costs)[0][pt][DCT_EOB_TOKEN]; cost += (*token_costs)[0][pt][EOB_TOKEN];
} }
} }

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

@ -27,30 +27,30 @@ static int dct_value_cost[DCT_MAX_VALUE * 2];
const int *vp9_dct_value_cost_ptr; const int *vp9_dct_value_cost_ptr;
// Array indices are identical to previously-existing CONTEXT_NODE indices // Array indices are identical to previously-existing CONTEXT_NODE indices
const vp9_tree_index vp9_coef_tree[TREE_SIZE(MAX_ENTROPY_TOKENS)] = { const vp9_tree_index vp9_coef_tree[TREE_SIZE(ENTROPY_TOKENS)] = {
-DCT_EOB_TOKEN, 2, /* 0 = EOB */ -EOB_TOKEN, 2, // 0 = EOB
-ZERO_TOKEN, 4, /* 1 = ZERO */ -ZERO_TOKEN, 4, // 1 = ZERO
-ONE_TOKEN, 6, /* 2 = ONE */ -ONE_TOKEN, 6, // 2 = ONE
8, 12, /* 3 = LOW_VAL */ 8, 12, // 3 = LOW_VAL
-TWO_TOKEN, 10, /* 4 = TWO */ -TWO_TOKEN, 10, // 4 = TWO
-THREE_TOKEN, -FOUR_TOKEN, /* 5 = THREE */ -THREE_TOKEN, -FOUR_TOKEN, // 5 = THREE
14, 16, /* 6 = HIGH_LOW */ 14, 16, // 6 = HIGH_LOW
-DCT_VAL_CATEGORY1, -DCT_VAL_CATEGORY2, /* 7 = CAT_ONE */ -CATEGORY1_TOKEN, -CATEGORY2_TOKEN, // 7 = CAT_ONE
18, 20, /* 8 = CAT_THREEFOUR */ 18, 20, // 8 = CAT_THREEFOUR
-DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4, /* 9 = CAT_THREE */ -CATEGORY3_TOKEN, -CATEGORY4_TOKEN, // 9 = CAT_THREE
-DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 10 = CAT_FIVE */ -CATEGORY5_TOKEN, -CATEGORY6_TOKEN // 10 = CAT_FIVE
}; };
// Unconstrained Node Tree // Unconstrained Node Tree
const vp9_tree_index vp9_coef_con_tree[TREE_SIZE(MAX_ENTROPY_TOKENS)] = { const vp9_tree_index vp9_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)] = {
2, 6, /* 0 = LOW_VAL */ 2, 6, // 0 = LOW_VAL
-TWO_TOKEN, 4, /* 1 = TWO */ -TWO_TOKEN, 4, // 1 = TWO
-THREE_TOKEN, -FOUR_TOKEN, /* 2 = THREE */ -THREE_TOKEN, -FOUR_TOKEN, // 2 = THREE
8, 10, /* 3 = HIGH_LOW */ 8, 10, // 3 = HIGH_LOW
-DCT_VAL_CATEGORY1, -DCT_VAL_CATEGORY2, /* 4 = CAT_ONE */ -CATEGORY1_TOKEN, -CATEGORY2_TOKEN, // 4 = CAT_ONE
12, 14, /* 5 = CAT_THREEFOUR */ 12, 14, // 5 = CAT_THREEFOUR
-DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4, /* 6 = CAT_THREE */ -CATEGORY3_TOKEN, -CATEGORY4_TOKEN, // 6 = CAT_THREE
-DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 7 = CAT_FIVE */ -CATEGORY5_TOKEN, -CATEGORY6_TOKEN // 7 = CAT_FIVE
}; };
static const vp9_prob Pcat1[] = { 159}; static const vp9_prob Pcat1[] = { 159};
@ -84,22 +84,22 @@ static void init_bit_trees() {
init_bit_tree(cat6, 14); init_bit_tree(cat6, 14);
} }
const vp9_extra_bit vp9_extra_bits[MAX_ENTROPY_TOKENS] = { const vp9_extra_bit vp9_extra_bits[ENTROPY_TOKENS] = {
{0, 0, 0, 0}, // ZERO_TOKEN {0, 0, 0, 0}, // ZERO_TOKEN
{0, 0, 0, 1}, // ONE_TOKEN {0, 0, 0, 1}, // ONE_TOKEN
{0, 0, 0, 2}, // TWO_TOKEN {0, 0, 0, 2}, // TWO_TOKEN
{0, 0, 0, 3}, // THREE_TOKEN {0, 0, 0, 3}, // THREE_TOKEN
{0, 0, 0, 4}, // FOUR_TOKEN {0, 0, 0, 4}, // FOUR_TOKEN
{cat1, Pcat1, 1, 5}, // DCT_VAL_CATEGORY1 {cat1, Pcat1, 1, 5}, // CATEGORY1_TOKEN
{cat2, Pcat2, 2, 7}, // DCT_VAL_CATEGORY2 {cat2, Pcat2, 2, 7}, // CATEGORY2_TOKEN
{cat3, Pcat3, 3, 11}, // DCT_VAL_CATEGORY3 {cat3, Pcat3, 3, 11}, // CATEGORY3_TOKEN
{cat4, Pcat4, 4, 19}, // DCT_VAL_CATEGORY4 {cat4, Pcat4, 4, 19}, // CATEGORY4_TOKEN
{cat5, Pcat5, 5, 35}, // DCT_VAL_CATEGORY5 {cat5, Pcat5, 5, 35}, // CATEGORY5_TOKEN
{cat6, Pcat6, 14, 67}, // DCT_VAL_CATEGORY6 {cat6, Pcat6, 14, 67}, // CATEGORY6_TOKEN
{0, 0, 0, 0} // DCT_EOB_TOKEN {0, 0, 0, 0} // EOB_TOKEN
}; };
struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS]; struct vp9_token vp9_coef_encodings[ENTROPY_TOKENS];
void vp9_coef_tree_initialize() { void vp9_coef_tree_initialize() {
init_bit_trees(); init_bit_trees();
@ -226,7 +226,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
t->extra = vp9_dct_value_tokens_ptr[v].extra; t->extra = vp9_dct_value_tokens_ptr[v].extra;
token = vp9_dct_value_tokens_ptr[v].token; token = vp9_dct_value_tokens_ptr[v].token;
} else { } else {
token = DCT_EOB_TOKEN; token = EOB_TOKEN;
} }
t->token = token; t->token = token;

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

@ -16,6 +16,8 @@
void vp9_tokenize_initialize(); void vp9_tokenize_initialize();
#define EOSB_TOKEN 127 // Not signalled, encoder only
typedef struct { typedef struct {
int16_t token; int16_t token;
int16_t extra; int16_t extra;