1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2026-04-24 04:44:54 +02:00
Commit Graph

12413 Commits

Author SHA1 Message Date
Lynne 5482deeb66 lavfi/scale_vulkan: fix width/height match check
Sponsored-by: Sovereign Tech Fund
2026-03-28 19:36:58 +01:00
James Almer 62f944d594 avfilter/vf_lcevc: add missing pixel formats
Signed-off-by: James Almer <jamrial@gmail.com>
2026-03-27 21:00:53 -03:00
James Almer 1b7483dddd avfilter/vf_lcevc: workaround for unknown initial dimensions
This is not enough as filters down the chain may get wrong dimensions

Signed-off-by: James Almer <jamrial@gmail.com>
2026-03-27 21:00:19 -03:00
Anton Khirnov dba8c62400 lavfi/vf_tiltandshift: stop (ab)using AVFrame.opaque
This filter uses AVFrame.opaque to build a linked list of AVFrames. This
is very wrong, as AVFrame.opaque is intended to store caller's private
data and may not be touched by filters. What's worse, the filter leaks
the opaque values to the outside.

Use an AVFifo instead of a linked list to implement the same logic.
2026-03-27 19:42:08 -03:00
Zhao Zhili fd9f1e9c52 avfilter/vf_drawtext: fix newline rendered as .notdef glyph
GET_UTF8 advances the pointer past the newline byte before the
newline check, so shape_text_hb receives text that includes the
newline character. Since HarfBuzz does not treat U+000A as
default-ignorable, it gets shaped into a .notdef glyph.

Fixes #21565

Reported-by: scriptituk <info@scriptit.uk>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-03-26 07:24:15 +00:00
Niklas Haas 238df21a4f avfilter/vf_libplacebo: early-free unused resources
Otherwise, this will indefinitely persist the last couple of mapped frames
(including any extra decoded frames) in memory, even though they will never be
used again, causing a gradual memory leak until filter uninit.

Signed-off-by: Niklas Haas <git@haasn.dev>
Sponsored-by: nxtedition AB
2026-03-25 17:47:09 +00:00
marcos ashton 9559a6036d libavfilter/vf_v360: fix operator precedence in stereo loop condition
The loop condition in the DEFINE_REMAP macro:

  stereo < 1 + s->out_stereo > STEREO_2D

is parsed by C as:

  (stereo < (1 + s->out_stereo)) > STEREO_2D

Since STEREO_2D is 0 and relational operators return 0 or 1, the
outer comparison against 0 is a no-op for STEREO_2D and STEREO_SBS.
But for STEREO_TB (value 2) the loop runs 3 iterations instead of 2,
producing an out-of-bounds stereo pass.

Add parentheses so the comparison is evaluated first:

  stereo < 1 + (s->out_stereo > STEREO_2D)

This gives 1 iteration for 2D and 2 for any stereo format (SBS or TB),
matching the actual number of stereo views.

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-25 01:19:08 +00:00
Andreas Rheinhardt 76a5d7c545 avfilter/framepool: Mark init, uninit functions as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-24 23:13:00 +00:00
Andreas Rheinhardt c3486e96dd avfilter/framepool: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-24 23:13:00 +00:00
Andreas Rheinhardt e1e2c85537 avfilter/framepool: Use av_unreachable() for unreachable code
Instead of av_assert0(0).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-24 23:13:00 +00:00
Andreas Rheinhardt 1c101330d6 avfilter/framepool: Remove impossible branches
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-24 23:13:00 +00:00
Lynne f40fcf8024 libavfilter/scale_vulkan: do not unnencessarily set s->qf on every frame
The initialization function already does this.

Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:23 +01:00
Lynne 940e407c64 libavfilter/scale_vulkan: use swscale's Vulkan code
This commit enables using swscale's newly added Vulkan code.

Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:17 +01:00
Romain Beauxis 878fb73135 libavfilter/vf_frei0r: use .so suffix for plugins on macOS 2026-03-22 14:27:36 +00:00
stevxiao a077da895b avfilter/dnn_backend_torch: add CUDA/ROCm device support
Add support for CUDA and ROCm (AMD GPU) devices in the LibTorch DNN
backend.

This works for both NVIDIA CUDA and AMD ROCm, as PyTorch exposes ROCm
through the CUDA-compatible API.

Usage:

./ffmpeg -i input.mp4 -vf scale=224:224,format=rgb24,dnn_processing=dnn_backend=torch:model=sr_model_torch.pt:device=cuda output.mp4

Reviewed-by: Guo Yejun <yejun.guo@intel.com>
Signed-off-by: younengxiao <steven.xiao@amd.com>
2026-03-21 16:25:40 +08:00
marcos ashton a43ea8bff7 avfilter/af_pan: fix sscanf() return value checks in parse_channel_name
sscanf() returns EOF (-1) on input failure, which is non-zero and
passes a bare truthy check. When this happens, the %n directive is
never processed, so len stays uninitialized. Using that value to
advance the arg pointer causes an out-of-bounds read and crash.

Check for >= 1 instead, matching the fix applied to the other
sscanf() call in init() by commit b5b6391d64.

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/22451
Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-21 00:44:30 +00:00
stevxiao 7b534c2bdc avfilter/dnn_backend_tf: fix ctx async field access
ctx->options.async does not exist on DnnContext; the correct
field is ctx->async directly on the context struct.

Signed-off-by: younengxiao <steven.xiao@amd.com>
2026-03-20 02:22:06 +00:00
WyattBlue 482395f830 avfilter/af_whisper: Add translate parameter 2026-03-15 06:53:19 +00:00
Lynne c102e89448 hwcontext_vulkan: deprecate AVVulkanDeviceContext.lock/unlock_queue
Without replacement, as VK_KHR_internally_synchronized_queues will be required.
2026-03-14 17:05:06 +00:00
Jun Zhao 795bccdaf5 lavfi/bwdif: fix heap-buffer-overflow with small height videos
Reproduce:
  ffmpeg -i /tmp/bwdif_test_input_160x4_gray16.jpg -vf "bwdif" -f null -

filter_intra accesses rows 3 lines away via cur[mrefs3] and cur[prefs3].
For small height videos (h <= 4), this causes heap-buffer-overflow.

Add boundary check for filter_intra when YADIF_FIELD_END is set.
The boundary condition (y < 3) or (y + 3 >= td->h) precisely matches
filter_intra's 3-line context requirement.

Test file: 160x4 gray16 JPEG
https://code.ffmpeg.org/attachments/db2ace24-bc00-4af6-a53a-5df6b0d51b15

fix #21570

Reviewed-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-03-14 23:26:51 +08:00
Karl Mogensen fa281d1394 avfilter/af_lv2: call lilv_instance_activate before lilv_instance_run
Why: the change is done to comply with lilv expectations of hosts.

Added call lilv_instance_activate in the config_output function to abide by lilv documentation that states it must be called before lilv_instance_run:
"This MUST be called before calling lilv_instance_run()" - documentation source (https://github.com/lv2/lilv/blob/main/include/lilv/lilv.h)

Added call lilv_instance_deactivate in the uninit function to abide by lv2 documentation:
"If a host calls activate(), it MUST call deactivate() at some point in the future" - documentation source (https://gitlab.com/lv2/lv2/-/blob/main/include/lv2/core/lv2.h)

Added instance_activated integer to LV2Context struct to track if instance was activated and only do lilv_instance_deactivate if was activated to abide by lv2 documentation:
"Hosts MUST NOT call deactivate() unless activate() was previously called." - documentation source (https://gitlab.com/lv2/lv2/-/blob/main/include/lv2/core/lv2.h)

Regarding the patcheck warning (possibly constant :instance_activated):
This is a false positive since the struct member is zero-initialized.

Fixes: trac issue #11661 (https://trac.ffmpeg.org/ticket/11661)
Reported-by: Dave Flater
Signed-off-by: Karl Mogensen <karlmogensen0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-13 21:31:54 +01:00
James Almer aa70cd0d19 avfilter/vf_vpp_amf: look for HDR metadata in link side data
This is the correct way to use and propagate this kind of metadata.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-03-13 12:52:57 -03:00
Timo Rothenpieler fb088f224b avfilter/vf_vpp_amf: fix build on non-windows
sscanf and sscanf_s are identical for pure number parsing anyway.
2026-03-11 14:12:26 +01:00
Dmitrii Gershenkop 910000fe59 avfilter/vf_vpp_amf: Extend AMF Color Converter HDR capabilities 2026-03-11 10:23:35 +01:00
Andreas Rheinhardt 2d9cf94283 avfilter/vf_chromanr: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-10 13:52:19 +01:00
Andreas Rheinhardt 380e1cdb0c avfilter/af_afftfilt: Don't get max align multiple times
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-10 13:52:19 +01:00
Andreas Rheinhardt a4efdcaa53 avfilter/af_apsyclip: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-10 13:52:19 +01:00
Andreas Rheinhardt b0839506d7 avfilter/vf_blurdetect: Fix shadowing
Also use smaller scope in general.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-10 13:52:19 +01:00
Andreas Rheinhardt 1bbac3643b avfilter/avf_showspectrum: Avoid allocation
Also fixes an instance of shadowing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-10 13:52:19 +01:00
Andreas Rheinhardt 0992c19c30 avfilter/avf_showspectrum: Fix allocation check
If s->stop is set, the return value would be overwritten
before being checked. This bug was introduced in the switch
to AV_TX in 014ace8f98.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-10 13:52:17 +01:00
Andreas Rheinhardt f6894debc0 avfilter/vf_hqdn3d: Remove unnecessary emms_c()
Added in e995cf1bcc,
yet this filter does not have any dsp function using MMX:
it only has generic x86 assembly, no SIMD at all,
so this emms_c() was always unnecessary.

Reviewed-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-09 19:07:34 +01:00
Michael Niedermayer c1263a3dd9 Bump versions for master after release/8.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-08 02:31:23 +01:00
Michael Niedermayer 67c886222f Bump versions for release/8.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-08 02:29:20 +01:00
Michael Niedermayer 9adced3278 avfilter/vf_scale: Fix integer overflow in config_props()
Fixes: signed integer overflow: 536870944 * 16 cannot be represented in type 'int'
Fixes: #21587

Found-by: HAORAN FANG
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-06 23:09:44 +01:00
Zhao Zhili 6fdbb5a93e avfilter/dnn: fix missing set default value to options
There are two options which use non-zero default value: async and
batch_size of openvino. init_model_ov checks and set batch_size to
one when batch_size is equal to zero, so the only option affected
by missing default value is async. Now async works as expected.
2026-03-06 21:41:11 +08:00
stevxiao ba38fa206e avfilter: update deinterlace_d3d12 filter options name
This commit update deinterlace_d3d12 filter options name.

Currently it follows the options name with "deinterlace_vaapi",
In this commit, it will follow filters such as "yadif" and "w3fdif".

Sample command lines:

1. Software decode with hwupload:

    ffmpeg -init_hw_device d3d12va=d3d12 -i interlaced.ts \
      -vf "format=nv12,hwupload,deinterlace_d3d12=method=default,hwdownload,format=nv12" \
      -c:v libx264 output.mp4

2. Full hardware pipeline:

    ffmpeg -hwaccel d3d12va -hwaccel_output_format d3d12 -i interlaced.ts \
      -vf "deinterlace_d3d12=method=custom:mode=field" \
      -c:v h264_d3d12va output.mp4

Signed-off-by: younengxiao <steven.xiao@amd.com>
2026-03-06 01:45:09 -05:00
Michael Niedermayer e24b9820b4 avfilter/vf_convolution: Handle corner cases with small frames
Fixes: out of array read
Fixes: #YWH-PGM40646-35

Found-by: jpraveenrao
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-06 03:21:37 +01:00
Michael Niedermayer 8970658472 avfilter/vf_convolution: Use avpriv_mirror
Fixes: out of array read
Fixes: #YWH-PGM40646-35

Found-by: jpraveenrao
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-06 03:21:37 +01:00
stevxiao 8429aec5e4 avfilter: add d3d12 deinterlace filter deinterlace_d3d12
This commit introduces a video filter `deinterlace_d3d12` that provides
hardware-accelerated deinterlacing using the D3D12 Video Processor.

The filter supports:
 - bob and custom (motion-adaptive)deinterlace modes
 - frame-rate and field-rate output
 - automatic interlace detection

Sample command lines:

1. Software decode with hwupload:

    ffmpeg -init_hw_device d3d12va=d3d12 -i interlaced.ts \
      -vf "format=nv12,hwupload,deinterlace_d3d12=mode=default,hwdownload,format=nv12" \
      -c:v libx264 output.mp4

2. Full hardware pipeline:

    ffmpeg -hwaccel d3d12va -hwaccel_output_format d3d12 -i interlaced.ts \
      -vf "deinterlace_d3d12=mode=custom:rate=field" \
      -c:v h264_d3d12va output.mp4

Signed-off-by: younengxiao <steven.xiao@amd.com>
2026-03-02 16:59:32 -05:00
Raja-89 27cdf70086 avfilter/dnn: implement asynchronous execution for LibTorch backend
This patch implements the DNNAsyncExecModule for the LibTorch backend,
enabling non-blocking inference using the common infrastructure instead
of custom threading (th_async_module_submit) to align with the
TensorFlow and OpenVINO backends.

The implementation uses ff_dnn_start_inference_async which provides
unified async logic across all DNN backends, eliminating the need for
backend-specific threading code.

Verified with:
  ffmpeg -f lavfi -i testsrc=duration=5:size=320x240:rate=30 -vf dnn_processing=dnn_backend=torch:model=model.pt -y output.mp4

Signed-off-by: Raja Rathour <imraja729@gmail.com>
2026-03-02 21:35:17 +08:00
Weixie Cui 743df5ded9 avfilter/buffersink: use correct enum for alpha_modes
Signed-off-by: Weixie Cui <cuiweixie@gmail.com>
2026-02-28 12:13:02 +00:00
Zhao Zhili 6b949407cb avfilter: use int instead of enum for AVOption fields
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-02-26 11:40:16 +08:00
Andreas Rheinhardt f951aa9ef3 avfilter/af_loudnorm: Avoid unchecked allocation
Also deduplicate printing json and summary output.

Reviewed-by: Kyle Swanson <k@ylo.ph>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-20 20:35:16 +01:00
Lynne 3ba81f2af4 vulkan: drop support for descriptor buffers
Descriptor buffers were a neat attempt at organizing descriptors.
Simple, robust, reliable.

Unfortunately, driver support never caught on, and neither did validation
layer support.

Now they're being replaced by descriptor heaps, which promises to be
the future. We'll see how it goes.
2026-02-19 19:42:31 +01:00
Lynne d616269035 vulkan: don't set FFVulkanDescriptorSetBinding.name when not necessary
It just bloats the code with unused strings.
2026-02-19 19:42:26 +01:00
Lynne ae1a227cf6 Makefile: specify GLSL version via command line arguments
GLSL strictly mandates the version must be the very first non-comment
statement, which results in issues when #including for templating.
2026-02-19 19:42:20 +01:00
nyanmisaka c96b0d94eb scale_vulkan: fix descriptor type for non debayer path
fixup 80229c1

[scale_vulkan @ 0000028b1c2c1300] scale:31: error: 'texture' : no matching overloaded function found
scale:31: error: 'return' : cannot convert return value to function return type

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
2026-02-19 18:41:44 +00:00
Adam Jensen 059c57a83e avfilter/af_loudnorm: add stats_file option
loudnorm provides stats output that's meant to be used for two-pass
normalization. These stats are often interleaved with ffmpeg's stream
descriptions and other output, making them difficult to parse and pass
to the second pass. The new stats_file option enables writing the stats
to a separate file, or to standard output, for simple parsing and other
programmatic usage.

Signed-off-by: Adam Jensen <adam@acj.sh>
2026-02-19 12:48:58 +00:00
James Almer eb36dce742 avfilter/video: reduce potential amount of pool reinitializations
Given we now align both dimensions when allocating buffers, don't reinitialize
the pool when dealing with dimension changes that will not affect the existing
pool size.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-17 20:19:01 -03:00
James Almer 14097ee1cd avfilter/framepool: add a few padding lines by aligning height
Fixes segfaults when handling files with odd chroma subsampled dimensions in
some scenarios like using the hstack filter.

./ffmpeg -lavfi testsrc=s=255x31,format=yuv420p -vframes 1 -y in.jpg && \
./ffmpeg -i in.jpg -i in.jpg -i in.jpg -i in.jpg -filter_complex "xstack=inputs=4:grid=2x2" -y out.png

Fixes issue #21739.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-17 20:19:01 -03:00