summaryrefslogtreecommitdiff
path: root/libavcodec/mlpdec.c
Commit message (Collapse)AuthorAge
* avcodec/mlpdec: Check max matrix instead of max channel in noise checkMichael Niedermayer2022-11-28
| | | | | | | | | | | This is a regression since: adaa06581c5444c94eef72d61b8166f096e2687a Before this, max_channel and max_matrix_channel where compared for equality Fixes: out of array access Fixes: 53340/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-514959011885875 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mlpdec: add max channels checkMichael Niedermayer2022-10-04
| | | | | | | | Fixes: out of array access Fixes: 51648/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-4644322217164800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mlpdec: unbreak TrueHD single substream mono decodingPaul 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/mlpdec: fix decoding of overlapping channels in substreamsPaul B Mahol2022-09-17
| | | | Fixes #5039
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-03
| | | | | | | | It reduces typing: Before this patch, there were 105 codecs whose long_name-definition exceeded the 80 char line length limit. Now there are only nine of them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move ff_side_data_update_matrix_encoding to decode.hAndreas Rheinhardt2022-08-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move ff_get_buffer() to decode.hAndreas Rheinhardt2022-08-27
| | | | | | | | | Only used by decoders (encoders have ff_encode_alloc_frame()). Also clean up the other headers a bit while removing now redundant internal.h inclusions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-18
| | | | | | | | | | | and remove FF_CODEC_CAP_INIT_THREADSAFE All our native codecs are already init-threadsafe (only wrappers for external libraries and hwaccels are typically not marked as init-threadsafe yet), so it is only natural for this to also be the default state. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vlc: Use structure instead of VLC_TYPE array as VLC elementAndreas Rheinhardt2022-06-17
| | | | | | | | | | | | | | | | | | In C, qualifiers for arrays are broken: const VLC_TYPE (*foo)[2] is a pointer to an array of two const VLC_TYPE elements and unfortunately this is not compatible with a pointer to a const array of two VLC_TYPE, because the latter does not exist as array types are never qualified (the qualifier applies to the base type instead). This is the reason why get_vlc2() doesn't accept a const VLC table despite not modifying the table at all, as there is no automatic conversion from VLC_TYPE (*)[2] to const VLC_TYPE (*)[2]. Fix this by using a structure VLCElem for the VLC table. This also has the advantage of making it clear which element is which. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-05
| | | | | | | | | | | This is possible, because every given FFCodec has to implement exactly one of these. Doing so decreases sizeof(FFCodec) and therefore decreases the size of the binary. Notice that in case of position-independent code the decrease is in .data.rel.ro, so that this translates to decreased memory consumption. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Make FFCodec.decode use AVFrame*Andreas Rheinhardt2022-04-05
| | | | | | | | This increases type-safety by avoiding conversions from/through void*. It also avoids the boilerplate "AVFrame *frame = data;" line for non-subtitle decoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mlpdec: Use 64bit for channel layoutMichael Niedermayer2022-03-21
| | | | | | | | | Fixes: shift exponent 33 is too large for 32-bit type 'int' Fixes: 45645/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-5651350182035456 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-21
| | | | | | | | | | | | | | | | Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-21
| | | | | | | | | | Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault. This reduces the amount of files that have to include internal.h (which comes with quite a lot of indirect inclusions), as e.g. most encoders don't need it. It is furthemore in preparation for moving the private part of AVCodec out of the public codec.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-16
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* mlp: convert to new channel layout APIAnton Khirnov2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/thd: fix special stereo supportPaul B Mahol2021-12-18
|
* avcodec/mlpdec: cover case when >2 channels are in single substreamPaul B Mahol2021-11-11
| | | | Previously it was assumed that all >2 channels streams have >1 substreams.
* avcodec/mlpdec: skip decoding substreams if their channels are not to be usedPaul B Mahol2021-10-03
|
* avcodec/mlpdec: update matrix encoding only if it changedPaul B Mahol2021-10-03
|
* avcodec/mlpdec: fix decoding single stereo stream in TrueHDPaul B Mahol2021-09-23
|
* avcodec/mlpdec: fix integer sanitizer warning under clangPaul B Mahol2021-09-07
| | | | | Fixes: libavcodec/mlpdec.c:1108:37: runtime error: negation of 1 cannot be represented in type 'unsigned int'
* avcodec/mlp: move sync defines to common headerPaul B Mahol2021-09-05
|
* avcodec/mlpdec: reset lossless crc checking when stream endsPaul B Mahol2021-08-31
| | | | | | | | Fixes invalid reports of bad lossless crc. While here make end of stream message into debug level as it is not really important to user. Also wait for new major sync frame as invalid concating of files may produce invalid files, which cause various errors.
* avcodec/mlpdec: add flush supportPaul B Mahol2021-08-29
| | | | Fixes spurious lossless check failures when seeking.
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-27
| | | | | | | | | | Given that the AVCodec.next pointer has now been removed, most of the AVCodecs are not modified at all any more and can therefore be made const (as this patch does); the only exceptions are the very few codecs for external libraries that have a init_static_data callback. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* 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.
* avcodec: set AV_CODEC_CAP_CHANNEL_CONF on decoders which set their own channelsHendrik Leppkes2020-12-10
| | | | | | | | | | | | The decoders in this set either have a fixed channel count, or read it from the bitstream, and thus do not require the channel count as external information. Fixes various regressions since 81503ac58a763a36b1f57264013b1e76acb62b68, which requires a valid channel count for decoders which do not set this capability. Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
* avcodec/mlpdec: Avoid code duplication when initializing VLCsAndreas Rheinhardt2020-11-24
| | | | | Reviewed-by: Jai Luthra <me@jailuthra.in> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mlpdec: Make decoders init-threadsafeAndreas Rheinhardt2020-11-24
| | | | | Reviewed-by: Jai Luthra <me@jailuthra.in> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mlpdec: use get_bits_long for huff lsbsJai Luthra2020-02-08
| | | | | | | lsb bits may go beyond 25 bits, so to be safe use get_bits_long Signed-off-by: Jai Luthra <me@jailuthra.in> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* mlp: check huff_lsbs only when codebook is usedJai Luthra2020-02-04
| | | | | | | When no codebook is used, huff_lsbs can be more than 24 and still decode to original values once filters are applied. Signed-off-by: Jai Luthra <me@jailuthra.in>
* avcodec/mlp_parser: split off shared code to its own fileJames Almer2019-05-07
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mlpdec: Insuffient typoMichael Niedermayer2019-02-23
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mlpdec: Only change noise_type if the related fields are validMichael Niedermayer2018-05-26
| | | | | | | | | Fixes: inconsistency Fixes:runtime error: index 8 out of bounds for type 'int32_t [8]' Fixes: 6686/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-5191383498358784 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '970c76f32283bddf3a5afd24fe52db7a96186244'James Almer2017-10-30
|\ | | | | | | | | | | | | * commit '970c76f32283bddf3a5afd24fe52db7a96186244': mlp_parser: Drop in-parser downmix functionality Merged-by: James Almer <jamrial@gmail.com>
| * mlp_parser: Drop in-parser downmix functionalityVittorio Giovara2017-04-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | request_channel_layout is a decoder option and it makes no sense to have it in a parser. This feature was needed in the past when the decoder was allowed to reuse the avctx from the demuxer. Nowadays the decoder receives only the parameters from it, already containing the real channel layout (and the correct request_channel_layout option). After initialization the decoder overwrites the channel layout with the downmixed one that is actually output, so there is no need to preserve this functionality in the parser. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit '94c54d97e7f4fe90570c323803f2bdf6246c1010'James Almer2017-10-30
|\| | | | | | | | | | | | | * commit '94c54d97e7f4fe90570c323803f2bdf6246c1010': mlp: Factor out channel layout subset checks Merged-by: James Almer <jamrial@gmail.com>
| * mlp: Factor out channel layout subset checksVittorio Giovara2017-04-26
| |
* | Merge commit '1f6e5dd4d4dd9c02371ad211049d27edb6d95286'James Almer2017-10-30
|\| | | | | | | | | | | | | * commit '1f6e5dd4d4dd9c02371ad211049d27edb6d95286': mlp: Rename the channel layout variable Merged-by: James Almer <jamrial@gmail.com>
| * mlp: Rename the channel layout variableVittorio Giovara2017-04-26
| | | | | | | | | | Purely cosmetic change, will make code more readable once the new channel layout takes over.
| * Use bitstream_init8() where appropriateDiego Biurrun2017-02-07
| |
| * mlp: Convert to the new bitstream readerAlexandra Hájková2016-12-19
| |
| * mlpdec: Fix a undefined left shift of negative numberGanesh Ajjanagadde2015-09-29
| | | | | | | | | | | | This fixes a -Wshift-negative-value warning reported with clang 3.7+. Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* | avcodec/mlpdec: Check quant_step_size against huff_lsbsMichael Niedermayer2017-06-03
| | | | | | | | | | | | | | | | | | This reorders the operations so as to avoid computations with the above arguments before they have been initialized. Fixes part of 1708/clusterfuzz-testcase-minimized-5035111957397504 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mlpdec: Do not leave invalid values in matrix_out_ch[] on errorMichael Niedermayer2017-05-27
| | | | | | | | | | | | | | | | Fixes: runtime error: index 12 out of bounds for type 'uint8_t [8]' Fixes: 1832/clusterfuzz-testcase-minimized-6574546079449088 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mlpdec: Fix runtime error: shift exponent -5 is negativeMichael Niedermayer2017-05-22
| | | | | | | | | | | | | | Fixes part of 1708/clusterfuzz-testcase-minimized-5035111957397504 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mlpdec: Do not leave a invalid num_primitive_matrices in the contextMichael Niedermayer2017-05-20
| | | | | | | | | | | | | | | | Fixes: runtime error: index 8 out of bounds for type 'uint8_t [8]' Fixes: 1699/clusterfuzz-testcase-minimized-6327177438035968 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mlpdec: Fix: runtime error: left shift of negative value -8Michael Niedermayer2017-05-18
| | | | | | | | | | | | | | Fixes: 1658/clusterfuzz-testcase-minimized-4889937130291200 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>