Commit graph

11935 commits

Author SHA1 Message Date
Andreas Rheinhardt
a6c58450da all: Fix doxy comments wrongly designated as trailing ///<
The ///< or /**< form of doxygen comments are only to be used
when the documentation follows the member and the comment
block starts on the same line as the member. This commit
fixes wrong uses of them; in particular, this fixes the comment
for mb_height in H.264 SPS's structure which was wrongly added
to mb_width.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 17:00:24 +01:00
Nil Fons Miret
9899da8175
libavfilter: guard against ff_draw_init/ff_draw_init2 failures
The return value of ff_draw_init and ff_draw_init2 are not checked in
most usages. However, if they return an error, they don't get to the
point where they set the attributes of the FFDrawContext. These
functions are typically used in conjunction with ff_draw_color, which
checks draw->desc->flags, causing a null pointer dereference.

Signed-off-by: Nil Fons Miret <nilf@netflix.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-11 14:17:01 +01:00
James Almer
5f5ab22639 avfilter/vsrc_testsrc: add support for semi planar formats to yuvtestsrc
Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-10 10:15:33 -03:00
Leandro Santiago
d21ed2298e avfilter/dnn_detect: fail on filter if mandatory anchor option is missing
It prevents the filter of running in case such option is missing,
failing early, during init() instead of simply logging an error
during runtime.

Signed-off-by: Leandro Santiago <leandrosansilva@gmail.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2025-03-03 18:30:18 +08:00
Leandro Santiago
90fbb40da5 avfilter/dnn: do not manually parse anchors filter option
Instead, rely on AV_OPT_TYPE_FLAG_ARRAY, which will automatically
perform the parsing.

Signed-off-by: Leandro Santiago <leandrosansilva@gmail.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2025-03-03 18:29:33 +08:00
Niklas Haas
651bfd0dad avfilter/vf_libplacebo: set correct alpha mode before blending
&pl_alpha_overlay expects straight alpha, but the alpha output may be
premultiplied as a result of the target alpha mode (or in the absence of an
alpha channel). Fix it by requesting independent alpha explicitly when
blending.
2025-02-27 18:58:19 +01:00
Niklas Haas
c85879c601 avfilter/vf_libplacebo: set colorspace properties on all inputs
There is no reason to only do this on the first input. It doesn't actually
matter for now given that we don't constrain the color space list, but it
may matter when that changes.

Signed-off-by: Niklas Haas <git@haasn.dev>
2025-02-27 18:56:49 +01:00
Niklas Haas
d48745ba1c avfilter/vf_libplacebo: allow differing formats per input
Each input is entirely independent and can have varying pixel formats,
color spaces, etc. To accomplish this, we need to make a full copy of the
format list for each subsequent input, rather than sharing the same ref.

Signed-off-by: Niklas Haas <git@haasn.dev>
Sponsored-by: nxtedition
2025-02-27 18:56:49 +01:00
Niklas Haas
6602b88df6 avfilter/vf_libplacebo: switch to new background API
Fixes a deprecation warning, and also fixes a bug where the depredated
skip_target_clearing option was not correctly mapped to the new API inside
libplacebo upstream.

Signed-off-by: Niklas Haas <git@haasn.dev>
Sponsored-by: nxtedition
2025-02-27 18:56:49 +01:00
Niklas Haas
05302767ac avfilter/vf_liplacebo: properly initialize variable
Signed-off-by: Niklas Haas <git@haasn.dev>
2025-02-27 18:56:24 +01:00
Niklas Haas
5944c4b20a avfilter/vf_libplacebo: remove deprecated options
These were removed upstream and no longer have had any effect for
a while now.

Signed-off-by: Niklas Haas <git@haasn.dev>
2025-02-27 18:56:19 +01:00
Niklas Haas
27814dc3b6 avfilter/libplacebo: add option for outputting separate fields
cf. the other deinterlacing-aware filters.
2025-02-27 18:55:33 +01:00
Niklas Haas
83c1b34964 avfilter/libplacebo: strip interlaced flag when deinterlacing 2025-02-27 18:55:33 +01:00
Niklas Haas
123cccb621 avfilter/libplacebo: only mark frame fields when deinterlacing
Avoids an unnecessary copy of the frame in the frame queue when not
deinterlacing anyways.
2025-02-27 18:55:33 +01:00
Niklas Haas
794cba812e avfilter/libplacebo: add deinterlacing options
These were introduced in libplacebo API version 220. We actually already
map the field by default, but deinterlacing was never enabled unless the user
explicitly forced it using extra_ops.
2025-02-27 18:55:33 +01:00
Niklas Haas
e23c79ebfc avfilter/vf_libplacebo: switch to AV_OPT_TYPE_COLOR 2025-02-27 18:51:41 +01:00
Lynne
2066c5526d
gblur_vulkan: simplify buffer content writing
Before .buf_elems, users had to manually print to a string if they
wanted a non-fixed number of elements in an array.

Since we're printing everything to the shaders manually anyway, use
the new mechanism.
2025-02-21 03:19:21 +01:00
Lynne
684171c9f7
overlay_vulkan: remove unused variable
Forgotten to be removed after the recent port to imageLoad()
2025-02-21 03:19:19 +01:00
Niklas Haas
cd81f08491 avfilter/libplacebo: use a transparent default fillcolor
This will leave the background transparent when the target format
contains an alpha channel, without affecting the behavior on formats
without one.
2025-02-19 18:33:21 +01:00
Lynne
08e37fa082
overlay_vulkan: port to imageLoad() 2025-02-18 10:44:56 +01:00
Lynne
2b8d38cbc1
blend_vulkan: port to imageLoad() 2025-02-18 10:44:56 +01:00
Lynne
379cfd1855
transpose_vulkan: port to imageLoad() 2025-02-18 10:44:55 +01:00
Lynne
b02f9157b8
gblur_vulkan: port to imageLoad() 2025-02-18 10:44:55 +01:00
Lynne
4d3e540fa4
flip_vulkan: port to imageLoad() 2025-02-18 10:44:54 +01:00
Lynne
a535639620
nlmeans_vulkan: switch to imageLoad() 2025-02-18 10:44:54 +01:00
Lynne
9c4a26d9b0
avgblur_vulkan: fix duplicated variable error when planes=0 2025-02-18 10:44:54 +01:00
Lynne
389fb36f92
avgblur_vulkan: port to imageLoad() 2025-02-18 10:44:53 +01:00
Lynne
779763181f
bwdif_vulkan: convert to storage images
texture() uses bilinear scaling; imageLoad() accesses the image directly.
The reason why texture() was used throughout Vulkan filters is that
back when they were written, they were targetting old Intel hardware,
which had a texel cache only for sampled images.

These days, GPUs have a generic cache that doesn't care what source it
gets populated with. Additionally, bypassing the sampling circuitry saves
us some performance.

Finally, all the old texture() code had an issue where unnormalized
coordinates were used, but an offset of 0.5 was not added, hence each
pixel ended up being interpolated. This fixes this.
2025-02-18 10:44:53 +01:00
Lynne
042ed96d0a
vulkan_filter: use GENERAL image layout when no sampler is given
This allows using the generic filter code with STORAGE image inputs.
2025-02-18 10:44:53 +01:00
Niklas Haas
4dc2ae69e7 avfilter/interlace_vulkan: add interlace_vulkan filter
This is a Vulkan-accelerated version of the existing interlace filter.
2025-02-17 17:16:25 +01:00
Gyan Doshi
7ee4936e0a avfilter/vpp_amf: add option reset_sar
4b77a0a681 added a new consumer of ff_scale_adjust_dimensions
which was recently modified to allow for square pixel output.

This commit extends the new option to vpp_amf, and unbreaks the building
of vf_amf_common.c
2025-02-10 19:59:26 +05:30
Timo Rothenpieler
d6a364e7c3 avfilter/vf_amf_common: fix build
AMF was forgotten in a28dc06869
2025-02-10 14:32:25 +01:00
Gyan Doshi
a28dc06869 avfilter/scale*: add option reset_sar
For anamorphic videos, enabling this option leads to adjustment of
output dimensions to obtain square pixels when the user requests
proportional scaling through either of the w/h expressions or
force_original_aspect_ratio.

Output SAR is always reset to 1.

Option added to scale, scale_cuda, scale_npp & scale_vaapi.

libplacebo already has a similar option with different semantics,
scale_vt and scale_vulkan don't implement force_oar, so for these
three filters, I've made minimal changes needed to not break building
or change output.
2025-02-10 16:25:23 +05:30
Steven Zhou
d1fa9cf4b4 avfilter/drawtext: fix memory leak when using "reinit" runtime command
Free AVOption in drawtext private context when freeing old copy of drawtext
private context during processing of "reinit" runtime command.

Signed-off-by: Steven Zhou <steven.zhou@netint.ca>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-06 17:41:12 -03:00
Gyan Doshi
6da82b4485 avfilter/xpsnr: avoid division by zero
The ref input may have its frame rate unset, which would then lead to
SIGFPE. So fall back to the main link frame rate. If that too is unset,
default to 0.

Related to #11428
2025-02-06 16:06:20 +05:30
James Almer
a750bcb237 avfilter/Makefile: add missing SKIPHEADERS for AMF
Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-04 16:35:06 -03:00
Evgeny Pavlov
4b77a0a681 avfilter/scale_amf: Add AMF VPP & super resolution filters
This commit adds two AMF filters: vpp_amf & sr_amf.
Both filters are using AMF hardware acceleration.
vpp_amf supports simple scaling algorithms & color conversion.
sr_amf supports advanced scaling algorithms such as FSR & can
be used for upscaling only.
2025-02-04 00:14:14 +01:00
James Almer
49726a922f avfilter/vf_scale: remove global side data when it no longer applies after scaling
Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-03 11:05:59 -03:00
James Almer
db7ff13574 avfilter/avfilter: remove accidental loop index variable reset
Fixes ticket #11442.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-03 11:05:59 -03:00
James Almer
85a327d9d0 avfilter/buffersrc: remove unused variable
Added by mistake in 7a025e1cb5.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-28 10:01:17 -03:00
Gyan Doshi
959b799c8d avfilter/setpts: add option strip_fps to decide framerate handling
In f121d95, the outlink framerate was unconditionally unset.
This breaks/bloats outputs from CFR muxers unless the user explicitly
sets a sane framerate. And the most common invocation for setpts seen in
workflows, our docs and across the web is `PTS-STARTPTS` or others of the
general form `PTS+constant` which preserves the input framerate.

Default value is false, which restores old behaviour.

Fixes #11428
2025-01-27 15:40:09 +05:30
James Almer
6a282cdf7e avfilter/af_aresample: propagate downmix metadata to swresample if present
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-25 21:56:49 -03:00
James Almer
6707d970c0 avfilter/buffersink: add av_buffersink_get_side_data()
This will be used to get global side data that was propagated through the
filterchain.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-25 21:56:49 -03:00
James Almer
7a025e1cb5 avfilter/buffersrc: add a side_data field
This will be used to propagate global side data through the filterchain.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-25 21:56:49 -03:00
James Almer
ef1cb1c9c8 avfilter/avfilter: add a side_data field to AVFilterLink
This will be used to propagate global side data through the filterchain.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-25 21:56:49 -03:00
Michael Niedermayer
66e9888bf4
avfilter/vf_v360: Fix NULL pointer use
Fixes: applying zero offset to null pointer
partly Fixes: verysmall.flv

Found-by: Elias Myllymäki <elias.myllymaki04p@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-15 01:27:46 +01:00
Andreas Rheinhardt
e540381f91 avfilter/vf_xpsnr: Avoid array only one of whose elements is used
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:40 +01:00
Andreas Rheinhardt
7822beed85 avfilter/vf_xpsnr: Fix leaks
This filter uses the AVBuffer API to allocate buffers that are never
shared at all and frees them via av_freep() (actually, it passes
pointers to AVBufferRefs to av_freep, so that only the AVBuffer
structures are freed at all (because AVBufferRef has a AVBuffer* as its
first member), not the AVBufferRef and not the underlying buffers;
and due to a wrong check the AVBuffers corresponding
to buf_org[c] with c>0 were never freed at all). This is a violation
of the AVBuffer API and causes a memleak. Fix this by avoiding the
AVBuffer API altogether.
(The FATE tests don't catch this, because they use piping to awk,
so that the error code from ffmpeg is ignored.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:40 +01:00
Andreas Rheinhardt
7ab7d9c3c0 avfilter/avfilter: Add FFFilter, hide internals of AVFilter
This patch is analogous to 20f9727018:
It hides the internal part of AVFilter by adding a new internal
structure FFFilter (declared in filters.h) that has an AVFilter
as its first member; the internal part of AVFilter is moved to
this new structure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:40 +01:00
Andreas Rheinhardt
9bbab3255b avfilter/vf_overlay: Remove spec-incompliant ';'
Fixes warnings with -pedantic with GCC and Clang.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:40 +01:00