[FFmpeg-devel] [PATCH 094/218] avfilter/vf_vidstab(detect|transform): Deduplicate pixel formats
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Thu Sep 30 16:40:35 EEST 2021
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavfilter/vf_vidstabdetect.c | 11 +----------
libavfilter/vf_vidstabtransform.c | 11 +----------
libavfilter/vidstabutils.c | 8 ++++++++
libavfilter/vidstabutils.h | 2 ++
4 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c
index 278d0f15a6..19e9ca5a42 100644
--- a/libavfilter/vf_vidstabdetect.c
+++ b/libavfilter/vf_vidstabdetect.c
@@ -84,16 +84,7 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
- // If you add something here also add it in vidstabutils.c
- static const enum AVPixelFormat pix_fmts[] = {
- AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
- AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUVA420P,
- AV_PIX_FMT_YUV440P, AV_PIX_FMT_GRAY8,
- AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA,
- AV_PIX_FMT_NONE
- };
-
- return ff_set_common_formats_from_list(ctx, pix_fmts);
+ return ff_set_common_formats_from_list(ctx, ff_vidstab_pix_fmts);
}
static int config_input(AVFilterLink *inlink)
diff --git a/libavfilter/vf_vidstabtransform.c b/libavfilter/vf_vidstabtransform.c
index 70fe552b59..338a5d4f8a 100644
--- a/libavfilter/vf_vidstabtransform.c
+++ b/libavfilter/vf_vidstabtransform.c
@@ -123,16 +123,7 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
- // If you add something here also add it in vidstabutils.c
- static const enum AVPixelFormat pix_fmts[] = {
- AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
- AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUVA420P,
- AV_PIX_FMT_YUV440P, AV_PIX_FMT_GRAY8,
- AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA,
- AV_PIX_FMT_NONE
- };
-
- return ff_set_common_formats_from_list(ctx, pix_fmts);
+ return ff_set_common_formats_from_list(ctx, ff_vidstab_pix_fmts);
}
diff --git a/libavfilter/vidstabutils.c b/libavfilter/vidstabutils.c
index 1199dbd56e..56fbdbdb87 100644
--- a/libavfilter/vidstabutils.c
+++ b/libavfilter/vidstabutils.c
@@ -20,6 +20,14 @@
#include "vidstabutils.h"
+const enum AVPixelFormat ff_vidstab_pix_fmts[] = {
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUVA420P,
+ AV_PIX_FMT_YUV440P, AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA,
+ AV_PIX_FMT_NONE
+};
+
/** convert AV's pixelformat to vid.stab pixelformat */
VSPixelFormat ff_av2vs_pixfmt(AVFilterContext *ctx, enum AVPixelFormat pf)
{
diff --git a/libavfilter/vidstabutils.h b/libavfilter/vidstabutils.h
index c6d6cedb72..17e1668be6 100644
--- a/libavfilter/vidstabutils.h
+++ b/libavfilter/vidstabutils.h
@@ -25,6 +25,8 @@
#include "avfilter.h"
+extern const enum AVPixelFormat ff_vidstab_pix_fmts[];
+
/* Conversion routines between libav* and vid.stab */
/**
--
2.30.2
More information about the ffmpeg-devel
mailing list