aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter
Commit message (Collapse)AuthorAgeFilesLines
* avfilter/avfilter: add AVFilterGraph->max_buffered_frames to limit buffered ↵Marton Balint24 hours3-2/+14
| | | | | | frames Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/framequeue: add support for limiting and tracking buffered frames ↵Marton Balint24 hours2-3/+22
| | | | | | in the queues Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/vf_thumbnail: switch to query_func2Niklas Haas3 days1-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of enumerating a static list of planar formats to support, walk through the format list and enable all supported formats. As of writing, this generates the following format list: - gbrap - gbrap10le - gbrap12le - gbrap14le - gbrap16le - gbrp - gbrp10le - gbrp12le - gbrp14le - gbrp16le - gbrp9le - gray - gray10le - gray12le - gray14le - gray16le - gray9le - ya16le - ya8 - yuv410p - yuv411p - yuv420p - yuv420p10le - yuv420p12le - yuv420p14le - yuv420p16le - yuv420p9le - yuv422p - yuv422p10le - yuv422p12le - yuv422p14le - yuv422p16le - yuv422p9le - yuv440p - yuv440p10le - yuv440p12le - yuv444p - yuv444p10le - yuv444p12le - yuv444p14le - yuv444p16le - yuv444p9le - yuva420p - yuva420p10le - yuva420p16le - yuva420p9le - yuva422p - yuva422p10le - yuva422p12le - yuva422p16le - yuva422p9le - yuva444p - yuva444p10le - yuva444p12le - yuva444p16le - yuva444p9le - yuvj411p - yuvj420p - yuvj422p - yuvj440p - yuvj444p
* avfilter/vf_thumbnail: support more planar formatsNiklas Haas3 days1-5/+20
| | | | | | | | | | | This adds support for high bit depth formats, as well as formats with fewer than 3 planes. The implementation for HBD is the same as for 8 bit formats, just right shifted to 8 bits. It's worth pointing out that this also works for HDR formats (and even DV), because the underlying implementation is just trying to minimize the histogram difference. If anything, using a HDR format will result in a *more* accurate detection, because HDR formats tend to be more perceptually uniform.
* avfilter/overlay_cuda: add timeline editing supportJorge Estrada4 days2-1/+2
| | | | | | | | | | | | | Enables timeline editing options for overlay_cuda similar to what overlay allows Example overlaying an image on a video between 30 to 60 seconds: ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i sample-video.mp4 -i sample-image.jpg -filter_complex "[1:v]hwupload_cuda[image],[0:v]scale_npp=format=yuv420p[video],[video][image]overlay_cuda=enable='between(t,30,60)'" -c:v h264_nvenc -c:a copy -y overlay-output-gpu.mp4 Signed-off-by: Jorge Estrada <jestrada.list@gmail.com> Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avfilter/asrc_sinc: fix leak in config_input()Lidong Yan10 days1-7/+11
| | | | | | | | | | | In config_input(), fir_to_phase() allocates memory in h[longer], which would leak if av_calloc() to s->coeffs failed. lpf() allocates memory in h[0] and h[1], which would leak if fir_to_phase() failed. To fix this leak, add av_free(h[longer]) in as cleanup code, and replace return AVERROR* with goto cleanup to prevent from leaks. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter: add pad_cuda filterJorge Estrada12 days5-1/+700
| | | | | | | | | | | This patch adds the pad_cuda video filter. A filter similar to the existing pad filter but accelerated by CUDA. The filter shares the same options as the software pad filter. Example usage: ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -vf "pad_cuda=w=iw+100:h=ih+100:x=-1:y=-1:color=red" out.mp4 Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avfilter/f_select: port to activateMarton Balint12 days1-19/+26
| | | | | | Multi-input or multi-output filters should use activate now. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/buffersink: keep requesting frames if one activation of the graph ↵Marton Balint12 days1-1/+6
| | | | | | | | | | | | | | | | | does not provide one A frame graph activation might not produce a frame in the requested sink, so keep on requesting a frame there unless we encounter a filter activation with buffersrc empty error. This makes av_buffersink_get_frame(_flags) work according to its documentation which claims that EAGAIN is only returned if additional frames must be inserted into the graph. Fate changes are because audio frames will have different sizes at segment boundaries, but content is the same. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter: signal an empty buffersrc with an explicit activate error codeMarton Balint12 days4-3/+9
| | | | | | No change in functionality. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/avfilter: make filter_activate_default request frames on behalf of ↵Marton Balint12 days1-0/+9
| | | | | | | | | | | | | sinks Sinks without an activate callback have no means to request frames in their input, therefore the default activate callback should do it for them. Fixes ticket #11624. Fixes ticket #10988. Fixes ticket #10990. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/avfilter: always forward request frame in filter_activate_defaultMarton Balint12 days1-0/+11
| | | | | | | Even if all inputs are blocked an activate callback should request a frame on some if its inputs if a frame is requested on any of its outputs. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/avfilter: fix forwarding EOF for simple API filters in ↵Marton Balint12 days1-9/+7
| | | | | | | | | | | | | | filter_activate_default EOF only need to be forwarded back if all outputs have reached EOF. Fixes infinte loop with ffprobe -f lavfi -i "smptebars=d=1,select=n=2:e=1[out0][out1]" Regression since d9e41ead82263e96ebd14d4d88d6e7f858dd944c. Fixes ticket #10959. Fixes ticket #11366. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/filters: simplify FF_FILTER_FORWARD_WANTED_ANYMarton Balint12 days1-3/+1
| | | | | | | | The status check is unneeded because an outlink with a nonzero status should always return 0 for ff_outlink_frame_wanted(). Also use unsigned for index because nb_outputs is unsigned as well. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter: factorize requesting an input frame from multi output filtersMarton Balint12 days5-36/+19
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/vf_showinfo: add support for 3D Reference Displays Information side ↵James Almer14 days1-0/+12
| | | | | | data Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/vf_lut3d: fix leak if allocate_3dlut failedLidong Yan2025-06-281-1/+1
| | | | | | | | | In parse_cinespace(), memory allocated in in_prelut[] and out_prelut[] would leak if allocate_3dlut() failed. Replace return ret with goto end to free memory before return error code. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/f_ebur128: properly propagate true peakNiklas Haas2025-06-241-1/+3
| | | | | | | | After 3b26b782ee, `ebur128->true_peak` was only set to the maximum of the current "true peak per frame" values, when it should report the true peak for the entire stream. Fixes: 3b26b782eeded9b9ab7fac013cd1a83a30d68206
* avfilter/codecview: Enable QP visualization for H.264Timothee2025-06-231-2/+3
| | | | | | | | | The codecviewfilter, when used with qp=1, did not display quantization parameter values for H.264 streams because the QP table extraction was restricted to MPEG-2 video. This patch enables H.264 support by updating ff_qp_table_extractto accept AV_VIDEO_ENC_PARAMS_H264. This allows for correct QP overlay on H.264 video Signed-off-by: Timothee <timothee.informatique@regaud-chapuy.fr> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/x86/f_ebur128: replace AVX2 instruction with AVX equivalentJames Almer2025-06-221-1/+1
| | | | | | | Using vpbroadcastq in an AVX function will result in SIGILL errors on pre Haswell/Zen processors. Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/af_aresample: rework activate logic to follow the advised flow more ↵Marton Balint2025-06-211-40/+34
| | | | | | | | | | | | strictly This should prevent the possibility of audio data accumulating. The commit also cleans up and simplifies the code a bit so all frame producers (filter_frame(), flush_frame()) functions follow similar logic as ff_inlink_consume_frame() for the return code. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/af_aresample: make aresample return FFERROR_NOT_READY when no ↵Marton Balint2025-06-211-2/+1
| | | | | | | | progress can be made FF_FILTER_FORWARD_WANTED() already sets the ready status as needed. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/af_aresample: merge request_frame into activate functionMarton Balint2025-06-211-24/+14
| | | | | | No functional change. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/split: consume all frames before forwarding inlink statusMarton Balint2025-06-211-0/+1
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/x86/f_ebur128: implement AVX peak calculationNiklas Haas2025-06-214-8/+31
| | | | Stereo only, for simplicity. Slightly faster than the C code.
* avfilter/f_ebur128: move peak detection to reusable DSP functionNiklas Haas2025-06-212-28/+37
| | | | | True peak and sample peak share almost the same logic. Define this logic in a separate function for reusability, and so we can write SIMD versions.
* avfilter/f_ebur128: move variable declarations to usage siteNiklas Haas2025-06-211-9/+9
| | | | This is actually allowed by non-ancient versions of C.
* avfilter/f_ebur128: lift sample peak calculation out of main loopNiklas Haas2025-06-211-20/+18
| | | | | This is substantially faster (~55%) than the transposed loop, and also avoids an unnecessary macro.
* avfilter/f_ebur128: move true peak calculation out of main loopNiklas Haas2025-06-211-9/+14
| | | | | | | | Easier to read, less convoluted, and ~30% faster. Most importantly, this avoids repeating the redundant recalculation of the true peak on every single sample, by moving the FIND_PEAK() loop out of the main loop. (Note that FIND_PEAK() does not depend on the current sample index at all, so there is no reason for it to ever be recomputed here)
* avfilter/f_ebur128: remove pointless macroNiklas Haas2025-06-211-13/+11
| | | | This macro is not shortening the code nor aiding readability.
* avfilter/x86/f_ebur128: add x86 AVX implementationNiklas Haas2025-06-215-5/+206
| | | | | | | | | | | Processes two channels in parallel, using 128-bit XMM registers. In theory, we could go up to YMM registers to process 4 channels, but this is not a gain except for relatively high channel counts (e.g. 7.1), and also complicates the sample load/store operations considerably. I decided to only add an AVX variant, since the C code is not substantially slower enough to justify a separate function just for ancient CPUs.
* avfilter/f_ebur128: split off C implementation to separate functionNiklas Haas2025-06-212-34/+52
| | | | | I decided to separate out the peak measurement loop to avoid bloating the signature, and since it's only conditionally used.
* avfilter/f_ebur128: move weights and cache to EBUR128DSPContextNiklas Haas2025-06-212-31/+62
|
* avfilter/f_ebur128: use a single packed array for the integrator cacheNiklas Haas2025-06-211-26/+10
| | | | | | | | | | | | | | Instead of having a planar array for each channel, use a single packed array. This will help processing multiple channels in parallel, as we can directly load all channels' data in a single load instruction. Also improves memory locality of data, as the loop order is: for (samples) { for (channels) { process sample } }
* avfilter/f_ebur128: use structs for biquad weightsNiklas Haas2025-06-211-23/+29
| | | | | Simplifies the code a bit. In particular, the copy to the stack is marginally faster.
* avfilter/f_ebur128: simplify sample cache arrayNiklas Haas2025-06-211-18/+11
| | | | | We don't need an X sample cache anymore, and we also can simplify the access macro slightly.
* avfilter/f_ebur128: use transformed direct form IINiklas Haas2025-06-211-7/+5
| | | | | Instead of direct form I. See af_biquads.c for math. Also eliminate an unnecessary indirection.
* avfilter/vf_libplacebo: add `reset_sar` optionNiklas Haas2025-06-201-2/+3
| | | | | | | | | | This was requested by users of `vf_libplacebo`, to mirror the existing option on the other `vf_scale_*` family of filters. While we have `vf_normalize`, it was not as useful in the event that the content stretching was actually desired. Bridges an important usability gap between `vf_scale` and `vf_libplacebo` that made mixing and matching the filters needlessly difficult.
* avfilter/vf_libplacebo: correctly update SAR to reflect scaled resultNiklas Haas2025-06-201-5/+24
| | | | | | | | | | | | | | This aligns the behavior of vf_libplacebo with other filters in the vf_scale family, that forward any change in the SAR as a result of changing the output resolution to the output frame / link, and updates the ff_scale_adjust_dimensions() call to continue working as intended. The new behavior reflects the documentation of vf_libplacebo, which described this behavior despite that not being the way the filter worked up to this point. As an aside, also fixes a bug where the AVFrame SAR was inconsistent with the AVFilterLink SAR when the s->nb_inputs > 1 condition was met.
* avfilter/vf_libplacebo: list AV_PIX_FMT_VULKAN firstNiklas Haas2025-06-201-12/+11
| | | | | | | | | | | | Under normal circumstances, this change does not affect anything, as the vast majority of filters either support only vulkan or only software formats. However, when a filter supports both (such as vf_libplacebo itself, and possibly vf_scale in the future), linking together two such filter instances without an explicit format will default matching the input format, resulting in a redundant round trip through host RAM. This change bumps up AV_PIX_FMT_VULKAN to the first entry in the format list, ensuring that it gets preferred whenever possible.
* avfilter/vf_overlay: Hoist calculations out of loopAndreas Rheinhardt2025-06-171-22/+14
| | | | | | Also use const where appropriate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vf_overlay: Keep dst_step in bytesAndreas Rheinhardt2025-06-171-5/+3
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vf_overlay: Use correct alpha when > 8 bitsAndreas Rheinhardt2025-06-171-6/+11
| | | | | | | | | | | | | | | | When chroma subsampling is in use, the filter averages the corresponding (non subsampled) alpha values to get the actual alpha value. When vertical subsampling is in use, the next line is accessed via a[src->linesize[3]], yet a is an uint16_t* for >8 bit formats and linesize is always in bytes, so that this actually uses the second line below the current one. This is fixed in this commit. No FATE test needed updates, because the filter-overlay-yuv420p10 and filter-overlay-yuv444p10 tests use a yuv420p test file that has constant opacity after conversion to yuva. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vf_overlay: Pass variable type directly in macroAndreas Rheinhardt2025-06-171-16/+16
| | | | | | Improves readability. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vf_overlay: Avoid converting stride to uint16_t and backAndreas Rheinhardt2025-06-171-23/+19
| | | | | | | Just keep the pointers for the beginning of a line uint8_t* and use uint16_t* to do the actual processing. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vf_overlay: Don't perform UB pointer arithmeticAndreas Rheinhardt2025-06-171-6/+10
| | | | | | | | | | | | | | | | | | | | This happens when the pixel format of the output does not have an alpha channel. It leads to FATE failures with the ffmpeg-filter_colorkey, filter-overlay-dvdsub-2397 filter-overlay, filter-overlay_{gbrp_gbrap,nv12,nv21,yuv420,yuv420_yuva420, yuv420p10,yuv422_yuva422,yuv422p10,yuv444_yuva444,yuv444p10} and sub2video tests when using Clang UBSan. Fix this by only performing the pointer arithmetic when it is going to be used. This can be checked via variables that compile-time constants due to inlining, so that the checks are free. Given that the pointer is potentially used as a function argument, the compiler could elide the calculation, but not it can. The size of .text decreased by 1632B with GCC 14 and by 1392B with Clang 19 (both -O3). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vf_libplacebo: Use new vulkan queue APIZhao Zhili2025-06-161-9/+27
| | | | | | Fixes deprecation warning. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avfilter/vf_scale: set correct AVFrame SAR if reset_sar=1Niklas Haas2025-06-161-4/+8
| | | | | | | | | This otherwise generates an inconsistency between the frame state and the link state, since the link state is set to 1:1 explicitly when `reset_sar` is enabled, but this line of code unconditionally overwrote the output frame SAR with the value that would be computed in the absence of `reset_sar`. cf. vf_scale_cuda, which does this correctly
* various: fix typosClément Péron2025-06-151-1/+1
| | | | | | | | usefull -> useful seperately -> separately reciever -> receiver Signed-off-by: Clément Péron <peron.clem@gmail.com>
* avfilter/vf_mcdeint: add yuv444p support to mcdeintEthan Halsall2025-06-141-4/+12
| | | | | Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>