[FFmpeg-devel] [PATCH v5 06/19] avutil/mem: add av_dynarray2_dup

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Jun 10 17:54:24 EEST 2025


Niklas Haas:
> On Tue, 10 Jun 2025 15:55:35 +0200 Andreas Rheinhardt <andreas.rheinhardt at outlook.com> wrote:
>> Niklas Haas:
>>> On Tue, 10 Jun 2025 15:04:57 +0200 Niklas Haas <ffmpeg at haasn.xyz> wrote:
>>>> From: Niklas Haas <git at haasn.dev>
>>>>
>>>> Like av_memdup() but correctly rounds up to the nearest power of two so that
>>>> av_dynarray2_add() will continue to work on the duplicated list.
>>>
>>> Just realized this is public, will add a Changelog entry and bump the API
>>> version before merging.
>> Is this version supposed to be merged?
>> Anyway, this function seems way too specialised to me.
> 
> What would you prefer? Simply having this logic inside swscale? I'm not
> very happy making cross-library assumptions about the exact resizing schedule.
> 

The behavior is documented: " * The array is reallocated when its number
of elements reaches powers of 2."
Alternatively, you could call add the elements in a loop.

> Alternatively, we could ditch the use of av_dynarray2 entirely.
> 

Fine by me.

- Andreas



More information about the ffmpeg-devel mailing list