32 #if FF_API_CONTEXT_SIZE
42 int (*
cmp)(
void *key,
const void *
b),
void *next[2])
45 unsigned int v =
cmp(key, t->
elem);
48 next[v >> 31] = t->
elem;
66 unsigned int v =
cmp(t->
elem, key);
75 key = t->
elem = next_elem[i];
85 int i = (v >> 31) ^ !!*next;
87 t->
state += 2 * i - 1;
89 if (!(t->
state & 1)) {
111 if ((*child)->state * 2 == -t->
state) {
112 *tp = (*child)->
child[i ^ 1];
115 *child = (*tp)->
child[i ^ 1];
116 (*tp)->
child[i ^ 1] = t;
119 (*tp)->child[1]->state = (*tp)->state < 0;
123 *child = (*child)->
child[i ^ 1];
124 (*tp)->
child[i ^ 1] = t;
129 (*tp)->state = -t->
state;
133 if (!(*tp)->state ^ !!*next)
158 int (*
cmp)(
void *opaque,
void *
elem),
159 int (*enu)(
void *opaque,
void *elem))
166 enu(opaque, t->
elem);
183 if (left > 999 || right > 999)
185 if (right - left != t->
state)
189 return FFMAX(left, right) + 1;
197 for (i = 0; i < depth * 4; i++)
201 print(t->
child[0], depth + 1);
202 print(t->
child[1], depth + 1);
207 static int cmp(
void *
a,
const void *
b)
220 for (i = 0; i < 10000; i++) {
223 void *ret, *jj = (
void *)(j + 1);
227 jj = (
void *)(j + 1);
230 if (
check(root) > 999) {
246 jj = (
void *)(j + 1);
memory handling functions
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])
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.
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)
const int av_tree_node_size
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...
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)
common internal and external API header
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)