Re: [FFmpeg-devel] [PATCH v3] libavutil: Add AVMap

2025-04-19 Thread Nicolas George
Nicolas George (HE12025-04-19): > Let me make you a promise: if you can write an introduction to the API > (as all non-trivial APIs should have) that makes other major developers > say “that was clear”, I will leave the matter alone. … which does not mean I demand you do that. You can probably con

Re: [FFmpeg-devel] [PATCH v3] libavutil: Add AVMap

2025-04-19 Thread Nicolas George
Michael Niedermayer (HE12025-04-19): > I dont know what you are trying to acomplish here. I am trying to help make this API as good as possible before it becomes public and cannot be changed. I am nowhere as good as you in many areas, but I think I can say that architecture, and in particular API

Re: [FFmpeg-devel] [PATCH v3] libavutil: Add AVMap

2025-04-19 Thread Michael Niedermayer
Hi On Sat, Apr 19, 2025 at 03:03:16PM +0200, Nicolas George wrote: > Michael Niedermayer (HE12025-04-17): > > ok, i will change teh name > > Thanks. > > > You can implement an av_map_new() variant thats on the stack > > if thats what you want to have / to use / to do > > once the code is in git

Re: [FFmpeg-devel] [PATCH v3] libavutil: Add AVMap

2025-04-19 Thread Michael Niedermayer
Hi Leo On Sat, Apr 19, 2025 at 06:36:56AM -0400, Leo Izen wrote: > On 4/17/25 12:52, Michael Niedermayer wrote: [...] > > +typedef struct{ > > +AVMapEntry map_entry; > > +uint8_t treenode_and_keyvalue[0]; > > +} AVMapInternalEntry; > > + > > +struct AVMap{ > > +#define CMP_MASK 31 > > +

Re: [FFmpeg-devel] [PATCH v3] libavutil: Add AVMap

2025-04-19 Thread Nicolas George
Michael Niedermayer (HE12025-04-17): > ok, i will change teh name Thanks. > You can implement an av_map_new() variant thats on the stack > if thats what you want to have / to use / to do > once the code is in git > or maybe i will do it but there are many more interresting things I have checked,

Re: [FFmpeg-devel] [PATCH v3] libavutil: Add AVMap

2025-04-19 Thread Leo Izen
On 4/17/25 12:52, Michael Niedermayer wrote: AVL Tree based Map compared to AVDictionary this has * clone is O(n) instead of O(n²) * copy is O(n*log n) instead of O(n²) * O(log n) malloc() calls by default and O(1) if av_map_realloc() is used instead of O(n) * get/add/delete is O(log n)

Re: [FFmpeg-devel] [PATCH v3] libavutil: Add AVMap

2025-04-18 Thread Michael Niedermayer
On Fri, Apr 18, 2025 at 10:46:42AM -0400, Leo Izen wrote: > On 4/17/25 16:12, Michael Niedermayer wrote: > > > > > > > + * @param keyvalue_cmp compare function, will be passed the key + > > > > value concatenated. > > > > > > Please no. Pass the key and the value separately to the compare > > >

Re: [FFmpeg-devel] [PATCH v3] libavutil: Add AVMap

2025-04-18 Thread Leo Izen
On 4/17/25 16:12, Michael Niedermayer wrote: + * @param keyvalue_cmp compare function, will be passed the key + value concatenated. Please no. Pass the key and the value separately to the compare function. thats neither efficient nor does it fit the existing APIs. The value is most of the

Re: [FFmpeg-devel] [PATCH v3] libavutil: Add AVMap

2025-04-17 Thread Michael Niedermayer
Hi On Thu, Apr 17, 2025 at 07:57:46PM +0200, Nicolas George wrote: > Michael Niedermayer (HE12025-04-17): > > +AVMap *av_map_new(AVMapCompareFunc cmp_keyvalue, int cmp_flags, > > AVMapCopyFunc copy, AVMapFreeFunc freef) > > +{ > > +AVMap *s = av_mallocz(sizeof(*s)); > > +if (!s) > > +

Re: [FFmpeg-devel] [PATCH v3] libavutil: Add AVMap

2025-04-17 Thread Nicolas George
Michael Niedermayer (HE12025-04-17): > +AVMap *av_map_new(AVMapCompareFunc cmp_keyvalue, int cmp_flags, > AVMapCopyFunc copy, AVMapFreeFunc freef) > +{ > +AVMap *s = av_mallocz(sizeof(*s)); > +if (!s) > +return NULL; > + > +s->copy = copy; > +s->freef = fre