Commit Graph

113760 Commits

Author SHA1 Message Date
Michael Niedermayer e9cc9e492f
libswscale/utils: Fix bayer to yuvj
Fixes: out of array access.

Earlier code assumes that a unscaled bayer to yuvj420 converter exists
but the later code then skips yuvj420

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-21 18:24:17 +01:00
Michael Niedermayer f9906911f0
Revert "swscale: fix sws_setColorspaceDetails after sws_init_context"
Suggested by: Niklas Haas in Ticket10824

Fixes: Assertion failure
Fixes: Ticket10824

This reverts commit cedf589c09.
2024-02-21 18:24:17 +01:00
Michael Niedermayer 8caa84cec7
tools: Add target_sws_fuzzer.c
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-21 18:24:17 +01:00
Michael Niedermayer 64098d0cd8
swscale/swscale: Check srcSliceH for bayer
Fixes: Assertion srcSliceH > 1 failed at libswscale/swscale_unscaled.c:1359
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-21 18:24:16 +01:00
Michael Niedermayer 18f26f8a2f
swscale/utils: Allocate more dithererror
Fixes: out of array read
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-21 18:24:16 +01:00
Dale Curtis 6ef32ea574
Avoid OOM for invalid STCO / CO64 constructions.
The `entries` value is read directly from the stream and used to
allocate memory. This change clamps `entries` to however many are
possible in the remaining atom or file size (whichever is smallest).

Fixes https://crbug.com/1429357

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-21 18:23:41 +01:00
Anton Khirnov a3f69cdec7 fftools/ffmpeg: cosmetics, vertically align structs 2024-02-21 10:33:20 +01:00
Anton Khirnov 6b6815b1c8 fftools/ffmpeg: move subtitle helpers to ffmpeg_dec, their only user 2024-02-21 10:31:27 +01:00
Anton Khirnov 826cfd9997 fftools/ffmpeg_filter: pass framerate through InputFilterOptions
Rather than read it directly from InputStream.

This is a step towards avoiding the assumption that filtergraph inputs
are always fed by demuxers.
2024-02-21 10:27:20 +01:00
Anton Khirnov fef3052df3 fftools/ffmpeg_filter: pass autorotate/reinit flags through InputFilterOptions
Rather than read them directly from InputStream.

This is a step towards avoiding the assumption that filtergraph inputs
are always fed by demuxers.
2024-02-21 10:27:20 +01:00
Anton Khirnov 6315f78e0c fftools/ffmpeg_filter: pass sub2video canvas size through InputFilterOptions
Rather than read them directly from InputStream.

This is a step towards avoiding the assumption that filtergraph inputs
are always fed by demuxers.
2024-02-21 10:27:20 +01:00
Anton Khirnov bd3c1c194b fftools/ffmpeg_filter: accept a name from its upstream input
Do not construct the name manually from input file/stream indices.

This is a step towards avoiding the assumption that filtergraph inputs
are always fed by demuxers.
2024-02-21 10:27:20 +01:00
Anton Khirnov 8f592eb35f fftools/ffmpeg_filter: compute input trim start/end in demuxer
The computation is based on demuxer properties, so that is the more
appropriate place for it. Filter code just receives the desired
start time/duration.
2024-02-21 10:27:20 +01:00
Anton Khirnov 09438d6529 fftools/ffmpeg_filter: stop taking display matrix from global side data
It should never be necessary now that decoders propagate global side
data to frames.
2024-02-21 10:27:20 +01:00
Andreas Rheinhardt cb9f1f59a1 avutil/version: Remove outdated checks
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 01:07:03 +01:00
Andreas Rheinhardt 39b4b5aad7 avcodec: Remove superfluous ';' outside of functions
Inside a function an extra ';' is a null statement;
but outside of it it simply must not happen.
So remove them.

Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 01:06:29 +01:00
Andreas Rheinhardt 48612de63c avcodec/vvc/vvcdsp: Remove pointless wrappers
Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 01:06:22 +01:00
Andreas Rheinhardt ef04737e18 avcodec/vvc/vvc_ps: Use union for luts to avoid unaligned accesses
These arrays are currently accessed via uint16_t* pointers
although nothing guarantees their alignment. Furthermore,
this is problematic wrt the effective-type rules.
Fix this by using a union of arrays of uint8_t and uint16_t.

Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 01:06:10 +01:00
Andreas Rheinhardt 1eafbc27e2 avcodec/vvc/vvc_ps: Check before access
max_bin_idx can be at most LMCS_MAX_BIN_SIZE - 1 here,
so pivot[LCMS_MAX_BIN_SIZE + 1] may be accessed,
but pivot has only LCMS_MAX_BIN_SIZE + 1 elements
(unless the values of pivot were so that it is always
assured that pivot[LCMS_MAX_BIN_SIZE] is always < sample
(which it is iff it is always < 2^bit_depth - 1)).
So reorder the checks.

Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 01:04:28 +01:00
Andreas Rheinhardt 1d66a122df avcodec/avcodec: Deprecate AV_INPUT_BUFFER_MIN_SIZE
It used to be used with preallocated packet buffers with
the old encode API, but said API is no more and therefore
there is no reason for this to be public any more.
So deprecate it and use an internal replacement
for the encoders using it as an upper bound for the
size of their headers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 00:24:44 +01:00
Andreas Rheinhardt b6b33f7edd avutil/common: Move includes to the beginning of the file
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 00:23:39 +01:00
Andreas Rheinhardt 27cd7011bc avutil/tests/pixelutils: Remove dead code
Forgotten in e6b125e3be.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 00:23:20 +01:00
Jan Ekström 37936b09ce avcodec/av1dec: fix matrix coefficients exposed by codec context
`colorspace` in avcodec terms means `matrix coefficients`.

Reviewed-by: James Almer <jamrial@gmail.com>
2024-02-20 20:54:17 +02:00
Andreas Rheinhardt 870d9730d6 avutil/hwcontext_vaapi: Allocate pub and priv frames hwctx together
This is possible because the lifetime of both coincide.
Besides reducing the number of allocations this also simplifies
access to VAAPIFramesContext as one no longer has to
go through AVHWFramesInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 19:08:23 +01:00
Andreas Rheinhardt 520c1b0a7c avutil/hwcontext_vaapi: Allocate public and priv device hwctx together
This is possible because the lifetime of both coincide.
Besides reducing the number of allocations this also simplifies
access to VAAPIDeviceContext as one no longer has to
go through AVHWDeviceInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 19:08:14 +01:00
Andreas Rheinhardt cffadfe99a avformat/movenc: Make check actually check what is intended
Also fixes a Clang warning:
"overlapping comparisons always evaluate to false
[-Wtautological-overlap-compare]"

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 19:00:23 +01:00
Andreas Rheinhardt e2afcb8242 avfilter/af_pan: Uninitialize channel layout
Fixes a leak in the mov-mp4-pcm-float FATE test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 18:41:45 +01:00
Martin Storsjö 58ffe0db4d flvdec: Honor the "flv_metadata" option for the "datastream" metadata field
By default the option "flv_metadata" (internally using the field
name "trust_metadata") is set to 0, meaning that we don't allocate
streams based on information in the metadata, only based on
actual streams we encounter. However the "datastream" metadata field
still would allocate a subtitle stream.

When muxing, the "datastream" field is added if either a data stream
or subtitle stream is present - but the same metadata field is used
to preemtively create a subtitle stream only. Thus, if the field
was added due to a data stream, not a subtitle stream, the demuxer
would create a stream which won't get any actual packets.

If there was such an extra, empty subtitle stream, running
avformat_find_stream_info still used to terminate within reasonable
time before 3749eede66. After that
commit, it no longer would terminate until it reaches the max
analyze duration, which is 90 seconds for flv streams (see
e6a084641a,
24fdf7334d and
f58e011a1f).

Before that commit (which removed the deprecated AVStream.codec), the
"st->codecpar->codec_id = AV_CODEC_ID_TEXT", set within the demuxer,
would get propagated into st->codec->codec_id by numerous
avcodec_parameters_to_context(st->codec, st->codecpar), then further
into st->internal->avctx->codec_id by update_stream_avctx within
read_frame_internal in libavformat/utils.c (demux.c these days).

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-02-20 16:49:51 +02:00
James Almer 8c00fe6408 fate: add IAMF in mp4 tests
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-20 11:45:15 -03:00
James Almer dbfa8381f6 avformat/movenc: add support for Immersive Audio Model and Formats in ISOBMFF
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-20 11:45:11 -03:00
James Almer fe637161db avformat/mov: add support for Immersive Audio Model and Formats in ISOBMFF
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-20 11:24:19 -03:00
James Almer 9ba327e70f avformat/mov: make MOVStreamContext refcounted
This will be useful in the next commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-20 11:24:19 -03:00
James Almer ce7b519ab7 avformat/mov: factorize out setting the output packet properties
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-20 11:24:19 -03:00
James Almer b140b8332c avformat/demux: allow demuxers to output more than one packet per read_packet() call
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-20 11:24:19 -03:00
Peter Ross 37702e2066 avcodec/lead: support format 0x0
Fixes ticket #10660.
2024-02-20 17:31:40 +11:00
Peter Ross db975ff00d avcodec/lead: support unaligned blocks
Fixed ticket #10656.
2024-02-20 16:40:35 +11:00
James Almer 80131321c4 avformat/iamfdec: set disposition flags to output streams
if there's an audio layer with a single stream that can be rendered alone, mark it
as default. Otherwise, mark every stream as dependent.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-19 20:53:36 -03:00
James Almer c95c8a0158 avformat/iamfenc: further split into shareable modules
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-19 20:53:36 -03:00
James Almer c7266ad60f avformat/iamfdec: further split into shareable modules
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-19 20:53:36 -03:00
Andreas Rheinhardt e8cdce88e9 configure, libavutil/version: Remove unused HAVE_MMX2
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt b96b3e291c avutil/intreadwrite: Remove obsolete warning
Obsolete since 7ec2354c38.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt 8d17ab607f avcodec/internal: Move ff_exp2fi() to aacsbr.c
Only used there.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt 42f6dfc42e avcodec/jpeg2000: Simplify exp2fi for numbers used here
The call to ff_exp2fi() here always uses arguments in the normal
range, so that the branches in ff_exp2fi() are unnecessary.
This is so because JPEG2000 itself only supports up to
128 bits per component per pixel (we only support far less);
furthermore, expn is always 0..31 for the decoder and also
sane for the encoder, so that the difference between these
two values is always in the normal range of -126..128.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt 271d6709cf avcodec/jpeg2000dec: Avoid using GetByteContext.buffer directly
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt b48b3250ca avcodec/jpeg2000dec, j2kenc: Constify where appropriate
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt 32178c2f28 avcodec/x86/h264_qpel: Remove put_h264_qpel[48]_mmxext
These functions are not faster than the C versions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt 4d45093f9e avcodec/h264qpel_template: Mark pointers as non-aliasing
It allows the compiler to combine two reads and writes of adjacent
32bit memory locations into 64bit read-writes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt 7cad4dba50 avcodec/x86/hpeldsp_init: Avoid using ff_avg_pixels16_mmx
Use ff_avg_pixels16_mmxext or ff_avg_pixels16_sse2
(for users with SSE2_FAST) instead.
This also allows to remove ff_avg_pixels16_mmx,
as this was its last remaining user.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Andreas Rheinhardt 8a349bb02f avcodec/x86/fpel: Remove declarations of inexistent functions
Forgotten in 50a8cbb23e and
a51279bbde.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 00:09:05 +01:00
Marton Balint 68f2b32ef2 avformat/mxfdec: do not use AnyType when resolving Descriptors and MultipleDescriptors
By using AnyType for resolving a strong reference we searched among all types,
not just the ones which can be the target of the reference, which in some cases
caused to find the wrong type, if the metadata set UUIDs were not unique.

UUIDs do not have to be unique if their type sets them apart, SMPTE 377M says:

> StrongRef: 'One to One’ relationship between sets and implemented in MXF
> with UUIDs. Strong References are typed which means that the definition
> identifies the kind of set which is the target of the reference.

Fixes ticket #10865.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-20 00:04:40 +01:00