From 2f62a433f26cab5d26d59b961b34637c26cf8e22 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Thu, 3 Aug 2023 14:37:51 +0200 Subject: avfilter: Deduplicate default video inputs/outputs Lots of video filters use a very simple input or output: An array with a single AVFilterPad whose name is "default" and whose type is AVMEDIA_TYPE_VIDEO; everything else is unset. Given that we never use pointer equality for inputs or outputs*, we can simply use a single AVFilterPad instead of dozens; this even saves .data.rel.ro (8312B here) as well as relocations. *: In fact, several filters (like the filters in vf_lut.c) already use the same outputs; furthermore, ff_filter_alloc() duplicates the input and output pads so that we do not even work with the pads directly. Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_monochrome.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'libavfilter/vf_monochrome.c') diff --git a/libavfilter/vf_monochrome.c b/libavfilter/vf_monochrome.c index c77c3b8f19..92ea651db2 100644 --- a/libavfilter/vf_monochrome.c +++ b/libavfilter/vf_monochrome.c @@ -268,13 +268,6 @@ static const AVFilterPad monochrome_inputs[] = { }, }; -static const AVFilterPad monochrome_outputs[] = { - { - .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - }, -}; - #define OFFSET(x) offsetof(MonochromeContext, x) #define VF AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM @@ -294,7 +287,7 @@ const AVFilter ff_vf_monochrome = { .priv_size = sizeof(MonochromeContext), .priv_class = &monochrome_class, FILTER_INPUTS(monochrome_inputs), - FILTER_OUTPUTS(monochrome_outputs), + FILTER_OUTPUTS(ff_video_default_filterpad), FILTER_PIXFMTS_ARRAY(pixel_fmts), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, -- cgit v1.2.3