History

avfilter/vf_convolution: Deduplicate AVClasses

Andreas Rheinhardt committed 5 years ago

Commit 8c4a7a41 parent 32089111 file · +9 −21Browse files

Unified · Split

libavfilter/vf_convolution.c+9−21
@@ -974,23 +974,23 @@ const AVFilter ff_vf_convolution = { · 973 unmodified lines
974974
975975 #endif /* CONFIG_CONVOLUTION_FILTER */
976976
977−static const AVOption prewitt_roberts_sobel_options[] = {
977+static const AVOption common_options[] = {
978978 { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=15}, 0, 15, FLAGS},
979979 { "scale", "set scale", OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, 65535, FLAGS},
980980 { "delta", "set delta", OFFSET(delta), AV_OPT_TYPE_FLOAT, {.dbl=0}, -65535, 65535, FLAGS},
981981 { NULL }
982982 };
983983
984−#if CONFIG_PREWITT_FILTER
984+AVFILTER_DEFINE_CLASS_EXT(common, "kirsch/prewitt/roberts/scharr/sobel",
985+ common_options);
985986
986−#define prewitt_options prewitt_roberts_sobel_options
987−AVFILTER_DEFINE_CLASS(prewitt);
987+#if CONFIG_PREWITT_FILTER
988988
989989 const AVFilter ff_vf_prewitt = {
990990 .name = "prewitt",
991991 .description = NULL_IF_CONFIG_SMALL("Apply prewitt operator."),
992992 .priv_size = sizeof(ConvolutionContext),
993− .priv_class = &prewitt_class,
993+ .priv_class = &common_class,
994994 .init = init,
995995 .query_formats = query_formats,
996996 FILTER_INPUTS(convolution_inputs),
@@ -1003,14 +1003,11 @@ const AVFilter ff_vf_prewitt = { · 6 unmodified lines
10031003
10041004 #if CONFIG_SOBEL_FILTER
10051005
1006−#define sobel_options prewitt_roberts_sobel_options
1007−AVFILTER_DEFINE_CLASS(sobel);
1008−
10091006 const AVFilter ff_vf_sobel = {
10101007 .name = "sobel",
10111008 .description = NULL_IF_CONFIG_SMALL("Apply sobel operator."),
10121009 .priv_size = sizeof(ConvolutionContext),
1013− .priv_class = &sobel_class,
1010+ .priv_class = &common_class,
10141011 .init = init,
10151012 .query_formats = query_formats,
10161013 FILTER_INPUTS(convolution_inputs),
@@ -1023,14 +1020,11 @@ const AVFilter ff_vf_sobel = { · 6 unmodified lines
10231020
10241021 #if CONFIG_ROBERTS_FILTER
10251022
1026−#define roberts_options prewitt_roberts_sobel_options
1027−AVFILTER_DEFINE_CLASS(roberts);
1028−
10291023 const AVFilter ff_vf_roberts = {
10301024 .name = "roberts",
10311025 .description = NULL_IF_CONFIG_SMALL("Apply roberts cross operator."),
10321026 .priv_size = sizeof(ConvolutionContext),
1033− .priv_class = &roberts_class,
1027+ .priv_class = &common_class,
10341028 .init = init,
10351029 .query_formats = query_formats,
10361030 FILTER_INPUTS(convolution_inputs),
@@ -1043,14 +1037,11 @@ const AVFilter ff_vf_roberts = { · 6 unmodified lines
10431037
10441038 #if CONFIG_KIRSCH_FILTER
10451039
1046−#define kirsch_options prewitt_roberts_sobel_options
1047−AVFILTER_DEFINE_CLASS(kirsch);
1048−
10491040 const AVFilter ff_vf_kirsch = {
10501041 .name = "kirsch",
10511042 .description = NULL_IF_CONFIG_SMALL("Apply kirsch operator."),
10521043 .priv_size = sizeof(ConvolutionContext),
1053− .priv_class = &kirsch_class,
1044+ .priv_class = &common_class,
10541045 .init = init,
10551046 .query_formats = query_formats,
10561047 FILTER_INPUTS(convolution_inputs),
@@ -1063,14 +1054,11 @@ const AVFilter ff_vf_kirsch = { · 6 unmodified lines
10631054
10641055 #if CONFIG_SCHARR_FILTER
10651056
1066−#define scharr_options prewitt_roberts_sobel_options
1067−AVFILTER_DEFINE_CLASS(scharr);
1068−
10691057 const AVFilter ff_vf_scharr = {
10701058 .name = "scharr",
10711059 .description = NULL_IF_CONFIG_SMALL("Apply scharr operator."),
10721060 .priv_size = sizeof(ConvolutionContext),
1073− .priv_class = &scharr_class,
1061+ .priv_class = &common_class,
10741062 .init = init,
10751063 .query_formats = query_formats,
10761064 FILTER_INPUTS(convolution_inputs),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t