1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00
Commit Graph

119621 Commits

Author SHA1 Message Date
James Almer
038314bc6b avcodec/exr: reindent after the previous change
Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-14 00:17:02 -03:00
Mark Thompson
527d5eaec7 apv_decode: Discard invalid run codes earlier
Caught by ubsan - would cause an invalid shift in constructing the
run value.
2025-05-13 20:52:35 +01:00
Mark Thompson
1753d41d4e fate: Add test for APV 400-10 profile
Same setup as the 422-10 profile test, using the same content.  FFmpeg
decoder output is identical to the reference decoder output.
2025-05-13 19:38:08 +01:00
Mark Thompson
1ad57a847e lavc: Add unit test for APV entropy decode 2025-05-13 19:37:53 +01:00
Mark Thompson
a3c8fba5da apv_decode: Multisymbol entropy decode 2025-05-13 19:37:49 +01:00
Michael Niedermayer
9980a0b9b1 avformat/iamfdec: Check side_substream_id before use
Fixes: poc-iamf-2025-04

Found-by: 苏童 <220235212@seu.edu.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-13 00:26:24 +02:00
Michael Niedermayer
74fd2c3ddb 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>
2025-05-13 00:20:23 +02:00
Michael Niedermayer
fd5a3c5fed 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>
2025-05-13 00:08:02 +02:00
xiongweixiao
8ce32a7cbb lavf: vvc_probe: lower probe score for invalid SPS/PPS/IRAP order to avoid misdetection of mp3 as VVC
The current vvc_probe function checks for SPS, PPS, and IRAP NAL units but does not enforce their detection order. This can lead to false positives when PPS or IRAP appear before SPS, causing malformed or non-compliant bitstreams to be incorrectly identified as valid VVC streams.

This commit modifies the logic to use boolean flags and enforces the correct detection sequence: SPS must be detected before PPS, and PPS before IRAP. This ensures more accurate probing and prevents invalid bitstreams from being misidentified.

For streams with wrong ordering a lower score is returned

This change addresses issues reported in:
- https://trac.ffmpeg.org/ticket/11496
- https://trac.ffmpeg.org/ticket/11087

Signed-off-by: xiongweixiao <xiongweixiaoxxw@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-12 11:07:35 +02:00
Zhao Zhili
1cda5fe3fd avformat/hls: Return error code when read key file failed
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-05-12 13:03:18 +08:00
Marton Balint
4014784b62 fftools/ffmpeg: move elapsed time counter to the end of the status line
Elapsed time is much less important than the actual progress, and I am guessing
several ffmpeg CLI frontends use the existing status line for showing progress,
so putting a new field in the beginning is less optimal anyway.

Related to ticket #11582.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-05-11 18:41:55 +02:00
Marton Balint
ce01c7fb58 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>
2025-05-11 18:41:55 +02:00
Michael Niedermayer
4e5523c985 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>
2025-05-09 22:27:04 +02:00
Michael Niedermayer
9230c93cc9 avcodec/rv60dec: inter also fails with qp >= 32
Fixes: out of array read in decode_cu_16x16()
Fixes: 398049430/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV60_fuzzer-5525836849807360

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>
2025-05-09 22:27:04 +02:00
Michael Niedermayer
ce1fd73d63 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>
2025-05-09 22:27:04 +02:00
Michael Niedermayer
43926e026d avcodec/mmvideo: fix palette index
Fixes: 391935573/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MMVIDEO_fuzzer-4655048979709952
Fixes: out of array access

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>
2025-05-09 22:26:51 +02:00
Marvin Scholz
aeea2defe4 avformat/apvdec: remove unused variable 2025-05-09 12:17:09 -04:00
Manuel Lauss
37064b2d16 avcodec/sanm: support "StarWars - Making Magic" video
Videos of "StarWars - Making Magic" consist of 640x480 codec3 frames
which establish a background, and a 320x240 codec48 video put on top
at random left/top offsets.

To support this, a new default buffer "fbuf", which holds the final
image to be presented, is added, since codec37/47/48 need their 2/3 buffers
to be private to themselves.  The decoded result is then copied to the fbuf,
honoring the left/top offsets if required.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
2025-05-09 07:29:15 +02:00
Manuel Lauss
9369ebf238 avcodec/sanm: recognize common FOBJ sizes
Change the size detection a bit to recognize common video sizes,
as the FOBJ codecs>=37 cannot always be trusted, since they can
be embedded in a larger frame.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
2025-05-09 07:29:13 +02:00
Manuel Lauss
7f0b7b0496 avcodec/sanm: ignore codec48 compression type 6
Some videos of "StarWars - Making Magic" have this subcompression
type: data just consists of the 16 byte codec48 header; the DOS player
and the c48 decoder in the "Mysteries of the Sith" game engine ignore it.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
2025-05-09 07:29:08 +02:00
James Almer
244ad944e9 avcodec/liboapvenc: remove 4:4:4 support until it's properly handled
liboapv will seemingly encode correct 4:4:4 output, but report profile_idc 33, which
is specifically the profile value for 4:2:2 10bit.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-07 21:40:08 -03:00
Michael Niedermayer
1b643e3f65 tests/fate/filter-video: Fix dependancy for codecview
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-07 15:35:48 +02:00
Michael Niedermayer
8c920c4c39 Remove libpostproc
Libpostproc will be available as source plugin at
https://github.com/michaelni/FFmpeg/tree/sourceplugin-libpostproc
OR
https://github.com/michaelni/libpostproc

whatever turns out more convenient to maintain

For the upcoming 8.0 release, libpostproc will be included, so as not to
cause delays or inconveniences

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-07 15:35:47 +02:00
Max Rudolph
9537d91e8f avformat/cinedec: add support for additional Bayer CFA patterns for Phantom CINE file format
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-07 15:35:47 +02:00
Link Mauve
d5f4a55123 avutil/hwcontext_vulkan: Query the correct format
In the call to vkGetPhysicalDeviceImageFormatProperties2(), we were
previously requesting the properties of the first fallback format (e.g.
VK_FORMAT_R8_UNORM for VK_FORMAT_G8_B8R8_2PLANE_420_UNORM) instead of
the actual format in use.

We don’t do anything with it afterwards, but there is no reason to keep
querying the wrong format.
2025-05-07 15:16:58 +02:00
Tobias Rapp
0f751d3836 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>
2025-05-07 10:52:44 +02:00
James Almer
2b6303762f tests/fate/cbs: add tests for APV
Ensure bitexact passthrough using the apv_metadata bsf.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-05 18:05:38 -03:00
Michael Niedermayer
c644720e68 postproc/tests/.gitignore: Add temptest
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-05 19:13:29 +02:00
Michael Niedermayer
e5640e67d0 libpostproc/tests: Factor ff_chksum() out
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-05 19:13:29 +02:00
Mark Thompson
9bf54cdb19 cbs_apv: Check tile component sizes
It was possible for the buffer pointers for the last tile to go over the
end of the unit buffer leading to a read overflow during decode of the
macroblock layer.  Check all tile component sizes to prevent this case
and also catch related tile size mismatch errors earlier.
2025-05-05 17:22:57 +01:00
Mark Thompson
ea457e54e1 apv_entropy: Improve robustness to bitstream errors 2025-05-05 17:22:57 +01:00
Mark Thompson
2aa2095bb4 cbs_apv: Better constrain tile_width/height_in_mbs
The maximum number of tile columns/rows adds an extra constraint on
the minimum tile width/height for large frames (over 5120 width or
2560 height).
2025-05-05 17:22:57 +01:00
Mark Thompson
1a9a2bafc8 apv_decode: Improve reporting of decode errors
Halt tile component decoding at the first entropy error (this will be a
desync and is not recoverable).  If any tile components contain errors
then discard the frame unless the output-corrupt flag is set.

Also fixes CID 1646764, which is the error case where the tile component
is too large for get_bits to handle.
2025-05-05 17:22:57 +01:00
Mark Thompson
5acd2145a4 apv_decode: Fix memory leak on decode error 2025-05-05 17:22:57 +01:00
Mark Thompson
135acc8e61 cbs_apv: Always restore tracing state on split fragment error
Fixes CID 1646769.
2025-05-05 17:22:57 +01:00
James Almer
a9557c1f26 avcodec/apv_decode: build the lut table only once
No reason to build the exact same table once per decoding thread.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-05 13:19:29 -03:00
James Almer
0af1d69959 avcodec/hevc/hevcdec: move the slice header buffer overread check up in the function
Abort as soon as we're done reading the slice header instead of running extra checks
that assume slice data may follow.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-05 12:55:03 -03:00
James Almer
d34c738435 avcodec/hevc/hevcdec: ensure a bit was read when checking for alignment_bit_equal_to_one
Prevents printing bogus errors about the value being 0, when in fact we
overread the available slice buffer.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-05 12:55:03 -03:00
Andreas Rheinhardt
62f7b43b53 tests/api/api-dump-stream-meta-test: Fix leaks
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-05 17:03:39 +02:00
Martin Storsjö
f4e72eb5a3 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>
2025-05-05 11:35:11 +03:00
James Almer
a0349d64fd avformat/apvdec: also look for an au_info PBU during probing
If present, an Access unit information PBU must be the first in an AU.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-04 16:26:57 -03:00
James Almer
d08c5527cf avcodec/exr: add support for half-float DWAA/B compression
Fixes ticket #11555.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-04 16:22:28 -03:00
James Almer
0cabfdc8bc avcodec/apv_parser: use an AVBufferRef to avoid data copying
Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-04 16:22:14 -03:00
James Almer
4bfe9c5663 avcodec/cbs: add an AVBufferRef input argument to ff_cbs_read()
To allow taking a reference from an existing buffer outside of AVPackets.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-04 16:22:14 -03:00
Dawid Kozinski
fab691edaf avcodec: add APV encoder using liboapv
Co-authored-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-04 16:21:35 -03:00
Michael Niedermayer
7faa560f1a postproc/tests/blocktest: Test several filter combinations
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-03 18:48:27 +02:00
Michael Niedermayer
fc3035e3c4 postproc/tests/blocktest: initialize qp array randomly to for testing
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-03 18:48:26 +02:00
Michael Niedermayer
71e25beb5c postproc/tests/blocktest: use dimensions
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-03 18:48:26 +02:00
Michael Niedermayer
fd9adbdbfb postproc/postprocess_template: fix dering with a 16x16 image
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-03 18:48:26 +02:00
Michael Niedermayer
d153b00534 postproc/tests/stripetest: use dimensions
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-03 18:48:25 +02:00