Commit graph

8 commits

Author SHA1 Message Date
Andreas Rheinhardt
3be9b3f156 avcodec/hashtable: Remove null statement
Reviewed-by: Emma Worley <emma@emma.gg>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-04 15:32:29 +02:00
Andreas Rheinhardt
a2c3d99478 avcodec/hashtable: Only free buffer if there is buffer to free
Reviewed-by: Emma Worley <emma@emma.gg>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-04 15:32:11 +02:00
Andreas Rheinhardt
06958c731e avcodec/hashtable: Mark alloc,free functions as av_cold
Reviewed-by: Emma Worley <emma@emma.gg>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-04 15:31:51 +02:00
Andreas Rheinhardt
12a43975d1 avcodec/hashtable: Combine allocations
Reviewed-by: Emma Worley <emma@emma.gg>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-04 15:17:37 +02:00
Andreas Rheinhardt
2e45d2f7d3 avcodec/hashtable: Check for overflow
Reviewed-by: Emma Worley <emma@emma.gg>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-04 15:13:55 +02:00
Andreas Rheinhardt
1e6fdafce0 avcodec/hashtable: Only align complete entries
It is unnecessary to align both key and val, as they are only accessed
via memcpy()/memcmp(), which has no alignment requirements.
We only need to ensure that that the entries as a whole
are suitable aligned for the probe sequence length.

Reviewed-by: Emma Worley <emma@emma.gg>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-04 15:12:48 +02:00
Andreas Rheinhardt
2fc310b2f2 avcodec/hashtable: Zero-initialize hashtable
Otherwise ff_hashtable_freep() would try to free uninitialized
pointers upon allocation error (which happens in the corresponding
test tool).

Reviewed-by: Emma Worley <emma@emma.gg>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-04 15:11:48 +02:00
Emma Worley
6fdb54ddee
lavc/hashtable: create generic robin hood hash table
Adds a generic hash table with the DXV encoder as an initial use case.

Signed-off-by: Emma Worley <emma@emma.gg>
2025-06-02 20:51:27 -07:00