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 1/3] avutil/dict2: Add AVDictionary2 with hash-based lookup
Date: Wed, 16 Apr 2025 23:24:48 +0200
Message-ID: <20250416212448.GN4991@pb2> (raw)
In-Reply-To: <b73334be1412100028fa04680a6f964beca85cbb.1744470718.git.ffmpegagent@gmail.com>


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

Hi

i like AI and ill reply with more comments about this elsewhere
but as i looked at the code, i had to reply here

[...]

> +/* Get a dictionary entry */
> +AVDictionaryEntry2 *av_dict2_get(const AVDictionary2 *m, const char *key,
> +                               const AVDictionaryEntry2 *prev, int flags) {
> +    unsigned int hash;
> +    int table_idx;
> +    DictEntry *entry;
> +    
> +    static AVDictionaryEntry2 de;  // Return value - holds pointers to internal data
> +    
> +    if (!m || !key)
> +        return NULL;
> +

> +    if (prev)
> +        return NULL;  // 'prev' functionality not implemented

not implemented ?


> +        
> +    // Get hash index

> +    hash = dict_hash(key, m->flags & AV_DICT2_MATCH_CASE);

case sensitivity is supported by having the set funtiom insert with the
case sensitivity that the get function later will use ?


> +    table_idx = hash % m->table_size;
> +    
> +    // Search in chain
> +    for (entry = m->entries[table_idx]; entry; entry = entry->next) {
> +        if ((m->flags & AV_DICT2_MATCH_CASE ? 
> +             !strcmp(entry->key, key) : 
> +             !av_strcasecmp(entry->key, key))) {
> +            
> +            // Found match
> +            de.key = entry->key;
> +            de.value = entry->value;
> +            return &de;

tasty globals for thread saftey

thx

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

Take away the freedom of one citizen and you will be jailed, take away
the freedom of all citizens and you will be congratulated by your peers
in Parliament.

[-- 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".

  reply	other threads:[~2025-04-16 21:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-12 15:11 [FFmpeg-devel] [PATCH 0/3] " ffmpegagent
2025-04-12 15:11 ` [FFmpeg-devel] [PATCH 1/3] " softworkz
2025-04-16 21:24   ` Michael Niedermayer [this message]
2025-04-16 22:38     ` softworkz .
2025-04-12 15:11 ` [FFmpeg-devel] [PATCH 2/3] doc/dict2: Add doc and api change for AVDictionary2 softworkz
2025-04-16 21:48   ` Michael Niedermayer
2025-04-16 22:43     ` softworkz .
2025-04-16 23:15     ` softworkz .
2025-04-16 23:40       ` Michael Niedermayer
2025-04-17 22:38         ` softworkz .
2025-04-19  2:28           ` Michael Niedermayer
2025-04-19 13:43             ` softworkz .
2025-04-20 20:37               ` Michael Niedermayer
2025-04-12 15:11 ` [FFmpeg-devel] [PATCH 3/3] tests/dict2: Add tests and benchmark " softworkz
2025-04-14 11:02 ` [FFmpeg-devel] [PATCH 0/3] avutil/dict2: Add AVDictionary2 with hash-based lookup Nicolas George
2025-04-14 11:50   ` softworkz .
2025-04-14 13:21   ` softworkz .

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=20250416212448.GN4991@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