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 <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2023-08-03 14:37:51 +02:00
parent 6d15643173
commit 2f62a433f2
147 changed files with 207 additions and 1247 deletions

View File

@ -135,19 +135,12 @@ static const AVFilterPad avfilter_vf_vflip_inputs[] = {
},
};
static const AVFilterPad avfilter_vf_vflip_outputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
},
};
const AVFilter ff_vf_vflip = {
.name = "vflip",
.description = NULL_IF_CONFIG_SMALL("Flip the input video vertically."),
.priv_size = sizeof(FlipContext),
.priv_class = &vflip_class,
FILTER_INPUTS(avfilter_vf_vflip_inputs),
FILTER_OUTPUTS(avfilter_vf_vflip_outputs),
FILTER_OUTPUTS(ff_video_default_filterpad),
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
};