Commit Graph

7684 Commits

Author SHA1 Message Date
Martin Pulec
82ebb9a0aa vulkan_sdl3: remove config*.h includes 2025-04-01 14:02:26 +02:00
Martin Pulec
430573a82b vulkan_sdl3: rewrite the code changed with SDL 3
+ use vulkan_sdl3 if SDL3 is detected by configure.ac
2025-04-01 14:02:26 +02:00
Martin Pulec
6656db1599 copy vulkan_sdl2.cpp to vulkan_sdl3.cpp 2025-04-01 14:02:26 +02:00
Martin Pulec
00e510bbf6 sdl3: set SDL logging if UG LL > INFO 2025-04-01 14:02:26 +02:00
Martin Pulec
87bb9fc8dc sdl3: handle vulkan renderer formats
Aside of the common YUV (YV12,IYUV,NV12,NV12) supports P010, RGBA
(ARGB8888), ARGB2101010 and RGBA64_FLOAT (Linux).
2025-04-01 14:02:25 +02:00
Martin Pulec
c89d9c2c8b sdl3: r10k to argb2101010 - handle by conv
use the new API for conversions

Doesn't seem to be usable, anyways - not supported by opengl/opengles2/gpu
render nor vulkan (but this has SDL_PIXELFORMAT_ABGR2101010).
2025-04-01 14:02:25 +02:00
Martin Pulec
7420a19cc6 sdl3: handle UYVY
Since the UYVY pixel format is no longer handled if the renderer doesn't
support it, handle the conversion manually (gl_renderer doesn't handle
UYVY except of macOS neigher for SDL3 nor SDL2 - but there obviously
some convertion occured implicitly).
2025-04-01 14:02:25 +02:00
Martin Pulec
5715347b23 sdl3: present only pixfmts supported by renderer
otherwise SDL_LockTexture() would fail
2025-04-01 14:02:25 +02:00
Martin Pulec
672958618a sdl3: use RGBX for RGBA
Alpha is almost always unused by UltraGrid so avoid interpreting it as
SDL3 does.
2025-04-01 14:02:24 +02:00
Martin Pulec
040b6a9bf5 sdl3: really rewrite the incomatible sdl2 stuff
+ add to configure.ac
2025-04-01 14:02:21 +02:00
Martin Pulec
00b7c03859 SDL3: use logger prefix SDL3 instead of SDL
Both SDL1 and SDL2 use just "[SDL] ".

But SDL2 may remain default for quite a while so that I'd rather use
"[SDL3] " to discriminate the "flavor" explicitly.
2025-03-31 13:43:04 +02:00
Martin Pulec
890cd02ae1 sdl3: reindent
reindent prior to modifying the code
2025-03-31 13:43:04 +02:00
Martin Pulec
a513c18ae9 sdl3: rename symbols 2->3 2025-03-31 13:43:03 +02:00
Martin Pulec
98921e70b2 copy sdl2.c as a base for sdl3 2025-03-31 13:43:00 +02:00
Martin Pulec
7378bae7c9 unit_evaluate_dbl: fixed err check
arm64 (Apple silicon) needs the comparison with NAN with isnan().

Fixes also failing test misc_test_unit_evaluate on GH macos-14 runner
(arm64 mac),
2025-03-31 12:17:56 +02:00
Martin Pulec
7d52ed0948 get_temp_file: removed debug printf
committed mistakenly
2025-03-31 11:42:35 +02:00
Martin Pulec
f4d94066c8 unit_evaluate: accept binary suffixes
+ test
2025-03-31 09:15:51 +02:00
Martin Pulec
5ed4b72ca4 unit_evaluate[_dbl]: set the endptr unconditionally
Even if no number is parsed, set the endptr. This is consistent with
strtod (and family) behavior.
2025-03-31 09:15:50 +02:00
atrivialatomic
51c9fb71b6 compress/cmpto_j2k.cpp - refactor to implement upstream changes and keep CPU compress working
Moved some interfaces to be inside of the state_video_compress_j2k class rather than outside of it. Still WIP, as additional testing is needed on a system with CUDA.

- Renamed parse_fmt(const char*) to parse_opts(const char*)
- Created more function predeclarations
- Renamed cuda_convert_funct to cmpto_j2k_enc_preprocessor_run_callback_cuda
- Created additional member functions of state_video_compress_j2k struct
    - bool compare_video_desc(const video_desc& video_desc);
    - bool compare_video_desc_and_reconfigure(const video_desc& video_desc);
    - void stop();
    - void try_push_image(std::shared_ptr<video_frame> tx);
    - shared_ptr<video_frame> try_pop_image();
    - bool set_pool(const video_desc& video_desc);

- Added additional struct members to state_video_compress_j2k
    - struct cmpto_j2k_enc_ctx_cfg*     ctx_cfg = nullptr;
    - bool  configured  = false;
    - bool should_exit = false
    - const char*   configuration_opts;

- Commented out functions that have been moved to be internal class methods
    - static void set_pool(struct state_video_compress_j2k *s, bool have_gpu_preprocess);
    - static bool configure_with(struct state_video_compress_j2k *s, struct video_desc desc)
2025-03-28 17:52:41 -04:00
Martin Pulec
3c6e5d5d41 Vk debug_callback: use to compat for ver up to 303
Also eg. distro Vulkan in Ubuntu 22.04 seem to be affected. The change
seem to be introduced with Vulkan headers version 304 (commit d4a196d8).
2025-03-28 15:49:14 +01:00
Martin Pulec
16943b4406 vcap/rtsp: includ H.265 in support list in help 2025-03-28 14:11:01 +01:00
Martin Pulec
2a1deceab8 rtpdec_h264: fixed incorrect address-of taken
Using operator & makes it actually the type uint8_t (*)[2], althoug the
pointer value remained the same. The cast then pruned the type - added
checks before the cast if the value given is really ptr to a char type.

Dropped the HEVC hint - now little-endian uint16_t ptr cannot be passed
by mistake.
2025-03-28 14:11:00 +01:00
Martin Pulec
4ef3f49297 rtpdec_h264: fixed cropping
If cropping_flag is used, from the size the margin was perhaps incorrectly
substracted twice times. Eg. in the example stream from the previous commit
the resolution was not 1920x1080 but 1920x1792 - 8 was substracted twice).
2025-03-28 11:50:57 +01:00
Martin Pulec
707422d291 h264_stream: compat with 444 subsampling
Sync the h264_stream source with [upstream] (commit 70124d30) because
the decoding of 4:4:4 subsampled H.264 video fails. Problematic stream
can be generated with:
```
docker run --rm -it --network=host bluenviron/mediamtx
ffmpeg -re -f lavfi -i smptebars=s=1920x1080 -pix_fmt yuv444p \
     -vcodec libx264 -f rtsp rtsp://localhost:8554/mystream
```

For that the read_seq_parameter_set_rbsp() called on PPS NALU from SDP
(sprop-parameter-sets) gave completly wrong resolution 16x160 - evidently
the header was misinterpreted.

The code is taken mostly unmodified (just internal functions set static
in prototype).  debug_sps() not updated (no longer compiles so commented
out).

[upstream]: https://github.com/aizvorski/h264bitstream
2025-03-28 11:50:37 +01:00
Martin Pulec
e41ab00ac6 parse_mtu: erase '!' before parse_number call
Do not pass number with trailing '!' to parse_number, which would
refuse it.

fixed GH-438
2025-03-28 08:47:47 +01:00
Martin Pulec
90ee52db0e rtpdec_h2645: use common decode_frame function
the handling is mostly the same

+ change MOD_NAME to rtpdec_h2645 (HEVC inclusive)
2025-03-27 13:43:29 +01:00
Martin Pulec
4ced077d94 rtpdec hevc: implement aggregation packets (untested) 2025-03-27 13:43:29 +01:00
Martin Pulec
07715c62e2 rtpdec_hevc: implement FU packets 2025-03-27 13:43:29 +01:00
Martin Pulec
e96314c9f5 HEVC RTP: support for 2 byte HEVC NAL header 2025-03-27 13:43:29 +01:00
Martin Pulec
7464d865e5 rtp hevc: add addition RTP types (aggregate, FU) 2025-03-27 13:43:28 +01:00
Martin Pulec
98d25a17a0 lavd: accept also different NALs for HEVC start
Accept also different NALs than VPS for HEVC decode start - VPS is first
in UG generated HEVC stream but must not be the case always.

Also debug dump the actual NALU names.
2025-03-27 13:43:28 +01:00
Martin Pulec
3134b14c28 rtpdec: add HEVC initial support 2025-03-27 13:43:28 +01:00
Martin Pulec
00ff09f3e0 separate H.264 and HEVC NALU types
Those sets are distinct in general (eg. the types 0-9 seem to be defined
differently for H.264 and HEVC).
2025-03-27 13:43:28 +01:00
Martin Pulec
9c6554851d vcap/rtsp: set frame prop when creating
It is possible that width/height is not yet set but it doesn't matter -
the demuxer sets it when detected.
2025-03-27 13:43:28 +01:00
Martin Pulec
d769384571 vcap/rtsp: parse HEVC metadata from SPS in SDP
HEVC not yet fully working - the actual packet decode needs to be done.
2025-03-27 13:43:27 +01:00
Martin Pulec
3cb0a2c135 vcap/rtsp: do not hard-set H264 decompress codec
We can now have also JPEG and in future HEVC, the .color_spec should
already be set correctly in the video_desc.
2025-03-27 13:43:27 +01:00
Martin Pulec
de410a05bc nal_to_rbsp: return also first byte
In [upstream] of h264_stream.c the iteration is from 0 but the byte is
subsequently consumed so use this variant. This should be idempotent
(aside of a little more instructions performed) but it will be used
also by the HEVC bitstream parser.

[upstream]: https://github.com/aizvorski/h264bitstream
2025-03-27 13:43:27 +01:00
Martin Pulec
8b547de34e rtpdec_h264: remove fill_coded_frame_from_sps()
fill_coded_frame_from_sps() and width_height_from_SDP() are almost the
same, except than different prototype (1st filss W/H of video_frame) and
additional debug message of the second, so keep just the second.
2025-03-27 13:43:27 +01:00
Martin Pulec
c8873da0b8 get_nals: improvements
- statically allocate the string s - 1500 should be available on stack
almost everytime
- use strtok_r (thread-safety)
- strstr -> strchr
- no need to memset s and setting nals[0]='\0'
- fgets - use the whole size of s (fgets reads n-1 bytes so cstr cannot
be truncated)
2025-03-27 13:43:27 +01:00
Martin Pulec
a2d98d5d98 add codec alias "H265"
the H265 can come from rtpmap parsed in RTSP capture
2025-03-27 13:43:24 +01:00
Martin Pulec
9d8ab816e2 vulkan_context: debug_callback compat
compat with old Vulkan as in Debian 11 (still used for ARM builds)
2025-03-27 12:35:07 +01:00
Martin Pulec
e2f0ddc6eb CI ARM: set CFLAGS for 32-bit off_t
The flags queried also for 64-bit ARM but it is empty there.

This does basically the same as the commit f46a101c, that adds
_FILE_OFFSET_BITS=64 define to config.h. But the config.h may not be
always included now.

+ compat/misc: typo in comment + assert 64b off_t (off_t should be
actually 64b in _OFF64 env and >= 64b in _OFFBIG so assert at least 64)
2025-03-27 12:17:34 +01:00
Martin Pulec
59543ca26f configure.ac: pcp has changed pkg-config name 2025-03-27 09:13:25 +01:00
Martin Pulec
167cf0ce53 utils/nat: IWYU 2025-03-27 09:13:25 +01:00
Martin Pulec
b09636241d main: mk fun adjust_ports from adjust_param
Separated adjust_ports() from adjust_params - the stuff is a bit complex
now, so use rather separate function that encapsulates the tweking.
2025-03-27 08:03:40 +01:00
Martin Pulec
159f687c90 respect the selected port if sending over loopback
`uv -t testcard -d gl -P 5004` didn't select the port 5004 until now
2025-03-27 08:03:26 +01:00
Stefan Hueneke
1eb4a96de9 Merge branch 'wip-cmpto-j2k-cpu' into wip-cmpto-j2k-cpu-merge-check 2025-03-26 14:27:58 -04:00
Martin Pulec
5d3c9f9e06 vcomp/lavc: accept no_intra_refresh
and no_interlaced_dct

The original option names are prefixed with disable_ to disable. But if
user (mistakenly) uses "no_XY", it actually did the opposite. So rewrite
the condition to accept both variants for now. The "no_" prefix may be
more natural and it might be switched to in future.

Also accept "no_header_inserter" aside the original "header_inserter=no"
- the original syntax is inconsistent with the other options above - this
could be unified later.

+ removed duplicite line
2025-03-26 15:32:55 +01:00
Martin Pulec
4caf732be1 rtp.h: do not include config_*.h 2025-03-26 11:06:46 +01:00
Martin Pulec
393fd8a415 utils/local_buard,resource_manager: IWYU 2025-03-25 13:13:30 +01:00