summaryrefslogtreecommitdiff
path: root/libavutil
Commit message (Collapse)AuthorAge
* avutil/internal: Move libm inclusion to the beginningAndreas Rheinhardt2024-03-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/arm/mpegvideo_arm: Use static_assert to check offsetsAndreas Rheinhardt2024-03-31
| | | | | | | Also move AV_CHECK_OFFSET to its only user, namely lavc/arm/mpegvideo_arm.c and rename it to CHECK_OFFSET. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-31
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lib*/version: Use static_assert for static assertsAndreas Rheinhardt2024-03-31
| | | | | | | Also update the checks that guard against inserting a new enum entry in the middle of a range. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/frame: use the same data information as the source entry when cloning ↵James Almer2024-03-30
| | | | | | | | side data src->{data,size} does not need to match src->buf->{data,size}. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/opt: Avoid av_uninitAndreas Rheinhardt2024-03-30
| | | | | | | GCC 9-13 do not emit warnings for this at all optimization levels even when -Wmaybe-uninitialized is not disabled. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: Don't use ATOMIC_VAR_INITAndreas Rheinhardt2024-03-28
| | | | | | | | | | | | | | | | | | | | C11 required to use ATOMIC_VAR_INIT to statically initialize atomic objects with static storage duration. Yet this macro was unsuitable for initializing structures [1] and was actually unneeded for all known implementations (this includes our compatibility fallback implementations which simply wrap the value in parentheses: #define ATOMIC_VAR_INIT(value) (value)). Therefore C17 deprecated the macro and C23 actually removed it [2]. Since commit 5ff0eb34d2b1089d3dd9f27fdb51520001709138 we default to C17 if the compiler supports it; Clang warns about ATOMIC_VAR_INIT in this mode. Given that no implementation ever needed this macro, this commit stops using it to avoid this warning. [1]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_485 [2]: https://en.cppreference.com/w/c/atomic/ATOMIC_VAR_INIT Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/tests/.gitignore: Add side_data_arrayAndreas Rheinhardt2024-03-28
| | | | | Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/opt: Don't cast when the result might be misalignedAndreas Rheinhardt2024-03-28
| | | | | | | | | | | | | | | | A pointer conversion is UB if the resulting pointer is not correctly aligned for the resultant type, even if no load/store is ever performed through that pointer (C11 6.3.2.3 (7)). This may happen in opt_copy_elem(), because the pointers are converted even when they belong to a type that does not guarantee sufficient alignment. Fix this by deferring the cast after having checked the type. Also make the casts -Wcast-qual safe and avoid an indirection for src. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/opt: Avoid av_strdup(NULL)Andreas Rheinhardt2024-03-28
| | | | | | | | | | | | | | | | | | It is not documented to be safe and in any case it is nonsense: Currently av_strdup(NULL) returns NULL and in order to distinguish this from a genuine allocation failure, opt_copy_elem() checked afterwards whether src was actually NULL. But then one can simply check in advance whether one should call av_strdup() at all. set_string() was even worse and returned ENOMEM in case the value to be duplicated is NULL; this only worked because av_opt_set_defaults2() does not check the return value at all (given that it can't propagate it). These two places account for 389114 of 390356 av_strdup(NULL) calls during one FATE run. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/fifo, file: Remove unused headersAndreas Rheinhardt2024-03-27
| | | | | | | | Forgotten in 4105899245d79976b4a1a230455066417f3f194d, 4c92fc02f850f4f813e8cef8f8f8ed37d498e090. Reviewed-by: Stefano Sabatini <stefasab@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/frame: add side data descriptorsAnton Khirnov2024-03-27
| | | | They allow exporting extended information about side data types.
* Bump after 7.0 branch pointMichael Niedermayer2024-03-27
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Bump prior release/7.0 branchMichael Niedermayer2024-03-27
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/timecode: use 64bit for intermediate for rounding in ↵Michael Niedermayer2024-03-26
| | | | | | | | | | fps_from_frame_rate() Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4802790784303104 Fixes: signed integer overflow: 1768972133 + 968491058 cannot be represented in type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/timestamp: change precision of av_ts_make_time_string()Marton Balint2024-03-25
| | | | | | | By calling the av_ts_make_time_string2() from the function we can fix the precision issue. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/timestamp: introduce av_ts_make_time_string2 for better precisionMarton Balint2024-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | av_ts_make_time_string() used "%.6g" format, but this format was losing precision even when the timestamp to be printed was not that large. For example for 3 hours (10800) seconds, only 1 decimal digit was printed, which made this format inaccurate when it was used in e.g. the silencedetect filter. Other detection filters printing timestamps had similar issues. Also time base parameter of the function was *AVRational instead of AVRational. Resolve these problems by introducing a new function, av_ts_make_time_string2(). We change the used format to "%.*f", use a precision of 6, except when printing values near 0, in which case we calculate the precision dynamically to aim for a similar precision in normal form as with %.6g. No longer using scientific representation can make parsing the timestamp easier for the users, we can safely do this because the theoretical maximum of INT64_MAX*INT32_MAX still fits into the string buffer in normal form. We somewhat imitate %g by trimming ending zeroes and the potential decimal point characters. In order not to trim "inf" as well, we assume that the decimal point string does not contain the letter "f". Note that depending on printf %f implementation, we might trim "infinity" to "inf". Thanks for Allan Cady for bringing up this issue. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: don't clear the opaque pointer on type conversionJames Almer2024-03-25
| | | | | | Otherwise it would not be lossless. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/hwcontext_qsv: Fix mixed declaration and codeAndreas Rheinhardt2024-03-25
| | | | | Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* vulkan_av1: port to the new stable APILynne2024-03-25
| | | | Co-Authored-by: Dave Airlie <airlied@redhat.com>
* avutil/film_grain_params: remove do loop in CHECK macroLeo Izen2024-03-24
| | | | | | | | The continue statement will break out of the do/while loop, not the outer loop as intended. This is one (compound) statement anyway, so we can remove the do/while entirely. Signed-off-by: Leo Izen <leo.izen@gmail.com>
* avutil/film_grain_params: remove unused variablesLeo Izen2024-03-24
| | | | | | These variables are never read from, so they trigger -Wunused-variables Signed-off-by: Leo Izen <leo.izen@gmail.com>
* x86: Update x86inc.asmHenrik Gramner2024-03-24
| | | | | | Make things up-to-date with upstream. https://code.videolan.org/videolan/x86inc.asm
* avutil/film_grain_params: add av_film_grain_params_select()Niklas Haas2024-03-23
| | | | | | | | Common utility function that can be used by all codecs to select the right (any valid) film grain parameter set. In particular, this is useful for AFGS1, which has support for multiple parameters. However, it also performs parameter validation for H274.
* avutil/frame: clarify AV_FRAME_DATA_FILM_GRAIN_PARAMS usageNiklas Haas2024-03-23
| | | | | To allow for AFGS1 usage, which can expose multiple parameter sets for a single frame.
* avutil/film_grain_params: initialize VCS to UNSPECIFIEDNiklas Haas2024-03-23
|
* avutil/film_grain_params: add metadata to common structNiklas Haas2024-03-23
| | | | | | | | | | | | This is needed for AV1 film grain as well, when using AFGS1 streams. Also add extra width/height and subsampling information, which AFGS1 cares about, as part of the same API bump. (And in principle, H274 should also expose this information, since it is needed downstream to correctly adjust the chroma grain frequency to the subsampling ratio) Deprecate the equivalent H274-exclusive fields. To avoid breaking ABI, add the new fields after the union; but with enough of a paper trail to hopefully re-order them on the next bump.
* avutil/frame: Use av_realloc_array(), improve overflow checkAndreas Rheinhardt2024-03-22
| | | | | | | | Also use sizeof of the proper type, namely sizeof(**sd) and not sizeof(*sd). Reviewed-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/frame: Rename av_frame_side_data_get and add wrapper for itAndreas Rheinhardt2024-03-22
| | | | | | | | | | | | | | | | | | | av_frame_side_data_get() has a const AVFrameSideData * const *sd parameter; so calling it with an AVFramesSideData **sd like AVCodecContext.decoded_side_data (or with a AVFramesSideData * const *sd) is safe, but the conversion is not performed automatically in C. All users of this function therefore resort to a cast. This commit changes this: av_frame_side_data_get() is renamed to av_frame_side_data_get_c(); furthermore, a static inline wrapper for it name av_frame_side_data_get() is added that accepts an AVFramesSideData * const * and converts this to const AVFramesSideData * const * in a Wcast-qual safe way. This also allows to remove the casts from the current users. Reviewed-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/frame: Constify av_frame_side_data_get()Andreas Rheinhardt2024-03-22
| | | | | Reviewed-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* {avutil/version,APIchanges}: bump, document new AVFrameSideData functionsJan Ekström2024-03-20
|
* avutil/frame: add helper for getting side data from arrayJan Ekström2024-03-20
|
* avutil/frame: add helper for adding existing side data to arrayJan Ekström2024-03-20
|
* avutil/frame: add helper for adding side data to arrayJan Ekström2024-03-20
| | | | | Additionally, add an API test to check that the no-duplicates addition works after duplicates have been inserted.
* avutil/frame: split side data removal out to non-AVFrame functionJan Ekström2024-03-20
| | | | This will make it possible to reuse logic in further commits.
* avutil/frame: split side_data_from_buf to base and AVFrame funcJan Ekström2024-03-20
|
* avutil/frame: add helper for freeing arrays of side dataJan Ekström2024-03-20
|
* avutil/frame: split side data list wiping out to non-AVFrame functionJan Ekström2024-03-20
| | | | This will make it possible to to reuse logic in further commits.
* lavu/hwcontext_vulkan: check PCI ID if possibleHaihao Xiang2024-03-19
| | | | | | | | Otherwise the derived device and the source device might have different PCI ID in a multiple-device system. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avutil/hwcontext_d3d11va: add logging to dxgi debug interfacesTimo Rothenpieler2024-03-18
|
* avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when availableTimo Rothenpieler2024-03-18
| | | | | | A lot of modern stuff straight up fails on the old 1.0 factory, which is masked by the fact that it's only used when an explicit adapter is specified.
* avutil/hwcontext_d3d11va: remove check for d3d11 debug layer dllTimo Rothenpieler2024-03-18
| | | | | | | | | | At least on latest Win 11 and Visual Studio 2022, that DLL does not exist anymore and can't be installed via any of the usual means. However, debugging works just fine regardless, so this check makes debugging impossible. D3D11CreateDevice will fail anyway if debugging is not supported, so let's rely on that instead.
* lavu/hwcontext_qsv: Join the download/upload session to the main sessionHaihao Xiang2024-03-18
| | | | | | | This may reduce the number of internal threads when using hwupload or hwdownload filter. Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avutil/hash: Avoid relocations for hash namesAndreas Rheinhardt2024-03-18
| | | | | | | | These strings are so short (longest takes 11B) that using pointers is wasteful. Avoiding them also moves hashdesc into .rodata (from .data.rel.ro). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/x86util: Fix broken pre-SSE4.1 PMINSD emulationHenrik Gramner2024-03-17
| | | | | | Fixes yadif-16 which allows FATE to pass. Broken since 2904db90458a1253e4aea6844ba9a59ac11923b6 (2017).
* avutil/channel_layout: add specific text versions for unknown and unused ↵Marton Balint2024-03-16
| | | | | | channels Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: fix some (un)initialization issues in ↵Marton Balint2024-03-16
| | | | | | | | | av_channel_layout_from_string() Also make initialization/uninitialization behaviour more explicit in the docs, and make sure we do not leak a channel map on error. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: factorize parsing list of channel namesMarton Balint2024-03-16
| | | | | | | Also make use of the av_channel_from_string() function to determine the channel id. This fixes some parse issues in av_channel_layout_from_string(). Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/tests/channel_layout: add some av_channel_from_string and ↵Marton Balint2024-03-16
| | | | | | | | | av_channel_layout_from_string tests We lacked tests which supposed to fail, and there are some which should fail but right now it does not. This will be fixed in a later commit. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/tests/channel_layout: make printing results part of the testsMarton Balint2024-03-16
| | | | | | | | | | Deduplicates a lot of code. Some minor differences (mostly white space and inconsistent use of quotes) are expected in the fate tests, there was no point aiming for exactly the same formatting. Signed-off-by: Marton Balint <cus@passwd.hu>