diff mbox series

[FFmpeg-devel,094/218] avfilter/vf_vidstab(detect|transform): Deduplicate pixel formats

Message ID PR3PR03MB666560598D670D6D7243BB148FAA9@PR3PR03MB6665.eurprd03.prod.outlook.com
State Accepted
Commit 688696790cc69b81d92f9c1a3e753399cdfb1508
Headers show
Series [FFmpeg-devel,001/218] avfilter/f_reverse: Don't use redundant query_formats function | expand

Checks

Context Check Description
andriy/commit_msg_x86 warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/commit_msg_ppc warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 30, 2021, 1:40 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@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 mbox series

Patch

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 */
 
 /**