Commit graph

118298 commits

Author SHA1 Message Date
Andreas Rheinhardt
7ab7d9c3c0 avfilter/avfilter: Add FFFilter, hide internals of AVFilter
This patch is analogous to 20f9727018:
It hides the internal part of AVFilter by adding a new internal
structure FFFilter (declared in filters.h) that has an AVFilter
as its first member; the internal part of AVFilter is moved to
this new structure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:40 +01:00
Andreas Rheinhardt
9bbab3255b avfilter/vf_overlay: Remove spec-incompliant ';'
Fixes warnings with -pedantic with GCC and Clang.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:40 +01:00
Andreas Rheinhardt
4cf445c75d tests/ref/fate/png-icc-parse: Add lossless flag to ref file
Forgotten in 8a29b4e38d
(this test depends on lcms2 and is therefore disabled by default).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:39 +01:00
Andreas Rheinhardt
4973bb661e swscale/cms,graph,lut3d: Use ff_-prefix, don't export internal functions
Symbols with the sws_* prefix are exported.

Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:39 +01:00
Andreas Rheinhardt
0bc1d2fac4 avcodec/aac/aacdec: Fix -Wdeclaration-after-statement
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:39 +01:00
Andreas Rheinhardt
b239eefeb5 avcodec/sga: Silence -Wunused-but-set-variable warnings
The variables are used, but only inside an av_assert1().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:39 +01:00
Andreas Rheinhardt
7a5d6690fc avcodec/aac_ac3_parser: Remove unused variable
Added in 64bb91fd3b, never used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:39 +01:00
James Almer
5f6e43f77d tests/fate/lavf-container: fix dependencies for lavf_container_fate tests
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-12 11:13:35 -03:00
James Almer
df50370e1b avformat/matroska: add support for VVC streams
As defined in https://github.com/ietf-wg-cellar/matroska-specification/blob/master/codec_specs.md#v_mpegiisovvc

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-12 11:13:31 -03:00
Frank Plowman
8bd66a8c95 lavc/vvc: Check slice structure
The criteria for slice structure validity is similar to that of
subpicture structure validity that we saw not too long ago [1].
The relationship between tiles and slices must satisfy the following
properties:

* Exhaustivity.  All tiles in a picture must belong to a slice.  The
  tiles cover the picture, so this implies the slices must cover the
  picture.
* Mutual exclusivity.  No tile may belong to more than one slice, i.e.
  slices may not overlap.

In most cases these properties are guaranteed by the syntax.  There is
one noticable exception however: when pps_tile_idx_delta_present_flag is
equal to one, each slice is associated with a syntax element
pps_tile_idx_delta_val[i] which "specifies the difference between the
tile index of the tile containing the first CTU in the ( i + 1 )-th
rectangular slice and the tile index of the tile containing the first
CTU in the i-th rectangular slice" [2].  When these syntax elements are
present, the i-th slice can begin anywhere and the usual guarantees
provided by the syntax are lost.

The patch detects slice structures which violate either of the two
properties above, and are therefore invalid, while building the
slice map.  Should the slice map be determined to be invalid, an
AVERROR_INVALIDDATA is returned.  This prevents issues including
segmentation faults when trying to decode,  invalid bitstreams.

[1]: https://ffmpeg.org//pipermail/ffmpeg-devel/2024-October/334470.html
[2]: H.266 (V3) Section 7.4.3.5, Picture parameter set RBSP semantics

Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-01-12 13:15:06 +08:00
Peter Ross
2202dcfc0f avformat/iff: ignore FVER tag when not processing DSD/DST files
Fixes ticket #10030.
2025-01-12 11:14:16 +11:00
Peter Ross
ba22d6a24f avformat/wtvenc: do not output negative 'third timestamp' field
Fixes ticket #3659.
2025-01-12 11:07:57 +11:00
Peter Ross
330470ef24 avformat/mlvdec: skip over some other known block types 2025-01-12 10:55:47 +11:00
Peter Ross
45c30bc51e avformat/mlvdec: process VERS block 2025-01-12 10:55:44 +11:00
Peter Ross
86dd15fd0d avformat/mlvdec: demux LJ92 huffman comressed frames
A minimal DNG header is added to each LJ92 compressed frame, allowing
thme to be decoded by the TIFF decoder. The TIFF decoder is responsible
for setting up the MJPEG decoder, signalling the correct s->bayer flag,
and setting pix_fmt.

The LJ92 compressed frames can be muxed out to DNG files, and manipulated
in DNG software. Tested with darktable and rawtherapee.

Contributor: South East <8billion.people@gmail.com>
2025-01-12 10:55:39 +11:00
f651ca3a68
avutil/frame.h: improve documentation for AV_FRAME_FLAG_LOSSLESS
It should be more clear what this flag is indicating with a more
verbose comment documenting it.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Reviewed-by: Marth64 <marth64@proxyid.net>
2025-01-11 10:31:00 -05:00
b76053d8bf avformat/flvdec: add support for legacy HEVC files 2025-01-10 21:55:23 +01:00
James Almer
5cd49e1bfd avcodec/hevc/hevcdec: use av_frame_side_data_add() where useful
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 15:02:31 -03:00
James Almer
f635f19537 avcodec/aom_film_grain: use av_frame_side_data_add() where useful
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 15:02:31 -03:00
James Almer
42e72d5c8b avutil/frame: add AV_FRAME_SIDE_DATA_FLAG_NEW_REF
The flag is documented but did not exist. So introduce it as it can be
useful.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 15:02:22 -03:00
James Almer
7f9c7f9849 avcodec/jpeg2000dec: clear array length when freeing it
Fixes NULL pointer dereferences.
Fixes ticket #11393.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 14:56:03 -03:00
James Almer
292c1df7c1 avformat/mov: merge stts and ctts arrays into one
Should reduce memory usage as well as remove code duplication.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 10:39:00 -03:00
James Almer
d7180a3f92 avcodec/vvc/dec: print thread debug logs only if DEBUG is defined
Makes the output of a normal decoding process with loglevel debug a lot less
verbose.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 10:23:57 -03:00
Jonathan Baudanza
c0fbb6d5b7 avformat/rtpdec: int overflow in start_time_realtime
This was previously adjusted by me in 6b3f9c2e92.
Unfortunately, I traded one integer overflow bug for
another.

Currently, NTP timestamps that exceed INT64_MAX
(~Jan 20, 1968) will cause an overflow when passed
to av_rescale.

This patch replaces av_rescale, which operates on
int64_t, with ff_parse_ntp_time, which operates on
uint64_t. This will give the correct values for
timestamps back around the NTP epoch and present day
timestamps.

Fixes ticket #11388.

Signed-off-by: Martin Storsjö <martin@martin.st>
2025-01-10 12:09:27 +02:00
251de1791e
avcodec/vc1dec: Clear block_index in vc1_decode_reset()
Fixes: 377965565/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-4504434689769472
Fixes: out of array access

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:27 +01:00
3f029bfb7f
avcodec/aacsbr_template: Clear n_q on error
Fixes: index 5 out of bounds for type 'uint8_t [5]'
Fixes: 377748135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5167109774049280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:27 +01:00
695b7c71d9
tools/target_dec_fuzzer: Adjust threshold for MSCC
Fixes: Timeout
Fixes: 377574369/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSCC_fuzzer-4924697608781824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:26 +01:00
4485a0fd77
avformat/iamf_parse: Check output_channel_count
Fixes: -nan is outside the range of representable values of type 'int'
Fixes: 377072730/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-6545416570601472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:26 +01:00
70514ff0ec
tools/target_dec_fuzzer: Adjust threshold for VP6
Fixes: Timeout (would need 62sec)
Fixes: 376731123/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP6_fuzzer-5926437896388608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:26 +01:00
f7cc023f06
avformat/mxfdec: Check edit_unit for being larger than signed 64bit
Fixes: signed integer overflow: 2 * -4962931467012268000 cannot be represented in type 'long'
Fixes: 376496313/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4921469185884160

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:25 +01:00
4bd9b5f520
tools/target_dec_fuzzer: Adjust threshold for TDSC
Fixes: Timeout
Fixes: 376320337/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TDSC_fuzzer-6259585758855168

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:25 +01:00
0f511b4518
avcodec/osq: Fixes several undefined overflows in do_decode()
Fixes: signed integer overflow: 1239596184 + 2119376059 cannot be represented in type 'int'
Fixes: 376136844/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6581164455821312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:25 +01:00
56faee21c1
swscale/output: Fix undefined overflow in yuv2rgba64_full_X_c_template()
Fixes: signed integer overflow: -1082982400 + -1195645138 cannot be represented in type 'int'
Fixes: 376136843/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4791844321427456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:24 +01:00
b5b6391d64
avfilter/af_pan: Fix sscanf() use
Fixes: Memory Data Leak

Found-by: Simcha Kosman <simcha.kosman@cyberark.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:24 +01:00
9ffa127aa6
avfilter/vf_grayworld: Use the correct pointer for av_log()
Fixes: crash

Found-by: Elias Myllymäki <elias.myllymaki04p@gmail.com>
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:24 +01:00
b72de49295
avfilter/vf_addroi: Add missing NULL termination to addroi_var_names[]()
Fixes: out of array read

Found-by: Elias Myllymäki <elias.myllymaki04p@gmail.com>
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:23 +01:00
Frank Plowman
cb60b29ac5 fate/vvc: Add vvc-frames-with-ltr.vvc
This sample is rather difficult, containing a lot of subtle edge cases
which revealed errors in the VVC decoder.  It covers 88.4% of lines in
libavcodec/vvc and brings the line coverage of the entire VVC fate suite
from 96.3% to 97.2%.

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-08 10:10:06 -03:00
910e5a275d avformat/avformat.h: elaborate documentation for avformat_open_input() on error condition
Signed-off-by: Marth64 <marth64@proxyid.net>
2025-01-08 00:14:13 -06:00
Scott Theisen
8ad2d1919f libavcodec/mpeg12dec: append CC data to a53_buf_ref
In mpeg_decode_a53_cc() only the A/53 part 4 CC data ("GA94") is saved between
frames. The other formats incorrectly created a larger buffer than they use
since a705bcd763 because they did not append to
the previous data.

The a53_buf_ref is added to the frame in mpeg_field_start() which will only be
called in decode_chunks() if not all of the picture data slices are skipped.

For these formats, utilize the data added to the buffer in case frames are skipped
(concatenating the CC data until a frame can be exported), in a similar fashion to
the A/53 part 4 logic.

Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Marth64 <marth64@proxyid.net>
2025-01-08 00:03:47 -06:00
9305a1edca avcodec/mpeg12dec: fix range for cc_format option
After support was added for DVB 0502 Closed Caption coding,
the cc_format option's range was never updated so user
cannot select this coding as a forced formatting choice.

Fix the range of the option by ending it with the new coding type.

Signed-off-by: Marth64 <marth64@proxyid.net>
2025-01-07 23:54:35 -06:00
NyanMaths
1215fefcb8
avformat/ipfsgateway: fix capitalizaton mistake
Fix the incorrect capitalization of the project name in a comment.
The project is named FFmpeg, not FFMpeg.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-01-07 17:47:15 -05:00
James Almer
692ce2503e avformat/flvdec: initialize ret in flv_read_packet() to AVERROR_BUG
This will ensure any future goto leave that may be added doesn't accidentally forget to
set ret to some proper value.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-07 16:09:49 -03:00
af74fe7139 avformat/flvdec: don't leak extradata pointer on realloc failure 2025-01-07 19:20:30 +01:00
9201f872b1 avformat/flvdec: properly free mt_extradata 2025-01-07 19:07:43 +01:00
Alessandro Ros
9fe66c7fcb avformat/flvenc: fix missing sequence start with MP3 tracks
When muxing to FLV/RTMP a MP3 track with an ID greater than zero,
enhanced RTMP has to be used, and a sequence start should preceed track
data.

This is already implemented (see line 823 of flvenc.c) but the code is
never reached due to a too-strict condition before it. This patch fixes
the issue.

Signed-off-by: Alessandro Ros <aler9.dev@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2025-01-07 18:38:11 +01:00
b32a1a69a4 avformat/flvenc: properly handle writing mpeg4 extradata 2025-01-07 18:30:23 +01:00
4c2b769e53 avformat/flvdec: clean up variable initialization spacing 2025-01-07 18:18:38 +01:00
0ed3446738 avformat/flvdec: fix potential premature return on audio MultichannelConfig 2025-01-07 18:18:02 +01:00
e9de794d7f avformat/flvdec: add missing track_size decrement 2025-01-07 17:57:52 +01:00
Koushik Dutta
252fc2e047 avfilter/scale_vulkan: add dynamic crop region and aspect ratio match
The scale_vulkan filter initializes the shader once, with the crop
region set by the original frame. However, subsequent frames may
specify a different crop region than the first frame. This change
updates the cropping to match the behavior present on the other
hardware frame scale filters.

The scale filter should also allow negative values
that respect aspect ratio, similar to other scale filters.

Signed-off-by: Koushik Dutta <koushd@gmail.com>
2025-01-07 08:34:59 +09:00