summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
...
* avcodec/libmp3lame: Avoid copying data, allow user-supplied bufferAndreas Rheinhardt2021-05-23
| | | | | | | | | | | The libmp3lame encoder already uses an internal buffer, so that the packet size is already known before allocating the packet; therefore one can avoid another (implicit) intermediate buffer by switching to ff_get_encode_buffer(), thereby also supporting user-supplied buffers. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libkvazaar: Allow user-supplied buffersAndreas Rheinhardt2021-05-23
| | | | | | | | Here the packet size is known before allocating the packet, so that supporting user-supplied buffers is trivial. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libgsmenc: Avoid copying packet data, allow user-supplied buffersAndreas Rheinhardt2021-05-23
| | | | | | | | | When the packet size is known in advance like here, one can avoid an intermediate buffer for the packet data by using ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libcodec2: Avoid copying packet data, allow user-supplied buffersAndreas Rheinhardt2021-05-23
| | | | | | | | | When the packet size is known in advance like here, one can avoid an intermediate buffer for the packet data by using ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libaomenc: Avoid copying data, allow user-supplied buffersAndreas Rheinhardt2021-05-23
| | | | | | | | | | | | Here the packet size is known before allocating the packet because the encoder provides said information (and works with internal buffers itself), so one can use this information to avoid the implicit use of another intermediate buffer for the packet data; and by switching to ff_get_encode_buffer() one can also allow user-supplied buffers. Reviewed-by: James Almer <jamrial@gmail.com> Reviewed-by: James Zern <jzern@google.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/audiotoolboxenc: Remove AV_CODEC_CAP_DR1Andreas Rheinhardt2021-05-23
| | | | | | | | | It has been added in 2016 when this flag made no sense for encoders at all; now that it makes sense, audiotoolboxenc doesn't support it, despite claiming to do so. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* aarch64: hevc_idct: Fix overflows in idct_dcMartin Storsjö2021-05-22
| | | | | | | | This is marginally slower, but correct for all input values. The previous implementation failed with certain input seeds, e.g. "checkasm --test=hevc_idct 98". Signed-off-by: Martin Storsjö <martin@martin.st>
* aacenc: make the twoloop coder the defaultLynne2021-05-21
| | | | | | | | This used to be the default, but was reverted as it was slower than the 'fast' coder by around 25%. Since our encoder is still not very good, change back to the twoloop coder by default. It has much better rate control management as well, making it closer to CBR, and it sounds much better.
* avcodec/vaapi_av1: pass full buffer size for each tileFei Wang2021-05-20
| | | | | | | | Previously, only the size of a given tile was passed, making the offset and size marked in VASliceParameterBufferAV1 invalid with multiple tiles. Signed-off-by: Fei Wang <fei.w.wang@intel.com>
* avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if not provided by ↵Zane van Iperen2021-05-19
| | | | | | | | | | the SDK Fixes build failure on older SDKs without it. Fixes #9242 Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/exrenc: Allow user-supplied buffersAndreas Rheinhardt2021-05-15
| | | | | | | Trivial for an encoder that has a good estimate of the size of the output packet in advance. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc2enc: Allow user-supplied buffersAndreas Rheinhardt2021-05-15
| | | | | | | Trivial for an encoder that has a very good estimate of the size of the output packet in advance. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpeglsenc: Remove unnecessary headerAndreas Rheinhardt2021-05-15
| | | | | | Unnecessary since 130d89d786d29148deb846de48b16e11a894e8a7. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpeglsenc: Remove redundant implicit checksAndreas Rheinhardt2021-05-15
| | | | | | | | | Now that the proper buffer size is calculated (and checked) before allocating the buffer, it is known that the buffer always suffices. So use the unchecked PutBit-API; and also use an unchecked bitstream reader as we check ourselves. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpeglsenc: Avoid intermediate buffer, allow user-supplied buffersAndreas Rheinhardt2021-05-15
| | | | | | | | | | | | | | | | | | | Up until now, the JPEG-LS encoder allocated a worst-case-sized packet at the beginning of each encode2 call; then it wrote the packet header into its destination buffer and encoded the actual packet data; said data is written into another worst-case-sized buffer, because it needs to be escaped before being written into the packet buffer. Finally, because the packet buffer is worst-case-sized, the generic code copies the actually used part into a fresh buffer. This commit changes this: Allocating the packet and writing the header into it is deferred until the actual data has been encoded and its size is known. This gives a good upper bound for the needed size of the packet buffer (the upper bound might be 1/15 too large) and so one can avoid the implicit intermediate buffer and support user-supplied buffers by using ff_get_encode_buffer(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpeglsenc: Allocate buffer with fixed size only onceAndreas Rheinhardt2021-05-15
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpeglsenc: Check for invalid dimensionsAndreas Rheinhardt2021-05-15
| | | | | | The dimensions are written on two bytes. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libx264: Fix redundant setting of caps_internalAndreas Rheinhardt2021-05-14
| | | | | | | | Exists since 8a129077cc37202a00dd666bd5365c3f61ea2e80. Fixes a -Winitializer-overrides warning when building with Clang. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/pngdec: fix updating reference frames for APNG_DISPOSE_OP_BACKGROUNDAnton Khirnov2021-05-14
| | | | | | | | They should be treated the same as APNG_DISPOSE_OP_NONE. Broken in 5663301560. Fixes #9184.
* avcodec: remove leftover references to AVCodecContext.refcounted_framesJames Almer2021-05-13
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/allcodecs: Don't include libx264 twice in the list of codecsAndreas Rheinhardt2021-05-13
| | | | | | | | | | | | Since a247ac640df3da573cd661065bf53f37863e2b46, allcodecs.c contained two lines that matched the regex used by find_filters_extern in configure; as a result, libx264 appeared twice the list of codecs (if enabled). Fix this by using only one matching line by adding a preprocessor define for the part that differed in the two old lines: The const qualifier. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Revert "avcodec/adpcm: Set vqa_version before use in init"Michael Niedermayer2021-05-13
| | | | | | | Redundant with ff946633a30e15415974c3f0ec7751c04eb91701. Found-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> This reverts commit 7a403da0cb8e5fe308fe307b7ed219110f7021e0.
* avcodec/clearvideo: Check for 0 tile_shiftMichael Niedermayer2021-05-12
| | | | | | | | Fixes: shift exponent -1 is negative Fixes: 33401/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-5908683596890112 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/adpcm: Set vqa_version before use in initMichael Niedermayer2021-05-12
| | | | | | | | Fixes: null pointer dereference Fixes: 33172/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_WS_fuzzer-5200164273913856 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vc1: Check remaining bits in ff_vc1_parse_frame_header()Michael Niedermayer2021-05-12
| | | | | | | | Fixes: Timeout Fixes: 33156/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-6259655027326976 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/adpcm_psx: ignore unknown flag bitsZane van Iperen2021-05-12
| | | | | | As per documentation. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_psx: always fetch next byte irregardless of flagZane van Iperen2021-05-12
| | | | | | | | | Even though all samples are meant to be zero (if flag == 0x07), doesn't mean that they aren't there. See No$PSX docs [1]. [1]: https://problemkaputt.de/psx-spx.htm#spuadpcmsamples Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/dvdsubdec: Mark decoder as init-threadsafeAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/dvdsubdec: Remove unnecessary close functionAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/metasound: Mark decoder as init-threadsafeAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/twinvqdec: Mark decoder as init-threadsafeAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/nuv: Mark decoder as init-threadsafeAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/webp: Mark decoder as init-threadsafeAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/j2kenc: Make encoder init-threadsafeAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpeg2000dec: Make decoder init-threadsafeAndreas Rheinhardt2021-05-12
| | | | | | | | | | | | | | | The JPEG-2000 decoder and encoder share common luts; the decoder initializes them once, guarded by a dedicated AVOnce, whereas the encoder initializes them always during init. This means that the decoder is not init-threadsafe; in fact there is a potential data race because these luts can be initialized while an active decoder/encoder is using them. Fix this and make the decoder init-threadsafe by making the initialization function guard initialization itself with a dedicated AVOnce. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mqc: Hardcode tables to save spaceAndreas Rheinhardt2021-05-12
| | | | | | | | | | | | | | | | | | mqc currently initializes three arrays at runtime; each of them has 2 * 47 elements, one is uint16_t, two are uint8_t, so that their combined size is 8 * 47. The source data for these initializations is contained in an array of 47 elements of size six. Said array is only used in order to initialize the other arrays, so the savings are just 2 * 47B. Yet this is dwarfed by the size of the code for performing the initializations: It is 109B (GCC 10.2, x64, -O3 albeit in an av_cold function); this does not even include the size of the code in the callers. So just hardcode these tables. This also fixes a data race, because the encoder always initialized these tables during init, although they might already be used at the same time by already running encoder/decoder instances. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vorbisenc: Combine codebooks, avoid relocationsAndreas Rheinhardt2021-05-12
| | | | | | | | | | | | | | | | | | | | The Vorbis encoder has an array of a structure containing all the ingredients for a codebook; this includes a pointer to the actual codebook and some even have a pointer to an array containing quant values. Each of these real codebooks is an array of its own. These pointers lead to relocations and therefore the array will be placed in .data.rel.ro and not in .rodata. This commit avoids the pointers altogether by combining all the actual codebooks into one big array; the actual codebooks are now accessed consecutively by incrementing the pointer used to access them by the length of the actual codebook that has just been dealt with (said length is contained in the structure describing the codebook). There is no downside to this given that these codebooks are already only used once during init. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vorbisenc: Mark encoder as init-threadsafeAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vorbisenc: Don't free uninitialized pointersAndreas Rheinhardt2021-05-12
| | | | | | | | | | | | | The Vorbis encoder allocates several arrays destined to contain pointers to separately allocated arrays; yet these arrays are allocated without initializing them: They are uninitialized until their final values are stored in them; so if allocating one of the earlier subarrays fails, all of the remaining pointers to subarrays are still uninitialized. But they are used for freeing, resulting in crashes. Fix this by zero-initializing the arrays with subarrays. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmaenc: Mark encoders as init-threadsafeAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmaenc: Check operations that can failAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmadec: Mark decoders as init-threadsafeAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmadec: Check operations that can failAndreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmadec: Forward error instead of return -1Andreas Rheinhardt2021-05-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wma: Check initializing VLCAndreas Rheinhardt2021-05-12
| | | | | | Initializing a VLC entails implicit allocations which may fail. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wma(dec|enc): Fix memleaks upon allocation errorAndreas Rheinhardt2021-05-12
| | | | | | | ff_wma_init() can fail without freeing everything it has allocated; so add the FF_CODEC_CAP_INIT_CLEANUP to the codecs using it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wma: Remove nonsense volatileAndreas Rheinhardt2021-05-12
| | | | | | | The address of this variable never leaks, so it cannot be modified by anyone else at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp3: Mark decoders as init-threadsafeAndreas Rheinhardt2021-05-10
| | | | | Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp3: ReindentationAndreas Rheinhardt2021-05-10
| | | | | Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp3: Avoid code duplication when initializing coeff_vlcsAndreas Rheinhardt2021-05-10
| | | | | Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>