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:
@@ -728,20 +728,13 @@ static const AVFilterPad pixscope_inputs[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const AVFilterPad pixscope_outputs[] = {
|
||||
{
|
||||
.name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
},
|
||||
};
|
||||
|
||||
const AVFilter ff_vf_pixscope = {
|
||||
.name = "pixscope",
|
||||
.description = NULL_IF_CONFIG_SMALL("Pixel data analysis."),
|
||||
.priv_size = sizeof(PixscopeContext),
|
||||
.priv_class = &pixscope_class,
|
||||
FILTER_INPUTS(pixscope_inputs),
|
||||
FILTER_OUTPUTS(pixscope_outputs),
|
||||
FILTER_OUTPUTS(ff_video_default_filterpad),
|
||||
FILTER_QUERY_FUNC(query_formats),
|
||||
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
|
||||
.process_command = pixscope_process_command,
|
||||
@@ -1132,13 +1125,6 @@ static const AVFilterPad oscilloscope_inputs[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const AVFilterPad oscilloscope_outputs[] = {
|
||||
{
|
||||
.name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
},
|
||||
};
|
||||
|
||||
const AVFilter ff_vf_oscilloscope = {
|
||||
.name = "oscilloscope",
|
||||
.description = NULL_IF_CONFIG_SMALL("2D Video Oscilloscope."),
|
||||
@@ -1146,7 +1132,7 @@ const AVFilter ff_vf_oscilloscope = {
|
||||
.priv_class = &oscilloscope_class,
|
||||
.uninit = oscilloscope_uninit,
|
||||
FILTER_INPUTS(oscilloscope_inputs),
|
||||
FILTER_OUTPUTS(oscilloscope_outputs),
|
||||
FILTER_OUTPUTS(ff_video_default_filterpad),
|
||||
FILTER_QUERY_FUNC(query_formats),
|
||||
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
|
||||
.process_command = oscilloscope_process_command,
|
||||
|
||||
Reference in New Issue
Block a user