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

111753 Commits

Author SHA1 Message Date
Paul B Mahol
80fdf51b8f avfilter/af_asdr: add fltp sample format support 2023-08-13 02:33:32 +02:00
Paul B Mahol
37b4837584 avfilter/af_asdr: stop recreating output timestamps 2023-08-13 02:33:30 +02:00
Paul B Mahol
9c694804fd avfilter/af_adeclick: stop returning EINVAL error
Instead clip relevant parameters.
2023-08-12 11:27:32 +02:00
Paul B Mahol
3e04f53571 avfilter/af_adeclick: stop outputing pointless message 2023-08-12 00:26:50 +02:00
Paul B Mahol
3d85892052 avfilter/af_adeclick: fix window generation
Stops adding invalid sinusoids in overlap-add mode.
2023-08-11 23:59:19 +02:00
Paul B Mahol
97741adf6f avformat/au: improve au_probe() 2023-08-11 23:55:05 +02:00
Andreas Rheinhardt
d53acf452f avformat/matroskaenc: Don't write \0 unnecessarily
Writing the duration SimpleTag is special: It's size is
reserved in advance via an EBML Void element (if seekable)
and this reserved space is overwritten when writing the trailer;
it does not use put_ebml_string().

The string to write is created via snprintf on a buffer
of size 20; this buffer is then written via put_ebml_binary()
with a size of 20.

EBML strings need not be zero-terminated; if not, they
are implicitly terminated by the element's length field.
snprintf() always zero-terminates the buffer, i.e.
the last byte can be discarded when using an EBML string.
This patch does this.

The FATE changes are as expected: One byte saved for every
track; the only exception is the matroska-qt-mode test:
An additional byte is saved because an additional byte
could be saved from the enclosing Tags length field.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 23:56:35 +02:00
Andreas Rheinhardt
59cb099478 avformat/matroskaenc: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 23:56:35 +02:00
Andreas Rheinhardt
b5968df9f0 avformat/matroskaenc: Don't reserve space for HDR10+ when unnecessary
Do it only for video (the only thing for type for which HDR10+
makes sense).

This effectively reverts changes to several FATE ref-files
made in bda44f0f39.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 23:56:35 +02:00
Andreas Rheinhardt
a315474a02 avformat/matroskaenc: Add const where appropriate
Also move getting the DOVI side data immediately before its use.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 23:56:35 +02:00
Andreas Rheinhardt
a08ff28059 avformat/dovi_isom: Don't use AVFormatContext* for logctx
Pass it as void* instead. While just at it, also constify
the pointee of AVDOVIDecoderConfigurationRecord* in
ff_isom_put_dvcc_dvvc().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 23:56:35 +02:00
Andreas Rheinhardt
3b75375c9c avformat/matroskaenc: Avoid allocations when writing Dynamic HDR10+
Possible since 61b27b15fc.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 23:56:35 +02:00
Andreas Rheinhardt
cf20f18c41 avformat/matroskaenc: Use dedicated pointer for accesses
Improves readability; also split overlong lines.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 23:56:35 +02:00
Andreas Rheinhardt
1ed03b5757 avformat/matroskaenc: Use proper AVIOContext
These two AVIOContexts currently coincide, but this is not
guaranteed to remain so (in fact, I have plans to write each
TrackEntry into its own AVIOContext).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 23:56:35 +02:00
Andreas Rheinhardt
f49515b082 avformat/matroskaenc: Remove unnecessary check
It is only WebVTT which is special in WebM; hypothetical future
subtitle codecs in WebM will presumably use the ordinary code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 23:56:35 +02:00
Andreas Rheinhardt
43db0e5ecf avformat/matroskaenc: Hoist check out of loop
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 23:56:35 +02:00
Andreas Rheinhardt
d9d5695390 avcodec/amfenc: Fix declaration-after-statement warning
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 09:11:09 +02:00
Andreas Rheinhardt
3fc8041b56 avutil/tests/channel_layout: Test av_channel_layout_copy()
Specifically, test copying a channel layout with custom order,
so that the allocation codepath of av_channel_layout_copy()
is executed.

Reviewed-by: Nicolas George <george@nsup.org>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 09:10:47 +02:00
Andreas Rheinhardt
bdc4553a77 avutil/tests/channel_layout: Don't include lavu/channel_layout.c
This test does not need access to the internals of said compilation
unit.

Reviewed-by: Nicolas George <george@nsup.org>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 09:10:41 +02:00
Andreas Rheinhardt
fcaff9b495 avutil/tests/channel_layout: Also test non-AVBPrint variants
Reviewed-by: Nicolas George <george@nsup.org>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 09:10:35 +02:00
Andreas Rheinhardt
c4f35ba808 avutil/channel_layout: Account for \0 in sizes
av_channel_name(), av_channel_description() and
av_channel_layout_describe() are supposed to return the size
of the needed buffer to allow the user to check for truncation;
the documentation ("If the returned value is bigger than buf_size,
then the string was truncated.") confirms that size does not
mean strlen.

Yet the AVBPrint API, i.e. AVBPrint.len, does not account for
the terminating '\0'. Therefore the returned length is off by one.

Furthermore, also check for whether the returned value actually
fits in an int (which is the return value of these functions).

Reviewed-by: Nicolas George <george@nsup.org>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 08:55:05 +02:00
Andreas Rheinhardt
8bea4a83aa avutil/bprint: Allow size == 0 in av_bprint_init_for_buffer()
The AVBPrint API guarantees that the string buffer is always
zero-terminated; in order to honour this guarantee, there
obviously must be a string buffer at all and it must have
a size >= 1. Therefore av_bprint_init_for_buffer() treats
passing a NULL buffer or size == 0 as invalid data that
leads to undefined behaviour, namely NPD in case NULL is provided
or a write to a buffer of size 0 in case size == 0.

But it would be easy to support this, namely by using the internal
buffer with AV_BPRINT_SIZE_COUNT_ONLY in case size == 0.

There is a reason to allow this: Several functions like
av_channel_(description|name) are actually wrappers
around corresponding AVBPrint functions. They accept user
provided buffers and are supposed to return the required
size of the buffer, which would allow the user to call
it once to get the required buffer size and call it once
more after having allocated the buffer.
If av_bprint_init_for_buffer() treats size == 0 as invalid,
all these users would need to check for this themselves
and basically add the same codeblock that this patch
adds to av_bprint_init_for_buffer().

This change is in line with e.g. snprintf() which also allows
the pointer to be NULL in case size is zero.

This fixes Coverity issues #1503074, #1503076 and #1503082;
all of these issues are about providing NULL to the channel-layout
functions that are wrappers around AVBPrint versions.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 08:53:38 +02:00
Andreas Rheinhardt
8a81ecce73 avutil/bprint: Don't use value of AV_BPRINT_SIZE_AUTOMATIC directly
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 08:52:30 +02:00
Andreas Rheinhardt
1df13b3891 avformat/matroskaenc: Don't pretend to be able to mux RV30
The demuxer uses a extradata offset of 26, so we would need
to recreate the missing 26 bytes somehow in the muxer, but
we just don't. Remuxed files (like real/rv30.rm from the FATE-suite)
don't work due to missing extradata.

(The extradata offset also applies to RV40 and the extradata
is indeed lost upon remuxing, yet remuxing real/spygames-2MB.rmvb
works; our RV40 decoder does not use extradata at all.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 08:37:01 +02:00
Andreas Rheinhardt
4e43cdcd1a avformat/matroskaenc: Don't pretend to support unsupported codecs
RV10 and RV20 are unsupported because creating the correct CodecPrivate
is unsupported (the demuxer uses a codecpriv_offset of 26, so one
would need to recreate the missing 26 bytes); COOK and SIPR are
unsupported, because Matroska uses a packetization mode that is
different from what FFmpeg uses in its packets (see
matroska_parse_rm_audio() in the demuxer).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 08:37:01 +02:00
Andreas Rheinhardt
11623f36a8 fate/matroska: Add ALAC remux test
Provides coverage for the code transforming the ALAC extradata.
Also set creation_time metadata to test this, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 08:36:47 +02:00
Andreas Rheinhardt
fd8a395cd7 avformat/matroskaenc: Don't reserve unnecessarily many EBML elements
bda44f0f39 added code that
potentially added another BlockMore master and BlockAdditional
data as well as BlockAddID number, yet it bumped the number
of EBML elements by four instead of only three.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 00:17:11 +02:00
Andreas Rheinhardt
c797b6400d avformat/matroskaenc: Support rotations
Matroska supports orthogonal transformations (both pure rotations
as well as reflections) via its 3D-projection elements, namely
ProjectionPoseYaw (for a horizontal reflection) as well as
ProjectionPoseRoll (for rotations). This commit adds support
for this.

Support for this in the demuxer has been added in
937bb6bbc1 and
the sample used in the matroska-dovi-write-config8 FATE-test
includes a displaymatrix indicating a rotation which is now
properly written and read, thereby providing coverage for
the relevant code in the muxer as well as the demuxer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-10 00:17:11 +02:00
Andreas Rheinhardt
7a2b587dea avformat/sbgdec: Use avio_read_to_bprint() where appropriate
Note: There is a slight difference in the handling of
the max_file_size option: The earlier code used it to mean
to limit the size of the buffer to allocate; the new code
treats it more literally as maximum size to read from
the input.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-09 23:36:12 +02:00
Andreas Rheinhardt
9583a2c8eb fftools/ffprobe: Use proper enum type
This is a bit cleaner as int need not be the underlying type
of an enum if a smaller type can hold all its values.
Also declare the children_ids array as const as it never changes.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-08 20:20:36 +02:00
Marton Balint
2eb7df1cbd avcodec/on2avc: use correct fft sizes
Also rename the contexts and the functions so their names will reflect their
intended size.

With the earlier patch this fixes the audio corruption regression caused by
6ba0aa1770.

Fixes ticket #10029.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-08-08 18:33:21 +02:00
Marton Balint
f296c76590 avcodec/on2avc: use the matching AVTX context for the 512 sized iMDCT
Improves the audio corruption regression caused by
6ba0aa1770 reported in ticket #10029.

There is still however a noticable audio glitch, so the FFT conversion to AVTX
probably also needs some modifications.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-08-08 18:33:21 +02:00
Paul B Mahol
c7bfc826c3 avfilter/af_vibrato: refactor code
Move some code out of inner loop.
2023-08-08 17:45:32 +02:00
Casey Smalley
b98ee1a355 aarch64/hevc: Replace br return with ret
This patch changes the return instruction in the tr_32x4 macro from
BR to RET.

Function returns should always use the RET instruction instead of BR,
to avoid interfering with branch prediction.

On devices that support BTI, this is observeable as a landing pad is
required when branching with BR. The change fixes
fate-hevc-hdr-vivid-metadata when on hardware with BTI support.

Signed-off-by: Casey Smalley <casey.smalley@arm.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-08-08 13:46:07 +03:00
Elias Carotti
418c954e31 lavc/libx264: add mb_info option
Pass the information about unchanged parts of the frame by means of
the AVVideoHint side data.
2023-08-08 10:06:38 +02:00
Elias Carotti
5012b4ab4c lavu: add video_hint API
Add side data type to provide hint to the video encoders about
unchanged portions of each frame.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-08-08 09:46:11 +02:00
Benjamin Cheng
c0709706dd vulkan_h264: fill correct ScalingList8x8 entries
The Vulkan spec wants ScalingList8x8 as defined by ITU spec, which is in
a different order from how ffmpeg parses it.
2023-08-08 08:27:14 +02:00
Brad Smith
f6d8464590
configure: use just the pkg-config for sndio
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-08-07 22:31:06 +02:00
Paul B Mahol
482a22e10f avfilter/avf_showcwt: reduce latency/delay in some cases 2023-08-07 22:24:59 +02:00
Paul B Mahol
5ff88bb7bc avfilter/avf_showcwt: simplify 2023-08-07 22:24:59 +02:00
Paul B Mahol
de71928383 avfilter/avf_showcwt: add two more options 2023-08-07 22:24:58 +02:00
Paul B Mahol
d295b6b693 avfilter: fix highshelf zdf coefficients 2023-08-07 11:57:28 +02:00
Andreas Rheinhardt
e35dfe864d avcodec/avcodec: Add FFHWAccel, hide internals of AVHWAccel
This commit is the AVHWAccel analogue of commit
20f9727018: It moves the private fields
of AVHWAccel to a new struct FFHWAccel extending AVHWAccel
in an internal header (namely hwaccel_internal.h).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:50:29 +02:00
Andreas Rheinhardt
c48cc9c6e9 avcodec/decode: Extend ff_hwaccel_frame_priv_alloc()'s task
All usages of ff_hwaccel_frame_priv_alloc() have the same pattern:
Check for whether a hwaccel is in use; check whether it needs
private frame-specific data; allocate the AVBuffer and set
it.

This commit modifies ff_hwaccel_frame_priv_alloc() to perform
this task on its own.

(It also seems that the H.264 decoder did not perform proper
cleanup in case the buffer could not be allocated. This has been
changed.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:50:29 +02:00
Andreas Rheinhardt
dcc1847b18 avcodec/hwconfig: Move HWACCEL_CAP_* to a new header
libavcodec/hwconfig.h currently contains HWACCEL_CAP_* flags
as well as the definition of AVCodecHWConfigInternal and some
macros to create them.

The users of these two are nearly disjoint: The flags are used
by files providing AVHWAccels whereas AVCodecHWConfigInternal
is used by files providing codecs (for FFCodec.hw_configs).

This patch therefore moves these flags to a new file hwaccel_internal.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:50:29 +02:00
Andreas Rheinhardt
428133a3ed avcodec/qsvenc: Remove unnecessary config_components.h inclusion
While just at it, also improve the other headers a bit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:21:13 +02:00
Andreas Rheinhardt
19ffa2ff2d avfilter: Remove unnecessary formats.h inclusions
A filter needs formats.h iff it uses FILTER_QUERY_FUNC();
since lots of filters have been switched to use something
else than FILTER_QUERY_FUNC, they don't need it any more,
but removing this header has been forgotten.
This commit does this; files with formats.h inclusion went down
from 304 to 139 here (it were 449 before the preceding commit).

While just at it, also improve the other headers a bit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:21:13 +02:00
Andreas Rheinhardt
19af142d45 avfilter/internal: Don't include formats.h
internal.h doesn't rely on it; instead include it directly
in every user that needs it (a filter needing it is basically
equivalent to it using FILTER_QUERY_FUNC, i.e. a majority of
filters doesn't need it).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:21:13 +02:00
Andreas Rheinhardt
571d0359fa avfilter/vf_colorconstancy: Remove redundant CONFIG check
This file is only used by the greyedge filter and therefore
only compiled if said filter is enabled. This also allows
to remove a config_components.h inclusion, avoiding unnecessary
rebuilds.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:21:13 +02:00
Andreas Rheinhardt
2f62a433f2 avfilter: Deduplicate default video inputs/outputs
Lots of video filters use a very simple input or output:
An array with a single AVFilterPad whose name is "default"
and whose type is AVMEDIA_TYPE_VIDEO; everything else is unset.

Given that we never use pointer equality for inputs or outputs*,
we can simply use a single AVFilterPad instead of dozens; this
even saves .data.rel.ro (8312B here) as well as relocations.

*: In fact, several filters (like the filters in vf_lut.c)
already use the same outputs; furthermore, ff_filter_alloc()
duplicates the input and output pads so that we do not even
work with the pads directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:21:13 +02:00