ref: 399a6cbcde18f6759e6ff6ac42af278129db4650
parent: 626d06502f9df90bc796e4e107600242a5bca6c5
parent: 24f18e1c34406c023ae57448641374b6e655f18f
author: Dmitry Kovalev <dkovalev@google.com>
date: Sun Apr 14 00:31:39 EDT 2013
Merge "Renaming vp9_token_struct to vp9_token and removing previous typedef." into experimental
--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -386,7 +386,7 @@
-DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 10 = CAT_FIVE */
};
-struct vp9_token_struct vp9_coef_encodings[MAX_ENTROPY_TOKENS];
+struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS];
/* Trees for extra bits. Probabilities are constant and
do not depend on previously encoded bits */
@@ -408,7 +408,7 @@
-NZC_3TO4, 8,
-NZC_5TO8, -NZC_9TO16,
};
-struct vp9_token_struct vp9_nzc4x4_encodings[NZC4X4_TOKENS];
+struct vp9_token vp9_nzc4x4_encodings[NZC4X4_TOKENS];
const vp9_tree_index vp9_nzc8x8_tree[2 * NZC8X8_NODES] = {
-NZC_0, 2,
@@ -419,7 +419,7 @@
-NZC_9TO16, 12,
-NZC_17TO32, -NZC_33TO64,
};
-struct vp9_token_struct vp9_nzc8x8_encodings[NZC8X8_TOKENS];
+struct vp9_token vp9_nzc8x8_encodings[NZC8X8_TOKENS];
const vp9_tree_index vp9_nzc16x16_tree[2 * NZC16X16_NODES] = {
-NZC_0, 2,
@@ -432,7 +432,7 @@
-NZC_33TO64, 16,
-NZC_65TO128, -NZC_129TO256,
};
-struct vp9_token_struct vp9_nzc16x16_encodings[NZC16X16_TOKENS];
+struct vp9_token vp9_nzc16x16_encodings[NZC16X16_TOKENS];
const vp9_tree_index vp9_nzc32x32_tree[2 * NZC32X32_NODES] = {
-NZC_0, 2,
@@ -447,7 +447,7 @@
-NZC_129TO256, 20,
-NZC_257TO512, -NZC_513TO1024,
};
-struct vp9_token_struct vp9_nzc32x32_encodings[NZC32X32_TOKENS];
+struct vp9_token vp9_nzc32x32_encodings[NZC32X32_TOKENS];
const int vp9_extranzcbits[NZC32X32_TOKENS] = {
0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -40,7 +40,7 @@
extern const vp9_tree_index vp9_coef_tree[];
-extern struct vp9_token_struct vp9_coef_encodings[MAX_ENTROPY_TOKENS];
+extern struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS];
typedef struct {
vp9_tree_p tree;
@@ -215,10 +215,10 @@
extern const vp9_tree_index vp9_nzc32x32_tree[];
/* nzc encodings */
-extern struct vp9_token_struct vp9_nzc4x4_encodings[NZC4X4_TOKENS];
-extern struct vp9_token_struct vp9_nzc8x8_encodings[NZC8X8_TOKENS];
-extern struct vp9_token_struct vp9_nzc16x16_encodings[NZC16X16_TOKENS];
-extern struct vp9_token_struct vp9_nzc32x32_encodings[NZC32X32_TOKENS];
+extern struct vp9_token vp9_nzc4x4_encodings[NZC4X4_TOKENS];
+extern struct vp9_token vp9_nzc8x8_encodings[NZC8X8_TOKENS];
+extern struct vp9_token vp9_nzc16x16_encodings[NZC16X16_TOKENS];
+extern struct vp9_token vp9_nzc32x32_encodings[NZC32X32_TOKENS];
#define codenzc(x) (\
(x) <= 3 ? (x) : (x) <= 4 ? 3 : (x) <= 8 ? 4 : \
--- a/vp9/common/vp9_entropymode.c
+++ b/vp9/common/vp9_entropymode.c
@@ -283,19 +283,19 @@
-ZERO4X4, -NEW4X4
};
-struct vp9_token_struct vp9_bmode_encodings[VP9_NKF_BINTRAMODES];
-struct vp9_token_struct vp9_kf_bmode_encodings[VP9_KF_BINTRAMODES];
-struct vp9_token_struct vp9_ymode_encodings[VP9_YMODES];
-struct vp9_token_struct vp9_sb_ymode_encodings[VP9_I32X32_MODES];
-struct vp9_token_struct vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
-struct vp9_token_struct vp9_kf_ymode_encodings[VP9_YMODES];
-struct vp9_token_struct vp9_uv_mode_encodings[VP9_UV_MODES];
-struct vp9_token_struct vp9_i8x8_mode_encodings[VP9_I8X8_MODES];
-struct vp9_token_struct vp9_mbsplit_encodings[VP9_NUMMBSPLITS];
+struct vp9_token vp9_bmode_encodings[VP9_NKF_BINTRAMODES];
+struct vp9_token vp9_kf_bmode_encodings[VP9_KF_BINTRAMODES];
+struct vp9_token vp9_ymode_encodings[VP9_YMODES];
+struct vp9_token vp9_sb_ymode_encodings[VP9_I32X32_MODES];
+struct vp9_token vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
+struct vp9_token vp9_kf_ymode_encodings[VP9_YMODES];
+struct vp9_token vp9_uv_mode_encodings[VP9_UV_MODES];
+struct vp9_token vp9_i8x8_mode_encodings[VP9_I8X8_MODES];
+struct vp9_token vp9_mbsplit_encodings[VP9_NUMMBSPLITS];
-struct vp9_token_struct vp9_mv_ref_encoding_array[VP9_MVREFS];
-struct vp9_token_struct vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
-struct vp9_token_struct vp9_sub_mv_ref_encoding_array[VP9_SUBMVREFS];
+struct vp9_token vp9_mv_ref_encoding_array[VP9_MVREFS];
+struct vp9_token vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
+struct vp9_token vp9_sub_mv_ref_encoding_array[VP9_SUBMVREFS];
void vp9_init_mbmode_probs(VP9_COMMON *x) {
unsigned int bct [VP9_YMODES] [2]; /* num Ymodes > num UV modes */
@@ -379,7 +379,7 @@
-0, 2,
-1, -2
};
-struct vp9_token_struct vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
+struct vp9_token vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
#if CONFIG_ENABLE_6TAP
const INTERPOLATIONFILTERTYPE vp9_switchable_interp[VP9_SWITCHABLE_FILTERS] = {
SIXTAP, EIGHTTAP, EIGHTTAP_SHARP};
@@ -397,7 +397,7 @@
const vp9_tree_index vp9_switchable_interp_tree[VP9_SWITCHABLE_FILTERS*2-2] = {
-0, -1,
};
-struct vp9_token_struct vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
+struct vp9_token vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
const vp9_prob vp9_switchable_interp_prob [VP9_SWITCHABLE_FILTERS+1]
[VP9_SWITCHABLE_FILTERS-1] = {
{248},
--- a/vp9/common/vp9_entropymode.h
+++ b/vp9/common/vp9_entropymode.h
@@ -54,21 +54,21 @@
extern const vp9_tree_index vp9_sb_mv_ref_tree[];
extern const vp9_tree_index vp9_sub_mv_ref_tree[];
-extern struct vp9_token_struct vp9_bmode_encodings[VP9_NKF_BINTRAMODES];
-extern struct vp9_token_struct vp9_kf_bmode_encodings[VP9_KF_BINTRAMODES];
-extern struct vp9_token_struct vp9_ymode_encodings[VP9_YMODES];
-extern struct vp9_token_struct vp9_sb_ymode_encodings[VP9_I32X32_MODES];
-extern struct vp9_token_struct vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
-extern struct vp9_token_struct vp9_kf_ymode_encodings[VP9_YMODES];
-extern struct vp9_token_struct vp9_i8x8_mode_encodings[VP9_I8X8_MODES];
-extern struct vp9_token_struct vp9_uv_mode_encodings[VP9_UV_MODES];
-extern struct vp9_token_struct vp9_mbsplit_encodings[VP9_NUMMBSPLITS];
+extern struct vp9_token vp9_bmode_encodings[VP9_NKF_BINTRAMODES];
+extern struct vp9_token vp9_kf_bmode_encodings[VP9_KF_BINTRAMODES];
+extern struct vp9_token vp9_ymode_encodings[VP9_YMODES];
+extern struct vp9_token vp9_sb_ymode_encodings[VP9_I32X32_MODES];
+extern struct vp9_token vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
+extern struct vp9_token vp9_kf_ymode_encodings[VP9_YMODES];
+extern struct vp9_token vp9_i8x8_mode_encodings[VP9_I8X8_MODES];
+extern struct vp9_token vp9_uv_mode_encodings[VP9_UV_MODES];
+extern struct vp9_token vp9_mbsplit_encodings[VP9_NUMMBSPLITS];
/* Inter mode values do not start at zero */
-extern struct vp9_token_struct vp9_mv_ref_encoding_array[VP9_MVREFS];
-extern struct vp9_token_struct vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
-extern struct vp9_token_struct vp9_sub_mv_ref_encoding_array[VP9_SUBMVREFS];
+extern struct vp9_token vp9_mv_ref_encoding_array[VP9_MVREFS];
+extern struct vp9_token vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
+extern struct vp9_token vp9_sub_mv_ref_encoding_array[VP9_SUBMVREFS];
void vp9_entropy_mode_init(void);
@@ -107,8 +107,7 @@
extern const vp9_tree_index vp9_switchable_interp_tree
[2 * (VP9_SWITCHABLE_FILTERS - 1)];
-extern struct vp9_token_struct vp9_switchable_interp_encodings
- [VP9_SWITCHABLE_FILTERS];
+extern struct vp9_token vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
extern const vp9_prob vp9_switchable_interp_prob[VP9_SWITCHABLE_FILTERS + 1]
[VP9_SWITCHABLE_FILTERS - 1];
--- a/vp9/common/vp9_entropymv.c
+++ b/vp9/common/vp9_entropymv.c
@@ -33,7 +33,7 @@
-MV_JOINT_HNZVZ, 4,
-MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ
};
-struct vp9_token_struct vp9_mv_joint_encodings[MV_JOINTS];
+struct vp9_token vp9_mv_joint_encodings[MV_JOINTS];
const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2] = {
-MV_CLASS_0, 2,
@@ -47,12 +47,12 @@
-MV_CLASS_7, -MV_CLASS_8,
-MV_CLASS_9, -MV_CLASS_10,
};
-struct vp9_token_struct vp9_mv_class_encodings[MV_CLASSES];
+struct vp9_token vp9_mv_class_encodings[MV_CLASSES];
const vp9_tree_index vp9_mv_class0_tree [2 * CLASS0_SIZE - 2] = {
-0, -1,
};
-struct vp9_token_struct vp9_mv_class0_encodings[CLASS0_SIZE];
+struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE];
const vp9_tree_index vp9_mv_fp_tree [2 * 4 - 2] = {
-0, 2,
@@ -59,7 +59,7 @@
-1, 4,
-2, -3
};
-struct vp9_token_struct vp9_mv_fp_encodings[4];
+struct vp9_token vp9_mv_fp_encodings[4];
const nmv_context vp9_default_nmv_context = {
{32, 64, 96},
--- a/vp9/common/vp9_entropymv.h
+++ b/vp9/common/vp9_entropymv.h
@@ -46,7 +46,7 @@
} MV_JOINT_TYPE;
extern const vp9_tree_index vp9_mv_joint_tree[2 * MV_JOINTS - 2];
-extern struct vp9_token_struct vp9_mv_joint_encodings [MV_JOINTS];
+extern struct vp9_token vp9_mv_joint_encodings[MV_JOINTS];
/* Symbols for coding magnitude class of nonzero components */
#define MV_CLASSES 11
@@ -65,7 +65,7 @@
} MV_CLASS_TYPE;
extern const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2];
-extern struct vp9_token_struct vp9_mv_class_encodings [MV_CLASSES];
+extern struct vp9_token vp9_mv_class_encodings[MV_CLASSES];
#define CLASS0_BITS 1 /* bits at integer precision for class 0 */
#define CLASS0_SIZE (1 << CLASS0_BITS)
@@ -76,10 +76,10 @@
#define MV_VALS ((MV_MAX << 1) + 1)
extern const vp9_tree_index vp9_mv_class0_tree[2 * CLASS0_SIZE - 2];
-extern struct vp9_token_struct vp9_mv_class0_encodings[CLASS0_SIZE];
+extern struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE];
extern const vp9_tree_index vp9_mv_fp_tree[2 * 4 - 2];
-extern struct vp9_token_struct vp9_mv_fp_encodings[4];
+extern struct vp9_token vp9_mv_fp_encodings[4];
typedef struct {
vp9_prob sign;
--- a/vp9/common/vp9_treecoder.c
+++ b/vp9/common/vp9_treecoder.c
@@ -18,15 +18,10 @@
#include "vp9/common/vp9_treecoder.h"
-static void tree2tok(
- struct vp9_token_struct *const p,
- vp9_tree t,
- int i,
- int v,
- int L
-) {
+static void tree2tok(struct vp9_token *const p, vp9_tree t,
+ int i, int v, int l) {
v += v;
- ++L;
+ ++l;
do {
const vp9_tree_index j = t[i++];
@@ -33,17 +28,17 @@
if (j <= 0) {
p[-j].value = v;
- p[-j].Len = L;
+ p[-j].len = l;
} else
- tree2tok(p, t, j, v, L);
+ tree2tok(p, t, j, v, l);
} while (++v & 1);
}
-void vp9_tokens_from_tree(struct vp9_token_struct *p, vp9_tree t) {
+void vp9_tokens_from_tree(struct vp9_token *p, vp9_tree t) {
tree2tok(p, t, 0, 0, 0);
}
-void vp9_tokens_from_tree_offset(struct vp9_token_struct *p, vp9_tree t,
+void vp9_tokens_from_tree_offset(struct vp9_token *p, vp9_tree t,
int offset) {
tree2tok(p - offset, t, 0, 0, 0);
}
--- a/vp9/common/vp9_treecoder.h
+++ b/vp9/common/vp9_treecoder.h
@@ -31,16 +31,15 @@
typedef const vp9_tree_index vp9_tree[], *vp9_tree_p;
-typedef const struct vp9_token_struct {
+struct vp9_token {
int value;
- int Len;
-} vp9_token;
+ int len;
+};
/* Construct encoding array from tree. */
-void vp9_tokens_from_tree(struct vp9_token_struct *, vp9_tree);
-void vp9_tokens_from_tree_offset(struct vp9_token_struct *, vp9_tree,
- int offset);
+void vp9_tokens_from_tree(struct vp9_token*, vp9_tree);
+void vp9_tokens_from_tree_offset(struct vp9_token*, vp9_tree, int offset);
/* Convert array of token occurrence counts into a table of probabilities
for the associated binary encoding tree. Also writes count of branches
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -118,7 +118,7 @@
static void update_mode(
vp9_writer *const bc,
int n,
- vp9_token tok [/* n */],
+ const struct vp9_token tok[/* n */],
vp9_tree tree,
vp9_prob Pnew [/* n-1 */],
vp9_prob Pcur [/* n-1 */],
@@ -458,12 +458,12 @@
while (p < stop) {
const int t = p->Token;
- vp9_token *const a = vp9_coef_encodings + t;
+ const struct vp9_token *const a = vp9_coef_encodings + t;
const vp9_extra_bit_struct *const b = vp9_extra_bits + t;
int i = 0;
const unsigned char *pp = p->context_tree;
int v = a->value;
- int n = a->Len;
+ int n = a->len;
if (t == EOSB_TOKEN)
{
--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -290,7 +290,7 @@
else
#endif
t->skip_eob_node = (c > 0) && (token_cache[c - 1] == 0);
- assert(vp9_coef_encodings[t->Token].Len - t->skip_eob_node > 0);
+ assert(vp9_coef_encodings[t->Token].len - t->skip_eob_node > 0);
if (!dry_run) {
++counts[type][ref][band][pt][token];
if (!t->skip_eob_node)
--- a/vp9/encoder/vp9_treewriter.h
+++ b/vp9/encoder/vp9_treewriter.h
@@ -67,11 +67,9 @@
} while (n);
}
-static INLINE void write_token(vp9_writer *const w,
- vp9_tree t,
- const vp9_prob *const p,
- vp9_token *const x) {
- treed_write(w, t, p, x->value, x->Len);
+static INLINE void write_token(vp9_writer *w, vp9_tree t, const vp9_prob *p,
+ const struct vp9_token *x) {
+ treed_write(w, t, p, x->value, x->len);
}
static INLINE int treed_cost(vp9_tree t,
@@ -91,10 +89,9 @@
return c;
}
-static INLINE int cost_token(vp9_tree t,
- const vp9_prob *const p,
- vp9_token *const x) {
- return treed_cost(t, p, x->value, x->Len);
+static INLINE int cost_token(vp9_tree t, const vp9_prob *p,
+ const struct vp9_token *x) {
+ return treed_cost(t, p, x->value, x->len);
}
/* Fill array of costs for all possible token values. */