Commit Graph

8376 Commits

Author SHA1 Message Date
Martin Pulec
2f145378ef vcomp/lavc: prefer libvpx-vp9 for VP9
It doesn't seem that libsvt_vp9 is better even for AVX2+ processors.

From testing with i9-9820X and 9950X with `testcard2:noise:fps=200` we got
60 FPS for SVT and 72 for VPX in case of Intel and 153 and 128 for AMD.
In the SVT case, the frame was significatly (250 framees) delaysed with
default setting.

Also, while libsvt_vp9 supports just yuv420p, libvpx-vp9 offers up to
12 bit 4:4:4 subsampled both YUV and RGB pixel formats.

For the record, there has been a [patch](https://github.com/OpenVisualCloud/SVT-VP9/pull/67)
for libsvt_vp9 to support pre-AVX2, but it doesn't seem to make much sense
to use.
2026-03-11 10:34:39 +01:00
Martin Pulec
1f9e6d4050 vcomp/lavc: fix default VP9 encoder for non-avx2
the default - libsvt_vp9 - requires AVX2 instructions so if not present,
use the fallback.

broken by some weird mistake since the commit ff3e34ef (24th Oct 2025)
2026-03-10 16:43:59 +01:00
Martin Pulec
5fb266f6d5 remove unused video_rxtx_loader 2026-03-10 16:43:59 +01:00
Martin Pulec
388e87e847 video_capture API: const struct to init
the init should accept rather the ptr to  const struct with init params
2026-03-10 16:43:59 +01:00
Martin Pulec
81930ee494 vcap/switcher: early return 2026-03-10 16:43:58 +01:00
Martin Piatka
df1062132f capture/pipewire: Workaround for frames marked as non-readable
On Arch with wlroots-git, sway-git and nvidia 595.45.04 data buffers are not marked as SPA_DATA_FLAG_READABLE for some reason and PW mmaps them with no read access leading to segfaults.
2026-03-10 15:46:32 +01:00
Martin Piatka
d94b8231dd disp/pano_gl: Small code quality improvements 2026-03-10 13:07:10 +01:00
Martin Piatka
aab39bc036 display/pano_gl: Remove config includes 2026-03-10 12:32:33 +01:00
Martin Piatka
1e2f562d60 display/openxr_gl: Remove config includes 2026-03-10 12:32:23 +01:00
Martin Piatka
14e55bd8da capture/bitflow: Remove config includes 2026-03-10 12:29:53 +01:00
Martin Pulec
ef0840bcdc vdec/jpegxs: zero-init svt_jpeg_xs_bitstream_buffer_t
maybe not 100% required but it is a good practice

fixes CID 900815
2026-03-10 08:39:52 +01:00
Martin Pulec
deae5df22d vcomp/jpegxs: process the poison pill outside loop
Move processing outside to the main jpegxs_worker_send() loop to make
it shorter. One level of indention removed as a consequence.
2026-03-09 15:46:57 +01:00
Martin Pulec
44302a925c vcomp/jpegxs: improvements
- check return value of send_picture for poison pill or reconfigure msg
- if configure fails, continue, do not break - not sure if useful but it
may be able to continue further (user can interrupt, anyways). At least
not it could be terminated gracefully, when the thread is terminated it
won't (maybe then either abort or exit_uv will be more proper)
- warn if bitrate is lower than 7.5 Mbps - for getting packet we then
receive SvtJxsErrorEncodeFrameError
2026-03-09 15:15:23 +01:00
Martin Pulec
a46e711714 vcomp/jpegxs: simplify synchronization
Avoid counting frames for the consumer and instead pass a reconfigure message
and then wait for configured_consumer=false (with corresponding _cv).

Also removed the `configured` variable and set cleanup() to be idempotent.
2026-03-09 15:15:18 +01:00
Martin Pulec
572f2352ac vcomp/jpegxs: simplify producer reconf
- the actual configuration can be run once, with waiting for the consumer
thread if we are configured
- saved_desc can be just for the thread
2026-03-09 12:31:39 +01:00
Martin Pulec
2c354775da vcomp/jpegxs: small changes
- reenabloe bpp with decimal point after check for validity added
- change default bpp to 3/2 - it might be better suitable, eg. with
testcard:m=VGA there are observable artifacts with 0.7 but disappear with 1.5
2026-03-09 12:31:28 +01:00
Martin Pulec
15812d8c8f vcomp/jpegxs: when send fail, release the buffer
The error triggered <https://github.com/CESNET/UltraGrid/issues/492>
causes freeze on svt_jpeg_xs_frame_pool_get().

It doesn't work, anyways - perhaps incorrect handling in SVT-JPEG-XS. At least
when `enc_input.image.ready_to_release` is not set to 1, current impl of
svt_jpeg_xs_frame_pool_release() doesn't release anything. But even if
set to 1, it still doesn't help.

So at least fixing our use and hopefully it will get also fixed
upstram. This shouldn't happen, anyways, unless passwdd wrong parameters
as in the #492.
2026-03-09 11:52:15 +01:00
Martin Pulec
50c60f56bb jpegxs: print errors symbolic names
eg.:
```
[SVT JXS] Failed to send frame to encoder: 0x80001005 (SvtJxsErrorBadParameter)
````
(the value in parenthesis)
2026-03-09 11:52:15 +01:00
Martin Pulec
1041bf4b3f jpegxs_worker_send: fix misleading indention
only a refactor
2026-03-09 11:52:10 +01:00
Martin Pulec
1e30d6da46 vcomp/jpegx: fix setting bitrate
regressiong from fc0df372f

fixes <https://github.com/CESNET/UltraGrid/issues/492>
2026-03-09 09:19:18 +01:00
Martin Pulec
d9a8ea322a vcomp/jpegxs: bpp/bitrate - check trailing chars
This avoids error like swapping bpp and bitrate and using bpp=100M
or bitrate=2/3.
2026-03-09 08:41:40 +01:00
Martin Pulec
d5e6e3629a hd-rum-translator: add new_message callback
if no data is comming, the messages are not dispatched

Maybe not a big problem, it would be dispatched when some data arives. The
potential problem, however, can be if added huge number of participants
at that time, the queue may overflow and further message dropped. (Current
max queue len is 10 - maybe it can be extended later.)
2026-03-06 16:21:08 +01:00
Martin Piatka
930bc29832 disp/vulkan_sdl2: Remove config includes 2026-03-06 13:40:12 +01:00
Martin Piatka
d75aa81263 Remove rtp/ptime
Never used throughout the whole git history + the only function declared in header is not defined
2026-03-06 13:35:41 +01:00
Martin Piatka
909e3f0e51 compat/vsnprintf: Remove config includes 2026-03-06 12:20:28 +01:00
Martin Pulec
8c4c0192d1 from_planar: make it more pretty
porting improvements from to_planar
2026-03-05 15:49:40 +01:00
Martin Pulec
20d6b5bb2a to_jpegxs_conv: run conversion from R12L parallel
The conversions from/to R12L might take 10-15 ms for 4K frame so make
it run parallel. This will slightly increase the latency and also allows
4K @60 R10L video encode on slower machines (shouldn't be much issue with
current CPU).
2026-03-05 15:49:40 +01:00
Martin Pulec
7155dd92df to_planar: add decode_to_planar_parallel
for parallel processing decode_buffer_func_t funcs
2026-03-05 15:49:40 +01:00
Martin Pulec
2d0afcad84 vcomp/jpegxs: help improves
- fix desc of threads (default now is nr of cores)
- hide pool_size - should not be needed otherwise by the user
2026-03-05 15:49:40 +01:00
Martin Pulec
60a23d31ba vcomp/jpegxs: set default pool size to 2
The value 2 should be sufficient - one as output buffer for video
conversion while the other being encoded. The original value 5 just
caused slower propagation of insufficient performance while increasing
the latency by 3 more frames.
2026-03-05 15:49:39 +01:00
Martin Pulec
fc0df372f6 vcomp/jpegxs: reduce default BPP=7/10
the value 3 seems to be very large as a default value

If the user omits the setting, it easily exceeeds 1 Gbps for
2160p60. Equivalent for JPEG Q=75 might be something like 0.5-0.7 so
using the upper bound.
2026-03-05 15:49:39 +01:00
Martin Pulec
113758e876 vcomp/jpegxs: set in_queue size 1
I don't see any particular advantage of having the size more than 1.
2026-03-05 15:49:39 +01:00
Martin Pulec
3b41cf2e93 vcomp/jpegxs: allow decimal number for bpp
allow eg. 0.5 in addtition to 2 or 3/4
2026-03-05 15:49:39 +01:00
Martin Pulec
b22631aa5a vcomp/jpegxs: print used bitrate + bpp 2026-03-05 15:49:39 +01:00
Martin Pulec
af317dcc35 vcomp/jpegxs: prevent race condition to dead-lock
Blocking svt_jpeg_xs_frame_pool_get is called with s->mtx held. If
there is no currently available buffer, it causes a dead-lock because
the consumer stops on wait on the lock.

Possible to reproduce (perhaps sometimes) with eg.
`-t testcard:patt=noise:size=3840x2160:fps=100:c=R12L` with the bitrate
exceeding egress iface speed when exitting.

Also removed a lock guarding nothing in _done - maybe it was kept there
to ensure the lock is lockable? If so, it is incorrect, anyways.
2026-03-05 15:49:36 +01:00
Martin Piatka
35d0f6df08 disp/dvs: Remove config includes 2026-03-05 15:16:15 +01:00
Martin Piatka
f1155e77d0 disp/sage: Remove config includes 2026-03-05 15:16:15 +01:00
Martin Piatka
8b3cc25e34 bluefish444: Remove config includes 2026-03-05 15:16:15 +01:00
Martin Piatka
2ab92aa3cb capture/gpustitch: Code quality improvements 2026-03-05 15:16:15 +01:00
Martin Piatka
c2900baee0 capture/gpustitch: Add missing zero initializers 2026-03-05 15:16:15 +01:00
Martin Piatka
1f06d7b97d capture/gpustitch: Remove config includes 2026-03-05 15:16:15 +01:00
Martin Pulec
0e846d57a6 from_planar: int for width/height
The change to unsigned is rather new and it may be safer actually to
use int (to_planar already uses that) - eg. in the constructiosn where
iterating over multiple lines and then computing the rest, if there is
less than so that we do not wraparound to `UINT_MAX - something`.
2026-03-04 09:04:52 +01:00
Martin Pulec
1c33a5bc34 to_planar: small changes
- uyvy_to_nv12: move width before the loop (clang is complaining)
- r12l_to_gbrpXXle: drop ALWAYS_INLINE+OPTIMIZED_FOR - for GCC/Intel we
get the same performance but for Clang/M1 it is something like 15 % faster
(eg. keeping OPTIMIZED_FOR without ALWAYS_INLINE worsens the performance
on other hand)

except r12l_to_gbrpXXle and derived, we don't have now a benchmark for
2026-03-04 09:04:52 +01:00
Martin Pulec
2c7bacb65d to_planar: switch to api with data struct 2026-03-04 09:04:52 +01:00
Martin Pulec
f5f3274f51 conversions: remove BYTE_SWAP
The initial use was incorrect - it assumed that on big endian, the bytes
b0,b1,b2,b3 need to be swapped so value b[0] would be what was b[3]
on little-endian which is not true (writting bytes)

This mistake has then spread across UltraGrid.
2026-03-04 09:04:52 +01:00
Martin Pulec
a22bc8f7e9 moved to_planar conversion from pixfmt_conv
this follows the recent similar change for from_planar
2026-03-04 09:04:52 +01:00
Martin Pulec
3aab9e93ab vcomp/cmpto_j2k: do not use else branch after if-return
+ unlock before notify_one
2026-03-04 09:04:52 +01:00
Martin Pulec
06e8278ca8 vcomp/cmpto_j2k: return vcomp_pop_retry
instead of using goto to make the stuff simpler
2026-03-04 09:04:52 +01:00
Martin Pulec
bb95d964fe vcomp/jpegxs: release the bufs in case of error
otherwise we the limited number of buffers can exhaust
2026-03-04 09:04:51 +01:00
Martin Pulec
1e750c5540 vcomp/jpegxs: uses tile API, not frame
The compression compresses just one tile so mark it as using tile API,
not frame API.

The multi-tile frames are seldom, anyways (stereoscopic 3D etc).
2026-03-04 09:04:51 +01:00