aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
Commit message (Collapse)AuthorAgeFilesLines
* avutil/frame: remove comment about avcodec_get_frame_class()Andrew Sayers2024-04-181-2/+1
| | | | | | The function was deprecated a while back and deleted last year. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: free the old side data buffer before replacing itJames Almer2024-04-111-0/+1
| | | | | | | Fixes memleaks reported by ASAN/Valgrind. Reported-by: Sean McGovern <gseanmcg@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/mastering_display_metadata: add a new allocator function that returns ↵James Almer2024-04-113-1/+23
| | | | | | | | | a size av_mastering_display_metadata_alloc() is not useful in scenarios where you need to know the runtime size of AVMasteringDisplayMetadata. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/version: bump minor after recent AVFrame API additionsJames Almer2024-04-111-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: add helper to remove side data of a given type from an arrayJames Almer2024-04-112-0/+11
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: add a flag to allow overwritting existing entriesJames Almer2024-04-113-33/+108
| | | | | | Enable it only for side data types that don't allow more than one entry. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: add helper for adding side data w/ AVBufferRef to arrayJames Almer2024-04-112-0/+43
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* aarch64: Factorize code for CPU feature detection on Apple platformsMartin Storsjö2024-04-101-12/+13
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* avutil/pix{desc,fmt}: add new matrix coefficients from H.273 v3Jan Ekström2024-04-033-1/+7
| | | | | | | | | | | | * SMPTE ST 2128 IPT-C2 defines the coefficients utilized in DoVi Profile 5. Profile 5 can thus now be represented in VUI as {AVCOL_RANGE_JPEG, AVCOL_PRI_BT2020, AVCOL_TRC_SMPTE2084, AVCOL_SPC_IPT_C2, AVCHROMA_LOC_LEFT} (although other chroma sample locations are allowed). AVCOL_TRC_SMPTE2084 should in this case be interpreted as 'PQ with reshaping'. * YCgCo-Re and YCgCo-Ro define the bitexact YCgCo-R, where the number of bits added to a source RGB bit depth is 2 (i.e., even) and 1 (i.e., odd), respectively.
* avutil/dovi_meta: add dolby vision extension blocksNiklas Haas2024-04-033-4/+166
| | | | | | | | | As well as accessors plus a function for allocating this struct with extension blocks, Definitions generously taken from quietvoid/dovi_tool, which is assembled as a collection of various patent fragments, as well as output by the official Dolby Vision bitstream verifier tool.
* avutil/dovi_meta: add AVDOVIDataMapping.nlq_pivotsquietvoid2024-04-032-1/+2
| | | | | | | | | The NLQ pivots are not documented but should be present in the header for profile 7 RPU format. It has been verified using Dolby's verification toolkit. Signed-off-by: quietvoid <tcChlisop0@gmail.com> Signed-off-by: Niklas Haas <git@haasn.dev>
* avutil/internal: Move avpriv_set_systematic_pal2 decl to imgutils_internal.hAndreas Rheinhardt2024-03-313-4/+4
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Include hwcontext.hAndreas Rheinhardt2024-03-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | struct Foo * declares a new type (namely struct Foo) if there is no declaration of struct Foo already visible in the current scope; otherwise it is just a pointer to an element of the already declared type "struct Foo". There is a gotcha with the first case: struct Foo is only declared in its scope; a later declaration of struct Foo in an enclosing scope declares a different type. This happens in hwcontext_vulkan.h if it is included before hwcontext.h, because some declarations of struct AVHWDeviceContext and struct AVHWFramesContext have function prototype scope. Compilers warn about this (during checkheaders): ‘struct AVHWDeviceContext’ declared inside parameter list will not be visible outside of this definition or declaration Fix this by including hwcontext.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/internal: Move FF_MEMORY_POISON to its only userAndreas Rheinhardt2024-03-312-2/+2
| | | | | | Namely mem.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/internal: Move libm inclusion to the beginningAndreas Rheinhardt2024-03-311-2/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/arm/mpegvideo_arm: Use static_assert to check offsetsAndreas Rheinhardt2024-03-311-8/+0
| | | | | | | 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-3124-6/+29
| | | | | | | | | | | 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-311-5/+7
| | | | | | | 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-301-10/+20
| | | | | | | | 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-301-1/+1
| | | | | | | 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-282-4/+4
| | | | | | | | | | | | | | | | | | | | 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-281-0/+1
| | | | | 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-281-14/+15
| | | | | | | | | | | | | | | | 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-281-3/+7
| | | | | | | | | | | | | | | | | | 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-272-5/+0
| | | | | | | | 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-273-31/+78
| | | | They allow exporting extended information about side data types.
* Bump after 7.0 branch pointn7.1-devMichael Niedermayer2024-03-271-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Bump prior release/7.0 branchMichael Niedermayer2024-03-271-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/timecode: use 64bit for intermediate for rounding in ↵Michael Niedermayer2024-03-261-1/+1
| | | | | | | | | | 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-251-3/+1
| | | | | | | 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-254-1/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-251-0/+8
| | | | | | Otherwise it would not be lossless. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/hwcontext_qsv: Fix mixed declaration and codeAndreas Rheinhardt2024-03-251-2/+2
| | | | | 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-253-3/+3
| | | | Co-Authored-by: Dave Airlie <airlied@redhat.com>
* avutil/film_grain_params: remove do loop in CHECK macroLeo Izen2024-03-241-3/+1
| | | | | | | | 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-241-3/+0
| | | | | | 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-241-210/+462
| | | | | | 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-233-1/+73
| | | | | | | | 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-231-0/+4
| | | | | 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-231-2/+9
|
* avutil/film_grain_params: add metadata to common structNiklas Haas2024-03-232-4/+56
| | | | | | | | | | | | 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-221-2/+3
| | | | | | | | 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-222-6/+21
| | | | | | | | | | | | | | | | | | | 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-223-3/+3
| | | | | 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-201-1/+1
|
* avutil/frame: add helper for getting side data from arrayJan Ekström2024-03-202-5/+29
|
* avutil/frame: add helper for adding existing side data to arrayJan Ekström2024-03-202-0/+69
|
* avutil/frame: add helper for adding side data to arrayJan Ekström2024-03-204-0/+143
| | | | | 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-201-8/+16
| | | | 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-201-8/+17
|