aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-27 17:22:25 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-10-05 18:58:25 +0200
commit688696790cc69b81d92f9c1a3e753399cdfb1508 (patch)
treebfbeb994c2065e223b2080977abedc2d7d8062e3
parente54b9bb8a20888f7b9bc00c1dbc6319e60bc7169 (diff)
downloadffmpeg-688696790cc69b81d92f9c1a3e753399cdfb1508.tar.gz
avfilter/vf_vidstab(detect|transform): Deduplicate pixel formats
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavfilter/vf_vidstabdetect.c11
-rw-r--r--libavfilter/vf_vidstabtransform.c11
-rw-r--r--libavfilter/vidstabutils.c8
-rw-r--r--libavfilter/vidstabutils.h2
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 */
/**