summaryrefslogtreecommitdiff
path: root/libavcodec/adpcmenc.c
Commit message (Collapse)AuthorAgeFilesLines
* lavc: support AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE in all no-delay encodersAnton Khirnov2023-01-291-1/+2
| | | | Including fake-delay encoders marked with FF_CODEC_CAP_EOF_FLUSH.
* avcodec/adpcmenc: Round up required buffer sizeAndreas Rheinhardt2022-09-151-1/+1
| | | | | | | | Otherwise the buffer might be too small. Fixes assert violations when encoding mono audio with exactly one sample. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* 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: Constify frame->data pointers for encoders where possibleAndreas Rheinhardt2022-08-051-2/+2
| | | | 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: 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-1/+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>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-161-0/+2
| | | | | | | | 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>
* adpcm: convert to new channel layout APIAnton Khirnov2022-03-151-59/+63
| | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/adpcmenc: Don't include disabled AVCodecsAndreas Rheinhardt2021-07-221-14/+22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/adpcmenc: Deduplicate AVClassesAndreas Rheinhardt2021-07-221-8/+8
| | | | | | | | The child_class_next API relied on different (de)muxers to use different AVClasses; yet this API has been replaced by child_class_iterate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/adpcmenc: #if disabled code away, fix build without ADPCM_ARGOAndreas Rheinhardt2021-07-221-62/+54
| | | | | | | | | | | | | The adpcm_argo encoder does not use the data from adpcm_data.c directly; instead it shares a function with the adpcm_argo decoder that is in adpcm.c. When all the ADPCM decoders and the adpcm_argo encoder are disabled, adpcm.c is not compiled; yet the code in adpcmenc.c calling said function from adpcm.c is still present, leading to link errors. Fix this by disabling the code belonging to disabled codecs in adpcmenc.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/adpcmenc: Use smaller scope for some variablesAndreas Rheinhardt2021-07-221-51/+54
| | | | | | | | This is to avoid unused variables warnings if the code for disabled encoders is #if'ed away which will happen in a subsequent commit. In case of buf it also avoids shadowing. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/adpcmenc: Avoid copying packet data, allow direct renderingAndreas Rheinhardt2021-05-051-3/+3
| | | | | | | | When the packet size is known in advance like here, one can avoid an intermediate buffer for the packet data; and one can also use user-supplied buffers. 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/adpcmenc: Adds encoder for Westwood ADPCM.Aidan Richmond2021-04-261-2/+30
| | | | | Signed-off-by: Aidan Richmond <aidan.is@hotmail.co.uk> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_swf: remove memory allocation during trellis encodingZane van Iperen2021-04-101-3/+4
| | | | | | | The block size is hardcoded, so the buffer size is always known. Statically allocate the buffer on the stack. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcmenc: don't share a single AVClass between multiple AVCodecs.Zane van Iperen2021-04-021-8/+8
| | | | | | | Temporary fix until AVClass::child_class_next is gone. Reviewed-By: James Almer <jamrial@gmail.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcmenc: Mark encoders as init-threadsafeAndreas Rheinhardt2020-12-041-1/+1
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/adpcmenc: Fix leak of trellis buffer with ADPCM_IMA_AMVAndreas Rheinhardt2020-11-121-0/+1
| | | | | | | Fixes Coverity ID 1469181. Reviewed-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: add adpcm_ima_amv encoderZane van Iperen2020-11-091-1/+57
| | | | | | Fixes ticket #747. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_ima_swf: fix frame size to 4096Zane van Iperen2020-11-071-1/+1
| | | | | | | | | SWF File Format Specification, Version 19 says this is 1 raw sample + 4095 nibbles. https://www.adobe.com/content/dam/acom/en/devnet/pdf/swf-file-format-spec.pdf Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec: add adpcm_ima_alp encoderZane van Iperen2020-10-251-0/+40
|
* avcodec/adpcm_swf: support custom block size for encodingZane van Iperen2020-10-211-1/+1
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_swf: set block_align when encodingZane van Iperen2020-10-211-4/+3
| | | | | | Allows it to be muxed to WAVs. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcmenc: remove BLKSIZE #defineZane van Iperen2020-10-171-1/+1
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_ima_wav: support custom block size for encodingZane van Iperen2020-10-171-2/+2
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_yamaha: support custom block size for encodingZane van Iperen2020-10-171-2/+2
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_ima_apm: support custom block size for encodingZane van Iperen2020-10-171-2/+2
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_ima_ssi: support custom block size for encodingZane van Iperen2020-10-171-2/+2
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_ms: support custom block size for encodingZane van Iperen2020-10-171-2/+2
| | | | | | Fixes tickets #6585 and #7109 Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcmenc: add "block_size" optionZane van Iperen2020-10-171-0/+32
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec: add adpcm_argo encoderZane van Iperen2020-08-071-1/+85
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcmenc: cleanup trellis checksZane van Iperen2020-07-211-17/+18
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec: add adpcm_ima_apm encoderZane van Iperen2020-07-211-2/+32
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcmenc: remove forward declarationAndriy Gelman2020-06-201-2/+0
| | | | | Reviewed-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avcodec/adpcmenc: remove FF_ALLOC_OR_GOTO macros and gotos lableLimin Wang2020-06-131-22/+16
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/adpcmenc: fix formattingZane van Iperen2020-05-271-5/+5
| | | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: add adpcm_ima_ssi encoderZane van Iperen2020-05-271-0/+32
| | | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/adpcmenc: add capabilities argument to ADPCM_ENCODER()Zane van Iperen2020-05-271-17/+18
| | | | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/adpcmenc: Add FF_CODEC_CAP_INIT_CLEANUPLimin Wang2020-05-271-1/+1
| | | | | | | then we can remove adpcm_encode_close() in adpcm_encode_init() if have failed. so the goto error lable will be unnecessary and can be removed later. Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* adpcm: fix clipping for yamahaPaul B Mahol2017-02-151-2/+2
| | | | | | | According to specification max value allowed is 0x6000. Fixes #5862. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-211-1/+1
|\ | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-1/+1
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * Remove unnecessary get_bits.h #includes and add missing headers where needed.Alexandra Hájková2016-05-041-1/+0
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'Michael Niedermayer2015-07-271-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '059a934806d61f7af9ab3fd9f74994b838ea5eba': lavc: Consistently prefix input buffer defines Conflicts: doc/examples/decoding_encoding.c libavcodec/4xm.c libavcodec/aac_adtstoasc_bsf.c libavcodec/aacdec.c libavcodec/aacenc.c libavcodec/ac3dec.h libavcodec/asvenc.c libavcodec/avcodec.h libavcodec/avpacket.c libavcodec/dvdec.c libavcodec/ffv1enc.c libavcodec/g2meet.c libavcodec/gif.c libavcodec/h264.c libavcodec/h264_mp4toannexb_bsf.c libavcodec/huffyuvdec.c libavcodec/huffyuvenc.c libavcodec/jpeglsenc.c libavcodec/libxvid.c libavcodec/mdec.c libavcodec/motionpixels.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo.c libavcodec/noise_bsf.c libavcodec/nuv.c libavcodec/nvenc.c libavcodec/options.c libavcodec/parser.c libavcodec/pngenc.c libavcodec/proresenc_kostya.c libavcodec/qsvdec.c libavcodec/svq1enc.c libavcodec/tiffenc.c libavcodec/truemotion2.c libavcodec/utils.c libavcodec/utvideoenc.c libavcodec/vc1dec.c libavcodec/wmalosslessdec.c libavformat/adxdec.c libavformat/aiffdec.c libavformat/apc.c libavformat/apetag.c libavformat/avidec.c libavformat/bink.c libavformat/cafdec.c libavformat/flvdec.c libavformat/id3v2.c libavformat/isom.c libavformat/matroskadec.c libavformat/mov.c libavformat/mpc.c libavformat/mpc8.c libavformat/mpegts.c libavformat/mvi.c libavformat/mxfdec.c libavformat/mxg.c libavformat/nutdec.c libavformat/oggdec.c libavformat/oggparsecelt.c libavformat/oggparseflac.c libavformat/oggparseopus.c libavformat/oggparsespeex.c libavformat/omadec.c libavformat/rawdec.c libavformat/riffdec.c libavformat/rl2.c libavformat/rmdec.c libavformat/rtpdec_latm.c libavformat/rtpdec_mpeg4.c libavformat/rtpdec_qdm2.c libavformat/rtpdec_svq3.c libavformat/sierravmd.c libavformat/smacker.c libavformat/smush.c libavformat/spdifenc.c libavformat/takdec.c libavformat/tta.c libavformat/utils.c libavformat/vqf.c libavformat/westwood_vqa.c libavformat/xmv.c libavformat/xwma.c libavformat/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * lavc: Consistently prefix input buffer definesVittorio Giovara2015-07-271-1/+1
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * adpcm: Write the proper predictor in trellis mode in IMA QTMartin Storsjö2014-06-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The actual predictor value, set by the trellis code, never was written back into the variable that was written into the block header. This was accidentally removed in b304244b. This significantly improves the audio quality of the trellis case, which was plain broken since b304244b. Encoding IMA QT with trellis still actually gives a slightly worse quality than without trellis, since the trellis encoder doesn't use the exact same way of rounding as in adpcm_ima_qt_compress_sample and adpcm_ima_qt_expand_nibble. CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
| * adpcm: Avoid reading out of bounds in the IMA QT trellis encoderMartin Storsjö2014-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | This was broken in 095be4fb - samples+ch (for the previous non-planar case) equals &samples_p[ch][0]. The confusion probably stemmed from the IMA WAV case where it originally was &samples[avctx->channels + ch], which was correctly changed into &samples_p[ch][1]. CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>