Commit Graph

239 Commits

Author SHA1 Message Date
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
bd353297ea from_lavc_vid_conv.c: mark one conversion as 02
(faster)
2026-02-27 16:07:15 +01:00
Martin Pulec
eeaea93bf6 vdec/jpegxs: allow decoding 10-bit Y444 to UYVY
This should be the last compat needed (in respect to the encoder producing
4:2:0 only in 8-bit - lavc encoder is not considered but it will likely
work just with encoded UYVY, anyways).
2026-02-27 09:20:56 +01:00
Martin Pulec
5a8df005a6 vdec/jpegxs: compat for 420 decode to UYVY
this may be quite useful because very few displays (if any) support I420
2026-02-27 09:20:56 +01:00
Martin Pulec
0609a7c43b similar for the previous but decodig >8 b to RGB 2026-02-27 09:20:55 +01:00
Martin Pulec
8c08ba7ad9 vdec/jpegxs: move also remaining convs to from_planar
(not all shared with from_lavc - to_i420 and to_yuyv is used just
for jpegxs)
2026-02-27 09:20:54 +01:00
Martin Pulec
9a997e6d00 from_lavc_vid_conv: use planar convs directly
without wrapping them with a function
2026-02-27 09:20:54 +01:00
Martin Pulec
6fef4f4f1d from_lavc_vid_conc: refactor a bit
store the ptr to the metadata instead just the av_to_uv conversion ptr

this will allow further modifications
2026-02-27 09:20:54 +01:00
Martin Pulec
cbc89b3695 from_planar: refactor to take params in struct
as it is in from_lavc_vid_conv - for better interoperation (likely mostly
one-way - porting from from_lavc_vid_conv)
2026-02-27 09:20:51 +01:00
Martin Pulec
7cd99c6a68 moved from planar conversions from pixfmt_conv
removed all ad hoc optimizations:
- -Ofast - removed by context (pixfmt_conv compiles with), _but_ see
previous commit - even in pixfmt_conv it was not actually used
- remove ALWAYS_INLINE + OPTIMIZED_FOR - from measurements it doesn't
seem to make some difference
2026-02-25 16:52:43 +01:00
Martin Pulec
d95c5bf7bc from_lavc_vid_conv: factor out some conversions 2026-02-25 16:52:41 +01:00
Martin Pulec
7cd9cfb13e mv gbrp1{2,6}le_to_r12l from lavc to pifmt_conv
for generic use, should be just a refactor

testted with:
`uv -t testcard:c=R12L -c lavc:e=libx265 -p change_pixfmt:RGBA -d gl`
(`change_pixfmt` required to allow decode to R12L, which GL does not
natively support)
2026-02-20 15:24:06 +01:00
Martin Pulec
4136c26319 mv r12l_to_gbrp1{2,6}le from lavc to pixfmt_conv
to be able to used also in different places

+ use compat/endian.h (POSIX) macros in BYTE_SWAP
2026-02-20 15:24:06 +01:00
Martin Pulec
fee03948d5 vdec/lavd: reenable CFHD decoder
removed unintentionally by the commit 7dd9a441 (2025-10-03)

as a consequence, this commit also allows CFHD encoder over vcap/lavc
2026-02-18 10:12:02 +01:00
Martin Pulec
9e5cb700b2 vcomp/lavc: support JXS 2026-02-17 16:50:43 +01:00
Martin Pulec
84f560b97f move countof() def from macros.h to compat/c23.h
technically it will be C2Y but the c23.h can be perhaps used for both

in c++, std::size() is rather used

This fixes compilation of pano_gl, where its implementation
of countof clashes with the macro (leaked through
debug.h->color_out.h->utils/macros.h, which no longer contains that
define).
2026-01-20 11:10:06 +01:00
Martin Pulec
b71b9231c1 from_lavc_pf_priority: do not advertise HW_VDPAU
This is handled differently and may trigger unexpected decode to HW_VDPAU
if gl display advertises that, eg. `uv -t testcard -c lavc:c=MJPG -d gl`.

This fixes the commit 647d8627 (2025-06-25) that unintentionally
enabled that.

The HW accel is hanndled actually separately ahd snouldn't be "enabled"
in this way.
2026-01-13 16:50:27 +01:00
Martin Pulec
258ef5406e replace ARR_COUNT with countof
see also recent commit 951f9648

countof seem to be upcoming C2Y language macro (and _Countof operator)
so make use of it instead of ARR_COUNT that is now removed.
2026-01-07 14:57:26 +01:00
Martin Pulec
5a10182de3 vdec/lavc: fix ProRes decode
fixes decode broken since the commit 7dd9a44 (2025-10-23)

refers to
<https://github.com/CESNET/UltraGrid/issues/479>

closes
<https://github.com/CESNET/UltraGrid/issues/481>
2025-12-05 08:46:14 +01:00
Martin Pulec
ead669c606 to_lavc_vid_conv: remove some warn in 2 last conv
+ IWYU file
2025-11-27 08:30:52 +01:00
Martin Pulec
3b2664086e to_lavc_vid_conv: reindent the recent 2 convs 2025-11-26 16:58:53 +01:00
Martin Pulec
e32dc06641 to_lavc_vid_conv: add r12l_to_ayuv64le
refers to <https://github.com/CESNET/UltraGrid/issues/479>
2025-11-26 16:21:54 +01:00
Martin Pulec
cb73002185 to_lav_vid_conv: add r12l_to_p210le
refers to <https://github.com/CESNET/UltraGrid/issues/480>
2025-11-26 16:21:54 +01:00
Martin Pulec
ecc8a510d5 from_lavc_vid_conv: applied previous commit also here 2025-11-25 15:32:20 +01:00
Martin Pulec
ed94c7a3ec to_lavc_vid_conv: watch_pixfmt_degrade improved
compare just the in codec and the MIN(intermediate, out_pixfmt)

to avoid missleading message
`[to_lavc_vid_conv] conversion is reducing subsampling from 4444 to 4440`
as eg. in:
<https://github.com/CESNET/UltraGrid/issues/480>

if converting R12L to bgra over RGBA - the alpha channel is present just
in the intermediate but both ends have 444 without alpha channel.
2025-11-25 15:31:41 +01:00
Martin Pulec
15a905676c lavc cuda conv: disable by default + note
The actual implementation has not been merged as for now, so disable
the stub by default in configure.ac.

Also add a notice suggesting the removal.
2025-11-21 11:57:58 +01:00
Martin Piatka
c4e20cf044 lavc: Fix r12l_to_gbrp12le conversion 2025-11-18 10:33:23 +01:00
Martin Pulec
9652fbc0b5 to_lavc_vid_conv: add convs R12L->yuv422p1Xle 2025-11-13 11:08:54 +01:00
Martin Pulec
f9b950f6d9 vcomp/lavc: add Advanced Professional Video
+ reindent av_to_uv_map struct
2025-10-24 11:22:59 +02:00
Martin Pulec
434d23ddd6 color.{c,h}: rename to color_space
color is too much general - the declarations relate to color spaces
2025-10-08 15:19:36 +02:00
Martin Pulec
4517c15526 testcard patt=bars: annotate font sz in pt
multiples of base font bitmap font height is used
2025-10-03 12:22:03 +02:00
Martin Pulec
00898f90fa from_lavc_vid_conv bench tool compat
Fix the benchmark tool build when src/config.h present and CUDA
conversions enabled there. The appropriate CUDA files will be required
if HAVE_LAVC_CUDA_CONV is defined.
2025-10-02 14:15:47 +02:00
Martin Pulec
90b6ec7bbe from_lavc_vid_conv: supporess unused fn warn 2025-09-29 08:10:39 +02:00
Martin Pulec
7c882baa98 lavc: add mapping VUYA<->AV_PIX_FMT_VUYX
should allow FF codecs with VUYX supported without conversion
2025-07-02 08:41:06 +02:00
Martin Pulec
5d5ebd6812 lavc VUYA compat
use already existing VUYX_PRESENT (VUYA was added by 6ab8a9d3 in Jul
2022 a month earlier than VUYX)
2025-07-01 09:02:59 +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
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
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
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
Ben Roeder
a62fe80c3f Fix spelling errors throughout codebase
Corrected various spelling mistakes in comments, documentation, and
variable names across the project. Changes include:
- Documentation files (CONTRIBUTING.md, README.md, etc.)
- Source code comments in C/C++ files
- Function parameter names and descriptions

No functional changes were made.
2025-06-01 18:03:40 +01:00
Martin Pulec
19f19c300a from_lavc_vid_conv: fix -Wcast-align (clang) 2025-05-05 12:59:36 +02:00
Martin Pulec
33b222c34c from_lavc_vid_conv: CS warn only once 2025-04-30 16:08:23 +02:00
Martin Pulec
fa764db2d6 share some more convs between sdl3, to_lavc, testc
1. to SDL3 nv12 (not supported before)

2. to_lavc - use rgba_to_bgra - the vc_copyline version was not keeping alpha
(if ever used - this may cause regressions, unfortunately, if alpha is
assumed to be 100%, because the orig version set it always)

3. uyvy_to_i420 use by testcard and to_lavc

uyvy_to_i420: do not write out of bounds

If width % 2 = 1, 1 extra luma on first line of pair will override the
first luma on the second.
2025-04-01 14:02:30 +02:00
Martin Pulec
faf1367cb7 y216_to_p010le: make it usable also for FFmpeg
to_lavc conversion
2025-04-01 14:02:30 +02:00