1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00
Commit Graph

120006 Commits

Author SHA1 Message Date
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
aeea2defe4 avformat/apvdec: remove unused variable 2025-05-09 12:17:09 -04:00
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
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
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
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
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
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
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
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
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
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
c644720e68 postproc/tests/.gitignore: Add temptest
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-05 19:13:29 +02:00
e5640e67d0 libpostproc/tests: Factor ff_chksum() out
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-05 19:13:29 +02:00
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
ea457e54e1 apv_entropy: Improve robustness to bitstream errors 2025-05-05 17:22:57 +01:00
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
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
5acd2145a4 apv_decode: Fix memory leak on decode error 2025-05-05 17:22:57 +01:00
135acc8e61 cbs_apv: Always restore tracing state on split fragment error
Fixes CID 1646769.
2025-05-05 17:22:57 +01:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
917c15435a libpostproc: check minimum size
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-03 18:48:25 +02:00
26bbca84de postproc/tests: Add test for temporal denoise
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-03 18:48:25 +02:00
75be669ca1 avformat/hls: Fix flash1.bogulus.cfd support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-03 18:48:24 +02:00
f99f223eb1 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>
2025-05-03 18:48:24 +02:00
1dbc5675c1 fftools/ffprobe: Disable stderr buffering on Windows
An identical call exists in ffmpeg.c

With POSIX/glibc, stderr is already unbuffered (or line-buffered when
a terminal is connected), but not in case of MSVCRT.
Explicitly calling setvbuf() like in this commit, makes the Windows
runtime behave like POSIX, giving the same “print immediately” behavior.

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-03 07:58:08 +02:00
b322640b4f fftools/ffmpeg: Log exit code on exit
When viewing logs, there are situations where it is not entirely
clear whether ffmpeg CLI has exited gracefully. The two primary cases
are

- A crash/segfault has occured
  Windows for example doesn't output any message to the calling shell
- The process has been terminated (e.g. killed externally)

Printing a message on exit provides a reliable indication that the
process has exited normally.
Printing the exit code is useful as it usually remains invisible
and unnoticed by users running FFmpeg from a shell.

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-03 07:57:27 +02:00
26429eee22 libavformat/asfdec: Fix regression bug when reading image attachments
Commit c8140fe732 had introduced
a check for value_len > UINT16_MAX.
As a consequence, attached images of sizes larger than UINT16_MAX
could no longer be read.

This is a minimal fix of the regression, avoiding the controversies
of my earlier submission regarding int type handling in asfdec.

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-03 07:57:15 +02:00
1a083a4d90 fftools/ffmpeg: Include elapsed-time in print_report()
It's a highly useful metric, both at runtime and when viewing logs.

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-03 07:57:01 +02:00
7a05f57250 avutil/opt: Print default option value for AV_OPT_TYPE_INT64
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-03 07:56:46 +02:00
3a93fadac1 avformat/dump: Stream start offsets: change precision and label
- Change precision to 6 digits to align with other printed times
- Change label to just "Start"
- Add 's' unit to format 'start' value for consistency

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-03 07:56:04 +02:00
33d0d1c672 avformat/apvdec: don't fill container level fields with codec level info
This is a raw demuxer, it should not read codec level information and export it
as container level information.
The generic demux code will use the recently introduced parser to take care of
that.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-01 22:42:41 -03:00
c4ea4abec2 avcodec: add an APV parser
Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-01 22:42:34 -03:00
8ebccdf2a4 avformat/av1dec: fix setting AVPacket->pos in Annex-B demuxer
This demuxers reads encapsulation bytes before reading codec data into the
output packets, so take such offset into consideration.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-05-01 14:24:04 -03:00
707c04fe06 ffv1enc_vulkan: support 8 and 16-bit 2-plane YUV formats
This adds support for all 8-bit and 16-bit 2-plane formats.
P010 and others require more work as the data's LSB-padded.
2025-05-01 09:34:44 +02:00
33a4d36101 hwcontext_vulkan: support AV_PIX_FMT_GBRP
Support was partially added previously in vulkan.c, but now it's fully
supported.
2025-05-01 09:34:44 +02:00