1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00
Commit Graph

12471 Commits

Author SHA1 Message Date
Vincent Herbst
2847803bfd avfilter/vf_yadif_videotoolbox: fix over-release of autoreleased Metal objects
call_kernel() obtains the command buffer and compute encoder from
property getters (mtlQueue.commandBuffer, buffer.computeCommandEncoder),
which return autoreleased references under the non-ARC build, and then
releases them via ff_objc_release(). That is an over-release: when the
enclosing autorelease pool is drained, the objects are released a second
time and the process crashes with EXC_BAD_ACCESS in objc_release.

On current macOS this is reproducible with the ffmpeg CLI itself. The
filter thread's thread-local autorelease pool is popped during pthread
TSD cleanup at thread exit, so any run that used yadif_videotoolbox
crashes when the filter thread terminates:

  ffmpeg -init_hw_device videotoolbox=vt -filter_hw_device vt \
    -f lavfi -i testsrc2=size=640x480:rate=30 \
    -vf setfield=tff,format=nv12,hwupload,yadif_videotoolbox,\
  hwdownload,format=nv12 -frames:v 20 -f null -

  Thread 11 Crashed:: vf#0:0
  0 libobjc.A.dylib  objc_release + 16
  1 libobjc.A.dylib  AutoreleasePoolPage::releaseUntil(objc_object**) + 204
  2 libobjc.A.dylib  objc_autoreleasePoolPop + 244
  3 libobjc.A.dylib  objc_tls_direct_base<...>::dtor_(void*) + 156
  4 libsystem_pthread.dylib  _pthread_tsd_cleanup + 620
  5 libsystem_pthread.dylib  _pthread_exit + 84

Host applications hit the same crash earlier, for example when a
dispatch queue drains its last-resort pool after a work item that ran
the filter.

Wrap the kernel invocation in @autoreleasepool and drop the manual
releases, making the pool pop the single balanced release and draining
the Metal transients once per frame. The ff_objc_release() calls on the
s->mtl* members in do_uninit() stay: those hold owned references
obtained from new* methods.

(cherry picked from commit 7f2e5cdd7c)
2026-10-20 02:01:21 +00:00
Timo Rothenpieler
330caae0c1 avfilter/vf_scale_cuda: consider chroma subsampling for scaling decisions
(cherry picked from commit a621ef4291)

Assisted-by: Fairy
2026-09-30 18:30:01 +00:00
Timo Rothenpieler
de8f9b5f27 avfilter/vf_scale_cuda: always have valid passes setup
(cherry picked from commit 4566eee588)

Assisted-by: Fairy
2026-09-30 18:30:01 +00:00
Timo Rothenpieler
39ee21dc9a avfilter/vf_scale_cuda: extract pass determination into its own function
(cherry picked from commit dda8b8253c)

Assisted-by: Fairy
2026-09-30 18:30:01 +00:00
Timo Rothenpieler
c11c663ca5 avfilter/vf_scale_cuda: skip allocating intermediate texture if not needed
(cherry picked from commit 3d7ea1dac4)

Assisted-by: Fairy
2026-09-30 18:30:01 +00:00
Timo Rothenpieler
e657988499 avfilter/vf_scale_cuda: don't try to execute disabled filter passes
(cherry picked from commit 50a9e34e1b)

Assisted-by: Fairy
2026-09-30 18:30:00 +00:00
Timo Rothenpieler
2223115a5a avfilter/vf_convolution: don't assume frame is multiple of 16 pixels wide
Limit the 8-bit column filter to the pixels remaining in the current slice. Pass slice_end - y at all three call sites so both the 8-bit and high-bit-depth column filters receive the correct remaining width. This handles partial 16-pixel blocks at frame and thread-slice boundaries. The non-column callbacks do not use this argument.

Fixes: #YWH-PGM40646-36
(cherry picked from commit 8b9e02cc17)
2026-09-29 20:08:24 +00:00
Michael Niedermayer
a4a6cb1e4a Bump for 8.1.3 2026-09-19 18:28:12 +02:00
Kacper Michajłow
4bca65da83 Revert "lavfi/bwdif: fix heap-buffer-overflow with small height videos"
This reverts commit 5bc4a9898c.

The heap-buffer-overflow was a symptom of the >8 bit boundary
conditions bug fixed in the previous commit. This workaround is no
longer needed.

This restores spatial-only interpolation of the whole frame for the
first and last fields, instead of running the temporal edge filter
against cloned reference frames on the outermost lines. Because of that
first frame references are updated to pre-fix values.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit 3cd408c2a6e5a7de8b6d641dedd12d523b94014c)
2026-09-19 17:01:18 +02:00
Kacper Michajłow
11076bf269 avfilter/vf_bwdif: fix line boundary checks for >8 bits content
The mrefs/prefs boundary conditions scaled the y limits by the number of
bytes per sample, even though the ref offsets are already expressed in
elements. For content deeper than 8 bits this clamped perfectly valid
in-bounds line taps.

Found by validating the libplacebo GPU port against this filter, which
matches exactly on 16-bit content everywhere except these lines.

This changes the output for >8 bit content on the affected lines.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit 7d96c87a7382fed8d571748d6ed5c1869c192c31)
2026-09-19 17:00:37 +02:00
Raja-89
aed52cc81b avfilter/dnn: fix async teardown race condition in all backends
When the filter graph is torn down early (e.g. at EOF with -frames:v),
the main thread calls dnn_free_model and destroys the request queue
while async inference threads may still be running. When a detached
thread finishes and tries to push its result back to the destroyed
queue, it triggers a segmentation fault.

Add ff_dnn_wait_requests() to dnn_backend_common which blocks
until all allocated request items (ctx->nireq) have been safely
returned to the request_queue. Call it from dnn_free_model in the
torch, tensorflow, openvino, and onnx backends before destroying the queue.

(cherry picked from commit b52c71e438)
Co-Authored-by: Fable 5
2026-09-19 16:18:37 +02:00
Michael Niedermayer
e8c2decf6d avfilter/vf_decimate: reject blocks smaller than one chroma sample
Fixes: out of array access
Fixes: division by zero
Fixes: vdfZuLhrGLdR
Found-by: zhang xingxing

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 590fb407b0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:20 +02:00
Michael Niedermayer
61e3f34d46 avfilter/vf_colorconstancy: free only allocated buffers on setup failure
Fixes: invalid free on allocation failure
Fixes: BvbItG8H5bk7
Found-by: zhang xingxing
(cherry picked from commit 432679772a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:15 +02:00
Michael Niedermayer
ef2834a6b4 avfilter/vf_uspp: Fix qpcount
Fixes: division by zero
Fixes: tiny_16x8.h264
Fixes: W9IyRhjCcQxd
Found-by: zhang xingxing

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2c05ce65e1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:14 +02:00
Yongqiang Tian
fc2ead770a avfilter/f_metadata: avoid overread on long formatted output
vsnprintf() returns the number of characters that would have been written
when its output is truncated. Passing that value to avio_write() makes it
read beyond the 128-byte stack buffer for long metadata values.

Use avio_vprintf() to write the complete formatted string without the fixed
intermediate buffer.

Fixes: b0159af6bc
Signed-off-by: Yongqiang Tian <yqtian668@gmail.com>
(cherry picked from commit fd625f452c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:13 +02:00
Ayoub Nabil Boubagrat
6e97011ab7 avfilter/acrossover: reject non-finite parameters
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
(cherry picked from commit 0ba7514f99)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:11 +02:00
Ayoub Nabil Boubagrat
36d3cebf15 avfilter/aiir: reject non-finite parameters
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
(cherry picked from commit 1d49dc80a9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:10 +02:00
Ayoub Nabil Boubagrat
b7a6813b3b avfilter/firequalizer: reject overflowing delays
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
(cherry picked from commit 31e92a56ca)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:10 +02:00
Ayoub Nabil Boubagrat
f5911d012c avfilter/aecho: reject non-finite delays and decays
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
(cherry picked from commit 71f9ea2d84)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:10 +02:00
Hao Chen
e871fdbaaa avfilter/aarch64/vf_bwdif_init: Fix stride bound check
Fix stride condition when bounding w.

Signed-off-by: Hao Chen <haochenc@google.com>
(cherry picked from commit d9ed77cb52)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:09 +02:00
Michael Niedermayer
1312857340 avfilter/spectrumsynth: negotiate one pixel format for both inputs
Fixes: out of array access
Fixes: ndSS0e433gq
Found-by: Eunsoo Kim, Microsoft FORGE Labs
(cherry picked from commit 4d896a22dd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:08 +02:00
Michael Niedermayer
782fd74129 avfilter/afir: bound the crossfades by the samples of the input frame
Fixes: ffmpeg -i tail.wav -i ir.wav -filter_complex "[0][1]afir=dry=1:wet=1:enable='lte(t,0.5)'" -f null -

Fixes: out of array access
Fixes: uQcNui1HxUqe
Regression since: 1835f884b7
Found-by: Eunsoo Kim, Microsoft FORGE Labs

(cherry picked from commit a681001244)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:07 +02:00
iSold Leo
5682173b8b avfilter/af_pan: check the id of named input channels before use
parse_channel_name() only rejects negative values on the named channel
path, while the numbered "c%d" path also checks against MAX_CHANNELS.
av_channel_from_string() accepts UNSD (512), UNK (768) and AMBI (1024),
and the id was then used directly to index used_in_ch[MAX_CHANNELS] on
the stack and pan->gain[out_ch_id][in_ch_id].

Before this change:

  ffmpeg -f lavfi -i "anullsrc=cl=stereo" -af "pan=stereo|FL=AMBI" -f null -
  af_pan.c:214:17: runtime error: index 1024 out of bounds for type 'int[64]'

The first out of bounds access is the read at the "reference twice"
check, so the symptom depends on what happens to be on the stack:
FL=UNK is silently accepted and produces silence, FL=UNSD reports
"Can not reference in channel 512 twice", and FL=AMBI aborts.

The check has to be at the caller and not in parse_channel_name(), which
is shared with the out channel path: there the named id is converted by
av_channel_layout_index_from_channel() into a layout index, so high ids
are legitimately supported and "pan=AMBI|AMBI=FL" works.

AVERROR_PATCHWELCOME is used because these are valid AVChannel values
that af_pan cannot represent: for named input channels the gain matrix is
indexed by the raw id, and the renumbering loop in config_props() is
bounded by MAX_CHANNELS as well, so such a mapping never worked.

The in_ch_id < 0 half is currently unreachable and only kept for symmetry
with the out channel check above.

Regression since 1f96db959c, which dropped
the "channel_id >= MAX_CHANNELS" part of the check when converting to the
new channel layout API.

Reported-by: karnakarreddi
Fixes: #22963
Signed-off-by: iSold Leo <s@qwqlog.com>
(cherry picked from commit f02c4372ed)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:05 +02:00
Dan Dennedy
8e858c0368 scale_d3d11: Fix hw_frame_ctx reference leak
This fixes #20995. The reference is taken twice and assigned to the same pointer (see above in the same function). Only the latter is needed.

(cherry picked from commit 66a8c37582)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:02 +02:00
Michael Niedermayer
0d9eee3680 avfilter/af_arnndn: pad the DCT input buffers to the read length
Fixes: out of array access
Fixes: SUcVEyk7r3Gc
Found-by: Kenan Alghythee <kalghy2@uic.edu>
(cherry picked from commit e38b5d15bd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:27:00 +02:00
Kenan Alghythee
536736a60d avfilter/vf_xpsnr: avoid a zero block size on small frames
Fixes: division by zero
Fixes: SUcVEyk7r3Gc
Found-by: Kenan Alghythee <kalghy2@uic.edu>
(cherry picked from commit 06fd4fd0e7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:59 +02:00
Michael Niedermayer
cc59325592 avfilter/vf_lut3d: do not compute size*size before the size is validated
parse_dat(), parse_cube(), and parse_cinespace() multiply an untrusted LUT size
before allocate_3dlut() validates it, which can overflow int.
Use the validated lutsize2 computed by allocate_3dlut() instead.

Fixes: signed integer overflow
(cherry picked from commit 92cd5c9781)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:58 +02:00
Michael Niedermayer
c8bfe73e26 avfilter/vf_hqdn3d: reject unsupported frame parameter changes
Fixes: out of array access
Fixes: 9aj_hqdn3d_dynamic_res.mjpg / 9aj_generate_hqdn3d_dynamic_res_mjpg.py
Fixes: wWDsy2oDvMuR
Found-by: Adrian Junge (vurlo) <adjun37@gmail.com>
(cherry picked from commit f0f634b658)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:57 +02:00
Michael Niedermayer
6dec9118b5 avfilter/vf_swaprect: size the temp row buffer for the widest plane
Fixes: out of array access
Fixes: 7aj_swaprect_odd17_nv12.nut / 7aj_generate_swaprect_odd17_nv12.py
Fixes: VRAXYvKtmKa8
Found-by: Adrian Junge (vurlo) <adjun37@gmail.com>
(cherry picked from commit a7e38b617b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:56 +02:00
Michael Niedermayer
04fc71debe avfilter/vf_floodfill: remove unneeded variables
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f186c50cf5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:56 +02:00
Michael Niedermayer
41105cc1f6 avfilter/vf_floodfill: size the point stack for the current frame
Fixes: out of array access
Fixes: 8aj_floodfill_dynamic_size.pgm / 8aj_generate_floodfill_dynamic_size_pgm.py
Fixes: 3MleMXjGZvu3
Found-by: Adrian Junge (vurlo) <adjun37@gmail.com>
(cherry picked from commit 24c322fdb2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:56 +02:00
Michael Niedermayer
7b4416dfc7 avfilter/vf_lut3d: compute size2 after the 3DLUTSIZE directive
Fixes: out of array access
Fixes: lut3d_poc/poc_3dlut2.dat
Fixes: 6p0ahHBxreqG
Found-by: SecBuddyF - Tencent KeenLab
(cherry picked from commit 0089694c06)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:56 +02:00
Michael Niedermayer
f00f40ef80 avfilter/vf_v360: keep remap source coordinates in bounds
Two runtime paths could compute out-of-range source coordinates for
degenerate projection geometry, causing heap-buffer-overflow reads

Fixes: out of array read
Fixes: assertion failure
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a73d648f6e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:53 +02:00
Michael Niedermayer
041487e046 avfilter/vf_v360: reject dimensions too small for the projection
Fixes: out of array read
Fixes: assertion failure
Fixes: mQzloVqnivHQ
Found-by: Anthony Hurtado
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b3712addc9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:52 +02:00
Michael Niedermayer
6757c200cd avfilter/vf_quirc: resize the quirc buffers when the input size changes
Fixes: out of array access
Fixes: JbvzNObhorBp
Fixes: 030e140145 (lavfi: add quirc filter)
Found-by: Adrian Junge (vurlo)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4da9812e25)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:50 +02:00
Pavel Kohout
4fd35f8cd2 avfilter/boxblur: reject pixel formats deeper than 16 bits
Fixes: heap buffer overflow
Fixes: CRufFb6TVikL
Fixes: dee7440531 (vf_boxblur: Templatize blur{8,16})
Found-by: Pavel Kohout (Aisle Research)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0dac41d2e5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:49 +02:00
Michael Niedermayer
7b1674a017 avfilter/vf_removelogo: free the whole mask on allocation failure
Found-by: Ao Xijie
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9a01c1cb6a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:48 +02:00
Michael Niedermayer
8046392927 avfilter/af_adeclick: free transform contexts and buffers on error
Found-by: Ao Xijie
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 59a5090070)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:48 +02:00
Jiale Yao
339931f548 avfilter/vf_vif: Fix out of array access with small dimensions
The hand written boundary mirroring reflected an out of range index only
once, which is insufficient when the image dimension is smaller than the
filter half width (filt_w/2 == 8). A 1x1 input made the index reach 8
and -7, reading out of the src[]/temp[] arrays. Use avpriv_mirror(),
which mirrors repeatedly and stays in range for any dimension.

Fixes: out of array access
Fixes: repro.sh
Fixes: HuQn51lLiVJX
Fixes: 38aea9b041 (avfilter: add vif filter)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 56309e476a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:47 +02:00
Zhao Zhili
c573a95381 avfilter/vf_scale_cuda: fix non-scaling format conversion
A format-only conversion leaves the auto use_filters value unresolved.
Regression since 5d0748243f.

Fix issue #23737

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit c57660fb18)

Assisted-by: Fairy
2026-09-16 10:29:49 +00:00
Kacper Michajłow
94138f6973 avfilter/vsrc_gfxcapture_winrt: add missing system_error include
Fixes: error: no type named 'system_error' in namespace 'std'
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit c6498178bb)
2026-07-06 11:09:47 +03:00
Niklas Haas
584952257a avfilter/vf_scale_cuda: fix inverted downscaling check
Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry-picked from commit 6baf561303)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 15:57:01 +02:00
Niklas Haas
1f463e44dc avfilter/vf_scale_cuda: allocate inter buffer with correct subsampling
Since the input and output format can differ (e.g. 444 -> 420), we need to
reference the correct subsampling for the partially applied filter.

Keep track of this in the CUDATex itself.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry-picked from commit 01972b4f85)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 15:56:38 +02:00
Niklas Haas
578c2dbf1d avfilter/vf_scale_cuda: allocate intermediate buffer directly
Instead of going via an AVFrame at all. This will allow us to fix the
intermediate chroma plane size for split downscaling.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry-picked from commit 420a9e90b8)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 15:56:12 +02:00
Niklas Haas
1166148417 avfilter/vf_scale_cuda: use persistent intermediate CUDATex
Instead of re-creating this object every frame.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry-picked from commit e79e9f06ba)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 15:55:48 +02:00
Niklas Haas
b7d139be74 avfilter/vf_scale_cuda: defer buffer allocation to setup_filters()
At this point, s->hwctx and CudaFunctions * are available.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry-picked from commit 4289a29bb0)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 15:55:10 +02:00
Niklas Haas
c69542aa9b avfilter/vf_scale_cuda: introduce CUDATex and mapping helper
I want to disentangle the internal logic from AVFrame, because some
intermediate states (e.g. for partially subsampled chroma with simultaneous
scaling) may not directly map to a valid AVPixelFormat.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry-picked from commit fef976b197)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 15:54:37 +02:00
Niklas Haas
45179413ee avfilter/vf_scale_cuda: add fail: label (cosmetic)
Make the next commit a bit easier to review.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry-picked from commit 61750318db)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 15:54:12 +02:00
Niklas Haas
eac505e3e8 avfilter/vf_scale_cuda: eliminate redundant context push/pop
This is already done by cudascale_filter_frame().

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry-picked from commit 0c3f04a97c)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 15:53:50 +02:00
Diego de Souza
90b5fc8479 avfilter/cuda: support P012/P212 and MSB 4:4:4 in scale/transpose/thumbnail
NVDEC and CUVID now output AV_PIX_FMT_P012 (12-bit 4:2:0), AV_PIX_FMT_P212
(12-bit 4:2:2) and AV_PIX_FMT_YUV444P10MSB / AV_PIX_FMT_YUV444P12MSB
(10/12-bit 4:4:4) for high-bit-depth content, but these CUDA filters
rejected the formats in their supported-format lists, breaking pipelines
such as "-hwaccel cuda ... -vf scale_cuda" on 12-bit input.

These formats use 16-bit sample storage, and the filters select their CUDA
kernel by byte-storage size and plane layout, not by the number of valid
bits, so they can reuse the existing 16-bit kernels:

- scale_cuda: P012/P212 -> "semiplanar16", YUV444P10MSB/YUV444P12MSB ->
  "planar16".
- transpose_cuda: the ushort/ushort2 kernels are chosen from the pixel
  descriptor (byte size + channel count); just allow the new formats.
- thumbnail_cuda: P012 reuses the P010/P016 path and the MSB 4:4:4 formats
  reuse the YUV444P16 path; P012 is added to the 4:2:0 chroma-histogram
  scaling as well. (thumbnail has no 4:2:2 path, so P212 is not added.)

The CUDA deinterlacers (bwdif_cuda, yadif_cuda) already accept any format
with <= 2 bytes per sample and <= 2 channels, so they need no change. The
8-bit-only filters (overlay_cuda, pad_cuda, bilateral_cuda, chromakey_cuda,
colorspace_cuda) do not support high bit depths and are left untouched.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
(cherry-picked from commit df94900c98)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 15:53:21 +02:00