diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-02-20 19:06:52 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-02-22 09:22:03 +0100 |
commit | 17a59a634c39b00a680c6ebbaea58db95594d13d (patch) | |
tree | f665e2d362590dbbbf49cfc507539e10b622198a /libavfilter/video.c | |
parent | 9da19c290960e976d9da42b5ee92f887a74dc8a5 (diff) | |
download | ffmpeg-17a59a634c39b00a680c6ebbaea58db95594d13d.tar.gz |
avfilter/framepool: fix alignment requirements for audio and video filters
Diffstat (limited to 'libavfilter/video.c')
-rw-r--r-- | libavfilter/video.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libavfilter/video.c b/libavfilter/video.c index 7ef04144e4..fa3d588044 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -24,6 +24,7 @@ #include <stdio.h> #include "libavutil/buffer.h" +#include "libavutil/cpu.h" #include "libavutil/hwcontext.h" #include "libavutil/imgutils.h" @@ -32,9 +33,6 @@ #include "internal.h" #include "video.h" -#define BUFFER_ALIGN 32 - - AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h) { return ff_get_video_buffer(link->dst->outputs[0], w, h); @@ -46,6 +44,7 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) int pool_width = 0; int pool_height = 0; int pool_align = 0; + int align = av_cpu_max_align(); enum AVPixelFormat pool_format = AV_PIX_FMT_NONE; if (link->hw_frames_ctx && @@ -65,7 +64,7 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) if (!link->frame_pool) { link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, - link->format, BUFFER_ALIGN); + link->format, align); if (!link->frame_pool) return NULL; } else { @@ -76,11 +75,11 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) } if (pool_width != w || pool_height != h || - pool_format != link->format || pool_align != BUFFER_ALIGN) { + pool_format != link->format || pool_align != align) { ff_frame_pool_uninit((FFFramePool **)&link->frame_pool); link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, - link->format, BUFFER_ALIGN); + link->format, align); if (!link->frame_pool) return NULL; } |