diff mbox series

[FFmpeg-devel,10/16] avfilter/vf_convolution: Deduplicate filter options

Message ID 20210104002816.2321974-10-andreas.rheinhardt@gmail.com
State Accepted
Commit 096cb41624d9792941988478f8ae0d86f9f7b880
Headers show
Series [FFmpeg-devel,01/16] avcodec/g723_1: Deduplicate arrays
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 4, 2021, 12:28 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
I wonder whether one should add an AVFILTER_DEFINE_CLASS2 macro that
allows a custom options name.

 libavfilter/vf_convolution.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
index 3674f5b590..0514c235a9 100644
--- a/libavfilter/vf_convolution.c
+++ b/libavfilter/vf_convolution.c
@@ -796,15 +796,18 @@  AVFilter ff_vf_convolution = {
 
 #endif /* CONFIG_CONVOLUTION_FILTER */
 
-#if CONFIG_PREWITT_FILTER
+#if CONFIG_PREWITT_FILTER || CONFIG_ROBERTS_FILTER || CONFIG_SOBEL_FILTER
 
-static const AVOption prewitt_options[] = {
+static const AVOption prewitt_roberts_sobel_options[] = {
     { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT,  {.i64=15}, 0, 15, FLAGS},
     { "scale",  "set scale",            OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0,  65535, FLAGS},
     { "delta",  "set delta",            OFFSET(delta), AV_OPT_TYPE_FLOAT, {.dbl=0}, -65535, 65535, FLAGS},
     { NULL }
 };
 
+#if CONFIG_PREWITT_FILTER
+
+#define prewitt_options prewitt_roberts_sobel_options
 AVFILTER_DEFINE_CLASS(prewitt);
 
 AVFilter ff_vf_prewitt = {
@@ -824,13 +827,7 @@  AVFilter ff_vf_prewitt = {
 
 #if CONFIG_SOBEL_FILTER
 
-static const AVOption sobel_options[] = {
-    { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT,  {.i64=15}, 0, 15, FLAGS},
-    { "scale",  "set scale",            OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0,  65535, FLAGS},
-    { "delta",  "set delta",            OFFSET(delta), AV_OPT_TYPE_FLOAT, {.dbl=0}, -65535, 65535, FLAGS},
-    { NULL }
-};
-
+#define sobel_options prewitt_roberts_sobel_options
 AVFILTER_DEFINE_CLASS(sobel);
 
 AVFilter ff_vf_sobel = {
@@ -850,13 +847,7 @@  AVFilter ff_vf_sobel = {
 
 #if CONFIG_ROBERTS_FILTER
 
-static const AVOption roberts_options[] = {
-    { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT,  {.i64=15}, 0, 15, FLAGS},
-    { "scale",  "set scale",            OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0,  65535, FLAGS},
-    { "delta",  "set delta",            OFFSET(delta), AV_OPT_TYPE_FLOAT, {.dbl=0}, -65535, 65535, FLAGS},
-    { NULL }
-};
-
+#define roberts_options prewitt_roberts_sobel_options
 AVFILTER_DEFINE_CLASS(roberts);
 
 AVFilter ff_vf_roberts = {
@@ -873,3 +864,4 @@  AVFilter ff_vf_roberts = {
 };
 
 #endif /* CONFIG_ROBERTS_FILTER */
+#endif /* CONFIG_PREWITT_FILTER || CONFIG_ROBERTS_FILTER || CONFIG_SOBEL_FILTER */