summaryrefslogtreecommitdiff
path: root/libavfilter/vf_chromashift.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-08-03 14:37:51 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-08-07 09:21:13 +0200
commit2f62a433f26cab5d26d59b961b34637c26cf8e22 (patch)
tree0d70e36850612c6ffe9f55523152aea0b18365ea /libavfilter/vf_chromashift.c
parent6d15643173263c8ff9e9422bbbdcb843f4bc8f9c (diff)
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_chromashift.c')
-rw-r--r--libavfilter/vf_chromashift.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/libavfilter/vf_chromashift.c b/libavfilter/vf_chromashift.c
index 2ddfa61726..92869113a9 100644
--- a/libavfilter/vf_chromashift.c
+++ b/libavfilter/vf_chromashift.c
@@ -382,13 +382,6 @@ static const AVFilterPad inputs[] = {
},
};
-static const AVFilterPad outputs[] = {
- {
- .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- },
-};
-
static const enum AVPixelFormat yuv_pix_fmts[] = {
AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P,
AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ422P,AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ411P,
@@ -411,7 +404,7 @@ const AVFilter ff_vf_chromashift = {
.description = NULL_IF_CONFIG_SMALL("Shift chroma."),
.priv_size = sizeof(ChromaShiftContext),
.priv_class = &chromashift_class,
- FILTER_OUTPUTS(outputs),
+ FILTER_OUTPUTS(ff_video_default_filterpad),
FILTER_INPUTS(inputs),
FILTER_PIXFMTS_ARRAY(yuv_pix_fmts),
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
@@ -448,7 +441,7 @@ const AVFilter ff_vf_rgbashift = {
.description = NULL_IF_CONFIG_SMALL("Shift RGBA."),
.priv_size = sizeof(ChromaShiftContext),
.priv_class = &rgbashift_class,
- FILTER_OUTPUTS(outputs),
+ FILTER_OUTPUTS(ff_video_default_filterpad),
FILTER_INPUTS(inputs),
FILTER_PIXFMTS_ARRAY(rgb_pix_fmts),
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,