Commit Graph

112281 Commits

Author SHA1 Message Date
Andreas Rheinhardt
dd48e49d54 avformat/avformat: Deprecate AVFMT_ALLOW_FLUSH
It is of no value to the user, because every muxer can always
be flushed with a NULL packet. As its documentation shows
("If not set, the muxer will not receive a NULL packet in
the write_packet function") it is actually an internal flag
that has been publically exposed because there was no internal
flags field for output formats for a long time. But now there is
and so use it by replacing the public flag with a private one.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-03 01:45:46 +02:00
Niklas Haas
0d596776c6 avcodec/decode: use ff_icc_profile_sanitize
Fixes: https://trac.ffmpeg.org/ticket/9673
2023-10-03 00:28:50 +02:00
Niklas Haas
443471356f avfilter/vf_iccdetect: use ff_icc_profile_sanitize 2023-10-03 00:28:50 +02:00
Niklas Haas
beac4a999c avcodec/fflcms2: add ff_icc_profile_sanitize
Buggy ICCv4 profiles are unfortunately used in the wild, and it's quite
easy to work around them by just forcing the white point to the correct
value. Display a warning just in case.

See-Also: https://trac.ffmpeg.org/ticket/9673
2023-10-03 00:28:50 +02:00
Niklas Haas
22530ad1ce lavc/h274: transpose IDCT
This is mathematically equivalent to what we were doing before, but
gives subtly different results due to rounding (rows first vs columns
first). Doing it this way makes our film grain database generation match
reference implementation and now produces bit-exact outputs in my
testing.

Rename the transposed variables to be a bit less confusing.
2023-10-03 00:27:14 +02:00
Martin Storsjö
2b9c6c70e6 tools: Don't include the direct library names when linking
When linking the main tools, the object files to link are set up
via the variable OBJS-<name>, but for the tools, we've only
used the target's list of dependencies.

In most cases, this has been fine, but it has caused specifying
the libraries to link in a duplicate fashion; the linking command
has looked like this:

    $CC -Llibavutil ... tools/tool.o libavutil/libavutil.a -lavutil

Normally, the libraries to link are handled with "-Llibavutil -lavutil";
when linking the main fftools, this is how they are linked.

In the case of the binaries under the "tools" directory (within the
make variable TOOLS), we've passed the full set of dependencies
to the linker, via $^, which does contain the names of the
dependency libraries as well.

When libraries are built as regular static libraries, or shared
unix libraries, this has all worked fine. When libraries are
built as DLLs for Windows, though, the norm is not to pass the
actual DLL to the linker, but an import library.

Mingw tools generally can handle linking directly against a DLL
as well, but MSVC tools don't support that, and error out with
a very cryptic error message:

    libavdevice\avdevice.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2D8

By omitting these parts of the dependencies, linking of these tool
executables succeed in MSVC builds with shared libraries enabled.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-02 22:49:07 +03:00
Mark Thompson
014c138633 cbs_av1: Make fake OBU size length field a write option
This is an option to modify the behaviour of the writer, not a syntax
field.
2023-10-02 20:32:03 +01:00
Rémi Denis-Courmont
1a4bd76ea5 swscale/rgb2rgb: remove R-V V shuffle_bytes_3012
This is slower than the Zbb version on real hardware due to register
strides. Proper support for vector byte-swap requires the Zvbb
extension, but it's much too early for me to worry about it.
2023-10-02 22:28:38 +03:00
Rémi Denis-Courmont
c4a144c29d swscale/rgb2rgb: add R-V Zbb shuffle_bytes_3210 2023-10-02 22:28:25 +03:00
Rémi Denis-Courmont
cec48e3b32 riscv: factor out the bswap32 assembler 2023-10-02 22:28:21 +03:00
Paul B Mahol
4fe0a31cab avcodec/mlpenc: allow changing some LPC parameters 2023-10-02 20:31:30 +02:00
Paul B Mahol
a1b29ab60d avcodec/mlpenc: increase compression ratio even more, fix LPC parameters 2023-10-02 20:31:28 +02:00
Paul B Mahol
0be5da9cfa avcodec/mlpenc: increase compression ratio when input is of lower bit depth 2023-10-02 20:31:27 +02:00
Rémi Denis-Courmont
b36f3d5330 lavc/fmtconvert: unroll R-V V int32_to_float_fmul_scalar 2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont
f3dfd4ccf2 lavc/aacpsdsp: unroll RISC-V V hybrid_synthesis_deint 2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont
0f1336b285 lavc/aacpsdsp: unroll RISC-V V hybrid_analysis_ileave 2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont
69d7486e59 lavc/aacpsdsp: unroll RISC-V V mul_pair_single 2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont
c270928cc0 lavc/aacpsdsp: unroll R-V V stereo interpolate 2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont
27d74fc1ef lavc/aacpsdsp: simplify R-V V stereo interpolate
Remove some useless vector splat.
2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont
3575ee2ea3 lavc/audiodsp: unroll RISC-V clip functions
audiodsp.vector_clip_int32_c: 17500.7
audiodsp.vector_clip_int32_rvv_i32: 8404.7  (m1)
audiodsp.vector_clip_int32_rvv_i32: 2689.9  (m8)

audiodsp.vector_clipf_c: 33679.7
audiodsp.vector_clipf_rvf: 7019.7
audiodsp.vector_clipf_rvv_f32: 8328.0       (m1)
audiodsp.vector_clipf_rvv_f32: 2209.4       (m8)
2023-10-02 18:07:54 +03:00
Andreas Rheinhardt
b6e5136ba3 avcodec/mpegvideo_dec: Remove commented-out legacy cruft
Added in 80e9e63c94 for reasons
unknown to me.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:23:28 +02:00
Andreas Rheinhardt
f52b4a6e69 avcodec/snow: Move dsp helper functions to snow_dwt.h
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:23:16 +02:00
Andreas Rheinhardt
155e7e126b avcodec/snow: Move encoder-only stuff out of SnowContext
Put it into an encoder-specific context with a SnowContext
at its front. This also avoids having to include mpegvideo.h
in snow.c and snowdec.c.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:23:00 +02:00
Andreas Rheinhardt
259e1d2bd7 avformat/matroskaenc: Write default duration for audio
This is easily possible for those codecs with a fixed frame-size
(in samples).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:22:20 +02:00
Andreas Rheinhardt
0c1103d4dc avformat/matroskaenc: Don't create wrong packet durations
We have to write an explicit BlockDuration element (and use
a BlockGroup instead of a SimpleBlock) in case the Track
has a DefaultDuration that is inconsistent with the duration
of the packet.

The matroska-h264-remux test uses a file with coded fields
where the duration of a Block is the duration of a field,
not of a frame, therefore this patch writes said BlockDuration
elements.

(When using a BlockGroup, one has to add ReferenceBlock elements
to distinguish keyframes from non-keyframes. Unfortunately,
the AV1 codec mapping [1] requires us to reference all references
and to really use the real references, which requires a lot of
effort for basically no gain. When BlockGroups are used with AV1,
the created files are most likely invalid, both before and after
this patch, but this patch makes this more likely to happen.)

[1]: https://github.com/ietf-wg-cellar/matroska-specification/blob/master/codec/av1.md

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:22:05 +02:00
Paul B Mahol
9e531370b3 avformat/aea: fix bitrate for mono 2023-10-02 01:28:14 +02:00
Paul B Mahol
edb6d6d536 avformat/aea: improve probe function 2023-10-02 01:28:11 +02:00
Paul B Mahol
7a444501d5 avcodec/mlpenc: fix quant_step_size for 16bit sample format input 2023-10-01 23:24:17 +02:00
Paul B Mahol
ffc783dea7 avcodec/mlpenc: fix writing end of stream marker 2023-10-01 23:24:16 +02:00
Paul B Mahol
873ce68f54 avcodec/flicvideo: add 1bit support 2023-10-01 18:44:13 +02:00
Andreas Rheinhardt
6f7bf64dbc avcodec: Remove DCT, FFT, MDCT and RDFT
They were replaced by TX from libavutil; the tremendous work
to get to this point (both creating TX as well as porting
the users of the components removed in this commit) was
completely performed by Lynne alone.

Removing the subsystems from configure may break some command lines,
because the --disable-fft etc. options are no longer recognized.

Co-authored-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 02:25:09 +02:00
Andreas Rheinhardt
d9464f3e34 avcodec/mpegaudiodsp: Init dct32 directly
This avoids using dct.c and will allow removing it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:53:32 +02:00
Andreas Rheinhardt
145db38f9b avcodec/bgmc: Use void* instead of AVCodecContext* as logctx
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:02:53 +02:00
Andreas Rheinhardt
7a9bc09176 avcodec/flac_parse: Use void* instead of AVCodecContext* as logctx
It more directly shows that ff_flac_decode_frame_header() does not
modify the AVCodecContext given to it at all; and it would not be
allowed to do so, given that it is used by the parser when it is
still unknown whether said frame header is even valid.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:02:53 +02:00
Andreas Rheinhardt
3ea73bc78a avcodec/lagarith: Use void* instead of AVCodecContext* as logctx
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:02:53 +02:00
Andreas Rheinhardt
08dd036b9f avcodec/roqvideo: Use void*, not AVCodecContext* for logctx
Also stop setting the field once per encode-frame.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:02:53 +02:00
Andreas Rheinhardt
7d1401ed02 avcodec/sipr: Remove write-only AVCodecContext*
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:02:53 +02:00
Andreas Rheinhardt
b2f5899ec2 avcodec/utvideo: Split UTvideoContext into decoder and encoder contexts
In particular the encoder used only a small part of the context:
The new encoder context is only 128B here. It used to be 32992.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:01:50 +02:00
Andreas Rheinhardt
0e18f1e9a3 avcodec/vorbis: Use void* logctx instead of AVCodecContext*
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 00:50:38 +02:00
Andreas Rheinhardt
bdbf9aa402 avcodec/ffv1dec: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-30 23:05:42 +02:00
Andreas Rheinhardt
0cfc7418bb avcodec/ffv1dec: Fix data races emanating from copying whole context
When using frame threading, the FFV1 decoder's update_thread_context()
function copies the whole context and afterwards restores some allocated
fields with backups made earlier. Among these fields are the
ThreadFrames and the source context's ThreadFrames can change
concurrently without any synchronization, leading to data races which
are undefined behaviour even if they don't lead to problems in
practice (as the destination's own ThreadFrames are restored directly
thereafter).

Fix this by only copying the actually needed fields.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-30 23:05:42 +02:00
James Almer
5ba06ad0b8 avcodec/decode: reduce scope of a variable in ff_decode_frame_props()
Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-30 11:14:32 -03:00
Paul B Mahol
ead1426a68 avcodec/rka: improve VRQ mode decoding 2023-09-30 15:35:04 +02:00
Paul B Mahol
8bfadacfd1 avcodec/rka: rename variable to something more representative 2023-09-30 15:35:03 +02:00
Andreas Rheinhardt
2cb2465cc7 avdevice/lavfi: Fix double-free on error
After the AVFrame has been wrapped into a buffer,
it is owned by the buffer and must not be freed manually
any more. Yet this happens on subsequent errors.

This bug was introduced in 6ca43a9675.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-30 12:27:44 +02:00
Michael Niedermayer
9a3bbf89bd
avformat/mov: Check avif_info
Fixes: leak
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6674082962997248
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6674082962997248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-29 23:08:38 +02:00
Roman Arzumanyan
f904e60c32 libavutil/hwcontext_cuda: don't destroy external context when using current CUDA context
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2023-09-29 19:42:11 +02:00
Michael Niedermayer
442d9412d2
avformat/mxfdec: Remove this_partition
Suggested-by: Tomas Härdin <git@haerdin.se>
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5130394286817280

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-29 19:23:36 +02:00
Paul B Mahol
3bbc7d799c avcodec/ffv1*: add GBRAP14, GRAY14, YUVA422P12, YUVA444P12 formats support 2023-09-29 18:59:08 +02:00
Paul B Mahol
41f5b73903 avfilter/f_ebur128: do not print summary log if nothing was processed 2023-09-29 18:40:54 +02:00