summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-10 22:58:21 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-19 04:32:05 +0200
commit443706d9374cc442bd9e7ccedf560065cbffbd05 (patch)
tree1f63fc73bdc43feddcd2bf0cb8371358fb7cea57
parent31adb960b700abe516b8ba86d02511611f2a7432 (diff)
avfilter/vf_neighbor: Deduplicate AVClasses
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavfilter/vf_neighbor.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/libavfilter/vf_neighbor.c b/libavfilter/vf_neighbor.c
index 16a092c761..c35a8a7917 100644
--- a/libavfilter/vf_neighbor.c
+++ b/libavfilter/vf_neighbor.c
@@ -354,14 +354,12 @@ static const AVFilterPad neighbor_outputs[] = {
#define OFFSET(x) offsetof(NContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
-#define DEFINE_NEIGHBOR_FILTER(name_, description_) \
-AVFILTER_DEFINE_CLASS(name_); \
- \
+#define DEFINE_NEIGHBOR_FILTER(name_, description_, priv_class_) \
const AVFilter ff_vf_##name_ = { \
.name = #name_, \
.description = NULL_IF_CONFIG_SMALL(description_), \
+ .priv_class = &priv_class_##_class, \
.priv_size = sizeof(NContext), \
- .priv_class = &name_##_class, \
.query_formats = query_formats, \
FILTER_INPUTS(neighbor_inputs), \
FILTER_OUTPUTS(neighbor_outputs), \
@@ -384,30 +382,31 @@ static const AVOption options[] = {
{ NULL }
};
+AVFILTER_DEFINE_CLASS_EXT(erosion_dilation, "erosion/dilation", options);
+
#if CONFIG_EROSION_FILTER
-#define erosion_options options
-DEFINE_NEIGHBOR_FILTER(erosion, "Apply erosion effect.");
+DEFINE_NEIGHBOR_FILTER(erosion, "Apply erosion effect.", erosion_dilation);
#endif /* CONFIG_EROSION_FILTER */
#if CONFIG_DILATION_FILTER
-#define dilation_options options
-DEFINE_NEIGHBOR_FILTER(dilation, "Apply dilation effect.");
+DEFINE_NEIGHBOR_FILTER(dilation, "Apply dilation effect.", erosion_dilation);
#endif /* CONFIG_DILATION_FILTER */
+AVFILTER_DEFINE_CLASS_EXT(deflate_inflate, "deflate/inflate",
+ &options[DEINFLATE_OPTIONS_OFFSET]);
+
#if CONFIG_DEFLATE_FILTER
-#define deflate_options &options[DEINFLATE_OPTIONS_OFFSET]
-DEFINE_NEIGHBOR_FILTER(deflate, "Apply deflate effect.");
+DEFINE_NEIGHBOR_FILTER(deflate, "Apply deflate effect.", deflate_inflate);
#endif /* CONFIG_DEFLATE_FILTER */
#if CONFIG_INFLATE_FILTER
-#define inflate_options &options[DEINFLATE_OPTIONS_OFFSET]
-DEFINE_NEIGHBOR_FILTER(inflate, "Apply inflate effect.");
+DEFINE_NEIGHBOR_FILTER(inflate, "Apply inflate effect.", deflate_inflate);
#endif /* CONFIG_INFLATE_FILTER */