Commit Graph

105424 Commits

Author SHA1 Message Date
Gyan Doshi
ebe0f1d2bb lavc/libx265: unbreak build for X265_BUILD >= 210
x265 added support for alpha starting with build 210.
While doing so, x265_encoder_encode() changed its fifth arg to
an array of pointers to x265_picture. This broke building lavc/libx265.c

This patch simply unbreaks the build and maintains existing single-layer
non-alpha encoding support.

Fixes #11130
2024-09-04 13:51:44 +02:00
Ramiro Polla
76e4a113ae configure: improve check for POSIX ioctl
Instead of relying on system #ifdefs which may or may not be correct,
detect the POSIX ioctl signature at configure time.

(cherry picked from commit 00b64fca55)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 20:10:44 -04:00
Ramiro Polla
a95bb07897 configure: restore autodetection of v4l2 and fbdev
The detection logic for v4l2 and fbdev was accidentally modified to
depend on v4l2-m2m in 43b3412.

(cherry picked from commit 7405f1ad53)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 20:10:20 -04:00
Brad Smith
bfa74c890b configure: use just the pkg-config for sndio
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f6d8464590)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 19:46:44 -04:00
Timo Rothenpieler
4810ff7d72 avformat/hlsenc: correctly reset subtitle stream counter per-varstream
Without resetting it, if there was a previous set of varstreams with
subtitles, it would subtract from all the streams, leading to chaos and
segfaults when trying to access for example stream -1.
2024-08-16 20:27:32 +02:00
llyyr
0b7f5b7566
lavc/vp9: reset segmentation fields when segmentation isn't enabled
Fields under the segmentation switch are never reset on a new frame, and
retain the value from the previous frame. This bugs out a bunch of
hwaccel drivers when segmentation is disabled but update_map isn't
reset because they don't ignore values behind switches. This commit also
resets the temporal field, though it may not be required.

We also do this for vp8 [1] so this commit is just mirroring the vp8
logic.

This fixes an issue with certain samples [2] that causes blocky
artifacts with vaapi, d3d11va and cuda (and possibly others).
Mesa worked around [3] this by ignoring these fields if
segmentation.enabled is 0, but d3d11va still displays blocky artifacts.

[1] 2e877090f9:/libavcodec/vp8.c#l797
[2] https://github.com/mpv-player/mpv/issues/13533
[3] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27816

Signed-off-by: llyyr <llyyr.public@gmail.com>
2024-05-27 12:45:32 +02:00
Brad Smith
80a676e8ae configure: enable ffnvcodec, nvenc, nvdec for FreeBSD
Signed-off-by: Brad Smith <brad@comstyle.com>
(cherry picked from commit 43b1a95678)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-05-26 19:37:11 -04:00
Andreas Rheinhardt
43de07cd20 avcodec/x86/vp3dsp_init: Set correct function pointer, fix crash
Regression since fd172185580c1ccdcfb90bbfdb59fa806fad3117;
triggered by vp4/KTkvw8dg1J8.avi in the FATE suite, but not
when running fate as this code is not used when the bitexact
flag is set.

Bisecting done by ami_stuff, patch from user Mika Fischer
in ticket #10027 (which this commit fixes).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit c3ca90a92e)
2024-05-22 17:35:44 +02:00
Brad Smith
d6bec7f83e avutil/ppc/cpu: Also use the machdep.altivec sysctl on NetBSD
Use the machdep.altivec sysctl on NetBSD for AltiVec detection
as is done with OpenBSD.

(cherry picked from commit 115c96b9bd)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-05-18 19:22:18 -04:00
Brad Smith
537a17a16f avutil/ppc/cpu: Use proper header for OpenBSD PPC CPU detection
Use the proper header for PPC CPU detection code. sys/param.h includes
sys/types, but sys/types.h is the more appropriate header to be used
here.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit beaf172d75)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-05-18 19:20:44 -04:00
Brad Smith
307df02e1d lavd/v4l2: Use proper field type for second parameter of ioctl() with BSD's
The proper type was used until 73251678c8.

This covers all of the OS's that currently have V4L2 support, permutations
of Linux glibc/musl, Android bionic, FreeBSD, NetBSD, OpenBSD, Solaris.

Copied from FreeBSD ports patch.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 9e674b3160)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-05-18 19:19:20 -04:00
Eugene Zemtsov
60df6aad93 avformat/mov: Check if a key is longer than the atom containing it
Stop reading keys and return AVERROR_INVALIDDATA if key_size
is larger than the amount of space left in the atom.

Bug: https://crbug.com/41496983
Signed-off-by: Eugene Zemtsov <eugene@chromium.org>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 8a23a145d8)
2024-04-02 09:17:44 -03:00
Timo Rothenpieler
201d0e6fc1 avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer 2024-03-30 00:22:23 +01:00
James Almer
09f9f1d7ee avformat/mov: don't abort on duplicate Mastering Display Metadata boxes
The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a
mdvc one. If both are present, just ignore one of them.
This is in line with clli and CoLL boxes.

Fixes ticket #10711.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 189c32f536)
2024-03-27 13:56:03 -03:00
Frank Plowman
7c2efd6cdc doc/html: fix styling issue with Texinfo 7.0
Texinfo 7.0 produces quite different HTML to Texinfo 6.8. Without
this change, enumerated option flags (i.e. Possible values of x
are...) render as white text on a white background with Texinfo 7.0
and are unreadable. This change removes a style for the selector
`.table .table` which causes the background to turn white for these
elements. As far as I can tell, it is not actually used anywhere in
files generated by Texinfo 6.8.

Signed-off-by: Frank Plowman <post@frankplowman.com>
(cherry picked from commit f16900bda2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-15 00:27:10 +01:00
Frank Plowman
72281adec0 doc/html: support texinfo 7.0
Resolves trac ticket #10636 (http://trac.ffmpeg.org/ticket/10636).

Texinfo 7.0, released in November 2022, changed the names of various
functions. Compiling docs with Texinfo 7.0 resulted in warnings and
improperly formatted documentation. More old names appear to have
been removed in Texinfo 7.1, released October 2023, which causes docs
compilation to fail.

This commit addresses the issue by adding logic to switch between the old
and new function names depending on the Texinfo version. Texinfo 6.8
produces identical documentation before and after the patch.

CC
https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1938238.html
https://bugs.gentoo.org/916104

Signed-off-by: Frank Plowman <post@frankplowman.com>
(cherry picked from commit f01fdedb69)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-15 00:26:54 +01:00
Christopher Degawa
2142d6e410 avcodec/libsvtav1: remove compressed_ten_bit_format and simplify alloc_buffer
compressed_ten_bit_format has been deprecated upstream and has no effect
and can be removed. Plus, technically it was never used in the first place
since it would require the app (ffmpeg) to set it and do additional
processing of the input frames.

Also simplify alloc_buffer by removing calculations relating to the
non-existant processing.

Signed-off-by: Christopher Degawa <christopher.degawa@intel.com>
2024-03-15 00:23:32 +01:00
Rémi Denis-Courmont
b0e2146b06 avcodec/x86/mathops: clip constants used with shift instructions within inline assembly
Fixes assembling with binutil as >= 2.41

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-13 03:26:12 +01:00
Jan Ekström
6073fff84d avcodec/av1dec: fix matrix coefficients exposed by codec context
`colorspace` in avcodec terms means `matrix coefficients`.

Reviewed-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 37936b09ce)
2024-02-20 21:39:15 +02:00
James Almer
4f9c230f42 avcodec/nvdec: don't free NVDECContext->bitstream
Ensure all hwaccels that allocate a buffer use NVDECContext->bitstream_internal
instead. Otherwise, if FFHWAccel->end_frame() isn't called before
FFHWAccel->uninit(), an attempt to free a stale pointer to memory not owned by
the hwaccel could take place.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-07 11:48:27 -03:00
Hendrik Leppkes
536cd25b99
avcodec/vdpau_mpeg4: fix order of quant matrix coefficients
The matrix coefficients are stored permutated for the IDCT,
rather then in plain raster order, and need to be un-permutated
for the hardware.
2023-05-15 18:43:40 +02:00
Hendrik Leppkes
8ea65672ca
avcodec/vdpau_mpeg12: fix order of quant matrix coefficients
The matrix coefficients are stored permutated for the IDCT,
rather then in plain raster order, and need to be un-permutated
for the hardware.
2023-05-15 18:43:40 +02:00
Hendrik Leppkes
a2c62be31d
avcodec/nvdec_mpeg4: fix order of quant matrix coefficients
The matrix coefficients are stored permutated for the IDCT,
rather then in plain raster order, and need to be un-permutated
for the hardware.
2023-05-15 18:43:40 +02:00
Hendrik Leppkes
5086261af4
avcodec/nvdec_mpeg2: fix order of quant matrix coefficients
The matrix coefficients are stored permutated for the IDCT,
rather then in plain raster order, and need to be un-permutated
for the hardware.
2023-05-15 18:43:39 +02:00
Anton Khirnov
e30302c636 fftools/ffmpeg: avoid possible invalid reads with short -tag values
Fixes #10319 and #10309.

Based on 89c9a3ac35.

(cherry picked from commit 1e413487bf)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-04-17 12:22:18 +02:00
Kyle Manning
f6facaf8c9 avcodec/nvenc: fix b-frame DTS behavior with fractional framerates
When using fractional framerates (or any fraction with a numerator != 1),
DTS values for packets would be calculated incorrectly.

Signed-off-by: Kyle Manning <tt2468@irltoolkit.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2023-04-03 12:10:22 +02:00
Michael Niedermayer
0e15444ace
update for 5.0.3
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 16:21:05 +02:00
Michael Niedermayer
4e8da0dc22
avcodec/tests/snowenc: Fix 2nd test
(cherry picked from commit 163013c724)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:26 +02:00
Michael Niedermayer
1fca7ff2be
avcodec/tests/snowenc: return a failure if DWT/IDWT mismatches
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 771c266c0b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:25 +02:00
Michael Niedermayer
a9655efa6f
avcodec/snowenc: Fix visual weight calculation
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5b5fcadea0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:25 +02:00
Michael Niedermayer
8ec5085898
avcodec/tests/snowenc: unbreak DWT tests
the IDWT data type mismatched current code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8b3351bbea)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:25 +02:00
Jiasheng Jiang
481e81be12
avformat/nutdec: Add check for avformat_new_stream
Check for failure of avformat_new_stream() and propagate
the error code.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9cf652cef4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:24 +02:00
Jiasheng Jiang
2cdddcd6ec
avcodec/vp3: Add missing check for av_malloc
Since the av_malloc() may fail and return NULL pointer,
it is needed that the 's->edge_emu_buffer' should be checked
whether the new allocation is success.

Fixes: d14723861b ("VP3: fix decoding of videos with stride > 2048")
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
(cherry picked from commit 656cb0450a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:24 +02:00
Michael Niedermayer
9097001f80
avcodec/mpeg12dec: Check input size
Fixes: Timeout
Fixes: 53599/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IPU_fuzzer-4950102511058944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7c130d6911)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:24 +02:00
Michael Niedermayer
54326fd8d8
avcodec/escape124: Fix some return codes
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 98df605f7a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:23 +02:00
Michael Niedermayer
35977631a2
avcodec/escape124: fix signdness of end of input check
Fixes: Timeout
Fixes: 56561/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE124_fuzzer-5560363635834880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 87ad0a5dd7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:23 +02:00
Michael Niedermayer
49872ca447
Use https for repository links
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 011f30fc82)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:23 +02:00
Paul B Mahol
1eb002596e
avcodec/rpzaenc: stop accessing out of bounds frame
(cherry picked from commit 92f9b28ed8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:22 +02:00
Paul B Mahol
293dc39bca
avcodec/smcenc: stop accessing out of bounds frame
(cherry picked from commit 13c1310975)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:22 +02:00
Michael Niedermayer
f380b1d22a
avcodec/motionpixels: Mask pixels to valid values
Fixes: out of array access
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOTIONPIXELS_fuzzer-6724203352555520

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ac6eec1fc2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:22 +02:00
Michael Niedermayer
bee5541a44
avcodec/xpmdec: Check size before allocation to avoid truncation
Fixes:OOM
Fixes:out of array access (no testcase)
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XPM_fuzzer-6573323838685184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 95f0f84dae)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:21 +02:00
Michael Niedermayer
1c9136ddd7
avcodec/bink: Avoid undefined out of array end pointers in binkb_decode_plane()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ea9deafd3b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:21 +02:00
Michael Niedermayer
fb895f9d4d
avcodec/bink: Fix off by 1 error in ref end
Fixes: out of array access
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-6657932926517248

Alterantivly to this it is possibly to allocate a bigger array

Note: oss-fuzz assigned this issue to a unrelated theora bug so the bug number matches that

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 49487045dd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:21 +02:00
Michael Niedermayer
1e22a8a9d0
avcodec/utils: Ensure linesize for SVQ3
Fixes: Assertion block_w * sizeof(uint8_t) <= ((buf_linesize) >= 0 ? (buf_linesize) : (-(buf_linesize))
Fixes: 54861/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-5352418248622080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4eef658ca5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:20 +02:00
Michael Niedermayer
8ed2948348
avcodec/utils: allocate a line more for VC1 and WMV3
Fixes: out of array read on 32bit
Fixes: 54857/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5840588224462848

The chroma MC code reads over the currently allocated frame.
Alternative fixes would be allocating a few bytes more at the end instead of a whole
line extra or to adjust the threshold where the edge emu code is activated

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 01636a63d4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:20 +02:00
Michael Niedermayer
9fc6586a00
avcodec/videodsp_template: Adjust pointers to avoid undefined pointer things
Fixes: subtraction of unsigned offset from 0xf6602770 overflowed to 0xf6638c80
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-495074400600064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f0150cd41c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:20 +02:00
Michael Niedermayer
904836c89f
avcodec/pngdec: dont skip/read chunk twice
Fixes: out of array access
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PNG_fuzzer-6668158952144896.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit df1a38d520)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:19 +02:00
Michael Niedermayer
ebdeef043a
avcodec/pngdec: Check deloco index more exactly
Fixes: out of array access:
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PNG_fuzzer-6716193709096960

Alternatively it should be possible to limit this to 3 plane RGB 8 /16bit to ensure the size is what it should be

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d5bae70406)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:19 +02:00
Michael Niedermayer
520af24c77
avcodec/ffv1dec: Check that num h/v slices is supported
Fixes: out of array access
Fixes: 55597/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-4898293416329216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8ead0ae68e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:19 +02:00
Michael Niedermayer
33785a4fd9
avformat/mov: Check samplesize and offset to avoid integer overflow
Fixes: signed integer overflow: 9223372036854775584 + 536870912 cannot be represented in type 'long'
Fixes: 55844/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-510613920664780

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 53c1f5c2e2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-27 13:37:18 +02:00