1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-07 11:13:41 +02:00
Commit Graph

108410 Commits

Author SHA1 Message Date
Anton Khirnov
8576c3c5d8 lavc/videotoolbox: deprecate write-only output_callback
This field has never been used for anything, so stop setting it and
deprecate it.
2022-09-19 15:18:20 +02:00
Anton Khirnov
d7f4ad88a0 lavc/videotoolbox: do not pass AVCodecContext to decoder output callback
The opaque parameter for the callback is set in videotoolbox_start(),
called when the hwaccel is initialized. When frame threading is used,
avctx will be the context corresponding to the frame thread currently
doing the decoding. Using this same codec context in all subsequent
invocations of the decoder callback (even those triggered by a different
frame thread) is unsafe, and broken after
cc867f2c09, since each frame thread now
cleans up its hwaccel state after decoding each frame.

Fix this by passing hwaccel_priv_data as the opaque parameter, which
exists in a single instance forwarded between all frame threads.

The only other use of AVCodecContext in the decoder output callback is
as a logging context. For this purpose, store a logging context in
hwaccel_priv_data.
2022-09-19 15:18:20 +02:00
Lynne
4ba68639ca
x86/tx_float: add asm call versions of the 2pt and 4pt transforms
Verified to be working.
2022-09-19 06:01:06 +02:00
Lynne
892548e6a1
x86/tx_float: fully support 128bit regs in LOAD64_LUT
The gather path didn't support 128bit registers.
It's not faster on Zen 3, but it's here for completeness.
2022-09-19 06:01:04 +02:00
Lynne
af42bb3d61
x86/tx_float: simplify and describe the intra-asm call convention 2022-09-19 06:01:02 +02:00
Andreas Rheinhardt
2ec59d2973 configure: Remove obsolete APTX decoder dependencies
Forgotten in 18e55de45a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-18 22:43:47 +02:00
Paul B Mahol
1f9f0dc6ee avfilter/af_afftdn: add double sample format support 2022-09-18 22:43:58 +02:00
Paul B Mahol
1af0051977 doc/filters: add speechnorm examples 2022-09-18 19:43:42 +02:00
Paul B Mahol
9ac777234e avfilter/af_dynaudnorm: fix parameter for copy samples function 2022-09-18 19:43:41 +02:00
Rémi Denis-Courmont
7f27ce6882 lavc/fmtconvert: remove dead int32_to_float
This is no longer used since 4608996772.
It also has no implementations other than the plain C one.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-18 18:28:12 +02:00
Andreas Rheinhardt
fc5aef59bf fate/lavf-audio: Add dfpwm test
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-18 17:48:52 +02:00
Paul B Mahol
2069894bc1 avcodec/mlpdec: unbreak TrueHD single substream mono decoding 2022-09-18 15:13:37 +02:00
Paul B Mahol
b0579cc298 avcodec/mlpenc: improve encoding of stereo TrueHD and add mono support 2022-09-18 15:13:37 +02:00
Paul B Mahol
c12a6fd227 avcodec/mlpenc: rename some variables to better alternatives 2022-09-18 15:13:37 +02:00
Paul B Mahol
adaa06581c avcodec/mlpdec: relax channels checking
Internal TrueHD decoder channel rematrix can mix 2 stereo substreams
into single mono stream.

Fixes #1726
2022-09-18 15:13:36 +02:00
Philip Langdale
ed83a3a5bd lavu/pixdesc: favour formats where depth and subsampling exactly match
Since introducing the various packed formats used by VAAPI (and p012),
we've noticed that there's actually a gap in how
av_find_best_pix_fmt_of_2 works. It doesn't actually assign any value
to having the same bit depth as the source format, when comparing
against formats with a higher bit depth. This usually doesn't matter,
because av_get_padded_bits_per_pixel() will account for it.

However, as many of these formats use padding internally, we find that
av_get_padded_bits_per_pixel() actually returns the same value for the
10 bit, 12 bit, 16 bit flavours, etc. In these tied situations, we end
up just picking the first of the two provided formats, even if the
second one should be preferred because it matches the actual bit depth.

This bug already existed if you tried to compare yuv420p10 against p016
and p010, for example, but it simply hadn't come up before so we never
noticed.

But now, we actually got a situation in the VAAPI VP9 decoder where it
offers both p010 and p012 because Profile 3 could be either depth and
ends up picking p012 for 10 bit content due to the ordering of the
testing.

In addition, in the process of testing the fix, I realised we have the
same gap when it comes to chroma subsampling - we do not favour a
format that has exactly the same subsampling vs one with less
subsampling when all else is equal.

To fix this, I'm introducing a small score penalty if the bit depth or
subsampling doesn't exactly match the source format. This will break
the tie in favour of the format with the exact match, but not offset
any of the other scoring penalties we already have.

I have added a set of tests around these formats which will fail
without this fix.
2022-09-17 15:11:13 -07:00
Paul B Mahol
7c60badbed avcodec/exr: recreate offset table outside of packet
Packet might not be writable at this point.
2022-09-17 11:26:49 +02:00
Paul B Mahol
f80e5815c0 avcodec/exr: remove less usefull log messages 2022-09-17 11:26:49 +02:00
Paul B Mahol
05066cba19 avcodec/8bps: fix style issue 2022-09-17 10:32:16 +02:00
Paul B Mahol
e35af6bcef avcodec/mlpdec: fix decoding of overlapping channels in substreams
Fixes #5039
2022-09-17 10:26:20 +02:00
Paul B Mahol
79dcee34dd avcodec: add XWD parser 2022-09-17 10:15:01 +02:00
Paul B Mahol
695bf82bfb avcodec/tta: simplify final samples conversion
Remove dubious overflow message and counter.
2022-09-17 10:00:41 +02:00
Yondon Fu
b11813708d avfilter/vf_libvmaf: Update ssim, ms_ssim options description
Update description for ssim and ms_ssim libvmaf options to specify
feature=float_ssim and feature=float_ms_ssim which are used to request
ssim and ms_ssim values in the latest versions of libvmaf.

Signed-off-by: Yondon Fu <yondon.fu@gmail.com>
2022-09-16 13:07:43 -07:00
Michael Niedermayer
f05247f6a4
avcodec/apedec: Fix integer overflow in filter_3800()
Fixes: signed integer overflow: -2147448926 + -198321 cannot be represented in type 'int'
Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5739619273015296
Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6744428485672960

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-16 21:30:59 +02:00
Michael Niedermayer
67250ee8d2
tools/target_dec_fuzzer: Adjust threshold for Jpeg2000
Fixes: Timeout
Fixes: 50955/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5148704872464384

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-16 21:30:59 +02:00
Michael Niedermayer
14e99cb472
avcodec/hdrdec: Update w in inner loop of decompress()
Fixes: out of array access
Fixes: 50936/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HDR_fuzzer-5423041009549312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-16 21:30:59 +02:00
Michael Niedermayer
3993345f91
avcodec/tta: Check 24bit scaling for overflow
Fixes: signed integer overflow: -8427924 * 256 cannot be represented in type 'int'
Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TTA_fuzzer-5409428670644224

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-16 21:30:58 +02:00
Michael Niedermayer
677e27a9af
avcodec/mobiclip: Check quantizer for overflow
Fixes: signed integer overflow: 127 + 2147483536 cannot be represented in type 'int'
Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-6014034970804224

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-16 21:30:58 +02:00
Michael Niedermayer
ac26712e35
avcodec/exr: Check preview psize
Fixes: signed integer overflow: 17121181824 * 538976288 cannot be represented in type 'long long'
Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5915330316206080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-16 21:30:58 +02:00
Michael Niedermayer
43a4854510
avcodec/tiff: Fix loop detection
Fixes regression with tickets/4364/L1004220.DNG

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-16 21:30:57 +02:00
Hao Chen
fb233771ce
lavc/mips: Fix hevc decoding bugs on MIPS paltform.
The patch fixes the bugs that occurred when running
fate-checkasm-hevc_pel on MIPS paltform.

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-16 21:30:57 +02:00
Lu Wang
d5679d6899
lavc/mips: Fix bugs in me_cmp_msa.c file.
This patch fixes a bug where the fate-checkasm-motion fails when
h is not a multiple of 8.

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-09-16 21:30:57 +02:00
Andreas Rheinhardt
629aa5fbc0 avcodec/dca_lbr: Inline nb_bits for VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
62d9b1195a avcodec/dca_lbr: Hardcode lpc table to save space
The code to initialize it takes more space (in .text) than
the table to be initialized (namely 86B vs 64B for GCC 11.2
with -O3 in an av_cold function), so hardcode the table.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
465e27e0f2 avcodec/dcahuff: Replace DCAVLC by ordinary VLCs
This is possible now that the offsets are already applied
when creating the VLC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
3652114596 avcodec/dca_core: Don't use too big max_depth in get_vlc2()
Most of the VLCs used here have a max_depth of two;
some have a max_depth of one. Therefore one can just use two
and avoid the runtime check for whether one should
perform another round of LUT lookup in case the first read
did not read a complete codeword.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
9dbc370769 avcodec/dca_core: Inline number of bits of scale factor VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
597bfff342 avcodec/dcahuff, dca_core, dca_lbr: Apply offset during VLC creation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
97610e856a avcodec/dcahuff: Combine tables, use ff_init_vlc_from_lengths()
Up until now, initializing the dca VLC tables uses ff_init_vlc_sparse()
with length tables of type uint8_t and code tables of type uint16_t
(except for the LBR tables, which uses length and symbols of type
uint8_t; these tables are interleaved). In case of the quant index
codebooks these arrays were accessed via tables of pointers to the
individual tables.

This commit changes this: First, we switch to ff_init_vlc_from_lengths()
to replace the uint16_t code tables by uint8_t symbol tables
(this necessitates ordering the tables from left-to-right in the tree
first). These symbol tables are interleaved with the length tables.

Furthermore, these tables are combined in order to remove the table of
pointers to individual tables, thereby avoiding relocations (for x64
elf systems this amounts to 96*24B = 2304B saved in .rela.dyn) and
saving 1280B from .data.rel.ro (for 64bit systems). Meanwhile the
savings in .rodata amount to 2709 + 2 * 334 = 3377B. Due to padding
the actual savings are higher: The ELF x64 ABI requires objects >= 16B
to be padded to 16B and lots of the tables have 2^n + 1 elements
of these were from replacing uint16_t codes with uint8_t symbols;
the rest was due to the fact that combining the tables eliminated
padding (the ELF x64 ABI requires objects >= 16B to be padded to 16B
and lots of the tables have 2^n + 1 elements)). Taking this into
account gives savings of 4548B. (GCC by default uses an even higher
alignment (controlled by -malign-data); for it the savings are 5748B.)

These changes also necessitated to modify the init code for
the encoder tables.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
2339f63eac avcodec/dcaenc: Create encoder-adapted tables
Up until now, the encoder used the same tables that the decoder
uses to create its VLCs. These have the downside of requiring
the encoder to offset the tables at runtime as well as having
to read from separate tables for the length as well as the code
of the symbol to encode. The former are uint8_t, the latter uint16_t,
so using a joint table would require padding, but this doesn't
matter when these tables are generated at runtime, because they
live in the .bss segment.

Also move these init functions as well as the functions that
actually use them to dcaenc.c, because they are encoder-specific.
This also allows to remove an inclusion of PutBitContext from
dcahuff.h (and indirectly from all dca-decoder files).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
077880ad88 avcodec/dcahuff: Always use three bits for transition mode VLCs
It increases the size of one VLC from two to three bits, thereby
requiring four more VLCEntries (16 bytes .bss), but it allows to
inline the number of bits used when reading them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
8819860f34 avcodec/dca_core, dcahuff: Don't use DCAVLC unnecessarily
The ff_dca_vlc_transition_mode VLCs don't use an offset at all,
so just use ordinary VLCs for them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
649a2d8d52 avcodec/dcahuff: Avoid redundant offset table
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
13cddfc453 avcodec/dcahuff: Remove unused define
In reality, the bit allocation VLCs do not use the same number
of bits at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
0b1b93823f avcodec/dolby_e_parser: Remove unnecessary headers
Possible since 81d070dd09.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Paul B Mahol
9c05f178a6 avformat/ape: fix overflow in total_blocks 2022-09-16 18:04:20 +02:00
Paul B Mahol
8f11512273 avformat/ape: set packet duration 2022-09-16 18:04:20 +02:00
Andreas Rheinhardt
2c23cd0181 avformat/bonk: Don't set data_offset to what it would be set to anyway
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 17:49:40 +02:00
Andreas Rheinhardt
aaf6d85283 avcodec/Makefile: Remove obsolete adx_parser->adx.c dependency
Obsolete since b024209b1f.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 11:21:22 +02:00
Andreas Rheinhardt
b15a2f2504 avcodec/adx: Move ff_adx_decode_header() to adxdec.c
Possible since 9325d88eba.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 11:14:32 +02:00