Commit Graph

113922 Commits

Author SHA1 Message Date
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
Marton Balint 41672f5586 avformat/mxfdec: move resolving Descriptors to the multi descriptor resolve function
Also remove unused descriptor member from MXFPackage.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-20 00:04:40 +01:00
Andreas Rheinhardt 1f7cd5d434 avformat/iamf_writer: Fix leaks on error
Fixes Coverity issues #1559544 and #1559547.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-19 23:30:18 +01:00
Andreas Rheinhardt c5845afd09 avformat/iamf_writer: Return proper error codes
Surprisingly the return value of add_param_definition()
(a pointer) has only been used to check for success
and not to actually access the pointee; nonsuccess
was equated with ENOMEM, although there is a non-enomem
error path in this function.

Change this by returning an int.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-19 23:30:06 +01:00
Andreas Rheinhardt 18af922c53 avformat/iamf: Don't mix ownership and non-ownership pointers
IAMFAudioElement and IAMFMixPresentation currently contain
pointers to independently allocated objects that are sometimes
owned by said structures and sometimes not.

More precisely, upon success the demuxer transfers ownership
of these other objects newly created AVStreamGroups, but it
keeps its pointers. iamf_read_close() therefore always resets
these pointers (because the cleanup code always treats them
as ownership pointers). This leads to memory leaks in case
iamf_read_header() without having attached all of these
objects to stream groups.

The muxer has a similar issue: It also clears these pointers
(pointing to objects owned by stream groups created by the user)
in its deinit function.

This commit fixes this memleak by explicitly adding non-ownership
pointers; this also allows to remove the code to reset the
ownership pointers.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-19 23:30:00 +01:00
Andreas Rheinhardt e7c33c92d1 avformat/iamf_writer: Don't memset twice
This has been allocated via av_calloc() a few lines above.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-19 23:29:57 +01:00
Andreas Rheinhardt 840f192540 avformat/iamf_writer: Remove nonsense check
Checking whether a pointer to an element of an array is NULL
makes no sense, as the pointer addition involved in getting
the address would be undefined behaviour already if the array
were NULL.
In this case the array allocation has already been checked
a few lines before.
Fixes Coverity issue #1559548.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-19 23:29:49 +01:00
Andreas Rheinhardt 94fadd335b avformat/iamf_writer: Don't leak on error when adding ParamDefinition
Fix this by postponing the allocation.
Fixes Coverity issue #1559545.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-19 23:29:25 +01:00
Marton Balint 86410e55ad fate: use an even more exotic channel layout mov-mp4-pcm-float test
The old layout happened to be a native layout and therefore missed some
recently fixed layout parsing bugs.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-19 22:29:46 +01:00
James Almer 4b8be3616d avformat/mpegts: remove decoding param from ts_packetsize option
It's a read only exported option, and not meant to be set by the user.
Also, move it to MPEGTS_OPTIONS while at it to avoid duplication.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-19 11:25:21 -03:00
James Almer f9f56fdc37 avformat/mpegts: add a ts_id exported option
It will replace AVFormatContext.ts_id in the coming bump.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-19 11:25:15 -03:00
Steven Liu 0c8e64e268 mailmap: remap my email accounts
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2024-02-19 11:55:53 +08:00
Lynne e43615fc2a
configure: fix compilation with glslang 14
The configure check already had fallback for the previous version
of glslang, which had different requirements for flags.
This commit simply moves the flags needed for glslang 13 to the
fallback, while first trying to use new flags for glslang 14.

This drops support for ~3 year old glslang versions, which
I'm not sure had the complete C API we're using anyway.
2024-02-18 19:57:47 +01:00
Andreas Rheinhardt 749e93d11d tests/fate-run: Do not ignore errors from intermediate commands
Otherwise the test may pass while ignoring errors from sanitizers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 18:09:49 +01:00
Andreas Rheinhardt 44620ade25 fftools/ffmpeg_mux_init: Fix attachment_filename use-after-free
The filename is freed with the OptionsContext and therefore
there will be a use-after-free when reporting the filename
in print_stream_maps(). So create a copy of the string.

This is a regression since 8aed3911fc.
fate-lavf-mkv_attachment exhibits it (and reports a random nonsense
filename here), but this does not make the test fail (not even with
valgrind; only with ASAN, as it aborts on use-after-free).

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 18:09:33 +01:00
Andreas Rheinhardt 32538dafca avfilter/avfilter: Move frame_pool to FilterLinkInternal
Avoids ugly casts when uninitializing.
(One could actually avoid allocating this separately if one
were willing to expose FFFramePool to those files including
link_internal.h.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt 4a7329994a avfilter/avfilter: Move age_index to FilterLinkInternal
Also make FFFilterGraph.sink_links a FilterLinkInternal**
because sink_links is used to access FilterLinkInternal
fields.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt 40b91eaea9 avfilter/avfilter: Move init_state to FilterLinkInternal
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt 89eea4e19a avfilter/avfilter: Move AVFilterGraph private fields to FFFilterGraph
(These fields were in AVFilterGraph although AVFilterGraphInternal
existed for years.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt 03567ed80c avfilter/avfiltergraph: Avoid allocation for AVFilterGraphInternal
To do this, allocate AVFilterGraphInternal jointly with AVFilterGraph
and rename it to FFFilterGraph in the process (similarly to
AVStream/FFStream).
The AVFilterGraphInternal* will be removed on the next major version
bump.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt a1aec776f1 avfilter/avfiltergraph: Avoid indirection when freeing filtergraph
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt a272c9cffa avfilter: Add a header for internal generic-layer APIs
This commit moves the generic-layer stuff (that is not used
by filters) to a new header of its own, similarly to
5e7b5b0090 for libavcodec.
thread.h and link_internal.h are merged into this header.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt db98b0e04e avfilter/avfilter: Avoid allocation for AVFilterInternal
To do this, allocate AVFilterInternal jointly with AVFilterContext
and rename it to FFFilterContext in the process (similarly to
AVStream/FFStream).
The AVFilterInternal* will be removed from AVFilterContext
on the next major bump.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt cc36a9f5b9 avfilter/signature_lookup: Avoid branch when adding to linked list
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt 626a076249 avfilter/signature_lookup: Remove useless error logs
These logs use the wrong loglevel and are uninformative;
and it is of course highly unlikely that a buffer of 56B
can't be allocated.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt bf82b6517e avfilter/signature_lookup: Allocate buffers jointly
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt eeb99dcb51 avfilter/signature_lookup: Check for allocation error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt c149d86760 avfilter/vf_signature: Allocate arrays together
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Lynne c7ceff690f
lavu/tx: correctly use a default scale parameter for all transform types
This fixes the previous commit and adds more cases (DCT-I and DST-I).

I am holding off on defining a scale parameter for FFTs as I'd like
to use a complex value for them.
2024-02-18 16:21:03 +01:00
James Almer b5911654c4 avutil/channel_layout: print known layout names in custom layout
If a custom layout is equivalent to a native one, check if it matches one of the
known layout names and print that instead.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-18 09:59:40 -03:00
Jan Ekström e06ce6d2b4 {avcodec,tests}: rename the bundled Mesa AV1 vulkan video headers
This together with adjusting the inclusion define allows for the
build to not fail with latest Vulkan-Headers that contain the
stabilized Vulkan AV1 decoding definitions.

Compilation fails currently as the AV1 header is getting included
via hwcontext_vulkan.h -> <vulkan/vulkan.h> -> vulkan_core.h, which
finally includes vk_video/vulkan_video_codec_av1std.h and the decode
header, leading to the bundled header to never defining anything
due to the inclusion define being the same.

This fix is imperfect, as it leads to additional re-definition
warnings for things such as
VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION. , but it is
not clear how to otherwise have the bundled version trump the
actually standardized one for a short-term compilation fix.
2024-02-18 13:16:37 +02:00
Marton Balint b81ed729ec avformat/mov_chan: rework ff_mov_read_chnl
A lot of changes and fixes to channel layout parsing, notably
- get rid of dynamic allocation of channel positions
- signal unimplemented speaker positions as unknown instead of failure, but
  warn the user about it
- native order, and that a single channel only appears once was always assumed
  for less than 64 channels, obviously this was incorrect

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-18 10:54:24 +01:00
Marton Balint f8f2142d61 avformat/mov: factorize reading the main part of the chnl atom to mov_chan
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-18 10:54:24 +01:00
Marton Balint 65c9c52a5a avutil/tests/channel_layout: add tests for av_channel_order_retype
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-18 10:54:22 +01:00
Marton Balint 242901f7c2 avutil/channel_layout: add FF_CHANNEL_ORDER_NB
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-18 10:43:12 +01:00
Marton Balint 2a12c04e35 avutil/channel_layout: change AV_CHAN_SILENCE to AV_CHAN_UNUSED in the docs
It got renamed during the API design phase.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-18 10:43:12 +01:00
Anton Khirnov 75697836b1 Require compilers to support C11.
It should be available in all relevant modern compilers and will allow
us to use features like anonymous unions.

Note that stdatomic.h is still emulated on MSVC, as current versions
require the /experimental:c11atomics, and do not support
ATOMIC_VAR_INIT() anyway.
2024-02-18 07:38:28 +01:00
Mattias Wadman 78812cd147 avcodec/h2645_parse: Don't treat 0x000002 as a start code and truncate
According to ITU-T H.265 7.4.2.1 this byte sequence should not appear in a
NAL unit but in practice in rare cases it seems it does, possibly due to buggy
encoders. Other players like VLC and Quicktime seem to be fine with it.

Currently when this sequence is found it is treated as if the next start code
has been found and the NAL unit gets truncated.

This change limits the code to only look for first start code 0x0000001 or
first escape 0x000003.

Sadly i can't share the original source file with the issue but the first
80 bytes of the NAL unit looks like this:

       │00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│
0x00000│00 00 00 01 02 01 d0 bc 57 a1 b8 44 70 01 00 0b│........W..Dp...│
0x00010│80 2e 00 c2 6c ec 3e b9 e3 03 fb 91 2e d2 43 cb│....l.>.......C.│
0x00020│1d 2c 00 00 02 00 02 00 5c 93 72 6f 31 76 18 00│.,......\.ro1v..│
0x00030│08 38 aa b1 4c 33 3f fd 08 cb 77 9b d4 3c db 02│.8..L3?...w..<..│
0x00040│a2 04 73 15 75 de 3b c4 67 c0 8f ca ad 31 f1 99│..s.u.;.g....1..│

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-02-18 07:33:27 +01:00
Connor Worley a4f019e44e lavc/dxv: assume DXV2 files use premultiplied alpha
I generated a DXV2 file with an interesting alpha channel using
Adobe Media Encoder 2015 and compared decoding it using Resolume Alley
and ffmpeg. Similarly to DXV3 files, Alley expects premultiplied alpha
and ffmpeg matches its decoding more closely when it does the same.

Reference file: https://connorworley.com/dxv2-dxt5.mov

Existing FATE tests for DXV2 files do not cover this change.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-02-18 07:33:27 +01:00