aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter
Commit message (Collapse)AuthorAgeFilesLines
...
* avfilter/filters: simplify FF_FILTER_FORWARD_WANTED_ANYMarton Balint2025-07-031-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 Balint2025-07-035-36/+19
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/vf_showinfo: add support for 3D Reference Displays Information side ↵James Almer2025-07-011-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>
* lavfi/f_sendcmd: clear Command on alloc failureMarvin Scholz2025-06-111-0/+1
| | | | | | | | If the command array failed to allocate, the current parsed Command has to be cleared, else memory allocated for it would be leaked. Fix CID 1638635
* lavfi/f_sendcmd: add helper to clear CommandMarvin Scholz2025-06-111-6/+14
| | | | | Makes clearing the Command more explicit and consistent.
* avfilter/vf_blackdetect_vulkan: fix black region reportingNiklas Haas2025-06-041-8/+22
| | | | | The old logic failed to take into account files that ended on ablack region. The new logic matches the vf_blackdetect behavior.
* avfilter/x86/vf_spp: Remove permutation-specific codeAndreas Rheinhardt2025-05-311-163/+0
| | | | | | | | | | | | | | The MMX requantize functions have the MMX permutation (i.e. FF_IDCT_PERM_SIMPLE) hardcoded and therefore check for the used permutation (namely via a CRC). Yet this is very ugly and could even lead to misdetection; furthermore, since d7246ea9f229db64ed909d7446196128d6f53de0 the permutation used here is de-facto and since bfb28b5ce89f3e950214b67ea95b45e3355c2caf definitely impossible on x64, making this code dead on x64. So remove it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/vf_scdet_vulkan: add new filterNiklas Haas2025-05-283-0/+414
| | | | | | | Carbon copy of vf_scdet. Signed-off-by: Niklas Haas <git@haasn.dev> Sponsored-by: nxtedition
* avfilter/blackdetect_vulkan: add hw accelerated blackdetect filterNiklas Haas2025-05-283-0/+433
| | | | | | | Like vf_blackdetect but better, faster, stronger, harder. Signed-off-by: Niklas Haas <git@haasn.dev> Sponsored-by: nxtedition
* avfilter/vf_blackdetect: add alpha optionNiklas Haas2025-05-281-13/+38
| | | | | | | | Check the alpha plane for (almost) transparent frames, instead of checking the luma channel for almost black frames. Signed-off-by: Niklas Haas <git@haasn.dev> Sponsored-by: nxtedition
* avfilter/vf_gblur_vulkan: omit unnecessary buffer usage flagNiklas Haas2025-05-281-1/+0
| | | | Implied internally now when needed.
* avfilter/vf_libplacebo: add shader_cache optionNiklas Haas2025-05-231-0/+29
| | | | | | | Useful to speed up shader compilation. May significantly lower startup times, in particular with large or complex shaders. Sponsored-by: nxtedition
* avfilter/vf_libplacebo: implement rotation optionNiklas Haas2025-05-232-1/+25
| | | | | | Flipping can already be accomplished by setting the crop_w/h expressions to their negative values, so together these options can implement any of the common frame orientations.
* avfilter/avfiltergraph: fix regression in picking channel layoutPaul B Mahol2025-05-221-2/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/vf_interlace_vulkan: fix FPS and PTS calculationNiklas Haas2025-05-211-1/+9
| | | | | | ol->frame_rate is 0/0, so we need to calcalute the correct value based on the il->frame_rate instead. Also adjust the time base, PTS and frame_duration values accordingly. (Logic taken from vf_tinterlace.c)
* avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx()softworkz2025-05-152-0/+21
| | | | Signed-off-by: softworkz <softworkz@hotmail.com>