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:
@@ -205,4 +205,20 @@ int tree_to_cdf(const aom_tree_index *tree, const aom_prob *probs,
|
|||||||
}
|
}
|
||||||
return nsymbs;
|
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
|
#endif
|
||||||
|
|||||||
@@ -127,6 +127,9 @@ static INLINE void av1_tree_to_cdf(const aom_tree_index *tree,
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
void av1_indices_from_tree(int *ind, int *inv, int len,
|
||||||
|
const aom_tree_index *tree);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECLARE_ALIGNED(16, extern const uint8_t, aom_norm[256]);
|
DECLARE_ALIGNED(16, extern const uint8_t, aom_norm[256]);
|
||||||
|
|||||||
@@ -32,22 +32,6 @@ void av1_tokens_from_tree(struct av1_token *tokens,
|
|||||||
tree2tok(tokens, tree, 0, 0, 0);
|
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,
|
static unsigned int convert_distribution(unsigned int i, aom_tree tree,
|
||||||
unsigned int branch_ct[][2],
|
unsigned int branch_ct[][2],
|
||||||
const unsigned int num_events[]) {
|
const unsigned int num_events[]) {
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ struct av1_token {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void av1_tokens_from_tree(struct av1_token *, const aom_tree_index *);
|
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,
|
static INLINE void av1_write_token(aom_writer *w, const aom_tree_index *tree,
|
||||||
const aom_prob *probs,
|
const aom_prob *probs,
|
||||||
|
|||||||
Reference in New Issue
Block a user