Lines Matching refs:hash

119     ePICPixHash      hash;
377 /* improved djb2 hash from http://www.cse.yorku.ca/~oz/hash.html */
390 static void epic_hash_init(ePICPixHash *hash)
392 memset(hash, 0, sizeof(*hash));
395 static ePICPixHashElem *epic_hash_find(const ePICPixHash *hash, uint32_t key)
398 ePICPixHashElem *bucket = hash->bucket[idx];
400 for (i = 0; i < hash->bucket_fill[idx]; i++)
407 static ePICPixHashElem *epic_hash_add(ePICPixHash *hash, uint32_t key)
412 if (hash->bucket_size[idx] > INT_MAX / sizeof(**hash->bucket))
415 if (!(hash->bucket_fill[idx] < hash->bucket_size[idx])) {
416 int new_size = hash->bucket_size[idx] + 16;
417 bucket = av_realloc(hash->bucket[idx], new_size * sizeof(*bucket));
420 hash->bucket[idx] = bucket;
421 hash->bucket_size[idx] = new_size;
424 ret = &hash->bucket[idx][hash->bucket_fill[idx]++];
430 static int epic_add_pixel_to_cache(ePICPixHash *hash, uint32_t key, uint32_t pix)
433 ePICPixHashElem *hash_elem = epic_hash_find(hash, key);
436 if (!(hash_elem = epic_hash_add(hash, key)))
451 static inline int epic_cache_entries_for_pixel(const ePICPixHash *hash,
454 ePICPixHashElem *hash_elem = epic_hash_find(hash, pix);
462 static void epic_free_pixel_cache(ePICPixHash *hash)
467 for (j = 0; j < hash->bucket_fill[i]; j++) {
468 ePICPixListElem *list_elem = hash->bucket[i][j].list;
475 av_freep(&hash->bucket[i]);
476 hash->bucket_size[i] =
477 hash->bucket_fill[i] = 0;
772 ePICPixHashElem *hash_elem = epic_hash_find(&dc->hash, W);
819 !epic_cache_entries_for_pixel(&dc->hash, pix)) {
847 int ret = epic_add_pixel_to_cache(&dc->hash,
915 epic_hash_init(&c->ec.hash);
931 epic_free_pixel_cache(&c->ec.hash);