Commit Graph

6236 Commits

Author SHA1 Message Date
Martin Pulec
34f93a6795 lavc: sws fallback - use UYVY if none pixfmt avail
Use UYVY as a fallback intermediate if no eligible pixfmt is reported.
This could eg. happen if no conversion fullfill constraint (eg.
currently R10k to anything WRT subsampling 4:2:0).
2022-07-22 14:56:39 +02:00
Martin Pulec
d7483d26de lavc: print pixelformat swscale is wishing convert to 2022-07-22 14:01:04 +02:00
Martin Pulec
056bb92619 DeckLink disp.: use unique_ptr for VideoDelegate
was leaked before
2022-07-21 13:34:10 +02:00
Martin Pulec
fffaadefe1 DeckLink cap.: further use RELEASE_IF_NOT_NULL 2022-07-21 13:27:56 +02:00
Martin Pulec
2368d779cd DeckLink cap.: release decklinkAttributes
(+ removed needless /but harmless/ repeated releasing of
   decklinkConfiguration)
2022-07-21 13:14:44 +02:00
Martin Pulec
5401043afe DeckLink cap.: small refactor 2022-07-20 15:59:08 +02:00
Martin Pulec
630f63217f DeckLink cap.: fixed some leak 2022-07-20 15:48:29 +02:00
Martin Pulec
dc826b52ce added BMD_STR->std::string func
+ use it in recent code
2022-07-20 14:23:04 +02:00
Martin Pulec
9388b33f20 bmd_hresult_to_string: print also error code 2022-07-20 14:23:04 +02:00
Martin Pulec
8e12a29ddf DeckLink cap.: supress IDeckLinkDisplayMode::GetName fail
For a reason, this sometime fail resulting to following error:

    [DeckLink capture] set_display_mode_properties: out of memory

+ release_bmd_api_str: NOOP if nullptr passed (can be now the case since
  the code is more permissive)
2022-07-20 14:23:04 +02:00
Martin Pulec
97dd5ceecb AppRun fixed libva-x11 not being LD_PRELOADED
In the second iteration of for cycle, $NAME was derived from something
like "/usr/lib/libva.so.2:/usr/lib/libva-drm.so.2"  (s/libva/libva-x11),
which obviously didn't exist as a file.

Fixes:

    $ <AppImage> --list-modules | grep -A 2 'Errors:'
    Errors:
            ultragrid_acompress_libavcodec.so
                    ./squashfs-root2/usr/lib/libva-x11.so.2: undefined symbol: va_fool_postp
2022-07-20 14:23:04 +02:00
Martin Pulec
9bbcefc240 AppRun (Linux): bundled libva selection improve 2022-07-20 14:22:57 +02:00
Martin Pulec
e859bc7b35 Rate limited usage: reduce indention lvl for help 2022-07-20 11:07:40 +02:00
Martin Pulec
f103a9e53f tx_init: remove one indention level 2022-07-20 11:07:40 +02:00
Martin Pulec
cbc548d384 Added+use dynamic rate limiter
Added a rate limiter that occasionally allows excessive frames.

It permits using 1.5x frame time for frame 2x bigger that moving
average if 4 normal frames (using .75x frame time) were emitted
inbetween.

This mode is now default (for video, audio doesn't use rate limiter).
2022-07-20 11:05:40 +02:00
Martin Pulec
03f70eadef parse_bitrate: use map for special vals 2022-07-19 09:51:14 +02:00
Martin Pulec
f42cafcedf get_packet_rate: needless use of long long 2022-07-19 09:51:14 +02:00
Martin Pulec
5be9d658e4 transmit.cpp: compute packet rate in separate func 2022-07-19 09:51:11 +02:00
Martin Pulec
309973738f parse_params: do not modify optarg
Since parse_params is now run twice, subsequent call must not be influenced by
the first run (in particular the parameter optarg).
2022-07-19 09:19:32 +02:00
Martin Pulec
9cf14ef683 parse_params: fixed validation
Validated parameter was not "<key>" but "<key>=<val>".
2022-07-19 09:11:07 +02:00
Martin Pulec
e561e45933 Fixed "--param" handling
The parsing was done early before dynamic modules that export own
parameters were loaded.

Now, the parsing is done in 2 steps -- first scan only for already known
parameters (output buffer settings is needed for preinit), ignore
"help".

The second step is to do the full parse (in main), when there are all
modules loaded (latter in common_preinit()).

Fixes #237.

The regression was introduced by 1dc89920.
2022-07-18 10:32:43 +02:00
Martin Pulec
1d30604a7a parse_params: optarg must not be NULL - don't check 2022-07-18 10:15:58 +02:00
Martin Pulec
b8766991ae host.{cpp,h}: make some param-related funcs static
Marked some param-related functions as internally linked.
2022-07-18 10:12:00 +02:00
Martin Pulec
5ce89a2dc9 host.cpp: validate parameters before assign 2022-07-18 10:08:23 +02:00
Martin Pulec
2c155cc542 video_decompress.cpp: fixed a typo 2022-07-18 09:55:32 +02:00
Martin Pulec
a0458aa6dd video pattern generator: finished SMPTE bars
It is not fully-conformant but the wiki description is rather vague and
it is eg. inpossible to represent a "superblack" color if we assume 0 as
a base black.
2022-07-14 15:54:22 +02:00
Martin Pulec
8f5d5b4ccd video pattern generator: fixed 7nd bar of SMPTE 2022-07-14 15:40:52 +02:00
Martin Pulec
e4f56be955 prevent dangling lambdas
Prevent dangling parameter-less lambdas. Although it may not be so dangerous
(operator() should be a plain function in the end), it is not correct.
2022-07-14 09:29:15 +02:00
Martin Pulec
45d0bfb615 Cineform: Windows warning fix 2022-07-14 09:29:15 +02:00
Martin Piatka
e2d42ecd15 types.h: Fix typo 2022-07-12 14:43:03 +02:00
Martin Pulec
d0224f6b2e .github/scripts/macOS/sign.sh: used shellcheck
Incorporated shellcheck complains.
2022-07-12 11:53:48 +02:00
Martin Pulec
c7a251f327 CI sign.sh [mac]: return 0 on pull request
On pull request, the repository secrets are not available.
2022-07-12 11:32:57 +02:00
Martin Pulec
727841f3bc set_output_buffering: small improvements
- show usage with "help"
- print error if setvbuf fails (but do not return an error - there may
  be some platform problem but the setting is done always, so it would
  unconditionally prevent UltraGrid from running)
- if usage error (or help) occurs, exit UltraGrid
2022-07-01 15:22:54 +02:00
Martin Pulec
67c4bad83b param help: added usage warning
--params should not be considered a part of standard options provided to
users but rather a developer/expert mode.
2022-07-01 14:49:56 +02:00
Martin Pulec
46938b20fb echo: param help indention fix 2022-07-01 14:49:56 +02:00
Martin Pulec
1dc899209d set output buffering early
setvbuf() should be called on a stream prior to any operation with the
stream. Previously it was to late -- it was even after configuration
summary was printed to stdout.
2022-07-01 14:49:32 +02:00
Martin Pulec
8e1369f21f setvbuf: set size=BUFSIZ
The value 0 is mentioned in man setvbuf(3) and indeed glibc
implements setlinebuf as:

    _IO_setvbuf (stream, NULL, 1, 0);

However, except the mention in manual page, this extension doesn't seem
to be anywhere mentioned (not clear if valid with _IOFBF) and it is not
widespread except glibc, since [1] forbids that. Also using _IOLBF+0
behaves in the same way as _IOLBF+BUFSIZ (buffers BUFSIZ bytes).

[1] https://www.ibm.com/docs/en/i/7.1?topic=functions-setvbuf-control-buffering
2022-07-01 09:29:18 +02:00
Martin Pulec
b76351d37e lavc: set rc_buffer_size frame size multiplier 2.5
Replace the original factor of 8 with 2.5. As a drawback, the resulting
stream is 13% smaller than requested bitrate, but maximal frame is
indeed at most 2.5x bigger than the average (measured on NewZealand
short).

This used to cause some artifacts if smaller than 8 but doesn't seem to
be true anymore. Anyways, this commit also adds param
`lavc-rc-buffer-size-factor` in case there is a need to increase the
factor.

Impact on PSNR (NZ@20 Mbps) -- previous: avg. 52.27, new 49.95 (but has
smaller actual bitrate; using the same bitrate yields 51.36).
2022-07-01 08:49:59 +02:00
Martin Pulec
52fad90bbf GL: option for GLFW window hints
See previous commit -- where eg. auto-iconify is desirable, user may opt
in.
2022-07-01 08:49:47 +02:00
Martin Pulec
f40bd85dc3 GL: do not iconify when FS loses focus
Do not iconify when windows is fullscreen and loses focus -- this is
particularly annoying when using 2 displays (but can have a rationale
in a single display setup when platform has full-screen windows always
on top).
2022-06-30 16:41:49 +02:00
Martin Pulec
6a83885516 lavc: do not set slice-max-size at all
Altough in theory it may be beneficial to limit NAL unit sizes to
approximately the size of packet and indeed in synthetic tests it
was, real world use seems to exhibit the opposite - potential artifacts
if exceeding 32 slices (some huge picture). Also the resilliency was
somhow worse.

User still may pass the parameter explicitly to see if the behavior
improves or worsens: "-t libavcodec:encoder=libx264:slice-max-size=1200"
2022-06-30 16:41:41 +02:00
Martin Pulec
03481f570a DeckLink disp.: use generic FPS indicator
(Main motivation was to have the video capture visually more apparent if
having cap+disp+audio. This is now solved by the generic indicator so
use it.)
2022-06-30 16:41:41 +02:00
Martin Pulec
1ccadb51fe generic display FPS indicator: use colors+bold 2022-06-30 16:41:41 +02:00
Martin Pulec
a50f443095 main: point clog to cout
Point clog to cout instead of default cerr. Unit of log is almost always
a line so it is pointless to flush it after each write (as stderr is set
by default not to buffer /see previous commit/) -- those would make
every '<<' operator a flush point (or in C code multiple calls of
console_out is done).
2022-06-30 16:41:40 +02:00
Martin Pulec
d4775e375e output buffering: set explicitly
Set output buffering to "line" for stdout and "no" for stderr. This is
the case usually but not always (eg. MSYS, GUI console) so make this
explicit to be deterministic.
2022-06-30 16:41:40 +02:00
Martin Pulec
26f85aee9d color_out: support for background color + more cols
+ do not use std::flush at the end of stream
2022-06-30 16:41:40 +02:00
Martin Pulec
801074d4af GL: removed custom FPS indicator and use generic 2022-06-30 16:41:40 +02:00
Martin Pulec
ae9ac7da07 video_display: added optional generic indicator 2022-06-30 16:41:40 +02:00
Martin Pulec
39c1e3f2cb initialize_video_display: return early if not found
refactorization -- return right away if display was not found instead of
indenting the whole opposite "normal" block.
2022-06-30 16:41:39 +02:00
Martin Pulec
3b1b3d6dab DeckLink cap.: use generic FPS indicator 2022-06-30 16:41:39 +02:00