40 int (*
cmp)(
void *key,
const void *
b),
void *next[2])
46 next[v >> 31] = t->
elem;
73 key = t->
elem = next_elem[i];
83 int i = (v >> 31) ^ !!*next;
85 t->
state += 2 * i - 1;
87 if (!(t->
state & 1)) {
109 if ((*child)->state * 2 == -t->
state) {
110 *tp = (*child)->
child[i ^ 1];
113 *child = (*tp)->
child[i ^ 1];
114 (*tp)->
child[i ^ 1] = t;
117 (*tp)->child[1]->state = (*tp)->state < 0;
121 *child = (*child)->
child[i ^ 1];
122 (*tp)->
child[i ^ 1] = t;
127 (*tp)->state = -t->
state;
131 if (!(*tp)->state ^ !!*next)
156 int (*
cmp)(
void *opaque,
void *
elem),
157 int (*enu)(
void *opaque,
void *elem))
164 enu(opaque, t->
elem);
181 if (left > 999 || right > 999)
183 if (right - left != t->
state)
187 return FFMAX(left, right) + 1;
195 for (i = 0; i < depth * 4; i++)
199 print(t->
child[0], depth + 1);
200 print(t->
child[1], depth + 1);
205 static int cmp(
void *
a,
const void *
b)
210 int main(
int argc,
char **argv)
216 int log_level = argc <= 1 ?
AV_LOG_INFO : atoi(argv[1]);
222 for (i = 0; i < 10000; i++) {
225 if (
check(root) > 999) {
memory handling functions
void av_log_set_level(int level)
Set the log level.
struct AVTreeNode * av_tree_node_alloc(void)
Allocate an AVTreeNode.
void * av_tree_find(const AVTreeNode *t, void *key, int(*cmp)(void *key, const void *b), void *next[2])
AVS_FilterInfo AVS_Value child
void av_tree_destroy(AVTreeNode *t)
void * av_tree_insert(AVTreeNode **tp, void *key, int(*cmp)(void *key, const void *b), AVTreeNode **next)
Insert or remove an element.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
struct AVTreeNode * child[2]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags)
compares a block (either a full macroblock or a partition thereof) against a proposed motion-compensa...
#define AV_LOG_INFO
Standard information.
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
const int av_tree_node_size
common internal and external API header
int main(int argc, char **argv)
void av_tree_enumerate(AVTreeNode *t, void *opaque, int(*cmp)(void *opaque, void *elem), int(*enu)(void *opaque, void *elem))
Apply enu(opaque, &elem) to all the elements in the tree in a given range.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define check(x, y, S, v)