summaryrefslogtreecommitdiff
path: root/libavutil
Commit message (Collapse)AuthorAge
* lavu/checkasm: add (private) kperf timing for macOSJ. Dekker2021-07-20
| | | | Signed-off-by: J. Dekker <jdek@itanimul.li>
* lavu/cpu: Use av_cpu_ prefixThilo Borgmann2021-07-20
|
* avutil/hwcontext_videotoolbox: implement hwupload to convert AVFrame to ↵Aman Karmani2021-07-18
| | | | | | | | | | | | CVPixelBuffer Teach AV_HWDEVICE_TYPE_VIDEOTOOLBOX to be able to create AVFrames of type AV_PIX_FMT_VIDEOTOOLBOX. This can be used to hwupload a regular AVFrame into its CVPixelBuffer equivalent. ffmpeg -init_hw_device videotoolbox -f lavfi -i color=black:640x480 -vf hwupload -c:v h264_videotoolbox -f null -y /dev/null Signed-off-by: Aman Karmani <aman@tmm1.net>
* x86/tx_float: correctly load the transform lengthLynne2021-07-18
| | | | | | | | The field is a standard field, yet we were loading it as if it was a quadword. This worked for forward transforms by chance, but broke when the transform was inverse. checkasm couldn't catch that because we only test forward transforms, which are identical to inverse transforms but with a different revtab.
* lavu/cpu.c: Add av_force_cpu_count() to override auto-detection.Thilo Borgmann2021-07-16
|
* avutil/tx: avoid negative left shiftsMichael Niedermayer2021-06-18
| | | | | | | | Fixes: left shift of negative value -1 Fixes: 33736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SIREN_fuzzer-6657785795313664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/samplefmt: don't add offsets to NULL pointersJames Almer2021-06-13
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/samplefmt: remove outdated commentJames Almer2021-06-13
| | | | | | | av_samples_fill_arrays() has been returning the minimum required buffer size for a while now. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/tests/audio_ffio: add missing headerMatthieu Patou2021-06-13
| | | | | | | Needed for HAVE_BIGENDIAN Suggested-by: ffmpeg@fb.com Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/tests/lzo: remove timer macrosJames Almer2021-06-13
| | | | | Suggested-by: ffmpeg@fb.com Signed-off-by: James Almer <jamrial@gmail.com>
* lavu/mem: un-inline av_size_mult()Anton Khirnov2021-06-11
| | | | There seems to be no compelling reason for it to be inline.
* lavu/video_enc_params: make sure blocks are properly alignedAnton Khirnov2021-06-10
|
* hwcontext_vulkan: fix typo in vulkan_device_init()Lynne2021-06-10
| | | | load_functions() did not load the device-level functions.
* avutil/opt: Check directly for av_dict_copy() failureAndreas Rheinhardt2021-06-08
| | | | | | av_dict_copy() returned void when this code was written. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavcodec/mips: Fix build errors reported by clangJin Bo2021-06-03
| | | | | | | | | | Clang is more strict on the type of asm operands, float or double type variable should use constraint 'f', integer variable should use constraint 'r'. Signed-off-by: Jin Bo <jinbo@loongson.cn> Reviewed-by: yinshiyou-hf@loongson.cn Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* pixfmt: fixed wrong fix of commentValerii Zapodovnikov2021-06-02
| | | | | | | | | | | | This mostly reverts 785bfb1d7bb8de567c3aac1d9cc369b55ac9fb7b. But I also added some clarifications so that nobody mixes primaries with matrix again. SMPTE 240 and 170 primaires are the same, while matrix coeff. are different, because 240 is derived from 170's new primaries and white point while 170 uses BT.601 derived from BT.470 System M (yes, with Illuminant C) a.k.a. NTSC 1953. Some nits too. Reviewed-by: Reto Kromer <lists@reto.ch> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/mem: use GCC builtins to check for overflow in av_size_mult()James Almer2021-05-31
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/mem: check for max_alloc_size in av_fast_malloc()James Almer2021-05-27
| | | | | | This puts av_fast_malloc*() in line with av_fast_realloc(). Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/mem: make ff_fast_malloc() internal to mem.cJames Almer2021-05-27
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/mem: make max_alloc_size an atomic typeJames Almer2021-05-23
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/imgutils: don't add offsets to NULL pointersJames Almer2021-05-12
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* mips: Fix potential illegal instruction error.Shiyou Yin2021-05-07
| | | | | | | | MSA2 optimizations are attached to MSA macros in generic_macros_msa.h. It's difficult to do runtime check for them. Remove this part of code can make it more robust. H264 1080p decoding: 5.13x==>5.12x. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/mem: Also poison new av_realloc-allocated blocksAndreas Rheinhardt2021-04-30
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* hwcontext_vulkan: dlopen libvulkanLynne2021-04-30
| | | | | | | | | | | | While Vulkan itself went more or less the way it was expected to go, libvulkan didn't quite solve all of the opengl loader issues. It's multi-vendor, yes, but unfortunately, the code is Google/Khronos QUALITY, so suffers from big static linking issues (static linking on anything but OSX is unsupported), has bugs, and due to the prefix system used, there are 3 or so ways to type out functions. Just solve all of those problems by dlopening it. We even have nice emulation for it on Windows.
* hwcontext_vulkan: dynamically load functionsLynne2021-04-30
| | | | This patch allows for alternative loader implementations.
* avutil/hwcontext_vulkan: fix format specifiers for some printed variablesJames Almer2021-04-29
| | | | | | | | | | VkPhysicalDeviceLimits.optimalBufferCopyRowPitchAlignment and VkPhysicalDeviceExternalMemoryHostPropertiesEXT.minImportedHostPointerAlignment are of type VkDeviceSize (a typedef uint64_t). VkPhysicalDeviceLimits.minMemoryMapAlignment is of type size_t. Signed-off-by: James Almer <jamrial@gmail.com> Reviewed-by: Lynne <dev@lynne.ee>
* hwcontext_vulkan: reorder structure fields and add spaces in betweenLynne2021-04-28
| | | | We're in the middle of an ABI unstable period, so we're allowed to.
* Bump major versions of all libraries.Anton Khirnov2021-04-27
| | | | | Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil: remove deprecated AVClass.child_class_nextJames Almer2021-04-27
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/cpu: Remove deprecated functionsAndreas Rheinhardt2021-04-27
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/buffer: Switch AVBuffer API to size_tAndreas Rheinhardt2021-04-27
| | | | | | | Announced in 14040a1d913794d9a3fd6406a6d8c2f0e37e0062. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/pixdesc: Remove deprecated AV_PIX_FMT_FLAG_PSEUDOPALAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in d6fc031caf64eed921bbdef86d79d56bfc2633b0. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: Remove deprecated getters and settersAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in 7df37dd319f2d9d3e1becd5d433884e3ccfa1ee2. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil: Switch crypto APIs to size_tAndreas Rheinhardt2021-04-27
| | | | | | | Announced in e435beb1ea5380a90774dbf51fdc8c941e486551. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: Remove deprecated AVFrame.pkt_pts fieldAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in 32c8359093d1ff4f45ed19518b449b3ac3769d27. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: Remove deprecated AVFrame.errorAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in 1aa24df74c052a73175c43e57d35b4835e537ec8. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/pixdesc: Remove deprecated off-by-one fields from pix fmt descsAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in 2268db2cd052674fde55c7d48b7a5098ce89b4ba. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: Remove AVFrame QP table APIAndreas Rheinhardt2021-04-27
| | | | | | | | Originally deprecated in 1296b1f6c0631ab79464e22d48a6a1548450b943; scheduled again for removal in a9915268327b097bba84a07f68968d8c07f4b549. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/pixfmt: Remove deprecated VAAPI pixel formatsAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in 9f8e57efe4400ca86352277873792792279c3b15. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* x86/tx_float: remove ff_ prefix from external constant tablesJames Almer2021-04-25
| | | | | | | Fixes compilation with some assemblers. Reviewed-by: Lynne Signed-off-by: James Almer <jamrial@gmail.com>
* x86/tx_float: fix forgotten 2-argument mulpsLynne2021-04-24
| | | | Yasm *really* cannot deal with any omitted arguments at all.
* x86/tx_float: use all arguments on vperm2f and vpermilps and reindent commentsLynne2021-04-24
| | | | Apparently even old nasm isn't required to accept incomplete instructions.
* x86/tx_float: Fixes compilation with old yasmJames Almer2021-04-24
| | | | | | | Use three operand format on some instructions, and lea to load effective addresses of tables. Signed-off-by: James Almer <jamrial@gmail.com>
* lavu/x86/tx_float: fix FMA3 implying AVX2 is availableLynne2021-04-24
| | | | It's the other way around - AVX2 implies FMA3 is available.
* lavu/x86: add FFT assemblyLynne2021-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a pure x86 assembly SIMD version of the FFT in libavutil/tx. The design of this pure assembly FFT is pretty unconventional. On the lowest level, instead of splitting the complex numbers into real and imaginary parts, we keep complex numbers together but split them in terms of parity. This saves a number of shuffles in each transform, but more importantly, it splits each transform into two independent paths, which we process using separate registers in parallel. This allows us to keep all units saturated and lets us use all available registers to avoid dependencies. Moreover, it allows us to double the granularity of our per-load permutation, skipping many expensive lookups and allowing us to use just 4 loads per register, rather than 8, or in case FMA3 (and by extension, AVX2), use the vgatherdpd instruction, which is at least as fast as 4 separate loads on old hardware, and quite a bit faster on modern CPUs). Higher up, we go for a bottom-up construction of large transforms, foregoing the traditional per-transform call-return recursion chains. Instead, we always start at the bottom-most basis transform (in this case, a 32-point transform), and continue constructing larger and larger transforms until we return to the top-most transform. This way, we only touch the stack 3 times per a complete target transform: once for the 1/2 length transform and two times for the 1/4 length transform. The combination algorithm we use is a standard Split-Radix algorithm, as used in our C code. Although a version with less operations exists (Steven G. Johnson and Matteo Frigo's "A modified split-radix FFT with fewer arithmetic operations", IEEE Trans. Signal Process. 55 (1), 111–119 (2007), which is the one FFTW uses), it only has 2% less operations and requires at least 4x the binary code (due to it needing 4 different paths to do a single transform). That version also has other issues which prevent it from being implemented with SIMD code as efficiently, which makes it lose the marginal gains it offered, and cannot be performed bottom-up, requiring many recursive call-return chains, whose overhead adds up. We go through a lot of effort to minimize load/stores by keeping as much in registers in between construcring transforms. This saves us around 32 cycles, on paper, but in reality a lot more due to load/store aliasing (a load from a memory location cannot be issued while there's a store pending, and there are only so many (2 for Zen 3) load/store units in a CPU). Also, we interleave coefficients during the last stage to save on a store+load per register. Each of the smallest, basis transforms (4, 8 and 16-point in our case) has been extremely optimized. Our 8-point transform is barely 20 instructions in total, beating our old implementation 8-point transform by 1 instruction. Our 2x8-point transform is 23 instructions, beating our old implementation by 6 instruction and needing 50% less cycles. Our 16-point transform's combination code takes slightly more instructions than our old implementation, but makes up for it by requiring a lot less arithmetic operations. Overall, the transform was optimized for the timings of Zen 3, which at the time of writing has the most IPC from all documented CPUs. Shuffles were preferred over arithmetic operations due to their 1/0.5 latency/throughput. On average, this code is 30% faster than our old libavcodec implementation. It's able to trade blows with the previously-untouchable FFTW on small transforms, and due to its tiny size and better prediction, outdoes FFTW on larger transforms by 11% on the largest currently supported size.
* checkasm: add av_tx FFT SIMD testing codeLynne2021-04-24
| | | | | | This sadly required making changes to the code itself, due to the same context needing to be reused for both versions. The lookup table had to be duplicated for both versions.
* lavu/tx: add parity revtab generator versionLynne2021-04-24
| | | | This will be used for SIMD support.
* lavu: bump minor and add APIchanges entry for the lavu/tx changesLynne2021-04-24
|
* lavu/tx: add full-sized iMDCT transform flagLynne2021-04-24
|
* lavu/tx: add unaligned flag to the APILynne2021-04-24
|