[FFmpeg-cvslog] avfilter/vf_neighbor: Deduplicate AVClasses
Andreas Rheinhardt
git at videolan.org
Sun Sep 19 06:14:10 EEST 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Fri Sep 10 22:58:21 2021 +0200| [443706d9374cc442bd9e7ccedf560065cbffbd05] | committer: Andreas Rheinhardt
avfilter/vf_neighbor: Deduplicate AVClasses
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=443706d9374cc442bd9e7ccedf560065cbffbd05
---
libavfilter/vf_neighbor.c | 23 +++++++++++------------
1 file 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 */
More information about the ffmpeg-cvslog
mailing list