[FFmpeg-devel] [PATCH 08/13] avcodec/elbg: Keep buffers to avoid allocations and frees

Tomas Härdin tjoppen at acc.umu.se
Sun Sep 19 13:06:55 EEST 2021


fre 2021-09-17 klockan 04:08 +0200 skrev Andreas Rheinhardt:
> Up until now, each call to avpriv_elbg_do() would result
> in at least six allocations. And this function is called a lot:
> A typical FATE run results in 52213653 calls to av_malloc; of these,
> 34974671 originate from av_malloc_array and from these 34783679
> originate from avpriv_elbg_do; the msvideo1 encoder tests are behind
> most of these.
> 
> This commit changes this by keeping the buffers and only reallocating
> them when needed. E.g. for the encoding part of fate-vsynth1-msvideo1
> total heap usage went down from 11,407,939 allocs and frees with
> 468,106,207 bytes allocated to 3,149 allocs and frees with 13,181,847
> bytes allocated. The time for one encode2-call went down by 69%.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

Looks fine

/Tomas



More information about the ffmpeg-devel mailing list