aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* x86/tx_float: remove ff_ prefix from external constant tablesJames Almer2021-04-251-20/+20
| | | | | | | Fixes compilation with some assemblers. Reviewed-by: Lynne Signed-off-by: James Almer <jamrial@gmail.com>
* libavformat/adtsenc: Increase ADTS_MAX_FRAME_BYTES from 8k to 16kChris Ribble2021-04-251-1/+1
| | | | | | | ADTS frames may contain up to 768 bytes per channel. With 16 channels, this is 12k, which cannot fit into the maximum 8k buffer. Signed-off-by: Chris Ribble <chris.ribble@resi.io>
* avcodec/mjpegdec: postpone calling ff_get_buffer() until the SOS markerJames Almer2021-04-255-39/+56
| | | | | | | | | | | | | | | With JPEG-LS PAL8 samples, the JPEG-LS extension parameters signaled with the LSE marker show up after SOF but before SOS. For those, the pixel format chosen by get_format() in SOF is GRAY8, and then replaced by PAL8 in LSE. This has not been an issue given both pixel formats allocate the second data plane for the palette, but after the upcoming soname bump, GRAY8 will no longer do that. This will result in segfauls when ff_jpegls_decode_lse() attempts to write the palette on a buffer originally allocated as a GRAY8 one. Work around this by calling ff_get_buffer() after the actual pixel format is known. Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/af_adelay: make per channel delay argument an int64_tJames Almer2021-04-251-4/+9
| | | | | | Should fix ticket #9196 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/adpcm: init from extradata before setting sample formatsZane van Iperen2021-04-251-2/+2
| | | | | | | | | Fixes a crash when decoding VQA files. Regression since c012f9b265e172de9c240c9dfab8665936fa3e83. Reported-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* lavfi/dnn_backend_openvino.c: Spelling Correction in OpenVino Backendshubhanshu022021-04-251-1/+1
| | | | | | | Correct Spelling of the word `descibe` to `describe` in init_model_ov Signed-off-by: shubhanshu02 <shubhanshu.e01@gmail.com>
* x86/tx_float: fix forgotten 2-argument mulpsLynne2021-04-241-1/+1
| | | | Yasm *really* cannot deal with any omitted arguments at all.
* x86/tx_float: use all arguments on vperm2f and vpermilps and reindent commentsLynne2021-04-241-78/+78
| | | | Apparently even old nasm isn't required to accept incomplete instructions.
* x86/tx_float: Fixes compilation with old yasmJames Almer2021-04-241-119/+121
| | | | | | | 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-242-5/+10
| | | | It's the other way around - AVX2 implies FMA3 is available.
* fate: add tests for JPEG-LS PAL8James Almer2021-04-245-0/+40
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavu/x86: add FFT assemblyLynne2021-04-245-0/+1319
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* doc/transforms: add documentation for the FFT transformsLynne2021-04-241-0/+706
| | | | | Makes the code far easier to follow, and makes creating new SIMD for the transforms far, far easier.
* checkasm: add av_tx FFT SIMD testing codeLynne2021-04-248-16/+134
| | | | | | 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-242-0/+80
| | | | This will be used for SIMD support.
* lavu: bump minor and add APIchanges entry for the lavu/tx changesLynne2021-04-242-1/+4
|
* lavu/tx: add full-sized iMDCT transform flagLynne2021-04-243-2/+42
|
* lavu/tx: add unaligned flag to the APILynne2021-04-241-1/+7
|
* lavu/tx: add a 9-point FFT and (i)MDCTLynne2021-04-241-1/+143
|
* lavu/tx: add a 7-point FFT and (i)MDCTLynne2021-04-241-10/+116
|
* lavu/tx: refactor power-of-two FFTLynne2021-04-242-87/+79
| | | | | | | | | This commit refactors the power-of-two FFT, making it faster and halving the size of all tables, making the code much smaller on all systems. This removes the big/small pass split, because on modern systems the "big" pass is always faster, and even on older machines there is no measurable speed difference.
* lavu/tx: minor code style improvements and additional commentsLynne2021-04-243-28/+48
|
* avcodec/exr: Return correct error code on allocation failureAndreas Rheinhardt2021-04-241-1/+1
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Actually honour the documentation of subtitle_headerAndreas Rheinhardt2021-04-241-2/+5
| | | | | | | | | | It is only supposed to be freed by libavcodec for decoders, yet avcodec_open2() always frees it on failure. Furthermore, avcodec_close() doesn't free it for decoders. Both of this has been changed. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* tests/fate: add a test for APNG_DISPOSE_OP_BACKGROUNDAnton Khirnov2021-04-242-0/+11
|
* avformat/asfdec_o: Use ff_get_extradata()Michael Niedermayer2021-04-241-15/+6
| | | | | | | | Fixes: OOM Fixes: 27240/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-5937469859823616 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/av1_metadata: don't store the inserted TD OBU in stackJames Almer2021-04-231-7/+9
| | | | | | | | | Fixes: stack-use-after-return Fixes: clusterfuzz-testcase-minimized-ffmpeg_BSF_AV1_METADATA_fuzzer-5931515701755904 Fixes: clusterfuzz-testcase-minimized-ffmpeg_BSF_AV1_METADATA_fuzzer-6105676541722624 Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/id3v2: Check end for overflow in id3v2_parse()Michael Niedermayer2021-04-231-1/+5
| | | | | | | | Fixes: signed integer overflow: 9223372036840103978 + 67637280 cannot be represented in type 'long' Fixes: 33341/clusterfuzz-testcase-minimized-ffmpeg_dem_DSF_fuzzer-6408154041679872 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: Fix file position additionMichael Niedermayer2021-04-221-1/+1
| | | | | | | | Fixes: signed integer overflow: 9223372036854775805 + 4 cannot be represented in type 'long' Fixes: 29927/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5579985228267520 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/wtvdec: Improve size overflow checks in parse_chunks()Michael Niedermayer2021-04-221-2/+2
| | | | | | | | | Fixes: signed integer overflow: 32 + 2147483647 cannot be represented in type 'int Fixes: 32967/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-5132856218222592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/faxcompr: Check remaining bits on error in decode_group3_1d_line()Michael Niedermayer2021-04-221-1/+1
| | | | | | | | Fixes: Timeout Fixes: 32886/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4779761466474496 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* tools/target_dec_fuzzer: Adjust threshold for paf videoMichael Niedermayer2021-04-221-0/+1
| | | | | | | | Fixes: Timeout (long -> 2sec) Fixes: 32790/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAF_VIDEO_fuzzer-5497584169910272 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: check for pts overflow in mov_read_sidx()Michael Niedermayer2021-04-221-1/+3
| | | | | | | | Fixes: signed integer overflow: 9223372036846336888 + 4278255871 cannot be represented in type 'long' Fixes: 32782/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6059216516284416 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/jpeglsdec: Don't presume the context to contain a JLSStateAndreas Rheinhardt2021-04-203-7/+12
| | | | | | | | | | | | | | | Before 9b3c46a081a9f01559082bf7a154fc6be1e06c18 every call to ff_jpegls_decode_picture() allocated and freed a JLSState. This commit instead put said structure into the context of the JPEG-LS decoder to avoid said allocation. But said function can also be called from other MJPEG-based decoders and their contexts doesn't contain said structure, leading to segfaults. This commit fixes this: The JLSState is now allocated on the first call to ff_jpegls_decode_picture() and stored in the context. Found-by: Michael Niedermayer <michael@niedermayer.cc> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/utils: Check ima wav duration for overflowMichael Niedermayer2021-04-201-1/+5
| | | | | | | | Fixes: signed integer overflow: 44331634 * 65 cannot be represented in type 'int' Fixes: 32120/clusterfuzz-testcase-minimized-ffmpeg_dem_RSD_fuzzer-5760221223583744 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* tools/target_dec_fuzzer: adjust threshold for arbcMichael Niedermayer2021-04-201-0/+1
| | | | | | | | Fixes: Timeout (63sec -> 48ms) Fixes: 31886/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARBC_fuzzer-5287235705503744 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* tools/target_dec_fuzzer: Adjust threshold for TSCCMichael Niedermayer2021-04-201-0/+1
| | | | | | | | Fixes: Timeout Fixes: 31850/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TSCC_fuzzer-5940231289307136 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/rv10: Execute whole size check earlier for rv20Michael Niedermayer2021-04-201-2/+6
| | | | | | | | Fixes: Timeout Fixes: 31380/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV20_fuzzer-5230899257016320 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/cafdec: Check channelsMichael Niedermayer2021-04-201-1/+1
| | | | | | | | Fixes: signed integer overflow: -1184429040541376544 * 32 cannot be represented in type 'long' Fixes: 31788/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6236746338664448 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* doc/filters: note requirements for xfade inputsGyan Doshi2021-04-201-0/+3
|
* avutil/cpu: Schedule deprecated functions for removalAndreas Rheinhardt2021-04-193-1/+8
| | | | | | | | av_set_cpu_flags_mask() has been deprecated in the commit which merged it: 6df42f98746be06c883ce683563e07c9a2af983f; av_parse_cpu_flags() has been deprecated in 4b529edff8934c258af95e5acc51f84deea66262. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Include attributes.h directlyAndreas Rheinhardt2021-04-1956-1/+58
| | | | | | | | Some files currently rely on libavutil/cpu.h to include it for them; yet said file won't use include it any more after the currently deprecated functions are removed, so include attributes.h directly. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/aarch64: add pred16x16 10-bit functionsMikhail Nitenko2021-04-192-0/+119
| | | | | | | | | | | | | | Benchmarks: A53 A72 pred16x16_dc_10_c: 136.0 124.0 pred16x16_dc_10_neon: 121.2 106.0 pred16x16_horizontal_10_c: 155.0 73.2 pred16x16_horizontal_10_neon: 82.2 67.7 pred16x16_top_dc_10_c: 106.0 93.7 pred16x16_top_dc_10_neon: 87.7 77.2 pred16x16_vertical_10_c: 83.0 67.7 pred16x16_vertical_10_neon: 54.2 61.7 Some functions work slower than C and are left commented out.
* lavc/aarch64: change h264pred_init structureMikhail Nitenko2021-04-191-30/+27
| | | | Change structure to allow the addition of other bit depths.
* doc/muxers.texi: fix build issue for unknown commandGuo, Yejun2021-04-191-1/+1
| | | | | | | The build log: ** Unknown command `@code' (left as is) (in src/doc/muxers.texi l. 2020) *** '{' without macro. Before: -map} option with the ffmpeg CLI tool. (in src/doc/muxers.texi l. 2020) *** '}' without opening '{' before: option with the ffmpeg CLI tool. (in src/doc/muxers.texi l. 2020)
* avutil/cpu: Use HW_NCPUONLINE to detect # of online CPUs with OpenBSDBrad Smith2021-04-181-0/+6
| | | | | Signed-off-by: Brad Smith <brad@comstyle.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/af_mcompand: check allocation resultsMarton Balint2021-04-181-0/+3
| | | | | | Fixes the only remaining part of ticket #8931. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/hls: check return value of new_init_section()Marton Balint2021-04-181-0/+4
| | | | | | Fixes part of ticket #8931. Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/nvenc: fix lossless tuning logicTimo Rothenpieler2021-04-182-70/+74
| | | | | | | | | | | | Relying on the order of the enum is bad. It clashes with the new presets having to sit at the end of the list, so that they can be properly filtered out by the options parser on builds with older SDKs. So this refactors nvenc.c to instead rely on the internal NVENC_LOSSLESS flag. For this, the preset mapping has to happen much earlier, so it's moved from nvenc_setup_encoder to nvenc_setup_device and thus runs before the device capability check.
* lavc/libaomdec: fix build with 1.0.0Anton Khirnov2021-04-181-10/+12
| | | | | aom_codec_frame_flags_t in libaom 1.0.0 is defined in aom_encoder.h, whereas for newer versions it was moved to aom_codec.h