Compare commits

...
Sign in to create a new pull request.

290 commits

Author SHA1 Message Date
James Almer
ca5c0a959d fftools/ffmpeg_demux: don't flag timestamps as unreliable if they are generated
Regardless of the source being an AVFMT_NOTIMESTAMPS format, if the timestamps
are generated like when using the use_wallclock_as_timestamps demuxer option,
then they are reliable.

Fixes ticket #11268

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 1787fade20)
2025-07-10 11:16:32 -03:00
James Almer
6400860b9d avformat/iamf_parse: prevent overreads in update_extradata
Fixes: libavcodec/put_bits.h:232:32: runtime error: shift exponent -19 is negative
Fixes: Assertion n>=0 && n<=32 failed at ./libavcodec/get_bits.h:406
Fixes: 398527871/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-6602025714647040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:50:09 -03:00
James Almer
2c4ca52c8a avformat/iamf_parse: increase PutBytes buffer when writing AAC extradata
We may write up to 43 bits, so 5 bytes is not enough.

Fixes: Assertion n>=0 && n<=32 failed at ./libavcodec/get_bits.h:406
Fixes: 398527871/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-6602025714647040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:50:08 -03:00
Michael Niedermayer
ebcd40e701
avformat/matroskadec: check that channels fit in signed 32bit int
Fixes: signed integer overflow: -1384566925600903168 * 16 cannot be represented in type 'long'
Fixes: 407069502/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-5159255372267520

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 05f8c8c4c2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:50 +02:00
Michael Niedermayer
3a418442dc
avcodec/takdec: Check remaining space for first predictors
Fixes: Timeout
Fixes: 403673829/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5498240154009600

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 8e6db875af)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:50 +02:00
Michael Niedermayer
1bd79545ee
avcodec/svq3: Check there are bits left before decompression
Fixes: out of array read
Fixes: 402587670/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-6343867775647744

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 c06f5b3ab9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:50 +02:00
Michael Niedermayer
534c87eb24
avcodec/sonic: Check num_taps
The encoder uses max 128 taps, which is quiet a lot already
If work is done to improve sonic, it will be more radical than changing the taps

Fixes: Timeout
Fixes: 402539974/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-6122944271286272

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 fd0a792766)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:49 +02:00
Michael Niedermayer
f9a3e1ac19
avformat/imf_cpl: fix indention after previous commit
(cherry picked from commit d28bec8c4d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:49 +02:00
Michael Niedermayer
72d65a3a69
avformat/imf_cpl: do not continue looping forever
Fixes: infinite loop
Fixes: 401658595/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5756875014733824
Regression since: 61fa1e14e4

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 39800d78b0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:49 +02:00
Michael Niedermayer
2ac90a049c
avformat/mov: reject negative ELST durations
Fixes: multiple integer overflows
Fixes: 401016767/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6242067591790592

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 9fc2702f6f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:48 +02:00
Michael Niedermayer
6c0ec7b61d
avformat/avidec: Ignore duplicate GAB2
Fixes: memleak
Fixes: 398401912/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-4669849976766464

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 6a47046981)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:48 +02:00
Michael Niedermayer
d432d24777
MAINTAINERS: Add entry for samples-request
This is based on discussion with the GA and its simply the people
who have done or tried to do some uploads recently.

Everyone who has a shell account on ffmpeg.org should have powers to
upload samples.

CC: compn <compn@ffmpeg.org>
CC: Thilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1a5ed492e5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:48 +02:00
Michael Niedermayer
9ddab572c0
avcodec/h264_mb: Fix tmp_cr for arm
When decoding a bitstream with weighted-bipred enabled,
the results on ARM and x86 platforms may differ.

The reason for the inconsistency is that the value of
STRIDE_ALIGN differs between platforms. And STRIDE_ALIGN
is set to the buffer stride of temporary buffers for U
and V components in mc_part_weighted.

If the buffer stride is 32 or 64 (as on x86 platforms),
the U and V pixels can be interleaved row by row without
overlapping, resulting in correct output.
However, on ARM platforms where the stride is 16,
the V component did overwrite part of the U component's pixels,
leading to incorrect predicted pixels.

The bug can be reproduced by the following bitstream.

https://trac.ffmpeg.org/attachment/ticket/11357/inter_weighted_bipred2.264

Fixes: ticket 11357
Commit-msg-mostly-by: Bin Peng <pengbin@visionular.com>
Reviewed-by: Bin Peng <pengbin@visionular.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 74fd2c3ddb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:47 +02:00
Michael Niedermayer
7c068e5550
avcodec/vorbisdec: Dont treat overread as error
This differs from libvorbis by
stddev:    2.44 PSNR: 88.58 MAXDIFF:   41 bytes:   834304/   834304
for the file from the ticket

Fixes: Ticket11427

Regression since: dc89cf804a

This is a similar solution to what james proposed earlier in
[FFmpeg-devel] [PATCH] avcodec/vorbisdec: don't abort on EOD when decoding residuals

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fd5a3c5fed)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:47 +02:00
Michael Niedermayer
dd21a1462e
avcodec/hevc/ps: Fix dependant layer id check
Fixes: shift exponent 49 is too large for 32-bit type 'int'
Fixes: 398060145/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5023082406543360

Reviewed-by: James Almer <jamrial@gmail.com>
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 4e5523c985)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:47 +02:00
Michael Niedermayer
6fb3c736a6
avformat/iff: Check nb_channels == 0 in MHDR
Fixes: division by 0
Fixes: 395163171/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-542604339373670

Reviewed-by: Peter Ross <pross@xvid.org>
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 ce1fd73d63)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:46 +02:00
Michael Niedermayer
6786f8f038
tests/fate/filter-video: Fix dependancy for codecview
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1b643e3f65)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:46 +02:00
Michael Niedermayer
2f0af494b6
postproc/postprocess_template: fix dering with a 16x16 image
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fd9adbdbfb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:46 +02:00
Michael Niedermayer
ba06c473ba
libpostproc: check minimum size
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 917c15435a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:45 +02:00
Michael Niedermayer
6153d69335
avformat/hls: Fix flash1.bogulus.cfd support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 75be669ca1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:45 +02:00
Michael Niedermayer
56e100a799
avformat/hls: Split allowed_segment_extensions off allowed_extensions
This allows the user to set only the one that is needed to ALL or a
specific "wrong" extension like html

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f99f223eb1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:44 +02:00
Michael Niedermayer
b8eb5f0cbd
avformat/hls: Fix Youtube AAC
Fixes: Ticket11435
Fixes: yt-dlp -f 234+270 https://www.youtube.com/live/l8PMl7tUDIE

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 48c0dba23b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:44 +02:00
Michael Niedermayer
84e237a58e
avformat/hls: add fmp4 to allowed_extensions
Fixes: yt-dlp/issues/12700

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d82016c730)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:44 +02:00
Michael Niedermayer
f2d135332b
avformat/hls: Add ec3 to allowed_extensions
Fixes part of Ticket11435
Fixes: Elisa Viihde (Finnish online recording service)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 68644994fd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:43 +02:00
Michael Niedermayer
eb922deff1
avformat/hls: Add cmfv and cmfa to allowed_extensions
Fixes: www.nicovideo.jp
Fixes: Ticket11526
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2352145e41)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:43 +02:00
Michael Niedermayer
64911ffc20
postproc/postprocess_template: fix handling of first row of dering_C
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 142eb90f07)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:43 +02:00
Michael Niedermayer
0b7e43fb17
postproc/postprocess_template: Fix reading uninitialized pixels in dering_C()
This issue was found through the new blocktest

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0118f392be)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:42 +02:00
Michael Niedermayer
d1cef18c5c
configure: Clearer documentation for "disable-safe-bitstream-reader"
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 979608dde7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:42 +02:00
Michael Niedermayer
2fa3801507
avcodec/osq: avoid undefined negation
Fixes: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself
Fixes: 390646659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-5040277374435328

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 c6a889f3e0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:42 +02:00
Michael Niedermayer
e5350ef107
swscale/output: Fix integer overflow in yuv2gbrp_full_X_c()
Fixes: signed integer overflow: 1966895953 + 210305024 cannot be represented in type 'int'
Fixes: 391921975/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5916798905548800

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 ce538ef97a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:41 +02:00
James Almer
e7e022094a
avcodec/libtheora: fix setting keyframe_mask
t_info.keyframe_granule_shift is set to the library default of 6, which is ok
for gop sizes up to 63. Since there's apparently no way to query the updated
value after having forced a gop value with TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE,
calculate it manually instead.

Fixes ticket #11454.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 22aa71d4da)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:41 +02:00
Michael Niedermayer
e77b52b6cd
doc: replace http/git by https urls
These are more secure

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b4d165c68f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:41 +02:00
Michael Niedermayer
937051872d
Revert "avformat/mpegts: update stream info when PMT ES stream_type changes"
This fixes mixing up contexts, use of uninitialized data and crashes.
More specifically:

==1001752== Conditional jump or move depends on uninitialised value(s)
==1001752==    at 0xA9ED82: avpriv_h264_has_num_reorder_frames (h264dec.c:64)
==1001752==    by 0x668C7E: has_decode_delay_been_guessed (demux.c:757)
==1001752==    by 0x66AB13: compute_pkt_fields (demux.c:1137)
==1001752==    by 0x66B2E9: parse_packet (demux.c:1265)
==1001752==    by 0x66BD84: read_frame_internal (demux.c:1449)
==1001752==    by 0x67085B: avformat_find_stream_info (demux.c:2692)
==1001752==    by 0x25157C: ifile_open (ffmpeg_demux.c:1814)
==1001752==    by 0x272B15: open_files (ffmpeg_opt.c:1366)
==1001752==    by 0x272D85: ffmpeg_parse_options (ffmpeg_opt.c:1415)
==1001752==    by 0x2925C9: main (ffmpeg.c:991)
==1001752==  Uninitialised value was created by a heap allocation
==1001752==    at 0x483E0F0: memalign (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1001752==    by 0x483E212: posix_memalign (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1001752==    by 0x14882CE: av_malloc (mem.c:107)
==1001752==    by 0x1463785: av_buffer_alloc (buffer.c:82)
==1001752==    by 0x146423F: pool_alloc_buffer (buffer.c:369)
==1001752==    by 0x14643C4: av_buffer_pool_get (buffer.c:407)
==1001752==    by 0x752C4B: buffer_pool_get (mpegts.c:1142)
==1001752==    by 0x7538F2: mpegts_push_data (mpegts.c:1407)
==1001752==    by 0x758893: handle_packet (mpegts.c:2909)
==1001752==    by 0x758E90: handle_packets (mpegts.c:3048)
==1001752==    by 0x759B1D: mpegts_read_packet (mpegts.c:3290)
==1001752==    by 0x6687A3: ff_read_packet (demux.c:649)
==1001752==    by 0x66B594: read_frame_internal (demux.c:1346)
==1001752==    by 0x67085B: avformat_find_stream_info (demux.c:2692)
==1001752==    by 0x25157C: ifile_open (ffmpeg_demux.c:1814)
==1001752==    by 0x272B15: open_files (ffmpeg_opt.c:1366)
==1001752==    by 0x272D85: ffmpeg_parse_options (ffmpeg_opt.c:1415)
==1001752==    by 0x2925C9: main (ffmpeg.c:991)

Found-by: Alexander A. Shvedov <shvedov@gmx.com>
CC: Pavel Koshevoy <pkoshevoy@gmail.com>
This reverts commit 0021484d05.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-11 17:29:40 +02:00
Andreas Rheinhardt
0f1fe3d153 avformat/matroska: Support JPEG2000 for demuxing
Legal since commit 1cd0a9be4b2d1e7c60184ec68404e00e46e3123e
(Jan 4) in the Cellar Matroska specification git repo.
We still hold out on muxing it due to compatibility with
old demuxers.

Reviewed-by: compn <ff@hawaiiantel.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 8a936b8726)
2025-06-07 09:28:45 +02:00
Andreas Rheinhardt
0755e038ca avformat/matroskadec: Fix VfW extradata size
The structure is padded to an even length with an internal
size field to indicate the real size.
The matroska-matroska-display-metadata test (writing FFV1
in VFW mode) was affected by this.
It should also fix ticket #11613.

Reviewed-by: compn <ff@hawaiiantel.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 92e310eb82)
2025-06-07 09:28:34 +02:00
Coia Prant
9373b442a6 configure: Use MSYSTEM_CARCH for default arch on msys2
On msys2, `uname -m` returns the architecture of the base msys2
layer. On Windows on arm64, the base msys2 layer itself is still
x86_64 only, even if running with e.g. the clangarm64 where the
windows native applications are built as aarch64.

If MSYSTEM_CARCH is set, use this instead of `uname -m` for
the default architecture. This gives the correct behaviour
for the clangarm64 environments. It also gives the correct
default for the 32 bit x86 environments such as `mingw32`.

(On `mingw32`, the fact that `uname -m` returned `x86_64`
hasn't been an issue, as both that and `i686` gets normalized
into `x86` internally in ffmpeg's configure.)

Signed-off-by: Coia Prant <coiaprant@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit df967d095a)
2025-05-28 10:35:33 +03:00
James Almer
4c78a357d0 avcodec/lcevcdec: don't try to write to output frames directly
The buffer references may not be writable at this point, as the decoder
calls get_buffer2() with the AV_GET_BUFFER_FLAG_REF flag.

Fixes races as reported by tsan, producing correct output regardless of
threading choices.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 8eae65dc5c)
2025-05-22 21:41:23 -03:00
Paul B Mahol
ccbd089467 avfilter/avfiltergraph: fix regression in picking channel layout
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 1b3f4842c1)
2025-05-22 19:40:35 -03:00
Pavel Koshevoy
24de8a98cf avformat/mpegts: update stream info when PMT ES stream_type changes
I have several .ts captures where video and audio codec changes even
though the PMT version does not change and the PIDs stay the same.
This happens during transition to/from slate (mpeg2 video and audio)
to network broadcast (hevc video and eac3 audio in private PES).

I've updated fate ts-demux expected results.
2025-05-18 11:26:56 -06:00
Kacper Michajłow
0b065663d4 avcodec/libzvbi-teletextdec: change new lines to \n in ASS header
Fixes remaining \r\n is ASS header after 57c545090d.

Fixes AVERROR_BUG error during init as this decoder expected `\r\n` in
default ASS header. strstr(..., "\r\n[Events]\r\n") failed after changes
in 57c545090d.

Fixes ticket #11545.

Fixes: 57c545090d
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit eb6dc952cb)
2025-05-17 21:44:39 +02:00
Marton Balint
59576ad4c5 avformat/wavdec: increase requested probe score for codec probe
Codec probing was primarily added to the wav demuxer to support DTS-in-wav
files, but DTS probing functions return AVPROBE_SCORE_EXTENSION+1, so we can be
a bit more strict with the required score.

This fixes MP3 misdetections for some wav files.

Fixes ticket #11581.

Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit ce01c7fb58)
2025-05-17 21:44:12 +02:00
James Almer
7eaa8c110e avcodec/h264_slice: insert LCEVC side data before get_buffer() call
Otherwise it will not be taken into account or applied at all.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 25b0a8e295)
2025-05-15 12:54:41 -03:00
Zhao Zhili
4991c1ec92 avformat/hls: Fix get key file error
The offset and end_offset options are meant for segment, not for key.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit bb0c4649fb)
2025-05-12 14:28:09 +08:00
Zhao Zhili
94784d0918 avcodec/bsf/h264_mp4toannexb: Fix mixed bitstream format
This bsf converts AV_PKT_DATA_NEW_EXTRADATA side data in avcc format
to in-band annexb format. However, the side data wasn't been removed
and copied from input packet to output packet. So the output packet
has mixed bitstream format. We don't support mixed bitstream format.
For example, h264_metadata report error in the following case:

ffmpeg -i foo.flv \
  -bsf:v "h264_mp4toannexb,h264_metadata" \
  -c copy -f null

This patch removed NEW_EXTRADATA side data after process.

This patch also add a check so only NEW_EXTRADATA in avcc format is
processed. NEW_EXTRADATA in annexb format is copied to output as is.

Reported-by: jiangjie <jiangjie618@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit 25812d3033)
2025-05-12 11:58:56 +08:00
Zhao Zhili
9237125e51 avformat/mov: Reduce seek when interleaved_read is disabled
Don't select sample with small dts when interleaved_read is disabled.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit ca964ba139)
2025-05-12 11:49:32 +08:00
Tobias Rapp
c6c20e04cc avfilter/vf_setparams: Fix chroma_location being cleared
Fix chroma_location being cleared by setrange and setfield filters.
This was forgotten in 201f1cba15.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
(cherry picked from commit 0f751d3836)
2025-05-07 10:57:35 +02:00
Martin Storsjö
652a765ecb configure: Enable -fno-common for Darwin targets, avoid linker warnings
Since GCC 10 and llvm.org Clang 11, -fno-common is the default.
However Apple's Xcode Clang hasn't followed suit yet, and still
defaults to -fcommon.

Compiling with -fcommon causes uninitialized global variables to
be treated as "common" (which allows multiple object files to have
similar definitions).

Common variables seem to have the issue that their intended alignment
isn't signaled, so the linker assumes that they may need alignment
according to their full size.

With large global tables, this can lead to linker warnings like
this, with Xcode 16.3:

    ld: warning: reducing alignment of section __DATA,__common from 0x8000 to 0x4000 because it exceeds segment maximum alignment

This can be reproduced with a small snippet like this:

    char table[16385];
    int main(int argc, char* argv[]) { return 0; }

Compiling with -fno-common avoids this issue and warning, and
matches the default behaviour of other compilers. (Compiling with
-fno-common also avoids the risk of accidentally accepting
duplicate definitions of global variables, as long as they are
uninitialized.)

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit f4e72eb5a3)
2025-05-06 10:55:51 +03:00
Martin Storsjö
c91d887a25 configure: Only try to use the -no_warn_duplicate_libraries flag on Darwin
While we only add the flag if the linker seems to support it,
it turns out that ld.bfd had a bug where the flag is accidentally
accepted, and the flag produces an output file named
"_warn_duplicate_libraries".

The ld.bfd bug was fixed in binutils 2.36, in
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=3991c7acb29aa8d7d52150695eb3efa03a08dd50.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 38d08f5c45)
2025-05-06 10:55:51 +03:00
Martin Storsjö
579e7b85c8 configure: Silence Xcode warnings about duplicate libraries
Since Xcode 15, macOS developer tools use a new linker. The new
linker by default warns for duplicate -l options. As this is a
known and expected thing, not to be considered an issue, ask for
the warning to be silenced.

This silences linker warnings like this:

    ld: warning: ignoring duplicate libraries: '-lc++', '-lcrypto', '-lm', '-logg', '-lpthread', '-lssl', '-lvorbis', '-lvpx', '-lz'

The linker can also warn about duplicate -rpath options, and there's
currently no option to silence those warnings.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit bd22d7e601)
2025-05-06 10:55:51 +03:00
Zhao Zhili
48c0f071d4 avcodec/mediacodecdec_common: Workaround MTK broken crop implementation
MediaTek SOC return broken crop info, e.g.,
width: int32(3840) height: int32(2160) crop: Rect(0, 0, 318, 238)

It will notify the right crop info with infoOutputFormatChanged, but
too late.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit 7fe9d12f25)
2025-04-01 17:34:13 +08:00
Peter Ross
276bd388f3 avcodec/Makefile: include aom_film_grain.o file for h264_sei component
h264_sei depends on h2645_sei, which in turn depends on aom_film_grain for
ff_aom_uninit_film_grain_params()

(cherry picked from commit 7aeae8d1ae)
2025-03-20 23:22:35 -03:00
Brad Smith
dca3b4760f lsws/ppc/yuv2rgb_altivec: Fix build in non-VSX environments with Clang v2
v2: test for function if AltiVec is enabled instead of with AltiVec and without VSX

(cherry picked from commit 49c8f33262)
Signed-off-by: Brad Smith <brad@comstyle.com>
2025-03-16 00:04:50 -04:00
Brad Smith
ea34bf7962 lsws/ppc/yuv2rgb_altivec: Fix build in non-VSX environments with Clang
Add a check for the existence of the vec_xl() function. Clang provides
the function even with VSX not enabled.

(cherry picked from commit 30a8641465)
Signed-off-by: Brad Smith <brad@comstyle.com>
2025-03-11 00:37:35 -04:00
Gyan Doshi
68b5db2464 avcodec/libsvtav1: unbreak build with latest svtav1
SVT-AV1 made a change in their public API in 988e930c but without a
version bump or any other accessible marker, thus breaking ffmpeg build
with current versions of SVT-AV1.

They have finally bumped versions a month later, so check added.

(cherry picked from commit d1ed5c06e3)
2025-03-05 21:09:17 -03:00
James Almer
f023d2c61b fftools/ffmpeg_filter: also remove display matrix side data from buffered frames
Some frames may be buffered before a complex filtergraph can be configured.
This change ensures the side data removal in the cases where autorotation is
enabled also applies to them.

Fixes ticket #11487

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 01f63ef0b4)
2025-03-04 10:29:16 -03:00
Lynne
db69d06eee
configure: update copyright year
On 01/01/2025 19:05, Peter Ross wrote:
> FFmpeg turns 25 this year.

(cherry picked from commit d3aa99a4f4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-03 01:17:09 +01:00
Michael Niedermayer
68af2cc3fe
Prepare for 7.1.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-02 16:29:39 +01:00
softworkz
a8a3fc84af
avformat/hls: Partially revert "reduce default max reload to 3"
(setting to 100 as a reasonable compromise)

The change has caused regressions for many users and consumers.
Playlist reloads only happen when a playlist doesn't indicate that it
has ended (via #EXT-X-ENDLIST), which means that the addition of future
segments is still expected.
It is well possible that an HLS server is temporarily unable to serve
further segments but resumes after some time, either indicating a
discontinuity or even by fully catching up.
With a segment length of 3s, a max_reload value of 1000 corresponds to
a duration of 50 minutes which appears to be a reasonable default.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ace9f03a6c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-02 16:28:23 +01:00
Pavel Koshevoy
71889a8437 avformat/mov: (v4) fix get_eia608_packet
The problem is reproducible with "Test for Quicktime 608 CC file.mov"
from https://samples.ffmpeg.org/MPEG2/subcc/

ffmpeg -i "Test for Quicktime 608 CC file.mov" -map 0 -c copy -y remuxed.mov

See https://trac.ffmpeg.org/ticket/11470
2025-02-26 16:02:09 -07:00
Michael Niedermayer
3e16202c39
Changelog: update
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 03:19:34 +01:00
Michael Niedermayer
d392931391
avformat/iff: Check that we have a stream in read_dst_frame()
Fixes: null pointer dereference
Fixes: 385644864/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-4551049565765632

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8668957ef6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:34 +01:00
Michael Niedermayer
6646dd2825
avcodec/aac/aacdec_lpd: Limit get_unary()
The limit is based on later code storing 32bits

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 393164866/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-4606798354513920

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 464fb861b1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:33 +01:00
Michael Niedermayer
bf8c0be971
avcodec/aac/aacdec_usac: Simplify decode_usac_scale_factors()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 41cd72d76e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:33 +01:00
Michael Niedermayer
0e5b6a7156
avcodec/aac/aacdec: Clear SFO on error
types and SFO become confused for a USAC stream

Fixes: out of array access
Fixes: 383854203/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-4996677847547904.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 d1be369af6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:33 +01:00
Michael Niedermayer
2e7364727c
avformat/mlvdec: fix size checks
Fixes: heap-buffer-overflow
Fixes: 391962476/clusterfuzz-testcase-minimized-ffmpeg_dem_MLV_fuzzer-5746746587676672

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 251d43aef0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:32 +01:00
Michael Niedermayer
6acfaa1084
avformat/wavdec: Fix overflow of intermediate in block_align check
Fixes: signed integer overflow: -251517880 * 32 cannot be represented in type 'int'
Fixes: 385224934/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-4909298151915520

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 1afbc40875)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:32 +01:00
Michael Niedermayer
c388bc1774
avformat/mxfdec: Check edit unit for overflow in mxf_set_current_edit_unit()
Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long'
Fixes: 392672068/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6232335892152320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8a6ad9eab2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:32 +01:00
Michael Niedermayer
43ba995a31
avformat/hls: Fix twitter
Allow mp4 with all mpegts extensions

Fixes: Ticket11435
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit cef3422b48)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:31 +01:00
Michael Niedermayer
4018b915a6
avcodec/vvc/refs: fix negative pps_scaling_win offsets
The spec seems to allow these to  be negative

Fixes: left shift of negative value -15
Fixes: 392687035/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-6559804532785152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 33679f5325)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:31 +01:00
Michael Niedermayer
6c4e56f07d
libavformat/hls: Be more restrictive on mpegts extensions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0113e30806)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:31 +01:00
Michael Niedermayer
880007e75c
avformat/hls: .ts is always ok even if its a mov/mp4
Maybe fixes: 11435

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9e12572933)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:30 +01:00
Michael Niedermayer
c74740fcd5
avcodec/h263dec: Check against previous dimensions instead of coded
Fixes: out of array access
Fixes: crash-a41ef3db699013f669b076f02f36942925f5a98c

Found-by: Kacper Michajlow <kasper93@gmail.com>
Reviewed-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0fe33c99a2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:30 +01:00
Michael Niedermayer
9dea077922
avformat/hls: Print input format in error message
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d845533130)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:30 +01:00
Michael Niedermayer
b753bac08f
avformat/hls: Be more picky on extensions
This blocks disallowed extensions from probing
It also requires all available segments to have matching extensions to the format
mpegts is treated independent of the extension

It is recommended to set the whitelists correctly
instead of depending on extensions, but this should help a bit,
and this is easier to backport

Fixes: CVE-2023-6602 II. HLS Force TTY Demuxer
Fixes: CVE-2023-6602 IV. HLS XBIN Demuxer DoS Amplification

The other parts of CVE-2023-6602 have been fixed by prior commits

Found-by: Harvey Phillips of Amazon Element55 (element55)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 91d96dc8dd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-26 01:26:29 +01:00
James Almer
9abf2aef37 avformat/iamf_parse: ensure there's at most one of each parameter types in audio elements
Should prevent potential memory leaks on invalid files.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 5470d024e1)
2025-02-23 12:49:05 -03:00
James Almer
b06845c672 avformat/iamf_parse: add missing constrains for num_parameters in audio_element_oub()
Fixes ticket #11475.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 0526535cd5)
2025-02-23 12:48:55 -03:00
James Almer
04fd3f69b3 avformat/iamf_parse: add missing av_free() call on failure path
Fixes ticket #11416

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d5873be583)
2025-02-23 12:48:17 -03:00
Anton Khirnov
8cabfd922a lavc/hevcdec: unbreak WPP/progress2 code
The "progress2" API in pthread_slice.c currently associates a progress
value with a thread rather than a job, relying on the broken assumption
that a job's thread number is equal to its job number modulo thread
count.

This removes this API entirely, and changes hevcdec to use a
ThreadProgress-based implementation that associates a
mutex/cond/progress value with every job.

Fixes races and deadlocks in hevdec with slice threading, e.g. some of
those mentioned in #11221.

(cherry picked from commit 79c47dfd25)
2025-02-13 19:45:30 +08:00
Martin Storsjö
745e70f1d5 fate: Add a dependency on ffprobe for fate-flcl1905
This fixes occasional failed tests, if doing "make fate" without a
regular "make" or "make all" inbetween.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit eb79c316c7)
2025-02-11 10:55:05 +02:00
Martin Storsjö
283e5a4fa0 checkasm: aacencdsp: Actually test nonzero values in quant_bands
Previously, we read elements from ff_aac_pow34sf_tab; however
that table is initialized to zero; one needs to call
ff_aac_float_common_init() to make sure that the table is
initialized.

However, given the range of the input values, a large number of
entries in ff_aac_pow34sf_tab would give results outside of the
range for signed 32 bit integers. As the largest aac_cb_maxval
entry is 16, it seems more reasonable to produce values within
an order of mangitude of that value.

(When hitting INT_MIN, implementations may end up with different
results depending on whether the value is negated as a float or
as an int. This corner case is irrelevant in practice as this
is way outside of the expected value range here.)

Coincidentally, this fixes linking checkasm with Apple's older
linker. (In Xcode 15, Apple switched to a new linker. The one in
older toolchains seems to have a bug where it won't figure out to
load object files from a static library, if the only symbol
referenced in the object file is a "common" symbol, i.e. one for
a zero-initialized variable. This issue can also be reproduced with
newer Apple toolchains by passing -Wl,-ld_classic to the linker.)

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e75a0f3c75)
2025-02-11 10:39:24 +02:00
Martin Storsjö
f2b85c8aa1 x86: aacencdsp: Fix negating signed values in aac_quantize_bands
Previously, we would do OR with the sign bit, forcing the output
to a negative value, while we want to negate it, by inverting the
sign bit.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 8b3e0061e1)
2025-02-11 10:39:18 +02:00
Martin Storsjö
ac494b8325 rtmpproto: Avoid rare crashes in the fail: codepath in rtmp_open
When running the cleanup in rtmp_close on failures in rtmp_open,
we can in rare cases end up using rt->playpath, assuming that it
is still set.

The crash could happen if we hit the fail codepath in rtmp_open
while publishing (rt->is_input == 0) with rt->state set to
a value > STATE_FCPUBLISH.

This would normally not happen while publishing; either we have
an error (and rt->state <= STATE_FCPUBLISH) or we reach
rt->state = STATE_PUBLISHING, and then we also return successfully
from rtmp_open.

The unexpected combination of states could happen if the server
responds with e.g. "NetStream.Play.Stop" while expecting
"NetStream.Publish.Start"; this sets rt->state to STATE_STOPPED,
which also fulfills the condition "> STATE_FCPUBLISH".

We don't need to free the rt->playpath/tcurl/flashver strings here;
they're handled via AVOption, and thus are freed automatically when
the protocol instance is freed (that's why they aren't freed
manually within the rtmp_close function either).

We also don't need to free the AVDictionary with options; it's
owned by the caller.

A smaller fix would be to just call rtmp_close before freeing
the strings and dictionary, but as we don't need to free them
at all, let's remove that redundant code.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 8f4819ce01)
2025-02-06 23:47:41 +02:00
Martin Storsjö
31f0084cbb configure: Improve the check for the rsync --contimeout option
Traditionally, macOS has shipped an old version of rsync that lacked
support for this option, hence this check (added in
a8b3f0c5cf).

However, in macOS 15.x, Apple have switched to providing rsync as a
different tool, openrsync. The version of openrsync in at least
macOS 15.2 does include "[--contimeout]" (note the lack of "=" after
the option), in the output of "rsync --help", but when used, the tool
errors out with "rsync: --contimeout=60: unknown option". So apparently
the tool erroenously lists the option as supported, while it really
isn't.

The original rsync tool (with a new enough version) prints
"--contimeout=SECONDS" in the output of "rsync --help".

It is unclear which version of openrsync Apple are shipping; the latest
upstream openrsync from OpenBSD does support the option and includes
"[--contimeout=seconds]" in the output of "--help", and older versions
don't seem to include the option as listed at all.

Therefore, check for "--conntimeout=" with the "=", this should
properly detect both new enough rsync and openrsync.

This fixes running "fate-rsync" on macOS 15.x.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 3cd4e8470a)
2025-02-06 23:47:41 +02:00
James Almer
e0f3c1018a avutil/downmix_info: add missing semicolon
Fixes compilation broken by 8a72775d5d.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-06 18:44:04 -03:00
Patrice Dumas
8accee8b56 doc/t2h: Support texinfo 7.1 and 7.2 pretest
Here is a proposed patch for portability of doc/t2h.pm for GNU Texinfo
7.1 and 7.1.90 (7.2 pretest).  I tested against 7.1 and 7.1.90 (7.2
pretest).  There is a difference in the headings compared to the website
version, maybe related to FA_ICONS not being set the same, but the
result seems correct.

I also renamed $element to $output_unit in ffmpeg_heading_command as in
new equivalent makeinfo/texi2any code the $element variable is the
$command variable in ffmpeg_heading_command, which is very confusing.  I
left as is the $command variable to have a patch easier to read, but it
could make sense to rename $command as $element later on.

The patch could also have effects with Texinfo 7.0, since some of the
changes are for that version, but that probably never show up because it
is for situations that may not exist in ffmpeg manuals (for example
@node without sectioning command), or because the code is robust to some
missing information (case of $heading_level in ffmpeg_heading_command
that was not set, as far as I can tell).

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 4d9cdf82ee)
2025-02-06 18:10:39 -03:00
Steven Zhou
57a53adf2b avfilter/drawtext: fix memory leak when using "reinit" runtime command
Free AVOption in drawtext private context when freeing old copy of drawtext
private context during processing of "reinit" runtime command.

Signed-off-by: Steven Zhou <steven.zhou@netint.ca>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d1fa9cf4b4)
2025-02-06 18:10:39 -03:00
James Almer
8a72775d5d avutil/downmix_info: zero the allocated buffer
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 0bed1b8953)
(cherry picked from commit a649b2a831)
2025-02-06 18:10:24 -03:00
James Almer
a4bf50b5c0 avformat/mov: fix overflow in drift timestamp calculation
Fixes: signed integer overflow: 7803923888585309955 - -3407677434275325337 cannot be represented in type 'int64_t' (aka 'long')
Fixes: 377736723/clusterfuzz-testcase-minimized-media_pipeline_integration_fuzzer-5052449500889088

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 02958ab715)
2025-02-06 18:07:34 -03:00
Michael Niedermayer
dc07f98934
Changelog: update
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:21:59 +01:00
Michael Niedermayer
a7a6d92e84
avformat/mxfdec: Check avio_read() success in mxf_decrypt_triplet()
Fixes: Use of uninitialized memory
Fixes: 71444/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5448597561212928

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 6ecc96f4d0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:21 +01:00
Michael Niedermayer
293e4ddd98
avcodec/huffyuvdec: Initialize whole output for decode_gray_bitstream()
Fixes: use of uninitialized memory
Fixes: 375286238/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-6352546854141952

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 ef71552cf9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:20 +01:00
Michael Niedermayer
5f337bd798
avformat/iamf_reader: Initialize padding and check read in ff_iamf_read_packet()
Fixes: Use of uninitialized memory
Fixes: 377642312/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-4554550985424896

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 aec2933344)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:20 +01:00
Michael Niedermayer
43eaca54bc
avformat/ipmovie: Check signature_buffer read
Fixes: use of uninitilaized data
Fixes: 385167047/clusterfuzz-testcase-minimized-ffmpeg_dem_IPMOVIE_fuzzer-5941477505564672

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 788abe0d25)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:19 +01:00
Michael Niedermayer
1646840988
avformat/wtvdec: Initialize buf
ff_parse_mpeg2_descriptor() reads over what is initialized
Fixes: use of uninitialized memory
Fixes: 383825645/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-5144130618982400

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 17b019c517)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:19 +01:00
Michael Niedermayer
f710d5af0a
avcodec/cbs_vp9: Initialize VP9RawSuperframeIndex
Fixes: use-of-uninitialized-value
Fixes: 70907/clusterfuzz-testcase-minimized-ffmpeg_BSF_VP9_METADATA_fuzzer-6339363208757248

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 e81d410242)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:19 +01:00
Michael Niedermayer
c82813c966
avformat/vqf: Propagate errors from add_metadata()
Suggested-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 49fa3f6c5b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:18 +01:00
Michael Niedermayer
30bef79c69
avformat/vqf: Check avio_read() in add_metadata()
Fixes: use of uninitialized data
Fixes: 383825642/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5380168801124352

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 c43dbecbda)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:18 +01:00
Michael Niedermayer
5ee56ebd30
avcodec/ffv1enc: Fix RCT for GBR colorspace
It performs better when its less buggy

Compression changes for rgb_scanline_half_piz_dw_t08 (using float16 with remaping) from
56086 byte to 34371
(with a single slice its 28122 byte)

prior remap it was 188186 bytes

ACES_OT_VWG_SampleFrames/ACES_OT_VWG_SampleFrames improves too but only by a fraction of a percent

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 62c98cdd54)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:18 +01:00
Michael Niedermayer
c3c7ecfe48
avformat/dashdec: Check whitelist
Fixes: CVE-2023-6602, V. DASH Playlist SSRF

Found-by: Harvey Phillips of Amazon Element55 (element55)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4c96d6bf75)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:17 +01:00
Michael Niedermayer
ac9c710e18
avutil/avstring: dont mess with NULL pointers in av_match_list()
Fixes: applying zero offset to null pointer

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c6c54943d1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:17 +01:00
Michael Niedermayer
75385a729f
avfilter/vf_v360: Fix NULL pointer use
Fixes: applying zero offset to null pointer
partly Fixes: verysmall.flv

Found-by: Elias Myllymäki <elias.myllymaki04p@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 66e9888bf4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:17 +01:00
Michael Niedermayer
ece76d7dd4
avcodec/mpegvideo_enc: Check FLV1 resolution limits
Found-by: Elias Myllymäki <elias.myllymaki04p@gmail.com>
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 827c073154)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:16 +01:00
Michael Niedermayer
5fed7010f8
avcodec/ffv1enc: Fix handling of 32bit unsigned symbols
This may be needed for floats

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 402824e9e9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:16 +01:00
Michael Niedermayer
0bb8a38c10
avformat/mov: perform sanity checks for heif before index building
Fixes: undefined NULL pointer use
Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-6363211175493632

This performs equivalent sanity checks as are done in mov_read_trak()
before mov_build_index()

Reported-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit afbc3a1b23)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:16 +01:00
Michael Niedermayer
41f8052284
avformat/mov: Factorize sanity check out
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 16b3d3e3eb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:15 +01:00
Michael Niedermayer
5e02e1ba96
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>
(cherry picked from commit 251de1791e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:15 +01:00
Michael Niedermayer
73fd378995
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>
(cherry picked from commit 3f029bfb7f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:15 +01:00
Michael Niedermayer
585c799b10
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>
(cherry picked from commit 4485a0fd77)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:14 +01:00
Michael Niedermayer
da1e316a1f
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>
(cherry picked from commit 0f511b4518)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:14 +01:00
Michael Niedermayer
658029334e
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>
(cherry picked from commit 56faee21c1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:14 +01:00
Michael Niedermayer
b827ac49b7
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>
(cherry picked from commit b5b6391d64)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:13 +01:00
Michael Niedermayer
601616f2de
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>
(cherry picked from commit 9ffa127aa6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:13 +01:00
Michael Niedermayer
553517868d
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>
(cherry picked from commit b72de49295)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:13 +01:00
Michael Niedermayer
5129ae45bf
avcodec/get_buffer: Use av_buffer_mallocz() for audio same as its done for video
Fixes: Use of uninintialized value
Fixes: 70993/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-6378949754552320
Fixes: 71104/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5001538727116800

For the AAC/USAC/SBR code which reads uninitialized memory, it would be good, if it did not
a fix for that is welcome!

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 b9b4c9ebf0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:12 +01:00
Michael Niedermayer
d322ffdef5
avformat/jpegxl_anim_dec: clear buffer padding
Fixes: use of uninitialized value
Fixes: 70992/clusterfuzz-testcase-minimized-ffmpeg_dem_IMAGE2_fuzzer-5735819170611200

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 3f0b95bb17)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:12 +01:00
Michael Niedermayer
d32543f520
avformat/rmdec: check that buf if completely filled
Fixes: use of uninitialized value
Fixes: 70988/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-5298245077630976

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9578c135d0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:12 +01:00
Michael Niedermayer
f44a7207f0
avcodec/cfhdenc: Clear dwt_tmp
This occurs on a 32x32 input

Fixes: use of uninitialized value
Fixes: 70897/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5960860961406976

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 9de721de70)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:11 +01:00
Michael Niedermayer
0da3deb079
avcodec/hapdec: Clear tex buffer
The code following makes no attempt to initialize all of the buffer

Fixes: use of uninitialized value
Fixes: 70980/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5329909059223552

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 7eeeda703b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:11 +01:00
Michael Niedermayer
14af28c2f5
avformat/mxfdec: Check that key was read sucessfull
Fixes: use of uninitialized value
Fixes: 70932/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4870202133643264

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 4c62cbcae2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-23 01:20:11 +01:00
James Almer
aeb8631048 avformat/hevc: fix writing hvcC when no arrays are provided in hvcC-formatted input
Don't reject extradata with missing PS NALUs if array_completeness is not
requested.

Fixes a regression since a696b28886.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 5813e5aa34)
2025-01-20 21:59:13 -03:00
Jonathan Baudanza
d72536008a 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>
(cherry picked from commit c0fbb6d5b7)
2025-01-10 12:10:37 +02:00
Eugene Zemtsov
5b2ee11a60 avcodec/decode: Fix incorrect enum type used in side_data_map()
It's AVPacketSideDataType, not AVFrameSideDataType.

Reviewed-by: Ted (Chromium) Meyer <tmathmeyer@chromium.org>
Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit e9c3698ed2)
2025-01-07 23:47:23 -06:00
Eugene Zemtsov
9328e07ad5 avformat/mov: fix crash when trying to get a fragment time for a non-existing fragment
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 7c9bde1d0d)
2025-01-07 23:47:23 -06:00
Marth64
60551696c0 avformat/libssh: fix credential variables typo
Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 084d3515ca)
2025-01-07 23:47:23 -06:00
Marth64
dd78b9ed7c avformat/hlsenc: check return value of avcodec_parameters_copy()
Written in the dominant style of the surrounding code block.

Signed-off-by: Marth64 <marth64@proxyid.net>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
(cherry picked from commit f46415f373)
2025-01-07 23:47:23 -06:00
Marth64
ae7332065b avformat/dashdec: format open_demux_for_component()
Signed-off-by: Marth64 <marth64@proxyid.net>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
(cherry picked from commit 95bb47de7d)
2025-01-07 23:47:23 -06:00
Marth64
ba94588afa avformat/dashdec: check return code of avcodec_parameters_copy()
Signed-off-by: Marth64 <marth64@proxyid.net>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
(cherry picked from commit 7acc2ebd5d)
2025-01-07 23:47:23 -06:00
Marth64
9d9b87be2b avformat/dashdec: return ret directly in open_demux_for_component()
Signed-off-by: Marth64 <marth64@proxyid.net>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
(cherry picked from commit 6ee7555a90)
2025-01-07 23:47:23 -06:00
Marth64
0a51afd21d avformat/smoothstreamingenc: check return value of avcodec_parameters_copy()
Written in the dominant style of the surrounding code block.

Reviewed-by: ePirat <epirat07@gmail.com>
Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 3528bfed45)
2025-01-07 23:47:23 -06:00
Marth64
3a375e3dcf avcodec/cbs_av1: fix variable shadowing in cbs_av1_split_fragment()
header is previously declared as an int argument then
shadowed in the scope of the loop as a AV1RawOBUHeader.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 8e8260aabf)
2025-01-07 23:47:23 -06:00
Marth64
0ccb070863 doc/demuxers/dvdvideo: seeking is supported, remove outdated statement
Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 1c2c70fe4d)
2025-01-07 23:43:35 -06:00
Marth64
a6d4bac44d avformat/dvdvideodec: check return code of ff_dvdclut_yuv_to_rgb()
Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit e256761def)
2025-01-07 23:43:35 -06:00
Marth64
7264127438 avformat/dvdvideodec: fix missing last chapter marker due to off-by-one
When using fast chapter marker calculation (default), the last
marker is inadverdently ignored due to an off-by-one.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit a5a899bfcb)
2025-01-07 23:43:35 -06:00
Marth64
7fc55c38c7 avformat/dvdvideodec: don't allow seeking beyond dvdnav reported duration
There is no reason to accept timestamp values beyond what dvdnav
reported as the duration of the title.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 1d55f54846)
2025-01-07 23:43:35 -06:00
Marth64
a626a08c45 avformat/dvdvideodec: discard duplicate or partial AC3 samples
Some DVD muxers signal segments to start with duplicate audio samples
when starting extraction from a chapter marker or terminate seamless PGs
on partial audio samples (causing corrupt AC3 frames). Clean up after
these muxers by tracking frames with duplicate PTS and eliminating
partial AC3 frames.

This results in smoother chapter extraction and overall seeking experience,
with linear PTS and AC3 delay within 32ms (1 frame) away from the video.

The issue was not apparent until the flushing pattern was replaced with
a full subdemux reset, as the flushing dropped the frames prematurely,
along side others, as such they were never present to begin with.

(cherry picked from commit 0912407b9d)
2025-01-07 23:43:35 -06:00
Marth64
53e66c7161 avformat/dvdvideodec: drop packets with unset PTS or DTS
The packets effectively serve no purpose and we are already
dropping packets with PTS less than 0. This also creates
for a smoother seeking experience after the subdemuxer
reset fix.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit f2f238c3a4)
2025-01-07 23:43:35 -06:00
Marth64
19740bcbf8 avformat/dvdvideodec: remove unnecessary need_parsing argument
The value is always AVSTREAM_PARSE_HEADERS.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 3656379d92)
2025-01-07 23:43:35 -06:00
Marth64
09e08d790e avformat/dvdvideodec: open subdemuxer after initializing IFO headers
It is wasteful to open the subdemuxer if an error occurs while
initializing streams or reading IFO headers.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit a2c57e27d6)
2025-01-07 23:43:35 -06:00
Marth64
340795adc9 avformat/dvdvideodec: remove auto value for menu_lu option
The "auto" mode serves no functional purpose except for logging
a message and setting the value to 1. The documentation clearly
explains what the option is for.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 60434b483c)
2025-01-07 23:43:35 -06:00
Marth64
212546e9c6 avformat/dvdvideodec: default menu_vts option to 1 and clarify description
Menu 0 is the VIDEO_TS root menu, which does not appear to be used
commonly for menu segments. Instead, default to the menu of VTS 1.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 4a03e95ff4)
2025-01-07 23:43:34 -06:00
Marth64
a61eb0c2c0 avformat/dvdvideodec: check the length of a NAV packet when reading titles
Some discs present titles with bogus NAV packets. We apply this check
for menus and for title MPEG blocks, but we should also apply it
for NAV packets during title demuxing.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit afc152f564)
2025-01-07 23:43:34 -06:00
Marth64
e46e1c3368 avformat/dvdvideodec: reset the subdemuxer on discontinuity instead of flushing
DVDs naturally consist of segmented MPEG-PS blobs within a VOB
(i.e. VOBs are not linear). NAV packs set the segment boundaries.
When switching between segments, discontinuities occur and thus
the subdemuxer needs to be reset. The current approach to manage
this is by invoking ff_read_frame_flush() on the subdemuxer context,
via a callback function which is invoked during the menu or dvdnav
block functions. The same subdemuxer context is used throughout
the demux, with a stretched PTS wrap bits value (64) + disabled
overflow correction, and then flushed on each segment. Eventually,
a play_end context variable is set to declare EOF.

However, this approach causes frame drops. The block read flushes the
demuxer before the frame read is complete, causing frames to drop
on discontinuity. The play_end signal likewise ends playback before
the frame read is complete, causing frames to drop at end of the title.
To compound the issue, the PTS wrap bits value of 64 is wrong;
the VOBU limit is actually 32 and the overflow correction should work.

Instead, EOF the MPEG-PS subdemuxer organically when each VOB segment
ends, and re-open it if needed with the offset after the full frame read
is complete. In doing so, correct the PTS wrap behavior to 32 bits and
remove the play_end/segment_started signals and callback pattern.

Note that the timestamps as reported by the NAV packets are known as
"PTMs", so the fields storing the time prior to adjustment are renamed
accordingly. This makes it more clear when we are offsetting the
NAV packet reported timestamps versus what we present as a demuxer.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit a1ae66c827)
2025-01-07 23:43:34 -06:00
Marth64
75c1943e30 avformat/dvdvideodec: simplify dvdvideo_read_packet()
The function has a few branches where it discards frames via
FFERROR_REDO; consolidate is via a goto block to simplify the
function and improve readability. Logging still maintains
all the relevant details for the reason of the discard.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 1964faa568)
2025-01-07 23:43:34 -06:00
Marth64
ece2a9a275 avformat/dvdvideodec: enable chapter calculation for menus
Menus are generally segmented by cell, so use them as the
marker delimiters. Requires preindex option to be enabled.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit c1e4b6c676)
2025-01-07 23:43:34 -06:00
Marth64
6f4ae5f183 avformat/dvdvideodec: standardize the NAV packet event signal
This consolidates the FFERROR_REDO handling of NAV packets to
dvdvideo_subdemux_read_data(), is a pre-requisite to calculating
chapter markers for menus, and a pre-requisite to fixing the
frame desync issue when the subdemuxer is flushed.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit b38ca20bf2)
2025-01-07 23:43:34 -06:00
Marth64
b108d17c56 avformat/dvdvideodec: move memcpy below missed NAV packet warning
Readability improvement; the warning can be bundled beneath
the preceding validations rather than awkwardly between the memcpy
and return.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 6bbaa7db49)
2025-01-07 23:43:34 -06:00
Marth64
a5c48cc7a1 avformat/dvdvideodec: remove "auto" value for -pg option, default to 1
The default "auto" mode is effectively useless; the reasonable
default use case is to use the first PG (segment) of the
selected PGC for both menus and standard titles. Just
default the value to 1, since the option is irrelevant
unless -pgc is also set.

Note that this should not break users using this advanced option.
The "auto" mode errored and asked for a PG number regardless
for non-menus, and for menus the mode simply defaulted to 1.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit e1ace1d314)
2025-01-07 23:43:34 -06:00
Marth64
5d37c7cf08 avformat/dvdvideodec: measure duration of the current menu VOBU in state
This will be a pre-requisite to calculating chapter markers
for menus.

Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 39c662f541)
2025-01-07 23:43:34 -06:00
Marth64
aebce8b1b8 avformat/dvdvideodec: fix menu PGC number off-by-one in state
Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 94346edbbf)
2025-01-07 23:43:34 -06:00
Marth64
15684239ca avformat/dvdvideodec: remove unused headers
Signed-off-by: Marth64 <marth64@proxyid.net>
(cherry picked from commit 3ad96243d7)
2025-01-07 23:43:34 -06:00
Bin Peng
54331d4305 lavc/aarch64: Fix ff_pred16x16_plane_neon_10
Fix test failure on aarch64:
./tests/checkasm/checkasm --test=h264pred 367840

Signed-off-by: Peng Bin <pengbin@visionular.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 72a3656e84)
2025-01-07 22:39:20 +02:00
Bin Peng
89bc70ddd8 lavc/aarch64: Fix ff_pred8x8_plane_neon_10
Fix test failure on aarch64:
./tests/checkasm/checkasm --test=h264pred 479612

The mismatch between neon and C functions can also be reproduced using the following bitstream and command line.

wget https://streams.videolan.org/ffmpeg/incoming/intra8x8pred_10bit.264
 ./ffmpeg -cpuflags 0  -threads 1 -i intra8x8pred_10bit.264  -f framemd5 -y md5_ref
 ./ffmpeg              -threads 1 -i intra8x8pred_10bit.264  -f framemd5 -y md5_neon

Signed-off-by: Bin Peng <pengbin@visionular.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit decc9e643c)
2025-01-07 22:39:20 +02:00
Zhao Zhili
0151f1daab aarch64/vvc: Fix clip in alf
Fix test failure:
./tests/checkasm/checkasm --test=vvc_alf 3607569773

(cherry picked from commit 40feba5f77)
2025-01-04 23:09:40 +08:00
Janne Grunau
7d1532f752 vp9: recon: Use emulated edge to prevent buffer overflows
The arm/aarch64 horizontal filter reads one additional pixel beyond what
the filter uses. This can become an issue if the application does not
allocate larger buffers than what's required for the pixel data. If the
motion vector points to the bottom right edge of the picture this
becomes a read buffer overflow. This triggers segfaults in Firefox for
video resolutions which result in a page aligned picture size like
1280x640.
Prevent this by using emulated edge in this case.

Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1881185
Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 060464105b)
2025-01-04 07:31:18 -05:00
Janne Grunau
535a8262cc arm: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
This reduces the amount the horizontal filters read beyond the filter
width to a consistent 1 pixel. The data is not used so this is usually
not noticeable. It becomes a problem when the application allocates
frame buffers only for the aligned picture size and the end of it is at
a page boundary. This happens for picture sizes which are a multiple of
the page size like 1280x640. The frame buffer allocation is based on
its most likely done via mmap + MAP_ANONYMOUS so start and end of the
buffer are page aligned and the previous and next page are not
necessarily mapped.
This mirrors the aarch64 change.

Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit f366256215)
2025-01-04 07:31:18 -05:00
Janne Grunau
1a254c5354 aarch64: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
This reduces the amount the horizontal filters read beyond the filter
width to a consistent 1 pixel. The data is not used so this is usually
not noticeable. It becomes a problem when the application allocates
frame buffers only for the aligned picture size and the end of it is at
a page boundary. This happens for picture sizes which are a multiple of
the page size like 1280x640. The frame buffer allocation is based on
its most likely done via mmap + MAP_ANONYMOUS so start and end of the
buffer are page aligned and the previous and next page are not
necessarily mapped.
Under these conditions like seen by Firefox a read beyond the end of the
buffer results in a segfault.
After the over-read is reduced to a single pixel it's reasonable to use
VP9's emulated edge motion compensation for this.

Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1881185
Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 430c38f698)
2025-01-04 07:31:18 -05:00
Michael Niedermayer
615f29e301
avformat/rpl: Fix check for negative values
Fixes: signed integer overflow: 10 * -1923267925333400000 cannot be represented in type 'int64_t' (aka 'long')
Fixes: 378891963/clusterfuzz-testcase-minimized-fuzzer_loadfile_direct-5714338935013376
Found-by: ossfuzz
Reported-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit eab65379bf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:48 +01:00
Michael Niedermayer
cac9112bf3
avformat/mlvdec: Check avio_read()
Fixes: use-of-uninitialized-value
Fixes: 383170476/clusterfuzz-testcase-minimized-ffmpeg_dem_MLV_fuzzer-4696002884337664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit bb85423142)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:48 +01:00
Michael Niedermayer
a82139d0e6
avcodec/aac/aacdec: Free channel layout
Fixes: 371445194/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5981081124274176
Fixes: memleak

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ae81beb351)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:48 +01:00
Michael Niedermayer
a5ce143895
avformat/mov: dereference pointer after null check
Fixes: null pointer dereference
Fixes: 383397479/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4776829338058752

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 954d55c2a4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:47 +01:00
Michael Niedermayer
8ae93fdc42
avcodec/utils: Fix block align overflow for ADPCM_IMA_WAV
Fixes: signed integer overflow: 529008646 * 8 cannot be represented in type 'int'
Fixes: 383379145/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6674045107503104

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 9327093079)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:47 +01:00
Michael Niedermayer
1cb5caeb5b
avformat/matroskadec: Check pre_ns for overflow
Fixes: signed integer overflow: -3483479120376300096 - 7442323944145700864 cannot be represented in type 'long'
Fixes: 383187489/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-4561470580391936

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 361d24e6d9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:47 +01:00
Michael Niedermayer
5e17ff811a
tools/target_dec_fuzzer: Adjust threshold for EACMV
Fixes: Timeout
Fixes: 382988735/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EACMV_fuzzer-5278721465974784

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 8f4eb0fe03)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:46 +01:00
Michael Niedermayer
364eb21d2a
tools/target_dec_fuzzer: Adjust threshold for MVC1
Fixes: Timeout
Fixes: 378231213/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MVC1_fuzzer-6640960500465664

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 e7230bc503)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:46 +01:00
Michael Niedermayer
6350530806
tools/target_dec_fuzzer: Adjust Threshold for indeo5
Fixes: 379768251/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO5_fuzzer-5981329084186624
Fixes: Timeout

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 89efc6c97c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:45 +01:00
Michael Niedermayer
52461e7e8b
avutil/timecode: Avoid fps overflow in av_timecode_get_smpte_from_framenum()
Fix from c94875471e

Found-by: Youngjae Choi <youngjaechoi@korea.ac.kr>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 6ba33b50f5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:45 +01:00
Michael Niedermayer
b444880422
avcodec/aac/aacdec_usac: Dont leave type at a invalid value
Fixes: Assertion 0 failed at libavcodec/aac/aacdec_usac.c:1646
Fixes: 70541/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5190889543106560

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a518b5540d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:45 +01:00
Michael Niedermayer
828569c0d0
avcodec/aac/aacdec_usac: Clean ics2->max_sfb when first SCE fails
Fixes: out of array access
Fixes: 70734/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-4741427068731392
Fixes: 383194070/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5302387708854272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 682d710bcb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:44 +01:00
Michael Niedermayer
bc8248d07a
avcodec/webp: Check ref_x/y
Fixes: 70991/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WEBP_fuzzer-5544067620995072
Fixes: use of uninintailized value

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 7c1e732ad2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:44 +01:00
Michael Niedermayer
886dd058fe
avcodec/ilbcdec: Initialize tempbuff2
Fixes: Use of uninitialized value
Fixes: 71350/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ILBC_fuzzer-6322020827070464

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 4482218440)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:44 +01:00
Michael Niedermayer
028391aa58
swscale/swscale_unscaled: Fix odd height with nv24_to_yuv420p_chroma()
Fixes: out of array read
Fixes: 71726/clusterfuzz-testcase-ffmpeg_SWS_fuzzer-5876893532880896
Fixes: 377735917/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6686071112400896

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Approved-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d32dcc07a7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:43 +01:00
Michael Niedermayer
82d45cb004
avcodec/hevc/hevcdec: initialize qp_y_tab
This does not replicate on my setup, thus this is a blind fix based on ossfuzz trace

Fixes: use of uninitialized value
Fixes: 71747/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5427736120721408

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 4fc43e45f9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:43 +01:00
Michael Niedermayer
9285b93143
avformat/qcp: Check for read failure in header
Fixes: Use of uninitialized value
Fixes: 71551/clusterfuzz-testcase-minimized-ffmpeg_dem_QCP_fuzzer-4647386712965120

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 f52b9d0583)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:43 +01:00
Michael Niedermayer
048a545e31
avcodec/eatgq: Check bytestream2_get_buffer() for failure
Fixes: Use of uninitialized memory
Fixes: 71546/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATGQ_fuzzer-5607656650244096

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 4949e34d96)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:42 +01:00
Michael Niedermayer
851bc9927d
avformat/dxa: check bpc
Fixes: integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 373971762/clusterfuzz-testcase-minimized-ffmpeg_dem_DXA_fuzzer-4880491112103936

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 7e020f2141)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:42 +01:00
Michael Niedermayer
f9f4835731
swscale/slice: clear allocated memory in alloc_lines()
Fixes: use of uninitialized memory in hScale16To15_c()
Fixes: 373924007/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5841199968092160

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 aeec39f3c1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:42 +01:00
Michael Niedermayer
173a978b9d
avcodec/h2645_parse: Ignore NAL with nuh_layer_id == 63
Comply with "For purposes other than determining the amount of data in the decoding units
of the bitstream, decoders shall ignore all data that follow the value 63 for nuh_layer_id in a NAL unit"
Rec. ITU-T H.265 v8 (08/2021)	Page 67

Fixes: index 63 out of bounds for type 'const int8_t[63]' (aka 'const signed char[63]')
Fixes: clusterfuzz-testcase-fuzzer_loadfile-5109286752026624
Reported-by: Kacper Michajlow <kasper93@gmail.com>
Found-by: ossfuzz
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 360e7cafd0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:41 +01:00
Michael Niedermayer
3c8b588f3c
MAINTAINERS: Lauri is still available but is really low on time nowadays
CC: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e531b3ff27)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:41 +01:00
Michael Niedermayer
8ac2375b71
MAINTAINERS: Remove Guillaume Poirier and Romain Dolbeau
Guillaume no longer has a PPC
Romain has no time

CC: Guillaume POIRIER <poirierg@gmail.com>
CC: Romain Dolbeau <romain@dolbeau.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 224b62489d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:41 +01:00
Michael Niedermayer
49e4c1717f
avcodec/mjpegdec: Disallow progressive bayer images
Fixes: Null pointer dereference
Fixes: sample1.dng
Found-by: South East <8billion.people@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 6d8285633d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:40 +01:00
Michael Niedermayer
3417e955c3
avformat/icodec: fix integer overflow with nb_pal
Fixes: runtime error: signed integer overflow
Fixes: 42536949/clusterfuzz-testcase-minimized-fuzzer_loadfile-6199846684393472
Found-by: ossfuzz
Reported-by: Kacper Michajlow
Tested-by: Kacper Michajlow
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 84569b6c22)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:40 +01:00
Michael Niedermayer
d9687e6156
doc/developer: Document relationship between git accounts and MAINTAINERS
This should have been documented long ago and i thought it was

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7051825b01)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:40 +01:00
Michael Niedermayer
f9901306ba
doc/infra: Document trac backup system
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit edc4855f77)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:39 +01:00
Michael Niedermayer
4930dd91c6
doc/infra: Document gitolite
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 07904231cb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:39 +01:00
Michael Niedermayer
c7aa0c4ecd
avformat/vividas: Check avio_read() for failure
Fixes: use of uninitialized value (untested)
Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_loadfile_direct-5505802505355264

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 96d45c3b21)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:39 +01:00
Michael Niedermayer
445065e23a
avformat/ilbc: Check avio_read() for failure
Fixes: use of uninitialized value
Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_protocol_memory-6656646223298560-cut

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e30d957a9b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:38 +01:00
Michael Niedermayer
1f1b309f9e
avformat/nistspheredec: Clear buffer
Fixes: use-of-uninitialized-value
Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_protocol_memory-6515855798632448-cut

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 898f6582eb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:38 +01:00
Michael Niedermayer
e2394166bf
avformat/mccdec: Initialize and check rate.den
Fixes: Assertion c > 0 failed at libavutil/mathematics.c:61
Fixes: use-of-uninitialized-value
Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_protocol_memory-5939605805793280

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit bf8e43083f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:38 +01:00
Michael Niedermayer
241e87afa4
avformat/rpl: check channels
Fixes: 42537199/clusterfuzz-testcase-minimized-fuzzer_loadfile_direct-5447162658357248
Fixes: runtime error: signed integer overflow: -3330498059201358222 * 4 cannot be represented in type 'int64_t' (aka 'long')

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit beca13a42e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:37 +01:00
Michael Niedermayer
ded98a0919
INSTALL: explain the circular dependency issue and solution
Sponsored-by: Sovereign Tech Fund
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit df00705e00)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:37 +01:00
Michael Niedermayer
0288fedf18
avformat/mpegts: Initialize predefined_SLConfigDescriptor_seen
Fixes: use of uninitialized variable
Fixes: 368729566/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTS_fuzzer-6044501804646400

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 db7b4fc89f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:37 +01:00
Michael Niedermayer
6b02047811
avformat/mxfdec: Fix overflow in midpoint computation
Fixes: signed integer overflow: 4611686016549392399 + 9223372033098784800 cannot be represented in type 'long long'
Fixes: 368503277/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5928227458056192

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 23088a5ff2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:36 +01:00
Michael Niedermayer
562af93025
swscale/output: used unsigned for bit accumulation
Fixes: Integer overflow
Fixes: 368725672/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5009093023563776

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 3fe3014405)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:36 +01:00
Michael Niedermayer
2ab2803944
swscale/rgb2rgb_template: Fix ff_rgb24toyv12_c() with odd height
Fixes: out of array access
Fixes: 368143798/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6475823425585152

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 14f5d67be3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:36 +01:00
Michael Niedermayer
a2666675bf
avcodec/rangecoder: only perform renorm check/loop for callers that need it
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d147b3d7ec)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:35 +01:00
Michael Niedermayer
9f8bd56e4f
avcodec/ffv1: add a named constant for the quant table size
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 81a360a5ed)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:35 +01:00
Michael Niedermayer
7043ef6828
avcodec/ffv1: RCT is only possible with RGB
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2542e9296c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:35 +01:00
Michael Niedermayer
4ca3f5102f
avcodec/ffv1enc: Fix RCT with RGB64
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c1edec3a24)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:34 +01:00
Michael Niedermayer
26fc4bf42c
avcodec/ffv1dec: Fix end computation with ec=2
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 10e5af15bf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:34 +01:00
Michael Niedermayer
2a39eeb8de
avcodec/ffv1enc: Move slice termination into threads
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8e52b15258)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:33 +01:00
Michael Niedermayer
d870febf88
avcodec/ffv1enc: Prevent generation of files with broken slices
Fixes: Ticket5548

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b7ff66a358)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:33 +01:00
Michael Niedermayer
631976108c
avformat/matroskadec: Check desc_bytes so bits fit in 64bit
Likely a tighter check can be done

Fixes: signed integer overflow: 3305606804154370442 * 8 cannot be represented in type 'long'
Fixes: 70449/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-4771166007918592

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 c4122406f6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:33 +01:00
Michael Niedermayer
ba89c5d1eb
avformat/mov: Avoid overflow in dts
This basically ignores the overflow without undefined behavior, alternatively we could detect and error out

Fixes: signed integer overflow: 6310596683470275584 + 7660622966157213696 cannot be represented in type 'long'
Fixes: 70433/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5483347233538048
Fixes: 369662284/clusterfuzz-testcase-minimized-media_metadata_parser_fuzzer-5327368763670528

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 057b8c2066)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:32 +01:00
Michael Niedermayer
3f76a33317
avcodec/ffv1enc: Correct error message about unsupported version
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 556c767786)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:32 +01:00
Michael Niedermayer
76ddc3f1e1
avcodec/ffv1: Store and reuse sx/sy
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7151081e33)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:32 +01:00
Michael Niedermayer
811fce437e
avcodec/ffv1enc: Slice combination is unsupported
We always write minimal slices, the size calculation is wrong in some
corner cases but as its always 1x1 (minus1) we can for now just hard-code it

This helps with ticket 5548

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7d514655bf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:31 +01:00
Michael Niedermayer
e4538bc888
avcodec/ffv1enc: 2Pass mode is not possible with golomb coding
"Fixes" Ticket7063

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 417b163c00)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-03 18:28:19 +01:00
James Almer
145a3a8455 avfilter/buffersrc: check for valid sample rate
A sample rate <= 0 is invalid.

Fixes an assert in ffmpeg_enc.c that assumed a valid sample rate would be set.
Fixes ticket #11385.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 1446e37d3d)
2025-01-02 15:55:37 -03:00
James Almer
be26ee23ab avcodec/libdav1d: clear the buffered Dav1dData on decoding failure
Should ensure avcodec_send_packet() doesn't return EAGAIN in scenarios where it's not
meant to (e.g., ffmpeg_dec.c where avcodec_receive_frame() is called in a loop to drain
all produced frames before trying to submit more packets).

Fixes ticket #11377.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d1d9b0813a)
2025-01-02 15:54:22 -03:00
James Almer
4f5769e052 avformat/iamf_writer: ensure the stream groups are not empty
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit cedd9151f8)
2025-01-02 15:54:09 -03:00
James Almer
b168ed9b14 avformat/iamf_writer: fix setting num_samples_per_frame for OPUS
As per section 3.11.1 of the IAMF spec, the sample rate used in Codec Config
for Opus shall be 48kHz, regardless of the original sample rate used during
encoding.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 76049d1c45)
2024-12-19 22:12:15 -03:00
James Almer
871c69a28b avformat/iamf_parse: fix setting duration for the last subblock in a parameter definition
When subblock durations are constant, the last block may be smaller and the
value needs to be calculated.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit fb5e8ea971)
2024-12-19 22:12:15 -03:00
James Almer
888a6b54bc avformat/iamf_parse: add checks to parameter definition durations
Section 3.6.1 of the IAMF spec states "When constant_subblock_duration is equal to 0, the summation of all
subblock_duration in this parameter block SHALL be equal to duration.".

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d38fc25519)
2024-12-19 22:12:15 -03:00
Michael Niedermayer
88126fc4ec avformat/iamf_parse: reject ambisonics mode > 1
ambisonics mode > 1 does not initialize any layer but layer 0
is unconditionally dereferenced

Fixes: poc-2024-11
Fixes: null pointer dereference
Found-by: 苏童 <220235212@seu.edu.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4cc1495aca)
2024-12-19 22:12:15 -03:00
Martin Storsjö
10aaf84f85 checkasm: Print benchmarks of C-only functions
This corresponds to commit 9278a14cf406f8edb5052c42b83750112bf5b515
in dav1d.

Omitting the C-only functions doesn't speed up benchmarking
anyway (as those has to be benchmarked before we know if we have
any corresponding assembly functions), and being able to benchmark
those functions without corresponding assembly can be valuable in
a number of cases.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 4b524649ff)
2024-12-11 12:05:23 +02:00
James Almer
364f6a5f11 avcodec/ac3dec: fix downmix logic for eac3
Ensure downmixed is only set once during init, as it used to be.

Fixes a regression since acbb2777e2.
Fixes ticket #11321

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 0e07a70611)
2024-12-01 12:53:33 -03:00
James Almer
f265f9c9d0 avcodec/codec_desc: remove Intra Only prop for AAC
xHE-AAC is a profile where some frames depend on other key frames, named IPF.
By setting the codec as Intra Only, all frames output by decoders and all
packets output by encoders/demuxers will be unconditionally flaged as
keyframes, which is incorrect.

Should fix ticket #11272.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 40bd6d8355)
2024-12-01 12:53:33 -03:00
James Almer
4b801baa46 avcodec/mediacodecdec: set set keyframe flag in output frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 8d2d2519e0)
2024-12-01 12:53:33 -03:00
James Almer
26bc7827e4 avcodec/libfdk-aacenc: set keyframe in output packets
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 99f87251e0)
2024-12-01 12:53:33 -03:00
James Almer
c13a0a2f59 avcodec/libfdk-aacdec: set keyframe flag and profile in output frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 281b7fc02e)
2024-12-01 12:53:33 -03:00
James Almer
f7d59ab17a avcodec/audiotoolboxnec: set set keyframe flag in output packets
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 495c891e39)
2024-12-01 12:53:33 -03:00
James Almer
07a92c1a64 avcodec/audiotoolboxdec: set set keyframe flag in output frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d3dd14bf5b)
2024-12-01 12:53:33 -03:00
James Almer
302f1b3882 avcodec/aacenc: set keyframe flag in output packets
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit ffdace5ad4)
2024-12-01 12:53:33 -03:00
James Almer
1b5bdce86a avcodec/aac/aacdec: set keyframe flag in output frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit faea08b722)
2024-12-01 12:53:33 -03:00
James Almer
075c6d325a avcodec/aac_parser: set key_frame and profile
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 64bb91fd3b)
2024-12-01 12:53:33 -03:00
James Almer
dc9d9b8636 avformat/mov: don't unconditionally set all audio packets in fragments as key frames
Some audio codecs, like TrueHD, have non key frames.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 8ddbc26ded)
2024-12-01 12:53:33 -03:00
James Almer
f1592a7ff1 avformat/matroskadec: set all frames in a keyframe simple box as keyframes
And not just the first, as it was being done for lacing. The spec states that the
flag applies to everything inside the simple box.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit f656c00bd9)
2024-12-01 12:53:33 -03:00
James Almer
13282e61b8 avformat/test/movenc: set audio packets as key frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit f938b2b3f5)
2024-12-01 12:53:33 -03:00
James Almer
33588a3749 avformat/movenc: write stss boxes for xHE-AAC
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 23a1c021f2)
2024-12-01 12:53:33 -03:00
James Almer
e07d7c75db avformat/spdifdec: parse headers for audio codecs
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 4e6d31755b)
2024-12-01 12:53:33 -03:00
James Almer
8fa5fa1463 avformat/movenc: don't disable edit lists when writing CMAF output
They are needed for audio tracks with priming samples, where negative CTS
offsets can't be used.

Fixes ticket #11031.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit ecc7d5db9c)
2024-12-01 12:53:33 -03:00
James Almer
cb997ccd09 avcodec/libfdk-aacenc: export CPB properties
Needed to signal the muxer that the stream is VBR.

Finishes fixing ticket #11303.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 46c6ca3ed1)
2024-12-01 12:47:30 -03:00
James Almer
3513ccccb6 avformat/movenc: don't write a calculated avgBitrate when the provided one is unset
avgBitrate == 0 is used to signal a VBR track, so if that value is propagated by an
encoder, don't overwrite it with a calculated value based on track size.

Part of a fix for ticket #11303.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 944212acad)
2024-12-01 12:47:30 -03:00
Brad Smith
64e2864cb9 libavutil/riscv: Make use of elf_aux_info() on FreeBSD / OpenBSD riscv
libavutil/riscv: Make use of elf_aux_info() on FreeBSD / OpenBSD riscv

FreeBSD/OpenBSD riscv have elf_aux_info().

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
(cherry picked from commit f3eca3f387)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-11-27 01:34:28 -05:00
Sean McGovern
0c641ee661 libavutil/ppc: defines involving bit shifts should be unsigned
Otherwise, these can overflow at the boundaries of the integer type.

Signed-off-by: Brad Smith <brad@comstyle.com>
(cherry picked from commit c325f9c619)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-11-27 01:32:46 -05:00
Brad Smith
ac4c725944 libavutil/ppc: Include the hardware feature flags like the other archs
Also include the hardware feature flags like the other archs do and
clean up the code a bit.

Tested on Linux POWER9.

Signed-off-by: Brad Smith <brad@comstyle.com>
(cherry picked from commit d6b2d08fc7)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-11-27 01:32:23 -05:00
Rémi Denis-Courmont
20c8a3f5ff lavu/riscv: fix compilation without Vector support
The half-baked assembler in Clang 16 and earlier can't process our
RISC-V assembler. This adds yet another work around that.

If you must use Clang, please use version 17 or later.

(cherry picked from commit e29432e6bb)
2024-11-18 20:05:47 +02:00
Marton Balint
b016aae662 avfilter/f_loop: fix aloop activate logic
The logic did not follow the documented behaviour and that caused skipping of
some audio in the loop and in the leftover buffer.

Example command line which should produce a smooth sine wave for the whole
duration of the output:

ffmpeg -f lavfi -i "sine=r=48000:f=480:d=4" -af "aloop=loop=4:start=48000:size=48000" out.wav

Fixes ticket #11283.

Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit fe18ed3f2a)
2024-11-17 22:17:42 +01:00
Marton Balint
0a58588ffb avfilter/f_loop: fix length of aloop leftover buffer
If the audio loop stops inside an audio frame, the leftover buffer contains the
end of the frame, which is not looped. The length supposed to be the part which
was not written to the loop buffer, so we need to drain exactly that number of
bytes from the leftover buffer.

Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit b33a594160)
2024-11-17 22:17:31 +01:00
James Almer
99f6adce60 avfilter/vf_zscale: align the frame buffers
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit c8e5c684b3)
2024-11-17 12:19:02 -03:00
Pavel Koshevoy
5b461ffb04 lavfi/vf_zscale: fix call to av_pix_fmt_count_planes
realign_frame called av_pix_fmt_count_planes with incorrect parameter.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 00cf3df03f)
2024-11-17 12:19:02 -03:00
Pavel Koshevoy
85f389520d lavfi/vf_zscale: fix tmp buffer ptr alignment for zimg_filter_graph_process
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 7b302f4db7)
2024-11-17 12:19:02 -03:00
James Almer
fa15e3839d avfilter/framepool: align the frame buffers
And not just the linesizes. Use the extra align bytes allocated for this purpose.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit f15fc27db5)
2024-11-17 12:19:02 -03:00
James Almer
b9abdd9eaa avcodec/h2645_sei: use the RefStruct API for film_grain_characteristics
And ensure the buffer is synced between threads.
Based on a patch by Dale Curtis <dalecurtis@chromium.org>

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit e33b162c7d)
2024-11-17 12:16:30 -03:00
James Almer
5f8b02a9ff avcodec/aom_film_grain: allocate film grain metadata dynamically
This removes the ABI breaking use of sizeof(AVFilmGrainParams), and achieves the
same size reduction to decoder structs as 08b1bffa49.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit fd4a2c9b02)
2024-11-17 12:16:13 -03:00
James Almer
f8fcebae95 avformat/mov: use an array of pointers for heif_item
Pointers to specific entries in the array are stored in other structs, so
in the scenario where heif_item was reallocated when parsing an iloc box after
and iinf one, the pointers may end up referencing freed memory.

Fixes use-after-free with such samples.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-17 12:14:17 -03:00
James Almer
23697c3f02 avformat/mov: split off heif item initialization to its own function
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d5eb0e7fb3)
2024-11-17 12:14:17 -03:00
James Almer
779b0fe015 avformat/mov: factorize getting the current item
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 58c265d956)
2024-11-17 12:14:17 -03:00
Rémi Denis-Courmont
f686cf77db lavc/h264idct: fix RISC-V group multiplier
After the branch, the expected SEW/LMUL ratio is 1 byte/vector.
So we have to set the same ratio before branching (QEMU does not care,
but real hardware does).

(cherry picked from commit bbb0fdedb7)
2024-11-17 16:37:01 +02:00
Rémi Denis-Courmont
4ea558152f lavc/h264dsp: move RISC-V fn pointers to .data.rel.ro
This should fix PIC builds.
2024-11-16 20:44:43 +02:00
Leo Izen
11e8319b8e
avcodec/jpegxl_parser: fix reading lz77-pair as initial entropy symbol
The JPEG XL parser has an entropy decoder inside, which supports LZ77
length-distance pairs. If the first symbol from the entropy stream is an
LZ77 pair, the bitstream is invalid, so we should abort immediately rather
than attempt to read it anyway (which would read from the uninitialized
starting window).

Reported-by: Kacper Michajłow <kasper93@gmail.com>
Found-by: ossfuzz
Fixes: 368725676/clusterfuzz-testcase-minimized-fuzzer_protocol_file-6022251122589696-cut
Fixes: 42537758/clusterfuzz-testcase-minimized-fuzzer_protocol_file-5818969469026304-cut
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-11-13 10:28:59 -05:00
Kacper Michajłow
03ffd4b3b3
avcodec/jpegxl_parser: check entropy_decoder_read_symbol return value
Found by OSS-Fuzz.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2024-11-13 10:28:50 -05:00
Nuo Mi
1b1ba7d4f2 avcodec/cbs_h266: Fix regression in DVB clip introduced by 93281630a7
This commit introduced a regression to VVC_HDR_UHDTV1_OpenGOP_3840x2160_50fps_HLG10_mosaic.ts.

Root Cause:
The AV_CEIL_RSHIFT(a, b) macro uses bit tricks that work only when -a is a negative value.
However, due to integer promotion rules, this behavior does not extend to the unsigned int type.

See "6.3.1.1 Boolean, characters, and integers" in the "ISO/IEC 9899" for details.

Reported-by: Frank Plowman <post@frankplowman.com>
(cherry picked from commit c49001e338)
2024-11-11 12:05:30 -03:00
James Almer
baef55364f avcodec/x86/vvc: add prototypes for OF functions
And wrap the implemtation in preprocessor checks.
Should fix ticket #11282.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 9ec042c1aa)
2024-11-11 09:52:31 -03:00
Anton Khirnov
5120d30890 Document stream specifier syntax change from 46cbe4ab5c
Fixes #11248.

(cherry picked from commit 9e68b26765)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-11-09 02:52:57 +01:00
Leandro Santiago
367b7b546f fftools/ffplay: fix crash when vk renderer is null
When vulkan rendering is requested by the user and fails, ffplay should
exit graciously instead of crash due to a null pointer deref.

Signed-off-by: Leandro Santiago <leandrosansilva@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit fd0cacc472)
2024-11-06 16:50:56 +08:00
Marton Balint
15035aaec0 avutil/wchar_filename: re-introduce explicit cast of void* to char*
Fixes compile error on windows with decklink:

In file included from ./libavformat/os_support.h:175,
                 from ./libavformat/internal.h:30,
                 from libavdevice/decklink_common.cpp:25:
./libavutil/wchar_filename.h: In function 'int wchartocp(unsigned int, const wchar_t*, char**)':
./libavutil/wchar_filename.h:59:32: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   59 |     *filename = av_malloc_array(num_chars, sizeof **filename);
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                |
      |                                void*

Regression since e9e8bea2e7.

Fixes ticket #11103.

Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 9b0128aa76)
2024-10-27 09:58:17 +01:00
Emily
9fbbd924f2 fate/ffmpeg: add samples dependency to fate-ffmpeg-spec-disposition
This test utilizes an MPEG-TS sample from FATE suite, yet was
marked as not requiring samples.

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
(cherry picked from commit 3565903c63)
2024-10-21 21:23:49 +03:00
Anton Khirnov
87ccf995cb fftools/ffmpeg_filter: treat apad filter as a source
Ideally lavfi should have a dedicated API for detecting this.

Fixes #11168 and #11061

(cherry picked from commit 9e2a231236)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-10-15 10:54:25 +02:00
Anton Khirnov
020d9f2b48 lavc/avcodec: fix global/private option precendence
Broken after 7753a9d627. Apply only the
whitelist early, and the rest with a single call to av_opt_set_dict2()
with AV_OPT_SEARCH_CHILDREN, which should be equivalent to the original
behaviour.

Reported-by: Cameron Gutman <aicommander@gmail.com>
(cherry picked from commit 9ce63e65d6)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-10-15 10:53:50 +02:00
Nicolas Gaullier
32d3e67717 avfilter/framesync: fix forward EOF pts
Note1: when the EOF pts is not accurate enough, the last frame
can be dropped by vf_fps with default rounding.

Note2: vf_scale use framesync since e82a3997cd,
so this is a very commonplace scenario.

For example:
./ffprobe -f lavfi testsrc=d=1,scale,fps -of flat \
  -count_frames -show_entries stream=nb_read_frames

Before:
streams.stream.0.nb_read_frames="24"

After:
streams.stream.0.nb_read_frames="25"

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit de976eaf30)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-10-15 10:50:23 +02:00
Ingo Brückl
5c59d97e8a avcodec/vaapi_encode: fix compilation without CONFIG_VAAPI_1
This adds VAAPIEncodeContext *ctx that has been removed
in aa82340b0c.

Signed-off-by: Ingo Brückl <ib@oddnet.de>
(cherry picked from commit 5557c673ea)
2024-10-12 09:13:33 +08:00
Martin Storsjö
0b5559378b libavcodec: x86: Remove an explicit include of config.asm
This file is never included explicitly anywhere else, it's only
included implicitly by passing -Pconfig.asm on the command line.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 5c4ede6b4f)
2024-10-11 14:40:30 +03:00
Martin Storsjö
c0d19c640a checkasm: lls: Use relative tolerances rather than absolute ones
Depending on the magnitude of the output values, the potential
errors can be larger.

This fixes errors in the lls tests on x86_32 for some seeds,
observed with GCC 11 (on Ubuntu 22.04, with the distro compiler,
with -m32).

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 6668268e16)
2024-10-10 23:56:10 +03:00
Martin Storsjö
794245fa71 arm: Consistently use proper interworking function returns
Use "bx lr", or "pop {lr}", which do proper mode switching
between thumb and arm modes. A plain "mov pc, lr" does not switch
from thumb mode to arm mode (while in arm mode, it does switch
mode for a thumb caller).

This is normally not an issue, as CONFIG_THUMB only is enabled if
the C compiler defaults to thumb; but stick to patterns that can
do mode switching if needed, for consistency.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 77e6293735)
2024-10-10 23:56:10 +03:00
Gyan Doshi
63f5c007a7 avcodec/libx265: unbreak build for X265_BUILD >= 213
Earlier, x265 made an API change to support alpha and
other multiple layer pictures. We added guards to accommodate
that in 1f801dfdb5

They have now reverted that API change in
78e5b703b1

Updated our wrapper guards to unbreak build again.
2024-10-05 20:18:14 +05:30
Marvin Scholz
9b061291ad fftools: log unconnected filter output label
(cherry picked from commit f25c9cc213)
2024-10-04 11:34:59 -03:00
Marvin Scholz
e14a3a4b11 fftools: do not access out of bounds filtergraph
The log message was logged for `filtergraphs[j]` which would cause a
heap buffer overflow in certain circumstances.

Correctly it should be logged for the current filtergraph, so just
use `fg` here.

(cherry picked from commit 5beeb3a1f9)
2024-10-04 11:34:59 -03:00
Zhao Zhili
4c0ef3bfae avcodec/mediacodecenc: Fix access of uninitialized value
When crop is skipped, av_strlcatf will access `str` which isn't
initialized properly.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit eff9ed7bff)
2024-10-04 15:45:43 +08:00
Zhao Zhili
8be6e56a53 avformat/img2enc: Fix integer truncation when frame_pts is enabled
Fix #11194

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit f56a54387b)
2024-10-03 23:25:43 +08:00
Zhao Zhili
ff93c1898d avformat/internal: Add ff_get_frame_filename
It's similar to av_get_frame_filename2 but with int64_t number
support. Make av_get_frame_filename* a wrapper over
ff_get_frame_filename.

Co-authored-by: Filip Mašić <shoutplenty@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit a2d9663241)
2024-10-03 22:47:51 +08:00
James Almer
12682eba2e avformat/mov: don't return the latest stream when an item stream is expected
Otherwise, things like ICC profiles as read from the colr box meant for an item
with no stream (like a grid) may end up being added to the wrong stream.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 04182b5549)
2024-09-30 17:28:44 -03:00
Michael Niedermayer
b08d7969c5
RELEASE_NOTES: Based on the version from 5.1
Name suggested by 3 people on ML

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-09-29 18:47:04 +02:00
Michael Niedermayer
69cf68f5a0
Update for 7.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-09-29 18:47:04 +02:00
Michael Niedermayer
0bad953cc5
avcodec/ffv1enc: Fix >8bit context size
Fixes: Ticket5405

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a9c83e43f2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-09-29 18:47:03 +02:00
Martin Storsjö
09e9d61d0a checkasm/sw_rgb: Revert test additions from e18b46d95f
The unaligned width test cases fail on i386; we have an assembly
function of rgb24toyv12 which is enabled only within
"#if ARCH_X86_32 && HAVE_7REGS", which seems to fail these new
test cases for unaligned widths.

As that assembly function has existed for a long time in that form,
the issue probably isn't very recent, thus skip testing these cases
for now.

Once the assembly function has been fixed, these test cases can
be readded.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 157ce21939)
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-29 14:23:06 +03:00
Marvin Scholz
ebd0ca9fee avdevice/decklink_dec: fix leaks on error
In case of errors in this function, the allocated context
was not properly freed in several cases.

Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 8e76c99301)
2024-09-29 10:30:49 +02:00
Marvin Scholz
963145483c avdevice/decklink_dec: fix leak on error
In the early return when both draw_bars and signal_loss_action
options are used, the context allocated previously was not
properly freed.

Introduced in 9bcb86b0fa

Fixes CID1619296

Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 7554346cb5)
2024-09-29 10:30:32 +02:00
Brad Smith
05ff3eb9f2 ppc: Recognize the PPC VSX and Power8 CPU flags
Signed-off-by: Brad Smith <brad@comstyle.com>
(cherry picked from commit 6ec6b07900)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-30 09:08:11 -04:00
Anton Khirnov
d5c308fcc5 lavu/opt: avoid accidentally propagating spurious errors
An error from read_number() is non-fatal here and should not be
forwarded.

(cherry picked from commit 505fea34e5)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-09-28 17:14:14 +02:00
Anton Khirnov
55d0c353fe lavu/opt: add missing 'else'
(cherry picked from commit 9b764e9b49)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-09-28 17:14:11 +02:00
Lynne
9ada04faa3
vulkan_encode_h265: fix rate control VBV values
The values written were placeholder values.

(cherry picked from commit 81c6e6c9ee)
2024-09-27 09:58:13 +02:00
Lynne
0482410818
vulkan_encode_h264: fix rate control VBV values
The values must be in milliseconds, not bytes.

(cherry picked from commit 934be0ff50)
2024-09-27 09:58:13 +02:00
James Almer
c21472ec31 avutil/iamf: fix doxygen
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d55ab2ba9b)
2024-09-26 16:43:30 -03:00
James Almer
cb23275623 tests/fate/mov: fix rules for some tests
This was broken in 2fb2cd5c79 and
74553f0026, making a simple make fate-mov fail
and most of the test not run with a simple make fate.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 8b4e32f30b)
2024-09-24 21:10:40 -03:00
James Almer
f7643454aa avfilter/vf_showinfo: add missing break to ViewID case
Missed in 6940a6de2f.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit fd6cc18d60)
2024-09-24 16:09:05 -03:00
James Almer
2db706374e avcodec/hevc/sei: num_ref_displays can be up to 32
Signed-off-by: James Almer <jamrial@gmail.com>
2024-09-24 15:13:19 -03:00
James Almer
a6a346e154 avcodec/cbs_h265: num_ref_displays can be up to 32
Signed-off-by: James Almer <jamrial@gmail.com>
2024-09-24 15:13:18 -03:00
James Almer
00ce36d037 avcodec/cbs_h265: fix valid range for {left,right}_view_id
view_id_len in VPS is 4 bits, so view_id values can be up to 15 bits long.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-09-24 15:13:18 -03:00
Anton Khirnov
f459c56b0f tests/fate/hevc: use bitexact scaling flags for fate-hevc-mv-switch
Makes the results consistent across platforms.

(cherry picked from commit 9dc0edd454)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-09-24 18:43:33 +02:00
195 changed files with 3387 additions and 2398 deletions

226
Changelog
View file

@ -1,6 +1,223 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version 7.1.1:
avformat/hls: Partially revert "reduce default max reload to 3"
avformat/mov: (v4) fix get_eia608_packet
avformat/iff: Check that we have a stream in read_dst_frame()
avcodec/aac/aacdec_lpd: Limit get_unary()
avcodec/aac/aacdec_usac: Simplify decode_usac_scale_factors()
avcodec/aac/aacdec: Clear SFO on error
avformat/mlvdec: fix size checks
avformat/wavdec: Fix overflow of intermediate in block_align check
avformat/mxfdec: Check edit unit for overflow in mxf_set_current_edit_unit()
avformat/hls: Fix twitter
avcodec/vvc/refs: fix negative pps_scaling_win offsets
libavformat/hls: Be more restrictive on mpegts extensions
avformat/hls: .ts is always ok even if its a mov/mp4
avcodec/h263dec: Check against previous dimensions instead of coded
avformat/hls: Print input format in error message
avformat/hls: Be more picky on extensions
avformat/iamf_parse: ensure there's at most one of each parameter types in audio elements
avformat/iamf_parse: add missing constrains for num_parameters in audio_element_oub()
avformat/iamf_parse: add missing av_free() call on failure path
lavc/hevcdec: unbreak WPP/progress2 code
fate: Add a dependency on ffprobe for fate-flcl1905
checkasm: aacencdsp: Actually test nonzero values in quant_bands
x86: aacencdsp: Fix negating signed values in aac_quantize_bands
rtmpproto: Avoid rare crashes in the fail: codepath in rtmp_open
configure: Improve the check for the rsync --contimeout option
avutil/downmix_info: add missing semicolon
doc/t2h: Support texinfo 7.1 and 7.2 pretest
avfilter/drawtext: fix memory leak when using "reinit" runtime command
avutil/downmix_info: zero the allocated buffer
avformat/mov: fix overflow in drift timestamp calculation
Changelog: update
avformat/mxfdec: Check avio_read() success in mxf_decrypt_triplet()
avcodec/huffyuvdec: Initialize whole output for decode_gray_bitstream()
avformat/iamf_reader: Initialize padding and check read in ff_iamf_read_packet()
avformat/ipmovie: Check signature_buffer read
avformat/wtvdec: Initialize buf
avcodec/cbs_vp9: Initialize VP9RawSuperframeIndex
avformat/vqf: Propagate errors from add_metadata()
avformat/vqf: Check avio_read() in add_metadata()
avcodec/ffv1enc: Fix RCT for GBR colorspace
avformat/dashdec: Check whitelist
avutil/avstring: dont mess with NULL pointers in av_match_list()
avfilter/vf_v360: Fix NULL pointer use
avcodec/mpegvideo_enc: Check FLV1 resolution limits
avcodec/ffv1enc: Fix handling of 32bit unsigned symbols
avformat/mov: perform sanity checks for heif before index building
avformat/mov: Factorize sanity check out
avcodec/vc1dec: Clear block_index in vc1_decode_reset()
avcodec/aacsbr_template: Clear n_q on error
avformat/iamf_parse: Check output_channel_count
avcodec/osq: Fixes several undefined overflows in do_decode()
swscale/output: Fix undefined overflow in yuv2rgba64_full_X_c_template()
avfilter/af_pan: Fix sscanf() use
avfilter/vf_grayworld: Use the correct pointer for av_log()
avfilter/vf_addroi: Add missing NULL termination to addroi_var_names[]()
avcodec/get_buffer: Use av_buffer_mallocz() for audio same as its done for video
avformat/jpegxl_anim_dec: clear buffer padding
avformat/rmdec: check that buf if completely filled
avcodec/cfhdenc: Clear dwt_tmp
avcodec/hapdec: Clear tex buffer
avformat/mxfdec: Check that key was read sucessfull
avformat/hevc: fix writing hvcC when no arrays are provided in hvcC-formatted input
avformat/rtpdec: int overflow in start_time_realtime
avcodec/decode: Fix incorrect enum type used in side_data_map()
avformat/mov: fix crash when trying to get a fragment time for a non-existing fragment
avformat/libssh: fix credential variables typo
avformat/hlsenc: check return value of avcodec_parameters_copy()
avformat/dashdec: format open_demux_for_component()
avformat/dashdec: check return code of avcodec_parameters_copy()
avformat/dashdec: return ret directly in open_demux_for_component()
avformat/smoothstreamingenc: check return value of avcodec_parameters_copy()
avcodec/cbs_av1: fix variable shadowing in cbs_av1_split_fragment()
doc/demuxers/dvdvideo: seeking is supported, remove outdated statement
avformat/dvdvideodec: check return code of ff_dvdclut_yuv_to_rgb()
avformat/dvdvideodec: fix missing last chapter marker due to off-by-one
avformat/dvdvideodec: don't allow seeking beyond dvdnav reported duration
avformat/dvdvideodec: discard duplicate or partial AC3 samples
avformat/dvdvideodec: drop packets with unset PTS or DTS
avformat/dvdvideodec: remove unnecessary need_parsing argument
avformat/dvdvideodec: open subdemuxer after initializing IFO headers
avformat/dvdvideodec: remove auto value for menu_lu option
avformat/dvdvideodec: default menu_vts option to 1 and clarify description
avformat/dvdvideodec: check the length of a NAV packet when reading titles
avformat/dvdvideodec: reset the subdemuxer on discontinuity instead of flushing
avformat/dvdvideodec: simplify dvdvideo_read_packet()
avformat/dvdvideodec: enable chapter calculation for menus
avformat/dvdvideodec: standardize the NAV packet event signal
avformat/dvdvideodec: move memcpy below missed NAV packet warning
avformat/dvdvideodec: remove "auto" value for -pg option, default to 1
avformat/dvdvideodec: measure duration of the current menu VOBU in state
avformat/dvdvideodec: fix menu PGC number off-by-one in state
avformat/dvdvideodec: remove unused headers
lavc/aarch64: Fix ff_pred16x16_plane_neon_10
lavc/aarch64: Fix ff_pred8x8_plane_neon_10
aarch64/vvc: Fix clip in alf
vp9: recon: Use emulated edge to prevent buffer overflows
arm: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
aarch64: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
avformat/rpl: Fix check for negative values
avformat/mlvdec: Check avio_read()
avcodec/aac/aacdec: Free channel layout
avformat/mov: dereference pointer after null check
avcodec/utils: Fix block align overflow for ADPCM_IMA_WAV
avformat/matroskadec: Check pre_ns for overflow
tools/target_dec_fuzzer: Adjust threshold for EACMV
tools/target_dec_fuzzer: Adjust threshold for MVC1
tools/target_dec_fuzzer: Adjust Threshold for indeo5
avutil/timecode: Avoid fps overflow in av_timecode_get_smpte_from_framenum()
avcodec/aac/aacdec_usac: Dont leave type at a invalid value
avcodec/aac/aacdec_usac: Clean ics2->max_sfb when first SCE fails
avcodec/webp: Check ref_x/y
avcodec/ilbcdec: Initialize tempbuff2
swscale/swscale_unscaled: Fix odd height with nv24_to_yuv420p_chroma()
avcodec/hevc/hevcdec: initialize qp_y_tab
avformat/qcp: Check for read failure in header
avcodec/eatgq: Check bytestream2_get_buffer() for failure
avformat/dxa: check bpc
swscale/slice: clear allocated memory in alloc_lines()
avcodec/h2645_parse: Ignore NAL with nuh_layer_id == 63
MAINTAINERS: Lauri is still available but is really low on time nowadays
MAINTAINERS: Remove Guillaume Poirier and Romain Dolbeau
avcodec/mjpegdec: Disallow progressive bayer images
avformat/icodec: fix integer overflow with nb_pal
doc/developer: Document relationship between git accounts and MAINTAINERS
doc/infra: Document trac backup system
doc/infra: Document gitolite
avformat/vividas: Check avio_read() for failure
avformat/ilbc: Check avio_read() for failure
avformat/nistspheredec: Clear buffer
avformat/mccdec: Initialize and check rate.den
avformat/rpl: check channels
INSTALL: explain the circular dependency issue and solution
avformat/mpegts: Initialize predefined_SLConfigDescriptor_seen
avformat/mxfdec: Fix overflow in midpoint computation
swscale/output: used unsigned for bit accumulation
swscale/rgb2rgb_template: Fix ff_rgb24toyv12_c() with odd height
avcodec/rangecoder: only perform renorm check/loop for callers that need it
avcodec/ffv1: add a named constant for the quant table size
avcodec/ffv1: RCT is only possible with RGB
avcodec/ffv1enc: Fix RCT with RGB64
avcodec/ffv1dec: Fix end computation with ec=2
avcodec/ffv1enc: Move slice termination into threads
avcodec/ffv1enc: Prevent generation of files with broken slices
avformat/matroskadec: Check desc_bytes so bits fit in 64bit
avformat/mov: Avoid overflow in dts
avcodec/ffv1enc: Correct error message about unsupported version
avcodec/ffv1: Store and reuse sx/sy
avcodec/ffv1enc: Slice combination is unsupported
avcodec/ffv1enc: 2Pass mode is not possible with golomb coding
avfilter/buffersrc: check for valid sample rate
avcodec/libdav1d: clear the buffered Dav1dData on decoding failure
avformat/iamf_writer: ensure the stream groups are not empty
avformat/iamf_writer: fix setting num_samples_per_frame for OPUS
avformat/iamf_parse: fix setting duration for the last subblock in a parameter definition
avformat/iamf_parse: add checks to parameter definition durations
avformat/iamf_parse: reject ambisonics mode > 1
checkasm: Print benchmarks of C-only functions
avcodec/ac3dec: fix downmix logic for eac3
avcodec/codec_desc: remove Intra Only prop for AAC
avcodec/mediacodecdec: set set keyframe flag in output frames
avcodec/libfdk-aacenc: set keyframe in output packets
avcodec/libfdk-aacdec: set keyframe flag and profile in output frames
avcodec/audiotoolboxnec: set set keyframe flag in output packets
avcodec/audiotoolboxdec: set set keyframe flag in output frames
avcodec/aacenc: set keyframe flag in output packets
avcodec/aac/aacdec: set keyframe flag in output frames
avcodec/aac_parser: set key_frame and profile
avformat/mov: don't unconditionally set all audio packets in fragments as key frames
avformat/matroskadec: set all frames in a keyframe simple box as keyframes
avformat/test/movenc: set audio packets as key frames
avformat/movenc: write stss boxes for xHE-AAC
avformat/spdifdec: parse headers for audio codecs
avformat/movenc: don't disable edit lists when writing CMAF output
avcodec/libfdk-aacenc: export CPB properties
avformat/movenc: don't write a calculated avgBitrate when the provided one is unset
libavutil/riscv: Make use of elf_aux_info() on FreeBSD / OpenBSD riscv
libavutil/ppc: defines involving bit shifts should be unsigned
libavutil/ppc: Include the hardware feature flags like the other archs
lavu/riscv: fix compilation without Vector support
avfilter/f_loop: fix aloop activate logic
avfilter/f_loop: fix length of aloop leftover buffer
avfilter/vf_zscale: align the frame buffers
lavfi/vf_zscale: fix call to av_pix_fmt_count_planes
lavfi/vf_zscale: fix tmp buffer ptr alignment for zimg_filter_graph_process
avfilter/framepool: align the frame buffers
avcodec/h2645_sei: use the RefStruct API for film_grain_characteristics
avcodec/aom_film_grain: allocate film grain metadata dynamically
avformat/mov: use an array of pointers for heif_item
avformat/mov: split off heif item initialization to its own function
avformat/mov: factorize getting the current item
lavc/h264idct: fix RISC-V group multiplier
lavc/h264dsp: move RISC-V fn pointers to .data.rel.ro
avcodec/jpegxl_parser: fix reading lz77-pair as initial entropy symbol
avcodec/jpegxl_parser: check entropy_decoder_read_symbol return value
avcodec/cbs_h266: Fix regression in DVB clip introduced by 93281630a71c06642adfebebb0d4b105a4e02e91
avcodec/x86/vvc: add prototypes for OF functions
Document stream specifier syntax change from 46cbe4ab5c
fftools/ffplay: fix crash when vk renderer is null
avutil/wchar_filename: re-introduce explicit cast of void* to char*
fate/ffmpeg: add samples dependency to fate-ffmpeg-spec-disposition
fftools/ffmpeg_filter: treat apad filter as a source
lavc/avcodec: fix global/private option precendence
avfilter/framesync: fix forward EOF pts
avcodec/vaapi_encode: fix compilation without CONFIG_VAAPI_1
libavcodec: x86: Remove an explicit include of config.asm
checkasm: lls: Use relative tolerances rather than absolute ones
arm: Consistently use proper interworking function returns
avcodec/libx265: unbreak build for X265_BUILD >= 213
fftools: log unconnected filter output label
fftools: do not access out of bounds filtergraph
avcodec/mediacodecenc: Fix access of uninitialized value
avformat/img2enc: Fix integer truncation when frame_pts is enabled
avformat/internal: Add ff_get_frame_filename
avformat/mov: don't return the latest stream when an item stream is expected
version 7.1:
- Raw Captions with Time (RCWT) closed caption demuxer
- LC3/LC3plus decoding/encoding using external library liblc3
@ -27,6 +244,15 @@ version 7.1:
- LCEVC enhancement data exporting in H.26x and MP4/ISOBMFF
- LCEVC filter
- MV-HEVC decoding
- minor stream specifier syntax changes:
- when matching by metadata (:m:<key>:<val>), the colon character
in keys or values now has to be backslash-escaped
- in optional maps (-map ....?) with a metadata-matching stream specifier,
the value has to be separated from the question mark by a colon, i.e.
-map ....:m:<key>:<val>:? (otherwise it would be ambiguous whether the
question mark is a part of <val> or not)
- multiple stream types in a single specifier (e.g. :s:s:0) now cause an
error, as such a specifier makes no sense
version 7.0:

View file

@ -15,3 +15,11 @@ NOTICE
------
- Non system dependencies (e.g. libx264, libvpx) are disabled by default.
NOTICE for Package Maintainers
------------------------------
- It is recommended to build FFmpeg twice, first with minimal external dependencies so
that 3rd party packages, which depend on FFmpegs libavutil/libavfilter/libavcodec/libavformat
can then be built. And last build FFmpeg with full dependancies (which may in turn depend on
some of these 3rd party packages). This avoids circular dependencies during build.

View file

@ -56,6 +56,7 @@ presets [0]
metadata subsystem Aurelien Jacobs
release management Michael Niedermayer
API tests [0]
samples-request [2] Thilo Borgmann, James Almer, Ben Littler
Communication
@ -511,9 +512,9 @@ Operating systems / CPU architectures
Alpha [0]
MIPS Manojkumar Bhosale, Shiyou Yin
LoongArch [2] Shiyou Yin
Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier
Mac OS X / PowerPC [0]
Amiga / PowerPC Colin Ward
Linux / PowerPC Lauri Kasanen
Linux / PowerPC [1] Lauri Kasanen
RISC-V [2] Rémi Denis-Courmont
Windows MinGW Alex Beregszaszi, Ramiro Polla
Windows Cygwin Victor Paesa

View file

@ -1 +1 @@
7.0.git
7.1.1

15
RELEASE_NOTES Normal file
View file

@ -0,0 +1,15 @@
┌──────────────────────────────────────┐
│ RELEASE NOTES for FFmpeg 7.1 "Péter" │
└──────────────────────────────────────┘
The FFmpeg Project proudly presents FFmpeg 7.1 "Péter", about 6
months after the release of FFmpeg 7.0.
A complete Changelog is available at the root of the project, and the
complete Git history on https://git.ffmpeg.org/gitweb/ffmpeg.git
We hope you will like this release as much as we enjoyed working on it, and
as usual, if you have any questions about it, or any FFmpeg related topic,
feel free to join us on the #ffmpeg IRC channel (on irc.libera.chat) or ask
on the mailing-lists.

28
configure vendored
View file

@ -434,7 +434,9 @@ Advanced options (experts only):
--enable-hardcoded-tables use hardcoded tables instead of runtime generation
--disable-safe-bitstream-reader
disable buffer boundary checking in bitreaders
(faster, but may crash)
(This disables some security checks and can cause undefined behavior,
crashes and arbitrary code execution, it may be faster, but
should only be used with trusted input)
--sws-max-filter-size=N the max filter size swscale uses [$sws_max_filter_size_default]
Optimization options (experts only):
@ -2212,6 +2214,7 @@ ARCH_EXT_LIST_PPC="
ldbrx
power8
ppc4xx
vec_xl
vsx
"
@ -2759,6 +2762,7 @@ altivec_deps="ppc"
dcbzl_deps="ppc"
ldbrx_deps="ppc"
ppc4xx_deps="ppc"
vec_xl_deps="altivec"
vsx_deps="altivec"
power8_deps="vsx"
@ -4110,6 +4114,8 @@ if test "$target_os_default" = aix; then
arch_default=$(uname -p)
strip_default="strip -X32_64"
nm_default="nm -g -X32_64"
elif test "$MSYSTEM_CARCH" != ""; then
arch_default="$MSYSTEM_CARCH"
else
arch_default=$(uname -m)
fi
@ -5805,6 +5811,13 @@ case $target_os in
clang_version=$($cc -dumpversion)
test ${clang_version%%.*} -eq 11 && add_cflags -fno-stack-check
fi
# Xcode Clang doesn't default to -fno-common while upstream llvm.org
# Clang (and GCC) do. This avoids linker warnings on Xcode 16.3 about
# "reducing alignment of section __DATA,__common from 0x8000 to 0x4000
# because it exceeds segment maximum alignment".
check_cflags -fno-common
;;
msys*)
die "Native MSYS builds are discouraged, please use the MINGW environment."
@ -6389,6 +6402,11 @@ elif enabled ppc; then
check_cpp_condition power8 "altivec.h" "defined(_ARCH_PWR8)"
fi
if enabled altivec; then
check_cc vec_xl altivec.h "const unsigned char *y1i = { 0 };
vector unsigned char y0 = vec_xl(0, y1i);"
fi
elif enabled riscv; then
enabled rv && check_inline_asm rv '".option arch, +zbb\nrev8 t0, t1"'
@ -6480,6 +6498,9 @@ check_cc intrinsics_sse2 emmintrin.h "__m128i test = _mm_setzero_si128()"
check_ldflags -Wl,--as-needed
check_ldflags -Wl,-z,noexecstack
if [ $target_os = "darwin" ]; then
check_ldflags -Wl,-no_warn_duplicate_libraries
fi
if ! disabled network; then
check_func getaddrinfo $network_extralibs
@ -7175,7 +7196,7 @@ enabled makeinfo \
disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
perl -v > /dev/null 2>&1 && enable perl || disable perl
pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
rsync --help 2> /dev/null | grep -q 'contimeout=' && enable rsync_contimeout || disable rsync_contimeout
xmllint --version > /dev/null 2>&1 && enable xmllint || disable xmllint
check_headers linux/fb.h
@ -7941,6 +7962,7 @@ if enabled ppc; then
echo "POWER8 enabled ${power8-no}"
echo "PPC 4xx optimizations ${ppc4xx-no}"
echo "dcbzl available ${dcbzl-no}"
echo "vec_xl available ${vec_xl-no}"
fi
if enabled loongarch; then
echo "LSX enabled ${lsx-no}"
@ -8191,7 +8213,7 @@ cat > $TMPH <<EOF
#define FFMPEG_CONFIG_H
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
#define FFMPEG_LICENSE "$(c_escape $license)"
#define CONFIG_THIS_YEAR 2024
#define CONFIG_THIS_YEAR 2025
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"

View file

@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER =
PROJECT_NUMBER = 7.1.1
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View file

@ -292,7 +292,6 @@ DVD-Video demuxer, powered by libdvdnav and libdvdread.
Can directly ingest DVD titles, specifically sequential PGCs, into
a conversion pipeline. Menu assets, such as background video or audio,
can also be demuxed given the menu's coordinates (at best effort).
Seeking is not supported at this time.
Block devices (DVD drives), ISO files, and directory structures are accepted.
Activate with @code{-f dvdvideo} in front of one of these inputs.
@ -380,11 +379,11 @@ Default is false.
@item menu_lu @var{int}
The menu language to demux. In DVD, menus are grouped by language.
Default is 0, the first language unit.
Default is 1, the first language unit.
@item menu_vts @var{int}
The VTS where the menu lives, or 0 if it is a VMG menu (root-level).
Default is 0, VMG menu.
Default is 1, menu of the first VTS.
@item pgc @var{int}
The entry PGC to start playback, in conjunction with @option{pg}.
@ -397,8 +396,7 @@ Default is 0, automatically resolve from value of @option{title}.
The entry PG to start playback, in conjunction with @option{pgc}.
Alternative to setting @option{title}.
Chapter markers are not supported at this time.
Default is 0, automatically resolve from value of @option{title}, or
start from the beginning (PG 1) of the menu.
Default is 1, the first PG of the PGC.
@item preindex @var{bool}
Enable this to have accurate chapter (PTT) markers and duration measurement,
@ -406,7 +404,6 @@ which requires a slow second pass read in order to index the chapter marker
timestamps from NAV packets. This is non-ideal extra work for real optical drives.
It is recommended and faster to use this option with a backup of the DVD structure
stored on a hard drive. Not compatible with @option{pgc} and @option{pg}.
Not applicable to menus.
Default is 0, false.
@item trim @var{bool}
@ -567,6 +564,13 @@ prefer to use #EXT-X-START if it's in playlist instead of live_start_index.
@item allowed_extensions
',' separated list of file extensions that hls is allowed to access.
@item extension_picky
This blocks disallowed extensions from probing
It also requires all available segments to have matching extensions to the format
except mpegts, which is always allowed.
It is recommended to set the whitelists correctly instead of depending on extensions
Enabled by default.
@item max_reload
Maximum number of times a insufficient list is attempted to be reloaded.
Default value is 1000.

View file

@ -927,6 +927,25 @@ In case you need finer control over how valgrind is invoked, use the
@code{--target-exec='valgrind <your_custom_valgrind_options>} option in
your configure line instead.
@anchor{Maintenance}
@chapter Maintenance process
@anchor{MAINTAINERS}
@section MAINTAINERS
The developers maintaining each part of the codebase are listed in @file{MAINTAINERS}.
Being listed in @file{MAINTAINERS}, gives one the right to have git write access to
the specific repository.
@anchor{Becoming a maintainer}
@section Becoming a maintainer
People add themselves to @file{MAINTAINERS} by sending a patch like any other code
change. These get reviewed by the community like any other patch. It is expected
that, if someone has an objection to a new maintainer, she is willing to object
in public with her full name and is willing to take over maintainership for the area.
@anchor{Release process}
@chapter Release process

View file

@ -1,5 +1,5 @@
slot= # some unique identifier
repo=git://source.ffmpeg.org/ffmpeg.git # the source repository
repo=https://git.ffmpeg.org/ffmpeg.git # the source repository
#branch=release/2.6 # the branch to test
samples= # path to samples directory
workdir= # directory in which to do all the work

View file

@ -1799,7 +1799,7 @@ Set the size of the canvas used to render subtitles.
@section Advanced options
@table @option
@item -map [-]@var{input_file_id}[:@var{stream_specifier}][:@var{view_specifier}][?] | @var{[linklabel]} (@emph{output})
@item -map [-]@var{input_file_id}[:@var{stream_specifier}][:@var{view_specifier}][:?] | @var{[linklabel]} (@emph{output})
Create one or more streams in the output file. This option has two forms for
specifying the data source(s): the first selects one or more streams from some

View file

@ -78,7 +78,8 @@ Match the stream by stream id (e.g. PID in MPEG-TS container).
@item m:@var{key}[:@var{value}]
Matches streams with the metadata tag @var{key} having the specified value. If
@var{value} is not given, matches streams that contain the given tag with any
value.
value. The colon character ':' in @var{key} or @var{value} needs to be
backslash-escaped.
@item disp:@var{dispositions}[:@var{additional_stream_specifier}]
Matches streams with the given disposition(s). @var{dispositions} is a list of
one or more dispositions (as printed by the @option{-dispositions} option)

View file

@ -143,7 +143,7 @@ git log <filename(s)>
@end example
You may also use the graphical tools like @command{gitview} or @command{gitk}
or the web interface available at @url{http://source.ffmpeg.org/}.
or the web interface available at @url{https://git.ffmpeg.org/ffmpeg.git}.
@section Checking source tree status

View file

@ -23,6 +23,8 @@ Web, mail, and public facing git, also website git
fftrac VM:
----------
trac.ffmpeg.org Issue tracking
gpg encrypted backups of the trac repositories are created once a day
and can be downloaded by any of the admins.
ffaux VM:
@ -65,6 +67,9 @@ Github mirrors are redundantly synced by multiple people
You need a new git repository related to FFmpeg ? contact root at ffmpeg.org
git repositories are managed by gitolite, every change to permissions is
logged, including when, what and by whom
Fate:
~~~~~

View file

@ -54,12 +54,24 @@ sub get_formatting_function($$) {
}
# determine texinfo version
my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify;
my $package_version = ff_get_conf('PACKAGE_VERSION');
$package_version =~ s/\+dev$//;
my $program_version_num = version->declare($package_version)->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
# no navigation elements
ff_set_from_init_file('HEADERS', 0);
my %sectioning_commands = %Texinfo::Common::sectioning_commands;
if (scalar(keys(%sectioning_commands)) == 0) {
%sectioning_commands = %Texinfo::Commands::sectioning_heading_commands;
}
my %root_commands = %Texinfo::Common::root_commands;
if (scalar(keys(%root_commands)) == 0) {
%root_commands = %Texinfo::Commands::root_commands;
}
sub ffmpeg_heading_command($$$$$)
{
my $self = shift;
@ -77,6 +89,9 @@ sub ffmpeg_heading_command($$$$$)
return $result;
}
# no need to set it as the $element_id is output unconditionally
my $heading_id;
my $element_id = $self->command_id($command);
$result .= "<a name=\"$element_id\"></a>\n"
if (defined($element_id) and $element_id ne '');
@ -84,24 +99,40 @@ sub ffmpeg_heading_command($$$$$)
print STDERR "Process $command "
.Texinfo::Structuring::_print_root_command_texi($command)."\n"
if ($self->get_conf('DEBUG'));
my $element;
if ($Texinfo::Common::root_commands{$command->{'cmdname'}}
and $command->{'parent'}
and $command->{'parent'}->{'type'}
and $command->{'parent'}->{'type'} eq 'element') {
$element = $command->{'parent'};
my $output_unit;
if ($root_commands{$command->{'cmdname'}}) {
if ($command->{'associated_unit'}) {
$output_unit = $command->{'associated_unit'};
} elsif ($command->{'structure'}
and $command->{'structure'}->{'associated_unit'}) {
$output_unit = $command->{'structure'}->{'associated_unit'};
} elsif ($command->{'parent'}
and $command->{'parent'}->{'type'}
and $command->{'parent'}->{'type'} eq 'element') {
$output_unit = $command->{'parent'};
}
}
if ($element) {
if ($output_unit) {
$result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
$command, $element);
$command, $output_unit);
}
my $heading_level;
# node is used as heading if there is nothing else.
if ($cmdname eq 'node') {
if (!$element or (!$element->{'extra'}->{'section'}
and $element->{'extra'}->{'node'}
and $element->{'extra'}->{'node'} eq $command
if (!$output_unit or
(((!$output_unit->{'extra'}->{'section'}
and $output_unit->{'extra'}->{'node'}
and $output_unit->{'extra'}->{'node'} eq $command)
or
((($output_unit->{'extra'}->{'unit_command'}
and $output_unit->{'extra'}->{'unit_command'} eq $command)
or
($output_unit->{'unit_command'}
and $output_unit->{'unit_command'} eq $command))
and $command->{'extra'}
and not $command->{'extra'}->{'associated_section'}))
# bogus node may not have been normalized
and defined($command->{'extra'}->{'normalized'}))) {
if ($command->{'extra'}->{'normalized'} eq 'Top') {
@ -111,7 +142,15 @@ sub ffmpeg_heading_command($$$$$)
}
}
} else {
$heading_level = $command->{'level'};
if (defined($command->{'extra'})
and defined($command->{'extra'}->{'section_level'})) {
$heading_level = $command->{'extra'}->{'section_level'};
} elsif ($command->{'structure'}
and defined($command->{'structure'}->{'section_level'})) {
$heading_level = $command->{'structure'}->{'section_level'};
} else {
$heading_level = $command->{'level'};
}
}
my $heading = $self->command_text($command);
@ -119,8 +158,8 @@ sub ffmpeg_heading_command($$$$$)
# if there is an error in the node.
if (defined($heading) and $heading ne '' and defined($heading_level)) {
if ($Texinfo::Common::root_commands{$cmdname}
and $Texinfo::Common::sectioning_commands{$cmdname}) {
if ($root_commands{$cmdname}
and $sectioning_commands{$cmdname}) {
my $content_href = $self->command_contents_href($command, 'contents',
$self->{'current_filename'});
if ($content_href) {
@ -140,7 +179,13 @@ sub ffmpeg_heading_command($$$$$)
}
}
if ($self->in_preformatted()) {
my $in_preformatted;
if ($program_version_num >= 7.001090) {
$in_preformatted = $self->in_preformatted_context();
} else {
$in_preformatted = $self->in_preformatted();
}
if ($in_preformatted) {
$result .= $heading."\n";
} else {
# if the level was changed, set the command name right
@ -149,21 +194,25 @@ sub ffmpeg_heading_command($$$$$)
$cmdname
= $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
}
# format_heading_text expects an array of headings for texinfo >= 7.0
if ($program_version_num >= 7.000000) {
$heading = [$heading];
}
$result .= &{get_formatting_function($self,'format_heading_text')}(
$result .= &{get_formatting_function($self,'format_heading_text')}($self,
$cmdname, [$cmdname], $heading,
$heading_level +$self->get_conf('CHAPTER_HEADER_LEVEL') -1,
$heading_id, $command);
} else {
$result .= &{get_formatting_function($self,'format_heading_text')}(
$self, $cmdname, $heading,
$heading_level +
$self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
}
}
}
$result .= $content if (defined($content));
return $result;
}
foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
foreach my $command (keys(%sectioning_commands), 'node') {
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
}
@ -188,28 +237,56 @@ sub ffmpeg_begin_file($$$)
my $filename = shift;
my $element = shift;
my $command;
if ($element and $self->get_conf('SPLIT')) {
$command = $self->element_command($element);
my ($element_command, $node_command, $command_for_title);
if ($element) {
if ($element->{'unit_command'}) {
$element_command = $element->{'unit_command'};
} elsif ($self->can('tree_unit_element_command')) {
$element_command = $self->tree_unit_element_command($element);
} elsif ($self->can('tree_unit_element_command')) {
$element_command = $self->element_command($element);
}
$node_command = $element_command;
if ($element_command and $element_command->{'cmdname'}
and $element_command->{'cmdname'} ne 'node'
and $element_command->{'extra'}
and $element_command->{'extra'}->{'associated_node'}) {
$node_command = $element_command->{'extra'}->{'associated_node'};
}
$command_for_title = $element_command if ($self->get_conf('SPLIT'));
}
my ($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
my ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
$root_html_element_attributes, $body_attributes, $copying_comment,
$after_body_open, $extra_head, $program_and_version, $program_homepage,
$program, $generator);
if ($program_version_num >= 7.000000) {
($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
if ($program_version_num >= 7.001090) {
($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
$root_html_element_attributes, $body_attributes, $copying_comment,
$after_body_open, $extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_information($command_for_title,
$filename);
} elsif ($program_version_num >= 7.000000) {
($title, $description, $encoding, $date, $css_lines, $doctype,
$root_html_element_attributes, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_information($command);
$program, $generator) = $self->_file_header_information($command_for_title,
$filename);
} else {
($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_informations($command);
$doctype, $root_html_element_attributes, $copying_comment,
$after_body_open, $extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_informations($command_for_title);
}
my $links = $self->_get_links ($filename, $element);
my $links;
if ($program_version_num >= 7.000000) {
$links = $self->_get_links($filename, $element, $node_command);
} else {
$links = $self->_get_links ($filename, $element);
}
my $head1 = $ENV{"FFMPEG_HEADER1"} || <<EOT;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@ -252,13 +329,25 @@ sub ffmpeg_program_string($)
if (defined($self->get_conf('PROGRAM'))
and $self->get_conf('PROGRAM') ne ''
and defined($self->get_conf('PACKAGE_URL'))) {
return $self->convert_tree(
if ($program_version_num >= 7.001090) {
return $self->convert_tree(
$self->cdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
{ 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
'program' => {'text' => $self->get_conf('PROGRAM') }}));
} else {
return $self->convert_tree(
$self->gdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
{ 'program_homepage' => $self->get_conf('PACKAGE_URL'),
'program' => $self->get_conf('PROGRAM') }));
{ 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
'program' => {'text' => $self->get_conf('PROGRAM') }}));
}
} else {
return $self->convert_tree(
$self->gdt('This document was generated automatically.'));
if ($program_version_num >= 7.001090) {
return $self->convert_tree(
$self->cdt('This document was generated automatically.'));
} else {
return $self->convert_tree(
$self->gdt('This document was generated automatically.'));
}
}
}
if ($program_version_6_8) {

View file

@ -912,9 +912,18 @@ static int ist_use(InputStream *ist, int decoding_needed,
if (decoding_needed && ds->sch_idx_dec < 0) {
int is_audio = ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO;
int is_unreliable = !!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS);
int64_t use_wallclock_as_timestamps;
ret = av_opt_get_int(d->f.ctx, "use_wallclock_as_timestamps", 0, &use_wallclock_as_timestamps);
if (ret < 0)
return ret;
if (use_wallclock_as_timestamps)
is_unreliable = 0;
ds->dec_opts.flags |= (!!ist->fix_sub_duration * DECODER_FLAG_FIX_SUB_DURATION) |
(!!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS) * DECODER_FLAG_TS_UNRELIABLE) |
(!!is_unreliable * DECODER_FLAG_TS_UNRELIABLE) |
(!!(d->loop && is_audio) * DECODER_FLAG_SEND_END_TS)
#if FFMPEG_OPT_TOP
| ((ist->top_field_first >= 0) * DECODER_FLAG_TOP_FIELD_FIRST)

View file

@ -1101,8 +1101,9 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch)
for (unsigned i = 0; i < graph->nb_filters; i++) {
const AVFilter *f = graph->filters[i]->filter;
if (!avfilter_filter_pad_count(f, 0) &&
!(f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS)) {
if ((!avfilter_filter_pad_count(f, 0) &&
!(f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS)) ||
!strcmp(f->name, "apad")) {
fgp->have_sources = 1;
break;
}
@ -1408,8 +1409,10 @@ int fg_finalise_bindings(void)
for (int j = 0; j < fg->nb_outputs; j++) {
OutputFilter *output = fg->outputs[j];
if (!output->bound) {
av_log(filtergraphs[j], AV_LOG_FATAL,
"Filter %s has an unconnected output\n", output->name);
av_log(fg, AV_LOG_FATAL,
"Filter '%s' has output %d (%s) unconnected\n",
output->name, j,
output->linklabel ? (const char *)output->linklabel : "unlabeled");
return AVERROR(EINVAL);
}
}
@ -1495,7 +1498,7 @@ static int insert_filter(AVFilterContext **last_filter, int *pad_idx,
return 0;
}
static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph,
static int configure_output_video_filter(FilterGraphPriv *fgp, AVFilterGraph *graph,
OutputFilter *ofilter, AVFilterInOut *out)
{
OutputFilterPriv *ofp = ofp_from_ofilter(ofilter);
@ -1574,7 +1577,7 @@ static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph,
return 0;
}
static int configure_output_audio_filter(FilterGraph *fg, AVFilterGraph *graph,
static int configure_output_audio_filter(FilterGraphPriv *fgp, AVFilterGraph *graph,
OutputFilter *ofilter, AVFilterInOut *out)
{
OutputFilterPriv *ofp = ofp_from_ofilter(ofilter);
@ -1639,8 +1642,10 @@ static int configure_output_audio_filter(FilterGraph *fg, AVFilterGraph *graph,
pad_idx = 0;
}
if (ofilter->apad)
if (ofilter->apad) {
AUTO_INSERT_FILTER("-apad", "apad", ofilter->apad);
fgp->have_sources = 1;
}
snprintf(name, sizeof(name), "trim for output %s", ofp->name);
ret = insert_trim(ofp->trim_start_us, ofp->trim_duration_us,
@ -1656,12 +1661,12 @@ fail:
return ret;
}
static int configure_output_filter(FilterGraph *fg, AVFilterGraph *graph,
static int configure_output_filter(FilterGraphPriv *fgp, AVFilterGraph *graph,
OutputFilter *ofilter, AVFilterInOut *out)
{
switch (ofilter->type) {
case AVMEDIA_TYPE_VIDEO: return configure_output_video_filter(fg, graph, ofilter, out);
case AVMEDIA_TYPE_AUDIO: return configure_output_audio_filter(fg, graph, ofilter, out);
case AVMEDIA_TYPE_VIDEO: return configure_output_video_filter(fgp, graph, ofilter, out);
case AVMEDIA_TYPE_AUDIO: return configure_output_audio_filter(fgp, graph, ofilter, out);
default: av_assert0(0); return 0;
}
}
@ -1938,7 +1943,7 @@ static int configure_filtergraph(FilterGraph *fg, FilterGraphThread *fgt)
avfilter_inout_free(&inputs);
for (cur = outputs, i = 0; cur; cur = cur->next, i++) {
ret = configure_output_filter(fg, fgt->graph, fg->outputs[i], cur);
ret = configure_output_filter(fgp, fgt->graph, fg->outputs[i], cur);
if (ret < 0) {
avfilter_inout_free(&outputs);
goto fail;
@ -1993,6 +1998,10 @@ static int configure_filtergraph(FilterGraph *fg, FilterGraphThread *fgt)
if (ifp->type_src == AVMEDIA_TYPE_SUBTITLE) {
sub2video_frame(&ifp->ifilter, tmp, !fgt->graph);
} else {
if (ifp->type_src == AVMEDIA_TYPE_VIDEO) {
if (ifp->displaymatrix_applied)
av_frame_remove_side_data(tmp, AV_FRAME_DATA_DISPLAYMATRIX);
}
ret = av_buffersrc_add_frame(ifp->filter, tmp);
}
av_frame_free(&tmp);

View file

@ -2607,6 +2607,11 @@ static int create_hwaccel(AVBufferRef **device_ctx)
if (type == AV_HWDEVICE_TYPE_NONE)
return AVERROR(ENOTSUP);
if (!vk_renderer) {
av_log(NULL, AV_LOG_ERROR, "Vulkan renderer is not available\n");
return AVERROR(ENOTSUP);
}
ret = vk_renderer_get_hw_dev(vk_renderer, &vk_dev);
if (ret < 0)
return ret;

View file

@ -108,7 +108,7 @@ OBJS-$(CONFIG_H264PARSE) += h264_parse.o h264_ps.o h264data.o \
h2645data.o h2645_parse.o h2645_vui.o
OBJS-$(CONFIG_H264PRED) += h264pred.o
OBJS-$(CONFIG_H264QPEL) += h264qpel.o
OBJS-$(CONFIG_H264_SEI) += h264_sei.o h2645_sei.o
OBJS-$(CONFIG_H264_SEI) += h264_sei.o h2645_sei.o aom_film_grain.o
OBJS-$(CONFIG_HEVCPARSE) += h2645data.o h2645_parse.o h2645_vui.o
OBJS-$(CONFIG_HEVC_SEI) += h2645_sei.o aom_film_grain.o \
dynamic_hdr_vivid.o

View file

@ -1102,6 +1102,8 @@ static av_cold int decode_close(AVCodecContext *avctx)
for (int i = 0; i < 2; i++) {
OutputConfiguration *oc = &ac->oc[i];
av_channel_layout_uninit(&ac->oc[i].ch_layout);
AACUSACConfig *usac = &oc->usac;
for (int j = 0; j < usac->nb_elems; j++) {
AACUsacElemConfig *ec = &usac->elems[j];
@ -1743,6 +1745,7 @@ int ff_aac_decode_ics(AACDecContext *ac, SingleChannelElement *sce,
return 0;
fail:
memset(sce->sfo, 0, sizeof(sce->sfo));
tns->present = 0;
return ret;
}
@ -2194,6 +2197,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, AVFrame *frame,
ac->frame->nb_samples = samples;
ac->frame->sample_rate = avctx->sample_rate;
ac->frame->flags |= AV_FRAME_FLAG_KEY;
*got_frame_ptr = 1;
skip_bits_long(gb, get_bits_left(gb));
@ -2354,6 +2358,7 @@ static int decode_frame_ga(AVCodecContext *avctx, AACDecContext *ac,
if (samples) {
ac->frame->nb_samples = samples;
ac->frame->sample_rate = avctx->sample_rate;
ac->frame->flags |= AV_FRAME_FLAG_KEY;
*got_frame_ptr = 1;
} else {
av_frame_unref(ac->frame);

View file

@ -62,7 +62,7 @@ static void parse_qn(GetBitContext *gb, int *qn, int nk_mode, int no_qn)
{
if (nk_mode == 1) {
for (int k = 0; k < no_qn; k++) {
qn[k] = get_unary(gb, 0, INT32_MAX); // TODO: find proper ranges
qn[k] = get_unary(gb, 0, 68); // TODO: find proper ranges
if (qn[k])
qn[k]++;
}
@ -75,7 +75,7 @@ static void parse_qn(GetBitContext *gb, int *qn, int nk_mode, int no_qn)
if (nk_mode == 2) {
for (int k = 0; k < no_qn; k++) {
if (qn[k] > 4) {
qn[k] = get_unary(gb, 0, INT32_MAX);;
qn[k] = get_unary(gb, 0, 65);
if (qn[k])
qn[k] += 4;
}
@ -85,7 +85,7 @@ static void parse_qn(GetBitContext *gb, int *qn, int nk_mode, int no_qn)
for (int k = 0; k < no_qn; k++) {
if (qn[k] > 4) {
int qn_ext = get_unary(gb, 0, INT32_MAX);;
int qn_ext = get_unary(gb, 0, 65);
switch (qn_ext) {
case 0: qn[k] = 5; break;
case 1: qn[k] = 6; break;
@ -114,6 +114,9 @@ static int parse_codebook_idx(GetBitContext *gb, uint32_t *kv,
}
}
if (nk > 25)
return AVERROR_PATCHWELCOME;
skip_bits(gb, 4*n);
if (nk > 0)

View file

@ -265,6 +265,7 @@ static int decode_usac_extension(AACDecContext *ac, AACUsacElemConfig *e,
/* No configuration needed - fallthrough (len should be 0) */
default:
skip_bits(gb, 8*ext_config_len);
e->ext.type = ID_EXT_ELE_FILL;
break;
};
@ -566,15 +567,8 @@ static int decode_usac_scale_factors(AACDecContext *ac,
int offset_sf = global_gain;
for (int g = 0; g < ics->num_window_groups; g++) {
for (int sfb = 0; sfb < ics->max_sfb; sfb++) {
/* First coefficient is just the global gain */
if (!g && !sfb) {
/* The cannonical representation of quantized scalefactors
* in the spec is with 100 subtracted. */
sce->sfo[0] = offset_sf - 100;
continue;
}
offset_sf += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
if (g || sfb)
offset_sf += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
if (offset_sf > 255U) {
av_log(ac->avctx, AV_LOG_ERROR,
"Scalefactor (%d) out of range.\n", offset_sf);
@ -917,8 +911,10 @@ static int decode_usac_stereo_info(AACDecContext *ac, AACUSACConfig *usac,
}
ret = setup_sce(ac, sce1, usac);
if (ret < 0)
if (ret < 0) {
ics2->max_sfb = 0;
return ret;
}
ret = setup_sce(ac, sce2, usac);
if (ret < 0)

View file

@ -40,6 +40,8 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
int new_frame_start;
int got_frame = 0;
s1->key_frame = -1;
if (s1->flags & PARSER_FLAG_COMPLETE_FRAMES) {
i = buf_size;
got_frame = 1;
@ -145,10 +147,15 @@ get_next:
} else {
#if CONFIG_AAC_PARSER
AACADTSHeaderInfo hdr;
GetBitContext gb;
int profile;
init_get_bits8(&gb, buf, buf_size);
if (buf_size < AV_AAC_ADTS_HEADER_SIZE ||
ff_adts_header_parse_buf(buf, &hdr) < 0)
ff_adts_header_parse(&gb, &hdr) < 0)
return i;
avctx->profile = hdr.object_type - 1;
s1->key_frame = (avctx->profile == AV_PROFILE_AAC_USAC) ? get_bits1(&gb) : 1;
bit_rate = hdr.bit_rate;
#endif
}

View file

@ -1177,6 +1177,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
&avpkt->duration);
avpkt->flags |= AV_PKT_FLAG_KEY;
*got_packet_ptr = 1;
return 0;
}

View file

@ -599,6 +599,7 @@ static int sbr_make_f_derived(AACDecContext *ac, SpectralBandReplication *sbr)
if (sbr->n_q > 5) {
av_log(ac->avctx, AV_LOG_ERROR, "Too many noise floor scale factors: %d\n", sbr->n_q);
sbr->n_q = 1;
return -1;
}

View file

@ -502,28 +502,27 @@ function ff_pred16x16_plane_neon_10, export=1
add v7.4h, v7.4h, v0.4h
shl v2.4h, v7.4h, #4
ssubl v2.4s, v2.4h, v3.4h
shl v3.4h, v4.4h, #4
ext v0.16b, v0.16b, v0.16b, #14
ssubl v6.4s, v5.4h, v3.4h
sxtl v6.4s, v5.4h // c
mov v0.h[0], wzr
mul v0.8h, v0.8h, v4.h[0]
dup v16.4s, v2.s[0]
dup v17.4s, v2.s[0]
dup v2.8h, v4.h[0]
dup v3.4s, v6.s[0]
shl v2.8h, v2.8h, #3
dup v2.8h, v4.h[0] // b
dup v3.4s, v6.s[0] // c
sshll v2.4s, v2.4h, #3 // b * 8
saddw v16.4s, v16.4s, v0.4h
saddw2 v17.4s, v17.4s, v0.8h
saddw v3.4s, v3.4s, v2.4h
sub v3.4s, v3.4s, v2.4s
mov w3, #16
mvni v4.8h, #0xFC, lsl #8 // 1023 for clipping
1:
sqshrun v0.4h, v16.4s, #5
sqshrun2 v0.8h, v17.4s, #5
saddw v16.4s, v16.4s, v2.4h
saddw v17.4s, v17.4s, v2.4h
add v16.4s, v16.4s, v2.4s
add v17.4s, v17.4s, v2.4s
sqshrun v1.4h, v16.4s, #5
sqshrun2 v1.8h, v17.4s, #5
add v16.4s, v16.4s, v3.4s
@ -595,12 +594,11 @@ function ff_pred8x8_plane_neon_10, export=1
ssubl v2.4s, v2.4h, v3.4h
ext v0.16b, v0.16b, v0.16b, #14
mov v0.h[0], wzr
mul v0.8h, v0.8h, v5.h[0]
dup v1.4s, v2.s[0]
dup v2.4s, v2.s[0]
dup v3.8h, v5.h[1]
saddw v1.4s, v1.4s, v0.4h
saddw2 v2.4s, v2.4s, v0.8h
smlal v1.4s, v0.4h, v5.h[0]
smlal2 v2.4s, v0.8h, v5.h[0]
mov w3, #8
mvni v4.8h, #0xFC, lsl #8 // 1023 for clipping
1:

View file

@ -230,6 +230,9 @@ function \type\()_8tap_\size\()h_\idx1\idx2
// reduced dst stride
.if \size >= 16
sub x1, x1, x5
.elseif \size == 4
add x12, x2, #8
add x13, x7, #8
.endif
// size >= 16 loads two qwords and increments x2,
// for size 4/8 it's enough with one qword and no
@ -248,9 +251,14 @@ function \type\()_8tap_\size\()h_\idx1\idx2
.if \size >= 16
ld1 {v4.8b, v5.8b, v6.8b}, [x2], #24
ld1 {v16.8b, v17.8b, v18.8b}, [x7], #24
.else
.elseif \size == 8
ld1 {v4.8b, v5.8b}, [x2]
ld1 {v16.8b, v17.8b}, [x7]
.else // \size == 4
ld1 {v4.8b}, [x2]
ld1 {v16.8b}, [x7]
ld1 {v5.s}[0], [x12], x3
ld1 {v17.s}[0], [x13], x3
.endif
uxtl v4.8h, v4.8b
uxtl v5.8h, v5.8b

View file

@ -148,7 +148,7 @@
sqxtun v20.8b, v20.8h
str d20, [dst]
.else
smin v20.8h, v20.8h, v25.8h
umin v20.8h, v20.8h, v25.8h
str q20, [dst]
.endif
ret
@ -249,7 +249,7 @@
sqxtun v20.8b, v20.8h
str s20, [dst]
.else
smin v20.4h, v20.4h, v25.4h
umin v20.4h, v20.4h, v25.4h
str d20, [dst]
.endif
ret

View file

@ -199,7 +199,6 @@ static void ac3_downmix(AVCodecContext *avctx)
av_channel_layout_uninit(&avctx->ch_layout);
avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
}
s->downmixed = 1;
}
/**
@ -241,6 +240,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
ac3_downmix(avctx);
s->downmixed = 1;
for (i = 0; i < AC3_MAX_CHANNELS; i++) {
s->xcfptr[i] = s->transform_coeffs[i];

View file

@ -26,7 +26,9 @@
*/
#include "libavutil/avassert.h"
#include "libavutil/buffer.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "aom_film_grain.h"
#include "get_bits.h"
@ -124,7 +126,7 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
{
GetBitContext gbc, *gb = &gbc;
AVFilmGrainAOMParams *aom;
AVFilmGrainParams *fgp, *ref = NULL;
AVFilmGrainParams *fgp = NULL, *ref = NULL;
int ret, num_sets, n, i, uv, num_y_coeffs, update_grain, luma_only;
ret = init_get_bits8(gb, payload, payload_size);
@ -135,28 +137,38 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
if (!s->enable)
return 0;
for (int i = 0; i < FF_ARRAY_ELEMS(s->sets); i++)
av_buffer_unref(&s->sets[i]);
skip_bits(gb, 4); // reserved
num_sets = get_bits(gb, 3) + 1;
for (n = 0; n < num_sets; n++) {
int payload_4byte, payload_size, set_idx, apply_units_log2, vsc_flag;
int predict_scaling, predict_y_scaling, predict_uv_scaling[2];
int payload_bits, start_position;
size_t fgp_size;
start_position = get_bits_count(gb);
payload_4byte = get_bits1(gb);
payload_size = get_bits(gb, payload_4byte ? 2 : 8);
set_idx = get_bits(gb, 3);
fgp = &s->sets[set_idx];
fgp = av_film_grain_params_alloc(&fgp_size);
if (!fgp)
goto error;
aom = &fgp->codec.aom;
fgp->type = get_bits1(gb) ? AV_FILM_GRAIN_PARAMS_AV1 : AV_FILM_GRAIN_PARAMS_NONE;
if (!fgp->type)
if (!fgp->type) {
av_freep(&fgp);
continue;
}
fgp->seed = get_bits(gb, 16);
update_grain = get_bits1(gb);
if (!update_grain)
if (!update_grain) {
av_freep(&fgp);
continue;
}
apply_units_log2 = get_bits(gb, 4);
fgp->width = get_bits(gb, 12) << apply_units_log2;
@ -330,32 +342,49 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
if (payload_bits > payload_size * 8)
goto error;
skip_bits(gb, payload_size * 8 - payload_bits);
av_buffer_unref(&s->sets[set_idx]);
s->sets[set_idx] = av_buffer_create((uint8_t *)fgp, fgp_size, NULL, NULL, 0);
if (!s->sets[set_idx])
goto error;
}
return 0;
error:
memset(s, 0, sizeof(*s));
av_free(fgp);
ff_aom_uninit_film_grain_params(s);
return AVERROR_INVALIDDATA;
}
int ff_aom_attach_film_grain_sets(const AVFilmGrainAFGS1Params *s, AVFrame *frame)
{
AVFilmGrainParams *fgp;
if (!s->enable)
return 0;
for (int i = 0; i < FF_ARRAY_ELEMS(s->sets); i++) {
if (s->sets[i].type != AV_FILM_GRAIN_PARAMS_AV1)
AVBufferRef *buf;
if (!s->sets[i])
continue;
fgp = av_film_grain_params_create_side_data(frame);
if (!fgp)
buf = av_buffer_ref(s->sets[i]);
if (!buf || !av_frame_new_side_data_from_buf(frame,
AV_FRAME_DATA_FILM_GRAIN_PARAMS, buf)) {
av_buffer_unref(&buf);
return AVERROR(ENOMEM);
memcpy(fgp, &s->sets[i], sizeof(*fgp));
}
}
return 0;
}
void ff_aom_uninit_film_grain_params(AVFilmGrainAFGS1Params *s)
{
for (int i = 0; i < FF_ARRAY_ELEMS(s->sets); i++)
av_buffer_unref(&s->sets[i]);
s->enable = 0;
}
// Taken from the AV1 spec. Range is [-2048, 2047], mean is 0 and stddev is 512
static const int16_t gaussian_sequence[2048] = {
56, 568, -180, 172, 124, -84, 172, -64, -900, 24, 820,

View file

@ -28,11 +28,12 @@
#ifndef AVCODEC_AOM_FILM_GRAIN_H
#define AVCODEC_AOM_FILM_GRAIN_H
#include "libavutil/buffer.h"
#include "libavutil/film_grain_params.h"
typedef struct AVFilmGrainAFGS1Params {
int enable;
AVFilmGrainParams sets[8];
AVBufferRef *sets[8];
} AVFilmGrainAFGS1Params;
// Synthesizes film grain on top of `in` and stores the result to `out`. `out`
@ -48,4 +49,7 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
// Attach all valid film grain param sets to `frame`.
int ff_aom_attach_film_grain_sets(const AVFilmGrainAFGS1Params *s, AVFrame *frame);
// Free all allocations in `s` and zero the entire struct.
void ff_aom_uninit_film_grain_params(AVFilmGrainAFGS1Params *s);
#endif /* AVCODEC_AOM_FILM_GRAIN_H */

View file

@ -279,11 +279,13 @@ function \type\()_8tap_\size\()h_\idx1\idx2
sub r1, r1, r5
.endif
@ size >= 16 loads two qwords and increments r2,
@ for size 4/8 it's enough with one qword and no
@ postincrement
@ size 4 loads 1 d word, increments r2 and loads 1 32-bit lane
@ for size 8 it's enough with one qword and no postincrement
.if \size >= 16
sub r3, r3, r5
sub r3, r3, #8
.elseif \size == 4
sub r3, r3, #8
.endif
@ Load the filter vector
vld1.16 {q0}, [r12,:128]
@ -295,9 +297,14 @@ function \type\()_8tap_\size\()h_\idx1\idx2
.if \size >= 16
vld1.8 {d18, d19, d20}, [r2]!
vld1.8 {d24, d25, d26}, [r7]!
.else
.elseif \size == 8
vld1.8 {q9}, [r2]
vld1.8 {q12}, [r7]
.else @ size == 4
vld1.8 {d18}, [r2]!
vld1.8 {d24}, [r7]!
vld1.32 {d19[0]}, [r2]
vld1.32 {d25[0]}, [r7]
.endif
vmovl.u8 q8, d18
vmovl.u8 q9, d19

View file

@ -542,6 +542,8 @@ static int ffat_decode(AVCodecContext *avctx, AVFrame *frame,
frame->nb_samples = avctx->frame_size;
frame->flags |= AV_FRAME_FLAG_KEY;
out_buffers.mBuffers[0].mData = at->decoded_data;
ret = AudioConverterFillComplexBuffer(at->converter, ffat_decode_callback, avctx,

View file

@ -576,6 +576,7 @@ static int ffat_encode(AVCodecContext *avctx, AVPacket *avpkt,
avctx->frame_size,
&avpkt->pts,
&avpkt->duration);
avpkt->flags |= AV_PKT_FLAG_KEY;
} else if (ret && ret != 1) {
av_log(avctx, AV_LOG_ERROR, "Encode error: %i\n", ret);
return AVERROR_EXTERNAL;

View file

@ -145,6 +145,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
int ret = 0;
AVCodecInternal *avci;
const FFCodec *codec2;
const AVDictionaryEntry *e;
if (avcodec_is_open(avctx))
return 0;
@ -175,8 +176,14 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)
return AVERROR(EINVAL);
if ((ret = av_opt_set_dict(avctx, options)) < 0)
return ret;
// set the whitelist from provided options dict,
// so we can check it immediately
e = options ? av_dict_get(*options, "codec_whitelist", NULL, 0) : NULL;
if (e) {
ret = av_opt_set(avctx, e->key, e->value, 0);
if (ret < 0)
return ret;
}
if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) {
av_log(avctx, AV_LOG_ERROR, "Codec (%s) not on whitelist \'%s\'\n", codec->name, avctx->codec_whitelist);
@ -211,12 +218,14 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
av_opt_set_defaults(avctx->priv_data);
}
}
if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, options)) < 0)
goto free_and_end;
} else {
avctx->priv_data = NULL;
}
ret = av_opt_set_dict2(avctx, options, AV_OPT_SEARCH_CHILDREN);
if (ret < 0)
goto free_and_end;
// only call ff_set_dimensions() for non H.264/VP6F/DXV codecs so as not to overwrite previously setup dimensions
if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height &&
(avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F || avctx->codec_id == AV_CODEC_ID_DXV))) {

View file

@ -93,6 +93,11 @@ static int h264_extradata_to_annexb(AVBSFContext *ctx,
const int padding = AV_INPUT_BUFFER_PADDING_SIZE;
int length_size, pps_offset = 0;
if (extradata_size < 7) {
av_log(ctx, AV_LOG_ERROR, "Invalid extradata size: %d\n", extradata_size);
return AVERROR_INVALIDDATA;
}
bytestream2_init(gb, extradata, extradata_size);
bytestream2_skipu(gb, 4);
@ -262,16 +267,11 @@ static int h264_mp4toannexb_init(AVBSFContext *ctx)
(extra_size >= 4 && AV_RB32(ctx->par_in->extradata) == 1)) {
av_log(ctx, AV_LOG_VERBOSE,
"The input looks like it is Annex B already\n");
} else if (extra_size >= 7) {
return h264_extradata_to_annexb(ctx,
ctx->par_in->extradata,
ctx->par_in->extradata_size);
} else {
av_log(ctx, AV_LOG_ERROR, "Invalid extradata size: %d\n", extra_size);
return AVERROR_INVALIDDATA;
return 0;
}
return 0;
return h264_extradata_to_annexb(ctx,
ctx->par_in->extradata,
ctx->par_in->extradata_size);
}
static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *opkt)
@ -293,10 +293,12 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *opkt)
extradata = av_packet_get_side_data(in, AV_PKT_DATA_NEW_EXTRADATA,
&extradata_size);
if (extradata) {
if (extradata && extradata[0] == 1) {
ret = h264_extradata_to_annexb(ctx, extradata, extradata_size);
if (ret < 0)
goto fail;
av_packet_side_data_remove(in->side_data, &in->side_data_elems,
AV_PKT_DATA_NEW_EXTRADATA);
}
/* nothing to filter */

View file

@ -728,16 +728,16 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
}
while (size > 0) {
AV1RawOBUHeader header;
AV1RawOBUHeader obu_header;
uint64_t obu_size;
init_get_bits(&gbc, data, 8 * size);
err = cbs_av1_read_obu_header(ctx, &gbc, &header);
err = cbs_av1_read_obu_header(ctx, &gbc, &obu_header);
if (err < 0)
goto fail;
if (header.obu_has_size_field) {
if (obu_header.obu_has_size_field) {
if (get_bits_left(&gbc) < 8) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU: fragment "
"too short (%"SIZE_SPECIFIER" bytes).\n", size);
@ -748,7 +748,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
if (err < 0)
goto fail;
} else
obu_size = size - 1 - header.obu_extension_flag;
obu_size = size - 1 - obu_header.obu_extension_flag;
pos = get_bits_count(&gbc);
av_assert0(pos % 8 == 0 && pos / 8 <= size);
@ -763,7 +763,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
goto fail;
}
err = ff_cbs_append_unit_data(frag, header.obu_type,
err = ff_cbs_append_unit_data(frag, obu_header.obu_type,
data, obu_length, frag->data_ref);
if (err < 0)
goto fail;

View file

@ -725,14 +725,14 @@ typedef struct H265RawSEI3DReferenceDisplaysInfo {
uint8_t ref_viewing_distance_flag;
uint8_t prec_ref_viewing_dist;
uint8_t num_ref_displays_minus1;
uint8_t left_view_id[31];
uint8_t right_view_id[31];
uint8_t exponent_ref_display_width[31];
uint8_t mantissa_ref_display_width[31];
uint8_t exponent_ref_viewing_distance[31];
uint8_t mantissa_ref_viewing_distance[31];
uint8_t additional_shift_present_flag[31];
uint16_t num_sample_shift_plus512[31];
uint16_t left_view_id[32];
uint16_t right_view_id[32];
uint8_t exponent_ref_display_width[32];
uint8_t mantissa_ref_display_width[32];
uint8_t exponent_ref_viewing_distance[32];
uint8_t mantissa_ref_viewing_distance[32];
uint8_t additional_shift_present_flag[32];
uint16_t num_sample_shift_plus512[32];
uint8_t three_dimensional_reference_displays_extension_flag;
} H265RawSEI3DReferenceDisplaysInfo;

View file

@ -2299,8 +2299,8 @@ SEI_FUNC(sei_3d_reference_displays_info, (CodedBitstreamContext *ctx, RWContext
ue(prec_ref_viewing_dist, 0, 31);
ue(num_ref_displays_minus1, 0, 31);
for (i = 0; i <= current->num_ref_displays_minus1; i++) {
ues(left_view_id[i], 0, UINT8_MAX, 1, i);
ues(right_view_id[i], 0, UINT8_MAX, 1, i);
ues(left_view_id[i], 0, MAX_UINT_BITS(15), 1, i);
ues(right_view_id[i], 0, MAX_UINT_BITS(15), 1, i);
us(6, exponent_ref_display_width[i], 0, 62, 1, i);
if (!current->exponent_ref_display_width[i])
length = FFMAX(0, (int)current->prec_ref_display_width - 30);

View file

@ -1162,7 +1162,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
for (i = 1; i <= current->sps_num_subpics_minus1; i++) {
if (!current->sps_subpic_same_size_flag) {
if (current->sps_pic_width_max_in_luma_samples > ctb_size_y) {
const unsigned int win_right_edge =
const int win_right_edge =
current->sps_pic_width_max_in_luma_samples
- current->sps_conf_win_right_offset * sub_width_c;
us(wlen, sps_subpic_ctu_top_left_x[i], 0,
@ -1172,7 +1172,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
infer(sps_subpic_ctu_top_left_x[i], 0);
if (current->sps_pic_height_max_in_luma_samples >
ctb_size_y) {
const unsigned int win_bottom_edge =
const int win_bottom_edge =
current->sps_pic_height_max_in_luma_samples
- current->sps_conf_win_bottom_offset * sub_height_c;
us(hlen, sps_subpic_ctu_top_left_y[i], 0,
@ -1183,9 +1183,9 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
if (i < current->sps_num_subpics_minus1 &&
current->sps_pic_width_max_in_luma_samples >
ctb_size_y) {
const unsigned int win_left_edge =
const int win_left_edge =
current->sps_conf_win_left_offset * sub_width_c;
const unsigned int win_left_edge_ctus =
const int win_left_edge_ctus =
AV_CEIL_RSHIFT(win_left_edge, ctb_log2_size_y);
us(wlen, sps_subpic_width_minus1[i],
win_left_edge_ctus > current->sps_subpic_ctu_top_left_x[i]
@ -1200,9 +1200,9 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
if (i < current->sps_num_subpics_minus1 &&
current->sps_pic_height_max_in_luma_samples >
ctb_size_y) {
const unsigned int win_top_edge =
const int win_top_edge =
current->sps_conf_win_top_offset * sub_height_c;
const unsigned int win_top_edge_ctus =
const int win_top_edge_ctus =
AV_CEIL_RSHIFT(win_top_edge, ctb_log2_size_y);
us(hlen, sps_subpic_height_minus1[i],
win_top_edge_ctus > current->sps_subpic_ctu_top_left_y[i]

View file

@ -375,7 +375,7 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
superframe_header = frag->data[frag->data_size - 1];
if ((superframe_header & 0xe0) == 0xc0) {
VP9RawSuperframeIndex sfi;
VP9RawSuperframeIndex sfi = {0};
GetBitContext gbc;
size_t index_size, pos;
int i;

View file

@ -285,7 +285,7 @@ static av_cold int cfhd_encode_init(AVCodecContext *avctx)
s->plane[i].dwt_buf =
av_calloc(h8 * 8 * w8 * 8, sizeof(*s->plane[i].dwt_buf));
s->plane[i].dwt_tmp =
av_malloc_array(h8 * 8 * w8 * 8, sizeof(*s->plane[i].dwt_tmp));
av_calloc(h8 * 8 * w8 * 8, sizeof(*s->plane[i].dwt_tmp));
if (!s->plane[i].dwt_buf || !s->plane[i].dwt_tmp)
return AVERROR(ENOMEM);

View file

@ -2697,7 +2697,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_AUDIO,
.name = "aac",
.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
.props = AV_CODEC_PROP_LOSSY,
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
},
{
@ -3031,7 +3031,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_AUDIO,
.name = "aac_latm",
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
.props = AV_CODEC_PROP_LOSSY,
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
},
{

View file

@ -1466,8 +1466,8 @@ static int side_data_map(AVFrame *dst,
{
for (int i = 0; map[i].packet < AV_PKT_DATA_NB; i++) {
const enum AVFrameSideDataType type_pkt = map[i].packet;
const enum AVFrameSideDataType type_frame = map[i].frame;
const enum AVPacketSideDataType type_pkt = map[i].packet;
const enum AVFrameSideDataType type_frame = map[i].frame;
const AVPacketSideData *sd_pkt;
AVFrameSideData *sd_frame;
@ -1671,22 +1671,49 @@ static void update_frame_props(AVCodecContext *avctx, AVFrame *frame)
}
}
static void attach_post_process_data(AVCodecContext *avctx, AVFrame *frame)
static int attach_post_process_data(AVCodecContext *avctx, AVFrame *frame)
{
AVCodecInternal *avci = avctx->internal;
DecodeContext *dc = decode_ctx(avci);
if (dc->lcevc_frame) {
FrameDecodeData *fdd = (FrameDecodeData*)frame->private_ref->data;
FFLCEVCFrame *frame_ctx;
int ret;
fdd->post_process_opaque = ff_refstruct_ref(dc->lcevc);
fdd->post_process_opaque_free = ff_lcevc_unref;
fdd->post_process = ff_lcevc_process;
frame_ctx = av_mallocz(sizeof(*frame_ctx));
if (!frame_ctx)
return AVERROR(ENOMEM);
frame_ctx->frame = av_frame_alloc();
if (!frame_ctx->frame) {
av_free(frame_ctx);
return AVERROR(ENOMEM);
}
frame_ctx->lcevc = ff_refstruct_ref(dc->lcevc);
frame_ctx->frame->width = frame->width;
frame_ctx->frame->height = frame->height;
frame_ctx->frame->format = frame->format;
frame->width = dc->width;
frame->height = dc->height;
ret = avctx->get_buffer2(avctx, frame_ctx->frame, 0);
if (ret < 0) {
ff_lcevc_unref(frame_ctx);
return ret;
}
validate_avframe_allocation(avctx, frame_ctx->frame);
fdd->post_process_opaque = frame_ctx;
fdd->post_process_opaque_free = ff_lcevc_unref;
fdd->post_process = ff_lcevc_process;
}
dc->lcevc_frame = 0;
return 0;
}
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
@ -1747,7 +1774,9 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
if (ret < 0)
goto fail;
attach_post_process_data(avctx, frame);
ret = attach_post_process_data(avctx, frame);
if (ret < 0)
goto fail;
end:
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions &&

View file

@ -178,7 +178,8 @@ static int tgq_decode_mb(TgqContext *s, GetByteContext *gbyte,
dc[4] = bytestream2_get_byte(gbyte);
dc[5] = bytestream2_get_byte(gbyte);
} else if (mode == 6) {
bytestream2_get_buffer(gbyte, dc, 6);
if (bytestream2_get_buffer(gbyte, dc, 6) != 6)
return AVERROR_INVALIDDATA;
} else if (mode == 12) {
for (i = 0; i < 6; i++) {
dc[i] = bytestream2_get_byte(gbyte);

View file

@ -119,6 +119,13 @@ av_cold int ff_ffv1_init_slices_state(FFV1Context *f)
return 0;
}
int ff_need_new_slices(int width, int num_h_slices, int chroma_shift) {
int mpw = 1<<chroma_shift;
int i = width * (int64_t)(num_h_slices - 1) / num_h_slices;
return width % mpw && (width - i) % mpw == 0;
}
av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
{
int max_slice_count = f->num_h_slices * f->num_v_slices;
@ -144,6 +151,8 @@ av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
sc->slice_height = sye - sys;
sc->slice_x = sxs;
sc->slice_y = sys;
sc->sx = sx;
sc->sy = sy;
sc->sample_buffer = av_malloc_array((f->width + 6), 3 * MAX_PLANES *
sizeof(*sc->sample_buffer));

View file

@ -44,6 +44,8 @@
#define CONTEXT_SIZE 32
#define MAX_QUANT_TABLES 8
#define MAX_QUANT_TABLE_SIZE 256
#define MAX_QUANT_TABLE_MASK (MAX_QUANT_TABLE_SIZE - 1)
#define MAX_CONTEXT_INPUTS 5
#define AC_GOLOMB_RICE 0
@ -75,6 +77,7 @@ typedef struct FFV1SliceContext {
int slice_height;
int slice_x;
int slice_y;
int sx, sy;
int run_index;
int slice_coding_mode;
@ -122,7 +125,7 @@ typedef struct FFV1Context {
const AVFrame *cur_enc_frame;
int plane_count;
int ac; ///< 1=range coder <-> 0=golomb rice
int16_t quant_tables[MAX_QUANT_TABLES][MAX_CONTEXT_INPUTS][256];
int16_t quant_tables[MAX_QUANT_TABLES][MAX_CONTEXT_INPUTS][MAX_QUANT_TABLE_SIZE];
int context_count[MAX_QUANT_TABLES];
uint8_t state_transition[256];
uint8_t (*initial_states[MAX_QUANT_TABLES])[32];
@ -170,6 +173,7 @@ PlaneContext *ff_ffv1_planes_alloc(void);
int ff_ffv1_allocate_initial_states(FFV1Context *f);
void ff_ffv1_clear_slice_state(const FFV1Context *f, FFV1SliceContext *sc);
int ff_ffv1_close(AVCodecContext *avctx);
int ff_need_new_slices(int width, int num_h_slices, int chroma_shift);
static av_always_inline int fold(int diff, int bits)
{

View file

@ -29,7 +29,7 @@ static inline int RENAME(predict)(TYPE *src, TYPE *last)
return mid_pred(L, L + T - LT, T);
}
static inline int RENAME(get_context)(const int16_t quant_table[MAX_CONTEXT_INPUTS][256],
static inline int RENAME(get_context)(const int16_t quant_table[MAX_CONTEXT_INPUTS][MAX_QUANT_TABLE_SIZE],
TYPE *src, TYPE *last, TYPE *last2)
{
const int LT = last[-1];
@ -40,14 +40,14 @@ static inline int RENAME(get_context)(const int16_t quant_table[MAX_CONTEXT_INPU
if (quant_table[3][127] || quant_table[4][127]) {
const int TT = last2[0];
const int LL = src[-2];
return quant_table[0][(L - LT) & 0xFF] +
quant_table[1][(LT - T) & 0xFF] +
quant_table[2][(T - RT) & 0xFF] +
quant_table[3][(LL - L) & 0xFF] +
quant_table[4][(TT - T) & 0xFF];
return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] +
quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] +
quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK] +
quant_table[3][(LL - L) & MAX_QUANT_TABLE_MASK] +
quant_table[4][(TT - T) & MAX_QUANT_TABLE_MASK];
} else
return quant_table[0][(L - LT) & 0xFF] +
quant_table[1][(LT - T) & 0xFF] +
quant_table[2][(T - RT) & 0xFF];
return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] +
quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] +
quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK];
}

View file

@ -241,7 +241,7 @@ static int decode_slice_header(const FFV1Context *f,
if (f->version > 3) {
sc->slice_reset_contexts = get_rac(c, state);
sc->slice_coding_mode = get_symbol(c, state, 0);
if (sc->slice_coding_mode != 1) {
if (sc->slice_coding_mode != 1 && f->colorspace == 1) {
sc->slice_rct_by_coef = get_symbol(c, state, 0);
sc->slice_rct_ry_coef = get_symbol(c, state, 0);
if ((uint64_t)sc->slice_rct_by_coef + (uint64_t)sc->slice_rct_ry_coef > 4) {
@ -347,7 +347,7 @@ static int decode_slice(AVCodecContext *c, void *arg)
if (f->ac != AC_GOLOMB_RICE && f->version > 2) {
int v;
get_rac(&sc->c, (uint8_t[]) { 129 });
v = sc->c.bytestream_end - sc->c.bytestream - 2 - 5*f->ec;
v = sc->c.bytestream_end - sc->c.bytestream - 2 - 5*!!f->ec;
if (v) {
av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n", v);
slice_set_damaged(f, sc);

View file

@ -198,7 +198,7 @@ static av_always_inline av_flatten void put_symbol_inline(RangeCoder *c,
} while (0)
if (v) {
const int a = FFABS(v);
const unsigned a = is_signed ? FFABS(v) : v;
const int e = av_log2(a);
put_rac(c, state + 0, 0);
if (e <= 9) {
@ -317,7 +317,7 @@ static void write_quant_table(RangeCoder *c, int16_t *quant_table)
uint8_t state[CONTEXT_SIZE];
memset(state, 128, sizeof(state));
for (i = 1; i < 128; i++)
for (i = 1; i < MAX_QUANT_TABLE_SIZE/2; i++)
if (quant_table[i] != quant_table[i - 1]) {
put_symbol(c, state, i - last - 1, 0);
last = i;
@ -326,7 +326,7 @@ static void write_quant_table(RangeCoder *c, int16_t *quant_table)
}
static void write_quant_tables(RangeCoder *c,
int16_t quant_table[MAX_CONTEXT_INPUTS][256])
int16_t quant_table[MAX_CONTEXT_INPUTS][MAX_QUANT_TABLE_SIZE])
{
int i;
for (i = 0; i < 5; i++)
@ -528,6 +528,11 @@ static av_cold int encode_init(AVCodecContext *avctx)
avctx->slices > 1)
s->version = FFMAX(s->version, 2);
if ((avctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) && s->ac == AC_GOLOMB_RICE) {
av_log(avctx, AV_LOG_ERROR, "2 Pass mode is not possible with golomb coding\n");
return AVERROR(EINVAL);
}
// Unspecified level & slices, we choose version 1.2+ to ensure multithreaded decodability
if (avctx->slices == 0 && avctx->level < 0 && avctx->width * avctx->height > 720*576)
s->version = FFMAX(s->version, 2);
@ -552,7 +557,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->version = FFMAX(s->version, 3);
if ((s->version == 2 || s->version>3) && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
av_log(avctx, AV_LOG_ERROR, "Version 2 needed for requested features but version 2 is experimental and not enabled\n");
av_log(avctx, AV_LOG_ERROR, "Version 2 or 4 needed for requested features but version 2 or 4 is experimental and not enabled\n");
return AVERROR_INVALIDDATA;
}
@ -713,7 +718,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->state_transition[i] = c.one_state[i];
}
for (i = 0; i < 256; i++) {
for (i = 0; i < MAX_QUANT_TABLE_SIZE; i++) {
s->quant_table_count = 2;
if (s->bits_per_raw_sample <= 8) {
s->quant_tables[0][0][i]= quant11[i];
@ -724,19 +729,21 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->quant_tables[1][2][i]= 11*11*quant5 [i];
s->quant_tables[1][3][i]= 5*11*11*quant5 [i];
s->quant_tables[1][4][i]= 5*5*11*11*quant5 [i];
s->context_count[0] = (11 * 11 * 11 + 1) / 2;
s->context_count[1] = (11 * 11 * 5 * 5 * 5 + 1) / 2;
} else {
s->quant_tables[0][0][i]= quant9_10bit[i];
s->quant_tables[0][1][i]= 11*quant9_10bit[i];
s->quant_tables[0][2][i]= 11*11*quant9_10bit[i];
s->quant_tables[0][1][i]= 9*quant9_10bit[i];
s->quant_tables[0][2][i]= 9*9*quant9_10bit[i];
s->quant_tables[1][0][i]= quant9_10bit[i];
s->quant_tables[1][1][i]= 11*quant9_10bit[i];
s->quant_tables[1][2][i]= 11*11*quant5_10bit[i];
s->quant_tables[1][3][i]= 5*11*11*quant5_10bit[i];
s->quant_tables[1][4][i]= 5*5*11*11*quant5_10bit[i];
s->quant_tables[1][1][i]= 9*quant9_10bit[i];
s->quant_tables[1][2][i]= 9*9*quant5_10bit[i];
s->quant_tables[1][3][i]= 5*9*9*quant5_10bit[i];
s->quant_tables[1][4][i]= 5*5*9*9*quant5_10bit[i];
s->context_count[0] = (9 * 9 * 9 + 1) / 2;
s->context_count[1] = (9 * 9 * 5 * 5 * 5 + 1) / 2;
}
}
s->context_count[0] = (11 * 11 * 11 + 1) / 2;
s->context_count[1] = (11 * 11 * 5 * 5 * 5 + 1) / 2;
if ((ret = ff_ffv1_allocate_initial_states(s)) < 0)
return ret;
@ -858,6 +865,10 @@ static av_cold int encode_init(AVCodecContext *avctx)
continue;
if (maxw * maxh * (int64_t)(s->bits_per_raw_sample+1) * plane_count > 8<<24)
continue;
if (s->version < 4)
if ( ff_need_new_slices(avctx->width , s->num_h_slices, s->chroma_h_shift)
||ff_need_new_slices(avctx->height, s->num_v_slices, s->chroma_v_shift))
continue;
if (avctx->slices == s->num_h_slices * s->num_v_slices && avctx->slices <= MAX_SLICES || !avctx->slices)
goto slices_ok;
}
@ -916,10 +927,10 @@ static void encode_slice_header(FFV1Context *f, FFV1SliceContext *sc)
int j;
memset(state, 128, sizeof(state));
put_symbol(c, state, (sc->slice_x +1)*f->num_h_slices / f->width , 0);
put_symbol(c, state, (sc->slice_y +1)*f->num_v_slices / f->height , 0);
put_symbol(c, state, (sc->slice_width +1)*f->num_h_slices / f->width -1, 0);
put_symbol(c, state, (sc->slice_height+1)*f->num_v_slices / f->height-1, 0);
put_symbol(c, state, sc->sx, 0);
put_symbol(c, state, sc->sy, 0);
put_symbol(c, state, 0, 0);
put_symbol(c, state, 0, 0);
for (j=0; j<f->plane_count; j++) {
put_symbol(c, state, sc->plane[j].quant_table_index, 0);
av_assert0(sc->plane[j].quant_table_index == f->context_model);
@ -935,7 +946,7 @@ static void encode_slice_header(FFV1Context *f, FFV1SliceContext *sc)
if (sc->slice_coding_mode == 1)
ff_ffv1_clear_slice_state(f, sc);
put_symbol(c, state, sc->slice_coding_mode, 0);
if (sc->slice_coding_mode != 1) {
if (sc->slice_coding_mode != 1 && f->colorspace == 1) {
put_symbol(c, state, sc->slice_rct_by_coef, 0);
put_symbol(c, state, sc->slice_rct_ry_coef, 0);
}
@ -969,6 +980,9 @@ static void choose_rct_params(const FFV1Context *f, FFV1SliceContext *sc,
int x, y, i, p, best;
int16_t *sample[3];
int lbd = f->bits_per_raw_sample <= 8;
int packed = !src[1];
int transparency = f->transparency;
int packed_size = (3 + transparency)*2;
for (y = 0; y < h; y++) {
int lastr=0, lastg=0, lastb=0;
@ -983,6 +997,15 @@ static void choose_rct_params(const FFV1Context *f, FFV1SliceContext *sc,
b = v & 0xFF;
g = (v >> 8) & 0xFF;
r = (v >> 16) & 0xFF;
} else if (packed) {
const uint16_t *p = ((const uint16_t*)(src[0] + x*packed_size + stride[0]*y));
r = p[0];
g = p[1];
b = p[2];
} else if (f->use32bit || transparency) {
g = *((const uint16_t *)(src[0] + x*2 + stride[0]*y));
b = *((const uint16_t *)(src[1] + x*2 + stride[1]*y));
r = *((const uint16_t *)(src[2] + x*2 + stride[2]*y));
} else {
b = *((const uint16_t*)(src[0] + x*2 + stride[0]*y));
g = *((const uint16_t*)(src[1] + x*2 + stride[1]*y));
@ -1043,7 +1066,7 @@ static int encode_slice(AVCodecContext *c, void *arg)
p->data[3] ? p->data[3] + ps*x + y*p->linesize[3] : NULL};
sc->slice_coding_mode = 0;
if (f->version > 3) {
if (f->version > 3 && f->colorspace == 1) {
choose_rct_params(f, sc, planes, p->linesize, width, height);
} else {
sc->slice_rct_by_coef = 1;
@ -1086,6 +1109,13 @@ retry:
ret = encode_rgb_frame(f, sc, planes, width, height, p->linesize);
}
if (f->ac != AC_GOLOMB_RICE) {
sc->ac_byte_count = ff_rac_terminate(&sc->c, 1);
} else {
flush_put_bits(&sc->pb); // FIXME: nicer padding
sc->ac_byte_count += put_bytes_output(&sc->pb);
}
if (ret < 0) {
av_assert0(sc->slice_coding_mode == 0);
if (f->version < 4 || !f->ac) {
@ -1210,14 +1240,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
buf_p = pkt->data;
for (i = 0; i < f->slice_count; i++) {
FFV1SliceContext *sc = &f->slices[i];
int bytes;
if (f->ac != AC_GOLOMB_RICE) {
bytes = ff_rac_terminate(&sc->c, 1);
} else {
flush_put_bits(&sc->pb); // FIXME: nicer padding
bytes = sc->ac_byte_count + put_bytes_output(&sc->pb);
}
int bytes = sc->ac_byte_count;
if (i > 0 || f->version > 2) {
av_assert0(bytes < pkt->size / f->slice_count);
memmove(buf_p, sc->c.bytestream_start, bytes);

View file

@ -142,7 +142,10 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame)
if (ret < 0)
goto fail;
pool->pools[0] = av_buffer_pool_init(pool->linesize[0], NULL);
pool->pools[0] = av_buffer_pool_init(pool->linesize[0],
CONFIG_MEMORY_POISONING ?
NULL :
av_buffer_allocz);
if (!pool->pools[0]) {
ret = AVERROR(ENOMEM);
goto fail;

View file

@ -431,6 +431,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
MpegEncContext *s = avctx->priv_data;
int ret;
int slice_ret = 0;
int bak_width, bak_height;
/* no supplementary picture */
if (buf_size == 0) {
@ -482,6 +483,9 @@ retry:
if (ret < 0)
return ret;
bak_width = s->width;
bak_height = s->height;
/* let's go :-) */
if (CONFIG_WMV2_DECODER && s->msmpeg4_version == MSMP4_WMV2) {
ret = ff_wmv2_decode_picture_header(s);
@ -501,11 +505,12 @@ retry:
}
if (ret < 0 || ret == FRAME_SKIPPED) {
if ( s->width != avctx->coded_width
|| s->height != avctx->coded_height) {
if ( s->width != bak_width
|| s->height != bak_height) {
av_log(s->avctx, AV_LOG_WARNING, "Reverting picture dimensions change due to header decoding failure\n");
s->width = avctx->coded_width;
s->height= avctx->coded_height;
s->width = bak_width;
s->height= bak_height;
}
}
if (ret == FRAME_SKIPPED)

View file

@ -581,9 +581,11 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
if (codec_id == AV_CODEC_ID_VVC)
ret = vvc_parse_nal_header(nal, logctx);
else if (codec_id == AV_CODEC_ID_HEVC)
else if (codec_id == AV_CODEC_ID_HEVC) {
ret = hevc_parse_nal_header(nal, logctx);
else
if (nal->nuh_layer_id == 63)
continue;
} else
ret = h264_parse_nal_header(nal, logctx);
if (ret < 0) {
av_log(logctx, AV_LOG_WARNING, "Invalid NAL unit %d, skipping.\n",

View file

@ -26,6 +26,7 @@
#include "config_components.h"
#include "libavutil/ambient_viewing_environment.h"
#include "libavutil/buffer.h"
#include "libavutil/display.h"
#include "libavutil/hdr_dynamic_metadata.h"
#include "libavutil/film_grain_params.h"
@ -41,6 +42,7 @@
#include "golomb.h"
#include "h2645_sei.h"
#include "itut35.h"
#include "refstruct.h"
#define IS_H264(codec_id) (CONFIG_H264_SEI && CONFIG_HEVC_SEI ? codec_id == AV_CODEC_ID_H264 : CONFIG_H264_SEI)
#define IS_HEVC(codec_id) (CONFIG_H264_SEI && CONFIG_HEVC_SEI ? codec_id == AV_CODEC_ID_HEVC : CONFIG_HEVC_SEI)
@ -494,7 +496,11 @@ int ff_h2645_sei_message_decode(H2645SEI *h, enum SEIType type,
case SEI_TYPE_DISPLAY_ORIENTATION:
return decode_display_orientation(&h->display_orientation, gb);
case SEI_TYPE_FILM_GRAIN_CHARACTERISTICS:
return decode_film_grain_characteristics(&h->film_grain_characteristics, codec_id, gb);
ff_refstruct_unref(&h->film_grain_characteristics);
h->film_grain_characteristics = ff_refstruct_allocz(sizeof(*h->film_grain_characteristics));
if (!h->film_grain_characteristics)
return AVERROR(ENOMEM);
return decode_film_grain_characteristics(h->film_grain_characteristics, codec_id, gb);
case SEI_TYPE_FRAME_PACKING_ARRANGEMENT:
return decode_frame_packing_arrangement(&h->frame_packing, gb, codec_id);
case SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
@ -542,6 +548,17 @@ int ff_h2645_sei_ctx_replace(H2645SEI *dst, const H2645SEI *src)
}
}
for (unsigned i = 0; i < FF_ARRAY_ELEMS(dst->aom_film_grain.sets); i++) {
ret = av_buffer_replace(&dst->aom_film_grain.sets[i],
src->aom_film_grain.sets[i]);
if (ret < 0)
return ret;
}
dst->aom_film_grain.enable = src->aom_film_grain.enable;
ff_refstruct_replace(&dst->film_grain_characteristics,
src->film_grain_characteristics);
return 0;
}
@ -811,8 +828,8 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
return ret;
}
if (sei->film_grain_characteristics.present) {
H2645SEIFilmGrainCharacteristics *fgc = &sei->film_grain_characteristics;
if (sei->film_grain_characteristics && sei->film_grain_characteristics->present) {
H2645SEIFilmGrainCharacteristics *fgc = sei->film_grain_characteristics;
AVFilmGrainParams *fgp = av_film_grain_params_create_side_data(frame);
AVFilmGrainH274Params *h274;
@ -913,5 +930,7 @@ void ff_h2645_sei_reset(H2645SEI *s)
s->ambient_viewing_environment.present = 0;
s->mastering_display.present = 0;
s->content_light.present = 0;
s->aom_film_grain.enable = 0;
ff_refstruct_unref(&s->film_grain_characteristics);
ff_aom_uninit_film_grain_params(&s->aom_film_grain);
}

View file

@ -135,11 +135,13 @@ typedef struct H2645SEI {
H2645SEIFramePacking frame_packing;
H2645SEIDisplayOrientation display_orientation;
H2645SEIAlternativeTransfer alternative_transfer;
H2645SEIFilmGrainCharacteristics film_grain_characteristics;
H2645SEIAmbientViewingEnvironment ambient_viewing_environment;
H2645SEIMasteringDisplay mastering_display;
H2645SEIContentLight content_light;
AVFilmGrainAFGS1Params aom_film_grain;
// Dynamic allocations due to large size.
H2645SEIFilmGrainCharacteristics *film_grain_characteristics;
} H2645SEI;
enum {

View file

@ -407,7 +407,7 @@ static av_always_inline void mc_part_weighted(const H264Context *h, H264SliceCon
/* don't optimize for luma-only case, since B-frames usually
* use implicit weights => chroma too. */
uint8_t *tmp_cb = sl->bipred_scratchpad;
uint8_t *tmp_cr = sl->bipred_scratchpad + (16 << pixel_shift);
uint8_t *tmp_cr = sl->bipred_scratchpad + (8 << pixel_shift + (chroma_idc == 3));
uint8_t *tmp_y = sl->bipred_scratchpad + 16 * sl->mb_uvlinesize;
int refn0 = sl->ref_cache[0][scan8[n]];
int refn1 = sl->ref_cache[1][scan8[n]];

View file

@ -55,7 +55,6 @@ void ff_h264_sei_uninit(H264SEIContext *h)
h->picture_timing.present = 0;
h->buffering_period.present = 0;
h->common.frame_packing.present = 0;
h->common.film_grain_characteristics.present = 0;
h->common.display_orientation.present = 0;
h->common.afd.present = 0;

View file

@ -191,6 +191,13 @@ static int alloc_picture(H264Context *h, H264Picture *pic)
av_assert0(!pic->f->data[0]);
if (h->sei.common.lcevc.info) {
HEVCSEILCEVC *lcevc = &h->sei.common.lcevc;
ret = ff_frame_new_side_data_from_buf(h->avctx, pic->f, AV_FRAME_DATA_LCEVC, &lcevc->info);
if (ret < 0)
return ret;
}
pic->tf.f = pic->f;
ret = ff_thread_get_ext_buffer(h->avctx, &pic->tf,
pic->reference ? AV_GET_BUFFER_FLAG_REF : 0);
@ -516,7 +523,10 @@ static int h264_frame_start(H264Context *h)
pic->f->crop_top = h->crop_top;
pic->f->crop_bottom = h->crop_bottom;
pic->needs_fg = h->sei.common.film_grain_characteristics.present && !h->avctx->hwaccel &&
pic->needs_fg =
h->sei.common.film_grain_characteristics &&
h->sei.common.film_grain_characteristics->present &&
!h->avctx->hwaccel &&
!(h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN);
if ((ret = alloc_picture(h, pic)) < 0)

View file

@ -310,6 +310,7 @@ static int hap_decode(AVCodecContext *avctx, AVFrame *frame,
ret = av_reallocp(&ctx->tex_buf, ctx->tex_size);
if (ret < 0)
return ret;
memset(ctx->tex_buf, 0, ctx->tex_size);
avctx->execute2(avctx, decompress_chunks_thread, NULL,
ctx->chunk_results, ctx->chunk_count);

View file

@ -54,6 +54,7 @@
#include "progressframe.h"
#include "refstruct.h"
#include "thread.h"
#include "threadprogress.h"
static const uint8_t hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 };
@ -128,7 +129,7 @@ static int pic_arrays_init(HEVCLayerContext *l, const HEVCSPS *sps)
l->filter_slice_edges = av_mallocz(ctb_count);
l->tab_slice_address = av_malloc_array(pic_size_in_ctb,
sizeof(*l->tab_slice_address));
l->qp_y_tab = av_malloc_array(pic_size_in_ctb,
l->qp_y_tab = av_calloc(pic_size_in_ctb,
sizeof(*l->qp_y_tab));
if (!l->qp_y_tab || !l->filter_slice_edges || !l->tab_slice_address)
goto fail;
@ -411,7 +412,7 @@ static int export_stream_params_from_sei(HEVCContext *s)
avctx->color_trc = s->sei.common.alternative_transfer.preferred_transfer_characteristics;
}
if (s->sei.common.film_grain_characteristics.present ||
if ((s->sei.common.film_grain_characteristics && s->sei.common.film_grain_characteristics->present) ||
s->sei.common.aom_film_grain.enable)
avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
@ -2751,6 +2752,8 @@ static int hls_decode_entry_wpp(AVCodecContext *avctx, void *hevc_lclist,
const uint8_t *data = s->data + s->sh.offset[ctb_row];
const size_t data_size = s->sh.size[ctb_row];
int progress = 0;
int ret;
if (ctb_row)
@ -2762,13 +2765,15 @@ static int hls_decode_entry_wpp(AVCodecContext *avctx, void *hevc_lclist,
hls_decode_neighbour(lc, l, pps, sps, x_ctb, y_ctb, ctb_addr_ts);
ff_thread_await_progress2(s->avctx, ctb_row, thread, SHIFT_CTB_WPP);
if (ctb_row)
ff_thread_progress_await(&s->wpp_progress[ctb_row - 1],
progress + SHIFT_CTB_WPP + 1);
/* atomic_load's prototype requires a pointer to non-const atomic variable
* (due to implementations via mutexes, where reads involve writes).
* Of course, casting const away here is nevertheless safe. */
if (atomic_load((atomic_int*)&s->wpp_err)) {
ff_thread_report_progress2(s->avctx, ctb_row , thread, SHIFT_CTB_WPP);
ff_thread_progress_report(&s->wpp_progress[ctb_row], INT_MAX);
return 0;
}
@ -2792,19 +2797,19 @@ static int hls_decode_entry_wpp(AVCodecContext *avctx, void *hevc_lclist,
ctb_addr_ts++;
ff_hevc_save_states(lc, pps, ctb_addr_ts);
ff_thread_report_progress2(s->avctx, ctb_row, thread, 1);
ff_thread_progress_report(&s->wpp_progress[ctb_row], ++progress);
ff_hevc_hls_filters(lc, l, pps, x_ctb, y_ctb, ctb_size);
if (!more_data && (x_ctb+ctb_size) < sps->width && ctb_row != s->sh.num_entry_point_offsets) {
/* Casting const away here is safe, because it is an atomic operation. */
atomic_store((atomic_int*)&s->wpp_err, 1);
ff_thread_report_progress2(s->avctx, ctb_row ,thread, SHIFT_CTB_WPP);
ff_thread_progress_report(&s->wpp_progress[ctb_row], INT_MAX);
return 0;
}
if ((x_ctb+ctb_size) >= sps->width && (y_ctb+ctb_size) >= sps->height ) {
ff_hevc_hls_filter(lc, l, pps, x_ctb, y_ctb, ctb_size);
ff_thread_report_progress2(s->avctx, ctb_row , thread, SHIFT_CTB_WPP);
ff_thread_progress_report(&s->wpp_progress[ctb_row], INT_MAX);
return ctb_addr_ts;
}
ctb_addr_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts];
@ -2814,17 +2819,43 @@ static int hls_decode_entry_wpp(AVCodecContext *avctx, void *hevc_lclist,
break;
}
}
ff_thread_report_progress2(s->avctx, ctb_row ,thread, SHIFT_CTB_WPP);
ff_thread_progress_report(&s->wpp_progress[ctb_row], INT_MAX);
return 0;
error:
l->tab_slice_address[ctb_addr_rs] = -1;
/* Casting const away here is safe, because it is an atomic operation. */
atomic_store((atomic_int*)&s->wpp_err, 1);
ff_thread_report_progress2(s->avctx, ctb_row ,thread, SHIFT_CTB_WPP);
ff_thread_progress_report(&s->wpp_progress[ctb_row], INT_MAX);
return ret;
}
static int wpp_progress_init(HEVCContext *s, unsigned count)
{
if (s->nb_wpp_progress < count) {
void *tmp = av_realloc_array(s->wpp_progress, count,
sizeof(*s->wpp_progress));
if (!tmp)
return AVERROR(ENOMEM);
s->wpp_progress = tmp;
memset(s->wpp_progress + s->nb_wpp_progress, 0,
(count - s->nb_wpp_progress) * sizeof(*s->wpp_progress));
for (int i = s->nb_wpp_progress; i < count; i++) {
int ret = ff_thread_progress_init(&s->wpp_progress[i], 1);
if (ret < 0)
return ret;
s->nb_wpp_progress = i + 1;
}
}
for (int i = 0; i < count; i++)
ff_thread_progress_reset(&s->wpp_progress[i]);
return 0;
}
static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
{
const HEVCPPS *const pps = s->pps;
@ -2909,7 +2940,7 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
}
atomic_store(&s->wpp_err, 0);
res = ff_slice_thread_allocz_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
res = wpp_progress_init(s, s->sh.num_entry_point_offsets + 1);
if (res < 0)
return res;
@ -3236,7 +3267,8 @@ static int hevc_frame_start(HEVCContext *s, HEVCLayerContext *l,
else
s->cur_frame->f->flags &= ~AV_FRAME_FLAG_KEY;
s->cur_frame->needs_fg = (s->sei.common.film_grain_characteristics.present ||
s->cur_frame->needs_fg = ((s->sei.common.film_grain_characteristics &&
s->sei.common.film_grain_characteristics->present) ||
s->sei.common.aom_film_grain.enable) &&
!(s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) &&
!s->avctx->hwaccel;
@ -3246,8 +3278,8 @@ static int hevc_frame_start(HEVCContext *s, HEVCLayerContext *l,
goto fail;
if (s->cur_frame->needs_fg &&
(s->sei.common.film_grain_characteristics.present &&
!ff_h274_film_grain_params_supported(s->sei.common.film_grain_characteristics.model_id,
(s->sei.common.film_grain_characteristics && s->sei.common.film_grain_characteristics->present &&
!ff_h274_film_grain_params_supported(s->sei.common.film_grain_characteristics->model_id,
s->cur_frame->f->format) ||
!av_film_grain_params_select(s->cur_frame->f))) {
av_log_once(s->avctx, AV_LOG_WARNING, AV_LOG_DEBUG, &s->film_grain_warning_shown,
@ -3826,6 +3858,10 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx)
ff_hevc_ps_uninit(&s->ps);
for (int i = 0; i < s->nb_wpp_progress; i++)
ff_thread_progress_destroy(&s->wpp_progress[i]);
av_freep(&s->wpp_progress);
av_freep(&s->sh.entry_point_offset);
av_freep(&s->sh.offset);
av_freep(&s->sh.size);
@ -3969,7 +4005,6 @@ static int hevc_update_thread_context(AVCodecContext *dst,
s->sei.common.alternative_transfer = s0->sei.common.alternative_transfer;
s->sei.common.mastering_display = s0->sei.common.mastering_display;
s->sei.common.content_light = s0->sei.common.content_light;
s->sei.common.aom_film_grain = s0->sei.common.aom_film_grain;
s->sei.tdrdi = s0->sei.tdrdi;
return 0;
@ -3981,12 +4016,6 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
HEVCContext *s = avctx->priv_data;
int ret;
if (avctx->active_thread_type & FF_THREAD_SLICE) {
ret = ff_slice_thread_init_progress(avctx);
if (ret < 0)
return ret;
}
ret = hevc_init_context(avctx);
if (ret < 0)
return ret;

View file

@ -540,6 +540,9 @@ typedef struct HEVCContext {
/** The target for the common_cabac_state of the local contexts. */
HEVCCABACState cabac;
struct ThreadProgress *wpp_progress;
unsigned nb_wpp_progress;
atomic_int wpp_err;
const uint8_t *data;

View file

@ -612,8 +612,8 @@ static int decode_vps_ext(GetBitContext *gb, AVCodecContext *avctx, HEVCVPS *vps
}
/* Consequence of established layer dependencies */
if (layer1_id_included != ((1 << vps->layer_id_in_nuh[0]) |
(1 << vps->layer_id_in_nuh[1]))) {
if (layer1_id_included != ((1ULL << vps->layer_id_in_nuh[0]) |
(1ULL << vps->layer_id_in_nuh[1]))) {
av_log(avctx, AV_LOG_ERROR, "Dependent layer not included in layer ID?\n");
return AVERROR_PATCHWELCOME;
}

View file

@ -84,14 +84,14 @@ typedef struct HEVCSEITDRDI {
uint8_t ref_viewing_distance_flag;
uint8_t prec_ref_viewing_dist;
uint8_t num_ref_displays;
uint16_t left_view_id[31];
uint16_t right_view_id[31];
uint8_t exponent_ref_display_width[31];
uint8_t mantissa_ref_display_width[31];
uint8_t exponent_ref_viewing_distance[31];
uint8_t mantissa_ref_viewing_distance[31];
uint8_t additional_shift_present_flag[31];
int16_t num_sample_shift[31];
uint16_t left_view_id[32];
uint16_t right_view_id[32];
uint8_t exponent_ref_display_width[32];
uint8_t mantissa_ref_display_width[32];
uint8_t exponent_ref_viewing_distance[32];
uint8_t mantissa_ref_viewing_distance[32];
uint8_t additional_shift_present_flag[32];
int16_t num_sample_shift[32];
uint8_t three_dimensional_reference_displays_extension_flag;
} HEVCSEITDRDI;

View file

@ -783,6 +783,8 @@ static void decode_gray_bitstream(HYuvDecContext *s, int count)
for (i = 0; i < count && BITS_LEFT(re, &s->gb) > 0; i++) {
READ_2PIX(s->temp[0][2 * i], s->temp[0][2 * i + 1], 0);
}
for (; i < count; i++)
s->temp[0][2 * i] = s->temp[0][2 * i + 1] = 0;
} else {
for (i = 0; i < count; i++) {
READ_2PIX(s->temp[0][2 * i], s->temp[0][2 * i + 1], 0);

View file

@ -658,7 +658,7 @@ static void get_codebook(int16_t * cbvec, /* (o) Constructed codebook vector *
int16_t k, base_size;
int16_t lag;
/* Stack based */
int16_t tempbuff2[SUBL + 5];
int16_t tempbuff2[SUBL + 5] = {0};
/* Determine size of codebook sections */
base_size = lMem - cbveclen + 1;

View file

@ -352,6 +352,8 @@ static int decode_hybrid_varlen_uint(GetBitContext *gb, JXLEntropyDecoder *dec,
if (bundle->lz77_enabled && token >= bundle->lz77_min_symbol) {
const JXLSymbolDistribution *lz77dist = &bundle->dists[bundle->cluster_map[bundle->num_dist - 1]];
if (!dec->num_decoded)
return AVERROR_INVALIDDATA;
ret = read_hybrid_uint(gb, &bundle->lz_len_conf, token - bundle->lz77_min_symbol, &dec->num_to_copy);
if (ret < 0)
return ret;
@ -531,6 +533,7 @@ static int read_dist_clustering(GetBitContext *gb, JXLEntropyDecoder *dec, JXLDi
dec->state = -1;
/* it's not going to necessarily be zero after reading */
dec->num_to_copy = 0;
dec->num_decoded = 0;
dist_bundle_close(&nested);
if (use_mtf) {
uint8_t mtf[256];
@ -1311,7 +1314,7 @@ static int parse_frame_header(void *avctx, JXLParseContext *ctx, GetBitContext *
// permuted toc
if (get_bits1(gb)) {
JXLEntropyDecoder dec;
uint32_t end, lehmer = 0;
int64_t end, lehmer = 0;
ret = entropy_decoder_init(avctx, gb, &dec, 8);
if (ret < 0)
return ret;
@ -1320,13 +1323,13 @@ static int parse_frame_header(void *avctx, JXLParseContext *ctx, GetBitContext *
return AVERROR_BUFFER_TOO_SMALL;
}
end = entropy_decoder_read_symbol(gb, &dec, toc_context(toc_count));
if (end > toc_count) {
if (end < 0 || end > toc_count) {
entropy_decoder_close(&dec);
return AVERROR_INVALIDDATA;
}
for (uint32_t i = 0; i < end; i++) {
lehmer = entropy_decoder_read_symbol(gb, &dec, toc_context(lehmer));
if (get_bits_left(gb) < 0) {
if (lehmer < 0 || get_bits_left(gb) < 0) {
entropy_decoder_close(&dec);
return AVERROR_BUFFER_TOO_SMALL;
}

View file

@ -45,7 +45,7 @@ static LCEVC_ColorFormat map_format(int format)
return LCEVC_ColorFormat_Unknown;
}
static int alloc_base_frame(void *logctx, LCEVC_DecoderHandle decoder,
static int alloc_base_frame(void *logctx, FFLCEVCContext *lcevc,
const AVFrame *frame, LCEVC_PictureHandle *picture)
{
LCEVC_PictureDesc desc;
@ -68,22 +68,22 @@ static int alloc_base_frame(void *logctx, LCEVC_DecoderHandle decoder,
desc.sampleAspectRatioDen = frame->sample_aspect_ratio.den;
/* Allocate LCEVC Picture */
res = LCEVC_AllocPicture(decoder, &desc, picture);
res = LCEVC_AllocPicture(lcevc->decoder, &desc, picture);
if (res != LCEVC_Success) {
return AVERROR_EXTERNAL;
}
res = LCEVC_LockPicture(decoder, *picture, LCEVC_Access_Write, &lock);
res = LCEVC_LockPicture(lcevc->decoder, *picture, LCEVC_Access_Write, &lock);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
res = LCEVC_GetPicturePlaneCount(decoder, *picture, &planes);
res = LCEVC_GetPicturePlaneCount(lcevc->decoder, *picture, &planes);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
for (unsigned i = 0; i < planes; i++) {
LCEVC_PicturePlaneDesc plane;
res = LCEVC_GetPictureLockPlaneDesc(decoder, lock, i, &plane);
res = LCEVC_GetPictureLockPlaneDesc(lcevc->decoder, lock, i, &plane);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
@ -94,43 +94,43 @@ static int alloc_base_frame(void *logctx, LCEVC_DecoderHandle decoder,
av_image_copy2(data, linesizes, frame->data, frame->linesize,
frame->format, frame->width, frame->height);
res = LCEVC_UnlockPicture(decoder, lock);
res = LCEVC_UnlockPicture(lcevc->decoder, lock);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
return 0;
}
static int alloc_enhanced_frame(void *logctx, LCEVC_DecoderHandle decoder,
const AVFrame *frame, LCEVC_PictureHandle *picture)
static int alloc_enhanced_frame(void *logctx, FFLCEVCFrame *frame_ctx,
LCEVC_PictureHandle *picture)
{
FFLCEVCContext *lcevc = frame_ctx->lcevc;
LCEVC_PictureDesc desc ;
LCEVC_ColorFormat fmt = map_format(frame->format);
LCEVC_ColorFormat fmt = map_format(frame_ctx->frame->format);
LCEVC_PicturePlaneDesc planes[4] = { 0 };
int width = frame->width * 2 / FFMAX(frame->sample_aspect_ratio.den, 1);
int height = frame->height * 2 / FFMAX(frame->sample_aspect_ratio.num, 1);
LCEVC_ReturnCode res;
res = LCEVC_DefaultPictureDesc(&desc, fmt, width, height);
res = LCEVC_DefaultPictureDesc(&desc, fmt, frame_ctx->frame->width, frame_ctx->frame->height);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
/* Set plane description */
for (int i = 0; i < 4; i++) {
planes[i].firstSample = frame->data[i];
planes[i].rowByteStride = frame->linesize[i];
planes[i].firstSample = frame_ctx->frame->data[i];
planes[i].rowByteStride = frame_ctx->frame->linesize[i];
}
/* Allocate LCEVC Picture */
res = LCEVC_AllocPictureExternal(decoder, &desc, NULL, planes, picture);
res = LCEVC_AllocPictureExternal(lcevc->decoder, &desc, NULL, planes, picture);
if (res != LCEVC_Success) {
return AVERROR_EXTERNAL;
}
return 0;
}
static int lcevc_send_frame(void *logctx, FFLCEVCContext *lcevc, const AVFrame *in)
static int lcevc_send_frame(void *logctx, FFLCEVCFrame *frame_ctx, const AVFrame *in)
{
FFLCEVCContext *lcevc = frame_ctx->lcevc;
const AVFrameSideData *sd = av_frame_get_side_data(in, AV_FRAME_DATA_LCEVC);
LCEVC_PictureHandle picture;
LCEVC_ReturnCode res;
@ -143,7 +143,7 @@ static int lcevc_send_frame(void *logctx, FFLCEVCContext *lcevc, const AVFrame *
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
ret = alloc_base_frame(logctx, lcevc->decoder, in, &picture);
ret = alloc_base_frame(logctx, lcevc, in, &picture);
if (ret < 0)
return ret;
@ -152,7 +152,7 @@ static int lcevc_send_frame(void *logctx, FFLCEVCContext *lcevc, const AVFrame *
return AVERROR_EXTERNAL;
memset(&picture, 0, sizeof(picture));
ret = alloc_enhanced_frame(logctx, lcevc->decoder, in, &picture);
ret = alloc_enhanced_frame(logctx, frame_ctx, &picture);
if (ret < 0)
return ret;
@ -163,8 +163,9 @@ static int lcevc_send_frame(void *logctx, FFLCEVCContext *lcevc, const AVFrame *
return 0;
}
static int generate_output(void *logctx, FFLCEVCContext *lcevc, AVFrame *out)
static int generate_output(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
{
FFLCEVCContext *lcevc = frame_ctx->lcevc;
LCEVC_PictureDesc desc;
LCEVC_DecodeInformation info;
LCEVC_PictureHandle picture;
@ -184,6 +185,11 @@ static int generate_output(void *logctx, FFLCEVCContext *lcevc, AVFrame *out)
out->crop_right = desc.cropRight;
out->sample_aspect_ratio.num = desc.sampleAspectRatioNum;
out->sample_aspect_ratio.den = desc.sampleAspectRatioDen;
av_frame_copy_props(frame_ctx->frame, out);
av_frame_unref(out);
av_frame_move_ref(out, frame_ctx->frame);
out->width = desc.width + out->crop_left + out->crop_right;
out->height = desc.height + out->crop_top + out->crop_bottom;
@ -194,13 +200,14 @@ static int generate_output(void *logctx, FFLCEVCContext *lcevc, AVFrame *out)
return 0;
}
static int lcevc_receive_frame(void *logctx, FFLCEVCContext *lcevc, AVFrame *out)
static int lcevc_receive_frame(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
{
FFLCEVCContext *lcevc = frame_ctx->lcevc;
LCEVC_PictureHandle picture;
LCEVC_ReturnCode res;
int ret;
ret = generate_output(logctx, lcevc, out);
ret = generate_output(logctx, frame_ctx, out);
if (ret < 0)
return ret;
@ -247,12 +254,7 @@ static int lcevc_init(FFLCEVCContext *lcevc, void *logctx)
#if CONFIG_LIBLCEVC_DEC
LCEVC_AccelContextHandle dummy = { 0 };
const int32_t event = LCEVC_Log;
#endif
if (lcevc->initialized)
return 0;
#if CONFIG_LIBLCEVC_DEC
if (LCEVC_CreateDecoder(&lcevc->decoder, dummy) != LCEVC_Success) {
av_log(logctx, AV_LOG_ERROR, "Failed to create LCEVC decoder\n");
return AVERROR_EXTERNAL;
@ -277,7 +279,8 @@ static int lcevc_init(FFLCEVCContext *lcevc, void *logctx)
int ff_lcevc_process(void *logctx, AVFrame *frame)
{
FrameDecodeData *fdd = (FrameDecodeData*)frame->private_ref->data;
FFLCEVCContext *lcevc = fdd->post_process_opaque;
FFLCEVCFrame *frame_ctx = fdd->post_process_opaque;
FFLCEVCContext *lcevc = frame_ctx->lcevc;
int ret;
if (!lcevc->initialized) {
@ -287,11 +290,14 @@ int ff_lcevc_process(void *logctx, AVFrame *frame)
}
#if CONFIG_LIBLCEVC_DEC
ret = lcevc_send_frame(logctx, lcevc, frame);
av_assert0(frame_ctx->frame);
ret = lcevc_send_frame(logctx, frame_ctx, frame);
if (ret)
return ret < 0 ? ret : 0;
lcevc_receive_frame(logctx, lcevc, frame);
lcevc_receive_frame(logctx, frame_ctx, frame);
if (ret < 0)
return ret;
@ -315,5 +321,8 @@ int ff_lcevc_alloc(FFLCEVCContext **plcevc)
void ff_lcevc_unref(void *opaque)
{
ff_refstruct_unref(&opaque);
FFLCEVCFrame *lcevc = opaque;
ff_refstruct_unref(&lcevc->lcevc);
av_frame_free(&lcevc->frame);
av_free(opaque);
}

View file

@ -36,6 +36,11 @@ typedef struct FFLCEVCContext {
struct AVFrame;
typedef struct FFLCEVCFrame {
FFLCEVCContext *lcevc;
struct AVFrame *frame;
} FFLCEVCFrame;
int ff_lcevc_alloc(FFLCEVCContext **plcevc);
int ff_lcevc_process(void *logctx, struct AVFrame *frame);
void ff_lcevc_unref(void *opaque);

View file

@ -372,9 +372,10 @@ static int libdav1d_receive_frame_internal(AVCodecContext *c, Dav1dPicture *p)
res = dav1d_get_picture(dav1d->c, p);
if (res < 0) {
if (res == AVERROR(EINVAL))
if (res == AVERROR(EINVAL)) {
dav1d_data_unref(data);
res = AVERROR_INVALIDDATA;
else if (res == AVERROR(EAGAIN))
} else if (res == AVERROR(EAGAIN))
res = c->internal->draining ? AVERROR_EOF : 1;
}

View file

@ -111,7 +111,7 @@ static const AVClass fdk_aac_dec_class = {
.version = LIBAVUTIL_VERSION_INT,
};
static int get_stream_info(AVCodecContext *avctx)
static int get_stream_info(AVCodecContext *avctx, AVFrame *frame)
{
FDKAACDecContext *s = avctx->priv_data;
CStreamInfo *info = aacDecoder_GetStreamInfo(s->handle);
@ -130,6 +130,9 @@ static int get_stream_info(AVCodecContext *avctx)
}
avctx->sample_rate = info->sampleRate;
avctx->frame_size = info->frameSize;
avctx->profile = info->aot - 1;
frame->flags |= AV_FRAME_FLAG_KEY * !!(info->flags & AC_INDEP);
#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
if (!s->output_delay_set && info->outputDelay) {
// Set this only once.
@ -413,7 +416,7 @@ static int fdk_aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
goto end;
}
if ((ret = get_stream_info(avctx)) < 0)
if ((ret = get_stream_info(avctx, frame)) < 0)
goto end;
frame->nb_samples = avctx->frame_size;

View file

@ -178,6 +178,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
AACContext *s = avctx->priv_data;
int ret = AVERROR(EINVAL);
AACENC_InfoStruct info = { 0 };
AVCPBProperties *cpb_props;
CHANNEL_MODE mode;
AACENC_ERROR err;
int aot = AV_PROFILE_AAC_LOW + 1;
@ -438,6 +439,14 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
memcpy(avctx->extradata, info.confBuf, info.confSize);
}
cpb_props = ff_encode_add_cpb_side_data(avctx);
if (!cpb_props)
return AVERROR(ENOMEM);
cpb_props->max_bitrate =
cpb_props->min_bitrate =
cpb_props->avg_bitrate = avctx->bit_rate;
return 0;
error:
aac_encode_close(avctx);
@ -540,6 +549,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
avpkt->size = out_args.numOutBytes;
avpkt->flags |= AV_PKT_FLAG_KEY;
*got_packet_ptr = 1;
return 0;
}

View file

@ -435,7 +435,11 @@ static av_cold int eb_enc_init(AVCodecContext *avctx)
svt_enc->eos_flag = EOS_NOT_REACHED;
#if SVT_AV1_CHECK_VERSION(3, 0, 0)
svt_ret = svt_av1_enc_init_handle(&svt_enc->svt_handle, &svt_enc->enc_params);
#else
svt_ret = svt_av1_enc_init_handle(&svt_enc->svt_handle, svt_enc, &svt_enc->enc_params);
#endif
if (svt_ret != EB_ErrorNone) {
return svt_print_error(avctx, svt_ret, "Error initializing encoder handle");
}

View file

@ -234,7 +234,7 @@ static av_cold int encode_init(AVCodecContext* avc_context)
return AVERROR_EXTERNAL;
}
h->keyframe_mask = (1 << t_info.keyframe_granule_shift) - 1;
h->keyframe_mask = (1 << av_ceil_log2(avc_context->gop_size)) - 1;
/* Clear up theora_info struct */
th_info_clear(&t_info);

View file

@ -661,7 +661,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
{
libx265Context *ctx = avctx->priv_data;
x265_picture x265pic;
#if X265_BUILD >= 210
#if (X265_BUILD >= 210) && (X265_BUILD < 213)
x265_picture x265pic_layers_out[MAX_SCALABLE_LAYERS];
x265_picture* x265pic_lyrptr_out[MAX_SCALABLE_LAYERS];
#else
@ -805,7 +805,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
#endif
}
#if X265_BUILD >= 210
#if (X265_BUILD >= 210) && (X265_BUILD < 213)
for (i = 0; i < MAX_SCALABLE_LAYERS; i++)
x265pic_lyrptr_out[i] = &x265pic_layers_out[i];
@ -844,7 +844,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
pkt->flags |= AV_PKT_FLAG_KEY;
}
#if X265_BUILD >= 210
#if (X265_BUILD >= 210) && (X265_BUILD < 213)
x265pic_out = x265pic_lyrptr_out[0];
#else
x265pic_out = &x265pic_solo_out;

View file

@ -91,7 +91,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx)
if (ret < 0)
return ret;
event_pos = strstr(avctx->subtitle_header, "\r\n[Events]\r\n");
event_pos = strstr(avctx->subtitle_header, "\n[Events]\n");
if (!event_pos)
return AVERROR_BUG;
@ -106,7 +106,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx)
"0,0," /* Spacing, Angle */
"3,0.1,0," /* BorderStyle, Outline, Shadow */
"5,1,1,1," /* Alignment, Margin[LRV] */
"0\r\n" /* Encoding */
"0\n" /* Encoding */
"Style: "
"Subtitle," /* Name */
"Monospace,16," /* Font{name,size} */
@ -116,7 +116,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx)
"0,0," /* Spacing, Angle */
"1,1,1," /* BorderStyle, Outline, Shadow */
"8,48,48,20," /* Alignment, Margin[LRV] */
"0\r\n" /* Encoding */
"0\n" /* Encoding */
, event_pos);
if (!new_header)

View file

@ -416,6 +416,7 @@ static int mediacodec_wrap_sw_audio_buffer(AVCodecContext *avctx,
frame->pts = info->presentationTimeUs;
}
frame->pkt_dts = AV_NOPTS_VALUE;
frame->flags |= AV_FRAME_FLAG_KEY;
av_log(avctx, AV_LOG_TRACE,
"Frame: format=%d channels=%d sample_rate=%d nb_samples=%d",
@ -593,7 +594,8 @@ static int mediacodec_dec_parse_video_format(AVCodecContext *avctx, MediaCodecDe
AMEDIAFORMAT_GET_INT32(s->crop_right, "crop-right", 0);
// Try "crop" for NDK
if (!(s->crop_right && s->crop_bottom) && s->use_ndk_codec)
// MediaTek SOC return some default value like Rect(0, 0, 318, 238)
if (!(s->crop_right && s->crop_bottom) && s->use_ndk_codec && !strstr(s->codec_name, ".mtk."))
ff_AMediaFormat_getRect(s->format, "crop", &s->crop_left, &s->crop_top, &s->crop_right, &s->crop_bottom);
if (s->crop_right && s->crop_bottom) {

View file

@ -134,7 +134,7 @@ static int extract_extradata_support(AVCodecContext *avctx)
static int mediacodec_init_bsf(AVCodecContext *avctx)
{
MediaCodecEncContext *s = avctx->priv_data;
char str[128];
char str[128] = {0};
int ret;
int crop_right = s->width - avctx->width;
int crop_bottom = s->height - avctx->height;

View file

@ -468,6 +468,10 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if (s->avctx->height <= 0)
return AVERROR_INVALIDDATA;
}
if (s->bayer && s->progressive) {
avpriv_request_sample(s->avctx, "progressively coded bayer picture");
return AVERROR_INVALIDDATA;
}
if (s->got_picture && s->interlaced && (s->bottom_field == !s->interlace_polarity)) {
if (s->progressive) {

View file

@ -567,6 +567,12 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "H.263 does not support resolutions above 2048x1152\n");
return AVERROR(EINVAL);
}
if (s->codec_id == AV_CODEC_ID_FLV1 &&
(avctx->width > 65535 ||
avctx->height > 65535 )) {
av_log(avctx, AV_LOG_ERROR, "FLV does not support resolutions above 16bit\n");
return AVERROR(EINVAL);
}
if ((s->codec_id == AV_CODEC_ID_H263 ||
s->codec_id == AV_CODEC_ID_H263P ||
s->codec_id == AV_CODEC_ID_RV20) &&

View file

@ -190,7 +190,7 @@ static uint32_t get_urice(GetBitContext *gb, int k)
static int32_t get_srice(GetBitContext *gb, int x)
{
int32_t y = get_urice(gb, x);
uint32_t y = get_urice(gb, x);
return get_bits1(gb) ? -y : y;
}
@ -300,7 +300,7 @@ static int do_decode(AVCodecContext *avctx, AVFrame *frame, int decorrelate, int
dst[n] += (int)(P2 + P3) / 2 + (unsigned)p;
break;
case 8:
dst[n] += (int)(P2 + P3) / 2;
dst[n] += (int)(P2 + P3) / 2 + 0U;
break;
case 9:
dst[n] += (int)(P2 * 2 + P3) / 3 + (unsigned)p;
@ -309,13 +309,13 @@ static int do_decode(AVCodecContext *avctx, AVFrame *frame, int decorrelate, int
dst[n] += (int)(P2 + P3 * 2) / 3 + (unsigned)p;
break;
case 11:
dst[n] += (int)((unsigned)dst[A] + dst[B]) / 2;
dst[n] += (int)((unsigned)dst[A] + dst[B]) / 2 + 0U;
break;
case 12:
dst[n] += (unsigned)dst[B];
break;
case 13:
dst[n] += (int)(unsigned)(dst[D] + dst[B]) / 2;
dst[n] += (int)((unsigned)dst[D] + dst[B]) / 2 + 0U;
break;
case 14:
dst[n] += (int)((unsigned)P2 + dst[A]) / 2 + (unsigned)p;

View file

@ -41,11 +41,6 @@ typedef int (action_func)(AVCodecContext *c, void *arg);
typedef int (action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr);
typedef int (main_func)(AVCodecContext *c);
typedef struct Progress {
pthread_cond_t cond;
pthread_mutex_t mutex;
} Progress;
typedef struct SliceThreadContext {
AVSliceThread *thread;
action_func *func;
@ -54,11 +49,6 @@ typedef struct SliceThreadContext {
void *args;
int *rets;
int job_size;
int *entries;
int entries_count;
int thread_count;
Progress *progress;
} SliceThreadContext;
static void main_function(void *priv) {
@ -82,18 +72,9 @@ static void worker_func(void *priv, int jobnr, int threadnr, int nb_jobs, int nb
void ff_slice_thread_free(AVCodecContext *avctx)
{
SliceThreadContext *c = avctx->internal->thread_ctx;
int i;
avpriv_slicethread_free(&c->thread);
for (i = 0; i < c->thread_count; i++) {
Progress *const progress = &c->progress[i];
pthread_mutex_destroy(&progress->mutex);
pthread_cond_destroy(&progress->cond);
}
av_freep(&c->entries);
av_freep(&c->progress);
av_freep(&avctx->internal->thread_ctx);
}
@ -175,86 +156,3 @@ int ff_slice_thread_init(AVCodecContext *avctx)
avctx->execute2 = thread_execute2;
return 0;
}
int av_cold ff_slice_thread_init_progress(AVCodecContext *avctx)
{
SliceThreadContext *const p = avctx->internal->thread_ctx;
int err, i = 0, thread_count = avctx->thread_count;
p->progress = av_calloc(thread_count, sizeof(*p->progress));
if (!p->progress) {
err = AVERROR(ENOMEM);
goto fail;
}
for (; i < thread_count; i++) {
Progress *const progress = &p->progress[i];
err = pthread_mutex_init(&progress->mutex, NULL);
if (err) {
err = AVERROR(err);
goto fail;
}
err = pthread_cond_init (&progress->cond, NULL);
if (err) {
err = AVERROR(err);
pthread_mutex_destroy(&progress->mutex);
goto fail;
}
}
err = 0;
fail:
p->thread_count = i;
return err;
}
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
{
SliceThreadContext *p = avctx->internal->thread_ctx;
Progress *const progress = &p->progress[thread];
int *entries = p->entries;
pthread_mutex_lock(&progress->mutex);
entries[field] +=n;
pthread_cond_signal(&progress->cond);
pthread_mutex_unlock(&progress->mutex);
}
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
{
SliceThreadContext *p = avctx->internal->thread_ctx;
Progress *progress;
int *entries = p->entries;
if (!entries || !field) return;
thread = thread ? thread - 1 : p->thread_count - 1;
progress = &p->progress[thread];
pthread_mutex_lock(&progress->mutex);
while ((entries[field - 1] - entries[field]) < shift){
pthread_cond_wait(&progress->cond, &progress->mutex);
}
pthread_mutex_unlock(&progress->mutex);
}
int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count)
{
if (avctx->active_thread_type & FF_THREAD_SLICE) {
SliceThreadContext *p = avctx->internal->thread_ctx;
if (p->entries_count == count) {
memset(p->entries, 0, p->entries_count * sizeof(*p->entries));
return 0;
}
av_freep(&p->entries);
p->entries = av_calloc(count, sizeof(*p->entries));
if (!p->entries) {
p->entries_count = 0;
return AVERROR(ENOMEM);
}
p->entries_count = count;
}
return 0;
}

View file

@ -62,7 +62,6 @@ void ff_build_rac_states(RangeCoder *c, int factor, int max_p);
static inline void renorm_encoder(RangeCoder *c)
{
// FIXME: optimize
while (c->range < 0x100) {
if (c->outstanding_byte < 0) {
c->outstanding_byte = c->low >> 8;
} else if (c->low <= 0xFF00) {
@ -81,7 +80,6 @@ static inline void renorm_encoder(RangeCoder *c)
c->low = (c->low & 0xFF) << 8;
c->range <<= 8;
}
}
static inline int get_rac_count(RangeCoder *c)
@ -108,7 +106,8 @@ static inline void put_rac(RangeCoder *c, uint8_t *const state, int bit)
*state = c->one_state[*state];
}
renorm_encoder(c);
while (c->range < 0x100)
renorm_encoder(c);
}
static inline void refill(RangeCoder *c)

View file

@ -176,7 +176,7 @@ endfunc
.global ff_h264_weight_funcs_8_rvv
.hidden ff_h264_weight_funcs_8_rvv
const ff_h264_weight_funcs_8_rvv
const ff_h264_weight_funcs_8_rvv, relocate=1
.irp w, 16, 8, 4, 2
#if __riscv_xlen == 32
.word ff_h264_weight_pixels\w\()_8_rvv

View file

@ -644,7 +644,7 @@ func ff_h264_idct4_add\type\()_\depth\()_rvv, zve32x
sd a4, 24(sp)
ld a0, 0(a0) # dest[0]
addi a1, a1, 16 * 4 # &block_offset[16]
vsetivli zero, 4, e8, mf4, ta, ma
vsetivli zero, 4, e8, m1, ta, ma
jal .Lidct4_add4_\depth\()_rvv
ld a4, 24(sp) # nnzc
@ -655,7 +655,7 @@ func ff_h264_idct4_add\type\()_\depth\()_rvv, zve32x
ld a0, 8(a0) # dest[1]
lla t0, ff_h264_scan8 + 32
.ifc \type, 8_422
vsetivli zero, 4, e8, mf4, ta, ma
vsetivli zero, 4, e8, m1, ta, ma
jal .Lidct4_add4_\depth\()_rvv
ld a4, 24(sp) # nnzc
@ -665,7 +665,7 @@ func ff_h264_idct4_add\type\()_\depth\()_rvv, zve32x
addi a1, t5, (-8 - 4) * 4 # &block_offset[24]
ld a0, 0(a0) # dest[0]
lla t0, ff_h264_scan8 + 24
vsetivli zero, 4, e8, mf4, ta, ma
vsetivli zero, 4, e8, m1, ta, ma
jal .Lidct4_add4_\depth\()_rvv
ld a4, 24(sp) # nnzc
@ -679,7 +679,7 @@ func ff_h264_idct4_add\type\()_\depth\()_rvv, zve32x
ld ra, 8(sp)
ld s0, 0(sp)
addi sp, sp, 32
vsetivli zero, 4, e8, mf4, ta, ma
vsetivli zero, 4, e8, m1, ta, ma
j .Lidct4_add4_\depth\()_rvv
endfunc
.endm

View file

@ -924,6 +924,9 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
if (get_bits1(&gb)) // XXX FIXME
av_log(avctx, AV_LOG_INFO, "Custom quant table\n");
if (s->num_taps > 128)
return AVERROR_INVALIDDATA;
s->block_align = 2048LL*s->samplerate/(44100*s->downsampling);
s->frame_size = s->channels*s->block_align*s->downsampling;
// avctx->frame_size = s->block_align;

View file

@ -1253,6 +1253,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
uint8_t *buf;
if (watermark_height <= 0 ||
get_bits_left(&gb) <= 0 ||
(uint64_t)watermark_width * 4 > UINT_MAX / watermark_height)
return AVERROR_INVALIDDATA;

View file

@ -434,6 +434,9 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
return AVERROR_INVALIDDATA;
}
if (get_bits_left(gb) < 2*10 + 2*size)
return AVERROR_INVALIDDATA;
s->predictors[0] = get_sbits(gb, 10);
s->predictors[1] = get_sbits(gb, 10);
s->predictors[2] = get_sbits(gb, size) * (1 << (10 - size));

View file

@ -56,10 +56,6 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags);
int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx,
int (*action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr),
int (*main_func)(AVCodecContext *c), void *arg, int *ret, int job_count);
int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count);
int ff_slice_thread_init_progress(AVCodecContext *avctx);
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n);
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift);
enum ThreadingStatus {
FF_THREAD_IS_COPY,

View file

@ -723,7 +723,7 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
case AV_CODEC_ID_ADPCM_IMA_WAV:
if (bps < 2 || bps > 5)
return 0;
tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8);
tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8LL);
break;
case AV_CODEC_ID_ADPCM_IMA_DK3:
tmp = blocks * (((ba - 16LL) * 2 / 3 * 4) / ch);
@ -913,25 +913,6 @@ int ff_thread_can_start_frame(AVCodecContext *avctx)
{
return 1;
}
int ff_slice_thread_init_progress(AVCodecContext *avctx)
{
return 0;
}
int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count)
{
return 0;
}
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
{
}
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
{
}
#endif
const uint8_t *avpriv_find_start_code(const uint8_t *restrict p,

View file

@ -406,6 +406,9 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
FFHWBaseEncodePicture *pic)
{
FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
#if !CONFIG_VAAPI_1
VAAPIEncodeContext *ctx = avctx->priv_data;
#endif
VAAPIEncodeH264Context *priv = avctx->priv_data;
VAAPIEncodePicture *vaapi_pic = pic->priv;
VAAPIEncodeH264Picture *hpic = pic->codec_priv;

View file

@ -788,6 +788,7 @@ static av_cold void vc1_decode_reset(AVCodecContext *avctx)
for (i = 0; i < 4; i++)
av_freep(&v->sr_rows[i >> 1][i & 1]);
ff_mpv_common_end(&v->s);
memset(v->s.block_index, 0, sizeof(v->s.block_index));
av_freep(&v->mv_type_mb_plane);
av_freep(&v->direct_mb_plane);
av_freep(&v->forward_mb_plane);

View file

@ -30,7 +30,7 @@
#include "version_major.h"
#define LIBAVCODEC_VERSION_MINOR 19
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

View file

@ -1469,8 +1469,10 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
unsigned step = FASTDIV(vr->partition_size << 1, dim << 1);
vorbis_codebook codebook = vc->codebooks[vqbook];
if (get_bits_left(gb) <= 0)
return AVERROR_INVALIDDATA;
if (get_bits_left(gb) < 0) {
av_log(vc->avctx, AV_LOG_ERROR, "Overread %d bits\n", -get_bits_left(gb));
return 0;
}
if (vr_type == 0) {

View file

@ -319,7 +319,11 @@ static av_always_inline void mc_luma_unscaled(VP9TileData *td, const vp9_mc_func
// The arm/aarch64 _hv filters read one more row than what actually is
// needed, so switch to emulated edge one pixel sooner vertically
// (!!my * 5) than horizontally (!!mx * 4).
// The arm/aarch64 _h filters read one more pixel than what actually is
// needed, so switch to emulated edge if that would read beyond the bottom
// right block.
if (x < !!mx * 3 || y < !!my * 3 ||
((ARCH_AARCH64 || ARCH_ARM) && (x + !!mx * 5 > w - bw) && (y + !!my * 5 + 1 > h - bh)) ||
x + !!mx * 4 > w - bw || y + !!my * 5 > h - bh) {
s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
ref - !!my * 3 * ref_stride - !!mx * 3 * bytesperpixel,
@ -358,7 +362,11 @@ static av_always_inline void mc_chroma_unscaled(VP9TileData *td, const vp9_mc_fu
// The arm/aarch64 _hv filters read one more row than what actually is
// needed, so switch to emulated edge one pixel sooner vertically
// (!!my * 5) than horizontally (!!mx * 4).
// The arm/aarch64 _h filters read one more pixel than what actually is
// needed, so switch to emulated edge if that would read beyond the bottom
// right block.
if (x < !!mx * 3 || y < !!my * 3 ||
((ARCH_AARCH64 || ARCH_ARM) && (x + !!mx * 5 > w - bw) && (y + !!my * 5 + 1 > h - bh)) ||
x + !!mx * 4 > w - bw || y + !!my * 5 > h - bh) {
s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
ref_u - !!my * 3 * src_stride_u - !!mx * 3 * bytesperpixel,

View file

@ -130,12 +130,12 @@ static int init_pic_rc(AVCodecContext *avctx, FFHWBaseEncodePicture *pic,
.consecutiveBFrameCount = FFMAX(ctx->base.b_per_p - 1, 0),
.temporalLayerCount = 0,
};
rc_info->pNext = &hp->vkrc_info;
rc_info->virtualBufferSizeInMs = enc->unit_opts.hrd_buffer_size;
rc_info->initialVirtualBufferSizeInMs = enc->unit_opts.initial_buffer_fullness;
if (rc_info->rateControlMode > VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR) {
rc_info->virtualBufferSizeInMs = (enc->unit_opts.hrd_buffer_size * 1000LL) / avctx->bit_rate;
rc_info->initialVirtualBufferSizeInMs = (enc->unit_opts.initial_buffer_fullness * 1000LL) / avctx->bit_rate;
hp->vkrc_layer_info = (VkVideoEncodeH264RateControlLayerInfoKHR) {
.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_KHR,

View file

@ -124,12 +124,12 @@ static int init_pic_rc(AVCodecContext *avctx, FFHWBaseEncodePicture *pic,
.consecutiveBFrameCount = FFMAX(ctx->base.b_per_p - 1, 0),
.subLayerCount = 0,
};
rc_info->pNext = &hp->vkrc_info;
rc_info->virtualBufferSizeInMs = 1000;
rc_info->initialVirtualBufferSizeInMs = 500;
if (rc_info->rateControlMode > VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR) {
rc_info->virtualBufferSizeInMs = (enc->hrd_buffer_size * 1000LL) / avctx->bit_rate;
rc_info->initialVirtualBufferSizeInMs = (enc->initial_buffer_fullness * 1000LL) / avctx->bit_rate;
hp->vkrc_layer_info = (VkVideoEncodeH265RateControlLayerInfoKHR) {
.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_LAYER_INFO_KHR,

View file

@ -146,10 +146,10 @@ static VVCFrame *alloc_frame(VVCContext *s, VVCFrameContext *fc)
for (int j = 0; j < frame->ctb_count; j++)
frame->rpl_tab[j] = frame->rpl;
win->left_offset = pps->r->pps_scaling_win_left_offset << sps->hshift[CHROMA];
win->right_offset = pps->r->pps_scaling_win_right_offset << sps->hshift[CHROMA];
win->top_offset = pps->r->pps_scaling_win_top_offset << sps->vshift[CHROMA];
win->bottom_offset = pps->r->pps_scaling_win_bottom_offset << sps->vshift[CHROMA];
win->left_offset = pps->r->pps_scaling_win_left_offset * (1 << sps->hshift[CHROMA]);
win->right_offset = pps->r->pps_scaling_win_right_offset * (1 << sps->hshift[CHROMA]);
win->top_offset = pps->r->pps_scaling_win_top_offset * (1 << sps->vshift[CHROMA]);
win->bottom_offset = pps->r->pps_scaling_win_bottom_offset * (1 << sps->vshift[CHROMA]);
frame->ref_width = pps->r->pps_pic_width_in_luma_samples - win->left_offset - win->right_offset;
frame->ref_height = pps->r->pps_pic_height_in_luma_samples - win->bottom_offset - win->top_offset;

View file

@ -704,6 +704,9 @@ static int decode_entropy_coded_image(WebPContext *s, enum ImageRole role,
ref_x = FFMAX(0, ref_x);
ref_y = FFMAX(0, ref_y);
if (ref_y == y && ref_x >= x)
return AVERROR_INVALIDDATA;
/* copy pixels
* source and dest regions can overlap and wrap lines, so just
* copy per-pixel */

View file

@ -96,7 +96,7 @@ cglobal aac_quantize_bands, 5, 5, 6, out, in, scaled, size, is_signed, maxval, Q
addps m2, m1
minps m2, m3
andps m5, m4, [inq+sizeq]
orps m2, m5
xorps m2, m5
cvttps2dq m2, m2
mova [outq+sizeq], m2
add sizeq, mmsize

View file

@ -20,7 +20,6 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "config.asm"
%include "libavutil/x86/x86util.asm"
%ifdef __NASM_VER__

Some files were not shown because too many files have changed in this diff Show more