summaryrefslogtreecommitdiff
path: root/libavcodec/libfdk-aacdec.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>
* libfdk-aac: convert to new channel layout APIVittorio Giovara2022-03-15
| | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* libfdk-aacdec: Flush delayed samples at the endMartin Storsjö2022-02-03
| | | | | | | | | | | | | | The fdk-aac decoder can return decoded audio data with a delay. (Whether it does this or not depends on the options set; by default it does add some delay.) Previously, this delay was handled by adjusting the timestamps of the decoded frames, but the last delayed samples weren't returned. Set the AV_CODEC_CAP_DELAY flag to indicate that the caller should flush remaining samples at the end. Also trim off the corresponding amount of samples at the start instead of adjusting timestamps. Signed-off-by: Martin Storsjö <martin@martin.st>
* libfdk-aacdec: Add an option for setting the decoder's DRC album modeMartin Storsjö2022-02-03
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* 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>
* libfdk-aacdec: Allow explicitly disabling the DRC reference level optionMartin Storsjö2020-02-11
| | | | | | | | | Previously, it was always left in the automatic mode, if the option was set to the only special (negative) value. Now there's two separate special values for this option, -1 for automatic (metadata based) and -2 for explicitly disabled. Signed-off-by: Martin Storsjö <martin@martin.st>
* libfdk-aacdec: Use the decoder's default level limiter settingsMartin Storsjö2020-02-11
| | | | | | | | It was disabled by default in 2dbd35b00c6433e587d5f44d5dbc8972ebbaa88e as it added delay, but now we compensate for the delay properly by offsetting timestamps. Signed-off-by: Martin Storsjö <martin@martin.st>
* libfdk-aacdec: Apply the decoder's output delay on timestampsMartin Storsjö2020-02-11
| | | | | | | The delay is normally zero when the level limiter is disabled, but if enabled, there's a small delay. Signed-off-by: Martin Storsjö <martin@martin.st>
* Merge commit '2a9e1c122eed66be1b26b747342b848300b226c7'James Almer2018-09-13
|\ | | | | | | | | | | | | * commit '2a9e1c122eed66be1b26b747342b848300b226c7': libfdk-aac: Don't use defined() in a #define Merged-by: James Almer <jamrial@gmail.com>
| * libfdk-aac: Don't use defined() in a #defineMartin Storsjö2018-09-13
| | | | | | | | | | | | | | | | | | | | | | MSVC expands the preprocessor directives differently, making the version check fail in the previous form. Clang can warn about this with -Wexpansion-to-defined (not currently enabled by default): warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined] Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '2edaafe5b93832715781851dfe2663da228a05ad'James Almer2018-09-11
|\| | | | | | | | | | | | | * commit '2edaafe5b93832715781851dfe2663da228a05ad': libfdk-aacdec: Allow setting the new dynamic range control effect setting Merged-by: James Almer <jamrial@gmail.com>
| * libfdk-aacdec: Allow setting the new dynamic range control effect settingMartin Storsjö2018-09-05
| | | | | | | | | | | | This is a new setting in FDK v2. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit 'ffb9b7a6bab6c6bfd3dd9a7c32e3724209824999'James Almer2018-09-11
|\| | | | | | | | | | | | | * commit 'ffb9b7a6bab6c6bfd3dd9a7c32e3724209824999': libfdk-aac: Consistently use a proper version check macro for detecting features Merged-by: James Almer <jamrial@gmail.com>
| * libfdk-aac: Consistently use a proper version check macro for detecting featuresMartin Storsjö2018-09-05
| | | | | | | | | | | | | | | | | | | | The previous version checks checked explicitly for the version where the version define was added to the installed headers, making an "#ifdef AACDECODER_LIB_VL0" enough. Now that we have a need for more diverse version checks than this, convert all checks to such checks. Signed-off-by: Martin Storsjö <martin@martin.st>
| * avcodec: add metadata to identify wrappers and hardware decoderswm42017-12-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Explicitly identify decoder/encoder wrappers with a common name. This saves API users from guessing by the name suffix. For example, they don't have to guess that "h264_qsv" is the h264 QSV implementation, and instead they can just check the AVCodec .codec and .wrapper_name fields. Explicitly mark AVCodec entries that are hardware decoders or most likely hardware decoders with new AV_CODEC_CAPs. The purpose is allowing API users listing hardware decoders in a more generic way. The proposed AVCodecHWConfig does not provide this information fully, because it's concerned with decoder configuration, not information about the fact whether the hardware is used or not. AV_CODEC_CAP_HYBRID exists specifically for QSV, which can have software implementations in case the hardware is not capable. Based on a patch by Philip Langdale <philipl@overt.org>. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * libfdk-aacdec: Correct buffer_size parameterMichael Niedermayer2017-06-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The timeDataSize argument to aacDecoder_DecodeFrame() seems undocumented and until 2016 04 (203e3f28fbebec7011342017fafc2a0bda0ce530) unused. After that commit libfdk-aacdec interprets it as size in sample units and memsets that on error. FFmpeg as well as others (like GStreamer) did interpret it as size in bytes. Fixes: 1442/clusterfuzz-testcase-minimized-4540199973421056 (This requires recent libfdk to reproduce) Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Martin Storsjö <martin@martin.st>
* | avcodec: add metadata to identify wrappers and hardware decoderswm42017-12-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Explicitly identify decoder/encoder wrappers with a common name. This saves API users from guessing by the name suffix. For example, they don't have to guess that "h264_qsv" is the h264 QSV implementation, and instead they can just check the AVCodec .codec and .wrapper_name fields. Explicitly mark AVCodec entries that are hardware decoders or most likely hardware decoders with new AV_CODEC_CAPs. The purpose is allowing API users listing hardware decoders in a more generic way. The proposed AVCodecHWConfig does not provide this information fully, because it's concerned with decoder configuration, not information about the fact whether the hardware is used or not. AV_CODEC_CAP_HYBRID exists specifically for QSV, which can have software implementations in case the hardware is not capable. Based on a patch by Philip Langdale <philipl@overt.org>. Merges Libav commit 47687a2f8aca3f65b6fdd117b1cb66a7409a7fd1.
* | Merge commit '97cfe1d8bd1968143e2ba9aa46ebe9504a835e24'James Almer2017-11-01
|\| | | | | | | | | | | | | * commit '97cfe1d8bd1968143e2ba9aa46ebe9504a835e24': Convert all AVClass struct declarations to designated initializers. Merged-by: James Almer <jamrial@gmail.com>
| * Convert all AVClass struct declarations to designated initializers.Diego Biurrun2017-06-12
| |
| * libfdk-aacdec: Remove unused variableVittorio Giovara2015-08-31
| |
* | avcodec/libfdk-aacdec: Correct buffer_size parameterMichael Niedermayer2017-05-28
| | | | | | | | | | | | | | | | | | | | | | | | the timeDataSize argument to aacDecoder_DecodeFrame() seems undocumented and until 2016 04 (203e3f28fbebec7011342017fafc2a0bda0ce530) unused. after that commit libfdk-aacdec interprets it as size in sample units and memsets that on error. FFmpeg as well as others (like GStreamer) did interpret it as size in bytes Fixes: 1442/clusterfuzz-testcase-minimized-4540199973421056 (This requires recent libfdk to reproduce) Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/libfdk-aacdec: Remove unused variableMichael Niedermayer2015-09-04
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'f34b152eb7b7e8d2aee57c710a072cf74173fbe1'Hendrik Leppkes2015-08-18
|\| | | | | | | | | | | | | * commit 'f34b152eb7b7e8d2aee57c710a072cf74173fbe1': libfdk-aacdec: Clean up properly if the init fails Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * libfdk-aacdec: Clean up properly if the init failsMartin Storsjö2015-08-16
| | | | | | | | | | | | | | | | | | Previously most of the error paths leaked. Also add FF_CODEC_CAP_INIT_THREADSAFE while adding caps_internal; this decoder wrapper doesn't have any static data that is initialized. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '1b90433f79de857550d4d8c35c89fbe954920594'Hendrik Leppkes2015-08-18
|\| | | | | | | | | | | | | | | | | | | * commit '1b90433f79de857550d4d8c35c89fbe954920594': libfdk-aacdec: Always decode into an intermediate buffer Conflicts: libavcodec/libfdk-aacdec.c Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * libfdk-aacdec: Always decode into an intermediate bufferMartin Storsjö2015-08-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For ADTS streams, the output format (number of channels, frame size) can change at any point (with the latest version of fdk-aac, the decoder seems to change format after a handful of frames, not outputting the right format immediately, for cases that worked fine with the earlier version of the lib). Previously, the decoder decoded straight into the output frame once the number of channels and frame size was known. This obviously does not work if the number of channels or frame size changes. The alternative would be to allocate the AVFrame with the maximum number of channels and frame size, and change them afterward decoding into it, but that may cause confusion to users e.g. of the get_buffer callback. This solution should be more robust. CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '87de6ddb7b7674e329d5c96677bd8685bc7f7855'Hendrik Leppkes2015-08-18
|\| | | | | | | | | | | | | * commit '87de6ddb7b7674e329d5c96677bd8685bc7f7855': libfdk-aacdec: Bump the max number of channels to 8 Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * libfdk-aacdec: Bump the max number of channels to 8Martin Storsjö2015-08-16
| | | | | | | | | | | | | | | | | | In the latest version of fdk-aac, the decoder can output up to 8 channels; take this into account when preallocating buffers that need to fit the output from any packet. CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
* | 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/libfdk-aacdec: Change conceal_method to int, its accessed via ↵Michael Niedermayer2015-03-02
| | | | | | | | | | | | | | | | AVOption as int This fixes depending on implementation defined behavior Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '2dbd35b00c6433e587d5f44d5dbc8972ebbaa88e'Michael Niedermayer2015-01-08
|\| | | | | | | | | | | | | * commit '2dbd35b00c6433e587d5f44d5dbc8972ebbaa88e': libfdk-aacdec: Make sure decoding doesn't add any extra delay in the latest version of fdk-aac Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * libfdk-aacdec: Make sure decoding doesn't add any extra delay in the latest ↵Martin Storsjö2015-01-08
| | | | | | | | | | | | | | | | | | | | | | version of fdk-aac The latest version added support for a new option for enabling a signal level limiter, which adds some extra delay. In fdk-aac, this is enabled by default, but disable it by default here since we'd rather have zero-delay decoding. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit 'c7921a480467876ece06566e0efd8f6bce9d1903'Michael Niedermayer2014-12-11
|\| | | | | | | | | | | | | * commit 'c7921a480467876ece06566e0efd8f6bce9d1903': libfdk-aacdec: Fix a boundary check Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * libfdk-aacdec: Fix a boundary checkMartin Storsjö2014-12-10
| | | | | | | | | | | | | | | | | | This avoids potential out of bounds writes, with potential future versions of the library. Bug-Id: CID 1254945 CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
| * libfdk-aacdec: Support building with the latest version of fdk-aacMartin Storsjö2014-11-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The latest fdk-aac code drop (from android 5.0) changed the channel layout enums (changing the value of existing enum constants), and renamed the option for downmixing. The failsafe comparison between ctype and FF_ARRAY_ELEMS(channel_counts) can trigger warnings (-Wtautological-constant-out-of-range-compare) when building with the old FDK AAC releases, where it can't be out of range with the enum values used there. CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
* | libfdk-aacdec: Support building with the latest version of fdk-aacMartin Storsjö2014-11-10
| | | | | | | | | | | | | | | | | | | | | | | | | | The latest fdk-aac code drop (from android 5.0) changed the channel layout enums (changing the value of existing enum constants), and renamed the option for downmixing. The failsafe comparison between ctype and FF_ARRAY_ELEMS(channel_counts) can trigger warnings (-Wtautological-constant-out-of-range-compare) when building with the old FDK AAC releases, where it can't be out of range with the enum values used there. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '66e9f839536238945fbfe9d2041b6891cb150e45'Michael Niedermayer2014-10-17
|\| | | | | | | | | | | | | | | | | | | * commit '66e9f839536238945fbfe9d2041b6891cb150e45': libfdk-aacdec: Enable Dynamic Range Control Metadata Support Conflicts: libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * libfdk-aacdec: Enable Dynamic Range Control Metadata SupportOmer Osman2014-10-17
| | | | | | | | | | | | | | | | | | | | For streams which contain DRC metadata, the FDK decoder is able to control rendering of the decoded output. The rendering parameters are detailed in fdk_aac_dec_options []. The default behavior is left up to the decoder. Signed-off-by: Martin Storsjö <martin@martin.st>
* | avcodec/libfdk-aacdec: use av_feeep() to avoid leaving stale pointers in memoryMichael Niedermayer2014-10-17
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'b01a2204b5cff7bb920f42fda1bb0103f450fe93'Michael Niedermayer2014-10-17
|\| | | | | | | | | | | | | | | | | | | | | * commit 'b01a2204b5cff7bb920f42fda1bb0103f450fe93': libfdk-aacdec: Enable Decoder Downmix including Downmix Metadata Support Conflicts: libavcodec/libfdk-aacdec.c libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * libfdk-aacdec: Enable Decoder Downmix including Downmix Metadata SupportOmer Osman2014-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The FDK decoder is capable of producing mono and stereo downmix from multichannel streams. These streams may contain metadata that control the downmix process. The decoder requires an Ancillary Buffer in order to correctly apply downmix in streams containing downmix Metadata. The decoder does not have an API interface to inform of the presence of Metadata in the stream, and therefore the Ancillary Buffer is always allocated whenever a downmix is requested. When downmixing multichannel streams, the decoder requires the output buffer in aacDecoder_DecodeFrame call to be of fixed size in order to hold the actual number of channels contained in the stream. For example, for a 5.1ch to stereo downmix, the decoder requires that the output buffer is allocated for 6 channels, regardless of the fact that the output is in fact two channels. Due to this requirement, the output buffer is allocated for the maximum output buffer size in case a downmix is requested (and also during decoder init). When a downmix is requested, the buffer used for output during init will also be used for the entire duration the decoder is open. Otherwise, the initial decoder output buffer is freed and the decoder decodes straight into the output AVFrame. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '1e9a93bfca2c2f43a07e01f2ef9fd5cbafe6c22d'Michael Niedermayer2014-07-07
|\| | | | | | | | | | | | | | | | | | | * commit '1e9a93bfca2c2f43a07e01f2ef9fd5cbafe6c22d': libfdk-aacdec: Decode the first AAC frame to reliably identify the bitstream Conflicts: libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * libfdk-aacdec: Decode the first AAC frame to reliably identify the bitstreamOmer Osman2014-07-07
| | | | | | | | | | | | | | | | | | | | | | | | For implicit signaling cases (as possible for Spectral Band Replication and Parametric Stereo Tools), the decoder must decode the first frame to correctly identify the stream configuration (as called from avformat_find_stream_info). The mechanism for this is built-in and only requires adding CODEC_CAP_CHANNEL_CONF to the libfdk-aacdec AVCodec struct. Signed-off-by: Omer Osman <omer.osman@iis.fraunhofer.de> Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit 'e0bfe34ea8ccf333ec5b17961fd58eb575e74f8b'Michael Niedermayer2014-07-05
|\| | | | | | | | | | | | | | | | | | | * commit 'e0bfe34ea8ccf333ec5b17961fd58eb575e74f8b': libfdk-aacdec: Reduce the default decoder delay by one frame Conflicts: libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * libfdk-aacdec: Reduce the default decoder delay by one frameOmer Osman2014-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | The default error concealment method if none is set via aacDecoder_SetParam(AAC_CONCEAL_METHOD) is set in CConcealment_InitCommonData within the fdk-aac library and is set to Energy Interpolation. This method requires one frame delay to the output. To reduce the default decoder output delay and avoid missing the last frame in file based decoding, use Noise Substitution as the default concealment method. Signed-off-by: Omer Osman <omer.osman@iis.fraunhofer.de> Signed-off-by: Martin Storsjö <martin@martin.st>