avfilter/vf_neighbor: Deduplicate AVClasses

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-09-10 22:58:21 +02:00
parent 31adb960b7
commit 443706d937

View File

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