diff mbox series

[FFmpeg-devel,3/4] avfilter/video: Add ff_default_get_video_buffer2() to set specific alignment

Message ID 20220411212120.15692-3-michael@niedermayer.cc
State Accepted
Commit d74078270198b97fdda258840f0d501a3ffcc693
Headers show
Series [FFmpeg-devel,1/4] avformat/demux: Use unsigned to check duration vs duration_text | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer April 11, 2022, 9:21 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavfilter/video.c | 8 ++++++--
 libavfilter/video.h | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/video.c b/libavfilter/video.c
index b2f0cdf88a..e9eb110ff4 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -38,13 +38,12 @@  AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
     return ff_get_video_buffer(link->dst->outputs[0], w, h);
 }
 
-AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
+AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int align)
 {
     AVFrame *frame = NULL;
     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 &&
@@ -94,6 +93,11 @@  AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
     return frame;
 }
 
+AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
+{
+    return ff_default_get_video_buffer2(link, w, h, av_cpu_max_align());
+}
+
 AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h)
 {
     AVFrame *ret = NULL;
diff --git a/libavfilter/video.h b/libavfilter/video.h
index f448e4ada4..f37bab9d03 100644
--- a/libavfilter/video.h
+++ b/libavfilter/video.h
@@ -24,6 +24,7 @@ 
 #include "avfilter.h"
 
 AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h);
+AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int align);
 AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h);
 
 /**