Commit Graph

7684 Commits

Author SHA1 Message Date
Martin Pulec
4820b4d2f8 vc_copylineVUYAtoRGB fix
BPP(RGB) = 3
2025-06-26 11:13:34 +02:00
Martin Pulec
7aa204d574 from_lavc_pf_priority: fine-grain selection
If there is no direct conversion from a AV PF compatible with internal
format, penalize a bit.

This may be mostly unneeded but just in case. It can be safely reverted,
anyways.
2025-06-26 11:13:34 +02:00
Martin Pulec
647d8627c4 from_lavc_pf_priority: get supported pf from convs
Assume that the output pixel format (ugc) is supported if there is at
least one conversion. This may not be optimal but it is just as it was
until now, we just remove the hard coded list.

Effectively this is just a refactor, except:
- VDEC_PRIO_NOT_PREFERRED now not returned if internal.rgb !=
codec_is_rgb(ugc) - doesn't seem relevant, because the codec is already
probed and ugc determined. So any alternative decompress will need to do
the conversion as well.
2025-06-26 11:13:34 +02:00
Martin Pulec
fcdb58e669 vdec/lavc: get_priority - delegate to from_lavc
Since the pixfmt conversion is responsibility of from_lavc conversion,
delegate the get_priority query there (after we know that we can decode
codec).
2025-06-26 11:13:34 +02:00
Martin Pulec
22ec0a903f sdl1: do not register q to keycontrol
In order not to be pressed by accident - other SW displays disable 'q'
as well.

Also, the call was incorrect - the message with the key would receive
root module because the first argument is the receiver of the key event,
which should be the sdl display mod. Also the events were not handled in
check_message event.
2025-06-26 11:13:06 +02:00
Martin Pulec
466de28481 audio_decodes: get correct ptr to control_socket
->priv_data now must be used (see also the commit ab5d2a5c from 2025-06-17)
2025-06-26 10:32:23 +02:00
Martin Pulec
86a53f9c1d pixfmt_conv: additional convs from YUVA 2025-06-25 14:09:26 +02:00
Martin Pulec
4fad1e7bad module: reference count modules in tree
- module is now removed when reach ref=0
- childer now hold reference to parent

As a consequence, if parent is (mistakenly) removed before child, the
poiner to it doesn't need to be erased, which is bug-prone (other thread
might have already retrieved the parent pointer).
2025-06-25 14:09:26 +02:00
Martin Pulec
c218188108 module: separate del_ref from module_done
now mostly the refactor but del_ref logic will be implemented later
2025-06-25 14:09:26 +02:00
Martin Pulec
90168ab5de module: add lock assumption to doxy 2025-06-25 14:09:26 +02:00
Martin Pulec
f6f313cdc9 module_mutex_lock: detect dead-locks 2025-06-25 14:09:22 +02:00
Martin Pulec
b9487faa3f add vc_copylineVUYAtoY416
This allows indirect conversion of 8-bit YUV 4:4:4 at least to Y416 for
displays that do not support VUYA directly over VUYA. Previously, due
to limited set of conversions from yuv444p and to Y416 it was UYVY, which
decimated the subsampling to 4:2:2.
2025-06-24 16:45:50 +02:00
Martin Pulec
f7a1504916 vulkan: locate shaders in srcdir
If running from inside out-of-tree build, the shaders were not located -
now look them up in srcdir (if the the formerly looked shader directory
doesn't exist).
2025-06-24 16:45:20 +02:00
Martin Pulec
fb15e67b15 lavc/utils.c: IWYU 2025-06-24 11:52:09 +02:00
Martin Pulec
4a0714a1b8 lavc,v4l2: add mappings fro VUYA 2025-06-24 11:51:55 +02:00
Martin Pulec
e4d896e90e from_lavc_vid_conv: add conv YCbCr 444->VUYA
When supported by the display, this eliminates the conversion eg. to
Y416 for video display because UYVY or v210 are 4:2:2. But the conversion
went over UYVY anyways (there was no conv from Y444 keeping subsampling), eg:
`$ uv -t testcard:c=vuya -d gl`
was originally:
```
./src/libavcodec/from_lavc_vid_conv.c: selected conversion from yuv444p to Y416 with UYVY intermediate.
```

now VUYA is selected
2025-06-24 10:30:12 +02:00
Martin Pulec
d41ad414f2 added VUYA
support for:
- base (types.h + metadata in video_codec.c)
- testcard (vc_copylineRGBAtoAYUV conversion)
- GL

usage eg. `uv -t testcard:c=vuya -d gl`
2025-06-24 10:30:10 +02:00
Martin Pulec
007af148d7 is_codec_opaque: assert != VC_NONE
to avoid unintended change in behavior because the behavior for VC_NONE
has changed

It should perhaps not be called on VC_NONE but if so, we should perhaps
catch and investigate that.
2025-06-24 08:42:48 +02:00
Martin Pulec
ea923fee8b video_codec: fix desc of block_size_pixels 2025-06-24 08:42:48 +02:00
Martin Pulec
a7a56027ec video_codec: IWYU 2025-06-24 08:42:47 +02:00
Martin Pulec
cc336eb38d main: --cuda-devices help suppress err
avoid printing 'Input number help contains non-numeric symbols!' (missing
return)
2025-06-24 08:42:47 +02:00
Martin Pulec
0302f58e45 video_codec: replace bitfields with flags
somehow more readable - the flag may be also searched directly

PRORES has set interframe=TRUE, perhaps irrelevant - not preserved

+ fix warning (0.0->0 conversion for block_size_pixels)
2025-06-24 08:42:47 +02:00
Martin Pulec
333dbc6b00 video_codec: subsampling - use enum values 2025-06-24 08:42:47 +02:00
Martin Pulec
3a32fdf739 video_codec: replace opaque flag with subsampling
almost everytime when opaque=TRUE, the subsampling is 0

An exception was VDPAU which has set both opaque=1 and subsampling=4440
but it seem that the subsampling doesn't need to be necessarily set.

Also for VC_NONE is_codec_opaque() returns newly true (VC_OPAQUE=0).
2025-06-24 08:42:47 +02:00
Martin Pulec
bfdb477476 get_av_to_uv_conversion_int: avoid NULL dereference
Avoid NULL pointer dereference for VERBOSE msg - in that case SWS fallback
can be used but if --verbose passed, UG crashes on nullptr dereference.
2025-06-24 08:39:59 +02:00
Martin Pulec
1b719d78cc deltacast_common: fix Windows warning 2025-06-20 14:59:19 +02:00
Martin Pulec
a6f255f114 vdisp/sdl2: fix clang align warning 2025-06-20 14:59:19 +02:00
Martin Pulec
03b3a87dda pam/y4m: fix Windows warning 2025-06-20 14:59:19 +02:00
Martin Pulec
29063abc6d control_socket: suppress Windows warning
winsock2.h (include from utils/net.h) should be included prior to
windows.h, otherwise windows.h includes winsock.h (version 1), that
is incompatible. WIN32_LEAN_AND_MEAN causes some headers not being
included with windows.h (including winsock.h).
2025-06-20 14:59:19 +02:00
Martin Pulec
59b91938be vcomp/lavc: don't blacklist x2rgb for qsv
Seems to work correctly now (aside that it converted to BT.601 by the
device, not BT.709, which is an outstanding issue with RGB formats passed
to QSV).
2025-06-20 14:59:17 +02:00
Martin Pulec
5f7436b213 pixfmt_conv: fix vc_copyliner10ktoY416
broken since the commit 4fe65769f from 2024-09-17
2025-06-20 14:59:17 +02:00
Martin Pulec
42134848a6 to_lavc_vid_conv: set uv_to_av metadata later
Set the metadata for parallel conversion later - av_frame_make_writable()
may actually alter that (at least pointer but perhaps also linesize), those
old values might have been invalidated by that lavc call.
2025-06-20 14:59:17 +02:00
Martin Pulec
71cf598216 vcomp/lavc: hint for "old" nvenc behavior
(see previous commits)
2025-06-19 13:44:46 +02:00
Martin Pulec
8940b44eb7 vcomp/lavc: nvenc: don't set rc_buffer_size if not intra-refresh 2025-06-19 09:09:45 +02:00
Martin Pulec
40dd353465 vcomp/lavc: nvenc no intra-refresh for HEVC/AV1
Since the pulsation issue, it was not much usable, anyways and this
clean-ups the code a bit.

Also the behavior will be now more deterministic - it behaved differently
with patched FFmpeg (most likely GH Linux builds), othewrise differntly.

+ enable the header-inserter if user expliclty requesetd intra-refresh

refers to GH-114
2025-06-19 09:09:44 +02:00
Martin Pulec
abd7ae96fd vcomp/lavc: h264_nvenc: fix pulsation w intra-refr
Avoid pulsation with inra-refresh by repeating the missing SPS/PPS with
header inseter.

Unfortunately this is doesn't work well with HEVC because it seems that
the NVIDIA encoder keeps the reference almost forever in specific cases,
eg. `testcard:patt=text`. However, it _may_ work under some circumstances.
2025-06-19 09:08:32 +02:00
Martin Pulec
976e9ef2e7 vcomp/lavc: fix init fail
Due to recent changes, libavcodec initialization fails because trying
to register the lavc module prior to vcomp.

This crashes due to the recent changes but it has been a dark zone so far.

Initialize the vcomp module correctly prior to the lavc.

+ add assert to module_register that would catch this problem
2025-06-18 12:10:03 +02:00
Martin Pulec
9ac2c6b33a vdisp/gl: hint for fullhelp (options)
to make sure that there are more
2025-06-18 11:18:22 +02:00
Martin Pulec
6f07112744 vdisp/gl: fix CID 481468
a null-pointer dereference if "fullhelp" isn't first option
2025-06-18 10:50:52 +02:00
Martin Pulec
f66647cef6 module: zero priv_data instead of cls
to allow multiple calls of module_done to same state (as keyboard_control
is called).

otherwise dump-tree would fail

This acutally revers the commit 33bdcb48 (2020-03-13).
2025-06-18 09:30:24 +02:00
Martin Pulec
ee993d3dbd module: module_class_name handle nfound
+ refactor a bit (early return if nfond, use ARR_COUNT)
+ make module_class_name_pairs const to make clang_tidy happy
2025-06-18 09:30:23 +02:00
Martin Pulec
d8a45610a7 module: do not depend on storage provided by caller
The caller might have deleted the state without calling module_done and
then the dangling pointer is referenced.
2025-06-18 09:00:01 +02:00
Martin Pulec
ab5d2a5cac control_socket acquire: get the pointer from priv_data
Do not assume that (struct module) is first in the (struct control_state)
anymore in particular and in any structure in general.
2025-06-18 08:49:44 +02:00
Martin Pulec
cda3d1b860 control_socket.cpp: IWYU 2025-06-18 08:49:44 +02:00
Martin Pulec
5c103173b1 control_socket: add magic + asserts 2025-06-18 08:49:44 +02:00
Martin Pulec
69a4a4ab2d module.name: use fixed-size string
Unsure if the name is really needed except the hd-rum-translator where it
may not need to store this in module - removing that may be considered as
it simplifies the code (added with commit c1b0bd8f2).
2025-06-18 08:49:27 +02:00
Martin Pulec
b4aed788ca module: move private data to separate structure 2025-06-17 12:35:41 +02:00
Martin Pulec
e3fefce85a module_register: early return (refactor) 2025-06-17 12:35:41 +02:00
Martin Pulec
e86209a558 module: remove CAST_MODULE
as module.deleter no longer exist, this should not be required
2025-06-17 12:35:41 +02:00
Martin Pulec
a1f3e08ad4 remove module.priv_data to simplify
seldom used and the modules can keep their 'magic' by themselves
2025-06-17 12:35:41 +02:00