33 int (*
cmp)(
void *key,
const void *
b),
void *next[2])
38 if (next) next[v >> 31] = t->
elem;
65 key = t->
elem = next_elem[i];
75 int i = (v >> 31) ^ !!*next;
77 t->
state += 2 * i - 1;
79 if (!(t->
state & 1)) {
99 if (( *child )->state * 2 == -t->
state) {
100 *tp = (*child)->
child[i ^ 1];
103 *child = ( *tp )->
child[i ^ 1];
106 (*tp)->child[0]->state = -((*tp)->state > 0);
107 (*tp)->child[1]->state = (*tp)->state < 0;
111 *child = (*child)->
child[i ^ 1];
113 if ((*tp)->state) t->
state = 0;
115 (*tp)->state = -t->
state;
119 if (!(*tp)->state ^ !!*next)
144 int (*
cmp)(
void *opaque,
void *
elem),
145 int (*enu)(
void *opaque,
void *elem))
152 enu(opaque, t->
elem);
168 if (left>999 || right>999)
170 if (right - left != t->
state)
174 return FFMAX(left, right) + 1;
185 print(t->
child[0], depth + 1);
186 print(t->
child[1], depth + 1);
191 static int cmp(
void *
a,
const void *
b)
193 return (uint8_t *) a - (
const uint8_t *) b;
205 for (i = 0; i < 10000; i++) {
207 if (
check(root) > 999) {
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
void * av_tree_find(const AVTreeNode *t, void *key, int(*cmp)(void *key, const void *b), void *next[2])
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.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
struct AVTreeNode * child[2]
void av_log(void *avcl, int level, const char *fmt,...)
int main(int argc, char **argv)
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...
struct AVTreeNode AVTreeNode
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
const int av_tree_node_size
void av_cold av_lfg_init(AVLFG *c, unsigned int seed)
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.
#define check(x, y, S, v)