1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

114818 Commits

Author SHA1 Message Date
James Almer
662dbf826d avutil/frame: add helper to remove side data of a given type from an array
Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-11 09:18:19 -03:00
James Almer
55621f6fae avutil/frame: add a flag to allow overwritting existing entries
Enable it only for side data types that don't allow more than one entry.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-11 09:18:19 -03:00
James Almer
a16338089c avutil/frame: add helper for adding side data w/ AVBufferRef to array
Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-11 09:18:19 -03:00
Martin Storsjö
e4f5c2414b tests/movenc: Validate that normal muxer usage doesn't print warnings
We have test to make sure that certain configurations do print
warnings. However, the normal operation of the muxer within this
test always printed a warning, so those tests to check for
extra warnings didn't essentially guard anything.

The warning that always was printed, "track 1: codec frame size is
not set" was not present in the libav fork where this testcase
originated, it was removed in f234e8a32e.

Set the frame size for the audio stream to silence the warning,
and use this frame size in a couple later calculations, and check
that one test configuration doesn't print warnings.

Setting the frame size apparently changes the rounding of a timestamp
in the ismv muxing testcase.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-11 14:08:55 +03:00
Andreas Rheinhardt
497a0f839d avformat/img2: Avoid relocations for ff_img_tags
The strings here are so short that using a pointer is wasteful
(the longest string takes nine bytes; on 64 bit systems,
the pointer+padding already take 12 bytes). So avoid them
and add asserts to ensure that no one ever tries to use a too
long tag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
Andreas Rheinhardt
1533351990 avcodec/flacenc: Avoid shift where possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
Andreas Rheinhardt
0458fdbeed avcodec/ac3enc: Avoid calculating the CRC multiple times
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
Andreas Rheinhardt
28ffc39808 avcodec/ac3enc: Move EAC-3 specific initialization to eac3enc.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
Andreas Rheinhardt
2281ab5c24 avcodec/ac3enc: Avoid function pointers to initialize MDCT
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
Andreas Rheinhardt
6c55cb95ed avcodec/ac3enc_float: Remove uninformative error message
AVERROR(ENOMEM) is enough.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
Andreas Rheinhardt
3cd136bc12 avcodec/ac3enc: Deduplicate copying input samples
These memcpy operands only depend upon sizeof(SampleType)
(and this size is actually the same for both the fixed-point
and the floating-point encoders for most (all supported?)
systems).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
Andreas Rheinhardt
7311a9086e avcodec/ac3enc: Deduplicate allocating buffers
These allocations only depend upon sizeof(SampleType)
(and this size is actually the same for both the fixed-point
and the floating-point encoders for most (all supported?)
systems).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
Andreas Rheinhardt
2fcc50d1f5 avcodec/ac3enc: Share more code between fixed/float encoders
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
Andreas Rheinhardt
1042ee36cd avcodec/ac3enc: Move ff_ac3_validate_metadate() upwards
Will avoid a forward declaration in the next commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
Andreas Rheinhardt
6244ecf8ec avcodec/ac3enc: Use common encode_frame function
This is in preparation for sharing even more stuff
common to the fixed and floating-point encoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:53:26 +02:00
Andreas Rheinhardt
fee093a570 avcodec/ac3enc: Remove disabled code for RealAudio variant of AC-3
Implicitly disabled by 4679a474f0.
Given that no one has ever complained about this, this commit
removes the now dead code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:52:46 +02:00
Andreas Rheinhardt
27a830c1d8 avcodec/ac3enc: Remove always-false sample rate check
encode_preinit_audio() already checks that the sample rate
is among AVCodec.supported_samplerates.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:44:27 +02:00
Andreas Rheinhardt
e878ec7eb2 avcodec/ac3enc: Avoid copying strings
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:44:27 +02:00
Andreas Rheinhardt
8261d5d38c avcodec/ac3enc: Use bit-operations for bit-mask
Simply masking the LFE bit is more natural than subtracting
if set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:44:27 +02:00
Andreas Rheinhardt
b3d12fe200 avcodec/ac3enc: Remove redundant channel layout checks
These are all checked generically via AVCodec.ch_layouts
in encode_preinit_audio().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:44:27 +02:00
Andreas Rheinhardt
13daafd5c0 avcodec/ac3enc: Don't overwrite AVCodecContext.ch_layout
This is unnecessary (the channel layout guessing code became
moot when the channel layouts were enforced generically)
and also dangerous, as a custom channel layout mapping
would leak in case one was used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:44:27 +02:00
Andreas Rheinhardt
c3fb0c5bab avcodec/ac3enc: Don't presume ch_layout to be AV_CHANNEL_ORDER_NATIVE
It is perfectly legal for users to use a custom layout
that is equivalent to a supported native one.
In this case the union in AVChannelLayout is not an uint64_t mask,
but a pointer to a custom map.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-11 12:44:27 +02:00
Anton Khirnov
0e4dfa4709 Revert "bsf: use standard include paths"
This reverts commit 41b73ae883.

This patch was pushed extremely quickly, without giving developers the
time to object.
2024-04-10 15:17:54 +02:00
J. Dekker
985fdf8e3d tests/checkasm: add exclude_guest for non-x86 linux perf
The exclude_guest option only has an effect on x86. Omitting
'exclude_guest' defaults to zero which implies that you can count guest
events should you run one. Some non-x86 kernels just ignore it, while
others (e.g. the Asahi Linux kernels) require the user to explicitly set
the option to 1, i.e. the only behaviour that makes sense when counting
guest events isn't supported.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-04-10 13:37:40 +02:00
Lynne
89a9042291
lavc/avfft: fix RDFT wrapper stride
Per the lavu/tx docs:

> * For forward transforms (R2C), stride must be the spacing between two
> * samples in bytes. For inverse transforms, the stride must be set
> * to the spacing between two complex values in bytes.

The code did the reverse.
The stride parameter is currently not respected for RDFT transforms,
but has to be correct, for a potential future change.
2024-04-10 13:22:18 +02:00
Fei Wang
0534d2ac84 lavfi/dnn_backend_torch: Include mem.h
Fix build fail since 790f793844.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-04-10 18:18:49 +08:00
Stefano Sabatini
7e59c4f908 doc/muxers/matroska: apply misc consistency fixups 2024-04-10 10:56:54 +02:00
Stefano Sabatini
8510108c1d doc/muxers: add lrc 2024-04-10 10:56:54 +02:00
Stefano Sabatini
57d64bb715 doc/muxers: add kvag 2024-04-10 10:56:54 +02:00
Stefano Sabatini
f7fd228560 doc/muxers: add jacosub 2024-04-10 10:56:54 +02:00
Stefano Sabatini
4fe3c8dcfd doc/muxers: add ivf 2024-04-10 10:56:54 +02:00
Martin Storsjö
fbd5e238d4 movenc: Allow writing timed ID3 metadata
This is based on a spec at https://aomediacodec.github.io/id3-emsg/,
further based on ISO/IEC 23009-1:2019.

Within libavformat, timed ID3 metadata (already supported by the
mpegts demuxer and muxer) is handled as a separate data AVStream
with codec type AV_CODEC_ID_TIMED_ID3. However, it doesn't
have a corresponding track in the mov file - instead, these events
are written as separate toplevel 'emsg' boxes.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-10 10:48:50 +03:00
Martin Storsjö
e4e3d25d41 movenc: Remove a leftover commented out line
This line originates from 6f69f7a8bf.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-10 10:42:02 +03:00
Martin Storsjö
8339a45400 aarch64: Factorize code for CPU feature detection on Apple platforms
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-10 10:39:08 +03:00
Andrew Kelley
41b73ae883 bsf: use standard include paths
Removes the special -I flag specified in the avcodec/bsf/ subdirectory.

This makes code copy-pastable to other parts of the ffmpeg codebase, as
well as simplifying the build script.

It also reduces ambiguity, since there are many instances of same-named
header files existing in both libavformat/ and libavcodec/
subdirectories.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-09 22:21:59 -03:00
James Almer
9dbc9a0f97 avcodec/libsvt1: check return value of send/receive functions
Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-09 21:37:49 -03:00
Marton Balint
c38f785be4 avformat/mov_chan: add support for omitted_channel bitmask in chnl atom
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-04-09 23:14:22 +02:00
Marton Balint
92e7a9a4d5 avformat/mov_chan: respect channel order when parsing and creating chnl atom
Previously we always assumed that the channels are in native order, even if
they were not. The new channel layout API allows us to signal the proper
channel order, so let's do so.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-04-09 23:14:22 +02:00
Marton Balint
da0fe26379 avformat/mov_chan: factorize some layout map search functions
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-04-09 23:14:22 +02:00
Marton Balint
c68dc3e5f1 avformat/mov_chan: check channel count of layout tags at compile time
We can do this by using an X-macro for channel map declaration and doing a
static_assert() in one pass for the check. Thanks for Andreas Rheinhardt for
the suggestion.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-04-09 23:14:21 +02:00
Marton Balint
7801451376 avformat/hlsenc: use a slash separator even in win32
We don't know if the protocol used is referring to a local file or a remote
resource, so it is better to simply use slash as separator which works all the
time. (well, except in very special cases when the user specified a \\?\ path)

Fixes ticket #9780.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-04-09 23:13:09 +02:00
Marton Balint
4721b9f15f avfilter/buffersrc: never override channel count in av_buffersrc_add_frame_flags
Overriding unknown layouts with the negotiated layout is OK, but the number of
channels should match with what was negotiated.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-04-09 23:12:46 +02:00
Martin Storsjö
359b6a7f8a aarch64/ac3dsp: simplify the end of ff_ac3_sum_square_butterfly_float_neon
Before:                           Cortex A53     A72     A78      M1
ac3_sum_square_bufferfly_float_neon:  1005.7   516.5   224.5   194.0
After:
ac3_sum_square_bufferfly_float_neon:   981.7   504.5   223.2   189.5

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-04-09 16:50:49 +02:00
Frank Plowman
1c0149359a lavc/vvc: Fix out-of-bounds array access
The 2 which has been changed to an 8 in the array length expression is
the maximum value of sps_bitdepth_minus8.  This was missed when updating
to VVCv2, which increased this maximum from 2 to 8.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-04-09 22:35:48 +08:00
Frank Plowman
2b7e79e890 lavc/vvc: Avoid overflow in coeff scale intermediate
Make intermediate result 64-bits to avoid an overflow before the right
shift.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-04-09 22:30:35 +08:00
Frank Plowman
fcf74c5ebc lavc/vvc: Fix buffer overread in CABAC
The size variable here is taken as gospel for the bounds of the input
buffer in later logic.  Clamp it to ensure that the returned region
does not extend past that allocated in the underlying GetBitContext,
even in the case entry point offsets are signalled in the bitstream.
Also assert this for good measure.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-04-09 22:30:18 +08:00
Frank Plowman
f499503073 lavc/vvc_parser: Fix integer overflow calculating framerate
num_units_in_tick and time_scale are both 32-bit unsigned integers.
Storing them as ints was causing overflows.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-04-09 22:15:29 +08:00
Frank Plowman
b4baa4c0b3 lavc/vvc: Fix left shifts of negative values
All these variables lie in the range [-12..12]

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-04-09 22:13:49 +08:00
J. Dekker
67e2f8b6bf configure, etc: switch to shebang without space
Note that the config.sh file is left without a shebang, this file is
supposed to be sourced into the current environment.

This commit is purely cosmetic.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-04-09 16:01:24 +02:00
J. Dekker
fcfd17dbb4 ffbuild/libversion.sh: add shebang
The implicit interpreter is dependent on the environment, and isn't
guaranteed to be /bin/sh. Some packagers call this script directly, and
in certain environments such as containers using qemu-user through
binfmt_misc emulation on Linux it doesn't fallback to /bin/sh.

To fix these cases we add the interpreter explicitly.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-04-09 15:34:53 +02:00