aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vorbisdec.c
Commit message (Collapse)AuthorAgeFilesLines
* all: fix typos found by codespellTimo Rothenpieler9 days1-2/+2
|
* Revert "ogg/vorbis: implement header packet skip in chained ogg bitstreams."Michael Niedermayer2025-05-311-44/+31
| | | | | | | non flat extradata is problematic and was missed by reviewers Found-by: Andreas Rheinhardt This reverts commit 574f634e49847e2225ee50013afebf0de03ef013.
* ogg/vorbis: implement header packet skip in chained ogg bitstreams.Romain Beauxis2025-05-301-31/+44
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vorbisdec: Dont treat overread as errorMichael Niedermayer2025-05-131-2/+4
| | | | | | | | | | | | | | | This differs from libvorbis by stddev: 2.44 PSNR: 88.58 MAXDIFF: 41 bytes: 834304/ 834304 for the file from the ticket Fixes: Ticket11427 Regression since: dc89cf804a811c0d25f4649a99f7fab4b5b416fa This is a similar solution to what james proposed earlier in [FFmpeg-devel] [PATCH] avcodec/vorbisdec: don't abort on EOD when decoding residuals Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/qdm2, vorbisdec: Use compile-time const max_depth in get_vlc2Andreas Rheinhardt2025-03-171-1/+1
| | | | | | | | | | It makes no sense to try to be exact with max depth in get_vlc2(): It will mean that the compiler emits code for all three stages of parsing and runtime checks for whether max_depth is big enough to parse the next stage when a not yet complete code has been encountered. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal, all: Use macros to set deprecated AVCodec fieldsAndreas Rheinhardt2025-03-101-3/+2
| | | | | | | | | | | | | | The aim of this is twofold: a) Clang warns when setting a deprecated field in a definition and because several of the widely set AVCodec fields are deprecated, one gets several hundred warnings from Clang for an ordinary build. Yet fortunately Clang (unlike GCC) allows to disable deprecation warnings inside a definition, so that one can create simple macros to set these fields that also suppress deprecation warnings for Clang. This has already been done in fdff1b9cbfd8cf5a9810c29efa4baf13a4786742 for AVCodec.channel_layouts. b) Using macros will allow to easily migrate these fields to internal ones. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vorbisdec: don't use double intermediate in vorbisfloat2floatJames Almer2024-06-131-3/+3
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-0/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vorbisdec: Check remaining data in vorbis_residue_decode_internal()Michael Niedermayer2024-03-101-0/+3
| | | | | | | | Fixes: timeout Fixes: 66326/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-6295291863040000 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUTJames Almer2024-03-071-1/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/vlc: Use proper namespaceAndreas Rheinhardt2023-09-111-3/+3
| | | | | | | | | | | | | | | | Therefore use a proper prefix for this API, e.g. ff_init_vlc_sparse -> ff_vlc_init_sparse ff_free_vlc -> ff_vlc_free INIT_VLC_LE -> VLC_INIT_LE INIT_VLC_USE_NEW_STATIC -> VLC_INIT_USE_STATIC (The ancient INIT_VLC_USE_STATIC has been removed in 595324e143b57a52e2329eb47b84395c70f93087, so that the NEW has been dropped.) Finally, reorder the flags and change their values accordingly. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vorbisdec: Check codebook float values to be finiteMichael Niedermayer2023-04-221-0/+4
| | | | | | | Fixes: Timeout Fixes: 55116/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-4572159970508800 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vorbisdec: export skip_samples instead of dropping framesJames Almer2023-03-221-8/+3
| | | | | | | | | | | | | | pts may not be set on input packets, which could result in the entire stream being discarded. This reverts commit 8fc2dedfe6e8fcc58dd052bf3b85cd4754133b17, reintroducing the behavior it replaced but now allowing the caller to manually drop the preroll samples by looking at the skip_samples side data at the start while ignoring it on seek, by setting the skip_manual avctx flag. Fixes ticket #10251. Suggested-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* vorbisdec: convert to lavu/txLynne2022-11-061-9/+23
| | | | | | This also fixes not checking the return values on transform init. Total decoder speedup on Zen 3: 9%
* avcodec/vorbis: Split data declarations out into new headerAndreas Rheinhardt2022-10-031-0/+1
| | | | | | | | | vorbis.h currently contains stuff only used by the native Vorbis codecs and some Vorbis tables, which are also used by Opus and libvorbis. Therefore split the data out into a header of its own. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Avoid deprecation warnings for channel_layoutsAndreas Rheinhardt2022-09-281-3/+1
| | | | | | | | | | | | | | | | | | AVCodec.channel_layouts is deprecated and Clang (unlike GCC) warns when setting this field in a codec definition. Fortunately, Clang (unlike GCC) allows to use FF_DISABLE_DEPRECATION_WARNINGS inside a definition (of an FFCodec), so that one can create simple macros to set AVCodec.channel_layouts that also suppress deprecation warnings for Clang. (Notice that some of the codec definitions were already inside FF_DISABLE/ENABLE_DEPRECATION_WARNINGS (that were not guarded by FF_API_OLD_CHANNEL_LAYOUT); these have been removed. Also notice that setting AVCodec.channel_layouts was not guarded by FF_API_OLD_CHANNEL_LAYOUT either, so testing disabling it it without removing all the codeblocks would not have worked.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vorbisdec: Move ff_vorbis_inverse_coupling() to vorbisdsp.cAndreas Rheinhardt2022-09-191-23/+0
| | | | | | | 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-191-12/+12
| | | | | | | 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-191-1/+1
| | | | ... for a difference between pointers.
* lavc/vorbisdec: use ptrdiff_t to iterate over intptr_tRémi Denis-Courmont2022-09-191-2/+1
| | | | | | | 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/vorbisdec: don't use a flag to determine if frames have been outputJyrki Vesterinen2022-09-141-1/+5
| | | | | | | | | | | | | If a developer using FFmpeg libraries seeks into an earlier position and calls avcodec_flush_buffers() afterwards as recommended, the Vorbis decoder will drop the next frame, since buffer flushing clears the first_frame flag. As a result, the audio samples the calling code receives may be ahead of the requested seek position, which is unacceptable in some use cases such as playing a looping sound effect. This commit records the presentation timestamp of the first frame and determines after that if the new frame is the first frame (possible after seeking to the start) by comparing its pts to the stored pts.
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-031-1/+1
| | | | | | | | 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_get_buffer() to decode.hAndreas Rheinhardt2022-08-271-1/+1
| | | | | | | | | 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-181-1/+1
| | | | | | | | | | | 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/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-051-1/+1
| | | | | | | | | | | 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-051-2/+1
| | | | | | | | 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/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-9/+9
| | | | | | | | | | | | | | | | 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-211-0/+1
| | | | | | | | | | 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>
* vorbis: convert to new channel layout APIAnton Khirnov2022-03-151-10/+17
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/vorbisdec: Mark decoder as init-threadsafeAndreas Rheinhardt2022-02-181-1/+1
| | | | | | It does not modify any static data in its init function. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-201-4/+4
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | | | | 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>
* avcodec: set AV_CODEC_CAP_CHANNEL_CONF on decoders which set their own channelsHendrik Leppkes2020-12-101-1/+1
| | | | | | | | | | | | 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/vorbisdec: fix FASTDIV usage for vr_type == 2Michael Niedermayer2019-09-061-1/+1
| | | | | | | | | | This reverts a hunk from f1ca40ee00402102046fc7e59606651930436b0e Fixes: out of array read Fixes: 16924/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5157893162139648 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vorbisdec: Check get_vlc2() failureMichael Niedermayer2019-08-301-7/+25
| | | | | | | | Fixes: out of array read Fixes: 16510/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5754510382727168 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vorbisdec: Implement vr->classifications = 1Michael Niedermayer2019-08-051-2/+7
| | | | | | | | | | | It appears no valid file uses this, so this is not testable with a valid file. Fixes: assertion failure Fixes: 16187/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5638880618872832 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vorbisdec: Check parameters in vorbis_floor0_decode() before divideMichael Niedermayer2019-08-051-0/+3
| | | | | | | | Fixes: division by zero Fixes: 16183/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5688966782648320 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vorbisdec: Check vlc for floor0 dec vector offsetMichael Niedermayer2019-07-211-2/+4
| | | | | | | | Fixes: out of array access Fixes: 15649/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5729191309344768 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vorbisdec: amplitude bits can be more than 25 bitsMichael Niedermayer2019-07-211-3/+4
| | | | | | | | Fixes: assertion failure, invalid shift Fixes: 15583/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5640157484548096 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/vorbisdec: Allow avcodec_open2 to call .closeMatt Wolenetz2018-03-071-0/+1
| | | | | | | | | | If there is a decoder initialization failure detected in avcodec_open2 after .init is called, allow graceful decoder .close to prevent leaking vorbis decoder allocations such as those from vorbis_parse_setup_*. BUG=772699 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vorbisdec: add missing commaJames Almer2017-05-041-1/+1
| | | | | | Should fix compilation failures after 191b2d4fc96fa87975a8eb5d87db04516b8a04c3. Found-by: philipl
* Merge commit '0b77a5933635293508e7289e7cf191ed166cf070'James Almer2017-05-041-1/+1
|\ | | | | | | | | | | | | | | | | * commit '0b77a5933635293508e7289e7cf191ed166cf070': Use correct printf conversion specifiers for POSIX integer types See 549045254c4614d5d61b5c36e340171a6914d57c Merged-by: James Almer <jamrial@gmail.com>
| * Use correct printf conversion specifiers for POSIX integer typesDiego Biurrun2016-12-231-3/+3
| |
* | Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-291-3/+3
| |
* | Merge commit 'b668662939de3a02454cfc9ba3e6d10b87527a40'Clément Bœsch2016-06-291-4/+4
|\| | | | | | | | | | | | | | | | | | | * commit 'b668662939de3a02454cfc9ba3e6d10b87527a40': get_bits: Move BITSTREAM_READER_LE definition before all relevant #includes The merge commit also includes changes for libavcodec/interplayacm.c and libavcodec/truemotion2rt.c Merged-by: Clément Bœsch <clement@stupeflix.com>
| * get_bits: Move BITSTREAM_READER_LE definition before all relevant #includesDiego Biurrun2016-06-071-3/+3
| | | | | | | | | | | | | | This avoids the danger that get_bits.h might get indirectly #included before BITSTREAM_READER_LE is defined. Also sort headers into canonical order where appropriate.
* | vorbisdec: reject rangebits 0 with non-0 partitionsAndreas Cadhalpun2016-01-041-0/+5
| | | | | | | | | | | | | | | | This causes non-unique elements in floor_setup->data.t1.list, which makes the stream undecodable according to the specification. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | vorbisdec: reject channel mapping with less than two channelsAndreas Cadhalpun2016-01-031-0/+5
| | | | | | | | | | | | | | | | | | It causes the angle channel number to equal the magnitude channel number, which makes the stream undecodable according to the specification. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | avcodec/vorbisdec: use init_get_bits8()Paul B Mahol2015-09-031-3/+8
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'Michael Niedermayer2015-07-271-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'def97856de6021965db86c25a732d78689bd6bb0': lavc: AV-prefix all codec capabilities Conflicts: cmdutils.c ffmpeg.c ffplay.c libavcodec/8svx.c libavcodec/aacenc.c libavcodec/ac3dec.c libavcodec/adpcm.c libavcodec/alac.c libavcodec/atrac3plusdec.c libavcodec/bink.c libavcodec/dnxhddec.c libavcodec/dvdec.c libavcodec/dvenc.c libavcodec/ffv1dec.c libavcodec/ffv1enc.c libavcodec/fic.c libavcodec/flacdec.c libavcodec/flacenc.c libavcodec/flvdec.c libavcodec/fraps.c libavcodec/frwu.c libavcodec/gifdec.c libavcodec/h261dec.c libavcodec/hevc.c libavcodec/iff.c libavcodec/imc.c libavcodec/libopenjpegdec.c libavcodec/libvo-aacenc.c libavcodec/libvorbisenc.c libavcodec/libvpxdec.c libavcodec/libvpxenc.c libavcodec/libx264.c libavcodec/mjpegbdec.c libavcodec/mjpegdec.c libavcodec/mpegaudiodec_float.c libavcodec/msmpeg4dec.c libavcodec/mxpegdec.c libavcodec/nvenc_h264.c libavcodec/nvenc_hevc.c libavcodec/pngdec.c libavcodec/qpeg.c libavcodec/ra288.c libavcodec/rv10.c libavcodec/s302m.c libavcodec/sp5xdec.c libavcodec/takdec.c libavcodec/tiff.c libavcodec/tta.c libavcodec/utils.c libavcodec/v210dec.c libavcodec/vp6.c libavcodec/vp9.c libavcodec/wavpack.c libavcodec/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>