]> git.sesse.net Git - ffmpeg/commit
avcodec/frame_thread_encoder: Avoid allocations of AVFrames
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 7 Feb 2021 13:30:28 +0000 (14:30 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 16 Feb 2021 21:11:53 +0000 (22:11 +0100)
commitde1b20a82bca61fc877482167ead69beadeb4c78
tree68a526f9831326df2dd2fedca97a1849a3914010
parent76d428e090e0a547b2e6be6dbd22cf87817adec7
avcodec/frame_thread_encoder: Avoid allocations of AVFrames

Up until now, when using frame threaded encoding, an AVFrame would be
allocated for every frame to be encoded. These AVFrames would reach the
worker threads via a FIFO of tasks, a structure which contained the
AVFrame as well as an index into an array which gives the place where
the worker thread shall put the returned packet; in addition to that,
said structure also contained several unused fields.

This commit changes this: The AVFrames are now allocated during init in
the array that is up until now only used to return the packets. The
contents to be encoded are put into the AVFrame in the same array
element that is also used to return the packets.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/frame_thread_encoder.c