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/vf_lut3d.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/vf_lut3d.c')
-rw-r--r-- | libavfilter/vf_lut3d.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c index 1ca448fcb3..db38d41932 100644 --- a/libavfilter/vf_lut3d.c +++ b/libavfilter/vf_lut3d.c @@ -1301,13 +1301,6 @@ static const AVFilterPad lut3d_inputs[] = { }, }; -static const AVFilterPad lut3d_outputs[] = { - { - .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - }, -}; - const AVFilter ff_vf_lut3d = { .name = "lut3d", .description = NULL_IF_CONFIG_SMALL("Adjust colors using a 3D LUT."), @@ -1315,7 +1308,7 @@ const AVFilter ff_vf_lut3d = { .init = lut3d_init, .uninit = lut3d_uninit, FILTER_INPUTS(lut3d_inputs), - FILTER_OUTPUTS(lut3d_outputs), + FILTER_OUTPUTS(ff_video_default_filterpad), FILTER_PIXFMTS_ARRAY(pix_fmts), .priv_class = &lut3d_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, @@ -2232,20 +2225,13 @@ static const AVFilterPad lut1d_inputs[] = { }, }; -static const AVFilterPad lut1d_outputs[] = { - { - .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - }, -}; - const AVFilter ff_vf_lut1d = { .name = "lut1d", .description = NULL_IF_CONFIG_SMALL("Adjust colors using a 1D LUT."), .priv_size = sizeof(LUT1DContext), .init = lut1d_init, FILTER_INPUTS(lut1d_inputs), - FILTER_OUTPUTS(lut1d_outputs), + FILTER_OUTPUTS(ff_video_default_filterpad), FILTER_PIXFMTS_ARRAY(pix_fmts), .priv_class = &lut1d_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, |