Commit Graph

114 Commits

Author SHA1 Message Date
Andreas Rheinhardt 790f793844 avutil/common: Don't auto-include mem.h
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>
2024-03-31 00:08:43 +01:00
Anton Khirnov 08bebeb1be Revert "all: Don't set AVClass.item_name to its default value"
Some callers assume that item_name is always set, so this may be
considered an API break.

This reverts commit 0c6203c97a.
2024-01-20 10:34:48 +01:00
Andreas Rheinhardt 0c6203c97a all: Don't set AVClass.item_name to its default value
Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9;
also avoids relocations.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 15:12:33 +01:00
Anton Khirnov 8d73f3ce56 lavc: support AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE in all no-delay encoders
Including fake-delay encoders marked with FF_CODEC_CAP_EOF_FLUSH.
2023-01-29 09:22:57 +01:00
Andreas Rheinhardt bffc8f9af1 avcodec/adpcmenc: Round up required buffer size
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>
2022-09-15 21:15:27 +02:00
Andreas Rheinhardt 48286d4d98 avcodec/codec_internal: Add macro to set AVCodec.long_name
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>
2022-09-03 15:42:57 +02:00
Andreas Rheinhardt 5828e8209f avcodec: Constify frame->data pointers for encoders where possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-05 03:21:41 +02:00
Andreas Rheinhardt 21b23ceab3 avcodec: Make init-threadsafety the default
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>
2022-07-18 20:04:59 +02:00
Andreas Rheinhardt 4243da4ff4 avcodec/codec_internal: Use union for FFCodec decode/encode callbacks
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>
2022-04-05 20:02:37 +02:00
Andreas Rheinhardt 20f9727018 avcodec/codec_internal: Add FFCodec, hide internal part of AVCodec
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>
2022-03-21 01:33:09 +01:00
Andreas Rheinhardt a688f3c13c avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.h
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>
2022-03-21 01:33:09 +01:00
Martin Storsjö a78f136f3f configure: Use a separate config_components.h header for $ALL_COMPONENTS
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>
2022-03-16 14:12:49 +02:00
Anton Khirnov 984612a403 adpcm: convert to new channel layout API
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>
2022-03-15 09:42:39 -03:00
Andreas Rheinhardt c8a8691c97 avcodec/adpcmenc: Don't include disabled AVCodecs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 08:00:39 +02:00
Andreas Rheinhardt 62e3d01cc7 avcodec/adpcmenc: Deduplicate AVClasses
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>
2021-07-22 07:50:05 +02:00
Andreas Rheinhardt 63f736f476 avcodec/adpcmenc: #if disabled code away, fix build without ADPCM_ARGO
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>
2021-07-22 07:35:31 +02:00
Andreas Rheinhardt 10f8f06a56 avcodec/adpcmenc: Use smaller scope for some variables
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>
2021-07-22 07:32:09 +02:00
Andreas Rheinhardt 32b20a274a avcodec/adpcmenc: Avoid copying packet data, allow direct rendering
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>
2021-05-05 12:26:14 +02:00
Andreas Rheinhardt a247ac640d avcodec: Constify AVCodecs
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>
2021-04-27 10:43:15 -03:00
Aidan Richmond a0fd55c206
avcodec/adpcmenc: Adds encoder for Westwood ADPCM.
Signed-off-by: Aidan Richmond <aidan.is@hotmail.co.uk>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-04-26 19:56:32 +10:00
Zane van Iperen 9e89a23eac
avcodec/adpcm_swf: remove memory allocation during trellis encoding
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>
2021-04-10 14:42:12 +10:00
Zane van Iperen aa1cfe05a5
avcodec/adpcmenc: don't share a single AVClass between multiple AVCodecs.
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>
2021-04-02 09:00:32 +10:00
Andreas Rheinhardt 6643eaaa30 avcodec/adpcmenc: Mark encoders as init-threadsafe
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-04 15:46:46 +01:00
Andreas Rheinhardt 454bee5be0 avcodec/adpcmenc: Fix leak of trellis buffer with ADPCM_IMA_AMV
Fixes Coverity ID 1469181.

Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-12 07:23:06 +01:00
Zane van Iperen 555f5c1fc5
avcodec: add adpcm_ima_amv encoder
Fixes ticket #747.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-11-09 14:58:38 +10:00
Zane van Iperen 406879f49c
avcodec/adpcm_ima_swf: fix frame size to 4096
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>
2020-11-07 23:43:26 +10:00
Zane van Iperen 40a8d43885
avcodec: add adpcm_ima_alp encoder 2020-10-25 23:44:26 +10:00
Zane van Iperen 4919b3c1c4
avcodec/adpcm_swf: support custom block size for encoding
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-21 11:26:39 +10:00
Zane van Iperen 0547fa572b
avcodec/adpcm_swf: set block_align when encoding
Allows it to be muxed to WAVs.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-21 11:26:38 +10:00
Zane van Iperen bf4a253f38
avcodec/adpcmenc: remove BLKSIZE #define
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:07 +10:00
Zane van Iperen e368be5230
avcodec/adpcm_ima_wav: support custom block size for encoding
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:06 +10:00
Zane van Iperen ed1cfb8e31
avcodec/adpcm_yamaha: support custom block size for encoding
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:06 +10:00
Zane van Iperen eb75a80dc8
avcodec/adpcm_ima_apm: support custom block size for encoding
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:06 +10:00
Zane van Iperen b5c2c9a1ce
avcodec/adpcm_ima_ssi: support custom block size for encoding
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:05 +10:00
Zane van Iperen bd1c94bb68
avcodec/adpcm_ms: support custom block size for encoding
Fixes tickets #6585 and #7109

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:05 +10:00
Zane van Iperen c78c60c3e8
avcodec/adpcmenc: add "block_size" option
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-17 09:36:02 +10:00
Zane van Iperen 62da99e1d0
avcodec: add adpcm_argo encoder
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:04:28 +10:00
Zane van Iperen e35a0f8f3f avcodec/adpcmenc: cleanup trellis checks
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-07-21 11:36:14 +10:00
Zane van Iperen 80dda80981 avcodec: add adpcm_ima_apm encoder
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-07-21 11:36:14 +10:00
Andriy Gelman 536e5dfa73 avcodec/adpcmenc: remove forward declaration
Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-06-20 23:20:27 -04:00
Limin Wang 3240121509 avcodec/adpcmenc: remove FF_ALLOC_OR_GOTO macros and gotos lable
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-06-13 06:59:18 +08:00
Zane van Iperen 09e6e45588 avcodec/adpcmenc: fix formatting
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-27 22:13:39 +02:00
Zane van Iperen b1189c1571 avcodec: add adpcm_ima_ssi encoder
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-27 22:13:39 +02:00
Zane van Iperen 908199802a avcodec/adpcmenc: add capabilities argument to ADPCM_ENCODER()
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>
2020-05-27 22:13:20 +02:00
Limin Wang 6124cbdcfa avcodec/adpcmenc: Add FF_CODEC_CAP_INIT_CLEANUP
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>
2020-05-27 21:59:51 +08:00
Paul B Mahol ee4aa388b2 adpcm: fix clipping for yamaha
According to specification max value allowed is 0x6000.
Fixes #5862.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-15 12:46:01 +01:00
Clément Bœsch 8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Vittorio Giovara 41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Alexandra Hájková 5c31eaa999 Remove unnecessary get_bits.h #includes and add missing headers where needed.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 15:14:14 +02:00
Michael Niedermayer 29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* 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>
2015-07-27 23:15:19 +02:00