Go to the documentation of this file.
32 #define ALIGN _Alignof(size_t)
53 #define ENTRY_PSL_VAL(entry) (*(size_t*)(entry))
54 #define ENTRY_KEY_PTR(entry) ((entry) + sizeof(size_t))
55 #define ENTRY_VAL_PTR(entry) (ENTRY_KEY_PTR(entry) + ctx->key_size)
57 #define KEYS_EQUAL(k1, k2) (!memcmp((k1), (k2), ctx->key_size))
60 size_t val_size,
size_t max_entries)
62 const size_t keyval_size = key_size + val_size;
64 if (keyval_size < key_size ||
65 keyval_size >
FFMIN(SIZE_MAX -
sizeof(
size_t) - (
ALIGN - 1),
104 for (
size_t psl = 1; psl <=
ctx->max_entries; psl++) {
105 size_t wrapped_index = (
hash + psl) %
ctx->max_entries;
106 uint8_t *
entry =
ctx->table + wrapped_index *
ctx->entry_size;
124 size_t wrapped_index =
hash %
ctx->max_entries;
125 uint8_t *
set =
ctx->swapbuf;
126 uint8_t *
tmp =
ctx->swapbuf +
ctx->key_size +
ctx->val_size;
131 for (
size_t i = 0;
i <
ctx->max_entries;
i++) {
132 if (++wrapped_index ==
ctx->max_entries)
134 uint8_t *
entry =
ctx->table + wrapped_index *
ctx->entry_size;
146 if (
ctx->nb_entries ==
ctx->max_entries)
165 if (!
ctx->nb_entries)
170 size_t wrapped_index =
hash %
ctx->max_entries;
172 for (
size_t psl = 1; psl <=
ctx->max_entries; psl++) {
173 if (++wrapped_index ==
ctx->max_entries)
175 uint8_t *
entry =
ctx->table + wrapped_index *
ctx->entry_size;
183 for (psl++; psl <=
ctx->max_entries; psl++) {
184 if (++wrapped_index ==
ctx->max_entries)
186 next_entry =
ctx->table + wrapped_index *
ctx->entry_size;
191 memcpy(
entry, next_entry,
ctx->entry_size);
203 memset(
ctx->table, 0,
ctx->entry_size *
ctx->max_entries);
#define ENTRY_PSL_VAL(entry)
static size_t hash_key(const struct FFHashtableContext *ctx, const void *key)
int ff_hashtable_delete(struct FFHashtableContext *ctx, const void *key)
Delete a value from a hash table given a key.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
av_cold void ff_hashtable_freep(FFHashtableContext **ctx)
Free a hash table.
static double val(void *priv, double ch)
#define KEYS_EQUAL(k1, k2)
static void set(uint8_t *a[], int ch, int index, int ch_count, enum AVSampleFormat f, double v)
void ff_hashtable_clear(struct FFHashtableContext *ctx)
Delete all values from a hash table.
#define ENTRY_KEY_PTR(entry)
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
#define ENTRY_VAL_PTR(entry)
#define i(width, name, range_min, range_max)
int ff_hashtable_set(struct FFHashtableContext *ctx, const void *key, const void *val)
Store a value in a hash table given a key.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void * av_calloc(size_t nmemb, size_t size)
#define FFSWAP(type, a, b)
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
int ff_hashtable_get(const struct FFHashtableContext *ctx, const void *key, void *val)
Look up a value from a hash table given a key.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
av_cold int ff_hashtable_alloc(FFHashtableContext **ctx, size_t key_size, size_t val_size, size_t max_entries)
Create a fixed-sized Robin Hood hash table.