@@ -25,8 +25,11 @@
#include "imgutils.h"
#include "mem.h"
#include "samplefmt.h"
+#include "staticpool.h"
+FF_STATICPOOL_DECLARE(AVFrame, 256)
+
static AVFrameSideData *frame_new_side_data(AVFrame *frame,
enum AVFrameSideDataType type,
AVBufferRef *buf);
@@ -149,7 +152,7 @@ static void wipe_side_data(AVFrame *frame)
AVFrame *av_frame_alloc(void)
{
- AVFrame *frame = av_mallocz(sizeof(*frame));
+ AVFrame *frame = FF_STATICPOOL_MALLOCZ(AVFrame);
if (!frame)
return NULL;
@@ -166,7 +169,7 @@ void av_frame_free(AVFrame **frame)
return;
av_frame_unref(*frame);
- av_freep(frame);
+ FF_STATICPOOL_FREEP(AVFrame, frame);
}
static int get_video_buffer(AVFrame *frame, int align)
Use default size 256. Benchmark: time ./ffmpeg -f s16le -ac 5 -ar 48000 -t 10000 -i /dev/zero \ -af "aformat=s16p, asetnsamples=256" -f null - old: 22.079s new: 21.180s Signed-off-by: Muhammad Faiz <mfcc64@gmail.com> --- libavutil/frame.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)