summaryrefslogtreecommitdiff
path: root/libavcodec/opusdec.c
Commit message (Collapse)AuthorAge
* 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/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/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>
* opus: convert to new channel layout APIAnton Khirnov2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-20
| | | | | | | 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-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>
* avcodec/opusdec: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-31
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/opusdec: Cleanup generically on init failureAndreas Rheinhardt2020-12-31
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/opusdec: Move per-stream fields to OpusStreamContextAndreas Rheinhardt2020-12-31
| | | | | | | | Besides being more natural it also avoids allocations for separate arrays of decoded samples/output buffers/.... Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/opusdec: Return error upon errorAndreas Rheinhardt2020-12-31
| | | | | | | | | The Opus decoder forgot to return an error when allocating an SwrContext fails. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/opusdec: Remove always-true checkAndreas Rheinhardt2020-12-31
| | | | | | | | The celt_delay AVAudioFifo is always allocated during init, so checking for its existence in .flush is unnecessary. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* 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>
* opus: add an option to toggle intensity stereo phase inversionRostislav Pehlivanov2017-12-04
| | | | | | | | | Due to a somewhat high volume of complains, phase inversion has been made optional with RFC8251. This allows for better bass frequency response when partially downmixing to play on systems with an LFE speaker. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opusdec: Remove dead codeDerek Buitenhuis2017-07-07
| | | | Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* opus_celt: rename structures to better names and reorganize themRostislav Pehlivanov2017-02-14
| | | | | | | | | | | | | | | | | | | | This is meant to be applied on top of my previous patch which split PVQ into celt_pvq.c and made opus_celt.h Essentially nothing has been changed other than renaming CeltFrame to CeltBlock (CeltFrame had absolutely nothing at all to do with a frame) and CeltContext to CeltFrame. 3 variables have been put in CeltFrame as they make more sense there rather than being passed around as arguments. The coefficients have been moved to the CeltBlock structure (why the hell were they in CeltContext and not in CeltFrame??). Now the encoder would be able to use the exact context the decoder uses (plus a couple of extra fields in there). FATE passes, no slowdowns, etc. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus: remove redundant ff_celt_window2 declarationRostislav Pehlivanov2016-12-18
| | | | Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_parser: fix leaking channel_maps on errorAndreas Cadhalpun2016-12-10
| | | | | | | | Make ff_opus_parse_extradata free allocated memory on error instead of expecting callers to free it in that case. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* opus: move the entropy decoding functions to opus_rc.cRostislav Pehlivanov2016-11-08
| | | | | | | The intention is to have both encoding and decoding functions in opus_rc.c. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* lavc/opusdec: Fix a memleak when reading invalid files.Carl Eugen Hoyos2015-11-22
| | | | Reviewed-by: James Almer
* opusdec: Don't run vector_fmul_scalar on zero length arraysKieran Kunhya2015-10-27
| | | | | | | Fixes crashes on fuzzed files Fixes Ticket4969 part2 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/opusdec: Fix extra samples read indexMichael Niedermayer2015-10-27
| | | | | | | Fixes crash Fixes Ticket4969 part 1 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '14e558024642638085ae2bbeffc6087612e6a3f9'Hendrik Leppkes2015-08-02
|\ | | | | | | | | | | | | * commit '14e558024642638085ae2bbeffc6087612e6a3f9': opusdec: properly handle mismatching configurations in multichannel streams Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * opusdec: properly handle mismatching configurations in multichannel streamsAnton Khirnov2015-08-02
| | | | | | | | | | | | | | The substreams can have different resampling delays, so an additional level of buffering is needed to synchronize them. Bug-Id: 876
* | Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * lavc: AV-prefix all codec capabilitiesVittorio Giovara2015-07-27
| | | | | | | | | | | | Express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/opusdec: Fix delayed sample valueMichael Niedermayer2015-03-07
| | | | | | | | | | | | | | | | | | | | | | | | Fixes out of array access Fixes: ffmpeg_opus_crash1.ogg This solution is likely not optimal in terms of error concealment but its simple and fixes the out of array access. Found-by: Thomas Lindroth <thomas.lindroth@gmail.com> Tested-by: Thomas Lindroth <thomas.lindroth@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/opusdec: Clear out pointers per packetMichael Niedermayer2015-03-07
| | | | | | | | | | | | | | This is safer than to assume that all error pathes cleared them and nothing will use uncleared pointers. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/opusdec: remove unused headersPaul B Mahol2015-02-18
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec: fix clobbered ff_get_buffer()Paul B Mahol2015-02-10
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec/opusdec: Use avpriv_float_dsp_alloc()Michael Niedermayer2014-12-03
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '1973079417e8701b52ba810a72cb6c7c6f7f9a56'Michael Niedermayer2014-11-28
|\| | | | | | | | | | | | | * commit '1973079417e8701b52ba810a72cb6c7c6f7f9a56': opusdec: make sure all substreams have the same number of coded samples Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * opusdec: make sure all substreams have the same number of coded samplesAnton Khirnov2014-11-27
| | | | | | | | | | | | Fixes invalid writes with invalid multichannel streams. CC:libav-stable@libav.org
* | avcodec/opusdec: check alignment, misalignment could lead to crashes with avxMichael Niedermayer2014-05-25
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/opusdec: fix some const correctnessMichael Niedermayer2014-05-16
| | | | | | | | | | | | | | also make a const array static Fixes 2 warnings Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/opusdec: switch to swresampleMichael Niedermayer2014-05-15
| | | | | | | | | | | | | | This also fixes linking failures in doc/examples which where apparently caused by the linking order between avcodec and avresample Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'b70d7a4ac72d23f3448f3b08b770fdf5f57de222'Michael Niedermayer2014-05-15
|/ | | | | | | | | | | | | | | | | * commit 'b70d7a4ac72d23f3448f3b08b770fdf5f57de222': lavc: add a native Opus decoder. Conflicts: Changelog configure libavcodec/version.h Fate tests pass with both avresample as well as swresample based opus decoder, but are disabled (reference files are very large so i want to think a day or 2 about if theres an alternative or if they could be avoided, they also dont match the official samples) Merged-by: Michael Niedermayer <michaelni@gmx.at>
* lavc: add a native Opus decoder.Anton Khirnov2014-05-15
Initial implementation by Andrew D'Addesio <modchipv12@gmail.com> during GSoC 2012. Completion by Anton Khirnov <anton@khirnov.net>, sponsored by the Mozilla Corporation. Further contributions by: Christophe Gisquet <christophe.gisquet@gmail.com> Janne Grunau <janne-libav@jannau.net> Luca Barbato <lu_zero@gentoo.org>