Commit Graph

114389 Commits

Author SHA1 Message Date
Andreas Rheinhardt f1b08b8a65 avcodec/mips/aaccoder_mips: Remove MIPS-specific aaccoder
ff_aac_coder_init_mips() modifies a static const structure of
function pointers. This will crash if the binary uses relro
and is a data race in any case.

Furthermore it points to a maintainability issue: The
AACCoefficientsEncoder structures have been constified
in commit fd9212f2ed,
a Libav commit merged in 318778de9e.
Libav did not have the MIPS-specific AAC code and so this was
fine for them; yet FFmpeg had them, but this was not recognized.

Commit 75a099fc73 points to another
maintainability issue: Contrary to ordinary DSP code, this code
here is way more complex and needs to be constantly kept in sync
with the ordinary code which it mimicks and replaces. Said commit
is the only commit actually changing aaccoder.c in the last few
years and the same change has not been performed for the MIPS
clone; before that, it even happened several times that the mips
code was broken due to changes of the generic code (see commits
97437bd17a and
de262d018d or
860dbe0275 or
933309a6ca or
b65ffa316e). This might even lead
to scenarios where someone changing non-dsp aacenc code would
have to modify mips inline asm in order to keep them in sync.
This is obviously a significant burden (if the AAC encoder were
actively developed).

Finally, the code does not even compile here due to errors like
"Error: float register should be even, was 1".

Reviewed-by: Lynne <dev@lynne.ee>
Reviewed-by: Jean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 01:49:38 +01:00
Andreas Rheinhardt e6c7a88b34 avutil/hash: Avoid relocations for hash names
These strings are so short (longest takes 11B) that using
pointers is wasteful. Avoiding them also moves hashdesc
into .rodata (from .data.rel.ro).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 01:48:46 +01:00
Andreas Rheinhardt 95a6788314 avformat/aiffenc: Usw avio_wb32() where possible
AIFF is a big-endian format, so this is more natural.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 16:09:15 +01:00
Andreas Rheinhardt 0230792bc8 avformat/aiffenc: Simplify padding tag
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 16:09:15 +01:00
Andreas Rheinhardt f088b28950 fate/lavf-audio: Test writing AIFF-native tags
In particular, test writing tags with odd strlen.
(These tags are zero-padded to even size.)

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 16:08:13 +01:00
Andreas Rheinhardt 3f7ee34efe avcodec/mpegaudio(data|dsp): Mark symbols as hidden
Avoids .got entries for ff_mpa_bitrate_tab, ff_mpa_synth_window_fixed,
ff_band_size_long, ff_mpa_pretab, ff_band_size_short,
ff_mpa_synth_window_float and ff_band_index_long here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt 333ff3e98d avcodec/vorbis_data: Mark symbols as hidden
Avoids .got entries for ff_vorbis_ch_layouts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt 6ffdf2f370 avcodec/dirac_arith: Only include x86/asm.h for ARCH_X86
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt b6301dc658 avdevice/alldevices: Mark iterators as av_cold
Because they are.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt 7cf4c9037c avdevice/alldevices: Mark devices as hidden
Both GCC and Clang create code that inlines the loops in
next_input() and next_output() at high optimization
levels (presumably when there are not too many devices)
and this code leads to the creation of .got entries:
  e7:	48 3b 3d 00 00 00 00 	cmp    0x0(%rip),%rdi        # ee <av_input_video_device_next+0xe>
			ea: R_X86_64_REX_GOTPCRELX	ff_alsa_demuxer-0x4
  ee:	74 43                	je     133 <av_input_video_device_next+0x53>
  f0:	48 3b 3d 00 00 00 00 	cmp    0x0(%rip),%rdi        # f7 <av_input_video_device_next+0x17>
			f3: R_X86_64_REX_GOTPCRELX	ff_fbdev_demuxer-0x4
  f7:	74 41                	je     13a <av_input_video_device_next+0x5a>

These relocations can't be fixed up lateron when it is known
that the symbols exist in the same DSO.

This commit therefore marks these symbols as hidden, leading
to code like this:
  f7:	48 8d 05 00 00 00 00 	lea    0x0(%rip),%rax        # fe <av_input_video_device_next+0xe>
			fa: R_X86_64_PC32	ff_alsa_demuxer-0x4
  fe:	48 39 c7             	cmp    %rax,%rdi
 101:	74 55                	je     158 <av_input_video_device_next+0x68>
 103:	48 8d 05 00 00 00 00 	lea    0x0(%rip),%rax        # 10a <av_input_video_device_next+0x1a>
			106: R_X86_64_PC32	ff_fbdev_demuxer-0x4
 10a:	48 39 c7             	cmp    %rax,%rdi
 10d:	74 50                	je     15f <av_input_video_device_next+0x6f>

(Note: It is actually strange that the compiler creates code
that tries to read the addresses from the .got given that the
addresses can be read directly from indev_list/outdev_list.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt ff15edf15a avcodec/ac3tab: Remove enum CustomChannelMapLocation
Forgotten in 4c8d9b1d09.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt 62412cd75d avformat/iamf: Mark symbols as hidden
Avoids .got entries for ff_iamf_scalable_ch_layouts and
ff_iamf_sound_system_map (whether they would have been
created otherwise depends upon the compiler and compiler
options).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Andreas Rheinhardt 1faafe738d fftools/ffmpeg_opt: Check before accessing union member
OptionDef.u is only an offset (i.e. its off member) iff OPT_FLAG_OFFSET
is true. Otherwise, the pointer arithmetic can be undefined behaviour.
UBSan warns about this (on 32bit arches):
src/fftools/ffmpeg_opt.c:102:15: runtime error: pointer index expression with base 0xffa4db10 overflowed to 0x56059a50

This commit fixes this by checking for OPT_FLAG_OFFSET first.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-17 15:10:05 +01:00
Henrik Gramner c3d3f0e697 avutil/x86util: Fix broken pre-SSE4.1 PMINSD emulation
Fixes yadif-16 which allows FATE to pass.

Broken since 2904db9045 (2017).
2024-03-17 13:52:27 +01:00
Stone Chen de2fb43e78 doc/filters: Change rdiv (vf_convolution) documentation to reflect actual behavior
The documentation correctly states that the rdiv is a multiplier but incorrectly states the default behavior is to multiply by the sum of all matrix elements - it multiplies by 1/sum.

This changes the documentation to match the code.

Address trac #10889

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 22:02:56 +01:00
Marton Balint d35b6fda45 avformat/mxfdec: signal channel layouts using the new channel layout api
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:49:39 +01:00
Marton Balint a4fc331118 avutil/channel_layout: add specific text versions for unknown and unused channels
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:49:39 +01:00
Marton Balint a688fbfb88 avutil/channel_layout: fix some (un)initialization issues in av_channel_layout_from_string()
Also make initialization/uninitialization behaviour more explicit in the docs,
and make sure we do not leak a channel map on error.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:49:39 +01:00
Marton Balint 95d31db82c avutil/channel_layout: factorize parsing list of channel names
Also make use of the av_channel_from_string() function to determine the channel
id. This fixes some parse issues in av_channel_layout_from_string().

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:49:39 +01:00
Marton Balint 0b3b8a1918 avutil/tests/channel_layout: add some av_channel_from_string and av_channel_layout_from_string tests
We lacked tests which supposed to fail, and there are some which should fail
but right now it does not. This will be fixed in a later commit.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:49:39 +01:00
Marton Balint b2b22c2d1a avutil/tests/channel_layout: make printing results part of the tests
Deduplicates a lot of code.

Some minor differences (mostly white space and inconsistent use of quotes) are
expected in the fate tests, there was no point aiming for exactly the same
formatting.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:49:39 +01:00
Marton Balint 26e0454cad avformat/mov_chan: simplify channel layout canonicalization
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:49:39 +01:00
Marton Balint ed6207274e avutil/channel_layout: add AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:49:39 +01:00
Marton Balint 44b2769619 avformat/pcm: decrease target audio frame per sec to 10
This makes the wav and pcm demuxer demux bigger packets, which is more
efficient.

As a side effect of the bigger packets, audio durations can become less exact
for command lines such as "ffmpeg -i $INPUT -c:a copy -t 1.0 $OUTPUT".

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:19:42 +01:00
Marton Balint 05936403f9 avformat/wavdec: use ff_pcm_default_packet_size for the default packet size
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:19:42 +01:00
Marton Balint 9c2c0c37f8 avformat/pcm: factorize and improve determining the default packet size
- Remove the 1024 cap on the number of samples, for high sample rate audio it
  was suboptimal, calculate the low neighbour power of two for the number of
  samples (audio blocks) instead.
- Make the function work correctly also for non-pcm codecs by using the stream
  bitrate to estimate the target packet size. A previous version of this patch
  used av_get_audio_frame_duration2() the estimate the desired packet size, but
  for some codecs that returns the duration of a single audio frame regardless
  of frame_bytes.
- Fallback to 4096/block_align*block_align if bitrate is not available.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-16 19:19:42 +01:00
Gyan Doshi f5441e441f avformat/mpegtsenc: correct bitstream check
8559cce3c3 made the bitstream check generic using a LUT.
However, one of the comparisons which involves a bitwise AND
and equality check is faulty due to operator precedence.

First reported and analysed at
https://github.com/streamlink/streamlink/issues/5876

Fixes #10908
2024-03-16 14:30:05 +05:30
James Almer aca7037e01 tools/target_dec_fuzzer: force experimental flag for decoders that need it
Otherwise they will not even open.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 22:38:13 -03:00
Timo Rothenpieler b47abd5737 avfilter/vsrc_ddagrab: clear all flags of buffer texture
One some system, one some displays, for unknown reasons,
these contain rather bad flags that cause all kinds of weird
behaviour.
2024-03-16 00:44:58 +01:00
James Almer cfa694d811 fate/wmavoice: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 59f5cf5c71 fate/vqf: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer e48b221144 fate/voice: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 9906bef5c4 fate/vorbis: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 85da6e5c44 fate/real: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 2262c9ab0c fate/pcm: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 540d1b14d8 fate/mpc: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 2df103528c fate/mp3: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 6d569aa80c fate/mov: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer b80b3947dd fate/monkeysaudio: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer be9d9b7aba fate/lossless-audio: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 8b96aca432 fate/libswresample: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 47362785ae fate/iamf: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 92c7e27373 fate/hlsenc: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 6887a0292f fate/gapless: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer f3f2932f75 fate/ffprobe: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:44:59 -03:00
James Almer 536dfe92e0 fate/ffmpeg: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:37:50 -03:00
James Almer 4c8b8bc52b fate/filter-audio: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:37:42 -03:00
James Almer 20581cea3e fate/fate-container: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:05:38 -03:00
James Almer 7416d216aa fate/demux: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:05:35 -03:00
James Almer 04ab5cc584 fate/audio: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:05:27 -03:00