[FFmpeg-devel] [PATCH 10/13] avcodec/cinepakenc: Check all calls to avpriv_elbg_do()

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Sep 21 00:36:07 EEST 2021


Tomas Härdin:
> fre 2021-09-17 klockan 04:08 +0200 skrev Andreas Rheinhardt:
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
>> ---
>>  libavcodec/cinepakenc.c | 28 ++++++++++++++++++++++------
>>  1 file changed, 22 insertions(+), 6 deletions(-)
> 
> Gave this one a try with -vframes 100 -s 640x360 for some random clips
> on my machine. Wall time doesn't change much.
> 

I highly doubted that this would be even noticeable, but your comment
made me benchmark this. This patch is indeed not noticeable, but patches
6 and 7 are a bit noticeable. They even outweigh the benefits of
avoiding the allocations. I guess you might be seeing this.
The reason seems to be that the compiler now has to presume that the
ELBGContext is aliased (whereas before that it was just a structure on
the stack of which it could prove that its address doesn't leak). Adding
av_restrict fixed this (with GCC 10) and improved performance to
something a bit better than it was before this patchset. They also help
for the msvideo1 case (where the speedup due to avoiding allocations
dwarfs everything else).
Sorry for only benchmarking the msvideo1 case earlier and not noticing this.

- Andreas


More information about the ffmpeg-devel mailing list