Commit Graph

9719 Commits

Author SHA1 Message Date
Martin Pulec
52ed2fdd22 tv.h: replace time conv macros (+ in alsa)
Replace time conversion macros defined 2 commits ago between msec
and usec.

This is proposed (considered) solution to the todo in tv.h - inconsistent
unit conversion macros. Rather than value, it might be better to use
function-like macros.

The issues is that there will be actaully double the amount - A_TO_B and
B_TO_A. To keep it in a reasonable range, it would be best to remove
the _DBL versions and keep the user typing the arg to double inestead
2024-09-10 08:58:27 +02:00
Martin Pulec
47c13e3968 configure: add kernels to vcomp/cmpto_j2k as well
refers to GH-406
2024-09-06 11:21:20 +02:00
Martin Pulec
f3462fc599 aplay/alsa: control debug print delay by log_level
use run-time log_level rather then macro DEBUG
2024-09-06 11:19:25 +02:00
Martin Pulec
fb15ce9218 aplay/alsa: moved buffer setting to a separate fn
refactor only

changed:
- use symbolic constannts MS_IN_US[_DBL]
- use MSG() instead of log_msg()
- add _MS suffix to macros for default buf sizes
- fixed including
2024-09-06 10:54:31 +02:00
Martin Pulec
e3556c66a7 aplay/alsa: warn if buffer is too short 2024-09-05 14:47:24 +02:00
Martin Pulec
52b9ed2554 testcard/pattern: rename pixel_bars to strips + w=10
Renamed pixel_bars to strips - the original name is not much descriptive -
pixels indicated 1 pixel width, which is not necessarily true, bars
(=vertical) isn't the default mode. Also not much distinctive (there
are other "bars").

Set also the default width to 10 - actually, the original width 1 is
better for troubleshooting compressions etc. But 10 is a visually more
appealing as a default and for the original use, the with can be set
explictily.
2024-09-04 11:58:17 +02:00
Martin Pulec
3a4c13f2d1 testcard/pattern/pixel_bars: add white/gray/black
may help in some troubleshooting
2024-09-04 11:56:20 +02:00
Martin Pulec
fe77b42a1e testcard/pattern/pixel_bars: added strip width opt 2024-09-04 11:08:12 +02:00
Martin Pulec
c40430e07a rt48_to_r12l_compute_blk: compute |last_bl|%8 != 0
Compute last incomplete block (as already done for the cmpto_j2k enc)
in CUDA kernel.
2024-09-03 16:50:56 +02:00
Martin Pulec
f860792e42 kernel_rg48_to_r12l: don't process incomplete blks
see also the commit 1a543b2c
2024-09-03 16:50:56 +02:00
Martin Pulec
9edc9bdc33 vdisp/dump: fix alloc size
MIN was used by mistake, should be MAX
2024-09-03 16:50:56 +02:00
Martin Pulec
c08bce79b8 kernel_r12l_to_rg48: compute last incomplete blk 2024-09-03 16:50:56 +02:00
Martin Pulec
2c6519223a kernel_r12l_to_rg48: of-by-one error
There must be an equal comparison, because the position_x indicates the
beginning of the block, so in the first case it means at most last
unfinished block and the 2nd comparison means the last unaligned block
(if any).
2024-09-03 16:50:56 +02:00
Martin Pulec
7869b2d0b3 kernel_r12l_to_rg48: rework a bit
- separate the block computation

Drop every non-aligned end of the line, not just on the last line. The
point is, that whereas out of bound read is no more a problem, we may
also do the out-of-bound write - write the trash at the beginning of
the following line.
2024-09-03 16:50:56 +02:00
Martin Pulec
d82ae79c00 kernels.cu: move commons ahead; mark parts 2024-09-03 16:50:56 +02:00
Martin Pulec
94afd6c5b4 cmpto_j2k: param to disable GPU conversions
for debugging + eventualy if there were problems as a workaround
2024-09-03 16:50:55 +02:00
Martin Pulec
7b91ebb5d4 vcomp/cmpto_j2k: move CUDA buf alloc to set_pool
The allocation was before set_pool, which can, however, now set
cuda_convert_func to nullptr, therefore the malloc would be unneeded.
2024-09-03 16:50:55 +02:00
Martin Pulec
1cffc72fa8 vcomp/cmpto_j2k: move pool setting to a sep func
The logic is a bit tricky so separate it to a separate func.

just a refactor
2024-09-03 16:50:55 +02:00
Martin Pulec
f613056481 vcomp/cmpto_j2k: update a msg
- inform that also CPU conversion used
- do not propopse reporting - the user may report regardless it is
written. However, since also decompress doesn't support postprocess
on multiple CUDA devices, we can assume this is inherent to the codec
(although tested on a fairly old version, so this might have changed)
2024-09-03 16:50:55 +02:00
Martin Pulec
e37e58cf52 vdec/cmpto_j2k: don't use GPU postp. with more dev
If multiple CUDA devices are used, do not use the CUDA postprocess,
because this is not supported by the codec (at least the version
2.5.8). Error:
```
[J2K dec.] Error initializing context: CUDA postprocessor is supported
only when single CUDA device is configured
```
2024-09-03 16:50:55 +02:00
Martin Pulec
b1ff4c6d29 vdec/cmpto_j2k: moved setting conv to separate fn
only a refactoring now
2024-09-03 16:50:55 +02:00
Martin Pulec
650bf71010 vc_copylineR12LtoRG48: do not override output buf
In non-native R12L lengths (width%8!=0). do not override the output
last block.
2024-09-03 16:50:54 +02:00
Martin Pulec
06a3ca6081 debug_dump: early return
Currently, if log_level isn't at least DEBUG, nothing will be printed,
anyways.
2024-09-03 16:41:51 +02:00
Martin Pulec
5aa5261dda debug_dump: improved printout
- use 'h' suffix when len printed in hexa
- for missing bytes at the end (not aligned to 16 B) print 2 spaces
instead of 1, because it stands for 2 nibbles. Otherwise the ASCII
representation would be moved left (the muber of chars didn't match).
2024-09-03 16:41:51 +02:00
Martin Pulec
33675df8f6 pattern pixel_{rows,column}: add diagonal+rename
- added diagonal variant
- rename to pixel_bars again (we now have 3 flavors, but are related).

vertical/horizontal/diagonal is now an option
2024-09-03 16:41:49 +02:00
Martin Pulec
6e42db0bed image_pattern_pixel_bars: allow also rows
+ bars rename to columns
2024-09-03 14:54:56 +02:00
Martin Pulec
66e7b23f2c video_pattern_generator/interlaced: check width 2024-09-03 14:54:56 +02:00
Martin Pulec
c9aef86c40 video_pattern_generator/interlaced: alloc inc MAX_PADDING 2024-09-03 14:54:56 +02:00
Martin Pulec
0e7b990d2b video_pattern_generator usage: reformat
as the number of of patterns grew, it became a bit messy
2024-09-03 14:54:56 +02:00
Martin Pulec
0466ef87a8 video_pattern_generator: new pattern pixel_bars
makes the bars as the default pattern, but width is set to 1 pixel
(and repeated).
2024-09-03 14:54:56 +02:00
Martin Pulec
cc6b820db2 vcomp/cmpto_j2k, pool: alloc extra data
padding for conversions
2024-09-03 14:54:21 +02:00
Martin Pulec
62dece8d97 to_lavc_vid_conv: extra padding for alloc
fixes `uv -t testcard:codec=R12L:size=1921x1080 -c lavc`
2024-09-03 09:14:23 +02:00
Martin Pulec
0df55a477f testcard/pattern=blank: print inline help 2024-09-03 09:14:15 +02:00
Martin Pulec
107e3e30da vdisp/sdl2: set correct data_len if pitch!=linelen
fixes:
```
uv -t testcard:codec=RGB:size=1921x1080 -d sdl
```

Doesn't crash but errors are printed on console and data at the end
(perhaps something like a line) is not written.
2024-09-03 09:14:03 +02:00
Martin Pulec
39c9c40d67 vcomp/cmpto_j2k: support RG48
RG48 can be supported immediately, see also the commit d0832b5e (similar
change for the decoder).
2024-08-30 16:21:36 +02:00
Martin Pulec
1cb99cba98 conversion kernels: watch duration
print a warning if consumes more than 10 ms

+ print the function name if DEBUG for elapsed time
2024-08-30 16:21:36 +02:00
Martin Pulec
930abe5325 vcomp/cmpto_j2k: kernel for R12L->RG48 conversion
see also the commit 4f3add780
2024-08-30 16:21:36 +02:00
Martin Pulec
95dea895d6 vdec/cmpto_j2k: missing config.h (HAVE_CUDA) 2024-08-30 16:21:36 +02:00
Martin Pulec
ad7929b49f vdec/cmpto_j2k: advertise RG48
RG48 is suppoted directly and it allows displaying eg. with GL display
that doesn't support R12L.
2024-08-30 16:21:36 +02:00
Martin Pulec
876870f8f3 j2k_dec[..]et_priority: get codec list from struct
Get the supported codec list from the struct codecs instead of hard-coding
it.
2024-08-30 16:21:13 +02:00
Martin Pulec
671b188013 change_pixfmt: added buffer padding
Pixelformat conversion suppose buffers with additional padding to handle
"odd" resolutions that doesn't match the pixfmt native block
size. Eg. this change fixes:
```
uv -t testcard:codec=R12L:size=1922x1080 -d gl -p change_pixfmt:RG48
```
2024-08-30 15:49:05 +02:00
Martin Pulec
3adb9a46cc vcomp/cmpto_j2k: do not set convertFunc
Needless because it is directly deduced from the src and dst
codec. Currently always R12L->RG48.
2024-08-30 15:49:05 +02:00
Martin Pulec
af5d5841d0 vcomp/cmpto_j2k: fixed misleading comments
Actually the pool properties is precompress_desc, saved_desc is used
in usual sense to check whether the properties were changed from last
(re)configuratio.
2024-08-30 15:49:05 +02:00
Martin Pulec
c2cebd3198 vcomp/cmpto_j2k: do R12L to RG48 conv in parallel
CPU only as for now
2024-08-30 15:49:05 +02:00
Martin Pulec
4061f8d0f2 vcomp/cmpto_j2k: fixed setting cuda_device!=0 2024-08-30 15:49:05 +02:00
Martin Pulec
ca71f59b9c vcomp/cmpto_j2k: disable CUDA buffers with |GPU|>1
Disable copying to CUDA buffers if there is more CUDA devices configured,
it does cause the following error:
```
[J2K enc.] Setting image samples: Cannot configure input samples in CUDA
buffer because argument 'device_id' doesn't match the configured CUDA
device in encoder. Single CUDA encoder must be configured.
```
2024-08-30 15:49:04 +02:00
Martin Pulec
c2e7811152 vcomp/cmpto_j2k: copy directly to device memory
If convert function is not used, copy the data directly to GPU memory
instead of duplicating with memcpy. CUDA support must also be enabled
for this to work.
2024-08-30 15:49:04 +02:00
Martin Pulec
779021b804 vcomp/cmpto_j2k: if enque fails, return frm to pool
see also the commit 95773727 for similar change for the dec
2024-08-30 15:49:04 +02:00
Martin Pulec
bda593c85b vcap/cmpto_j2k + video_frame_pool rework
use pimpl for video_frame_pool

use implicit constructor for vcomp/cmpto_j2k to allow switching of pools
2024-08-30 15:49:04 +02:00
Martin Pulec
c2448bc613 vcomp/cmpto_j2k: free with cudaFreeHost
The pointer is allocated with cudaMallocHost so it should be freed
with cudaFreeHost.
2024-08-30 15:49:04 +02:00