Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v5 1/3] lavc/hashtable: create generic robin hood hash table
Date: Fri, 30 May 2025 21:23:01 +0200
Message-ID: <20250530192301.GJ29660@pb2> (raw)
In-Reply-To: <20250425160509.54880-1-emma@emma.gg>


[-- Attachment #1.1: Type: text/plain, Size: 2957 bytes --]

On Sat, Apr 26, 2025 at 01:05:07AM +0900, Emma Worley wrote:
> Adds a generic hash table with the DXV encoder as an initial use case.
> 
> Signed-off-by: Emma Worley <emma@emma.gg>
> ---
>  libavcodec/Makefile          |   2 +
>  libavcodec/hashtable.c       | 214 +++++++++++++++++++++++++++++++++++
>  libavcodec/hashtable.h       |  91 +++++++++++++++
>  libavcodec/tests/hashtable.c | 110 ++++++++++++++++++
>  4 files changed, 417 insertions(+)
>  create mode 100644 libavcodec/hashtable.c
>  create mode 100644 libavcodec/hashtable.h
>  create mode 100644 libavcodec/tests/hashtable.c
[...]

> diff --git a/libavcodec/hashtable.h b/libavcodec/hashtable.h
> new file mode 100644
> index 0000000000..a26eb30cec
> --- /dev/null
> +++ b/libavcodec/hashtable.h
> @@ -0,0 +1,91 @@
> +/*
> + * Generic hashtable
> + * Copyright (C) 2024 Connor Worley <connorbworley@gmail.com>
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#ifndef AVCODEC_HASHTABLE_H
> +#define AVCODEC_HASHTABLE_H
> +
> +#include <stddef.h>
> +
> +/* Implements a hash table using Robin Hood open addressing.
> + * See: https://cs.uwaterloo.ca/research/tr/1986/CS-86-14.pdf
> + */
> +
> +typedef struct FFHashtableContext FFHashtableContext;
> +
> +/**
> + * Create a fixed-sized Robin Hood hash table.
> + *
> + * @param ctx         context to allocate and initialize
> + * @param key_size    size of key type in bytes
> + * @param val_size    size of value type in bytes
> + * @param max_entries maximum number of key-value pairs to store
> + *
> + * @return zero on success, nonzero on error
> + */
> +int ff_hashtable_alloc(struct FFHashtableContext **ctx, size_t key_size, size_t val_size, size_t max_entries);

I think this API should clarify how the hash of a object and object
equality is defined.
One can guess that from just a size and pointer that would be defined
on a bytewise compare and hash() of the bytes. But this should be spelled
out explicitly

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      parent reply	other threads:[~2025-05-30 19:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25 16:05 Emma Worley
2025-04-25 16:05 ` [FFmpeg-devel] [PATCH v5 2/3] lavc/dxvenc: migrate DXT1 encoder to lavc hashtable Emma Worley
2025-04-25 16:05 ` [FFmpeg-devel] [PATCH v5 3/3] lavc/dxvenc: improve compatibility with Resolume products Emma Worley
2025-04-27  1:37   ` Emma Worley
2025-05-01  6:56     ` Emma Worley
2025-05-14  4:39       ` Emma Worley
2025-05-28 22:35         ` Emma Worley
2025-05-30 19:18           ` Michael Niedermayer
2025-05-31 23:42             ` Emma Worley
2025-06-14 23:00   ` Kacper Michajlow
2025-06-15  4:27     ` Emma Worley
2025-06-15 22:24       ` Emma Worley
2025-06-17 16:48         ` Kacper Michajlow
2025-05-30 19:23 ` Michael Niedermayer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250530192301.GJ29660@pb2 \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git