History

avfilter/vf_neighbor: Deduplicate AVClasses

Andreas Rheinhardt committed 5 years ago

Commit 443706d1 parent 31adb961 file · +11 −12Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_neighbor.c+11−12
@@ -354,14 +354,12 @@ static const AVFilterPad neighbor_outputs[] = { · 353 unmodified lines
354354 #define OFFSET(x) offsetof(NContext, x)
355355 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
356356
357−#define DEFINE_NEIGHBOR_FILTER(name_, description_) \
358−AVFILTER_DEFINE_CLASS(name_); \
359− \
357+#define DEFINE_NEIGHBOR_FILTER(name_, description_, priv_class_) \
360358 const AVFilter ff_vf_##name_ = { \
361359 .name = #name_, \
362360 .description = NULL_IF_CONFIG_SMALL(description_), \
361+ .priv_class = &priv_class_##_class, \
363362 .priv_size = sizeof(NContext), \
364− .priv_class = &name_##_class, \
365363 .query_formats = query_formats, \
366364 FILTER_INPUTS(neighbor_inputs), \
367365 FILTER_OUTPUTS(neighbor_outputs), \
@@ -384,30 +382,31 @@ static const AVOption options[] = { · 16 unmodified lines
384382 { NULL }
385383 };
386384
385+AVFILTER_DEFINE_CLASS_EXT(erosion_dilation, "erosion/dilation", options);
386+
387387 #if CONFIG_EROSION_FILTER
388388
389−#define erosion_options options
390−DEFINE_NEIGHBOR_FILTER(erosion, "Apply erosion effect.");
389+DEFINE_NEIGHBOR_FILTER(erosion, "Apply erosion effect.", erosion_dilation);
391390
392391 #endif /* CONFIG_EROSION_FILTER */
393392
394393 #if CONFIG_DILATION_FILTER
395394
396−#define dilation_options options
397−DEFINE_NEIGHBOR_FILTER(dilation, "Apply dilation effect.");
395+DEFINE_NEIGHBOR_FILTER(dilation, "Apply dilation effect.", erosion_dilation);
398396
399397 #endif /* CONFIG_DILATION_FILTER */
400398
399+AVFILTER_DEFINE_CLASS_EXT(deflate_inflate, "deflate/inflate",
400+ &options[DEINFLATE_OPTIONS_OFFSET]);
401+
401402 #if CONFIG_DEFLATE_FILTER
402403
403−#define deflate_options &options[DEINFLATE_OPTIONS_OFFSET]
404−DEFINE_NEIGHBOR_FILTER(deflate, "Apply deflate effect.");
404+DEFINE_NEIGHBOR_FILTER(deflate, "Apply deflate effect.", deflate_inflate);
405405
406406 #endif /* CONFIG_DEFLATE_FILTER */
407407
408408 #if CONFIG_INFLATE_FILTER
409409
410−#define inflate_options &options[DEINFLATE_OPTIONS_OFFSET]
411−DEFINE_NEIGHBOR_FILTER(inflate, "Apply inflate effect.");
410+DEFINE_NEIGHBOR_FILTER(inflate, "Apply inflate effect.", deflate_inflate);
412411
413412 #endif /* CONFIG_INFLATE_FILTER */

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