summaryrefslogtreecommitdiff
path: root/libavutil
Commit message (Collapse)AuthorAge
* Bump minor versions after release branchMichael Niedermayer2021-03-20
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Bump Versions before release/4.4 branchMichael Niedermayer2021-03-20
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/adler32: Switch av_adler32_update() to size_t on bumpAndreas Rheinhardt2021-03-19
| | | | | | | | | | av_adler32_update() is used by av_hash_update() which will be switched to size_t at the next bump. So it also has to be made to use size_t. This is also necessary for framecrcenc.c, because the size of side data will become a size_t, too. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avutil/avstring: Check for memory allocation error in av_escapeAndreas Rheinhardt2021-03-15
| | | | | | | | av_bprint_finalize() can still fail even when it has been checked that the AVBPrint is currently complete: Namely if the string was so short that it fit into the AVBPrint's internal buffer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avutil/avstring: Limit string length in av_escape to range of intAndreas Rheinhardt2021-03-15
| | | | | | Otherwise the caller can't distinguish the return value from an error. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avutil/timecode: Avoid fps overflowMichael Niedermayer2021-03-14
| | | | | | | | Fixes: Integer overflow and division by 0 Fixes: poc-202102-div.mov Found-by: 1vanChen of NSFOCUS Security Team Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavutil/timer: Fix clang reserved-user-defined-literalChristopher Degawa2021-03-13
| | | | | | | | clang errors when compiling with C++11 about needing spaces between literal and identifier Signed-off-by: Christopher Degawa <ccom@randomderp.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/buffer_internal: Include internal for buffer_size_tAndreas Rheinhardt2021-03-11
| | | | | | | Fixes checkheaders. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avutil: use the buffer_size_t typedef where requiredJames Almer2021-03-10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: change av_frame_new_side_data() size parameter type to size_tJames Almer2021-03-10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/buffer: change public function and struct size parameter types to size_tJames Almer2021-03-10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/{avstring,bprint}: add XML escaping from ffprobe to avutilStefano Sabatini2021-03-05
| | | | | | | | | | Base escaping only escapes values required for base character data according to part 2.4 of XML, and if additional flags are added single and double quotes can additionally be escaped in order to handle single and double quoted attributes. Co-authored-by: Jan Ekström <jan.ekstrom@24i.com> Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avutil/parseutils: Check sign in av_parse_time()Michael Niedermayer2021-03-03
| | | | | | | | Fixes: signed integer overflow: -9223372053736 * 1000000 cannot be represented in type 'long' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-6607924558430208 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/spherical: Use av_strstart instead of strncmpAndreas Rheinhardt2021-02-28
| | | | | | | It makes the intent clearer and avoids calculating the length separately. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avutil/stereo3d: Use av_strstart instead of strncmpAndreas Rheinhardt2021-02-28
| | | | | | | It makes the intent clearer and avoids calculating the length separately. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avutil/pixdesc: Use av_strstart where appropriateAndreas Rheinhardt2021-02-28
| | | | | | | It makes the intent clearer and allows to avoid calculating the strlen separately. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavu/tx: do not invert permutes on MDCTsLynne2021-02-27
|
* lavu/tx: invert permutation lookupsLynne2021-02-27
| | | | | | | | | | | | | out[lut[i]] = in[i] lookups were 4.04 times(!) slower than out[i] = in[lut[i]] lookups for an out-of-place FFT of length 4096. The permutes remain unchanged for anything but out-of-place monolithic FFT, as those benefit quite a lot from the current order (it means there's only 1 lookup necessary to add to an offset, rather than a full gather). The code was based around non-power-of-two FFTs, so this wasn't benchmarked early on.
* lavu/tx: simplify in-place permute search functionLynne2021-02-27
|
* lavu/tx: require output argument to match input for inplace transformsLynne2021-02-26
| | | | | This simplifies some assembly code by a lot, by either saving a branch or saving an entire duplicated function.
* avutil/buffer: free all pooled buffers immediately after uninitializing the poolJames Almer2021-02-24
| | | | | | | | | | | | | No buffer will be fetched from the pool after it's uninitialized, so there's no benefit from waiting until every single buffer has been returned to it before freeing them all. This should free some memory in certain scenarios, which can be beneficial in low memory systems. Based on a patch by Jonas Karlman. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/tx: Fix declaration after statementAndreas Rheinhardt2021-02-22
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* arm/aarch64: Use mach_absolute_time as timer on apple platformsMartin Storsjö2021-02-21
| | | | | | | | | This is much less precise than the cycle counter register, but the cycle counter register is not available on apple platforms (and on linux, it requires a kernel module for allowing user mode access). Signed-off-by: Martin Storsjö <martin@martin.st>
* lavu/tx: support in-place FFT transformsLynne2021-02-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds support for in-place FFT transforms. Since our internal transforms were all in-place anyway, this only changes the permutation on the input. Unfortunately, research papers were of no help here. All focused on dry hardware implementations, where permutes are free, or on software implementations where binary bloat is of no concern so storing dozen times the transforms for each permutation and version is not considered bad practice. Still, for a pure C implementation, it's only around 28% slower than the multi-megabyte FFTW3 in unaligned mode. Unlike a closed permutation like with PFA, split-radix FFT bit-reversals contain multiple NOPs, multiple simple swaps, and a few chained swaps, so regular single-loop single-state permute loops were not possible. Instead, we filter out parts of the input indices which are redundant. This allows for a single branch, and with some clever AVX512 asm, could possibly be SIMD'd without refactoring. The inplace_idx array is guaranteed to never be larger than the revtab array, and in practice only requires around log2(len) entries. The power-of-two MDCTs can be done in-place as well. And it's possible to eliminate a copy in the compound MDCTs too, however it'll be slower than doing them out of place, and we'd need to dirty the input array.
* lavu/tx: space out enum AVTXType values with newlinesLynne2021-02-21
| | | | Makes separation clearer.
* avutil/video_enc_params: Check for truncation before creating bufferAndreas Rheinhardt2021-02-19
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avutil/video_enc_params: Combine overflow checksAndreas Rheinhardt2021-02-19
| | | | | | | | | | | This patch also fixes a -Wtautological-constant-out-of-range-compare warning from Clang and a -Wtype-limits warning from GCC on systems where size_t is 64bits and unsigned 32bits. The reason for this seems to be that variable (whose value derives from sizeof() and can therefore be known at compile-time) is used instead of using sizeof() directly in the comparison. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avutil/common: Move everything inside inclusion guardsAndreas Rheinhardt2021-02-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libavutil/common.h is a public header that provides generic math functions whereas libavutil/intmath.h is a private header that contains plattform-specific optimized versions of said math functions. common.h includes intmath.h (when building the FFmpeg libraries) so that the optimized versions are used for them. This interdependency sometimes causes trouble: intmath.h once contained an inlined ff_sqrt function that relied upon av_log2_16bit. In case there was no optimized logarithm available on this plattform, intmath.h needed to include common.h to get the generic implementation and this has been done after the optimized versions (if any) have been provided so that common.h used the optimized versions; it also needed to be done before ff_sqrt. Yet when intmath.h was included from common.h and if an ordinary inclusion guard was used by common.h, the #include "common.h" in intmath.h was a no-op and therefore av_log2_16bit was still unknown at the end of intmath.h (and also in ff_sqrt) if no optimized version was available. Before a955b5965825631986ba854d007d4e934e466c7d this was solved by duplicating the #ifndef av_log2_16bit check after the inclusion of common.h in intmath.h; said commit instead moved these checks to the end of common.h, outside the inclusion guards and made common.h include itself to get these unguarded defines. This is still the current state of affairs. Yet this is unnecessary since 9734b8ba56d05e970c353dfd5baafa43fdb08024 as said commit removed ff_sqrt as well as the #include "common.h" from intmath.h. Therefore this commit moves everything inside the inclusion guards and makes common.h not include itself. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avutil/mathematics: Fix undefined negation in av_compare_ts()Michael Niedermayer2021-02-10
| | | | | | | | Fixes: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself Fixes: 29437/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4748510022991872 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavutil/common: Add FFABS64U()Michael Niedermayer2021-02-10
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavutil/eval: Remove CONFIG_TRAPV special handlingMichael Niedermayer2021-02-10
| | | | | | | | Fixes: division by zero Fixes: 29555/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVO_fuzzer-5149951447400448 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavutil/frame.h: correct typo for AVFilmGrainParams in commentGuo, Yejun2021-01-27
|
* avutil/common: Add FFABSU() for a signed -> unsigned ABSMichael Niedermayer2021-01-26
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Revert "avutil/timecode: fix sscanf format string with garbage at the end"Marton Balint2021-01-23
| | | | | | | | | This reverts commit 6696a07ac62bfec49dd488510a719367918b9f7a. It is wrong to restrict timecodes to always contain leading zeros or for hours or frames to be 2 chars only. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutils/vulkan: hwmap, respect src frame resolutionXu Guangxin2021-01-22
| | | | | | | | | | | | | fixes http://trac.ffmpeg.org/ticket/9055 The hw decoder may allocate a large frame from AVHWFramesContext, and adjust width and height based on bitstream. We need to use resolution from src frame instead of AVHWFramesContext. test command: ffmpeg -loglevel debug -hide_banner -hwaccel vaapi -init_hw_device vaapi=va:/dev/dri/renderD128 -hwaccel_device va -hwaccel_output_format vaapi -init_hw_device vulkan=vulk -filter_hw_device vulk -i 1920x1080.264 -c:v libx264 -r:v 30 -profile:v high -preset veryfast -vf "hwmap,chromaber_vulkan=0:0,hwdownload,format=nv12" -map 0 -y vaapiouts.mkv expected: No green bar at bottom.
* All: update names in copyright headersrcombs2021-01-20
|
* avutil/timecode: Avoid undefined behavior with large framenumMichael Niedermayer2021-01-19
| | | | | | | | Fixes: signed integer overflow: 2147462079 + 2149596 cannot be represented in type 'int' Fixes: 27565/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5091972813160448 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/timecode: fix sscanf format string with garbage at the endLimin Wang2021-01-16
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avutil/tx: use ENOSYS instead of ENOTSUPJames Almer2021-01-13
| | | | | | | It's the standard error code used across the codebase to signal unimplemented or unsupported features. Signed-off-by: James Almer <jamrial@gmail.com>
* lavu: support arbitrary-point FFTs and all even (i)MDCT transformsLynne2021-01-13
| | | | | | | | | This patch adds support for arbitrary-point FFTs and all even MDCT transforms. Odd MDCTs are not supported yet as they're based on the DCT-II and DCT-III and they're very niche. With this we can now write tests.
* avutil/eval: Unconditionally check argument of e_divMichael Niedermayer2021-01-11
| | | | | | | | Fixes: division by zero Fixes: 26451/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVO_fuzzer-4756955832516608 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavu/tx: clip when converting table values to fixed-pointLynne2021-01-09
| | | | | | | | | | | | | | | | | | INT32_MAX (2147483647) isn't exactly representable by a floating point value, with the closest being 2147483648.0. So when rescaling a value of 1.0, this could overflow when casting the 64-bit value returned from lrintf() into 32 bits. Unfortunately the properties of integer overflows don't match up well with how a Fourier Transform operates. So clip the value before casting to a 32-bit int. Should be noted we don't have overflows with the table values we're currently using. However, converting a Kaiser-Bessel window function with a length of 256 and a parameter of 5.0 to fixed point did create overflows. So this is more of insurance to save debugging time in case something changes in the future. The macro is only used during init, so it being a little slower is not a problem.
* Mark some pointers as constAndreas Rheinhardt2021-01-01
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* mpegvideo: use the AVVideoEncParams API for exporting QP tablesAnton Khirnov2021-01-01
| | | | | | | | | | Do it only when requested with the AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS flag. Drop previous code using the long-deprecated AV_FRAME_DATA_QP_TABLE* API. Temporarily disable fate-filter-pp, fate-filter-pp7, fate-filter-spp. They will be reenabled once these filters are converted in following commits.
* lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bumpAnton Khirnov2021-01-01
| | | | They are not properly namespaced and not intended for public use.
* lavu: move LOCAL_ALIGNED from internal.h to mem_internal.hAnton Khirnov2021-01-01
| | | | That is a more appropriate place for it.
* hwcontext_drm: make dependency on Linux kernel headers optionalLynne2020-12-30
| | | | | | | | | | This was introduced in version 4.6. And may not exist all without an optional package. So to prevent a hard dependency on needing the Linux kernel headers to compile, make this optional. Also ignore the status of the ioctl, since it may fail on older kernels which don't support it. It's okay to ignore as its not fatal and any serious errors will be caught later by the mmap call.
* lavu: use address-of operator checking clock_gettimeMarvin Scholz2020-12-28
| | | | | | | | | | | | When targeting a recent enough macOS/iOS version that has clock_gettime it won't be a weak symbol, in which case clang warns for this check as it's always true: warning: address of function 'clock_gettime' will always evaluate to 'true' This warning is silenced by using the address-of operator to make the intent explicit.
* hwcontext_vulkan: wait and signal semaphores when transferring to CUDALynne2020-12-05
| | | | | Same as when downloading. Not sure why this isn't done, probably because the CUDA code predates the sync mechanism we settled on.
* avutil/opt: add AV_OPT_FLAG_DEPRECATED optionLimin Wang2020-12-05
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>