Merge "Renaming vp9_token_struct to vp9_token and removing previous typedef." into experimental

This commit is contained in:
Dmitry Kovalev 2013-04-14 04:31:39 -07:00 committed by Gerrit Code Review
commit 399a6cbcde
11 changed files with 67 additions and 77 deletions

View File

@ -386,7 +386,7 @@ const vp9_tree_index vp9_coef_tree[ 22] = /* corresponding _CONTEXT_NODEs */
-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 @@ const vp9_tree_index vp9_nzc4x4_tree[2 * NZC4X4_NODES] = {
-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 @@ const vp9_tree_index vp9_nzc8x8_tree[2 * NZC8X8_NODES] = {
-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 @@ const vp9_tree_index vp9_nzc16x16_tree[2 * NZC16X16_NODES] = {
-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 @@ const vp9_tree_index vp9_nzc32x32_tree[2 * NZC32X32_NODES] = {
-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

View File

@ -40,7 +40,7 @@ extern const int vp9_i8x8_block[4];
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_nzc16x16_tree[];
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 : \

View File

@ -283,19 +283,19 @@ const vp9_tree_index vp9_sub_mv_ref_tree[6] = {
-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 @@ const vp9_tree_index vp9_switchable_interp_tree[VP9_SWITCHABLE_FILTERS*2-2] = {
-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_prob vp9_switchable_interp_prob [VP9_SWITCHABLE_FILTERS+1]
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},

View File

@ -54,21 +54,21 @@ extern const vp9_tree_index vp9_mv_ref_tree[];
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 int vp9_is_interpolating_filter[SWITCHABLE + 1];
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];

View File

@ -33,7 +33,7 @@ const vp9_tree_index vp9_mv_joint_tree[2 * MV_JOINTS - 2] = {
-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,19 +47,19 @@ const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2] = {
-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,
-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},

View File

@ -46,7 +46,7 @@ typedef enum {
} 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 @@ typedef enum {
} 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 @@ extern struct vp9_token_struct vp9_mv_class_encodings [MV_CLASSES];
#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;

View File

@ -18,32 +18,27 @@
#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++];
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);
}

View File

@ -31,16 +31,15 @@ typedef int8_t vp9_tree_index;
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

View File

@ -118,7 +118,7 @@ static int prob_diff_update_cost(vp9_prob newp, vp9_prob oldp) {
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 @@ static void pack_mb_tokens(vp9_writer* const bc,
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)
{

View File

@ -290,7 +290,7 @@ static void tokenize_b(VP9_COMP *cpi,
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)

View File

@ -67,11 +67,9 @@ static INLINE void treed_write(vp9_writer *const w,
} 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 @@ static INLINE int treed_cost(vp9_tree t,
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. */