Move av1_indices_from_tree() to common code space.

Move the av1_indices_from_tree() function from av1/encoder/treewriter.c
 to aom_dsp/prob.c so that it can be used by both the encoder and
 the decoder.

Change-Id: Ie43c599f425c3503b1ff93f0c77b5033a05b1bb4
This commit is contained in:
Nathan E. Egge
2016-07-20 13:12:31 -04:00
committed by Yaowu Xu
parent cfb02ddcad
commit 8abf8673e6
4 changed files with 19 additions and 18 deletions

View File

@@ -205,4 +205,20 @@ int tree_to_cdf(const aom_tree_index *tree, const aom_prob *probs,
}
return nsymbs;
}
/* This code assumes that tree contains as unique leaf nodes the integer values
0 to len - 1 and produces the forward and inverse mapping tables in ind[]
and inv[] respectively. */
void av1_indices_from_tree(int *ind, int *inv, int len,
const aom_tree_index *tree) {
int i;
int index;
for (i = index = 0; i < TREE_SIZE(len); i++) {
const aom_tree_index j = tree[i];
if (j <= 0) {
inv[index] = -j;
ind[-j] = index++;
}
}
}
#endif

View File

@@ -127,6 +127,9 @@ static INLINE void av1_tree_to_cdf(const aom_tree_index *tree,
} \
} \
} while (0)
void av1_indices_from_tree(int *ind, int *inv, int len,
const aom_tree_index *tree);
#endif
DECLARE_ALIGNED(16, extern const uint8_t, aom_norm[256]);

View File

@@ -32,22 +32,6 @@ void av1_tokens_from_tree(struct av1_token *tokens,
tree2tok(tokens, tree, 0, 0, 0);
}
/* This code assumes that tree contains as unique leaf nodes the integer values
0 to len - 1 and produces the forward and inverse mapping tables in ind[]
and inv[] respectively. */
void av1_indices_from_tree(int *ind, int *inv, int len,
const aom_tree_index *tree) {
int i;
int index;
for (i = index = 0; i < TREE_SIZE(len); i++) {
const aom_tree_index j = tree[i];
if (j <= 0) {
inv[index] = -j;
ind[-j] = index++;
}
}
}
static unsigned int convert_distribution(unsigned int i, aom_tree tree,
unsigned int branch_ct[][2],
const unsigned int num_events[]) {

View File

@@ -28,8 +28,6 @@ struct av1_token {
};
void av1_tokens_from_tree(struct av1_token *, const aom_tree_index *);
void av1_indices_from_tree(int *ind, int *inv, int len,
const aom_tree_index *tree);
static INLINE void av1_write_token(aom_writer *w, const aom_tree_index *tree,
const aom_prob *probs,