#include "vpx_mem/vpx_mem.h"
#include "vpx/vpx_integer.h"
+const vp9_prob vp9_cat1_prob[] = { 159 };
+const vp9_prob vp9_cat2_prob[] = { 165, 145 };
+const vp9_prob vp9_cat3_prob[] = { 173, 148, 140 };
+const vp9_prob vp9_cat4_prob[] = { 176, 155, 140, 135 };
+const vp9_prob vp9_cat5_prob[] = { 180, 157, 141, 134, 130 };
+const vp9_prob vp9_cat6_prob[] = {
+ 254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129
+};
const uint8_t vp9_coefband_trans_8x8plus[1024] = {
0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
DECLARE_ALIGNED(16, extern const uint8_t, vp9_pt_energy_class[ENTROPY_TOKENS]);
+#define CAT1_MIN_VAL 5
+#define CAT2_MIN_VAL 7
+#define CAT3_MIN_VAL 11
+#define CAT4_MIN_VAL 19
+#define CAT5_MIN_VAL 35
+#define CAT6_MIN_VAL 67
+
+// Extra bit probabilities.
+DECLARE_ALIGNED(16, extern const uint8_t, vp9_cat1_prob[1]);
+DECLARE_ALIGNED(16, extern const uint8_t, vp9_cat2_prob[2]);
+DECLARE_ALIGNED(16, extern const uint8_t, vp9_cat3_prob[3]);
+DECLARE_ALIGNED(16, extern const uint8_t, vp9_cat4_prob[4]);
+DECLARE_ALIGNED(16, extern const uint8_t, vp9_cat5_prob[5]);
+DECLARE_ALIGNED(16, extern const uint8_t, vp9_cat6_prob[14]);
+
#define EOB_MODEL_TOKEN 3
extern const vp9_tree_index vp9_coefmodel_tree[];
#define CAT_THREE_CONTEXT_NODE 6
#define CAT_FIVE_CONTEXT_NODE 7
-#define CAT1_MIN_VAL 5
-#define CAT2_MIN_VAL 7
-#define CAT3_MIN_VAL 11
-#define CAT4_MIN_VAL 19
-#define CAT5_MIN_VAL 35
-#define CAT6_MIN_VAL 67
-#define CAT1_PROB0 159
-#define CAT2_PROB0 145
-#define CAT2_PROB1 165
-
-#define CAT3_PROB0 140
-#define CAT3_PROB1 148
-#define CAT3_PROB2 173
-
-#define CAT4_PROB0 135
-#define CAT4_PROB1 140
-#define CAT4_PROB2 155
-#define CAT4_PROB3 176
-
-#define CAT5_PROB0 130
-#define CAT5_PROB1 134
-#define CAT5_PROB2 141
-#define CAT5_PROB3 157
-#define CAT5_PROB4 180
-
-static const vp9_prob cat6_prob[15] = {
- 254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0
-};
-
#define INCREMENT_COUNT(token) \
do { \
if (!cm->frame_parallel_decoding_mode) \
unsigned int (*eob_branch_count)[COEFF_CONTEXTS] =
counts->eob_branch[tx_size][type][ref];
uint8_t token_cache[32 * 32];
- const uint8_t *cat6;
const uint8_t *band_translate = get_band_translate(tx_size);
const int dq_shift = (tx_size == TX_32X32);
int v;
if (!vp9_read(r, prob[HIGH_LOW_CONTEXT_NODE])) {
if (!vp9_read(r, prob[CAT_ONE_CONTEXT_NODE])) {
val = CAT1_MIN_VAL;
- ADJUST_COEF(CAT1_PROB0, 0);
+ ADJUST_COEF(vp9_cat1_prob[0], 0);
WRITE_COEF_CONTINUE(val, CATEGORY1_TOKEN);
}
val = CAT2_MIN_VAL;
- ADJUST_COEF(CAT2_PROB1, 1);
- ADJUST_COEF(CAT2_PROB0, 0);
+ ADJUST_COEF(vp9_cat2_prob[0], 1);
+ ADJUST_COEF(vp9_cat2_prob[1], 0);
WRITE_COEF_CONTINUE(val, CATEGORY2_TOKEN);
}
if (!vp9_read(r, prob[CAT_THREEFOUR_CONTEXT_NODE])) {
if (!vp9_read(r, prob[CAT_THREE_CONTEXT_NODE])) {
val = CAT3_MIN_VAL;
- ADJUST_COEF(CAT3_PROB2, 2);
- ADJUST_COEF(CAT3_PROB1, 1);
- ADJUST_COEF(CAT3_PROB0, 0);
+ ADJUST_COEF(vp9_cat3_prob[0], 2);
+ ADJUST_COEF(vp9_cat3_prob[1], 1);
+ ADJUST_COEF(vp9_cat3_prob[2], 0);
WRITE_COEF_CONTINUE(val, CATEGORY3_TOKEN);
}
val = CAT4_MIN_VAL;
- ADJUST_COEF(CAT4_PROB3, 3);
- ADJUST_COEF(CAT4_PROB2, 2);
- ADJUST_COEF(CAT4_PROB1, 1);
- ADJUST_COEF(CAT4_PROB0, 0);
+ ADJUST_COEF(vp9_cat4_prob[0], 3);
+ ADJUST_COEF(vp9_cat4_prob[1], 2);
+ ADJUST_COEF(vp9_cat4_prob[2], 1);
+ ADJUST_COEF(vp9_cat4_prob[3], 0);
WRITE_COEF_CONTINUE(val, CATEGORY4_TOKEN);
}
if (!vp9_read(r, prob[CAT_FIVE_CONTEXT_NODE])) {
val = CAT5_MIN_VAL;
- ADJUST_COEF(CAT5_PROB4, 4);
- ADJUST_COEF(CAT5_PROB3, 3);
- ADJUST_COEF(CAT5_PROB2, 2);
- ADJUST_COEF(CAT5_PROB1, 1);
- ADJUST_COEF(CAT5_PROB0, 0);
+ ADJUST_COEF(vp9_cat5_prob[0], 4);
+ ADJUST_COEF(vp9_cat5_prob[1], 3);
+ ADJUST_COEF(vp9_cat5_prob[2], 2);
+ ADJUST_COEF(vp9_cat5_prob[3], 1);
+ ADJUST_COEF(vp9_cat5_prob[4], 0);
WRITE_COEF_CONTINUE(val, CATEGORY5_TOKEN);
}
val = 0;
- cat6 = cat6_prob;
- while (*cat6)
- val = (val << 1) | vp9_read(r, *cat6++);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[0]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[1]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[2]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[3]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[4]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[5]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[6]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[7]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[8]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[9]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[10]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[11]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[12]);
+ val = (val << 1) | vp9_read(r, vp9_cat6_prob[13]);
val += CAT6_MIN_VAL;
WRITE_COEF_CONTINUE(val, CATEGORY6_TOKEN);
-CATEGORY5_TOKEN, -CATEGORY6_TOKEN // 7 = CAT_FIVE
};
-static const vp9_prob Pcat1[] = { 159};
-static const vp9_prob Pcat2[] = { 165, 145};
-static const vp9_prob Pcat3[] = { 173, 148, 140};
-static const vp9_prob Pcat4[] = { 176, 155, 140, 135};
-static const vp9_prob Pcat5[] = { 180, 157, 141, 134, 130};
-static const vp9_prob Pcat6[] = {
- 254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129
-};
-
static vp9_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[28];
static void init_bit_tree(vp9_tree_index *p, int n) {
}
const vp9_extra_bit vp9_extra_bits[ENTROPY_TOKENS] = {
- {0, 0, 0, 0}, // ZERO_TOKEN
- {0, 0, 0, 1}, // ONE_TOKEN
- {0, 0, 0, 2}, // TWO_TOKEN
- {0, 0, 0, 3}, // THREE_TOKEN
- {0, 0, 0, 4}, // FOUR_TOKEN
- {cat1, Pcat1, 1, 5}, // CATEGORY1_TOKEN
- {cat2, Pcat2, 2, 7}, // CATEGORY2_TOKEN
- {cat3, Pcat3, 3, 11}, // CATEGORY3_TOKEN
- {cat4, Pcat4, 4, 19}, // CATEGORY4_TOKEN
- {cat5, Pcat5, 5, 35}, // CATEGORY5_TOKEN
- {cat6, Pcat6, 14, 67}, // CATEGORY6_TOKEN
- {0, 0, 0, 0} // EOB_TOKEN
+ {0, 0, 0, 0}, // ZERO_TOKEN
+ {0, 0, 0, 1}, // ONE_TOKEN
+ {0, 0, 0, 2}, // TWO_TOKEN
+ {0, 0, 0, 3}, // THREE_TOKEN
+ {0, 0, 0, 4}, // FOUR_TOKEN
+ {cat1, vp9_cat1_prob, 1, CAT1_MIN_VAL}, // CATEGORY1_TOKEN
+ {cat2, vp9_cat2_prob, 2, CAT2_MIN_VAL}, // CATEGORY2_TOKEN
+ {cat3, vp9_cat3_prob, 3, CAT3_MIN_VAL}, // CATEGORY3_TOKEN
+ {cat4, vp9_cat4_prob, 4, CAT4_MIN_VAL}, // CATEGORY4_TOKEN
+ {cat5, vp9_cat5_prob, 5, CAT5_MIN_VAL}, // CATEGORY5_TOKEN
+ {cat6, vp9_cat6_prob, 14, CAT6_MIN_VAL}, // CATEGORY6_TOKEN
+ {0, 0, 0, 0} // EOB_TOKEN
};
struct vp9_token vp9_coef_encodings[ENTROPY_TOKENS];