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)
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.
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).
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
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.
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
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.
- 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)
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)
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
Extend the script added by previous commit to one handling the entire
bundling from Makefile.
It is nicer having the scripting outside the Makefile, anyways, and the
bundle LC_RPATH fix workaround closly relates to bundling.