1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

397 Commits

Author SHA1 Message Date
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
66b691f99f avcodec/internal: Move ff_get_buffer() to decode.h
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>
2022-08-27 14:14:56 +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
ce7dbd0481 avcodec/codec_internal: Make FFCodec.decode use AVFrame*
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>
2022-04-05 19:54:09 +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
73b847e136 avcodec/adpcm_data: Move tables only used by adpcm.c to it
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 08:31:23 +02:00
Andreas Rheinhardt
0a67ca63e4 avcodec/adpcm: Don't include disabled AVCodecs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 08:31:23 +02:00
Andreas Rheinhardt
0f168344f1 avcodec/adpcm: Disable dead code
This change ensures that the linker can drop adpcm_data.o if no decoder
that actually uses anything from there is enabled.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 08:30:18 +02:00
Andreas Rheinhardt
6914aa7fb4 avcodec/adpcm: Fix indentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 08:12:20 +02:00
Andreas Rheinhardt
421de73a10 avcodec/adpcm: Use smaller scope for some variables
This is to avoid unused variables warnings after the code for
the disabled encoders has been #if'ed away which will happen in
a subsequent commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 08:06:10 +02:00
Michael Niedermayer
f119d7526e Revert "avcodec/adpcm: Set vqa_version before use in init"
Redundant with ff946633a3.

Found-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This reverts commit 7a403da0cb.
2021-05-13 14:44:55 +02:00
Michael Niedermayer
7a403da0cb avcodec/adpcm: Set vqa_version before use in init
Fixes: null pointer dereference
Fixes: 33172/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_WS_fuzzer-5200164273913856

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-12 23:00:07 +02:00
Zane van Iperen
d1c28c6c78
avcodec/adpcm_psx: ignore unknown flag bits
As per documentation.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-05-12 20:25:22 +10:00
Zane van Iperen
a845e6daa9
avcodec/adpcm_psx: always fetch next byte irregardless of flag
Even though all samples are meant to be zero (if flag == 0x07),
doesn't mean that they aren't there. See No$PSX docs [1].

[1]: https://problemkaputt.de/psx-spx.htm#spuadpcmsamples

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-05-12 20:25:21 +10:00
Cameron Cawley
5c7313c740
avcodec: Implement Acorn Replay IMA ADPCM decoder
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-05-09 17:01:27 +10:00
Zane van Iperen
1ab74bc193
avcodec/adpcm_ima_apm: cosmetics
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-04-28 11:13:50 +10:00
Zane van Iperen
a859e57424
avcodec/adpcm_ima_apm: remove old extradata format
Was added in error very early on, passing in only the required fields.
Later, the muxer and demuxer were changed to pass the entire APMState
struct as extradata.

Technically a breaking change, but this was only around for a *very* short
time before it was updated,

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-04-28 11:13:43 +10: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
50442540d0
avcodec/adpcm: Fixes output from Westwood ADPCM.
Fixes bug #9198

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
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
ff946633a3
avcodec/adpcm: init from extradata before setting sample formats
Fixes a crash when decoding VQA files.

Regression since c012f9b265.

Reported-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-04-25 21:32:26 +10:00
Zane van Iperen
c012f9b265
avcodec/adpcm: refactor init/flush code
Most of the codecs just need everything zeroed. Those that don't
are either handled inline during decode, or pull state from
extradata.

Move state reset/init functionality into adpcm_flush(), and
invoke it from adpcm_decode_init().

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-04-10 14:42:18 +10:00
Zane van Iperen
e550667f61
avcodec/adpcm_ima_cunning: reset state on flush
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-25 12:51:09 +10:00
Zane van Iperen
257d9f91fc
avcodec/adpcm_ima_alp: reset state on flush
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-25 12:51:09 +10:00
Zane van Iperen
ff7bbd6d88
avcodec/adpcm_ima_ssi: reset state on flush
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-25 12:51:09 +10:00
Zane van Iperen
660c14a9b9
avcodec/adpcm_argo: reset state on flush
Commit 003b5c800f introduced seeking in argo_asf,
but this was missed, leading to non-deterministic output.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-25 12:51:08 +10:00
Zane van Iperen
efb58ec8f9
avcodec/adpcm_aica: reset state in flush callback
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-25 12:51:08 +10:00
Zane van Iperen
95280cf3e7
avcodec/adpcm_zork: reset state in flush callback
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-25 12:51:08 +10:00
Zane van Iperen
55a50885b9
avcodec/adpcm: add comment to has_status field
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-25 12:51:01 +10:00
Zane van Iperen
d294c33231
avcodec/adpcm_ima_cunning: reindent
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-19 23:38:33 +10:00
Zane van Iperen
684745230f
avcodec/adpcm_ima_cunning: support stereo
Changes the sample format to S16P, but was only ever mono so it
affects nothing.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-03-19 23:38:25 +10:00
Andreas Rheinhardt
87a5d9821f avcodec/adpcm: Mark decoders as init-threadsafe
They don't modify any global state

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-04 15:46:46 +01:00
Zane van Iperen
8903cb3c15
avcodec/adpcm_ima_amv: document header format
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-11-09 14:58:37 +10:00
Zane van Iperen
50d3a751aa
avcodec/adpcm_ima_amv: use coded sample count
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-11-09 14:58:37 +10:00
Zane van Iperen
d6912294d3
avcodec/adpcm_ima_amv: restrict to 1 channel
The format doesn't allow for anything else.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-11-09 14:58:30 +10:00
Zane van Iperen
45d45c8ec5
Revert "avcodec/adpcm_swf: support decoding multiple fixed-sized blocks at once"
Is incorrect behaviour. Was covering for an encoder bug where it produced frames
of the wrong size.

This reverts commit e9dd73d30d.

Fixes: out of array write
Fixes: 26821/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_SWF_fuzzer-5764465137811456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-11-07 23:43:02 +10:00
Zane van Iperen
e9dd73d30d
avcodec/adpcm_swf: support decoding multiple fixed-sized blocks at once
For incoming packets from WAV.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-10-21 11:23:26 +10:00
Michael Niedermayer
4ebe40ef64 avcodec/adpcm: Check channels before use for ADPCM_PSX
Fixes: division by zero
Fixes: 26293/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_PSX_fuzzer-5176665237618688
Fixes: 26331/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_PSX_fuzzer-5632330364092416

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-20 15:33:13 +02:00
Carl Eugen Hoyos
86f0bba776 lavc, lavf: Remove newlines from calls to avpriv_request_sample(). 2020-10-11 19:59:24 +02:00
Michael Niedermayer
991246657b avcodec/adpcm: Check block align for AV_CODEC_ID_ADPCM_PSX
Regression since: ca49476ace
Fixes: out of array write
Fixes: 25786/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_PSX_fuzzer-5704869380620288

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-11 16:42:49 +02:00
Zane van Iperen
bb021be31c
avcodec/adpcm_{psx,argo}: add missing indent
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-19 15:34:31 +10:00
Zane van Iperen
9eabe9c4b5
avcodec/adpcm_argo: support decoding multiple frames
Increases decode speed significantly.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-19 15:34:25 +10:00
Paul B Mahol
ca49476ace avcodec/adpcm: take into account block_align when decoding ADPCM_PSX
Should reduce decoding overhead.
2020-09-12 14:52:31 +02:00
Paul B Mahol
a1caa16d45 avcodec: add ADPCM IMA MOFLEX decoder 2020-09-03 18:06:50 +02:00
Zane van Iperen
5d1e1dd6bd
avcodec/adpcm_argo: add ff_adpcm_argo_expand_nibble() and cleanup parameters
Replaces adpcm_argo_expand_nibble(). Preparation for the encoder.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:04:25 +10:00
Zane van Iperen
fa7ad81dab
avcodec/adpcm_argo: fix incorrect documentation
Flag bit was in the wrong place.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-04 18:01:00 +10:00
Zane van Iperen
b35968e060 avcodec/adpcm_ima_apm: support new extradata format
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-26 21:47:13 +02:00