There are some calls using just the codec_ctx
parameter, which fail (with the compat with
legacy FFmpeg).
eg. `uv -A Opus -s testcard` (using the old FFmpeg)
The rationale is to separate the config.h-dependent stuff to a separate
file to eliminate the need to transitively include config.h.
+ fix the files that need config.h directly to include it
Some AVCodec properties like pix_fmts or sample_fmts are marked as
deprecated and should be replaced by avcodec_get_supported_config()
in current FFmpeg.
Created compat functions to get rid of deprecate warnings running with
both old and new FFmpeg.
Set lmt_rng=0 for full-range src YCbCr only - the color conversions are
used for both (src) YCbCr->RGB and RGB->YCbCr (perhaps less often). In
the second case, the input is full-range so that output YCbCr would be
full-range YCbCr 709. which is incorrect.
If CS conversion is done, handle also full-range input. This shouldn't be
the case most of the time (we use always limited range) but the case that
is handled is namely a JPEG from a webcam or so, which is 601
limited. Full YCbCr->YCbCr is not handled by this commit.
Remove MJPG codec_t which was complementary to JPEG. The difference was
that JPEG was used for JPEG with restart intervals and MJPG without.
But slices are now enabled for MJPG (emits reset marker every 16 lines)
which actually gives the GPUJPEG decoder a space for efficient decoding.
Measured decoding performance using Ryzen 7900X and RTX 4080:
NewZealand (UYVY, 3840x2160, frame 2500):
encoded by\decoded by GPUJPEG lavd
-c libavcodec 7.1 ms 19 ms
-c gpujpeg 1.35 ms 14.3 ms
-t testcard:s=3840x2160:patt=text
encoded by\decoded by GPUJPEG lavd
-c libavcodec 2 ms 40 ms
-c gpujpeg 25 ms 40 ms
The advantage is simpler maintanance (no need to handle 2 codec
identifiers) and also performance because from the above, the GPUJPEG
decode should be faster even for JPEGs encoded by lavc.
Only situation where lavd performs better is a stream without restart
intervals at all (either `-c lavc:slices=1`, `-c gpujpeg:r=0` or from
a webcam), let say 28 ms for lavd and 40 for GPUJPEG. But it is not worth
keeping it for such a case - it will be better implemented using struct
pixfmt_desc to return rst count and picking the decoder according to
this if really needed.
As this can occur if the source is eg. a webcam-compressed JPEG and
cannot be easily work-arounded, print the warning just once.
Also update the message - it is not problem that is not being unsupported
but clipping the values (also redundant "may", because we can be sure).
It can be used in place of other network-related headers, not just for
htonl and family.
+ compat for fd_t and INVALID_SOCKET (that has been in config_*.h)
Mainly depth is included in Y_ and CBCR_LIMIT - the used denominator
255.0 matched only 8 bits.
Add (substract) epsilon 0.5 when converting the to integer to round the
value correctly.
WORDS_BIGENDIAN is defiend by config.h
Use __BYTE_ORDER__ defined by GNU compilers (POSIX 2024 further defines
endian.h header but not yet in macOS /15/),
1. do not call av_log_set_level if using custom callback - seemingly not
used for custom callbacks
2. simplify lavc-log-level (rename from lavcd-...) and keep it only for FFmpeg
values only (+ use FFmpeg default logger)
As indicated by the point 1, it didn't perhaps even work unless the
'D' suffix (now removed) was added to the param because the value set
was not used by the custom callback but default (UG global) log_msg was
used instead.
The old and now defunct hwaccel was removed in 30eab46 and was replaced
by a new DRM-PRIME based implementation that works on the recent
versions on Raspbian.
Some parts of the old implementation remained by mistake. This should
remove all the remaining stuff.
Fixed a crash on (dummy) conversion from Y216 to AV_PIX_FMT_Y212 (just
memcpy), because the state given in AVFrame::opaque was not passed
through task-specific AVFrames.
Properly handle situations when AVPixelFromat is not handled by CUDA
implementation but CUDA is requested.
In this cases just handle the format as if CUDA was not enabled.
\+ removed Y444 (not needed for testing purposes any more)
for better encapsulation, just moved the code now with 2 very small fixes:
- int cpu_count - added const
- explicit size_t cast "i * row_height * pitch" to satisfy clang-tidy