diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-08-03 14:37:51 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-08-07 09:21:13 +0200 |
commit | 2f62a433f26cab5d26d59b961b34637c26cf8e22 (patch) | |
tree | 0d70e36850612c6ffe9f55523152aea0b18365ea /libavfilter/trim.c | |
parent | 6d15643173263c8ff9e9422bbbdcb843f4bc8f9c (diff) | |
download | ffmpeg-2f62a433f26cab5d26d59b961b34637c26cf8e22.tar.gz |
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>
Diffstat (limited to 'libavfilter/trim.c')
-rw-r--r-- | libavfilter/trim.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/libavfilter/trim.c b/libavfilter/trim.c index 91a68716c9..4c1a2b4f48 100644 --- a/libavfilter/trim.c +++ b/libavfilter/trim.c @@ -32,6 +32,7 @@ #include "avfilter.h" #include "internal.h" #include "filters.h" +#include "video.h" typedef struct TrimContext { const AVClass *class; @@ -356,13 +357,6 @@ static const AVFilterPad trim_inputs[] = { }, }; -static const AVFilterPad trim_outputs[] = { - { - .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - }, -}; - const AVFilter ff_vf_trim = { .name = "trim", .description = NULL_IF_CONFIG_SMALL("Pick one continuous section from the input, drop the rest."), @@ -371,7 +365,7 @@ const AVFilter ff_vf_trim = { .priv_size = sizeof(TrimContext), .priv_class = &trim_class, FILTER_INPUTS(trim_inputs), - FILTER_OUTPUTS(trim_outputs), + FILTER_OUTPUTS(ff_video_default_filterpad), }; #endif // CONFIG_TRIM_FILTER |