Commit Graph

107253 Commits

Author SHA1 Message Date
Andreas Rheinhardt
b468ddc75d avformat/matroskaenc: Don't waste bytes to Write Tag length fields
This is possible by using a dynamic buffer to write them;
said dynamic buffer is (re)used and reset as appropriate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-20 23:42:28 +02:00
Marton Balint
58df81b027 avformat/mpegts: remove obsolate hacks for detecting streams with bad PMTs
Ffmpeg/ffprobe/ffplay sets scan_all_pmts to 1 when finding the streams, that
should be enough to handle files for which some early PMTs miss some streams.

Fixes ticket #9782.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-20 23:36:37 +02:00
Marton Balint
5468548d5e doc/decoders: add docs for v210 decoder
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-20 22:56:50 +02:00
Marton Balint
96f2fc3841 avcodec/v210dec: add support for strideless v210 as in BOXX files
Fixes ticket #1838.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-20 22:56:50 +02:00
Marton Balint
a10132b967 avcodec/v210dec: add support for invalid paddings up to 16 bytes
Fixes ticket #1528.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-20 22:56:50 +02:00
Marton Balint
2e895edb5d avcodec/v210dec: do not use accelerated code for the last pixels of a row
ASM code tends to overwrite the buffers by 2-4 bytes and it can cause issues
with slice threads.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-20 22:56:50 +02:00
Marton Balint
5716836963 avcodec/v210dec: disallow negative custom stride
Also make sure a big custom stride does not overflow size check.

Avoids segfaults.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-20 22:56:49 +02:00
Marton Balint
a5c7d3173c avcodec/v210dec: factorize row decoding
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-20 22:56:49 +02:00
Marton Balint
9793760f22 avcodec/v210dec: properly support odd widths
Fixes ticket #5195.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-20 22:56:49 +02:00
Gyan Doshi
56419428a8 avcodec/mfenc: set variable frame size flag.
Default avctx->frame_size is 0 which led to init failure for
audio MediaFoundation encoders since 827d6fe73d.

The MF audio encoders accept variable frame size input buffers.

Fixes #9802
2022-06-20 15:04:26 +05:30
Michael Goulet
b7f6a933fa tests/checkasm/sw_scale: Fix alignment for movdqa
SSE3 instruction movdqa in ff_yuv2yuvX_sse3() expects a 16-byte aligned address for a memory address, or else a segfault is generated.
The src_pixels buffer below was not aligned to 16 bytes on the stack necessarily, so we got segfaults during fate-checkasm-sw_scale.

Therefore 16-byte align all of these local variables, aligning them too much shouldn't hurt.
2022-06-20 11:08:43 +02:00
Michael Goulet
0aa5dd084b lavc/libx264.c: Fix possible UB by NULL pointer LHS
It is UB to attempt to do pointer arithmetic on NULL pointer LHS, even if that pointer arithmetic ends up being "+= 0" (i.e. !!p == 0 if p == NULL).
2022-06-20 11:08:26 +02:00
rcombs
6c3a82f043 lavfi/drawutils: improve colorspace support
- Introduce ff_draw_init2, which takes explicit colorspace and range
  args
- Use lavu/csp and lavfi/colorspace for conversion, rather than the
  lavu/colorspace.h macros
- Use the passed-in colorspace when performing RGB->YUV conversions

The upshot of this is:
- Support for YUV spaces other than BT601
- Better rounding for all conversions
- Particular rounding improvements in >8-bit formats, which previously
  used simple left-shifts
- Support for limited-range RGB
- Support for full-range YUV in non-J pixfmts

Due to the rounding improvements, this results in a large number of
minor changes to FATE tests.

Signed-off-by: rcombs <rcombs@rcombs.me>
2022-06-19 19:18:34 -05:00
rcombs
a5b3b65dc0 lavfi/colorspace: add ff_matrix_mul_3x3_vec
Signed-off-by: rcombs <rcombs@rcombs.me>
2022-06-19 19:18:34 -05:00
Matt Jacobson
b3e261bab3 avdevice/oss_dec: account for sample size when computing timestamp
Don't assume each sample is one byte in size. Doing so results in wrong and
occasionally non-monotonically-increasing timestamps.

Fix nearby cosmetic typo.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-19 23:01:20 +02:00
softworkz
fee765c207 fftools/fopen_utf8: support long paths on Windows for fftools
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-06-19 01:38:23 +03:00
Andreas Rheinhardt
6d3f771588 avcodec/x86/lpc, vp8dsp_init: Remove redundant checks
EXTERNAL_SSE2_SLOW is now more encompassing than EXTERNAL_SSE2.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-18 19:25:03 +02:00
Andreas Rheinhardt
ac322ec214 avutil/cpu_internal: Fix check for SSE2SLOW
For SSE2 and SSE3, there are four states that the two flags
involved (AV_CPU_FLAG_SSE[23] and AV_CPU_FLAG_SSE[23]SLOW) can convey.
When ordered from worst to best they are:
1. both flags unset (SSE[23] unavailable)
2. the slow flag set, the ordinary flag unset (this is designed
for cases where SSE2 is available, but so slow that MMX(EXT)/SSE
code is usually faster)
3. both flags set (SSE2 is available, but there might be scenarios
where MMX(EXT)/SSE code is faster)
4. the ordinary flag set, the slow flag unset (this is the normal case)

The ordinary macros for checking cpuflags return true
in the latter two cases; the fast macros only return true for
the latter case. Yet the macros to check for slow currently
only return true in case three.

This seems unintended. In fact, the only uses of the slow macros
are all of the form
if (EXTERNAL_SSE2(cpu_flags) || EXTERNAL_SSE2_SLOW(cpu_flags))
where the check for EXTERNAL_SSE2_SLOW is completely redundant.
Even more importantly, it is not what was intended. Before
6369ba3c9c, the checks passed
in cases 2 to 4. Said commit changed this to something that
only passes for the third case. Commits
7fb758cd8e and
c1913064e3 restored the old behaviour,
yet merging 4efab89332 (in commit
ac774cfa57) broke this again
by changing it to what it is now.*

This commit changes the macros to make the slow macros check
whether a specific instruction is supported, even if slow.
This restores the intended meaning to all uses of the SLOW macros
and is generally more natural.

*: Libav only checks for EXTERNAL_SSE2_SLOW, i.e. for the third case
only.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-18 19:25:03 +02:00
Marton Balint
b3cca50638 avformat/librist: bump required version to 0.2.7
This is the first version for which fifo size setting actually works.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-18 16:32:23 +02:00
Andreas Rheinhardt
2d764069be avcodec/vlc: Use structure instead of VLC_TYPE array as VLC element
In C, qualifiers for arrays are broken:
const VLC_TYPE (*foo)[2] is a pointer to an array of two const VLC_TYPE
elements and unfortunately this is not compatible with a pointer
to a const array of two VLC_TYPE, because the latter does not exist
as array types are never qualified (the qualifier applies to the base
type instead). This is the reason why get_vlc2() doesn't accept
a const VLC table despite not modifying the table at all, as
there is no automatic conversion from VLC_TYPE (*)[2] to
const VLC_TYPE (*)[2].

Fix this by using a structure VLCElem for the VLC table.
This also has the advantage of making it clear which
element is which.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-17 16:47:29 +02:00
Wenbin Chen
97141ffeec libavcodec/qsvenc: add ROI support to qsv encoder
Use The mfxEncoderCtrl parameter to enable ROI. Get side data
"AVRegionOfInterest" and use it to configure "mfxExtEncoderROI" which is
the MediaSDK's ROI configuration.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-06-17 13:09:35 +08:00
Michael Niedermayer
6a02de2127 avformat/aiffdec: avoid integer overflow in get_meta()
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 45891/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6159183893889024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-17 01:54:05 +02:00
Michael Niedermayer
c16a0ed242 avformat/aaxdec: Check for overlaping segments
Fixes: Timeout
Fixes: 45875/clusterfuzz-testcase-minimized-ffmpeg_dem_AAX_fuzzer-6121689903136768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-17 01:54:05 +02:00
Michael Niedermayer
b0cac7082d avformat/demux: Count EAGAIN as 100 bytes in relation to read limit in avformat_find_stream_info()
Fixes: Timeout
Fixes: 43717/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5206008287330304
Fixes: 45738/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6142535657979904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-17 01:54:05 +02:00
Michael Niedermayer
02699490c1 avformat/demux: Make read_frame_internal() return AVERREOR(EAGAIN) on stuck empty input parser
Fixes: read_frame_internal() which does not return even though both demuxer and parser do return
Fixes: 43717/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5206008287330304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-17 01:54:05 +02:00
Marton Balint
1b3ec3c8ca avdevice/pulse_audio_dec: deprecate frame_size option
It does not do anything. Frame sizes can be controlled by using fragment_size.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-16 21:28:20 +02:00
Marton Balint
b67ca8a7a5 avdevice/pulse_audio_dec: reduce default fragment size
Reduces default fragment size from the pulse audio default of 2 sec to 50 ms.
This also has an effect on the size of the returned frames, which will be
around 50 ms as well, making timestamps more accurate.

This should fix the regression in ticket #9776.

Pulseaudio timestamps for monitor sources are still pretty inaccurate for me,
but I don't see how else should we query latencies from the library.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-16 21:28:20 +02:00
Marton Balint
b83032899a Revert "avdevice/pulse_audio_dec: only set adjust latency flag if fragment_size is not set"
This reverts commit 7f059a250b.

Apparently adjusting latency makes a difference even if fragment size is specifed.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-16 21:28:20 +02:00
Andreas Rheinhardt
672987b2db avformat/matroskaenc: Convert chapter metadata
It is no longer converted since mkv_write_chapters() is called
before mkv_write_tags() which happens since commit
4ebfc13c33. Given the fact that
chapters can also be written late, mkv_write_chapters() has to
convert the metadata itself.

Fixes ticket #9812.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-16 19:18:48 +02:00
Andreas Rheinhardt
49a63c6c66 avformat/matroskaenc: Reset cur_master_element when discarding master
Before this patch the muxer writes an invalid file
(namely one in which the Projection master is a child of
the Colour element) if the following conditions are met:
a) The stream contains AVMasteringDisplayMetadata without primaries
and luminance (i.e. useless AVMasteringDisplayMetadata).
b) The stream contains AV_PKT_DATA_SPHERICAL side data.
c) All the colour elements of the stream are equal to default
(i.e. unknown).
Fortunately these conditions are very unlikely to be met.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-16 19:06:10 +02:00
Andreas Rheinhardt
9ff0fbbc0a avformat/mxfdec: Offload allocating string to av_dict_set()
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-16 18:39:46 +02:00
Andreas Rheinhardt
6b5e3590c7 avformat/mxfdec: Use ff_data_to_hex() for data->hex conversion
In this case it also stops pretending that the length of
the output string is somehow checked (which is currently
being done by using snprintf that is called with the amount
of space needed instead of the amount of space actually available).

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-16 18:39:25 +02:00
Andreas Rheinhardt
8823900b14 avformat/mxfdec: Don't duplicate av_uuid_unparse
Also don't allocate the string ourselves, let av_dict_set()
do it.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-16 18:39:09 +02:00
Andreas Rheinhardt
41365fdf5c avformat/mxf: Use AVUUID for uids
This is in preparation for using av_uuid functions directly.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-16 18:38:50 +02:00
Peter Ross
5242ede48d doc: describe QOI image format 2022-06-16 15:16:58 +05:30
Paul B Mahol
42289d5eaf avfilter/vf_zscale: dissallow too small slices
Also change rounding type when calculating slices size.
2022-06-16 10:23:30 +02:00
Paul B Mahol
afc7679c89 avcodec/mace: fix some style issues 2022-06-16 10:23:30 +02:00
Paul B Mahol
d39f9feddc avfilter: add virtualbass filter 2022-06-16 10:23:30 +02:00
Gyan Doshi
557a1a8af2 doc/APIchanges: add missing marker for release 5.0 2022-06-16 12:52:24 +05:30
Andreas Rheinhardt
2c882f4708 avcodec/exif: Move tag_list out of header
It is only used by exif.c (and e.g. EXIF_TAG_NAME_LENGTH
is an implementation detail anyway).
Also remove the sentinel, as it is used in conjunction
with FF_ARRAY_ELEMS.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-15 04:58:14 +02:00
Andreas Rheinhardt
ca2c60b060 swresample/noise_shaping_data: Remove unused tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-15 04:58:14 +02:00
Andreas Rheinhardt
40e6575aa3 all: Replace if (ARCH_FOO) checks by #if ARCH_FOO
This is more spec-compliant because it does not rely
on dead-code elimination by the compiler. Especially
MSVC has problems with this, as can be seen in
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html
or
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/297022.html

This commit does not eliminate every instance where we rely
on dead code elimination: It only tackles branching to
the initialization of arch-specific dsp code, not e.g. all
uses of CONFIG_ and HAVE_ checks. But maybe it is already
enough to compile FFmpeg with MSVC with whole-programm-optimizations
enabled (if one does not disable too many components).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-15 04:56:37 +02:00
Michael Niedermayer
e5f6707a7b avformat/ape: more bits in size for less overflows
Fixes: signed integer overflow: 2147483647 + 3 cannot be represented in type 'int'
Fixes: 46184/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-4678059519770624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-14 16:46:28 +02:00
Michael Niedermayer
b97e58da44 avcodec/binkaudio: Clear state on EAGAIN
Its not supported to maintain a frame as receive_frame() argument
over multiple calls
Fixes: store to null pointer of type 'FFTSample' (aka 'float')
Fixes: 46231/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINKAUDIO_DCT_fuzzer-6276566037954560
Fixes: ACDC.smo

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-14 16:46:28 +02:00
Michael Niedermayer
9274fb2532 avformat/mov: Non overflowing ambisonic order check
Fixes: signed integer overflow: 536870913 * 536870913 cannot be represented in type 'int'
Fixes: 45862/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4730373768085504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-14 16:46:28 +02:00
Zane van Iperen
9874baf2cd doc/APIchanges: add missing uuid and csp entries
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-06-13 22:04:36 -03:00
Zane van Iperen
ff59ecc4de avutil: bump version after UUID changes
Forgot to bump after 76e95daa08.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-06-13 22:01:28 -03:00
Andreas Rheinhardt
0e8a5ded7e swresample/resample: Remove unnecessary emms_c
The last MMX code in swresample has just been removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-14 01:28:29 +02:00
Andreas Rheinhardt
dd61d6489b swresample/x86/resample: Remove obsolete MMXEXT functions
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). So given that the only systems which benefit
from the MMXEXT resamplers (which are overridden by SSE2)
are truely ancient 32bit x86s they are removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-14 01:28:29 +02:00
Andreas Rheinhardt
4e51e48ebd swresample/x86/rematrix: Remove obsolete MMX functions
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2) for x64. So given that the only systems that
benefit from these functions are truely ancient 32bit x86s
they are removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-14 01:28:29 +02:00