summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/libshine: Remove dead channel count checkAndreas Rheinhardt2022-09-22
| | | | | | | This encoder has AVCodec.ch_layouts set, so that this is checked generically. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libcodec2: Remove dead channel count checkAndreas Rheinhardt2022-09-22
| | | | | | | | This encoder has AVCodec.ch_layouts set, so that this is checked generically. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pcm: Remove always-false checkAndreas Rheinhardt2022-09-22
| | | | | | | | None of the decoders here have the AV_CODEC_CAP_CHANNEL_CONF set, so that it is already checked generically that the number of channels is positive. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pcm-blurayenc: Don't presume every channel layout to be nativeAndreas Rheinhardt2022-09-22
| | | | | | | | | | | | | | The pcm_bluray encoder has AVCodec.ch_layouts set, so that ff_encode_preinit() checks that the channel layout in use is equivalent to one of the layouts from AVCodec.ch_layouts. Yet equivalent is not the same as identical; in particular, custom layouts equivalent to native layouts are possible (and necessary if one wants to use the name/opaque fields with an ordinary channel layout), so one must not simply use AVChannelLayout.u.mask. Use av_channel_layout_subset() instead. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/dfpwmdec: Remove always-false checkAndreas Rheinhardt2022-09-22
| | | | | | | | This decoder does not have the AV_CODEC_CAP_CHANNEL_CONF set, so that number of channels has to be set by the user before avcodec_open2(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/encode: Remove deprecated always-false checksAndreas Rheinhardt2022-09-22
| | | | | | | | | | Now that it is ensured that the old and new channel count/layout values coincide if the old ones are set, the consistency of the AVChannelLayout (which is checked before we reach this point) implies the consistency of the old values, making these checks here dead code. So remove them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Always use old channel count/layout if setAndreas Rheinhardt2022-09-22
| | | | | | | | | | | This ensures that if AVCodecContext.channels or AVCodecContext.channel_layout are set, AVCodecContext.ch_layout has the equivalent values after this block. (In case these values are set inconsistently, the consistency check for ch_layout below will error out.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Check for more invalid channel layoutsAndreas Rheinhardt2022-09-22
| | | | | | | | | | In particular, check the provided channel layout for encoders without AVCodec.ch_layouts set. This fixes an infinite loop in the WavPack encoder (and maybe other issues in other encoders as well) in case the channel count is zero. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/encode: Remove dead deprecated checkAndreas Rheinhardt2022-09-22
| | | | | | | | The wrapper for the legacy channel layout API already sets AVCodecContext.channels based upon AVCodecContext.channel_layout if the latter is set while the former is unset. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Uninitialize AVChannelLayout before overwriting itAndreas Rheinhardt2022-09-22
| | | | | | Otherwise, there might be leaks. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/fmtconvert: Remove unused AVCodecContext parameterAndreas Rheinhardt2022-09-21
| | | | | | | Unused since d74a8cb7e42f703be5796eeb485f06af710ae8ca. Reviewed-by: Rémi Denis-Courmont <remi@remlab.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/blockdsp: Remove unused AVCodecContext parameterAndreas Rheinhardt2022-09-21
| | | | | | | Possible since be95df12bb06b183c8d2aea3b0831fdf05466cf3. Reviewed-by: Rémi Denis-Courmont <remi@remlab.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cavsdsp: Remove unused function parameterAndreas Rheinhardt2022-09-21
| | | | | Reviewed-by: Rémi Denis-Courmont <remi@remlab.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegbdec: use init_get_bits8()Paul B Mahol2022-09-21
|
* avcodec/mlpenc: analyze only if there are samplesPaul B Mahol2022-09-21
|
* lavc/videotoolboxenc: Fix crash by uninitialized valueThilo Borgmann2022-09-21
| | | | If create_cv_pixel_buffer() fails, pixel_buffer_info might get into CFRelease() containing an arbitrary value.
* lavc/aarch64: Add neon implementation for pix_median_abs8Hubert Mazur2022-09-21
| | | | | | | | | | | | | Provide optimized implementation for pix_median_abs8 function. Performance comparison tests are shown below. - median_sad_1_c: 277.0 - median_sad_1_neon: 82.0 Benchmarks and tests run with checkasm tool on AWS Graviton 3. Signed-off-by: Hubert Mazur <hum@semihalf.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* lavc/aarch64: Add neon implementation for vsad8_intraHubert Mazur2022-09-21
| | | | | | | | | | | | | Provide optimized implementation for vsad8_intra function. Performance comparison tests are shown below. - vsad_5_c: 94.7 - vsad_5_neon: 20.7 Benchmarks and tests run with checkasm tool on AWS Graviton 3. Signed-off-by: Hubert Mazur <hum@semihalf.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* lavc/aarch64: Add neon implementation for pix_median_abs16Hubert Mazur2022-09-21
| | | | | | | | | | | | | Provide optimized implementation for pix_median_abs16 function. Performance comparison tests are shown below. - median_sad_0_c: 720.5 - median_sad_0_neon: 127.2 Benchmarks and tests run with checkasm tool on AWS Graviton 3. Signed-off-by: Hubert Mazur <hum@semihalf.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/ac3dec: add downmix support for mono and stereo for eac3 7.1Paul B Mahol2022-09-21
|
* x86/lpc: implement a new Welch windowing functionLynne2022-09-21
| | | | | | | | | | | | Old one was written with the assumption only even inputs would be given. This very messy replacement supports even and odd inputs, and supports AVX2 for extra speed. The buffers given are usually quite big (4k samples), so the speedup is worth it. The new SSE version is still faster than the old inline asm version by 33%. Also checkasm is provided to make sure this monstrosity works. This fixes some FATE tests.
* lavc/lpc: do not explode when windowing a 1-length arrayLynne2022-09-21
| | | | Divided by 0.
* avcodec/rpzaenc: Avoid useless intermediate variableAndreas Rheinhardt2022-09-20
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/smc: Move transient GetByteContext from context to stackAndreas Rheinhardt2022-09-20
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegdec: Avoid copying data when flipping imageAndreas Rheinhardt2022-09-20
| | | | | | | | | Basically reverts af15c17daa5d8d2940c0263ba4d3ecec761c11ee. Flipping a picture by modifying the pointers is so common that even users of direct rendering should take it into account. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vorbisdec: Move ff_vorbis_inverse_coupling() to vorbisdsp.cAndreas Rheinhardt2022-09-19
| | | | | | | Only used there. Also make it static. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/vorbisdec: use intermediate variablesRémi Denis-Courmont2022-09-19
| | | | | | | The compiler cannot infer that the two float vectors do not alias, causing unnecessary extra loads and serialisation. This patch caches the two input values in local variables so that compiler can optimise individual loop iterations.
* lavc/vorbisdsp: use ptrdiff_t rather than intptr_tRémi Denis-Courmont2022-09-19
| | | | ... for a difference between pointers.
* lavc/vorbisdec: use ptrdiff_t to iterate over intptr_tRémi Denis-Courmont2022-09-19
| | | | | | | While this probably never overflows, we are better safe than sorry. The callback prototype should probably also use ptrdiff_t or size_t, but I diggress (this would affect the DSP callback prototype).
* avcodec/aptxenc: Process data in complete blocks of four samples onlyAndreas Rheinhardt2022-09-19
| | | | | | | | | | | Do this by setting AVCodecInternal.pad_samples. This prevents reading into the frame's padding and writing into the packet's padding. This actually happened in our FATE tests (where the number of samples is 2 mod 4), which therefore needed to be updated. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/encode: Enable encoders to control padding of last frameAndreas Rheinhardt2022-09-19
| | | | | | | | | | | Some audio codecs work with atomic units that decode to a fixed number of audio samples with this number being so small that it is common to put multiple of these atoms into one packet. In these cases it makes no sense to pad the last frame to the big frame_size, so allow encoders to set the number of samples that they want the last frame to be padded to instead. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/encode: Redo checks for small last audio frameAndreas Rheinhardt2022-09-19
| | | | | | | In particular, check that there is only one small last frame in case the encoder has the AV_CODEC_CAP_SMALL_LAST_FRAME set. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aptxdec: Process data in complete blocks onlyAndreas Rheinhardt2022-09-19
| | | | | | | | | | | The APTX (HD) decoder decodes blocks of four (six) bytes to four output samples. It makes no sense to handle incomplete blocks: They would just lead to synchronization errors, in which case the complete frame is discarded. So only handle complete blocks. This also avoids reading from the packet's padding and writing into the frame's padding. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/aptx: Use AVCodecContext.frame_size according to the APIAndreas Rheinhardt2022-09-19
| | | | | | | | | | | | | | | | | | Currently the APTX (HD) codecs set frame_size if unset and check whether it is divisible by block_size (corresponding to block_align as used by other codecs). But this is based upon a misunderstanding of the API: frame_size is not in bytes, but in samples. Said value is also not intended to be set by the user at all, but set by encoders and (possibly) decoders if the number of channels in a frame is constant. The latter condition is not fulfilled here, so only set it for encoders. Given that the encoder can handle any number of samples as long as it is divisible by four and given that it worked to set a custom frame size before, the encoders accept any multiple of four; otherwise the value is set to the value that it already had for APTX: 1024 samples (per channel). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/utils: Support APTX (HD) in av_get_audio_frame_duration()Andreas Rheinhardt2022-09-19
| | | | | | | | | | | | APTX decodes four bytes of input to four stereo samples; APTX HD does the same with six bytes of input. So it can be easily supported in av_get_audio_frame_duration(). This fixes invalid durations and (derived) timestamps of demuxed APTX HD packets and therefore fixed the timestamp in the aptx-hd FATE test. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Use the new API fields to validate the layout returned by ↵James Almer2022-09-19
| | | | | | | | | | | decoders This block was scheduled for removal, which means that no validation would have taken place after the old API was removed. It was algo going to mistakenly remove an unrelated bits_per_coded_sample check. Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/videotoolbox: deprecate write-only output_callbackAnton Khirnov2022-09-19
| | | | | This field has never been used for anything, so stop setting it and deprecate it.
* lavc/videotoolbox: do not pass AVCodecContext to decoder output callbackAnton Khirnov2022-09-19
| | | | | | | | | | | | | | | | | | The opaque parameter for the callback is set in videotoolbox_start(), called when the hwaccel is initialized. When frame threading is used, avctx will be the context corresponding to the frame thread currently doing the decoding. Using this same codec context in all subsequent invocations of the decoder callback (even those triggered by a different frame thread) is unsafe, and broken after cc867f2c09d2b69cee8a0eccd62aff002cbbfe11, since each frame thread now cleans up its hwaccel state after decoding each frame. Fix this by passing hwaccel_priv_data as the opaque parameter, which exists in a single instance forwarded between all frame threads. The only other use of AVCodecContext in the decoder output callback is as a logging context. For this purpose, store a logging context in hwaccel_priv_data.
* lavc/fmtconvert: remove dead int32_to_floatRémi Denis-Courmont2022-09-18
| | | | | | | This is no longer used since 46089967722f74e794865a044f5f682f26628802. It also has no implementations other than the plain C one. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mlpdec: unbreak TrueHD single substream mono decodingPaul B Mahol2022-09-18
|
* avcodec/mlpenc: improve encoding of stereo TrueHD and add mono supportPaul B Mahol2022-09-18
|
* avcodec/mlpenc: rename some variables to better alternativesPaul B Mahol2022-09-18
|
* avcodec/mlpdec: relax channels checkingPaul B Mahol2022-09-18
| | | | | | | Internal TrueHD decoder channel rematrix can mix 2 stereo substreams into single mono stream. Fixes #1726
* avcodec/exr: recreate offset table outside of packetPaul B Mahol2022-09-17
| | | | Packet might not be writable at this point.
* avcodec/exr: remove less usefull log messagesPaul B Mahol2022-09-17
|
* avcodec/8bps: fix style issuePaul B Mahol2022-09-17
|
* avcodec/mlpdec: fix decoding of overlapping channels in substreamsPaul B Mahol2022-09-17
| | | | Fixes #5039
* avcodec: add XWD parserPaul B Mahol2022-09-17
|
* avcodec/tta: simplify final samples conversionPaul B Mahol2022-09-17
| | | | Remove dubious overflow message and counter.
* avcodec/apedec: Fix integer overflow in filter_3800()Michael Niedermayer2022-09-16
| | | | | | | | | Fixes: signed integer overflow: -2147448926 + -198321 cannot be represented in type 'int' Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5739619273015296 Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6744428485672960 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>