avfilter: Deduplicate default audio inputs/outputs

Lots of audio filters use very simple inputs or outputs:
An array with a single AVFilterPad whose name is "default"
and whose type is AVMEDIA_TYPE_AUDIO; 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 (4784B here) as well as relocations.

*: In fact, several filters (like the filters in af_biquads.c)
already use the same inputs; 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 00:59:02 +02:00
parent 6b82f35041
commit 50ea7389ec
85 changed files with 114 additions and 710 deletions

View File

@@ -204,13 +204,6 @@ static const AVFilterPad inputs[] = {
},
};
static const AVFilterPad outputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_AUDIO,
},
};
const AVFilter ff_af_adynamicequalizer = {
.name = "adynamicequalizer",
.description = NULL_IF_CONFIG_SMALL("Apply Dynamic Equalization of input audio."),
@@ -218,7 +211,7 @@ const AVFilter ff_af_adynamicequalizer = {
.priv_class = &adynamicequalizer_class,
.uninit = uninit,
FILTER_INPUTS(inputs),
FILTER_OUTPUTS(outputs),
FILTER_OUTPUTS(ff_audio_default_filterpad),
FILTER_QUERY_FUNC(query_formats),
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
AVFILTER_FLAG_SLICE_THREADS,