summaryrefslogtreecommitdiff
path: root/libavutil
Commit message (Collapse)AuthorAge
...
* lavu/fixed_dsp: R-V V scalarproductRémi Denis-Courmont2023-10-07
|
* hwcontext_vulkan: properly support STORAGE usage for mutliplane imagesLynne2023-10-05
| | | | | | | | Fixes multiplane support on Nvidia. Also, remove the ENCODE usage, even if the driver signals it as supported. Currently, it's not used, and when it is used, it'll be gated behind two extension checks.
* lavu/float_dsp: avoid reg-stride in R-V V fmul_windowRémi Denis-Courmont2023-10-03
|
* avutil/tx_template: Fix some signed integer overflows in DECL_FFT5()Michael Niedermayer2023-10-03
| | | | | | | | Fixes: signed integer overflow: -1364715454 + -1468954671 cannot be represented in type 'int' Fixes: 62093/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5538774254485504 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavu/float_dsp: avoid reg-stride in R-V V reverse_fmulRémi Denis-Courmont2023-10-03
| | | | | | This revectors the inner loop to reverse vectors element in vectors, thus eliminating the negative register stride. Note that RVV does not have a vector reverse instruction, so this uses a gather.
* riscv: factor out the bswap32 assemblerRémi Denis-Courmont2023-10-02
|
* libavutil/hwcontext_cuda: don't destroy external context when using current ↵Roman Arzumanyan2023-09-29
| | | | | | CUDA context Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avutil: add GBRAP14 format supportPaul B Mahol2023-09-28
|
* avutil/hwcontext_cuda: add option to use current device contextRoman Arzumanyan2023-09-28
| | | | Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* Revert "lavu/timer: remove gratuitous volatile"Rémi Denis-Courmont2023-09-28
| | | | | | | | It does not make much sense to me, but GCC somehow optimises the inline assembler even though the output is very obviously used and having observable side effects. This reverts commit 09731fbfc3a914ec4f6ffad60aa9062db6a8f6aa.
* avutil/avutil: make AV_TIME_BASE_Q available in C++Zhao Zhili2023-09-19
| | | | | | | | | | | | | | | | | | | | | | | | ISO C++ forbids compound-literals. It's not available with MSVC. This is a known issue from 10 years ago, and that's why there is a av_get_time_base_q(). Since we have no plan to remove AV_TIME_BASE_Q, just make it available in C++. There are multiple choices: 1. Use C++11 syntax: AVRational{1, AV_TIME_BASE} Users may still use C++98 to write new code. So no. 2. Use av_get_time_base_q(). It's for this purpose. But it's not compile time constants as AV_TIME_BASE_Q in C. So I choose av_make_q() as Anton's suggestion. https://libav-devel.libav.narkive.com/ZQCWfTun/patch-0-2-fix-avutil-h-usage-from-c Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/hwcontext_vulkan: CosmeticsAndreas Rheinhardt2023-09-15
| | | | | | | | | The alignment in vulkan_unmap_from_drm() (formerly the clone of vulkan_frame_free()) is nicer than the in vulkan_frame_free(), let's preserve it. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Deduplicate codeAndreas Rheinhardt2023-09-15
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Improve type-safetyAndreas Rheinhardt2023-09-15
| | | | | | | | | | | | | | | The AVBuffer API uses uint8_t as base type for buffers and therefore its free callbacks need to abide by this. Therefore vulkan_frame_free() used an inappropriate signature which caused casts whenever this function has been called manually. This commit changes this by making vulkan_frame_free() use the proper type and a vulkan_frame_free_cb() that is used as free callback for the AVBuffer API. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Remove redundant resettingAndreas Rheinhardt2023-09-15
| | | | | | | | vulkan_free_internal() already resets the AVVkFrame.internal pointer. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libaribb24,ttmlenc, avutil/tx: Remove redundant init of AVBPrintAndreas Rheinhardt2023-09-14
| | | | | | | | | An AVBPrint is initialized via av_bprint_init() (or av_bprint_init_for_buffer()) which expects uninitialized AVBPrints; it is therefore not necessary to zero them before the actual initialization. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/imgutils: Add wrapper for av_image_copy() to avoid castsAndreas Rheinhardt2023-09-12
| | | | | | | | | | | | av_image_copy() accepts const uint8_t* const * as source; lots of user have uint8_t* const * and therefore either cast (the majority) or copy the array of pointers. This commit changes this by adding a static inline wrapper for av_image_copy() that casts between the two types so that we do not need to add casts everywhere else. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/fifo: Constify AVFifo pointees in peek functionsAndreas Rheinhardt2023-09-12
| | | | | | They do not modify the AVFifo state. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/audio_fifo: Constify some pointeesAndreas Rheinhardt2023-09-12
| | | | | | | Also constify AVAudioFifo* in the peek functions besides constifying intermediate pointers (void**->void * const *). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/samplefmt: Constify some pointeesAndreas Rheinhardt2023-09-12
| | | | | | | This is the samplefmt analog of the imgutils changes from the preceding commit. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/imgutils: Constify some pointeesAndreas Rheinhardt2023-09-12
| | | | | | | | This is done immediately without waiting for the next major bump just as in 9546b3a1cbcd94e9107f85c8f1d2175efc6cf083 and 4eaaa38d3dfb8863a62f3646a62e4098b1c078d5. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: Use av_frame_replace() where appropriateAndreas Rheinhardt2023-09-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/tx: add missing prints for the type of dctI/dstILynne2023-09-08
|
* avutil/avstring: Remove obsolete version.h inclusionAndreas Rheinhardt2023-09-07
| | | | | | Forgotten in 30e1e7e0f324d7bf66b3b8583a3e49fd3cd101b2. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/mem: Don't include avutil.hAndreas Rheinhardt2023-09-07
| | | | | | | | | It is not necessary at all. So remove it. This also breaks an inclusion cycle mem.h->avutil.h->common.h->mem.h. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil: Move error.h from avutil.h to common.hAndreas Rheinhardt2023-09-07
| | | | | | | | | | | | Up until now, avutil.h includes common.h which includes mem.h which includes avutil.h, so that all these headers are in fact equivalent. Yet mem.h does not need to include avutil.h at all and when it no longer does, including common.h will no longer include error.h (included by avutil.h) as well; change this by moving error.h to avutil.h, as error.h is clearly a commonly used header. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/avstring: fix typo in av_strireplace function doxyStefano Sabatini2023-09-06
|
* avutil/internal: Don't auto-include emms.hAndreas Rheinhardt2023-09-04
| | | | | | Instead include emms.h wherever it is needed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil: add thread executorNuo Mi2023-09-02
| | | | | | | | | | The executor design pattern was introduced by java <https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/util/concurrent/Executor.html> it also adapted by python <https://docs.python.org/3/library/concurrent.futures.html> Compared to handcrafted thread pool management, it greatly simplifies the thread code. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavu/tx: fix scaling of R2R transformsLynne2023-09-01
| | | | Still slightly inaccurate, but it's good enough now.
* lavu/tx: improve rdft table generation precision slightlyLynne2023-09-01
|
* lavu/tx: add DCT-I and DST-I transformsLynne2023-09-01
| | | | | These are true, actual DCT-I and DST-I transforms, unlike the libavcodec versions, which are plainly not.
* lavu/tx: add real to real and real to imaginary RDFT transformsLynne2023-09-01
| | | | | | | These are in-place transforms, required for DCT-I and DST-I. Templated as the mod2 variant requires minor modifications, and is required specifically for DCT-I/DST-I.
* vulkan: do not leak bound_buffer_indicesLynne2023-08-28
|
* vulkan: check for extension rather than function pointerLynne2023-08-28
| | | | | | | | | The loader ensures only that functions with tagged supported extensions exist, rather than ensuring only those with supported extensions are loaded. As the init function uses Vulkan functions, whose loading requires them to have the extension flags set, the extension flags are guaranteed to also exist at this point.
* vulkan: do not leak cooperative matrix propertiesLynne2023-08-28
|
* vulkan: enable VK_KHR_cooperative_matrixLynne2023-08-26
| | | | | It's of interest to API users, and of interest to us, as a DCT/DST can be implemented via matrix multiplies.
* lavu/timer: specify RISC-V time unitRémi Denis-Courmont2023-08-24
|
* lavu/timer: remove gratuitous volatileRémi Denis-Courmont2023-08-24
| | | | AV_READ_TIME has no side effects. It does not need to be volatile.
* lavu/timer: use time for AV_READ_TIME on RISC-VRémi Denis-Courmont2023-08-24
| | | | | | | | | | | | | | | So far, AV_READ_TIME would return the cycle counter. This posed two problems: 1) On recent systems, it would just raise an illegal instruction exception. Indeed RDCYCLE is blocked in user space to ward off some side channel attacks. In particular, this would cause the random number generator to crash. 2) It does not match the x86 behaviour and the apparent original intent of AV_READ_TIME in the functional code base (outside test cases). So this replaces the cycle counter with the time counter. The unit is a platform-dependent constant fraction of time, and the value should be stable across harts (RISC-V lingo for physical CPU thread).
* hwcontext_vulkan: always use create_pnext in vulkan_pool_allocChris Spencer2023-08-20
| | | | | | | | | | | | | Currently, create_pnext is only used if an applicable external memory extension is enabled. This will usually the case when used from the command line, but may not be when the Vulkan context is created manually. For images used in video decoding, create_pnext contains the video profile list, which is mandatory.[1] This fixes a GPU crash when using RADV. [1] https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkImageCreateInfo.html#VUID-VkImageCreateInfo-usage-04815 Signed-off-by: Chris Spencer <spencercw@gmail.com>
* avutil/thread: add wrappers for pthread_cond_t functionsJames Almer2023-08-19
| | | | | | | | This abstraction is similar to the existing one for pthread_mutex_t and pthread_once_t functions, and should reduce the amount of ifdeffery used in future code. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: make pre-defined channel layouts C++ friendlyZhao Zhili2023-08-18
| | | | | | | | | | | | C++ doesn't support designated initializers until C++20. We have a bunch of pre-defined channel layouts, the gains to make them usable in C++ exceed the losses. Bump minor version so C++ project can check before use these defines. Also initialize .opaque field explicitly to reduce warning in C++. Signed-off-by: James Almer <jamrial@gmail.com>
* lavu/hwcontext_vaapi: Add vaapi_drm_format_map support for x2rgb10David Rosca2023-08-17
| | | | | Support for allocating frames with x2rgb10 format was added in c00264f5013, this adds support for importing DMA-BUFs.
* configure: Set WIN32_LEAN_AND_MEAN at configure timeL. E. Segovia2023-08-14
| | | | | | | | | | | | | Including winsock2.h or windows.h without WIN32_LEAN_AND_MEAN cause bzlib.h to parse as nonsense, due to an instance of #define char small in rpcndr.h. See: https://stackoverflow.com/a/27794577 Signed-off-by: L. E. Segovia <amy@amyspark.me> Signed-off-by: Martin Storsjö <martin@martin.st>
* avutil/tests/channel_layout: Test av_channel_layout_copy()Andreas Rheinhardt2023-08-10
| | | | | | | | | | Specifically, test copying a channel layout with custom order, so that the allocation codepath of av_channel_layout_copy() is executed. Reviewed-by: Nicolas George <george@nsup.org> Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/tests/channel_layout: Don't include lavu/channel_layout.cAndreas Rheinhardt2023-08-10
| | | | | | | | | This test does not need access to the internals of said compilation unit. Reviewed-by: Nicolas George <george@nsup.org> Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/tests/channel_layout: Also test non-AVBPrint variantsAndreas Rheinhardt2023-08-10
| | | | | | Reviewed-by: Nicolas George <george@nsup.org> Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/channel_layout: Account for \0 in sizesAndreas Rheinhardt2023-08-10
| | | | | | | | | | | | | | | | | | | av_channel_name(), av_channel_description() and av_channel_layout_describe() are supposed to return the size of the needed buffer to allow the user to check for truncation; the documentation ("If the returned value is bigger than buf_size, then the string was truncated.") confirms that size does not mean strlen. Yet the AVBPrint API, i.e. AVBPrint.len, does not account for the terminating '\0'. Therefore the returned length is off by one. Furthermore, also check for whether the returned value actually fits in an int (which is the return value of these functions). Reviewed-by: Nicolas George <george@nsup.org> Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/bprint: Allow size == 0 in av_bprint_init_for_buffer()Andreas Rheinhardt2023-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The AVBPrint API guarantees that the string buffer is always zero-terminated; in order to honour this guarantee, there obviously must be a string buffer at all and it must have a size >= 1. Therefore av_bprint_init_for_buffer() treats passing a NULL buffer or size == 0 as invalid data that leads to undefined behaviour, namely NPD in case NULL is provided or a write to a buffer of size 0 in case size == 0. But it would be easy to support this, namely by using the internal buffer with AV_BPRINT_SIZE_COUNT_ONLY in case size == 0. There is a reason to allow this: Several functions like av_channel_(description|name) are actually wrappers around corresponding AVBPrint functions. They accept user provided buffers and are supposed to return the required size of the buffer, which would allow the user to call it once to get the required buffer size and call it once more after having allocated the buffer. If av_bprint_init_for_buffer() treats size == 0 as invalid, all these users would need to check for this themselves and basically add the same codeblock that this patch adds to av_bprint_init_for_buffer(). This change is in line with e.g. snprintf() which also allows the pointer to be NULL in case size is zero. This fixes Coverity issues #1503074, #1503076 and #1503082; all of these issues are about providing NULL to the channel-layout functions that are wrappers around AVBPrint versions. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>