1
0
Fork 0

Compare commits

...

2036 Commits

Author SHA1 Message Date
Michael Niedermayer d24b136f53
tools/target_dec_fuzzer: adjust threshold for AV_CODEC_ID_IFF_ILBM
Fixes: timeout
Fixes: 66444/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-4812862400823296

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-19 04:10:48 +01:00
Michael Niedermayer af91b1b366
tools/target_dem_fuzzer: add libavformat/demux.h
needed for FFInputFormat

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-19 04:10:48 +01:00
Nicolas Gaullier b96571df3a
doc/fate: advise on --assert-level=2
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-19 04:10:48 +01:00
Andreas Rheinhardt d1e446f2e1 fate/atrac: Add atrac->aea, atrac->matroska remux tests
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-19 03:17:12 +01:00
Andreas Rheinhardt 7e41a658f5 avformat/aeadec: Use sample rate as time base
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-19 02:54:24 +01:00
Andreas Rheinhardt 103965053b avformat/aeadec: Export title
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-19 02:54:13 +01:00
Haihao Xiang d296c8689d lavu/hwcontext_vulkan: check PCI ID if possible
Otherwise the derived device and the source device might have different
PCI ID in a multiple-device system.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-03-19 09:37:39 +08:00
Stefano Sabatini 39087e739c doc/muxers: add fits 2024-03-18 17:59:45 +01:00
Stefano Sabatini 9754e1f532 doc/muxers: add filmstrip 2024-03-18 17:59:32 +01:00
Stefano Sabatini 38c18dca63 doc/muxers: add film_cpk 2024-03-18 17:59:26 +01:00
Stefano Sabatini be37ce70fe doc/muxers: add ffmetadata 2024-03-18 17:59:19 +01:00
Timo Rothenpieler 030f4925b8 avutil/hwcontext_d3d11va: add logging to dxgi debug interfaces 2024-03-18 13:28:30 +01:00
Timo Rothenpieler 6e78d92399 avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when available
A lot of modern stuff straight up fails on the old 1.0 factory, which is
masked by the fact that it's only used when an explicit adapter is
specified.
2024-03-18 13:28:30 +01:00
Timo Rothenpieler ae5453503d avutil/hwcontext_d3d11va: remove check for d3d11 debug layer dll
At least on latest Win 11 and Visual Studio 2022, that DLL does not
exist anymore and can't be installed via any of the usual means.
However, debugging works just fine regardless, so this check makes
debugging impossible.

D3D11CreateDevice will fail anyway if debugging is not supported, so
let's rely on that instead.
2024-03-18 13:28:30 +01:00
Andreas Rheinhardt efcb539f47 tests/ref/lavf-fate/hevc.flv: Fix ref file
Unbreaks the lavf-fate-hevc.flv FATE test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 12:10:04 +01:00
Gyan Doshi a32f75d6e2 fate/lavf-container: correct operator; unbreak build 2024-03-18 16:14:43 +05:30
Steven Liu 7c9e7665e1 Changelog: Add Support PacketTypeMetadata of PacketType in enhanced flv
Reviewed-by: Jean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2024-03-18 18:38:48 +08:00
Zhu Pengfei aeebcd2f73 fate/flvenc: support enhanced flv PacketTypeMetadata
Signed-off-by: Zhu Pengfei <411294962@qq.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2024-03-18 17:06:46 +08:00
Zhu Pengfei 85e047e7cd avformat/flvenc: support enhanced flv PacketTypeMetadata
Signed-off-by: Zhu Pengfei <411294962@qq.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2024-03-18 15:41:54 +08:00
Zhu Pengfei 4e5b1882d6 avformat/flvdec: support enhanced flv PacketTypeMetadata
Signed-off-by: Zhu Pengfei <411294962@qq.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2024-03-18 15:41:48 +08:00
Fei Wang 8962e2b1aa lavc/vaapi_decode: Don't update buffer number if allocataion fail
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-03-18 12:00:14 +08:00
Fei Wang a8d9fab06b lavc/vaapi_encode: Enable block level bitrate control
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-03-18 12:00:14 +08:00
Haihao Xiang 74a8e080d0 lavu/hwcontext_qsv: Join the download/upload session to the main session
This may reduce the number of internal threads when using hwupload or
hwdownload filter.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-03-18 12:00:14 +08:00
Haihao Xiang 697251bb0c lavc/qsvdec: Do not print warning when draining cached frames
When all cached frames are drained, the output mfxSyncPoint pointer is
NULL and  MFX_ERR_MORE_DATA is returned, hence needn't print warning for
this expected behavior, otherwise the user might think the output from
qsv decoders are wrong.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-03-18 12:00:14 +08:00
Andreas Rheinhardt 6e63295d41 avformat/crypto: Avoid cast, use proper printf specifier
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 01:53:32 +01:00
Andreas Rheinhardt 7b48cc61be avformat/aeaenc: Fix printf-specifier
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 01:53:26 +01:00
Andreas Rheinhardt 2a0194bafa avcodec/ccaption_dec: Use static_assert instead of _Static_assert
The latter is not supported by MSVC 19.27.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-18 01:49:38 +01:00
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
James Almer fc17af7f8d fate/atrac: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:05:22 -03:00
James Almer 8755e7eb74 fate/amrwb: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:05:18 -03:00
James Almer 7a10d6521f fate/amrnb: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:05:14 -03:00
James Almer b3ab87d320 fate/alac: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:04:31 -03:00
James Almer 234268b4ed fate/adpcm: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:03:36 -03:00
James Almer 73095bc19e fate/ac3: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:03:36 -03:00
James Almer 136f1cdf0f fate/aac: add missing aresample filter dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-15 12:03:36 -03:00
Marth64 4464b7eeb1 avformat/dvdvideodec: use int64_t for menu blocks_read and make format expressions portable
Signed-off-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-15 15:50:35 +01:00
Andreas Rheinhardt 5f7eb4240a avcodec/tests/snowenc: Fix mixed declaration and code
Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-15 15:31:58 +01:00
Andreas Rheinhardt c00cd007e8 configure: Remove av_restrict
All versions of MSVC that support C11 (namely >= v19.27)
also support the restrict keyword, therefore av_restrict
is no longer necessary since 75697836b1.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-15 12:51:15 +01:00
Andreas Rheinhardt 53a51e70f2 avformat/internal: Remove declaration for ff_format_io_close_default()
Forgotten in d6799ee0e4.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-14 22:53:50 +01:00
Andreas Rheinhardt 78e2be2377 fftools/ffmpeg_sched: Remove set-but-unused variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-14 22:53:45 +01:00
Andreas Rheinhardt 09e6840cf7 avcodec/ppc/vp8dsp_altivec: Fix out-of-bounds access
h_subpel_filters_inner[i] and h_subpel_filters_outer[i / 2]
belong together and the former allows the range 0..6,
so the latter needs to support 0..3. But it has only three
elements. Add another one.
The value for the last element has been guesstimated
from subpel_filters in libavcodec/vp8dsp.c.

This is also intended to fix FATE-failures with UBSan here:
https://fate.ffmpeg.org/report.cgi?time=20240312011016&slot=ppc-linux-gcc-13.2-ubsan-altivec-qemu

Tested-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-14 22:20:00 +01:00
Andreas Rheinhardt 8e207bf463 avcodec/mpeg4videodec: Align idct-block appropriately
It is accessed via AV_RN64A in ff_simple_idct_put_int32_10bit().
Should fix the UBSan failures in the mpeg4-simple-studio-profile
test here:
https://fate.ffmpeg.org/report.cgi?time=20240312011016&slot=ppc-linux-gcc-13.2-ubsan-altivec-qemu

Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Tested-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-14 21:52:16 +01:00
Andreas Rheinhardt cc2d2b665e avcodec/lossless_videoencdsp: Fix unaligned access
HAVE_FAST_UNALIGNED being true does not imply that
one can simply read from any pointer via *(long*).
It is undefined behaviour in case the pointer is not
sufficiently aligned; and even if it is, it is (likely)
a violation of the effective-type rules. Fix both
of these by using the appropriate AV_[RW]N macros.

Also, the current code used sizeof(long) as if this
were the CPU's native arithmetic size, but this is
not true on 64bit Windows. This has been fixed, too.

This affected huffyuv FATE-tests.

Tested-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-14 21:22:45 +01:00
Andreas Rheinhardt 7a089ed8e0 avformat/avidec: Fix integer overflow iff ULONG_MAX < INT64_MAX
Affects many FATE-tests, see
https://fate.ffmpeg.org/report.cgi?time=20240312011016&slot=ppc-linux-gcc-13.2-ubsan-altivec-qemu

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-14 20:48:20 +01:00
James Almer a327434df7 fate/ffmpeg: add missing idct decoder option to fate-ffmpeg-loopback-decoding
Should fix failures on x86_32 targets.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-14 16:44:12 -03:00
Andreas Rheinhardt f9aa5457ff avcodec/ppc/h264dsp: Fix unaligned stores
Also fix an effective-type violation.
Exposed by https://fate.ffmpeg.org/report.cgi?time=20240312011016&slot=ppc-linux-gcc-13.2-ubsan-altivec-qemu

Tested-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-14 20:37:25 +01:00
Andreas Rheinhardt f032f1326b avcodec/tiff_data: Remove incorrect GeoTIFF entries
They are incorrect according to [1]. They also share keys with valid
entries, so that it is unspecified which entry bsearch returns
in this case. Fix this by removing the incorrect values.

[1]: https://www.earthdata.nasa.gov/s3fs-public/imported/19-008r4.pdf

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-14 20:37:03 +01:00
Andreas Rheinhardt 282812d6dc avcodec/tiff_data: Avoid relocations for TiffGeoTagNameType
Instead store all the strings in one continugous string
(with internal \0) and use offsets to access the actual
substrings. This replaces the pointers to the strings
and therefore avoids relocations (and on x64, it actually
shrinks TiffGeoTagNameType by reusing padding to store
the offset field).

This saves 720B of .data.rel.ro and 1080B of .rela.dyn
(containing the relocation records) here while increasing
.rodata by 384B.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-14 20:37:03 +01:00
James Almer ad6347fc37 fate/ffmpeg: add a -threads input option to the loopback decoder
Honor the requested value passed when calling make fate.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-14 10:48:09 -03:00
James Almer d925b2e139 fate/ffmpeg: add a test for loopback decoding
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-14 10:00:03 -03:00
Martin Storsjö 8ff4a4a4f4 checkasm: hevc_pel: Use checkasm_check for printing failing output
This simplifies the code for checking the output, and can print
the failing output (including a map of matching/mismatching
elements) if checkasm is run with the -v/--verbose option.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-03-14 13:42:39 +01:00
Martin Storsjö 3ad3ada11f checkasm: hevc_pel: Split a couple excessively long lines
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-03-14 13:42:39 +01:00
Martin Storsjö 64a2cdca13 checkasm: hevc_pel: Check the full output in hevc_epel/hevc_qpel
Previously it only checked half the output in 8 bit per pixel mode,
as the output actually is 16 bit elements here.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-03-14 13:42:39 +01:00
Martin Storsjö 0c5da7be59 aarch64: Fix ff_hevc_put_hevc_epel_h48_8_neon_i8mm
The first 32 elements of each row were correct, while the
last 16 were scrambled.

This hasn't been noticed, because the checkasm test erroneously
only checked half of the output (for 8 bit functions), and
apparently none of the samples as part of "fate-hevc" seem to
trigger this specific function.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-03-14 13:42:39 +01:00
Marton Balint 2129d66a66 fate: use atrim filter instead of -frames:a 20 for fate-filter-tremolo
To make it independent of incoming wav demuxer packet size.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-14 01:37:31 +01:00
Marton Balint 6fc6cac4c6 fate: use a fixed wav demux packet size for amix tests
The dropout transition feature of the amix filter depends on the incoming
packet size.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-14 01:37:31 +01:00
Marton Balint 8c8ce4f233 fate: make filter-channelsplit test use a fixed frame size
Muxing multiple streams to raw files is allowed but the packets are
interleaved, so the output is dependant of packet size.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-14 01:37:31 +01:00
Marton Balint 7196b12b2b avformat/daudenc: force 2000 sample packet size with a bsf
The samples I found all have 2000 sample packets, and by forcing the packet
size with a bsf we could automagically make muxing work for packets containing
more than 3640 samples.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-14 01:37:31 +01:00
Marton Balint 9eebeea4dd avcodec/bsf/pcm_rechunk: add some more supported PCM formats
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-14 01:37:31 +01:00
Marton Balint 66e6272917 avcodec/bsf/pcm_rechunk: reorder supported codec list
Use lexical order.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-14 01:37:31 +01:00
Kieran Kunhya 110d8549d5 avcodec/vvcdec: Mark as experimental
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-13 20:46:10 -03:00
Andreas Rheinhardt c1cdaef5ce avcodec/hevc_cabac: Let compiler count offsets
This is easily possible with an X macro.
Using an enum for the offsets also allows to remove
two arrays which are not really needed and will typically
be optimized away by the compiler: The first just exists
to count the number of syntax elements*, the second one
exists to get offset[CONSTANT]. These constants were
of type enum SyntaxElement and this enum was only used
in hevc_cabac.c (although it was declared in hevcdec.h);
it is now no longer needed at all and has therefore been
removed.

The first of these arrays led to a warning from Clang
which is fixed by this commit:
warning: variable 'num_bins_in_se' is not needed and will
not be emitted [-Wunneeded-internal-declaration]

*: One could also just added a trailing SYNTAX_ELEMENT_NB
to the SyntaxElement enum for this purpose.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-13 23:29:02 +01:00
Mark Thompson 98a2ade630 avcodec: Fix doxygen comment marker 2024-03-13 21:56:59 +00:00
James Almer 394abd8458 fftools/ffprobe: export IAMF Stream Group parameters
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-13 16:45:15 -03:00
James Almer 5cd8db3060 fftools/ffprobe: export Tile Grid Stream Group parameters
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-13 16:06:10 -03:00
Rajiv Harlalka 4700925d22 lavfi/atempo: avoid asendcmd assertion failure
Check for zeros equal to the total samples early, because in
that case we would already be leaving the first few frames out.

Fixes trac ticket #10692
2024-03-13 09:45:17 +00:00
Anton Khirnov 8996945d45 fftools/ffmpeg_enc: set AV_PKT_FLAG_TRUSTED on encoded packets
This allows using WRAPPED_AVFRAME encoders with loopback decoders in
order to connect multiple filtergraphs together.

Clear the flag in muxers, since lavf does not need it for anything and
it would change the results of framecrc FATE tests.
2024-03-13 08:01:28 +01:00
Anton Khirnov a9193f7b7d fftools/ffmpeg: add loopback decoding
This allows to send an encoder's output back to decoding and feed the
result into a complex filtergraph.
2024-03-13 08:01:27 +01:00
Anton Khirnov b98af440c5 fftools/ffmpeg: prepare FrameData for having allocated fields
Will be useful in following commits.
2024-03-13 08:01:15 +01:00
Anton Khirnov efab83c156 fftools/ffmpeg_sched: allow connecting encoder output to decoders 2024-03-13 08:01:15 +01:00
Anton Khirnov da17c4d24a fftools/ffmpeg_sched: factor initializing nodes into separate function
Will be useful in following commits.
2024-03-13 08:01:15 +01:00
Anton Khirnov 6ccbff2631 fftools/ffmpeg_sched: allow encoders to send to multiple destinations
Will become useful in following commits.
2024-03-13 08:01:15 +01:00
Anton Khirnov 3febc84e5e fftools/ffmpeg_enc: merge do_{audio,video}_out into frame_encode()
These functions used to be much longer, but now they are only a couple
lines each, some of them duplicated between audio and video.
2024-03-13 08:01:15 +01:00
Anton Khirnov 2f5c570dd6 fftools/ffmpeg_enc: drop unnecessary parameter from forced_kf_apply()
Encoder timebase is equal to the frame timebase, so does not need to be
passed separately.

Also, rename in_picture to frame, which is shorter and more accurate -
it always contains a frame, never a field.
2024-03-13 08:01:15 +01:00
Anton Khirnov 2ee9362419 fftools/ffmpeg: remove unncessary casts for *_thread() return values
These functions used to be passed directly to pthread_create(), which
required them to return void*. This is no longer the case, so they can
return a plain int.
2024-03-13 08:01:15 +01:00
Anton Khirnov f5d03b972c fftools/ffmpeg: simplify propagating fallback parameters from decoders to filters
Current callstack looks like this:
* ifilter_bind_ist() (filter) calls ist_filter_add() (demuxer);
* ist_filter_add() opens the decoder, and then calls
  dec_add_filter() (decoder);
* dec_add_filter() calls ifilter_parameters_from_dec() (i.e. back into
  the filtering code) in order to give post-avcodec_open2() parameters
  to the filter.

This is unnecessarily complicated. Pass the parameters as follows
instead:
* dec_init() (which opens the decoder) returns post-avcodec_open2()
  parameters to its caller (i.e. the demuxer) in a parameter-only
  AVFrame
* the demuxer passes these parameters to the filter in
  InputFilterOptions, together with other filter options
2024-03-13 08:01:15 +01:00
Anton Khirnov cabeac9123 fftools/ffmpeg_filter: add logging for binding inputs to demuxer streams 2024-03-13 08:01:15 +01:00
Anton Khirnov cb0ec854fd fftools/ffmpeg_filter: move filtergraph input type check to a better place
Perform it right after we figure out what the type is.
2024-03-13 08:01:15 +01:00
Anton Khirnov 7b51523f12 fftools/ffmpeg_opt: merge init_complex_filters() and check_filter_outputs()
The first of these binds inputs of complex filtergraphs to demuxer
streams (with a misleading comment claiming it *creates* complex
filtergraphs).

The second ensures that all filtergraph outputs are connected to an
encoder.

Merge them into a single function, which simplifies the ffmpeg_filter
API, is shorter, and will also be useful in following commits.

Also, rename misleadingly-named init_input_filter() to
fg_complex_bind_input().
2024-03-13 08:01:15 +01:00
Anton Khirnov c4de5778bc fftools/ffmpeg_dec: factor opening the decoder out of dec_open()
Rename dec_open to dec_init(), as it is more descriptive of its new
purpose.

Will be useful in following commits, which will add a new path for
opening decoders.
2024-03-13 08:01:15 +01:00
Anton Khirnov 48c39a9c71 fftools/ffmpeg_dec: move scheduler registration from dec_open() to dec_alloc()
Will be useful in following commits where we will want to create a
decoder before having enough information to open it.
2024-03-13 08:01:15 +01:00
Anton Khirnov 6f2acd7a9c fftools/ffmpeg_filter: drop unused InputFilterPriv.ist
Outside of ifilter_bind_ist(), there are no longer any assumptions about
about filter inputs being fed by an InputStream.
2024-03-13 08:01:15 +01:00
Anton Khirnov daca5d1241 fftools/ffmpeg_filter: refactor setting input timebase
Treat it analogously to stream parameters like format/dimensions/etc.
This is functionally different from previous code in 2 ways:
* for non-CFR video, the frame timebase (set by the decoder) is used
  rather than the demuxer timebase
* for sub2video, AV_TIME_BASE_Q is used, which is hardcoded by the
  subtitle decoding API

These changes should avoid unnecessary and potentially lossy timestamp
conversions from decoder timebase into the demuxer one.

Changes the timebases used in sub2video tests.
2024-03-13 08:01:15 +01:00
Anton Khirnov ddaedde7a8 fftools/cmdutils: fix printing group name in split_commandline() 2024-03-13 08:01:15 +01:00
Gyan Doshi 9e8be937fc configure: add threads dep for vulkan
Fixes #10900
2024-03-13 09:57:54 +05:30
Reimar Döffinger 605fc72f19
avcodec/parser: Reset *buf_size on realloc failure
Fixes: out of array access
Fixes: crash-0d640731c7da52415670eb47a2af701cbe2e1a3b
Fixes: crash-e745864ead6ea418959c8df56de2765571201dae

Found-by: Catena cyber <contact@catenacyber.fr>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-13 00:52:30 +01:00
Christian Lee Seibold 384cc270d2 avformat/gopher: Add audio and video itemtypes
The 's', ';', and '<' itemtypes are used for audio and video by
Gophernicus and Gopher+.

Signed-off-by: Christian Lee Seibold <christian.seibold32@outlook.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-12 23:01:46 +01:00
Nicolas Gaullier 275add9328 fate: fix generating references when sh=dash
Regression since 0b98f28c46

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-12 23:01:46 +01:00
Kristoffer Brånemyr 51d303e20c avformat/webvttdec: Skip more parts of header to let parsing continue
Signed-off-by: Kristoffer Brånemyr <ztion1@yahoo.se>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-12 23:01:46 +01:00
Andreas Rheinhardt 41ab25cb2d avformat/fifo_test: Move into tests/fifo_muxer.c
This muxer solely exists to test the fifo muxer via a dedicated
test tool in libavformat/tests/fifo_muxer.c. It fulfills no
other role and it is only designed with this role in mind.

The latter can be seen in two facts: The muxer uses printf
for logging and it simply presumes the packets' data to contain
a FailingMuxerPacketData (a struct duplicated in fifo_test.c
and tests/fifo_muxer.c.); in particular, it presumes packets
to have data at all, but this need not be true with side-data
only packets and a segfault can easily be triggered by e.g.
encoding flac (our native encoder sends a side-data only packet
with updated extradata at the end of encoding).

This patch fixes this by moving the test muxer into the fifo
test tool, making it inaccessible via the API (and actually
removing it from libavformat.so and libavformat.a).
While this muxer was accessible via e.g. av_guess_format(),
it was not really usable for an API user as FailingMuxerPacketData
was not public. Therefore this is not considered a breaking change.

In order to continue to use the test muxer in the test tool,
the ordinary fifo muxer had to be overridden: fifo_muxer.c
includes lavf/fifo.c but with FIFO_TEST defined which makes
it support the fifo_test muxer. This is possible because
test tools are always linked statically to their respective
library.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-12 22:39:54 +01:00
Leo Izen a356815a31
avcodec/libjxlenc: add option to disable xyb encoding
Add an AVOption to the libjxl encoder wrapper, which exposes the flag
uses_original_profile in libjxl. For highly unusual ICC profiles where
the target needs to stay in the original space, this can be useful.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-03-12 17:36:05 -04:00
Andreas Rheinhardt c9eb36e0a0 avcodec/tiff: Use ff_tget_long() where appropriate
No need to use the generic ff_tget() when we know the type.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-12 18:05:34 +01:00
James Almer 7cf4e305a2 fate/h264: add missing swscale dependency to h264-bsf-mp4toannexb-new-extradata
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-12 13:41:29 -03:00
Marth64 b3d87fb0c4 avformat/sccdec: remove unused bprint.h include
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-12 14:54:54 +01:00
Marth64 9b981e3112 avcodec/rcwtenc: canonize name and refresh documentation
The formal title of the muxer according to the specification
is "RCWT (Raw Captions With Time)", so canonize this
in the long name of the codec and docs.

In the documentation section, point #2 was wrong: ccextractor
extracts the Closed Captions data and stores normalized bits
similarly to this muxer.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-12 14:54:54 +01:00
Andreas Rheinhardt c14dc99f44 avcodec/tiff: Improve inclusions
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-12 14:37:49 +01:00
Andreas Rheinhardt f6f94c3357 avcodec/tiff: Don't check before av_freep()
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-12 14:37:45 +01:00
Andreas Rheinhardt 957053b52a avcodec/tiff: Avoid duplicating strings
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-12 14:37:33 +01:00
Andreas Rheinhardt 9b9b574191 avcodec/tiff: Fix handling of av_strdup() failures
For unknown geokey values, get_geokey_val() returns
"Unknown-%d" with val being used for %d. This string
is allocated and therefore all the known geokey values
(static strings) are strdup'ed. In case this fails
it is either ignored or treated as "Unknown-%d".
(Furthermore it is possible to call av_strdup(NULL),
although this is not documented to be legal.)

This commit changes this by only returning the static strings
in get_geokey_val(); the unknown handling and strdup'ing
is moved out of it.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-12 14:35:52 +01:00
Fei Wang 4027c2e1d0 lavc/vvc_ps: Correct NoOutputBeforeRecoveryFlag of IDR
The NoOutputBeforeRecoveryFlag of an IDR frame should be set to 1 as
spec says in 8.1.1.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-03-12 20:25:25 +08:00
Fei Wang c252d2b84a lavc/vvcdec: Add missed chroma sampling factor for crop offset
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-03-12 20:25:25 +08:00
asivery 9124d807dc avformat/aea: add aea muxer
Signed-off-by: asivery <asivery@protonmail.com>
2024-03-12 11:26:13 +01:00
hung kuishing 78803a4b8a doc/examples/qsv_decode: remove unused config.h header file
Signed-off-by: clarkh <hungkuishing@outlook.com>
2024-03-12 11:26:06 +01:00
Marth64 275877b981 avformat/dvdvideodec: add menu demuxing support
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-12 11:14:16 +01:00
Marth64 b8cbaad2ac avformat/dvdvideodec: add CLUT utilities and subtitle color support
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-12 11:14:16 +01:00
Stefano Sabatini 75dd083904 doc/muxers/fifo: review documentation
Apply consistency fixes, sort options, clarify example.
2024-03-12 11:13:31 +01:00
Stefano Sabatini 5828aaa2b5 lavf/fifo: sort options by name 2024-03-12 11:05:01 +01:00
Anton Khirnov f344277a88 fftools/ffmpeg_filter: merge block with the enclosing one
It has no reason to exist.
2024-03-12 09:47:56 +01:00
Anton Khirnov 639208cc6a fftools/ffmpeg_filter: don't forward EOF in close_output()
The caller does not need or expect it, and it can lead to terminating
filtering prematurely in case there is more than one output.
2024-03-12 09:47:56 +01:00
Anton Khirnov ce178be8b0 fftools/ffmpeg_filter: do not assume av_buffersrc_get_nb_failed_requests()>0
Apparently it can happen that avfilter_graph_request_oldest() returns
EAGAIN, yet av_buffersrc_get_nb_failed_requests() returns 0 for every
input.

Works around #10795, though the root issue is most likely in the
scale2ref filter.
2024-03-12 09:47:14 +01:00
Stefano Sabatini 53a952a731 lavf/fifo: fix typo 2024-03-11 16:52:42 +01:00
Stefano Sabatini bce9234f10 lavf/dvenc: improve error messaging
Provide useful information about the failure in the error message, do
not let the user guess.
2024-03-11 16:52:42 +01:00
Stefano Sabatini 58a1386eaf fftools/opt_common: show if muxer is device 2024-03-11 16:52:42 +01:00
Niklas Haas da39a19aad avcodec/av1dec: parse DV profile 10 T.35 OBU
See previous commit.
2024-03-11 11:40:09 +01:00
Niklas Haas a5d1e69b3b avcodec/libdav1d: parse DV profile 10 T.35 OBU
This is thankfully passed through verbatim by libdav1d, so we can parse
it in our own code.

In theory, taking the DV profile from the packet-level configuration
struct is redundant since there is currently only one possible DV level
for AV1 (and all others would fail parsing), but this marginally
future-proofs it against possible new AV1-specific profiles being added
in the future.
2024-03-11 11:40:09 +01:00
Niklas Haas 9aecd717ab avcodec/dovi_rpu: implement support for profile 10
Instead of the nal_prefix, this profile inside wraps the RPU inside an
EMDF container, as specified in ETSI TS 102 366. However, this
DV-specific EMDF container is restricted (by the specification) to
a fixed set of hard-coded parameters, which we can effecitvely treat as
a magic byte sequence.

Validated and tested using official Dolby sample files, which
I unfortunately cannot share. However, there are public sample files
available at the merge request link below.

Relevant links:
- https://www.etsi.org/deliver/etsi_ts/102300_102399/102366/01.04.01_60/ts_102366v010401p.pdf
- https://patentimages.storage.googleapis.com/8a/0b/da/28294acaed2182/EP3588964A1.pdf
- https://www.etsi.org/deliver/etsi_ts/103500_103599/103572/01.03.01_60/ts_103572v010301p.pdf
- https://gitlab.com/mbunkus/mkvtoolnix/-/merge_requests/2254
2024-03-11 11:40:09 +01:00
Gyan Doshi 3d1860ec8d avfilter: update filter timeline state only on main link
At present, consume_update evaluates timeline state on all links for
a multi-input filter. This can lead to the filter being incorrectly
en/dis-abled when evaluation on a frame on a secondary link leads to
a different result than the frame on the current main link next in
line for processing.
2024-03-11 15:38:13 +05:30
Martin Storsjö c31d232656 libavcodec: Don't include libavcodec/x86/vvc/Makefile on any architecture
This currently builds files in the libavcodec/x86/{vvc,h26x}
subdirectories, which is somewhat unexpected when building for
another architecture than x86.

The regular arch subdirectories are handled with

    -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile

in the toplevel Makefile. Switch this to a similar optional
inclusion, using $(ARCH).

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-03-10 23:46:48 +02:00
Martin Storsjö cd420c2949 makefile: Clean up missed object files with "make clean"
In some builds, the following object files could be left behind
after make clean:

./libavfilter/metal/utils.o
./libavfilter/metal/vf_yadif_videotoolbox.metallib.o
./libavcodec/x86/h26x/h2656dsp.o
./libavcodec/neon/mpegvideo.o
./ffbuild/bin2c_host.o

Fixes: http://trac.ffmpeg.org/ticket/10895

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-03-10 23:45:51 +02:00
Michael Niedermayer e0e30e07a1
avcodec/proresenc_kostya: Remove bug similarity text
According to kostya, it is not based on Wassermans encoder

CC: Kostya Shishkov <kostya.shishkov@gmail.com>
CC: Anatoliy Wasserman <anatoliy.wasserman@yandex.ru>

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-10 19:49:05 +01:00
Michael Niedermayer dc89cf804a
avcodec/vorbisdec: Check remaining data in vorbis_residue_decode_internal()
Fixes: timeout
Fixes: 66326/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-6295291863040000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-10 19:49:04 +01:00
Michael Niedermayer b2d7cbc378
avformat/concatdec: Check in and outpoints to be to produce a positive representable duration
Fixes: signed integer overflow: -93000000 - 9223372036839000000 cannot be represented in type 'long'
Fixes: 64546/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-5110813828186112

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-10 19:49:04 +01:00
Michael Niedermayer 5db09574df
avcodec/8bps: Consider width in the minimal size check
Fixes: Timeout
Fixes: 64479/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EIGHTBPS_fuzzer-5434435386081280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-10 19:49:03 +01:00
Andreas Rheinhardt cc95fd4531 doc/bitstream_filters.texi: Document types used by filter_units
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-10 17:49:16 +01:00
Marth64 2c82ec9b4a doc/bitstream_filters: add filter_units practical examples for removing closed captions
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-10 16:01:18 +01:00
Marth64 590b2d6517 avcodec/ccaption_dec: use consistent naming convention of Closed Captions
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-10 15:21:23 +01:00
Marth64 8991cedd6a avcodec/ccaption_dec: clarify log message when out-of-display columns are ignored
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-10 15:21:23 +01:00
Marth64 e68f57d89e MAINTAINERS: add myself as dvdvideo demuxer, rcwt muxer maintainer
I am willing to maintain these into the future as needed.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-10 15:21:23 +01:00
Marth64 ffc3f2a350 avformat/dvdvideodec: assign mono channel layout explicitly
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-10 15:01:11 +01:00
Andreas Rheinhardt ac61231757 avutil/avstring: Use proper types
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-10 13:51:37 +01:00
Andreas Rheinhardt 9e36e2fb7b avcodec/xpmdec: Use LUT for hex char->number conversion
Speeds up decoding and also reduces binary size.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-10 13:51:37 +01:00
Andreas Rheinhardt 0b2ed7f6c7 avcodec/xbmdec: Use LUT for hex char->number conversion
Improves performance by about 30%.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-10 13:51:37 +01:00
Andreas Rheinhardt 8fb89790af avcodec/h264_ps: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-10 13:51:37 +01:00
Andreas Rheinhardt 878f8cabe8 avcodec/xbmenc: Avoid snprintf() for data->hex conversion
Use a small LUT instead. Improves performance.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-10 13:50:26 +01:00
Andreas Rheinhardt 357e339898 avcodec/xpmdec: Avoid unnecessary size_t->int conversion
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-10 13:50:26 +01:00
Marton Balint 64634e809f avformat/mxfenc: add h264_mp4toannexb bitstream filter if needed when muxing h264
Partially fixes ticket #10395.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-08 20:22:32 +01:00
James Almer 901165516c fate/flvenc: force the av1 decoder in all steps for fate-enhanced-flv-av1
Tested-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-08 10:38:55 -03:00
联盟少侠 e6d933404f avfilter/avfilter: Fix for Incorrect Parameter in ff_filter_config_links
src/libavfilter/internal.h:255:45: note: passing argument to parameter 'filter' here
int ff_filter_config_links(AVFilterContext *filter);

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-08 13:12:21 +01:00
Martin Storsjö 71e871280d libavdevice: Fix the avfoundation device after switching to FFInputFormat
This was missed in b800327f4c.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-03-08 12:48:59 +02:00
Anton Khirnov abd7da0af9 lavfi: deprecate avfilter_config_links()
It never makes sense for this function to be called by users.
2024-03-08 09:29:54 +01:00
Anton Khirnov 6b1f41e152 lavfi: deprecate avfilter_link_free()
It never makes sense for this function to be called by users.
2024-03-08 09:29:54 +01:00
Anton Khirnov c0aee39412 tests/fate/matroska: add tests for side data preference
Cf. #10857

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-03-08 07:44:05 +01:00
Anton Khirnov 6169bd0fea lavc/*dec: use side data preference for mastering display/content light metadata 2024-03-08 07:38:38 +01:00
Niklas Haas 588c5c3d51 avcodec/dpx: respect side data preference
If the time code side data is overridden by the packet level, we also
make sure not to update `p->metadata` to a mismatched timecode.
2024-03-08 07:37:56 +01:00
Niklas Haas 0b7aefe698 avcodec/libdav1d: respect side data preference
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-03-08 07:37:56 +01:00
Niklas Haas 133cbbe31e avcodec/webp: respect side data preference 2024-03-08 07:37:56 +01:00
Niklas Haas 276be6da9e avcodec/tiff: respect side data preference 2024-03-08 07:37:56 +01:00
Niklas Haas 454691a2ec avcodec/pngdec: respect side data preference 2024-03-08 07:37:56 +01:00
Niklas Haas ffb8dc7be6 avcodec/mpeg12dec: respect side data preference
We only need to consider side data types that may possibly come from the
packet.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-03-08 07:37:56 +01:00
Niklas Haas ed3cc8fc65 avcodec/mjpegdec: respect side data preference 2024-03-08 07:37:56 +01:00
Niklas Haas 62f40d0e38 avcodec/libjxldec: respect side data preference
Also fixes a memory leak where the side data was previously not properly
cleaned up on OOM.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-03-08 07:37:56 +01:00
Niklas Haas b9565db9a0 avcodec/hevcdec: respect side data preference
If the time code side data is overridden by the packet level, we also
make sure not to update `out->metadata` to a mismatched timecode.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-03-08 07:37:56 +01:00
Anton Khirnov d9f1b321cf lavc/hevcdec: pass an actual codec context to ff_h2645_sei_to_frame()
Needed by following commit.
2024-03-08 07:37:56 +01:00
Niklas Haas eec01ef65f avcodec/h264_slice: respect side data preference
If the time code side data is overridden by the packet level, we also
make sure not to update `out->metadata` to a mismatched timecode.
2024-03-08 07:37:56 +01:00
Niklas Haas 2c2d3d5acb avcodec/cri: respect side data preference
This function was already ignoring OOM errors.
2024-03-08 07:37:56 +01:00
Niklas Haas 01056078ed avcodec/av1dec: respect side data preference 2024-03-08 07:37:56 +01:00
Anton Khirnov 6dd832673b lavc: add content light/mastering display side data wrappers 2024-03-08 07:37:56 +01:00
Niklas Haas 8a70c5cb93 avcodec: add internal side data wrappers
The signature of these wrappers is more complicated due to a need to
distinguish between "failed allocating side data" and "side data was
already present".

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-03-08 07:37:56 +01:00
Anton Khirnov 68a8eca752 lavc: add a decoder option for configuring side data preference
This and the following commits fix #10857
2024-03-08 07:37:55 +01:00
Anton Khirnov efe4478778 lavu/opt: add array options 2024-03-08 07:36:15 +01:00
Anton Khirnov fc706276c0 lavu/opt: distinguish between native and foreign access for AVOption fields
Native access is from the code that declared the options, foreign access
is from code that is using the options. Forbid foreign access to
AVOption.offset/default_val, for which there is no good reason, and
which should allow us more freedom in extending their semantics in a
compatible way.
2024-03-08 07:24:50 +01:00
Anton Khirnov c259f80315 lavu/opt: factor per-type dispatch out of av_opt_copy()
Will be useful in following commits.
2024-03-08 07:24:50 +01:00
Anton Khirnov 2cd89194b0 libavutil/opt: rework figuring out option sizes
Replace the opt_size() function, currently only called from
av_opt_copy(), with
* a constant array of element sizes
* a function that signals whether an option type is POD (i.e.
  memcpyable) or not

Will be useful in following commits.
2024-03-08 07:24:50 +01:00
Anton Khirnov 85797886fe lavu/opt: factor per-type dispatch out of av_opt_set()
Will be useful in following commits.
2024-03-08 07:24:50 +01:00
Anton Khirnov a1be08ba05 lavu/opt: factor per-type dispatch out of av_opt_get()
Will be useful in following commits.
2024-03-08 07:24:50 +01:00
Andreas Rheinhardt 93178c6c1a avformat/tests/movenc: Constify write functions
Forgotten in 2a68d945cd.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-08 03:30:57 +01:00
Haihao Xiang eb7d019b32 lavfi/vulkan_filter: fix input format
Otherwise s->input_format is always yuv420p.

This fixes invalid output format for hwframe download in the command
below:
./ffmpeg -init_hw_device vulkan -f lavfi \
	-i testsrc=duration=1,format=nv12 \
	-vf 'hwupload,format=vulkan,scale_vulkan=1024:768,hwdownload,format=nv12' \
	-f null -

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-03-08 10:10:51 +08:00
Andreas Rheinhardt dfffe03755 avutil/dict: Deduplicate freeing dictionary
Reviewed-by: epirat07@gmail.com
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-08 01:01:49 +01:00
Andreas Rheinhardt 6cf904ac3d checkasm/hevc_deblock: Initialize buffer
Fixes the hevc_deblock checkasm test with Valgrind.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-08 01:01:49 +01:00
Andreas Rheinhardt ec1b6e0cd4 avcodec/ccaption_dec: Avoid relocations for strings
The longest string here takes four bytes, so using an array
of pointers is wasteful even when ignoring the cost of relocations;
the lack of relocations also implies that this array
will now be put into .rodata and not into .data.rel.ro.

Static asserts are used to ensure that all strings are always
properly zero-terminated.

Tested-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-08 00:59:24 +01:00
Andreas Rheinhardt c9f5cea9cc avcodec/vdpau: Deprecate redundant allocators and getter/setter
The allocators have been superseded by av_vdpau_bind_context().
The latter have only been added "to allow multiple forks to add
fields to the structure without breaking ABI" [1], but libav
is no more, so this is not needed any longer.

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2013-August/146954.html

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-08 00:58:40 +01:00
Andreas Rheinhardt 2a87345e69 avcodec/vdpau: Remove outdated comment
Forgotten in b773a8d8c1.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-08 00:57:09 +01:00
Niklas Haas 30d6861a11 fftools/ffprobe: add AVFilmGrainParams printing 2024-03-07 21:09:06 +01:00
Niklas Haas c2a233fe14 avfilter/vf_showinfo: add AVFilmGrainAOMParams support
For testing purposes.
2024-03-07 21:08:53 +01:00
Andreas Rheinhardt 2dfdee3969 avcodec/xvmc: Remove header
Forgotten in a12cd3be98.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 16:33:23 +01:00
Anton Khirnov 384a207ea9 lavf/matroskadec: add missing linebreaks in error messages 2024-03-07 15:59:31 +01:00
James Almer 783d00b203 libs: bump major version for all libraries
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 11:29:43 -03:00
Anton Khirnov 0757669629 lavc: move AVCodecContext.pts_correction* to DecodeContext
These fields are documented to be non-public and are only used in
decode.c
2024-03-07 08:53:32 -03:00
James Almer c8db1006ef avformat/avformat: Reorder AVFormatContext fields
Move related fields closer together.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:32 -03:00
James Almer 53cdf94653 avformat/avformat: remove AVFormatContext.ts_id
It's been replaced by a demuxer exported private option.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:32 -03:00
James Almer 823d60d55e avcodec/codec_par: Reorder AVCodecParameters fields
Move related fields closer together.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt 326c97dd38 avcodec/avcodec: Reorder AVCodecContext and AVSubtitleRect fields
Move related fields closer together and try to plug holes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt 3e669b24e2 avutil/hwcontext: Allocate AVHWFramesCtx jointly with its internals
This is possible because the lifetime of these structures coincide.
It has the advantage of allowing to remove AVHWFramesInternal
from the public header; given that AVHWFramesInternal.priv is no more,
most accesses to AVHWFramesInternal are no more; indeed, the only
field accessed of it outside of hwcontext.c is the internal frame pool,
making this commit very simple.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt a0b9b96269 avutil/hwcontext_internal: Remove unused AVHWFramesInternal.priv
It is no longer used by any hwcontext, as they all allocate
their private data together with their public data and access
it via AVHWFramesContext.hwctx.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt 51d6bee667 avutil/hwcontext_d3d12va: 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 D3D12VAFramesContext as one no longer has to
go through AVHWFramesInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt dd397d05f1 avutil/hwcontext: Allocate AVHWDevCtx jointly with its internals
This is possible because the lifetime of these structures coincide.
It has the advantage of allowing to remove the AVHWDeviceInternal
from the public header; given that AVHWDeviceInternal.priv is no more,
all accesses to it happen in hwcontext.c, so that this commit moves
the joint structure there.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt 060277136d avutil/hwcontext: Remove unused AVHWDeviceInternal.priv
It is no longer used by any hwcontext, as they all allocate
their private data together with their public data and access
it via AVHWDeviceContext.hwctx.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt 51f0405450 avutil/hwcontext_d3d12va: Allocate pub 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 D3D12VADevicePriv as one no longer has to
go through AVHWDeviceInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt 71c7e9c5f4 avfilter/avfilter: Reorder structure fields
Move related fields closer together and try to plug holes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt a76592440e avfilter/avfilter: Remove always-NULL pointers to internal contexts
Made possible by db98b0e04e
and 03567ed80c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt cd93ba6531 avformat/demux: Use enum AVCodecID for raw_codec_id
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt be54923abc avutil/opt: Don't use AV_OPT_TYPE_FLAGS for sentinels
Make AVOptionType start with 1 instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt b800327f4c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat
This commit does for AVInputFormat what commit
59c9dc82f4 did for AVOutputFormat:
It adds a new type FFInputFormat, moves all the internals
of AVInputFormat to it and adds a now reduced AVInputFormat
as first member.

This does not affect/improve extensibility of both public
or private fields for demuxers (it is still a mess due to lavd).

This is possible since 50f34172e0
(which removed the last usage of an internal field of AVInputFormat
in fftools).

(Hint: tools/probetest.c accesses the internals of FFInputFormat
as well, but given that it is a testing tool this is not considered
a problem.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt bb81c60927 Revert "avcodec: Rename ff_kbd_window_init() as it will be needed from outside libavcodec"
This reverts commits fd5aa93a37
and cf00f60bab
("avcodec/kbdwin: Support arbitrary sized windows").

The change in question has only been made for libavradio.
in anticipation of merging it into the main tree. This has
not happened, so this commit reverts the changes to kbdwin
that are not used for anything else. In particular, these
functions are no longer exported (as avpriv functions);
notice that the fixed-point function has been exported
despite having never been used outside of lavc.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
James Almer 7b11fd585f avutil/version_major: postpone some deprecations until the next bump
They are too recent.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer d4574a9b64 avformat/version_major: postpone some deprecations until the next bump
They are either too recent, or are not trivial to remove.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 118948cbac avcodec/version_major: postpone some deprecations until the next bump
They are either too recent, or can't be removed yet.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 583cf2a869 avutil: remove deprecated FF_API_FRAME_PICTURE_NUMBER
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 67e7f0b05e avutil: remove deprecated FF_API_REORDERED_OPAQUE
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer b8fef7e9c5 avutil: remove deprecated FF_API_PKT_DURATION
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 4c92fc02f8 avutil: remove deprecated FF_API_AV_FOPEN_UTF8
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 65ddc74988 avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUT
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer a12cd3be98 avutil: remove deprecated FF_API_XVMC
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 4105899245 avutil: remove deprecated FF_API_FIFO_OLD_API
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 43c62b11aa avutil: remove deprecated FF_API_FIFO_PEEK2
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer e58afae1e4 avfilter: remove deprecated FF_API_LIBPLACEBO_OPTS
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 02aea61d69 avformat: remove deprecated FF_API_AVIO_WRITE_NONCONST
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer d6799ee0e4 avformat: remove deprecated FF_API_AVFORMAT_IO_CLOSE
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer aaefe47913 avformat: remove deprecated FF_API_AVIODIRCONTEXT
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer c4c6c9e9d2 avformat: remove deprecated FF_API_GET_END_PTS
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 5b23b18d40 avcodec: remove deprecated FF_CODEC_CRYSTAL_HD
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 98e1eebef9 avcodec: remove deprecated FF_API_SLICE_OFFSET
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 2717dcfb85 avcodec: remove deprecated FF_API_AVCTX_FRAME_NUMBER
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 7bca8ce422 avcodec: remove deprecated FF_API_VT_HWACCEL_CONTEXT
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer c4498aae7c avcodec: remove deprecated FF_API_AVCODEC_CHROMA_POS
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer f00f70c8f1 avcodec: remove deprecated FF_API_VT_OUTPUT_CALLBACK
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 9ee59b63f5 avcodec: remove deprecated FF_API_AYUV_CODECID
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:29 -03:00
James Almer c947731275 avcodec: remove deprecated FF_API_SVTAV1_OPTS
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:29 -03:00
James Almer 0b8940f96a avcodec: remove deprecated FF_API_IDCT_NONE
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:29 -03:00
Andreas Rheinhardt 97beb63a66 avcodec/hq_hqa: Make VLC tables static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 09:15:18 +01:00
Andreas Rheinhardt 51b2343ef9 avcodec/hq_hqadata: Move data in a header
It is only used by hq_hqa.c, so said header can simply
be included there.
Also move the code to initialize the VLCs to hq_hqa.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 09:15:18 +01:00
Andreas Rheinhardt ccb432c1fe avcodec/vulkan_decode: Remove always-false check
These fields are set for all Vulkan decoding hwaccels;
they would be useless if it were different.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 09:00:47 +01:00
Andreas Rheinhardt f9d35e78fe avcodec/vulkan_decode: Un-sparse extensions table
Only three of the 226 (== AV_CODEC_ID_AV1) entries
have been used. Unsparsing this table is especially
important given that this array lives in .data.rel.ro.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 09:00:39 +01:00
Andreas Rheinhardt f7b227bec3 avcodec/vulkan_video: Merge dec part of FFVkCodecMap and extension props
All the fields of FFVkCodecMap are either decoder-only
or encoder-only (with the latter being unused and unset for now).
Yet there is already a per-decoder struct containing
static information about these decoders, namely
VkExtensionProperties.

This commit merges the decoder-parts of FFVkCodecMap
with the VkExtensionProperties into a common structure.

Given that FFVkCodecMap is now unused, it is removed.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 09:00:30 +01:00
Andreas Rheinhardt 6c82b7bc0a avcodec/vulkan_video: Remove unused array
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 09:00:14 +01:00
Andreas Rheinhardt 49707b0590 avformat/options: Deprecate av_fmt_ctx_get_duration_estimation_method()
Forgotten in b7785d10b0.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-06 13:27:52 +01:00
James Almer d65908c3d4 avcodec/decode: remove HDR10+ from the global side data array
It's a per packet/frame side data type.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 21:39:52 -03:00
James Almer d34e9a81b1 fate/iamf: print stream disposition
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 18:07:25 -03:00
James Almer 924c7cd745 fate/mov: add a heic test with a derived image using a single item twice
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 17:29:20 -03:00
James Almer 708175616c fate/mov: use framecrc for the remaining avif/heic tests
Put them in sync with the other tests.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 17:29:20 -03:00
James Almer 1f73b52850 fate/mov: print stream group information for avif/heic tests
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 17:29:20 -03:00
Andreas Rheinhardt 68f48d5c30 avutil/hwcontext_videotoolbox: 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 VTFramesContext as one no longer has to
go through AVHWFramesInternal.

Tested-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 18:45:36 +01:00
James Almer 1a34eb3ffc avformat/mov: fix setting dependent disposition on ambisonic IAMF streams
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 13:26:04 -03:00
James Almer 3635c1ee97 fate/mov: print stream group information for iamf tests
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 13:03:03 -03:00
James Almer e3671e6441 fate/iamf: print stream group information
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 13:00:46 -03:00
James Almer 7e4334e16a fftools/ffprobe: add support for Stream Groups
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 12:56:21 -03:00
James Almer 3769968afd fftools/ffprobe: fix printing side data components and pieces
Components and pieces are side data specific fields and there's a variable
amount of them.
They also need to be identified in some form, so print a type too.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 12:56:13 -03:00
James Almer ab15c04dee avformat/avformat: add a function to return the name of stream groups
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 11:54:27 -03:00
James Almer 79c6ba9007 avformat/iamf_writer: constify some variables
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 11:39:17 -03:00
James Almer 988e3a061a avformat/iamf_writer: clear extradata_size on extradata allocation failure
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 11:23:41 -03:00
Andreas Rheinhardt 440f8186ef avformat/dashenc, hlsenc: Return 0 on succes from write_header
Do not propagate the return value of avformat_write_header(),
as it contains the information whether the output had
already been initialized in avformat_init_output(),
but this is set generically; the return value of
FFOutputFormat.write_header is not documented at all
(and is currently ignored if >= 0), but it is more future-proof
to simply return 0 on success.

Reviewed-by: Liu Steven <lq@chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 15:15:31 +01:00
Andreas Rheinhardt d085f341d6 avformat/hlsenc: Redo checking for strftime %s support to avoid warnings
This is intended to avoid -Wformat= warnings on systems
where %s might not be supported (and also generally emitted
by GCC with -pedantic).

Reviewed-by: Liu Steven <lq@chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 15:15:06 +01:00
Zhao Zhili b0e17e0f95 avcodec/mediacodecenc: Add a hint message to use nv12 pix_fmt
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-05 21:25:56 +08:00
Andreas Rheinhardt fed46d7706 avformat/avio: Avoid av_strdup(NULL)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 12:08:18 +01:00
Andreas Rheinhardt c856e4c546 avformat/avio: Avoid indirection in ffio_fdopen()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 12:08:18 +01:00
Andreas Rheinhardt 57e20dd6b6 avformat/avio: Avoid function pointer casts
It is undefined behaviour to use a different type for a call
than the actual type of the function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 12:08:18 +01:00
Andreas Rheinhardt f0abb44fbf avformat/aviobuf: Move code specific to URLContexts to avio.c
This separates the URL-layer adjacent parts of the code
from the parts that are also usable with custom IO.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 12:08:18 +01:00
Andreas Rheinhardt 91745ac233 avutil/hwcontext_qsv: 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 QSVFramesContext as one no longer has to
go through AVHWFramesInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 09:33:28 +01:00
Andreas Rheinhardt 028907b08a avutil/hwcontext_qsv: 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 QSVDeviceContext as one no longer has to
go through AVHWDeviceInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 09:33:16 +01:00
Andreas Rheinhardt 32fd27df2f avutil/hwcontext_d3d11va: 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 D3D11VAFramesContext as one no longer has to
go through AVHWFramesInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 08:59:35 +01:00
Andreas Rheinhardt a62c8558ae avutil/hwcontext_dxva2: 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 DXVA2FramesContext as one no longer has to
go through AVHWFramesInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 08:59:26 +01:00
James Almer 44e5749462 avformat/iamfenc: ensure updated extradata is written
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-04 21:14:17 -03:00
James Almer 56d630e6c2 avformat/iamf_writer: update extradata from packet side data
Some encoders, like flac, propagate updated extradata at the end of encoding
as packet side data. Use it to update the relevant codec_config.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-04 21:14:05 -03:00
James Almer 97e1480c8c avformat/mov: set stream index field in tile grids
It was forgotten for grid type derived images.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-04 20:17:52 -03:00
James Almer 8f33d8fa9b avformat/mov: don't mark an item referenced by a grid as dependent if it's the primary item
If it's the primary item, then it's expected to be ready for presentation even
outside of the grid it belongs to.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-04 20:17:41 -03:00
James Almer d78c75fe49 avformat/mov: fix setting disposition for the first iamf stream
st->disposition will be overwritten with disposition later in the function.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-04 20:17:41 -03:00
Marth64 59981b47db configure: do not specify -ldvdread, as pkg-config check is already done
Reported-by: BtbN
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-04 18:54:50 +01:00
Andrew Sayers b47b2c5b91 fix "@param foo[in/out]" to "@param[in, out] foo"
Fix a few invalid doxygen comments:

    /**
     * @param[in,out] correctly_formatted
     * @param incorrect1[in] - [in] must come immediately after @param
     * @param incorrect2[in/out] - '/' must be ','
     */

Actual command: sed -i -e "s/\(\* .*param\)\( [^\[]*\)\(\[.*\]\)/\1\3\2/g" -e "s/in\//in,/" $( git grep -l "\* .*param .*\[\(in\|out\)" )

Signed-off-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
2024-03-04 17:45:12 +01:00
Andrew Sayers dea1d7531d fix "param"s that should be "@param"
Actual command: sed -i -e "s/\(^ *\\* \)\(param[^a-z]\)/\1@\2/" $( git grep -l "^ *\\* param[^a-z]" )

Signed-off-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
2024-03-04 17:45:00 +01:00
Andrew Sayers 0dde5c5efa avcodec/avcodec: downgrade multi-member comment to non-Doxygen comment
Doxygen only associates this comment with "pts_correction_num_faulty_pts",
causing it to display incorrectly.

Signed-off-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
2024-03-04 17:40:24 +01:00
Andrew Sayers 899e022cd7 avcodec/ivi: make comments more Doxygen-friendly
Doxygen eats the newline in the first comment, making it harder to read.
Join the lines and add a comma, so source and documentation are equally readable.

Doxygen only associates the second comment with cust_dec.
The comments for cust_dec and cust_tab make perfect sense without it,
so downgrade it to a non-doxygen "//" comment.

The third comment was missed by the command in the previous commit,
because it (correctly but uniquely) doesn't have a trailing comma.

Signed-off-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
2024-03-04 17:39:25 +01:00
Andrew Sayers 6096c244bb fix /// comments that should be ///<
Actual command: sed -i -e "s/\([;,] *\)<* *\/\/\/ *<* */\1\/\/\/< /" $( git grep -l "[;,] */// " )

Signed-off-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
2024-03-04 17:38:57 +01:00
Andreas Rheinhardt ac86b52f80 avutil/hwcontext_vdpau: Don't use AVHWFramesInternal.priv
Use AVHWFramesContext.hwctx instead.
This simplifies access to VDPAUFramesContext as one no longer has
to go through AVHWFramesInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 16:26:55 +01:00
Andreas Rheinhardt f4df14b354 avutil/hwcontext_vdpau: 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 VDPAUDeviceContext as one no longer has to
go through AVHWDeviceInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 16:26:41 +01:00
Anton Khirnov e2e2ee7711 fftools/ffplay: stop printing non-public AVCodecContext fields
They are documented as not intended for caller use.
2024-03-04 15:56:48 +01:00
Nuo Mi 72b1237ece avcodec/vvcdec: fix undefined behaviours for derive_affine_mvc
libavcodec/vvc/vvc_inter.c:823:18: runtime error: signed integer overflow: 1426128896 + 1426128896 cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior libavcodec/vvc/vvc_inter.c:823:18

Suggested-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 20:39:31 +08:00
Nuo Mi 49ba613146 avcodec/vvcdec: fix boundary strength when IBC involved
The following cases should set bs to 1:
If the prediction modes are not the same.
If both prediction modes are MODE_IBC, but the motion vector delta is larger than 8 of 1/16 pixels.
see 8.8.3.5

How to reproduce it:
vvencapp -i sintel_trailer_2k_1080p24.y4m --preset fast --additional "IBC=1" -o sintel.266
ffmpeg -i sintel.266 -f md5 -
md5 will mismatch

Found-by: 6ws at https://github.com/ffvvc/FFmpeg/issues/187#issuecomment-1962842135
2024-03-04 20:39:27 +08:00
Niklas Haas 679d5611ed doc/ffprobe.xsd: add <components> and <pieces>
Originally introduced for dovi side data printing, but not properly
reflected in the xsd.
2024-03-04 12:51:21 +01:00
Niklas Haas 245eb67160 doc/ffprobe.xsd: add frameSideDatumType entry
Frame-level side data attributes are printed with the same key/value
structure as packet-level side data attributes, but this is not
reflected in the XSD.
2024-03-04 12:51:21 +01:00
Andreas Rheinhardt edfb4325e7 fftools/cmdutils: Inline print_error()
It is only used by ffprobe (once) and ffplay (twice);
inlining it avoids including it unnecessarily into ffmpeg.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 12:07:58 +01:00
Marth64 b065ffb295 doc/demuxers: emphasize that DVD demuxer does not do decryption
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-04 11:38:25 +01:00
Marth64 e3a137bef3 Changelog: restore new line
A new line was removed in a1304272c3
which breaks consistency in between versions.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-04 10:52:12 +01:00
Marth64 01476f752a avformat/dvdvideodec: fix -pgc and -pg options
Rebased on top of recently merged fixes (should apply correctly now).

In merged DVD patch, -pgc and -pg options were broken. While these are
rather advanced options, they are the only means to get content for
some strangely authored discs.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-04 10:47:57 +01:00
Martin Storsjö e30369bc1c aarch64: Use regular hwcaps flags instead of HWCAP_CPUID for CPU feature detection on Linux
This makes the code much simpler (especially for adding support
for other instruction set extensions), avoids needing inline
assembly for this feature, and generally is more of the canonical
way to do this.

The CPU feature detection was added in
493fcde50a, using HWCAP_CPUID.

The argument for using that, was that HWCAP_CPUID was added much
earlier in the kernel (in Linux v4.11), while the HWCAP flags for
individual features always come later. This allows detecting support
for new CPU extensions before the kernel exposes information about
them via hwcap flags.

However in practice, there's probably quite little advantage in this.
E.g. HWCAP2_I8MM was added in Linux v5.10 - long after HWCAP_CPUID,
but there's probably very little practical cases where one would
run a kernel older than that on a CPU that supports those instructions.

Additionally, we provide our own definitions of the flag values to
check (as they are fixed constants anyway), with names not conflicting
with the ones from system headers. This reduces the number of ifdefs
needed, and allows detecting those features even if building with
userland headers that are lacking the definitions of those flags.

Also, slightly older versions of QEMU, e.g. 6.2 in Ubuntu 22.04,
do expose support for these features via HWCAP flags, but the
emulated cpuid registers are missing the bits for exposing e.g. I8MM.
(This issue is fixed in later versions of QEMU though.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-03-04 10:13:31 +02:00
Andreas Rheinhardt 4ed0fea0fa avcodec/aactab: Deduplicate ltp_coef and tns_tmp2_map tables
This will allow to make aac_defines.h decoder-only.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 02:11:53 +01:00
Andreas Rheinhardt b9dea251d5 avcodec/aacdec: Move buffer to reduce padding
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 02:11:50 +01:00
Andreas Rheinhardt aaf26cffba avcodec/lpc: Split inline functions into a header of their own
And move compute_ref_coefs() to its only user: lpc.c
There is no overlap between the users of compute_lpc_coefs()
and lpc proper.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 02:11:38 +01:00
Andreas Rheinhardt 08aa791d20 avcodec/lpc: Don't use AAC defines directly
It leads to defines for the AAC decoder being included
outside of the AAC decoder.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 02:11:19 +01:00
Marton Balint 0aaee4741c avformat/mpegts: detect synchronous metadata KLV more reliably
The mpegts code historically tries to strip (the first) metadata access unit
header from synchronous KLV metadata, but the detection for such streams was
unreliable causing strips of asynchronous metadata or ID3 as well.

MISB ST 1402 specifies required stream type, stream id and registration
descriptor (which eventually maps to the codec ID) so let's use all of these
for reliable detection.

Fixes a regression caused by 468615f204.

Fixes ticket #10828, #10883.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-04 00:33:20 +01:00
Andreas Rheinhardt c0a1ce1c40 avutil/hwcontext_opencl: 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 OpenCLFramesContext as one no longer has to
go through AVHWFramesInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 00:05:11 +01:00
Andreas Rheinhardt c305dbf745 avutil/hwcontext_opencl: Allocate pub 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 OpenCLDeviceContext as one no longer has to
go through AVHWDeviceInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-04 00:04:38 +01:00
Andreas Rheinhardt 1b7308b61d avutil/vulkan: Remove unused ff_vk_set_descriptor_sampler()
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 22:56:25 +01:00
Andreas Rheinhardt c346c097af avutil/vulkan: Make ff_vk_set_descriptor_image() static
Only used in vulkan.c.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 22:56:21 +01:00
Andreas Rheinhardt c0d31cec7f avutil/vulkan: Avoid shadowing
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 22:56:17 +01:00
Andreas Rheinhardt 0a05577d1e avutil/vulkan_loader: Avoid relocations for strings
To do so, concatenate all the names together to one big string
name1\0name2\0....lastname\0\0. This avoids the pointer in
the FunctionLoadInfo structure and thereby moves vk_load_info
into .rodata (and makes it smaller by 888B).

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 22:56:07 +01:00
Andreas Rheinhardt 674f20813d avutil/vulkan_loader: Use smaller types
Saves 16B per entry here (four of these 16 bytes are padding);
leads to 1776 B of savings in each file that uses
ff_vk_load_functions().

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 22:55:52 +01:00
Andreas Rheinhardt e9b4f4461f avutil/vulkan_loader: Avoid redundant strings and relocations
There are three possible names for the functions requested;
they only differ in an extension: "", "EXT" or "KHR".
Yet vk_load_info contained pointers to all these strings.
This is wasteful and this commit changes it to avoid
the latter two strings. This saves 6353B of strings,
1776 B of .data.rel.ro as well as 5328 B due to the removed
relocations (corresponding to 2 * 111 removed pointers)
in lavc/vulkan_decode.o alone (ff_vk_load_functions()
is inlined in lavfi/vulkan_filter.c, lavu/hwcontext_vulkan.c
and lavc_vulkan_decode.c, so the savings are three times
this for shared builds; for static builds, the number may
be smaller depending upon whether strings are deduplicated).

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 22:55:44 +01:00
Andreas Rheinhardt e429b0fdb7 avutil/vulkan: Don't autoinclude vulkan_loader.h
Only include it where necessary.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 22:55:26 +01:00
Andreas Rheinhardt a172d80703 avcodec/x86/fpel: Remove remnants of MMX
Since 7cad4dba50
averaging functions only exist for MMXEXT and SSE2.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 19:48:41 +01:00
Andreas Rheinhardt cb15b7b29e avcodec/vulkan_video: Don't use sparse table
ff_vk_codec_map currently is an array indexed by AVCodecID;
it has AV_CODEC_ID_FIRST_AUDIO (= 65536) entries, but uses
only three of them; only 24B of 1MiB were actually used

This commit fixes this by adding an AVCodecID field to the table
and making it non-sparse.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 17:17:13 +01:00
Andreas Rheinhardt c6e1793e7a fftools/ffprobe: Print dispositions generically
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 17:16:45 +01:00
Andreas Rheinhardt 1a4e0eb374 avformat/dvdvideodec: Reorder allocations to simplify freeing
Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 09:20:36 +01:00
Andreas Rheinhardt 77b26bf4b6 avformat/dvdvideodec: Only free allocated buffers
Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 09:20:23 +01:00
Andreas Rheinhardt e30dd9bbac avformat/dvdvideodec: Don't store AVInputFormat*
The inner AVInputFormat* of the inner mpegps-demuxer
is only used once (in avformat_open_input()), so
don't even store it. In fact, just use ff_mpegps_demuxer
directly, as this demuxer has a configure dependency
on it.

Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 09:20:13 +01:00
Andreas Rheinhardt 0b8f7a7859 avformat/dvdvideodec: Explicitly return 0 on success
Don't "return ret" even when ret is zero on success.

Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 09:19:51 +01:00
James Almer f8caf388fb avformat/iamf_writer: constify some function parameters
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-02 21:41:09 -03:00
Marton Balint 3a09c2122d avformat/wavdec: dynamically set max_size by default
The wav demuxer by default tried to demux 4096-byte packets which caused
packets with very few number of samples for files with high channel count.
This caused a significant overhead especially since the latest ffmpeg.c
threading changes.

So let's use a similar approach for selecting audio frame size which is already
used in the PCM demuxer, which is to read 25 times per second but at most 1024
samples.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-02 19:13:03 +01:00
Marton Balint 315be8b279 fate/libswresample: force number of samples for the input of aresample async tests
Since PTS is changed randomly for every audio frame, it matters. Also add some
forgotten filter dependencies.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-02 19:13:03 +01:00
Marton Balint 7b1b9bb31f swresample/resample: fix rounding errors with filter_size=1 and phase_shift=0
Depending on input chunk size noticable corrpution was hearable, here is an
example command line:

ffplay -f lavfi -i "sine=440:r=8000:samples_per_frame=32,aresample=24000:filter_size=1:phase_shift=0"

Fix this by rounding the fixed point fractions up instead of down.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-02 19:13:03 +01:00
Marton Balint 0b98f28c46 fate: never generate auto-generated references
GEN=1 is used to generate reference files in the source tree, not
auto-generated reference samples.

Without this patch GEN=1 could overwrite the auto generated reference files
in each test where they are used causing failures.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-02 19:13:03 +01:00
Marton Balint 4ebf478f4c avformat/mxfdec: track metadata sets by their type
We typically are only interesed in a single type of metadata set, so it is
better to keep them separated instead of always filtering for them.

Also use av_dynarray_add for increasing their array.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-02 18:49:31 +01:00
Marton Balint aa299faa9a avformat/mxfdec: remove resolve_strong_ref usage with AnyType
UUIDs do not have to be unique if their type sets them apart, so avoid using
AnyType, since we are only interested in specific types.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-02 18:49:31 +01:00
Marth64 a1304272c3 libavformat/dvdvideo: add DVD-Video demuxer, powered by libdvdread and libdvdnav
Signed-off-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-03-02 08:12:29 +01:00
Michael Niedermayer b95c0d93ff avcodec/vvc/vvcdec: allow vvc_decode_close() on failed open
Fixes: division by 0
Fixes: 67008/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-5873503163187200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-02 13:29:07 +08:00
Andreas Rheinhardt 45c612702f configure: Add missing vvc_decoder->cbs_h266 dependency
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 13:28:21 +08:00
Andreas Rheinhardt d25b3497f2 avcodec/x86/rv40dsp, simple_idct: Remove remnants of MMX
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:54:12 +01:00
Andreas Rheinhardt 0f944c8b27 tests/checkasm: Improve included headers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:54:12 +01:00
Andreas Rheinhardt cfe21a66e2 checkasm/vvc_mc: Don't use declare_func_emms
There is no MMX DSP code for VVC, so one can use the stricter
declare_func which also tests that we are not in MMX mode
at the end of this function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:54:12 +01:00
Andreas Rheinhardt 540d8e7740 avcodec/vvc/vvc_mvs: Add proper header include
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:54:12 +01:00
Andreas Rheinhardt 33a3a23b79 avcodec/vvc/vvc_intra: Move utils out of vvc_intra.c
Otherwise vvc_intra.o gets pulled in by the vvc_mc checkasm
test and it in turn pulls vvc_ctu.o and then the rest of vvcdec
and lavc in. Besides being bad size-wise this also has the downside
that it pulls in avpriv_(cga|vga16)_font from libavutil which are
marked as being imported from another library when building
libavcodec as a DLL and this breaks checkasm because it links
both lavc and lavu statically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:54:12 +01:00
Andreas Rheinhardt 4460cb485b avcodec/svq1enc: Move initializing DSP out of svq1enc.c
Otherwise svq1enc.o gets pulled in by the svq1encdsp checkasm
test and it in turn pulls the rest of lavc in.
Besides being bad size-wise this also has the downside that
it pulls in avpriv_(cga|vga16)_font from libavutil which are
marked as being imported from another library when building
libavcodec as a DLL and this breaks checkasm because it links
both lavc and lavu statically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:54:11 +01:00
Andreas Rheinhardt 88b3b09afa avcodec/aacenc: Move initializing DSP out of aacenc.c
Otherwise aacenc.o gets pulled in by the aacencdsp checkasm
test and it in turn pulls the rest of lavc in.
Besides being bad size-wise this also has the downside that
it pulls in avpriv_(cga|vga16)_font from libavutil which are
marked as being imported from another library when building
libavcodec as a DLL and this breaks checkasm because it links
both lavc and lavu statically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:54:11 +01:00
Andreas Rheinhardt 6c693da690 fftools/ffmpeg_demux, sync_queue: Constify a bit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:51:59 +01:00
Andreas Rheinhardt b295aafb08 swresample/swresample: Constify swr_convert()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:51:55 +01:00
Andreas Rheinhardt 58e3ef7f54 avutil/timestamp: Constify av_ts_make_time_string()
(Actually, the time base should be passed by value.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:51:10 +01:00
Andreas Rheinhardt dfb9d8a5a2 avformat/avio: Make avio_print_string_array() accept const pointers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:49:48 +01:00
Andreas Rheinhardt 1e98cc4787 avcodec/bsf/mp3_header_decompress: Remove BSF
This BSF is supposed to be used in conjunction with mp3_header_compress,
which has been removed more than ten years ago in commit
c6080d8900. It mangled the headers
by removing the CRC field as well as fields that are supposed
to stay constant for the entirety of a stream (which are put into
extradata). This made these files unplayable; they need to be
decompressed with the BSF first (which does not happen automatically).
Even in this case the CRC does not get restored.

I am not aware that such compressed files exist at all; therefore
this commit removes the BSF completely.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 02:47:50 +01:00
Andreas Rheinhardt e70e9b6554 avutil/hwcontext_vulkan: 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 VulkanFramesPriv as one no longer has to
go through AVHWFramesInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 18:48:06 +01:00
Andreas Rheinhardt 2d63379cae avutil/hwcontext_vulkan: 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 VulkanDevicePriv as one no longer has to
go through AVHWDeviceInternal.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 18:48:06 +01:00
Andreas Rheinhardt ac7e72972c avutil/hwcontext_cuda: Allocate public and internal device ctx jointly
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 18:32:40 +01:00
Andreas Rheinhardt 8d277de009 avutil/hwcontext_cuda: Don't use AVHWFramesInternal.priv
Use AVHWFramesContext.hwctx instead.
This simplifies accesses to VDPAUFramesContext as one no longer has
to go through AVHWFramesInternal.

Tested-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 18:32:01 +01:00
Andreas Rheinhardt cb92b4bd83 avutil/hwcontext: Clarify documentation of AVHWFramesContext.hwctx
Correct the names of the format-specific headers (not hwframe_*.h)
and clarify that the user shall ignore this field if there is no
public context associated with it.
In particular, this allows to use this field for the private context
alone if there is no public context. This can't break conforming
API users, because they always have to live with the possibility
that a new public context has been introduced.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 18:32:01 +01:00
Anton Khirnov 200f82e3f8 lavu/opt: get rid of useless read_number() calls
The option type is known and fixed for all these, so reading the value
directly is simpler and more clear.
2024-03-01 16:57:24 +01:00
Anton Khirnov 1ffa657a03 lavu/opt: simplify error handling in get_number() 2024-03-01 16:57:24 +01:00
Anton Khirnov 84ba46fa5e lavu/opt: drop an always-NULL argument to get_number() 2024-03-01 16:57:24 +01:00
Anton Khirnov 9fabdd64b2 lavu/opt: drop useless handling of NULL return from get_bool_name()
That function always returns an actual string.
2024-03-01 16:57:24 +01:00
Anton Khirnov 333cc9bff8 lavu/opt: factor out printing option default from opt_list() 2024-03-01 16:57:24 +01:00
Anton Khirnov 8904f35133 lavu/opt: simplify printing option type in opt_list() 2024-03-01 16:57:24 +01:00
Anton Khirnov 6456dd50a6 lavu/opt: cosmetics, group option reading function together 2024-03-01 16:57:24 +01:00
Anton Khirnov 2a3a33d04b lavu/opt: cosmetics, group option setting function together 2024-03-01 16:57:24 +01:00
Anton Khirnov cc0bd9da70 lavu/opt: cosmetics, group (un)init and management functions together 2024-03-01 16:57:24 +01:00
Anton Khirnov 067fde4966 lavu/opt: document AVOption.flags 2024-03-01 16:57:24 +01:00
Anton Khirnov 39a3a1c69b lavu/opt: cosmetics, move AV_OPT_FLAG_* out of AVOption
Also drop an obsolete FIXME.
2024-03-01 16:57:24 +01:00
Anton Khirnov 105a1bc150 lavu/opt: cosmetics, change option flags to (1 << N) style
It is easier to read. Also, change their doxy comments to use the same
style.
2024-03-01 16:57:24 +01:00
Anton Khirnov e48055fdce fftools/ffmpeg: remove options deprecated before 6.0 2024-03-01 16:51:11 +01:00
Zhao Zhili f7545e90df avutil/hwcontext_opencl: Add map from Videotoolbox to OpenCL
For example:
./ffmpeg -hwaccel videotoolbox \
	-hwaccel_output_format videotoolbox_vld \
	-i foo.mp4 \
	-vf hwmap=derive_device=opencl,transpose_opencl=dir=clock,hwmap,format=nv12 \
	-c:v hevc_videotoolbox \
	-c:a copy \
	-b:v 2M -tag:v hvc1 bar.mp4

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:24:00 +08:00
Zhao Zhili dcfc6089b1 avutil/hwcontext_opencl: Fix missing linesize when map from opencl
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:23:50 +08:00
Zhao Zhili 35dc129940 avcodec/encode: Fix default setting of bits_per_raw_sample
bits_per_raw_sample doesn't always match size of AV_SAMPLE_FMT_,
e.g., S24.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:23:38 +08:00
Zhao Zhili b56b343e43 avformat/mov: Update bits_per_coded_sample after read pcmC
Fix #10878
2024-03-01 17:23:18 +08:00
Zhao Zhili ab8aab5e2f avfilter/vf_scale_vulkan: Fix typo
Fix #10875

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:22:25 +08:00
Zhao Zhili 74e27d9e31 avutil/hwcontext_vulkan: Fix memleaks when transfer to vulkan
Without ff_vk_exec_discard_deps which is called by ff_vk_exec_wait,
the reference count of hwframe context cannot reach zero due to
circular reference created by ff_vk_exec_add_dep_frame.

Fix #10873

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:22:14 +08:00
Zhao Zhili f6f06fb42a avutil/vulkan: avoid overreads in ff_vk_count_images
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:20:35 +08:00
Zhao Zhili 03275b0f09 avutil/hwcontext_vulkan: Fix leaks in map_from_drm
Also simplify error handing.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:20:29 +08:00
Zhao Zhili 6f9730cb28 avutil/hwcontext_vulkan: Fix leaks when semaphore creation fails
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:20:21 +08:00
Zhao Zhili 3bb00c0a42 avutil/hwcontext: Don't assume frames_uninit is reentrant
Fix heap use after free when vulkan_frames_init failed.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:20:00 +08:00
Zhao Zhili 90bbe1e8e2 avutil/hwcontext: Don't assume device_uninit is reentrant
device_uninit will be called by hwdevice_ctx_free. vulkan_device_uninit
is non-reentrant.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:19:52 +08:00
Zhao Zhili 39a0c55347 fftools/ffplay: Fix output color_spaces of filter
The sdl_supported_color_spaces only meant for SDL builtin renderer.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:19:15 +08:00
Andreas Rheinhardt 601bb6a739 avcodec/mss[12]: Cleanup generically on init failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:35:42 +01:00
Andreas Rheinhardt 80736531da avcodec/decode: Improve validity check a bit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:35:42 +01:00
Andreas Rheinhardt 22dda5615e avutil/mem_internal: Remove unneeded headers
Unneeded since 21814a70db.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:35:42 +01:00
Andreas Rheinhardt 72becd0627 avcodec/refstruct: Don't use STRIDE_ALIGN for alignment
It was always intended that the buffers returned by
RefStruct shall have the same alignment guarantees
as the buffers returned by av_malloc(); said alignment
depends upon the arch and the enabled instruction set
and the code used STRIDE_ALIGN as a proxy for this.

Yet since 7945d30e91
there is a better way to get av_malloc's alignment:
ALIGN_64 in mem_internal.h. So use this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:35:42 +01:00
Andreas Rheinhardt d36cb46681 avcodec/libxeve: Use av_dict_iterate()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt fbf1e51352 avcodec/libxevd: Fix "if (ret = ff_foo() < 0)" precedence problem
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt 0c92c8e6e3 avcodec/libxevd: Improve included headers a bit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt ec0bd89297 avcodec/libxevd: Use CODEC_LONG_NAME()
Brings the length of the line down to less than 80 chars.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt 9209350f8d avcodec/libxevd: Remove useless AVClass
This decoder does not have options.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt c4dceb8354 avcodec/libxevd: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt cb9fb80c7f avcodec/libxevd: Deduplicate code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt 85fc5a0c3f avcodec/libxevd: Avoid cloning AVPacket
Cloning a packet whose source is going to be unreferenced
immediately afterwards is wasteful.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt 4e14a8e6be avcodec/libxevd: Set AV_CODEC_CAP_DR1
This decoder uses av_image_copy() to copy decoded images
to buffers obtained via ff_get_buffer(); ergo it can handle
user-provided buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt bbeee3339f avcodec/libxevd: Remove FF_CODEC_CAP_SETS_PKT_DTS cap
This decoder implements the receive_frame API; such decoders
always have to set the pkt_dts field themselves and the avcodec
test checks for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:19 +01:00
Andreas Rheinhardt 5a4702cba9 avcodec/Makefile: Add missing AV1 decoder->av1_parse.o dependency
Needed for ff_av1_framerate().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:33:03 +01:00
James Almer 194414f62d avcodec/av1dec: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
Fixes errors when opening streams with no extradata (like those from raw OBU
sources). It also calls get_format() on new Sequence Headers when required.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-29 14:48:00 -03:00
James Almer ec7937f4a5 avformat/iamf: remove duplicated function
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-29 12:57:25 -03:00
Andreas Rheinhardt 4a134eb14a avcodec/intrax8: Fix assert
Commit 900ce6f8c3 replaced
IntraX8Context.ac_vlc by IntraX8Context.ac_vlc_table,
but forgot to update an av_assert2()*.
cf7ed01938 then
replaced this with a check for j_ac_vlc[mode],
but this makes no sense as j_ac_vlc is of type
const VLCElem [2][2][8][].

Worse yet, mode can be up to three and then
j_ac_vlc[mode] is undefined behaviour. This happened
during the wmv8-x8intra FATE test.

*: Since 84f16bb5e6
config.h was no longer auto-included in avassert.h
and this disabled av_assert1() and av_assert2()
in files where config.h has not been included before
the inclusion of avassert.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-29 10:30:16 +01:00
Haihao Xiang d263fce2b2 lavc/qsvenc: update the selection of bitrate control method
The default method is changed to CQP

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-02-29 13:36:41 +08:00
Fei Wang 57fbe929f3 avcodec/av1dec: Return error for unsupported tile list OBU
Otherwise decoding maybe successful but output result is incorrect.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-02-29 13:36:41 +08:00
Fei Wang 3f7e50f539 avcodec/av1dec: Move message of OBU info back to the beginning
So that can show OBU info even it doesn't have decomposed content. And
add OBU content status into the message.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-02-29 13:36:41 +08:00
J. Dekker 2b17a74df5 avdevice: deprecate sdl outdev
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-28 10:28:49 +01:00
J. Dekker e4c0cdf8df avdevice: deprecate opengl outdev
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-28 10:28:49 +01:00
J. Dekker 570052cd2a avcodec/aarch64/hevc: add luma deblock NEON
Benched using single-threaded full decode on an Ampere Altra.

Bpp Before  After  Speedup
8   73,3s   65,2s  1.124x
10  114,2s  104,0s 1.098x
12  125,8s  115,7s 1.087x

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-28 10:14:58 +01:00
Cosmin Stejerean 69dd1ce610 avcodec/libsvtav1: send the EOS signal without a one frame delay to allow for the library to operate in a low-delay mode
Co-authored-by: Amir Naghdinezhad <amir.naghdinezhad@intel.com>
Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-27 19:38:23 -03:00
Andreas Rheinhardt 0c204ce9f6 avcodec/dxvenc: Use proper alignment, write endian-independent output
Fixes the dxv3enc-dxt1 FATE test with UBSan and on big-endian
hardware.

Reviewed-by: James Almer <jamrial@gmail.com>
Tested-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 23:05:26 +01:00
Timo Rothenpieler 7945d30e91 avutil/mem: limit alignment to maximum simd align
FFmpeg has instances of DECLARE_ALIGNED(32, ...) in a lot of structs,
which then end up heap-allocated.
By declaring any variable in a struct, or tree of structs, to be 32 byte
aligned, it allows the compiler to safely assume the entire struct
itself is also 32 byte aligned.

This might make the compiler emit code which straight up crashes or
misbehaves in other ways, and at least in one instances is now
documented to actually do (see ticket 10549 on trac).
The issue there is that an unrelated variable in SingleChannelElement is
declared to have an alignment of 32 bytes. So if the compiler does a copy
in decode_cpe() with avx instructions, but ffmpeg is built with
--disable-avx, this results in a crash, since the memory is only 16 byte
aligned.

Mind you, even if the compiler does not emit avx instructions, the code
is still invalid and could misbehave. It just happens not to. Declaring
any variable in a struct with a 32 byte alignment promises 32 byte
alignment of the whole struct to the compiler.

This patch limits the maximum alignment to the maximum possible simd
alignment according to configure.
While not perfect, it at the very least gets rid of a lot of UB, by
matching up the maximum DECLARE_ALIGNED value with the alignment of heap
allocations done by lavu.
2024-02-27 19:41:09 +01:00
sunyuechi 40911bc1a1 lavc/dnxhdenc: add ff_dnxhdenc_init
This is for clarity and use in testing, consistent with other parts of the code.

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-27 20:32:37 +02:00
sunyuechi a7ad76fbbf lavc/me_cmp: R-V V nsse
C908:
nsse_0_c: 1990.0
nsse_0_rvv_i32: 572.0
nsse_1_c: 910.0
nsse_1_rvv_i32: 456.0

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-27 20:31:30 +02:00
Andreas Rheinhardt 1bb7d5ca9f avformat/mov: Don't use entry[-1] in pointer arithmetic
It is undefined behaviour.
Fixes many failed tests with UBSan and GCC 13 like
"src/libavformat/mov.c:4229:44: runtime error: store to address
0x5572abe20f80 with insufficient space for an object of type 'struct
MOVIndexRange'"
(The line number does not refer to the line where &entry[-1]
is assigned.)

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 10:27:42 +01:00
Andreas Rheinhardt 9d7d03ea45 Revert "avformat/mov: zero initialize the index ranges buffer"
This reverts commit eee3b7e2fb.
It has been made in an attempt to fix UBSan test failures with
GCC 13 (see e.g. [1]), but it did not help at all. So revert it,
but use av_malloc_array() instead of going back to av_malloc().

[1]: https://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-ubsan&time=20240226182430

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:17:39 +01:00
Andreas Rheinhardt a6aa043baa avcodec/aac: Split ChannelElement in decoder and encoder structs
The AAC decoders share no common code with the AAC encoder,
so they are not restricted to using the same structures.
This implies that one can use different structs for each
component and remove elements not used by the decoders/
the encoder. This leads to quite sizeable savings:
sizeof(ChannelElement) for the encoder went down to 134432B
here from 547552B; for the decoder it went down to 512800B.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt 6c92347ab9 avcodec/sbr: Remove unused AACDecContext* parameter from sbr_lf_gen_mips
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt 80eca6ec99 avcodec/aacps: Inline ff_ps_ctx_init()
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt 1ecc906536 avcodec/aacdec: Rename AACContext to AACDecContext
It is decoder-only; furthermore, there is already
an AACContext in use by libfdk-aacenc.
Also make aacdec.h provide the typedef for AACContext;
up until now, this has been done by sbr.h.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt 1b048dd443 avcodec/aacsbr: Remove unused parameter from sbr_gain_calc
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt a0fa6b6030 avocdec/aac: Move decoder-only stuff to new header aacdec.h
AACContext is not used by the encoder at all.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt c6cf253c98 avcodec/aacdec_template: Don't use intermediate void*
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt 25e0e087c4 configure: Disable linker warnings for common symbols
Common symbols are not part of ISO-C and therefore not used
by FFmpeg at all. Yet linker warnings to ensure it stays
that way are nevertheless wrong, because the existence of
common symbols does not imply that there is a bug in our code.

More precisely, Clang's ASAN implementation uses a common symbol
___asan_globals_registered when used on Elf targets with
the -fsanitize-address-globals-dead-stripping option;
said option is the default since Clang 17 [1].
This leads to 1883 warnings about ___asan_globals_registered
when linking here.
(Even without that option there were warnings like
_ZN14__interception10real_vforkE being overridden.)

Said warning is also unnecessary: The proper way to ensure
that our code is free of common symbols is to let the compiler
enforce this. But this is already the default since GCC 10
and Clang 11, so there is no risk of introducing our own
common symbols.

[1]: https://reviews.llvm.org/D152604

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-26 22:09:19 +01:00
James Almer 84e669167d fate/mov: add tests for HEIF samples with derived images
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-26 12:21:12 -03:00
James Almer feab8f9c58 fate/mov: test remuxing all stream heif items
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-26 12:21:12 -03:00
James Almer 41e349c24a avformat/mov: add support for tile HEIF still images
Export each tile as its own stream, and the grid information as a Stream Group
of type TILE_GRID.
This also enables exporting other stream items like thumbnails, which may be
present in non tiled HEIF images too. For those, the primary stream will be
tagged with the default disposition.

Based on a patch by Swaraj Hota

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-26 12:21:12 -03:00
James Almer 25a10677d1 avformat: add a Tile Grid stream group type
This will be used to support tiled image formats like HEIF.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-26 12:21:12 -03:00
Ronald S. Bultje d6083f503d avcodec/x86/hevc: fix luma 12b overflow
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-26 12:29:58 +01:00
J. Dekker 07cc8f6b3c checkasm/hevc_deblock: add luma and chroma full
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-26 12:29:58 +01:00
Zhao Zhili a3ca4beeaa avcodec/evc: Remove redefine of HEVC_MAX_ENTRY_POINT_OFFSETS
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-02-26 16:28:37 +08:00
Fei Wang b5714d1f91 avfilter/tonemap_vaapi: Remove duplicate format check
Supported formats are checked in base function ff_vaapi_vpp_config_output.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-02-26 14:52:06 +08:00
Tong Wu cfa802bdc3 avcodec/vaapi_encode: remove a duplicate av_freep
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-02-26 14:52:06 +08:00
Frank Plowman 8b6219a99d lavc/vvc: Read subpic ID when only one subpicture is present
Previously, the following syntax elements were not read in the case
sps_num_subpics_minus is 0:
* sps_subpic_id_len_minus1
* sps_subpic_id_mapping_explicitly_signalled_flag
* sps_subpic_id_mapping_present_flag
* sps_subpic_id[i]
This was causing failures to decode bitstreams, for example the DVB's
"VVC HDR UHDTV1 OpenGOP 3840x2160 50fps HLG10 PiP" V&V bitstream.

Patch fixes this by moving the reads for these syntax elements out a
scope.

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-25 19:55:01 -03:00
Frank Plowman 53ab7ff67e lavc/vvc: Correct sps_num_subpics_minus1 minimum
The spec says "the value of sps_num_subpics_minus1 shall be in the
range of 0 to MaxSlicesPerAu − 1, inclusive."

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-25 18:52:18 -03:00
Frank Plowman 248a1f9d00 lavc/vvc: Increase VVC_MAX_* definitions for level 6.3
Reported-by: James Almer <jamrial@gmail.com>
Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-25 18:30:34 -03:00
Andreas Rheinhardt ab2173c0a5 avcodec/cbs_h2645: Avoid function pointer casts, fix UB
The SEI message read/write functions are called
via function pointers where the SEI message-specific
context is passed as void*. But the actual function
definitions use a pointer to their proper context
in place of void*, making the calls undefined behaviour.
Clang UBSan 17 warns about this.

This commit fixes this by adding wrapper functions
(created via macros) that have the right type that
call the actual functions. This reduced the number of failing
FATE tests with UBSan from 164 to 85 here.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 13:42:47 +01:00
Andreas Rheinhardt b4b8b9ad5c avfilter/avfilter: Suppress warning for variable only used in av_assert1
Forgotten in e7f9edb469.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 13:42:44 +01:00
Andreas Rheinhardt 906fc2b2e7 fftools/ffmpeg_mux: Fix use of uninitialized variable
Broken in a2fc86378a.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 13:41:56 +01:00
Stone Chen ef917950f0 avfilter/vf_convolution: add float user_rdiv[4] to allow user options to apply correctly
Previously to support dynamic reconfigurations of the matrix string (e.g. 0m),
the rdiv values would always be cleared to 0.f, causing the rdiv to be
recalculated based on the new filter. This however had the side effect of
always ignoring user specified rdiv values.

Instead float user_rdiv[0] is added to ConvolutionContext which will store the
user specified rdiv values. Then the original rdiv array will store either the
user_rdiv or the automatically calculated 1/sum.

This fixes trac ticket #10294, #10867.

Signed-off-by: Stone Chen <chen.stonechen@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-25 10:49:37 +01:00
sunyuechi 9b90d0d36a lavc/me_cmp: R-V V vsse vsad intra
C908:
vsad_4_c: 681.0
vsad_4_rvv_i32: 182.2
vsad_5_c: 278.0
vsad_5_rvv_i32: 145.2
vsse_4_c: 595.0
vsse_4_rvv_i32: 125.2
vsse_5_c: 281.0
vsse_5_rvv_i32: 101.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-25 11:05:25 +02:00
sunyuechi 925b55a5e8 lavc/me_cmp: R-V V vsse vsad
C908:
vsad_0_c: 936.0
vsad_0_rvv_i32: 236.2
vsad_1_c: 424.0
vsad_1_rvv_i32: 190.2
vsse_0_c: 877.0
vsse_0_rvv_i32: 204.2
vsse_1_c: 439.0
vsse_1_rvv_i32: 140.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-25 11:05:25 +02:00
Andreas Rheinhardt 2e4e424ac2 avutil/hwcontext: Don't check before av_buffer_unref()
av_buffer_unref() can handle AVBufferRef** that point
to a NULL AVBufferRef*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:42:04 +01:00
Andreas Rheinhardt f705b8b5b4 avutil/opt: Use correct function pointer type
av_get_sample/pix_fmt() return their respective enums
and are therefore not of the type int (*)(const char*),
yet they are called as-if they were of this type.
This works in practice, but is actually undefined behaviour.

With Clang 17 UBSan these violations are flagged, affecting lots
of tests. The number of failing tests went down from 3363 to 164
here with this patch.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:19:18 +01:00
Andreas Rheinhardt 484e7716bc avcodec/cbs_h266_syntax_template: Don't omit unused function parameter
The calls to the sei_decoded_picture_hash read and write functions
are performed with four pointer arguments; just because one
of them is unused by the callees does not mean that they
can be omitted: This is undefined behaviour.
(This was not recognized because the SEI_MESSAGE_RW macro
contains casts.)

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:19:18 +01:00
Andreas Rheinhardt b31ee084a9 fftools/ffprobe: Use int64_t instead of long long int
This makes ffprobe match the rest of the codebase.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:19:18 +01:00
Andreas Rheinhardt 08328463d5 fftools/ffprobe: Simplify printing xml values
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:19:18 +01:00
Andreas Rheinhardt ed5bf403d7 fftools/ffprobe: Constify printing section header
Allows to avoid casting const away.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:19:18 +01:00
Andreas Rheinhardt 0f20e48e3d fftools/ffprobe: Don't cast const away needlessly
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 02:19:18 +01:00
Marton Balint 569257735b fate/mxf: fix mxf-probe-j2k on big endian systems
Jpeg2000 decoder is decoding in native endian, so let's use the same workaround
as in fate-mxf-probe-applehdr10.

Fixes ticket #10868.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-25 00:35:02 +01:00
Marton Balint 87677c2195 avformat/libsrt: use SRT_EPOLL_IN for waiting for an incoming connection
This is the proper poll mode for waiting for an incoming connection according
to the SRT API docs.

Fixes ticket #9142.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-25 00:35:02 +01:00
Gyan Doshi ecb3c8a536 configure: select iamfenc as movenc dep
Unbreaks movenc compilation in minimal configuration.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-24 19:44:38 -03:00
Michael Niedermayer 22845fbb80
doc: Add infra.txt 2024-02-24 15:05:19 +01:00
Wu Jianhua 6c83cd5cb3 avcodec/vvcdec: add Intra Block Copy decoder
Introduction at https://ieeexplore.ieee.org/document/9408666

passed files:
    10b444_A_Kwai_3.bit
    10b444_B_Kwai_3.bit
    CodingToolsSets_D_Tencent_2.bit
    IBC_A_Tencent_2.bit
    IBC_B_Tencent_2.bit
    IBC_C_Tencent_2.bit
    IBC_D_Tencent_2.bit
    IBC_E_Tencent_1.bit
    LOSSLESS_B_HHI_3.bit

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Nuo Mi <nuomi2021@gmail.com>
2024-02-24 20:24:56 +08:00
Wu Jianhua 9481887755 avcodec/vvcdec: add Intra Block Copy parser
Co-authored-by: Nuo Mi <nuomi2021@gmail.com>
2024-02-24 20:24:56 +08:00
Nuo Mi 422e8a877b avcodec/vvcdec: refact, rename !is_mvp to check_mer
For IBC, we'll utilize the check_available function.
However, neither MVP nor merge mode need to check the motion estimation region.
Let's rename it to avoid confusion.
2024-02-24 20:24:56 +08:00
Nuo Mi 1ffeeb8a26 avcodec/vvcdec: fix dual tree for skipped transform tree/unit
fix IBC_E_Tencent_1.bit
2024-02-24 20:24:55 +08:00
Nuo Mi c503c0b33e avcodec/vvcdec: ff_vvc_set_intra_mvf, refact to support dmvr tab 2024-02-24 20:24:55 +08:00
Nuo Mi 3241aa26d1 avcodec/vvcdec: skip inter prediction for IBC blocks
Intra Block Copy relies on reconstructed pixels from the current frame.
We skip IBC during the inter prediction stage and handle it during the reconstruction stage.
2024-02-24 20:24:55 +08:00
Wu Jianhua 09946dc40b avcodec/vvcdec: implement update_hmvp for IBC
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Nuo Mi <nuomi2021@gmail.com>
2024-02-24 20:24:55 +08:00
Nuo Mi 5a388d2cc6 avcodec/vvcdec: cabac, fix non_inter_flag, pred_mode_flag, amvr_shift for IBC 2024-02-24 20:24:55 +08:00
Nuo Mi dd3650cada avcodec/vvcdec: deblock_bs, fix intra check for IBC
An Intra Block Copy clip may use different modes for luma and chroma.
For example, MODE_IBC for luma and MODE_INTRA for chroma.
We have to check luma and chroma CuPredMode (cpm) separately.
2024-02-24 20:24:55 +08:00
Nuo Mi 37ebebd055 avcodec/vvcdec: set CuPredMode table for chroma
follow the spec
2024-02-24 20:24:55 +08:00
Nuo Mi ab2c9dfb26 avcodec/vvcdec: refact out deblock_bs to reduce duplicate code 2024-02-24 20:24:55 +08:00
Anton Khirnov c19c2078f3 fftools/ffmpeg_sched: remove a triggerable assert in send_to_enc_sq()
It can be triggered when send_to_enc_thread() returns AVERROR(ENOMEM).
Propagate the error to the caller instead.

Reported-by: Andreas Rheinhardt
2024-02-24 11:51:41 +01:00
Anton Khirnov a00765fcbe fftools/ffmpeg_sched: simplify failure path in sch_dec_send() 2024-02-24 11:51:41 +01:00
Anton Khirnov a2fc86378a fftools/ffmpeg: declare loop indices inside loops 2024-02-24 11:51:41 +01:00
Anton Khirnov 29e1b9d90c fftools/cmdutils: remove harmful variable shadowing
It causes write_option() to return 0 when calling func_arg() fails.
2024-02-24 11:51:21 +01:00
Fei Wang 7d82daf31d lavc/vvc_ps: Correct vaule of ALF_NUM_FILTERS_CC
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-02-23 22:08:56 +08:00
Andreas Rheinhardt fe340c3244 .mailmap: Update my mailmap entry
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-23 00:17:21 +01:00
Zhao Zhili 4ea2b271eb avformat/libsrt: Remove manually free AV_OPT_TYPE_STRING
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-02-22 19:13:36 +08:00
Zhao Zhili 80cd6e655b avcodec/audiotoolboxenc: Ensure frame_size isn't zero
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-02-22 19:13:13 +08:00
Zhao Zhili 338e33b084 avcodec/audiotoolboxenc: remove CAP_VARIABLE_FRAME_SIZE from alac
AV_CODEC_CAP_VARIABLE_FRAME_SIZE has been set for alac_at encoder,
which means avctx->frame_size should be zero. However, alac_at
encoder also set avctx->frame_size. This leading to assert failure
in ffmpeg_sched.c
	av_assert0(enc->sq_idx[0] >= 0);

Actually, the implementation of audiotoolboxenc.c doesn't support
frame_size been zero.

Fix #10720.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-02-22 19:13:02 +08:00
James Almer 76b2bb96b4 avutil/tx: print debug log at trace level
The output of TX is extremely verbose and makes it harder to find other debug
log messages, so print most of it at trace level.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-22 00:29:59 -03:00
Andreas Rheinhardt 4179c121c3 avcodec/movtextenc: Don't copy data around unnecessarily
Using av_bprint_init_for_buffer() avoids copying data
into the internal AVBPrint buffer (or worse: to allocate
a temporary buffer in case the internal buffer does not
suffice).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt e9a587af25 avcodec/srtenc, webvttenc: Use av_printf_format
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt ed9de6d2d8 avcodec/ttmlenc: Remove always-true check
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt 253a8340f5 avcodec/ttmlenc: Don't copy data around unnecessarily
Using av_bprint_init_for_buffer() avoids copying data
into the internal AVBPrint buffer (or worse: to allocate
a temporary buffer in case the internal buffer does not
suffice).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt abea3749b3 avcodec/webvttenc: Don't copy data around unnecessarily
Using av_bprint_init_for_buffer() avoids copying data
into the internal AVBPrint buffer (or worse: to allocate
a temporary buffer in case the internal buffer does not
suffice). It also ensures that the data is always
0-terminated.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt 686af4578c avcodec/srtenc: Don't copy data around unnecessarily
Using av_bprint_init_for_buffer() avoids copying data
into the internal AVBPrint buffer (or worse: to allocate
a temporary buffer in case the internal buffer does not
suffice). It also ensures that the data is always
0-terminated, whereas the current code never does this
and returns success in case the length of the
string to write and the size of the buffer coincide.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt b8a00a1f73 avcodec/assenc: Use size_t for length of string
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:45:31 +01:00
Andreas Rheinhardt fe08058f24 avcodec/cbs_vp8: Don't leave out ... in calls to variadic macros
It is undefined behaviour (see C11, 6.10.3 (4); see also
14dd0a9057).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:42:28 +01:00
Andreas Rheinhardt 76b4151175 avcodec/h264dec: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:42:28 +01:00
Andreas Rheinhardt b550dd670a avcodec/h264dec: Return early in ff_h264_draw_horiz_band()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-22 01:42:28 +01:00
Martin Storsjö 1f1abb27f1 configure: Fix a typo
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-02-21 23:28:21 +02:00
Martin Storsjö 8a9b02389d checkasm: Add a "run-checkasm" make target
Contrary to the existing "fate-checkasm", this always prints the
tool output, and runs all tests at once instead of splitting it up
per target group. This is more useful when the user expects to
look directly at the tool output, instead of being part of a full
fate run.

(On failure with the regular "make fate-checkasm" targets, none of
the tool output is printed, but stored in files. If run with reporting
set up to the FATE website, the individual failures are uploaded there,
but if it is run in some sort of other CI setup, the intermediate files
might not be available afterwards for inspection.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-02-21 23:27:28 +02:00
James Almer d06cc1cb47 fate/mov: rename a test group to better reflect what it requires
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-21 18:03:06 -03:00
James Almer ebed8be508 fate/mov: add missing samples dependency to avif/heic tests
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-21 17:56:41 -03:00
James Almer 733d641211 fate/mov: add missing ffprobe dependency to mov-write-amve
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-21 17:46:54 -03:00
Andreas Rheinhardt 4d86e64d33 avcodec/cbs_vp8: Remove empty flush callback
This callback is optional and should therefore only be set
if it actually does something.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 19:24:19 +01:00
Andreas Rheinhardt e2f56f2bac fate/image: Enable fate-webp-rgb-lossless-palette-predictor test
Postponed in 9f4708c22d
because the sample had not been uploaded at that time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-21 19:24:19 +01:00
sunyuechi 9cb8f262f2 lavc/me_cmp: R-V V sse
C908:
sse_0_c: 614.7
sse_0_rvv_i32: 138.2
sse_1_c: 302.7
sse_1_rvv_i32: 107.2
sse_2_c: 175.7
sse_2_rvv_i32: 104.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-21 20:08:55 +02:00
sunyuechi 37463d7979 lavc/me_cmp: R-V V pix_abs_y2
C908:
pix_abs_0_2_c: 904.0
pix_abs_0_2_rvv_i32: 172.2
pix_abs_1_2_c: 460.0
pix_abs_1_2_rvv_i32: 168.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-21 20:08:25 +02:00
sunyuechi f1ec475f66 lavc/me_cmp: R-V V pix_abs_x2
C908:
pix_abs_0_1_c: 767.0
pix_abs_0_1_rvv_i32: 196.2
pix_abs_1_1_c: 388.0
pix_abs_1_1_rvv_i32: 185.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-21 20:08:25 +02:00
sunyuechi b41e115dde lavc/me_cmp: R-V V pix_abs
C908:
pix_abs_0_0_c: 534.0
pix_abs_0_0_rvv_i32: 136.2
pix_abs_1_0_c: 287.7
pix_abs_1_0_rvv_i32: 125.2
sad_0_c: 534.0
sad_0_rvv_i32: 136.2
sad_1_c: 287.7
sad_1_rvv_i32: 125.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-21 20:08:25 +02:00
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
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
Connor Worley 1487f6198c lavc/texturedsp: require explicitly-set frame dimensions
This change decouples the frame dimensions from avctx, which is useful
for DXV decoding, and fixes incorrect behavior in the existing
implementation.

Tested with `make fate THREADS=7` and
`make fate THREADS=7 THREAD_TYPE=slice`.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-02-18 07:30:01 +01:00
James Almer 0895ef0d6d avcodec/speexdec: further check for sane frame_size values
Prevent potential integer overflows.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-17 09:51:23 -03:00
sunyuechi d897bbb48d lavc/vp8dsp: R-V V vp8_idct_dc_add4uv
c908:
vp8_idct_dc_add4uv_c: 387.7
vp8_idct_dc_add4uv_rvv_i32: 134.5

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:45:49 +02:00
sunyuechi e74e18cae4 lavc/vp8dsp: R-V V vp8_idct_dc_add4y
c908:
vp8_idct_dc_add4y_c: 368.5
vp8_idct_dc_add4y_rvv_i32: 134.5

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:45:49 +02:00
sunyuechi c12053cefc lavc/vp8dsp: R-V V vp8_idct_dc_add
c908:
vp8_idct_dc_add_c: 102.2
vp8_idct_dc_add_rvv_i32: 42.0

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:45:49 +02:00
sunyuechi 89189dd9e7 lavc/rv34dsp: R-V V rv34_idct_dc_add
C908:
rv34_idct_dc_add_c: 134.7
rv34_idct_dc_add_rvv_i32: 45.5

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:33:35 +02:00
sunyuechi d133e52790 checkasm/rv34dsp: add rv34_idct_dc_add test
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:33:35 +02:00
sunyuechi ee08974f90 lavc/rv34dsp: R-V V rv34_inv_transform_dc
C908:
rv34_inv_transform_dc_c: 35.5
rv34_inv_transform_dc_rvv_i32: 27.0

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:33:35 +02:00
sunyuechi 6728edadde checkasm/rv34dsp: add rv34_inv_transform_dc test
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-17 14:33:35 +02:00
Michael Niedermayer 7f36127595
avfilter/v360: Use AV_VIDEO_MAX_PLANES
Issue found through Coverity CID1457948

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-16 21:34:38 +01:00
Michael Niedermayer eea9bd88a5
avutil/pixfmt: Add AV_VIDEO_MAX_PLANES
It seems we do not have a named identifier for the maximum planes of pixel formats

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-16 21:34:38 +01:00
James Almer 66b50445cb avcodec/speexdec: check for sane frame_size values
Regression since ab39cc36c7.

Fixes heap buffer overflows
Fixes ticket #10866

Reported-by: sploitem <sploitem@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-16 15:21:52 -03:00
Andreas Rheinhardt 7ed1e806e7 avcodec/x86/simple_idct: Empty MMX state in ff_simple_idct_mmx
We currently mostly do not empty the MMX state in our MMX
DSP functions; instead we only do so before code that might
be using x87 code. This is a violation of the System V i386 ABI
(and maybe of other ABIs, too):
"The CPU shall be in x87 mode upon entry to a function. Therefore,
every function that uses the MMX registers is required to issue an
emms or femms instruction after using MMX registers, before returning
or calling another function." (See 2.2.1 in [1])
This patch does not intend to change all these functions to abide
by the ABI; it only does so for ff_simple_idct_mmx, as this
function can by called by external users, because it is exported
via the avdct API. Without this, the following fragment will
assert (on x86_32, as ff_simple_idct_mmx is not used on x64):
    int16_t __attribute__ ((aligned (16))) block[64];
    AVDCT *dct = avcodec_dct_alloc();
    dct->idct_algo = FF_IDCT_AUTO;
    avcodec_dct_init(dct);
    dct->idct(block);
    av_assert0_fpu();

[1]: https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/intel386-psABI-1.1.pdf

Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-16 14:58:12 +01:00
Frank Plowman acacf8a313 lavc/vvc: Use pps->{width, height} over sps->{width, height}
The PPS should be used instead of the SPS to get the current picture's
dimensions.  Using the SPS can cause issues if the resolution changes
mid-sequence.  In particular, it was leading to invalid memory accesses
if the resolution decreased.

Patch replaces sps->{width,height} with pps->{width,height}.  It also
removes sps->{width,height}, as these are no longer used anywhere.

Fixes crash when decoding DVB V&V test sequence
VVC_HDR_UHDTV1_ClosedGOP_Max3840x2160_50fps_HLG10_res_change_without_RPR

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-02-16 12:05:03 +08:00
Dariusz Marcinkiewicz 86367be5ef lavc/libvpxenc: add screen-content-mode option
This exposes VP8E_SET_SCREEN_CONTENT_MODE option from libvpx.

Co-authored-by: Erik Språng <sprang@webrtc.org>
Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
Signed-off-by: James Zern <jzern@google.com>
2024-02-15 19:09:05 -08:00
Michael Niedermayer ebb7dffa97
swscale/tests/swscale: Add help text
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-15 23:07:44 +01:00
Michael Niedermayer 6ebe4ebee3
swscale/tests/swscale: Highlight cases that worsened
also highlight cases that worsened alot in uppercase

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-15 23:07:44 +01:00
Michael Niedermayer f7770ec9a4
swscale/tests/swscale: Allow comparing a subset of cases to a reference file
Testing all cases exhaustively is slow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-15 23:07:44 +01:00
Michael Niedermayer 885a802f24
swscale/tests/swscale: Test a wider range of flag combinations
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-15 23:07:43 +01:00
Michael Niedermayer 35ab103c30
swscale/tests/swscale: Compute chroma and alpha between gray and opaque frames too
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-15 23:07:43 +01:00
Michael Niedermayer 247f485448
swscale/tests/swscale: Split sws_getContext()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-15 23:07:43 +01:00
Michael Niedermayer 1055ece30b
swscale/tests/swscale: Implement isALPHA() using AVPixFmtDescriptor
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-15 23:07:42 +01:00
Peter Ross a2cfd6062c av_tx_init: accept NULL scale for RDFT
Make av_tx_init() agree with documentation:

     * Real to complex and complex to real DFTs.
     * For the float and int32 variants, the scale type is 'float', while for
     * the double variant, it's a 'double'. If scale is NULL, 1.0 will be used
     * as a default.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Peter Ross <pross@xvid.org>
2024-02-15 18:56:44 +11:00
Ingo Oppermann 86128bd07a avformat/libsrt: Fix srt:// URL query string parsing
Add missing NULL check and use ff_urldecode for string query
parameters.

Signed-off-by: Ingo Oppermann <ingo@datarhei.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-15 00:34:16 +01:00
Andreas Rheinhardt e7f9edb469 avfilter/avfilter: Fix build with ASSERT_LEVEL >= 1
Broken in 86417b759f.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-14 15:35:47 +01:00
Anton Khirnov 86417b759f lavfi: get rid of FF_INTERNAL_FIELDS
This hack is used to limit the visibility of some AVFilterLink fields to
only certain files. Replace it with the same pattern that is used e.g.
in lavf AVStream/FFStream and avoid exposing these internal fields in a
public header completely.
2024-02-14 15:08:49 +01:00
Anton Khirnov 1e7d2007c3 all: use designated initializers for AVOption.unit
Makes it robust against adding fields before it, which will be useful in
following commits.

Majority of the patch generated by the following Coccinelle script:

@@
typedef AVOption;
identifier arr_name;
initializer list il;
initializer list[8] il1;
expression tail;
@@
AVOption arr_name[] = { il, { il1,
- tail
+ .unit = tail
}, ...  };

with some manual changes, as the script:
* has trouble with options defined inside macros
* sometimes does not handle options under an #else branch
* sometimes swallows whitespace
2024-02-14 14:53:41 +01:00
Andreas Rheinhardt 8a2c8687bd avfilter/af_hdcd: Drop a redundant log
avfilter_insert_filter() already reports (also with AV_LOG_VERBOSE)
when a filter is auto-inserted.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-14 13:24:55 +01:00
Andreas Rheinhardt b84d286ac7 avfilter/vf_(bwdif|yadif)_cuda: Remove unused variables
Forgotten in 268062fa15.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-14 13:18:42 +01:00
Andreas Rheinhardt 80666fdd2f avcodec/cri, tdsc, tiff: Don't forward AVCodecContext.dct_algo
It is unused for decoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-14 13:18:42 +01:00
Andreas Rheinhardt 964693324a avformat/avformat: Remove reference to removed setter
Removed in 704017d91e.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-14 13:18:41 +01:00
Nuo Mi 1e174120d4 avcodec/vvcdec: frame_context_setup, set fc->ref to NULL
fc->ref points to an old VVCFrame, which cannot be used after frame_context_setup.
This prevents crashes in decode_nal_units-->ff_vvc_report_frame_finished.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-02-14 10:09:06 +08:00
James Almer eb5b4e60c9 avcodec/avcodec: don't print coded dimensions if not set
The avctx passed to avcodec_string() may have unset coded dimensions, as is the
case when called by av_dump_format() where the streams had all the needed
information at the container level, and as such no frames were decoded
internally.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-13 20:32:48 -03:00
Andreas Rheinhardt 6106fb2b4c avcodec/hevcdsp: Offset ff_hevc_.pel_filters to simplify addressing
Besides simplifying address computations (it saves 432B of .text
in hevcdsp.o alone here) it also fixes undefined behaviour that
occurs if mx or my are 0 (happens when the filters are unused)
because they lead to an array index of -1 in the old code.
This happens in the checkasm-hevc_pel FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-13 20:25:49 -03:00
Kieran Kunhya 40c5c19eac x86/h264_pred: Convert ff_pred8x8_vertical_8_mmx to ff_pred8x8_vertical_8_sse2 2024-02-13 21:17:06 +00:00
Kieran Kunhya f43b5f1098 vp6dsp: Remove MMX code
Missed from 6cb3ee8
2024-02-13 20:47:16 +00:00
sunyuechi fdebde817c lavc/blockdsp: R-V V clear_blocks
C908:
blockdsp.clear_blocks_c: 128.2
blockdsp.clear_blocks_rvv_i64: 102.5

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-13 21:29:46 +02:00
Niklas Haas d2ae2aad8c avfilter/buffersrc: allow promoting color range to MPEG
Otherwise, passing an UNSPECIFIED frame to am MPEG-only filter graph
would trigger insertion of an unnecessary vf_scale filter, which would
perform a memcpy to convert between the two.

This is safe to do because unspecified YUV frames are already
universally assumed to be MPEG range, in particular by swscale.
2024-02-13 19:30:14 +01:00
Niklas Haas 2303bf3232 avfilter/buffersrc: promote unspecified color metadata
Currently, this only affects untagged RGB/XYZ/Gray, which get forced to
their corresponding metadata before entering the filter graph. The main
justification for this change, however, is the planned ability to add
automatic promotion of unspecified yuv to mpeg range yuv.

Notably, this change will never allow accidentally cross-promoting
unspecified to jpeg or to a specific YUV matrix, since that is still
bound by the constraints of YUV range negotiation as set up by
query_formats.
2024-02-13 19:30:14 +01:00
Andreas Rheinhardt 99d33cc661 fate/subtitles: Ignore line endings for sub-scc test
Since 7bf1b9b357,
the test produces ordinary \n, yet this is not what the reference
file used for the most time, leading to test failures.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-13 18:26:48 +01:00
Niklas Haas 3bf80df3cc avfilter/vf_setparams: use YUV colorspace negotiation API
When this filter overrides frame properties, the outgoing frames have
a different YUV colorspace than the incoming ones. This requires
signalling the new colorspace on the outlink, and in particular, making
sure it's *not* set to a common ref with the input - otherwise the point
of this filter would be destroyed.

Untouched fields will continue being passed through, so we don't need to
do anything there.
2024-02-13 15:56:03 +01:00
Andreas Rheinhardt aa3bf6d41c avutil/hwcontext_opencl: Use proper OpenCLFramesContext
The currently used pointer when unmapping DXVA2 and D3D11
actually points to an OpenCLDeviceContext.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-13 15:33:30 +01:00
asivery 7f4abe7c37 avformat/matroska: Add support for A_ATRAC/AT1
Signed-off-by: asivery <asivery@protonmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-13 15:27:29 +01:00
Andreas Rheinhardt 568645f087 avformat/dump: Fix use of undeclared variables
Broken in ec2036454b.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-13 14:17:38 +01:00
James Almer ec2036454b avformat: add a disposition field to AVStreamGroup
The existing (and upcoming) available group types are meant to combine several
streams for presentation, with the result being treated as if it was a stream
itself.
For example, a file could export two stream groups of the same type with one of
them as the "default".

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-13 09:51:28 -03:00
Marton Balint 106527d2e5 avformat/mov_chan: add support for reading custom channel layouts when layout_tag == 0
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-12 21:04:11 +01:00
Marton Balint 66386bf2a2 avutil/channel_layout: add av_channel_layout_retype()
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-12 21:03:45 +01:00
Marton Balint 4569b86132 avutil/channel_layout: add av_channel_layout_custom_init()
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-12 21:03:45 +01:00
sunyuechi 0748d2bbc7 lavc/blockdsp: R-V V clear_block
C908:
blockdsp.clear_block_c: 47.2
blockdsp.clear_block_rvv_i64: 28.5

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-12 22:00:03 +02:00
rcombs 7bf1b9b357 lavf/assenc: normalize line endings to \n
Previously, we produced output with either \r\n or mixed line endings.
This was undesirable unto itself, but also made working with patches affecting
FATE output particularly challenging, especially via the mailing list.

Everything that consumes the SSA/ASS format is line-ending-agnostic,
so \n is selected to simplify git/ML usage in FATE.

Extra \r characters at the end of a packet are dropped. These are always
ignored by the renderer anyway.
2024-02-11 17:01:07 -08:00
rcombs 98eeef44aa lavf/avio_internal: add ffio_write_lines for line ending normalization 2024-02-11 17:01:07 -08:00
Michael Niedermayer 3be80ce299
avcodec/indeo3: Round dimensions up in allocate_frame_buffers()
Fixes: Ticket6581

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-12 00:50:47 +01:00
Michael Niedermayer f465badb06
avutil/rational: Document what is to be expected from av_d2q() of doubles representing rational numbers
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-12 00:50:46 +01:00
Michael Niedermayer 66f60a2355
avcodec/ac3enc_template: add fbw_channels assert
fbw_channels must be > 0 as teh code is only run if cpl_enabled is set and that requires mode >= AC3_CHMODE_STEREO

CID 718138 Uninitialized scalar variable
	assumes this assert to be false

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-12 00:50:46 +01:00
Michael Niedermayer 98ae1ad7cf
avfilter/signature_lookup: Do not dereference NULL pointers after malloc failure
Fixes: CID 1403229 Dereference after null check

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-12 00:50:46 +01:00
Michael Niedermayer 6c50482951
avfilter/signature_lookup: dont leave uncleared pointers in sll_free()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-12 00:50:45 +01:00
James Almer 2c324fcce0 x86/h264_intrapred: convert ff_pred16x16_horizontal_8_mmxext to sse2
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-11 22:23:37 +00:00
Nuo Mi 4f80441455 avcodec/hevc_mp4toannexb: more validations for nalu_len
For a corrupted stream, the value of nalu_len read from the extradata is not reliable.
We need to perform additional checks
2024-02-11 22:50:01 +08:00
Nuo Mi f7a504a0df avcodec/vvc_mp4toannexb: more validations for nalu_len
For a corrupted stream, the value of nalu_len read from the extradata is not reliable.
We need to perform additional checks

Fixes: fuzzer timeout
Fixes: 65253/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_MP4TOANNEXB_fuzzer-4972412487467008

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-11 22:49:51 +08:00
Leo Izen 7894904141
avcodec/pngenc: write cLLi and mDVc chunks
These chunks contain the Content Light Level Information and the
Mastering Display Color Volume information that FFmpeg already supports
as AVFrameSideData. This patch adds support for the png encoder to save
this metadata as the corresponding chunks in the PNG stream.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-02-11 08:58:00 -05:00
Leo Izen c7a57b0f70
avcodec/pngdec: read cLLi and mDVc chunks
These chunks contain the Content Light Level Information and the
Mastering Display Color Volume information that FFmpeg already supports
as AVFrameSideData. This patch adds support for the png decoder to read
these chunks if present and attach the corresponding side data to the
decoded frame.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-02-11 08:57:40 -05:00
Leo Izen eb4df2709e
avcodec/tiff: pass arguments to bytestream2_seek in the right order
The function signature for bytestream2_seek is (gb, offset, whence);
Before this patch, the code passed (gb, SEEK_SET, offset), which is
incorrect.

Siged-off-by: Leo Izen <leo.izen@gmail.com>
2024-02-11 08:57:11 -05:00
Akihiko Odaki 66231e5871 avcodec/vc1dec: Fix vc1_hwaccel_pixfmt_list_420
vc1_hwaccel_pixfmt_list_420 is referenced even if
!(CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER) so move it out
of the #if block.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-11 11:15:15 +01:00
Connor Worley afb630ce4d lavc/dxv: remove ctx fields that can be derived from texdsp ctxs
Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-11 00:40:06 +01:00
Connor Worley 2f9936e446 lavc/dvx: use texdsp funcs for texture block decompression
Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-11 00:40:06 +01:00
Connor Worley 939bf30d82 lavc/dxv: move tag definitions to common header
Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-11 00:40:06 +01:00
Andreas Rheinhardt 5e2b0862eb tests/fate-run: Sanitize test argument
test -z is a binary operator.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-10 08:05:57 +01:00
James Almer 81c2557691 avcodec: remove some references to avcodec_close
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-10 00:04:16 -03:00
Marton Balint dc9d64f794 avformat/mov_chan: never override number of channels based on chan atom
The channel designation metadata should not override the number of channels.
Let's warn the user if it is inconsistent, and keep the channel layout
unspecified.

Before the conversion to the channel layout API the code only set the mask, but
never overridden the channel count, so this restores the old behaviour.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-09 23:47:24 +01:00
Marton Balint 3d3cad7483 avformat/mov_chan: do not assume channels are in native order
Existing code could have caused wrong channel order signalling or reduced
channel count if a channel designation appeared multiple times. This is
actually an old bug, but the conversion to the new channel layout API made it
visible, because now the code overrides the proper channel count with the one
calculated from the mask.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-09 23:47:24 +01:00
Lynne 90adef99ca
avfft: avoid overreads with RDFT API users
The new API requires an extra array member at the very end,
which old API users did not do.

This disables in-place RDFT transforms and instead
does the transform out of place by copying once, there shouldn't
be a significant loss of speed as our in-place FFT requires a reorder
which is likely more expensive in the majority of cases to do.
2024-02-09 23:20:29 +01:00
Andreas Rheinhardt ce7c90ff82 avcodec/dca_core: Remove unneeded emms.h inclusion
Possible since 7ec2354c38.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 23:11:52 +01:00
Martin Storsjö 7ec2354c38 x86: Remove inline MMX assembly that clobbers the FPU state
These inline implementations of AV_COPY64, AV_SWAP64 and AV_ZERO64
are known to clobber the FPU state - which has to be restored
with the 'emms' instruction afterwards.

This was known and signaled with the FF_COPY_SWAP_ZERO_USES_MMX
define, which calling code seems to have been supposed to check,
in order to call emms_c() after using them. See
0b1972d409,
29c4c0886d and
df215e5758 for history on earlier
fixes in the same area.

However, new code can use these AV_*64() macros without knowing
about the need to call emms_c().

Just get rid of these dangerous inline assembly snippets; this
doesn't make any difference for 64 bit architectures anyway.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-02-09 23:55:52 +02:00
Connor Worley d5aaed9d4c lavc/dxv: align to 4x4 blocks instead of 16x16
The previous assumption that DXV needs to be aligned to 16x16 was
erroneous. 4x4 works just as well, and FATE decoder tests pass for all
texture formats.

On the encoder side, we should reject input that isn't 4x4 aligned,
like the HAP encoder does, and stop aligning to 16x16. This both solves
the uninitialized reads causing current FATE tests to fail and produces
smaller encoded outputs.

With regard to correctness, I've checked the decoding path by encoding a
real-world sample with git master, and decoding it with
  ffmpeg -i dxt1-master.mov -c:v rawvideo -f framecrc -
The results are exactly the same between master and this patch.

On the encoding side, I've encoded a real-world sample with both master
and this patch, and decoded both versions with
  ffmpeg -i dxt1-{master,patch}.mov -c:v rawvideo -f framecrc -
Under this patch, results for both inputs are exactly the same.

In other words, the extra padding gained by 16x16 alignment over 4x4
alignment has no impact on decoded video.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-02-09 23:47:14 +02:00
Niklas Haas c619d20906 fftools/ffplay: constrain supported YUV color spaces
SDL supports only these three matrices. Actually, it only supports these
three combinations: BT.601+JPEG, BT.601+MPEG, BT.709+MPEG, but we have
no way to restrict the specific *combination* of YUV range and YUV
colorspace with the current filter design.

See-Also: https://trac.ffmpeg.org/ticket/10839

Instead of an incorrect conversion result, trying to play a YCgCo file
with ffplay will simply error out with a "No conversion possible" error.
2024-02-09 21:02:08 +01:00
Niklas Haas 75f4cb81de avfilter/buffersink: add color_spaces, color_ranges params
An oversight in my previous series. This omission slipped under the
radar because fftools/ffmpeg_filter.c did not use these options, instead
preferring to insert an explicit format filter.
2024-02-09 21:02:08 +01:00
Timo Rothenpieler 4618b5ebb9 Revert "avutil/mem: limit alignment to maximum simd align"
Patch was not intended to be part of the set it got pushed with.

This reverts commit 6154137b18.
2024-02-09 20:20:03 +01:00
Timo Rothenpieler 21c6d12449 avfilter/ddagrab: only use acquired texture on valid updates 2024-02-09 19:51:48 +01:00
Timo Rothenpieler 6154137b18 avutil/mem: limit alignment to maximum simd align
FFmpeg has instances of DECLARE_ALIGNED(32, ...) in a lot of structs,
which then end up heap-allocated.
By declaring any variable in a struct, or tree of structs, to be 32 byte
aligned, it allows the compiler to safely assume the entire struct
itself is also 32 byte aligned.

This might make the compiler emit code which straight up crashes or
misbehaves in other ways, and at least in one instances is now
documented to actually do (see ticket 10549 on trac).
The issue there is that an unrelated variable in SingleChannelElement is
declared to have an alignment of 32 bytes. So if the compiler does a copy
in decode_cpe() with avx instructions, but ffmpeg is built with
--disable-avx, this results in a crash, since the memory is only 16 byte
aligned.

Mind you, even if the compiler does not emit avx instructions, the code
is still invalid and could misbehave. It just happens not to. Declaring
any variable in a struct with a 32 byte alignment promises 32 byte
alignment of the whole struct to the compiler.

This patch limits the maximum alignment to the maximum possible simd
alignment according to configure.
While not perfect, it at the very least gets rid of a lot of UB, by
matching up the maximum DECLARE_ALIGNED value with the alignment of heap
allocations done by lavu.
2024-02-09 18:11:49 +01:00
Lynne 9af87828bd
x86/tx_init: propely indicate the extended available transform sizes
Forgot to do this with the previous commit.

Actually makes the assembly being used.

Still the fastest FFT in the world, 15% faster than FFTW on the
largest available size.
2024-02-09 18:08:42 +01:00
James Almer 7c873fb298 lavc/refstruct: do not use max_align_t on MSVC
It is not available there, even when C11/17 is requested.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-02-09 16:24:50 +01:00
Anton Khirnov 1cc24d7495 lavc: deprecate avcodec_close()
Its use has been discouraged since 2016, but now is no longer used in
avformat, so there is no reason to keep it public.
2024-02-09 16:14:56 +01:00
Anton Khirnov ca18bb5972 lavf/demux: stop calling avcodec_close()
Replace it with recreating the codec context.

This is the last remaining blocker for deprecating avcodec_close().
2024-02-09 16:14:56 +01:00
Anton Khirnov 88ba22009e lavf/flacdec: stop accessing FFStream.avctx
The demuxer opens an internal parser instance in read_timestamp(), which
requires a codec context. There is no need for it to access the FFStream
one which is used for other purposes, it can allocate its own internal
one.
2024-02-09 16:14:56 +01:00
Anton Khirnov 0d54ae4012 lavf/mpegts: drop a cargo-culted check
This check has survived the transition to AVCodecParameters, but is no
longer relevant after it, since the codec context is no longer updated
or accessed at all from the demuxer.
2024-02-09 16:14:56 +01:00
Anton Khirnov 05fc6d3ce7 fftools/ffmpeg_demux: set stream index right before sending packet to scheduler
This avoids assuming that it survives unchanged through bitstream
filters, if present.
2024-02-09 16:14:24 +01:00
Andreas Rheinhardt 8c2e86ca28 fftools/cmdutils: Don't cast const away
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 12:22:21 +01:00
Andreas Rheinhardt 3371250c32 avformat/rcwtenc: Pass RCWTContext directly in rcwt_init_cluster()
It does not use the AVFormatContext at all.

Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 10:20:42 +01:00
Andreas Rheinhardt a8e55cf118 avformat/rcwtenc: Remove redundant zeroing of buffer
Resetting the counter of used elements is enough as nothing is
ever read from the currently unused elements.

Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 10:20:35 +01:00
Andreas Rheinhardt d30fe36b88 avformat/rcwtenc: Fix potential out-of-bounds write
The rcwt muxer uses several counters for how much data
it has already cached: One byte counter and one counter
for how many complete blocks (of three bytes each).
These counters can become inconsistent when the muxer is
fed incomplete blocks as the muxer presumes that it is
about to write a new block at the start of each write_packet
call. E.g. sending 65535*3+1 1-byte packets (with data[0] e.g. 0x03)
will trigger an out-of-bounds write.

This patch fixes this by processing the data in complete blocks
only. This also allows to simplify the code, e.g. to remove one of
the counters.

Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 10:20:21 +01:00
Andreas Rheinhardt 2b0e9e278a avcodec/h263dec: Remove AVCodec.pix_fmts arrays
They are not intended for decoders (for which there is the get_format
callback in case the user has a choice).

Also note that the list was wrong for MPEG4, because it did not contain
the high bit depth pixel formats used for studio profiles.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 08:16:25 +01:00
Andreas Rheinhardt 39cfd30bf1 avcodec/vc1dec: Remove AVCodec.pix_fmts arrays
They are not intended for decoders (for which there is the get_format
callback in case the user has a choice).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 08:16:25 +01:00
Andreas Rheinhardt ca95863758 avcodec/vc1dec: Don't call ff_get_format() twice
It is currently called once in the codecs' init function
and once when (re)initializing the VC-1 decode context
(which happens upon frame size changes as well as before
decoding the first frame). The first one is unnecessary
now that vc1_decode_frame() no longer requires avctx->hwaccel
to be already set for hwaccel to work properly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 08:16:25 +01:00
Andreas Rheinhardt 38f234c06e avcodec/vc1dec: Set pointers for hwaccel even without hwaccel
VC-1 uses a 0x03 escaping scheme like H.26x and our decoder
unescapes data for this purpose, but hardware accelerations
just want the data as-is and therefore get fed the original
data. The pointers to the actual data are only setcorrectly
if avctx->hwaccel is set (after all, they are only used in
this case).

There are two problems with this: The first is that the branch
is pointless; the second is that it is harmful, because
a hardware acceleration may be added after the packet has been
parsed (in case there is a reconfiguration e.g. due to frame
size changes) in which case decoding the first few frames
won't work.

So delete these branches.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 08:16:25 +01:00
Andreas Rheinhardt 687a287e14 avcodec/mmaldec: Avoid using AVCodec.pix_fmts
It is entirely unnecessary to use it given that all decoders
here share the same set of supported pixel formats. So just
hardcode this list.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 08:16:25 +01:00
Andreas Rheinhardt 89995cfda1 avcodec: Remove redundant pix_fmts from decoders
AVCodec.pix_fmts is only intended for encoders (decoders use
the get_format callback to let the user choose a pix fmt).
So remove them for the decoders for which this is possible
without further complications; keep them for now in the codecs
that actually use them (by passing avctx->codec->pix_fmts to
ff_get_formatt()).

Also notice that some of these lists were wrong; e.g.
317b7b06fd added support for YUV444P16
for cuviddec, but forgot to add it to pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-09 08:16:25 +01:00
Connor Worley 395469c1b0 fate/video: add DXV3 HQ tests
Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-08 20:37:27 +01:00
Connor Worley 5fbb6fc636 fate/video: add DXV3 DXT1 encoding test
Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-08 20:37:27 +01:00
Connor Worley 1eeee68d8e lavc/dxv: fix incorrect back-reference index calculation in DXT5 decoding
This bug causes the DXT5 decoder to produce incorrect block texture data.
After the fix, textures are visually correct and match data decoded by
Resolume Alley (extracted with Nvida Nsight for comparison). Current FATE DXT5
samples did not cover this case.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-08 20:36:15 +01:00
Connor Worley 3b6a515c5f lavc/dxv: treat DXT5-tagged files as DXT4
DXV files seem to misnomer DXT5 and really encode DXT4 with
premultiplied alpha. At least, this is what Resolume alley does.

To check, encode some input with alpha as "Normal Quality, With Alpha"
in Alley, then decode the output with this change -- results are true
to the original input compared to git-master.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-08 20:36:04 +01:00
Connor Worley c4e9556cf5 lavc/texturedsp: fix premult2straight inversion
This function should convert premultiplied alpha to straight, but does the opposite.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
2024-02-08 20:36:04 +01:00
Andreas Rheinhardt f6ec01147f avfilter/fifo: Remove (a)fifo filters
Obsolete since 4ca1fb9d2a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-08 14:02:55 +01:00
Andreas Rheinhardt 9ae40f282d avcodec/nvdec: Constify bitstream pointee
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-08 14:00:37 +01:00
Haihao Xiang cd31eac999 lavc/qsvenc: Add workaround for VP9 keyframe
The runtime doesn't set the frame type to MFX_FRAMETYPE_IDR on the
returned mfx bitstream for a keyframe, it set the frame type to
MFX_FRAMETYPE_I only. This patch added workaround for VP9 keyframe to
make the coded stream seekable.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-02-08 10:34:02 +08:00
Tong Wu 82e8838165 avcodec/dxva2: fix different 'const' qualifiers warning
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-02-08 10:34:02 +08:00
Tong Wu 92ee7461c3 avcodec/d3d12va_decode: fix different 'const' qualifiers warning
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-02-08 10:34:02 +08:00
Aleksoid 336d59643a avcodec/d3d12va_vc1: add support for D3D12_VIDEO_DECODE_PROFILE_VC1_D2010 guid.
The VC1_D2010 profile, also known as VC1_VLD2010, has the same functionality
and specification as the VC1_D profile. Support for this profile serves only
as a positive indication that the accelerator has been designed with awareness
of the modifications specified in the August 2010 version of this specification.

Hardware accelerator drivers that expose support for this profile must not
also expose the previously specified VC1_D GUID, unless the accelerator works
properly with existing software decoders that use VC1_D and that do not incorporate
the corrections added to the August 2010 version of this specification.

As a result, we could give VC1_VLD2010 a higher priority and initialize
it first.

Signed-off-by: Aleksoid <Aleksoid1978@mail.ru>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-02-08 10:34:02 +08:00
Wu Jianhua 3372876888 avcodec/x86/vvc/vvcdsp_init: fix unresolved external symbol on ARCH_X86_32
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-02-07 22:53:15 +08:00
James Almer 7f92014aca avcodec/nvdec: don't free NVDECContext->bitstream
Ensure all hwaccels that allocate a buffer use NVDECContext->bitstream_internal
instead. Otherwise, if FFHWAccel->end_frame() isn't called before
FFHWAccel->uninit(), an attempt to free a stale pointer to memory not owned by
the hwaccel could take place.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-07 11:31:33 -03:00
Lynne bd3e71b21e
x86/tx_float: enable SIMD for sizes over 131072
The tables for the new sizes were added last year due
to being required for SDR.
However, the assembly was never updated to use them.
2024-02-07 15:20:48 +01:00
Andreas Rheinhardt e05d3c1a16 avdevice/caca: Allow to list multiple dither option types at once
This can be achieved by using AV_OPT_TYPE_FLAGS instead of
AV_OPT_TYPE_STRING. It also avoids strcmp() when accessing
the option.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:25:17 +01:00
Andreas Rheinhardt ed56ca856c avutil/opt: Fix AV_OPT_TYPE_CONST default value
It uses the int64_t instead of the double member.

(This code can currently not be reached: av_opt_get() calls
av_opt_find2() with NULL as unit in which case AV_OPT_TYPE_CONST
options are never returned, leading av_opt_get() to always
return AVERROR_OPTION_NOT_FOUND when searching for AV_OPT_TYPE_CONST*.
For the same reason the code read_number() will never be called
from get_number() when searching for an option of type
AV_OPT_TYPE_CONST. The other callers of read_number() also only
call it with types other than AV_OPT_TYPE_CONST.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:23:00 +01:00
Andreas Rheinhardt 8b83b52d0f avformat/nutenc: Fix indentation
Forgotten after 82beb46e65.
Also use loop-scope for iterators while at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:19 +01:00
Andreas Rheinhardt 1a52cbd404 avfilter/ccfifo: Improve included headers
We don't need to include fifo.h, because we don't need AVFifo
as a complete type. Also add the other used headers directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:19 +01:00
Andreas Rheinhardt 9b67c5a684 avfilter/ccfifo: Inline trivial functions
Besides being extremly simple this also avoids including
ff_ccfifo_ccdetected() unnecessarily (it is only used by decklink).
This is possible because this is not avpriv, but duplicated into
lavd if necessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:19 +01:00
Andreas Rheinhardt 71e1da4522 avformat/mux: Don't allocate priv_pts separately
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt ad9f644505 avformat/avformat: Avoid av_strdup(NULL)
It is not documented to be safe.
Also copy these lists in a more generic manner.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt 569ad285a5 avformat/options: Only allocate AVCodecContext for demuxers
The muxer's AVCodecContext is currently used for exactly one thing:
To store a time base in it that has been derived via heuristics
in avformat_transfer_internal_stream_timing_info(); said time base
can then be read back via av_stream_get_codec_timebase().
But one does not need a whole AVCodecContext for that, a simple
AVRational is enough.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt 76ef2b9337 avformat/avformat: Remove obsolete comment
Forgotten in 3f991325b5,
obsolete since 3749eede66.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt 1d5ba34249 avformat/avformat: Remove dead check, write-only assignment
For muxers, the internal AVCodecContext is basically unused
except in avformat_transfer_internal_stream_timing_info()
(which sets time_base and ticks_per_frame) and
av_stream_get_codec_timebase() (a getter for time_base).
This makes ticks_per_frame write-only, so don't set it.

Also remove an always-false check for the AVCodecContext's
codec_tag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Marth64 97fb84d74e doc/formats: clarify meaning of igndts as per definition in avformat.h
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-02-07 00:55:40 +01:00
Frank Plowman 5076fa30ab lavc/vvc: Validate alf_list indexes
Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-02-06 22:10:06 +08:00
James Almer e7a9dd03ab avcodec/libaomdec: print libaomdec version in verbose level
info level will be too noisy if several instances of the decoder are fired
at the same time, as will be the case with tiled AVIF.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-06 10:34:50 -03:00
James Almer 48f4a29bae avcodec/libdav1d: print libdav1d version in verbose level
info level will be too noisy if several instances of the decoder are fired
at the same time, as will be the case with tiled AVIF.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-06 10:34:50 -03:00
Frank Plowman a42f884cd2 lavc/vvc: Fix slice_idx out-of-bounds memset
If the number of CTUs reduces between one picture and the next, the
slice_idx table is reduced in size in the frame_context_for_each_tl call
on vvcdec.c:321.  When initialising the slice_idx table on vvcdec.c:325,
the old code uses fc->tab.sz.ctu_count when calculating the table size.
fc->tab.sz.ctu_count holds the old ctu count at this point however, not
being updated to hold the new ctu count until vvcdec.c:342.  This causes
an out-of-bounds write.

Patch fixes the problem by using pps->ctb_count, which was just used
when allocating the table, in place of fc->tab.sz.ctu_count when
initialising the table.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-02-06 19:45:43 +08:00
Niklas Haas aa1a194a7e avfilter/vsrc_testsrc: switch to YUV colorspace negotiation API
Instead of overriding the frame properties in fill_picture(), advertise
the supported YUV colorspace and range at format negotiation time. (The
correct metadata will now be set automatically by ff_get_video_buffer)
2024-02-06 11:30:10 +01:00
Niklas Haas ce81237d63 avfilter: pass link YUV colorspace to ff_draw_init2
This makes all ff_draw_* based filters aware of YUV colorspaces and
ranges. Needed for YUVJ removal. Also fixes a bug where e.g. vf_pad
would generate a limited range background even after conversion to
full-scale grayscale.

The FATE changes were a consequence of the aforementioned bugfix - the
gray scale files are output as full range (due to conversion by
libswscale, which hard-codes gray = full), and appropriately tagged as
such, but before this change the padded version incorrectly used
a limited range (16) black background for these formats.
2024-02-06 11:30:10 +01:00
Cosmin Stejerean 8264f3612c .mailmap: update my mailmap entry 2024-02-06 10:34:15 +01:00
Leo Izen c0de7ac520
avcodec/libjxlenc: support negative linesizes
libjxl doesn't support negative strides, but JPEG XL has an orientation
flag inside the codestream. We can use this to work around the library
limitation, by taking the absolute value of the negative row stride,
sending the image up-side-down, and telling the library that the image
has a vertical-flip orientation.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-02-05 12:28:02 -05:00
Niklas Haas 789109ab21 avfilter/vf_tiltandshift: check outlink->color_range
In addition to YUVJ pixfmts.
2024-02-05 15:20:48 +01:00
Nuo Mi 88a040386a avcodec/vvcdec: fix seeking for open GOP
how to reproduce:
wget https://media.xiph.org/video/derf/y4m/students_cif.y4m
vvencapp --input students_cif.y4m --preset faster --output students.266
MP4Box -add students.266:fps=30000/1001:par=12:11 -new students.mp4
ffplay students.mp4
2024-02-05 21:43:18 +08:00
Anton Khirnov f80d91c051 tests/fate/ffmpeg: add a test for the issue fixed in previous commit 2024-02-05 11:55:12 +01:00
Anton Khirnov 931192226b fftools/ffmpeg_mux: fix terminating muxer on streamcopy with -t
Reported-by: Andreas Rheinhardt
2024-02-05 11:55:12 +01:00
Marton Balint 71ea90638e avutil/thread: fix pthread_setname_np parameters for NetBSD and Apple
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-05 09:42:30 +01:00
Paul B Mahol d3111486f9 MAINTAINERS: remove myself from here
Once it became fully non-transparent and service of shady practices
behind closed doors, I can not be here any more.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-02-04 22:22:42 +01:00
Brad Smith fd16d8c68c avutil/thread: add support for setting thread name on *bsd and solaris
FreeBSD/DragonFly/Solaris use pthread_setname_np(). OpenBSD uses pthread_set_name_np().

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:45:10 +01:00
Alessandro Ros 49ab7f8997 avformat/flvenc: fix stereo flag when writing PCMA/PCMU
Currently, when writing PCMA or PCMU tracks with FLV or RTMP, the
stereo flag and sample rate flag inside RTMP audio messages are
overridden, making impossible to distinguish between mono and stereo
tracks. This patch fixes the issue by restoring the same flag mechanism
of all other codecs, that takes into consideration the right channel
count and sample rate.

Signed-off-by: Alessandro Ros <aler9.dev@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:28:47 +01:00
Mark Thompson fa580a0f17 lavc/d3d12va: Improve behaviour on missing decoder support
Distinguish between a decoder being entirely missing and a decoder which
requires features which are not present in the incomplete implementation
in libavcodec and therefore can't be used.
2024-02-04 19:18:58 +00:00
Marton Balint 52cc89dc45 avfilter/yadif_common: fix timestamps with very small timebases
Yadif filter assumed that the output timebase is always half of the input
timebase. This is not true if halving the input time base is not representable
as an AVRational causing the output timestamps to be invalidly scaled in such a
case.

So let's use av_reduce instead of av_mul_q when calculating the output time
base and if the conversion is inexact then let's fall back to the original
timebase which probably makes more parctical sense than using x/INT_MAX.

Fixes invalidly scaled pts_time values in this command line:
ffmpeg -f lavfi -i testsrc -vf settb=tb=1/2000000000,yadif,showinfo -f null none

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:04:18 +01:00
Marton Balint 268062fa15 avfilter/yadif_common: factorize some part of the config_output and the uninit functions
This unifies slightly diverged code and ensures that cc_fifo is always initialized.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:04:18 +01:00
Marton Balint 8fccd6d510 avutil/rational: increase av_d2q precision
Fixes parsing small timebases from expressions (where the expression API
converts the result to double), like in this command line:

ffprobe -f lavfi -i testsrc=d=1,settb=1/2000000000 -show_streams -show_entries stream=time_base

Before the patch timebase was parsed as 1/1999999999.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:04:18 +01:00
Cosmin Stejerean 976cf2343d tests/fate/mov: add a test for reading and writing amve box 2024-02-04 14:03:45 -03:00
Damiano Galassi 112d3618ca avformat/mov: add support for 'amve' ambient viewing environment box
As defined in ISOBMFF (ISO/IEC 14496-12) document.

Co-Authored-By: Cosmin Stejerean <cosmin@cosmin.at>
2024-02-04 13:36:25 -03:00
Cosmin Stejerean dda4b25e2d avformat/mov: rename rescale_mdcv
It's not specific to the mdcv box.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-04 13:36:25 -03:00
Damiano Galassi 45697e6a51 avcodec: add ambient viewing environment packet side data. 2024-02-04 13:36:21 -03:00
Andreas Rheinhardt d525dbb41f avcodec/vp8: Change criterion for calling ff_thread_finish_setup()
The current criterion is to check for the existence of
update_thread_context. Change this to check for whether
we are actually decoding VP8 (and not VP7 or VP8-in-WebP).
This is equivalent to the current criterion, but allows
the WebP decoder to evolve and to get its own update_thread_context.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-04 13:58:38 +01:00
Andreas Rheinhardt e37e9d58f8 avcodec/vp8: Remove write-only vp7 struct field
This decoder always inlines whether it is VP7 or VP8.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-04 13:58:38 +01:00
Andreas Rheinhardt 4b8b1415ae avcodec/vp8: Enforce key-frame only for WebP
VP8-in-WebP only uses key frame encoding (see [1]), yet this
is currently not enforced. This commit does so in order to
make output reproducible with frame-threading as the VP8 decoder's
update_thread_context is not called at all when using decoding
VP8-in-WebP (as this is unnecessary for key frame-only streams).

[1]: https://developers.google.com/speed/webp/docs/riff_container

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-04 13:58:38 +01:00
Gyan Doshi 7375a6ca7b avformat/wavenc: use strtoull for UMID conversion
Existing use of strtoll can lead to ERANGE errors leading to incorrect
storage of UMID.
2024-02-04 14:44:32 +05:30
James Almer b94b3eac0e avformat/mov: use a more descriptive name for variables of type HEIFItem
Other HEIF related structs will be introduced, so lets be more specific about what
this one defines.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-03 23:08:42 -03:00
James Almer cc774cd962 avcodec/cbs_h266_syntax_template: check aps_adaptation_parameter_set_id
"When aps_params_type is equal to ALF_APS or SCALING_APS, the value of aps_adaptation_parameter_set_id shall be
in the range of 0 to 7, inclusive.
When aps_params_type is equal to LMCS_APS, the value of aps_adaptation_parameter_set_id shall be in the range of 0
to 3, inclusive."

Fixes: out of array accesses
Fixes: 65932/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-4563412340244480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-03 23:49:25 +08:00
Marth64 01388936a8 avformat/avlanguage: add the 6 deprecated DVD languages
There are 6 deprecated ISO language codes that are still valid for DVDs.
This patch allows avlanguage to recognize them correctly. The codes are:
(1) "in" - legacy code for Indonesian, mapped to the modern code
(2) "iw" - legacy code for Hebrew, mapped to the modern code
(3) "ji" - legacy code for Yiddish, mapped to the modern code
(4) "jw" - legacy code for Javanese, published and used as a typoed version of "jv"
(5) "mo" - legacy code for Moldavian, mapped to the inclusive code
(6) "sh" - legacy code for Serbo-Croatian, no modern inclusive code so it is left alone

All of this can be verified from several sources including:
https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-02-03 12:52:47 +01:00
王昊然 344ec7a3f7 fftools/ffmpeg: use correct unit prefix symbol for binary scaled byte values
Fix bug #10501

Signed-off-by: WHR <msl0000023508@gmail.com>
2024-02-03 12:50:42 +01:00
Andreas Rheinhardt 9d364fbdb0 avcodec/vlc: Remove unused macros
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-03 00:26:17 +01:00
Andreas Rheinhardt 648df1c250 avcodec/leaddec: Remove unnecessary VLC structures
One only needs the VLCElem[].

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-03 00:26:17 +01:00
Andreas Rheinhardt d50a246687 avformat/iamf*: Improve included headers
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-03 00:26:10 +01:00
Andreas Rheinhardt 8d4b22edc7 avformat/iamf_writer, iamfenc: Avoid allocations when using dyn buffers
Use avio_get_dyn_buf()+ffio_free_dyn_buf() instead of
avio_close_dyn_buf()+av_free(). This saves an allocation
(and memcpy) in case all the data fits in the AVIOContext's
write buffer.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-03 00:26:02 +01:00
Andreas Rheinhardt b9596daafb avformat/iamf_writer: Avoid using dynamic buffer
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-03 00:25:38 +01:00
Anton Khirnov aa3cfd4b5a lavc/bsf: add a showinfo filter
Analogous to the (a)showinfo lavfi filters, logs basic packet
information. Mainly useful for debugging/testing/development.
2024-02-02 15:41:54 +01:00
Anton Khirnov 70ecb8238c lavd: deprecate the bktr device
It implements BSD-specific support for very old analog capture cards,
which are highly unlikely to be useful today. After being added in 2005,
there were never any commits to it beyond compilation fixes and generic
maintenance. There have also been zero trac tickets for this device, and
the only related web search result I found concludes that it does not
work.

The code also does some unacceptable things, like messing with signal
handlers and storing its state in global variables.
2024-02-02 15:40:35 +01:00
Niklas Haas f7b1017d73 fftools/ffmpeg_filter: simplify buffersrc arg printing
There's no need to go through full string expansion here.
2024-02-02 13:24:27 +01:00
Niklas Haas dcc7263b0e fftools/ffplay: add missing YUV metadata to buffersrc
This commit lets ffplay properly propagate YUV metadata into the filter
graph, avoiding such issues as e.g. accidentally passing YCgCo into a
filter that can't support it. Also fixes an error related to this
missing metadata from buffersrc (since commit 2d555dc82d)

See-Also: https://trac.ffmpeg.org/ticket/10839
2024-02-02 13:22:42 +01:00
James Almer b181868aba x86/h26x/h2656dsp: add missing preprocessor wrappers
Fixes compilation on x86_32 targets.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-01 16:04:09 -03:00
James Almer 6b6eb7d74e x86/Makefile: fix hevc and vvc dependency of h2656dsp.o
And remove tabs while at it.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-01 16:02:50 -03:00
James Almer f6b7b473d4 avformat/mov: ignore item boxes for animated heif
Fixes a regression since d9fed9df2a, where the single animated stream would
be exported twice as two independent streams.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-01 11:19:15 -03:00
James Almer 2dc8221e66 x86/hevcdsp_init.c: fix preprocessor check
HAVE_AVX2_EXTERNAL has a value, so check for it.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-01 10:47:53 -03:00
James Almer 0042cf8980 avformat/mov: split off MOVStreamContext freeing into its own function
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-01 10:28:57 -03:00
James Almer 78a7927df7 x86/vvc/vvc_mc: wrap the entire file in x86_64 and AVX2 checks
Fixes compilation with old yasm.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-01 10:23:42 -03:00
James Almer 692e32a7dc fate/checkasm: enable testing vvc_mc
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-01 10:07:26 -03:00
James Almer bf62ddc7bf x86/vvc/vvc_mc: set the correct number of used registers in vvc_w_avg functions
Fixes crashes when running fate-vvc-conformance-WP_A_3 on Win64 targets

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-01 10:04:14 -03:00
Wu Jianhua 4720cf56ca tests/checkasm/vvc_mc: add check_avg
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-02-01 19:54:29 +08:00
Wu Jianhua 326cc01de9 avcodec/x86/vvc: add avg and avg_w AVX2 optimizations
The avg/avg_w is based on dav1d.
See https://code.videolan.org/videolan/dav1d/-/blob/master/src/x86/mc_avx2.asm

vvc_avg_8_2x2_c: 71.6
vvc_avg_8_2x2_avx2: 26.8
vvc_avg_8_2x4_c: 140.8
vvc_avg_8_2x4_avx2: 34.6
vvc_avg_8_2x8_c: 410.3
vvc_avg_8_2x8_avx2: 41.3
vvc_avg_8_2x16_c: 769.3
vvc_avg_8_2x16_avx2: 60.3
vvc_avg_8_2x32_c: 1669.6
vvc_avg_8_2x32_avx2: 105.1
vvc_avg_8_2x64_c: 1978.3
vvc_avg_8_2x64_avx2: 425.8
vvc_avg_8_2x128_c: 6536.8
vvc_avg_8_2x128_avx2: 1315.1
vvc_avg_8_4x2_c: 155.6
vvc_avg_8_4x2_avx2: 26.1
vvc_avg_8_4x4_c: 250.3
vvc_avg_8_4x4_avx2: 31.3
vvc_avg_8_4x8_c: 831.8
vvc_avg_8_4x8_avx2: 41.3
vvc_avg_8_4x16_c: 1461.1
vvc_avg_8_4x16_avx2: 57.1
vvc_avg_8_4x32_c: 2821.6
vvc_avg_8_4x32_avx2: 105.1
vvc_avg_8_4x64_c: 3615.8
vvc_avg_8_4x64_avx2: 412.6
vvc_avg_8_4x128_c: 11962.6
vvc_avg_8_4x128_avx2: 1274.3
vvc_avg_8_8x2_c: 215.8
vvc_avg_8_8x2_avx2: 29.1
vvc_avg_8_8x4_c: 430.6
vvc_avg_8_8x4_avx2: 37.6
vvc_avg_8_8x8_c: 1463.3
vvc_avg_8_8x8_avx2: 51.8
vvc_avg_8_8x16_c: 2630.1
vvc_avg_8_8x16_avx2: 97.6
vvc_avg_8_8x32_c: 5813.8
vvc_avg_8_8x32_avx2: 196.6
vvc_avg_8_8x64_c: 6687.3
vvc_avg_8_8x64_avx2: 487.8
vvc_avg_8_8x128_c: 13178.6
vvc_avg_8_8x128_avx2: 1290.6
vvc_avg_8_16x2_c: 443.8
vvc_avg_8_16x2_avx2: 28.3
vvc_avg_8_16x4_c: 1253.3
vvc_avg_8_16x4_avx2: 32.1
vvc_avg_8_16x8_c: 2236.3
vvc_avg_8_16x8_avx2: 44.3
vvc_avg_8_16x16_c: 5127.8
vvc_avg_8_16x16_avx2: 63.3
vvc_avg_8_16x32_c: 6573.3
vvc_avg_8_16x32_avx2: 223.6
vvc_avg_8_16x64_c: 30311.8
vvc_avg_8_16x64_avx2: 437.8
vvc_avg_8_16x128_c: 25693.3
vvc_avg_8_16x128_avx2: 1266.8
vvc_avg_8_32x2_c: 954.6
vvc_avg_8_32x2_avx2: 32.1
vvc_avg_8_32x4_c: 2359.6
vvc_avg_8_32x4_avx2: 39.6
vvc_avg_8_32x8_c: 5703.6
vvc_avg_8_32x8_avx2: 57.1
vvc_avg_8_32x16_c: 9967.6
vvc_avg_8_32x16_avx2: 107.1
vvc_avg_8_32x32_c: 21327.6
vvc_avg_8_32x32_avx2: 272.6
vvc_avg_8_32x64_c: 39240.8
vvc_avg_8_32x64_avx2: 529.6
vvc_avg_8_32x128_c: 52580.8
vvc_avg_8_32x128_avx2: 1338.8
vvc_avg_8_64x2_c: 1647.3
vvc_avg_8_64x2_avx2: 38.8
vvc_avg_8_64x4_c: 5130.1
vvc_avg_8_64x4_avx2: 58.8
vvc_avg_8_64x8_c: 6529.3
vvc_avg_8_64x8_avx2: 88.3
vvc_avg_8_64x16_c: 19913.6
vvc_avg_8_64x16_avx2: 162.3
vvc_avg_8_64x32_c: 39360.8
vvc_avg_8_64x32_avx2: 295.8
vvc_avg_8_64x64_c: 49658.3
vvc_avg_8_64x64_avx2: 784.1
vvc_avg_8_64x128_c: 108513.1
vvc_avg_8_64x128_avx2: 1977.1
vvc_avg_8_128x2_c: 3226.1
vvc_avg_8_128x2_avx2: 61.1
vvc_avg_8_128x4_c: 10280.3
vvc_avg_8_128x4_avx2: 94.6
vvc_avg_8_128x8_c: 18079.3
vvc_avg_8_128x8_avx2: 155.3
vvc_avg_8_128x16_c: 45121.8
vvc_avg_8_128x16_avx2: 285.3
vvc_avg_8_128x32_c: 48651.8
vvc_avg_8_128x32_avx2: 581.6
vvc_avg_8_128x64_c: 165078.6
vvc_avg_8_128x64_avx2: 1942.8
vvc_avg_8_128x128_c: 339103.1
vvc_avg_8_128x128_avx2: 4332.6
vvc_avg_10_2x2_c: 144.3
vvc_avg_10_2x2_avx2: 26.8
vvc_avg_10_2x4_c: 142.6
vvc_avg_10_2x4_avx2: 45.3
vvc_avg_10_2x8_c: 478.1
vvc_avg_10_2x8_avx2: 38.1
vvc_avg_10_2x16_c: 518.3
vvc_avg_10_2x16_avx2: 58.1
vvc_avg_10_2x32_c: 2059.8
vvc_avg_10_2x32_avx2: 93.1
vvc_avg_10_2x64_c: 2383.8
vvc_avg_10_2x64_avx2: 714.8
vvc_avg_10_2x128_c: 4498.3
vvc_avg_10_2x128_avx2: 1466.3
vvc_avg_10_4x2_c: 228.6
vvc_avg_10_4x2_avx2: 26.8
vvc_avg_10_4x4_c: 378.3
vvc_avg_10_4x4_avx2: 30.6
vvc_avg_10_4x8_c: 866.8
vvc_avg_10_4x8_avx2: 44.6
vvc_avg_10_4x16_c: 1018.1
vvc_avg_10_4x16_avx2: 58.1
vvc_avg_10_4x32_c: 3590.8
vvc_avg_10_4x32_avx2: 128.8
vvc_avg_10_4x64_c: 4200.8
vvc_avg_10_4x64_avx2: 663.6
vvc_avg_10_4x128_c: 8450.8
vvc_avg_10_4x128_avx2: 1531.8
vvc_avg_10_8x2_c: 369.3
vvc_avg_10_8x2_avx2: 28.3
vvc_avg_10_8x4_c: 513.8
vvc_avg_10_8x4_avx2: 32.1
vvc_avg_10_8x8_c: 1720.3
vvc_avg_10_8x8_avx2: 49.1
vvc_avg_10_8x16_c: 1894.8
vvc_avg_10_8x16_avx2: 71.6
vvc_avg_10_8x32_c: 3931.3
vvc_avg_10_8x32_avx2: 148.1
vvc_avg_10_8x64_c: 7964.3
vvc_avg_10_8x64_avx2: 613.1
vvc_avg_10_8x128_c: 15540.1
vvc_avg_10_8x128_avx2: 1585.1
vvc_avg_10_16x2_c: 877.3
vvc_avg_10_16x2_avx2: 27.6
vvc_avg_10_16x4_c: 955.8
vvc_avg_10_16x4_avx2: 29.8
vvc_avg_10_16x8_c: 3419.6
vvc_avg_10_16x8_avx2: 62.6
vvc_avg_10_16x16_c: 3826.8
vvc_avg_10_16x16_avx2: 54.3
vvc_avg_10_16x32_c: 7655.3
vvc_avg_10_16x32_avx2: 86.3
vvc_avg_10_16x64_c: 30011.1
vvc_avg_10_16x64_avx2: 692.6
vvc_avg_10_16x128_c: 47894.8
vvc_avg_10_16x128_avx2: 1580.3
vvc_avg_10_32x2_c: 944.3
vvc_avg_10_32x2_avx2: 29.8
vvc_avg_10_32x4_c: 2022.6
vvc_avg_10_32x4_avx2: 35.1
vvc_avg_10_32x8_c: 6148.8
vvc_avg_10_32x8_avx2: 51.3
vvc_avg_10_32x16_c: 12601.6
vvc_avg_10_32x16_avx2: 70.8
vvc_avg_10_32x32_c: 15958.6
vvc_avg_10_32x32_avx2: 124.3
vvc_avg_10_32x64_c: 31784.6
vvc_avg_10_32x64_avx2: 757.3
vvc_avg_10_32x128_c: 63892.8
vvc_avg_10_32x128_avx2: 1711.3
vvc_avg_10_64x2_c: 1890.8
vvc_avg_10_64x2_avx2: 34.3
vvc_avg_10_64x4_c: 6267.3
vvc_avg_10_64x4_avx2: 42.6
vvc_avg_10_64x8_c: 12778.1
vvc_avg_10_64x8_avx2: 67.8
vvc_avg_10_64x16_c: 22304.3
vvc_avg_10_64x16_avx2: 116.8
vvc_avg_10_64x32_c: 30777.1
vvc_avg_10_64x32_avx2: 201.1
vvc_avg_10_64x64_c: 60169.1
vvc_avg_10_64x64_avx2: 1454.3
vvc_avg_10_64x128_c: 124392.8
vvc_avg_10_64x128_avx2: 3648.6
vvc_avg_10_128x2_c: 3650.1
vvc_avg_10_128x2_avx2: 41.1
vvc_avg_10_128x4_c: 22887.8
vvc_avg_10_128x4_avx2: 64.1
vvc_avg_10_128x8_c: 14622.6
vvc_avg_10_128x8_avx2: 111.6
vvc_avg_10_128x16_c: 62207.6
vvc_avg_10_128x16_avx2: 186.3
vvc_avg_10_128x32_c: 59761.3
vvc_avg_10_128x32_avx2: 374.6
vvc_avg_10_128x64_c: 117504.3
vvc_avg_10_128x64_avx2: 2684.6
vvc_avg_10_128x128_c: 236767.6
vvc_avg_10_128x128_avx2: 15278.1
vvc_avg_12_2x2_c: 78.6
vvc_avg_12_2x2_avx2: 26.1
vvc_avg_12_2x4_c: 254.1
vvc_avg_12_2x4_avx2: 30.6
vvc_avg_12_2x8_c: 261.8
vvc_avg_12_2x8_avx2: 39.1
vvc_avg_12_2x16_c: 527.6
vvc_avg_12_2x16_avx2: 57.3
vvc_avg_12_2x32_c: 1089.1
vvc_avg_12_2x32_avx2: 93.8
vvc_avg_12_2x64_c: 2337.6
vvc_avg_12_2x64_avx2: 707.1
vvc_avg_12_2x128_c: 4582.1
vvc_avg_12_2x128_avx2: 1414.6
vvc_avg_12_4x2_c: 129.6
vvc_avg_12_4x2_avx2: 26.8
vvc_avg_12_4x4_c: 427.3
vvc_avg_12_4x4_avx2: 30.6
vvc_avg_12_4x8_c: 529.6
vvc_avg_12_4x8_avx2: 36.6
vvc_avg_12_4x16_c: 1022.1
vvc_avg_12_4x16_avx2: 57.3
vvc_avg_12_4x32_c: 1987.6
vvc_avg_12_4x32_avx2: 84.3
vvc_avg_12_4x64_c: 4147.6
vvc_avg_12_4x64_avx2: 706.3
vvc_avg_12_4x128_c: 8469.3
vvc_avg_12_4x128_avx2: 1448.3
vvc_avg_12_8x2_c: 253.6
vvc_avg_12_8x2_avx2: 27.6
vvc_avg_12_8x4_c: 836.3
vvc_avg_12_8x4_avx2: 32.1
vvc_avg_12_8x8_c: 1074.6
vvc_avg_12_8x8_avx2: 45.1
vvc_avg_12_8x16_c: 3616.8
vvc_avg_12_8x16_avx2: 71.6
vvc_avg_12_8x32_c: 3823.6
vvc_avg_12_8x32_avx2: 140.1
vvc_avg_12_8x64_c: 7764.8
vvc_avg_12_8x64_avx2: 656.1
vvc_avg_12_8x128_c: 15896.1
vvc_avg_12_8x128_avx2: 1232.8
vvc_avg_12_16x2_c: 462.1
vvc_avg_12_16x2_avx2: 26.8
vvc_avg_12_16x4_c: 1732.1
vvc_avg_12_16x4_avx2: 29.1
vvc_avg_12_16x8_c: 2097.6
vvc_avg_12_16x8_avx2: 62.6
vvc_avg_12_16x16_c: 6753.1
vvc_avg_12_16x16_avx2: 47.8
vvc_avg_12_16x32_c: 7373.1
vvc_avg_12_16x32_avx2: 80.8
vvc_avg_12_16x64_c: 15046.3
vvc_avg_12_16x64_avx2: 621.1
vvc_avg_12_16x128_c: 52574.6
vvc_avg_12_16x128_avx2: 1417.1
vvc_avg_12_32x2_c: 1712.1
vvc_avg_12_32x2_avx2: 29.8
vvc_avg_12_32x4_c: 2036.8
vvc_avg_12_32x4_avx2: 37.6
vvc_avg_12_32x8_c: 4017.6
vvc_avg_12_32x8_avx2: 44.1
vvc_avg_12_32x16_c: 8018.6
vvc_avg_12_32x16_avx2: 70.8
vvc_avg_12_32x32_c: 15637.6
vvc_avg_12_32x32_avx2: 124.3
vvc_avg_12_32x64_c: 31143.3
vvc_avg_12_32x64_avx2: 830.3
vvc_avg_12_32x128_c: 75706.8
vvc_avg_12_32x128_avx2: 1604.8
vvc_avg_12_64x2_c: 3230.3
vvc_avg_12_64x2_avx2: 33.6
vvc_avg_12_64x4_c: 4139.6
vvc_avg_12_64x4_avx2: 45.1
vvc_avg_12_64x8_c: 8201.6
vvc_avg_12_64x8_avx2: 67.1
vvc_avg_12_64x16_c: 25632.3
vvc_avg_12_64x16_avx2: 110.3
vvc_avg_12_64x32_c: 30744.3
vvc_avg_12_64x32_avx2: 200.3
vvc_avg_12_64x64_c: 105554.8
vvc_avg_12_64x64_avx2: 1325.6
vvc_avg_12_64x128_c: 235254.3
vvc_avg_12_64x128_avx2: 3132.6
vvc_avg_12_128x2_c: 6194.3
vvc_avg_12_128x2_avx2: 55.1
vvc_avg_12_128x4_c: 7583.8
vvc_avg_12_128x4_avx2: 79.3
vvc_avg_12_128x8_c: 14635.6
vvc_avg_12_128x8_avx2: 104.3
vvc_avg_12_128x16_c: 29270.8
vvc_avg_12_128x16_avx2: 194.3
vvc_avg_12_128x32_c: 60113.6
vvc_avg_12_128x32_avx2: 346.3
vvc_avg_12_128x64_c: 197030.3
vvc_avg_12_128x64_avx2: 2779.6
vvc_avg_12_128x128_c: 432809.6
vvc_avg_12_128x128_avx2: 5513.3
vvc_w_avg_8_2x2_c: 84.3
vvc_w_avg_8_2x2_avx2: 42.6
vvc_w_avg_8_2x4_c: 156.3
vvc_w_avg_8_2x4_avx2: 58.8
vvc_w_avg_8_2x8_c: 310.6
vvc_w_avg_8_2x8_avx2: 73.1
vvc_w_avg_8_2x16_c: 942.1
vvc_w_avg_8_2x16_avx2: 113.3
vvc_w_avg_8_2x32_c: 1098.8
vvc_w_avg_8_2x32_avx2: 202.6
vvc_w_avg_8_2x64_c: 2414.3
vvc_w_avg_8_2x64_avx2: 467.6
vvc_w_avg_8_2x128_c: 4763.8
vvc_w_avg_8_2x128_avx2: 1333.1
vvc_w_avg_8_4x2_c: 140.1
vvc_w_avg_8_4x2_avx2: 49.8
vvc_w_avg_8_4x4_c: 276.3
vvc_w_avg_8_4x4_avx2: 58.1
vvc_w_avg_8_4x8_c: 524.3
vvc_w_avg_8_4x8_avx2: 72.3
vvc_w_avg_8_4x16_c: 1108.1
vvc_w_avg_8_4x16_avx2: 111.8
vvc_w_avg_8_4x32_c: 2149.8
vvc_w_avg_8_4x32_avx2: 199.6
vvc_w_avg_8_4x64_c: 12288.1
vvc_w_avg_8_4x64_avx2: 509.3
vvc_w_avg_8_4x128_c: 8398.6
vvc_w_avg_8_4x128_avx2: 1319.6
vvc_w_avg_8_8x2_c: 271.1
vvc_w_avg_8_8x2_avx2: 44.1
vvc_w_avg_8_8x4_c: 503.3
vvc_w_avg_8_8x4_avx2: 61.8
vvc_w_avg_8_8x8_c: 1031.1
vvc_w_avg_8_8x8_avx2: 93.8
vvc_w_avg_8_8x16_c: 2009.8
vvc_w_avg_8_8x16_avx2: 163.1
vvc_w_avg_8_8x32_c: 4161.3
vvc_w_avg_8_8x32_avx2: 292.1
vvc_w_avg_8_8x64_c: 7940.6
vvc_w_avg_8_8x64_avx2: 592.1
vvc_w_avg_8_8x128_c: 16802.3
vvc_w_avg_8_8x128_avx2: 1287.6
vvc_w_avg_8_16x2_c: 762.6
vvc_w_avg_8_16x2_avx2: 53.6
vvc_w_avg_8_16x4_c: 1486.3
vvc_w_avg_8_16x4_avx2: 67.1
vvc_w_avg_8_16x8_c: 1907.8
vvc_w_avg_8_16x8_avx2: 96.8
vvc_w_avg_8_16x16_c: 3883.6
vvc_w_avg_8_16x16_avx2: 151.3
vvc_w_avg_8_16x32_c: 7974.8
vvc_w_avg_8_16x32_avx2: 285.8
vvc_w_avg_8_16x64_c: 25160.6
vvc_w_avg_8_16x64_avx2: 589.8
vvc_w_avg_8_16x128_c: 58328.1
vvc_w_avg_8_16x128_avx2: 1169.8
vvc_w_avg_8_32x2_c: 1009.1
vvc_w_avg_8_32x2_avx2: 65.6
vvc_w_avg_8_32x4_c: 2091.1
vvc_w_avg_8_32x4_avx2: 96.8
vvc_w_avg_8_32x8_c: 3997.8
vvc_w_avg_8_32x8_avx2: 156.3
vvc_w_avg_8_32x16_c: 8216.8
vvc_w_avg_8_32x16_avx2: 269.6
vvc_w_avg_8_32x32_c: 21746.1
vvc_w_avg_8_32x32_avx2: 635.3
vvc_w_avg_8_32x64_c: 31564.8
vvc_w_avg_8_32x64_avx2: 1010.6
vvc_w_avg_8_32x128_c: 114373.3
vvc_w_avg_8_32x128_avx2: 2013.6
vvc_w_avg_8_64x2_c: 2067.3
vvc_w_avg_8_64x2_avx2: 97.6
vvc_w_avg_8_64x4_c: 3901.1
vvc_w_avg_8_64x4_avx2: 154.8
vvc_w_avg_8_64x8_c: 7911.6
vvc_w_avg_8_64x8_avx2: 268.8
vvc_w_avg_8_64x16_c: 16508.8
vvc_w_avg_8_64x16_avx2: 501.8
vvc_w_avg_8_64x32_c: 38770.3
vvc_w_avg_8_64x32_avx2: 1287.6
vvc_w_avg_8_64x64_c: 110350.6
vvc_w_avg_8_64x64_avx2: 1890.8
vvc_w_avg_8_64x128_c: 141354.6
vvc_w_avg_8_64x128_avx2: 3839.6
vvc_w_avg_8_128x2_c: 7012.1
vvc_w_avg_8_128x2_avx2: 159.3
vvc_w_avg_8_128x4_c: 8146.8
vvc_w_avg_8_128x4_avx2: 272.6
vvc_w_avg_8_128x8_c: 24596.8
vvc_w_avg_8_128x8_avx2: 501.1
vvc_w_avg_8_128x16_c: 35918.1
vvc_w_avg_8_128x16_avx2: 948.8
vvc_w_avg_8_128x32_c: 68799.6
vvc_w_avg_8_128x32_avx2: 1963.1
vvc_w_avg_8_128x64_c: 133862.1
vvc_w_avg_8_128x64_avx2: 3833.6
vvc_w_avg_8_128x128_c: 348427.8
vvc_w_avg_8_128x128_avx2: 7682.8
vvc_w_avg_10_2x2_c: 118.6
vvc_w_avg_10_2x2_avx2: 73.1
vvc_w_avg_10_2x4_c: 189.1
vvc_w_avg_10_2x4_avx2: 89.3
vvc_w_avg_10_2x8_c: 382.8
vvc_w_avg_10_2x8_avx2: 179.8
vvc_w_avg_10_2x16_c: 658.3
vvc_w_avg_10_2x16_avx2: 185.1
vvc_w_avg_10_2x32_c: 1409.3
vvc_w_avg_10_2x32_avx2: 290.8
vvc_w_avg_10_2x64_c: 2906.8
vvc_w_avg_10_2x64_avx2: 793.1
vvc_w_avg_10_2x128_c: 6292.6
vvc_w_avg_10_2x128_avx2: 1696.8
vvc_w_avg_10_4x2_c: 178.8
vvc_w_avg_10_4x2_avx2: 80.1
vvc_w_avg_10_4x4_c: 581.6
vvc_w_avg_10_4x4_avx2: 97.6
vvc_w_avg_10_4x8_c: 693.3
vvc_w_avg_10_4x8_avx2: 128.1
vvc_w_avg_10_4x16_c: 1436.6
vvc_w_avg_10_4x16_avx2: 179.8
vvc_w_avg_10_4x32_c: 2409.1
vvc_w_avg_10_4x32_avx2: 292.3
vvc_w_avg_10_4x64_c: 4925.3
vvc_w_avg_10_4x64_avx2: 746.1
vvc_w_avg_10_4x128_c: 10664.6
vvc_w_avg_10_4x128_avx2: 1647.6
vvc_w_avg_10_8x2_c: 359.3
vvc_w_avg_10_8x2_avx2: 80.1
vvc_w_avg_10_8x4_c: 925.6
vvc_w_avg_10_8x4_avx2: 97.6
vvc_w_avg_10_8x8_c: 1360.6
vvc_w_avg_10_8x8_avx2: 121.8
vvc_w_avg_10_8x16_c: 3490.3
vvc_w_avg_10_8x16_avx2: 203.3
vvc_w_avg_10_8x32_c: 5266.1
vvc_w_avg_10_8x32_avx2: 325.8
vvc_w_avg_10_8x64_c: 11127.1
vvc_w_avg_10_8x64_avx2: 747.8
vvc_w_avg_10_8x128_c: 31058.3
vvc_w_avg_10_8x128_avx2: 1424.6
vvc_w_avg_10_16x2_c: 624.8
vvc_w_avg_10_16x2_avx2: 84.6
vvc_w_avg_10_16x4_c: 1389.6
vvc_w_avg_10_16x4_avx2: 109.1
vvc_w_avg_10_16x8_c: 2688.3
vvc_w_avg_10_16x8_avx2: 137.1
vvc_w_avg_10_16x16_c: 5387.1
vvc_w_avg_10_16x16_avx2: 224.6
vvc_w_avg_10_16x32_c: 10776.3
vvc_w_avg_10_16x32_avx2: 312.1
vvc_w_avg_10_16x64_c: 18069.1
vvc_w_avg_10_16x64_avx2: 858.6
vvc_w_avg_10_16x128_c: 43460.3
vvc_w_avg_10_16x128_avx2: 1411.6
vvc_w_avg_10_32x2_c: 1232.8
vvc_w_avg_10_32x2_avx2: 99.1
vvc_w_avg_10_32x4_c: 4017.6
vvc_w_avg_10_32x4_avx2: 134.1
vvc_w_avg_10_32x8_c: 9306.3
vvc_w_avg_10_32x8_avx2: 208.1
vvc_w_avg_10_32x16_c: 8424.6
vvc_w_avg_10_32x16_avx2: 349.3
vvc_w_avg_10_32x32_c: 20787.8
vvc_w_avg_10_32x32_avx2: 655.3
vvc_w_avg_10_32x64_c: 40972.1
vvc_w_avg_10_32x64_avx2: 904.8
vvc_w_avg_10_32x128_c: 85670.3
vvc_w_avg_10_32x128_avx2: 1751.6
vvc_w_avg_10_64x2_c: 2454.1
vvc_w_avg_10_64x2_avx2: 132.6
vvc_w_avg_10_64x4_c: 5012.6
vvc_w_avg_10_64x4_avx2: 215.6
vvc_w_avg_10_64x8_c: 10811.3
vvc_w_avg_10_64x8_avx2: 361.1
vvc_w_avg_10_64x16_c: 33349.1
vvc_w_avg_10_64x16_avx2: 904.1
vvc_w_avg_10_64x32_c: 41892.3
vvc_w_avg_10_64x32_avx2: 1220.6
vvc_w_avg_10_64x64_c: 66983.3
vvc_w_avg_10_64x64_avx2: 2622.1
vvc_w_avg_10_64x128_c: 246508.8
vvc_w_avg_10_64x128_avx2: 3316.8
vvc_w_avg_10_128x2_c: 7791.6
vvc_w_avg_10_128x2_avx2: 198.8
vvc_w_avg_10_128x4_c: 10534.3
vvc_w_avg_10_128x4_avx2: 337.3
vvc_w_avg_10_128x8_c: 21142.3
vvc_w_avg_10_128x8_avx2: 614.8
vvc_w_avg_10_128x16_c: 40968.6
vvc_w_avg_10_128x16_avx2: 1160.6
vvc_w_avg_10_128x32_c: 113043.3
vvc_w_avg_10_128x32_avx2: 1644.6
vvc_w_avg_10_128x64_c: 230658.3
vvc_w_avg_10_128x64_avx2: 5065.3
vvc_w_avg_10_128x128_c: 335236.3
vvc_w_avg_10_128x128_avx2: 6450.3
vvc_w_avg_12_2x2_c: 185.3
vvc_w_avg_12_2x2_avx2: 43.6
vvc_w_avg_12_2x4_c: 340.3
vvc_w_avg_12_2x4_avx2: 55.8
vvc_w_avg_12_2x8_c: 632.3
vvc_w_avg_12_2x8_avx2: 70.1
vvc_w_avg_12_2x16_c: 728.3
vvc_w_avg_12_2x16_avx2: 108.1
vvc_w_avg_12_2x32_c: 1392.6
vvc_w_avg_12_2x32_avx2: 176.8
vvc_w_avg_12_2x64_c: 2618.3
vvc_w_avg_12_2x64_avx2: 757.3
vvc_w_avg_12_2x128_c: 6408.8
vvc_w_avg_12_2x128_avx2: 1435.1
vvc_w_avg_12_4x2_c: 349.3
vvc_w_avg_12_4x2_avx2: 44.3
vvc_w_avg_12_4x4_c: 607.1
vvc_w_avg_12_4x4_avx2: 52.6
vvc_w_avg_12_4x8_c: 1134.8
vvc_w_avg_12_4x8_avx2: 70.1
vvc_w_avg_12_4x16_c: 1378.1
vvc_w_avg_12_4x16_avx2: 115.3
vvc_w_avg_12_4x32_c: 2599.3
vvc_w_avg_12_4x32_avx2: 174.3
vvc_w_avg_12_4x64_c: 4474.8
vvc_w_avg_12_4x64_avx2: 656.1
vvc_w_avg_12_4x128_c: 11319.6
vvc_w_avg_12_4x128_avx2: 1373.1
vvc_w_avg_12_8x2_c: 595.8
vvc_w_avg_12_8x2_avx2: 44.3
vvc_w_avg_12_8x4_c: 1164.3
vvc_w_avg_12_8x4_avx2: 56.6
vvc_w_avg_12_8x8_c: 2019.6
vvc_w_avg_12_8x8_avx2: 80.1
vvc_w_avg_12_8x16_c: 4071.6
vvc_w_avg_12_8x16_avx2: 139.3
vvc_w_avg_12_8x32_c: 4485.1
vvc_w_avg_12_8x32_avx2: 250.6
vvc_w_avg_12_8x64_c: 8404.8
vvc_w_avg_12_8x64_avx2: 735.8
vvc_w_avg_12_8x128_c: 35679.8
vvc_w_avg_12_8x128_avx2: 1252.6
vvc_w_avg_12_16x2_c: 1114.8
vvc_w_avg_12_16x2_avx2: 46.6
vvc_w_avg_12_16x4_c: 2240.1
vvc_w_avg_12_16x4_avx2: 62.6
vvc_w_avg_12_16x8_c: 13174.6
vvc_w_avg_12_16x8_avx2: 88.6
vvc_w_avg_12_16x16_c: 5334.6
vvc_w_avg_12_16x16_avx2: 144.3
vvc_w_avg_12_16x32_c: 8378.1
vvc_w_avg_12_16x32_avx2: 234.6
vvc_w_avg_12_16x64_c: 21300.8
vvc_w_avg_12_16x64_avx2: 761.8
vvc_w_avg_12_16x128_c: 32786.8
vvc_w_avg_12_16x128_avx2: 1432.8
vvc_w_avg_12_32x2_c: 2154.3
vvc_w_avg_12_32x2_avx2: 61.1
vvc_w_avg_12_32x4_c: 4299.8
vvc_w_avg_12_32x4_avx2: 83.1
vvc_w_avg_12_32x8_c: 7964.8
vvc_w_avg_12_32x8_avx2: 132.6
vvc_w_avg_12_32x16_c: 13321.6
vvc_w_avg_12_32x16_avx2: 234.6
vvc_w_avg_12_32x32_c: 21149.3
vvc_w_avg_12_32x32_avx2: 433.3
vvc_w_avg_12_32x64_c: 43666.6
vvc_w_avg_12_32x64_avx2: 876.6
vvc_w_avg_12_32x128_c: 83189.8
vvc_w_avg_12_32x128_avx2: 1756.6
vvc_w_avg_12_64x2_c: 3829.8
vvc_w_avg_12_64x2_avx2: 83.1
vvc_w_avg_12_64x4_c: 8588.1
vvc_w_avg_12_64x4_avx2: 127.1
vvc_w_avg_12_64x8_c: 17027.6
vvc_w_avg_12_64x8_avx2: 310.6
vvc_w_avg_12_64x16_c: 29797.8
vvc_w_avg_12_64x16_avx2: 415.6
vvc_w_avg_12_64x32_c: 43854.3
vvc_w_avg_12_64x32_avx2: 773.3
vvc_w_avg_12_64x64_c: 137767.3
vvc_w_avg_12_64x64_avx2: 1608.6
vvc_w_avg_12_64x128_c: 316428.3
vvc_w_avg_12_64x128_avx2: 3249.8
vvc_w_avg_12_128x2_c: 8824.6
vvc_w_avg_12_128x2_avx2: 130.3
vvc_w_avg_12_128x4_c: 17173.6
vvc_w_avg_12_128x4_avx2: 219.3
vvc_w_avg_12_128x8_c: 21997.8
vvc_w_avg_12_128x8_avx2: 397.3
vvc_w_avg_12_128x16_c: 43553.8
vvc_w_avg_12_128x16_avx2: 790.1
vvc_w_avg_12_128x32_c: 89792.1
vvc_w_avg_12_128x32_avx2: 1497.6
vvc_w_avg_12_128x64_c: 226573.3
vvc_w_avg_12_128x64_avx2: 3153.1
vvc_w_avg_12_128x128_c: 332090.1
vvc_w_avg_12_128x128_avx2: 6499.6

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-02-01 19:54:29 +08:00
Wu Jianhua fb26c7bfd4 tests/checkasm: add checkasm_check_vvc_mc
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-02-01 19:54:29 +08:00
Wu Jianhua 70889620f2 avcodec/vvcdec: reuse h26x/2656_inter.asm to enable x86 optimizations
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-02-01 19:54:28 +08:00
Wu Jianhua fc5ff6b0b8 avcodec/x86/h26x/h2656_inter: add dststride to put
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-02-01 19:54:28 +08:00
Wu Jianhua 7d9f1f5485 avcodec/x86/hevc_mc: move put/put_uni to h26x/h2656_inter.asm
This enable that the asm optimization can be reused by VVC

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-02-01 19:54:28 +08:00
Wu Jianhua 04c2e246a3 avcodec/hevcdsp_template: reuse put/put_luma/put_chroma from h2656_inter_template
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-02-01 19:54:28 +08:00
Wu Jianhua 639b1820ce avcodec/vvc/vvc_inter_template: move put/put_luma/put_chroma template to h2656_inter_template.c
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-02-01 19:54:28 +08:00
Gyan Doshi 94422871fc avfilter/buffersrc: limit link variance logs below debug loglevel
The video param change check will print loglines below debug level
for each frame which is different from the inlink parameters. This
can spam the console. It is now printed at warning level once for
each param change else it is kept at debug level.

Partially addresses #10823
2024-02-01 16:36:18 +05:30
James Almer fa469545ba avcodec: move leb reading functions to its own header
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-31 11:19:16 -03:00
Thomas Siedel db6e360afb avformat/mpegts: add ts stream types for H266/VVC
Add transport stream stream type 0x33 for vvc.
Add STREAM_TYPE_VIDEO_VVC to MPEG-1/2 and MPEG-2 transport stream.
Add basic transport stream support for TS mux/demux.

Tested with:
ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v libvvenc test.ts && ffmpeg -i test.ts -f null -
ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v copy test.ts     && ffmpeg -i test.ts -f md5 -

Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Thomas Siedel <thomas.ff@spin-digital.com>
Co-Authored-By: Nuo Mi <nuomi2021@gmail.com>
2024-01-31 22:14:12 +08:00
Nuo Mi 11a57685cd avformat/mpegtsenc: refact out h26x_prefix_aud
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-01-31 22:14:12 +08:00
Nuo Mi 627dbc4e00 avformat/mpegtsenc: refact, remove h264, hevc magic numbers for nal_type 2024-01-31 22:14:12 +08:00
Nuo Mi d2c4f72016 avformat/mpegtsenc: refact, move h264, hevc startcode checking to check_h26x_startcode 2024-01-31 22:14:12 +08:00
Nuo Mi 8559cce3c3 avformat/mpegtsenc: refact mpegts_check_bitstream to loop up table
Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-31 22:14:12 +08:00
Thomas Siedel aa3155e4c2 avformat/mp4: add muxer support for H266/VVC
Add muxer for vvcc byte stream format.
Add AV_CODEC_ID_VVC to ff_mp4_obj_type.
Add AV_CODEC_ID_VVC to ISO Media codec (VvcConfigurationBox vvi1,
vvc1 defined in ISO/IEC 14496-15:2021).
Add VvcConfigurationBox vvcC which extends FullBox type in
ISO/IEC 14496-15:2021.

Tested with:
    ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v libvvenc test.mp4 && ffmpeg -i test.mp4 -f null -
    ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v copy test.mp4     && ffmpeg -i test.mp4 -f md5 -

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Thomas Siedel <thomas.ff@spin-digital.com>
Co-Authored-By: Nuo Mi <nuomi2021@gmail.com>
2024-01-31 22:14:12 +08:00
Lynne 5860a966d2
lavfi/vsrc_testsrc_vulkan: fix -Wint-conversion
While VK_NULL_HANDLE is equivalent to NULL on 64-bit platforms, the same is not
true across all platforms.

Fixes building with gcc-14.
2024-01-31 14:26:26 +01:00
James Almer 9949c1dd78 avformat/avformat: fix group index range check in match_stream_specifier()
Fixes segfaults when trying to map a group index with a value equal to the
amount of groups in the file.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-30 17:23:20 -03:00
Andreas Rheinhardt 7252e4f8ee avcodec/aac_defines: Remove unused AAC_RENAME_32
Unused since fbe6a51b11.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-30 20:43:48 +01:00
Frank Plowman 36a986d9a1 lavc/vvc: Add check to num_multi_layer_olss
Check that vps_each_layer_is_an_ols_flag, which indicates that "at
least one OLS specified by the VPS contains more than one layer," is
set if num_multi_layer_olss is non-zero.

Fixes: 65160/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_METADATA_fuzzer-4665241535119360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-30 09:24:03 -03:00
Zhao Zhili bc944168db avcodec/mpeg4videodec: Remove write-only variable
Fix warning: variable 'time_incr' set but not used.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-30 18:25:52 +08:00
Anton Khirnov 093be1fb06 fftools/ffmpeg: cosmetics, vertically align Input{File,Stream} 2024-01-30 09:52:00 +01:00
Anton Khirnov f4b76a1d6a fftools/ffmpeg: make InputStream.decoder_opts private to demuxer
It is no longer used outside of ffmpeg_demux.
2024-01-30 09:52:00 +01:00
Anton Khirnov 01c71b78eb fftools/ffmpeg: make InputStream.decoding_needed private to demuxer
It is no longer used outside of ffmpeg_demux.
2024-01-30 09:52:00 +01:00
Anton Khirnov 0d00e2e2f7 fftools/ffmpeg_dec: eliminate all remaining InputStream uses
Previously, the demuxer would register decoder with the scheduler, using
InputStream as opaque, and pass the scheduling index to the decoder.

Now the registration is done by the decoder itself, using DecoderPriv as
opaque, and the scheduling index is returned to demuxer from dec_open().

decoder_thread() then no longer needs to be accessed from outside of
ffmpeg_dec and can be made static.
2024-01-30 09:52:00 +01:00
Anton Khirnov fe3be6f78f fftools/ffmpeg_dec: stop passing InputStream to dec_open() 2024-01-30 09:52:00 +01:00
Anton Khirnov a0ca99ccb7 fftools/ffmpeg_dec: remove unnecessary InputStream arguments 2024-01-30 09:52:00 +01:00
Anton Khirnov 1b2c539a0f fftools/ffmpeg_dec: pass AVCodecParameters through DecoderOpts
Do not retrieve it from InputStream directly.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov b3d1916ba0 fftools/ffmpeg_dec: pass AVCodec through DecoderOpts
Do not retrieve it from InputStream directly.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov d5f9ef766b fftools/ffmpeg_dec: eliminate InputStream use in hw_device_setup_for_decode()
The same information can also be obtained from the decoder itself.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov 097f9ddbe9 fftools/ffmpeg_dec: pass decoder name through DecoderOpts
Do not build it from InputStream values.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov 9ba4bc87e6 fftools/ffmpeg_dec: pass top_field_first through DecoderOpts
Do not read it from InputStream directly.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov 9702817662 fftools/ffmpeg_dec: pass input timebase through DecoderOpts
Do not read it from AVStream directly.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov b27de18e4f fftools/ffmpeg_dec: move setting compute_edt to demuxer
It is done based on demuxer information, so that is the more appropriate
place for this code.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov 052c83e356 fftools/ffmpeg_dec: pass forced/estimated framerate though DecoderOpts
Stop reading them from InputStream.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov e0a6cb07b2 fftools/ffmpeg_dec: move flags to DecoderOpts
Will be useful in the following commit.
2024-01-30 09:52:00 +01:00
Anton Khirnov 4bdffec814 fftools/ffmpeg_dec: pass hwaccel options to the decoder in a separate struct
Stop reading them from InputStream.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov a3a9c4ae66 fftools/ffmpeg: move hwaccel_retrieve_data() from ffmpeg_hw to ffmpeg_dec
This function is decoding-only and has no interaction with the rest of
ffmpeg_hw. It thus belongs more properly in ffmpeg_dec.
2024-01-30 09:52:00 +01:00
Anton Khirnov ebb8a58c8f fftools/ffmpeg_dec: replace InputFile.format_nots with a decoder flag
Reduces the need to access InputFile from decoding.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov a938f47916 fftools/ffmpeg: refactor disabling decoder threading for attached pictures
* as this decision is based on demuxing information, move it from the
  decoder to the demuxer
* as the issue being addressed is latency added by frame threading, we
  only need to disable frame threading, not all threading
2024-01-30 09:52:00 +01:00
Anton Khirnov 474ca6c71e fftools/ffmpeg_dec: stop accesing InputStream.fix_sub_duration
Pass this information to dec_open() instead.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov 924a6f3cc7 fftools/ffmpeg_dec: override video SAR with AVCodecParameters value
Rather than access the AVStream one.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov b2a0a2e6f5 fftools/ffmpeg: move decoder existence check to a more appropriate place 2024-01-30 09:52:00 +01:00
Anton Khirnov 217b8757db fftools/ffmpeg_dec: drop a useless log message 2024-01-30 09:52:00 +01:00
Anton Khirnov 27de2aacd1 fftools/ffmpeg_dec: drop useless and racy code
Setting demuxer's video_delay from the decoder cannot accomplish
anything meaningful and is racy, as they run in different threads.
2024-01-30 09:52:00 +01:00
Anton Khirnov 9be3f80527 fftools/ffmpeg_dec: move decoding counters from InputStream to Decoder
This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov 5b0e4f945e fftools/ffmpeg_dec: pass decoder options as an argument to dec_open()
Rather than access the dictionary in InputStream.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov 7ecd45587f fftools/ffmpeg_dec: add an AVClass to Decoder
Log decoder messages to the decoder rather than InputStream.

This is a step towards decoupling Decoder and InputStream.
2024-01-30 09:52:00 +01:00
Anton Khirnov f2a2094c47 fftools/ffmpeg: make decoding AVCodecContext private to the decoder 2024-01-30 09:52:00 +01:00
Anton Khirnov d47bb91f8b fftools/ffmpeg_filter: consolidate decoder/filter type checks
Also perform them earlier.
2024-01-30 09:52:00 +01:00
Anton Khirnov b43d4a0692 fftools/ffmpeg_dec: export subtitle_header in Decoder
This way the encoder does not need to access the decoder AVCodecContext,
which will allow to make it private in future commits.
2024-01-30 09:52:00 +01:00
Anton Khirnov 3b84140a1b fftools/ffmpeg_dec: split Decoder into a private and public part
Similar to what is currently done for other components, e.g. (de)muxers.
There is nothing in the public part currently, but that will change in
future commits.
2024-01-30 09:51:57 +01:00
Anton Khirnov 0291b6f824 lavfi/vsrc_ddagrab: add an option to avoid duplicating frames
Tested-by: Jiří Eliášek, Misha Aizatulin
2024-01-30 09:32:39 +01:00
James Almer 66f028accb avcodec/cbs_h266: fix logic setting num_layers_in_ols when vps_ols_mode_idc is 2
The old code did not follow the syntax from the spec.

Reviewed-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-29 20:45:31 -03:00
Frank Plowman 85e031d5bf lavc/vvc: Increase IntraEdgeParams buffer size
The reference line buffers are used with indices in the range
-MAX_TB_SIZE - 3 to refw + FFMAX(1, w/h) * ref_idx + 1, which is
at most 5*MAX_TB_SIZE + 1.

Fixes buffer overflows.
http://fate.ffmpeg.org/report.cgi?slot=armv7-linux-gcc-9&time=20240124051736

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-29 20:29:57 -03:00
Anton Khirnov 887a7817b6 lavc: move bitstream filters into bsf/ subdir 2024-01-29 18:40:14 +01:00
Anton Khirnov e0da916b8f fftools/ffmpeg: optimize inter-thread queue sizes
Use 8 packets/frames by default rather than 1, which seems to provide
better throughput.

Allow -thread_queue_size to set the muxer queue size manually again.
2024-01-28 13:34:56 +01:00
Andreas Rheinhardt 341d0419e1 avcodec/texturedsp: Factor common code out
Namely calling avctx->execute2(avctx,...).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-28 11:00:01 +01:00
Andreas Rheinhardt 4f58372c10 avcodec/hap: Avoid unnecessary opt.h inclusion
It presumably exists because HapContext contains an AVClass*.
Yet AVClass is actually defined in log.h and even this inclusion
can be avoided by struct AVClass*. This avoids opt.h inclusions
in hap.c and hapdec.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-28 10:59:36 +01:00
Andreas Rheinhardt a3fc9fb9fb avcodec/texturedsp: Add separate TextureDSPEncContext
ff_texturedspenc_init() doesn't support most of the function types
supported for decoding; add a separate context containing only pointers
for the actually supported types.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-28 10:52:48 +01:00
Andreas Rheinhardt 8f791304f2 avcodec/dxvenc, hap(dec|enc): Move TextureDSPContext to stack
Only used during init.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-28 10:52:41 +01:00
Andreas Rheinhardt e1d1304b4b avcodec/texturedspenc: Remove unused rgtc1_u_alpha encoding func
Effectively reverts 50a20de6b9.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-28 10:52:38 +01:00
Andreas Rheinhardt 916f016741 avcodec/dxvenc: Fix data races with slice threading
The old code set a common struct from each thread;
this only "worked" (but is still UB) because the values
written are the same for each thread.
Fix this by moving the assignments to the main thread.

(This also avoids casting const away from a const AVFrame*.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-28 10:52:24 +01:00
Andreas Rheinhardt 555879ca7c avcodec/dxvenc: Don't cast const away
Reviewed-by: Connor Worley <connorbworley@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-28 10:52:11 +01:00
Wenbin Chen d52e8ed114 libavfilter/vf_dnn_detect: Use class confidence to filt boxes
Use class confidence instead of box_score to filt boxes, which is more
accurate. Class confidence is obtained by multiplying class probability
distribution and box_score.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-01-28 11:18:13 +08:00
Wenbin Chen 3de38b9da5 libavfilter/dnn_interface: use dims to represent shapes
For detect and classify output, width and height make no sence, so
change width, height to dims to represent the shape of tensor. Use
layout and dims to get width, height and channel.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-01-28 11:18:06 +08:00
Wenbin Chen c695de56b5 libavfilter/dnn_bakcend_openvino: Add automatic input/output detection
Now when using openvino backend, user doesn't need to set input/output
names in command line. Model ports will be automatically detected.

For example:
ffmpeg -i input.png -vf \
dnn_detect=dnn_backend=openvino:model=model.xml:input=image:\
output=detection_out -y output.png

can be simplified to:
ffmpeg -i input.png -vf dnn_detect=dnn_backend=openvino:model=model.xml\
 -y output.png

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-01-28 11:17:59 +08:00
Frank Plowman 0c517fcbe8 lavc/vvc: Fix emulation prevention byte handling
nal->skipped_bytes_pos contains the positions of errors relative to the
start of the slice header, whereas the position they were tested against
is relative to the start of the slice data, i.e. one byte after the end
of the slice header.

Patch fixes this by storing the size of the slice header in H266RawSlice
and adding it to the position given by the GetBitContext before
comparing to skipped_bytes_pos.  This fixes AVERROR_INVALIDDATAs for
various valid bitstreams, such as the LMCS_B_Dolby_2 conformance
bitstream.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-01-27 11:29:40 -03:00
Anton Khirnov bab7f91c36 tests/fate/ffmpeg: add a test for the issue fixed in previous commit 2024-01-27 09:24:29 +01:00
Anton Khirnov 1ea2e757f7 fftools/ffmpeg_filter: do not end filtering when a graph input EOFs
There may be other inputs or sources in the filtergraph. Propagate the
EOF to the scheduler and continue filtering.

Fixes #10803
2024-01-27 09:24:29 +01:00
Anton Khirnov 00013341df fftools/ffmpeg_sched: add filter API to signal EOF on input 2024-01-27 09:24:29 +01:00
James Almer eb4584f994 avcodec/vvc_ps: remove duplicated enum
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-26 19:20:48 -03:00
Frank Plowman 763e31a8d3 lavc/vvc: Clamp shift RHS
Resolves the following undefined behavior sanitiser error:
runtime error: shift exponent 32 is too large for 32-bit type 'int'

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-26 15:47:41 -03:00
Frank Plowman cb7b4ee024 lavc/vvc: Use av_log2 when destination is integer
Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-26 15:47:41 -03:00
Tong Wu 8c99a1429a avcodec/d3d12va_mpeg2|vc1: remove the unused macros
These macros are no longer used. Remove them.

Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-26 09:22:12 +08:00
Tong Wu 8b41e9cfbe avcodec/d3d12va_decode: check existance before assigning a new index
Fixes #10759.

It can happen in H.264, MPEG2, VC1 that the current frame resource
memory is already in ref_resource. For example, for a interlaced frame,
the same curr memory is passed twice. For the second time it could possibly
reference itself. When this happens the curr is already given an index and
in ref_resources. When the reference frame index is required, we should check
the existance in the ref_resources first before assigning a new index for it.

Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-26 09:22:12 +08:00
Leo Izen ac06190a5a
avcodec/libjxl.h: include version.h
This file has been exported since our minimum required version (0.7.0),
but it wasn't documented. Instead it was transitively included by
<jxl/decode.h> (but not jxl/encode.h), which ffmpeg relied on.

libjxl broke its API in libjxl/libjxl@66b9592393 by removing
the transitive include of version.h, and they do not plan on adding
it back. Instead they are choosing to leave the API backwards-
incompatible with downstream callers written for some fairly recent
versions of their API.

As a result, we include <jxl/version.h> to continue to build against
more recent versions of libjxl. The version macros removed are also
present in that file, so we no longer need to redefine them.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-01-25 11:07:28 -05:00
Leo Izen 9d4eda8040
avformat/mxfenc: remove unused variables
Produces a -Wunused-variables warning with -Wall.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-01-25 11:06:55 -05:00
James Almer 00b288da73 fate/matroska: add missing speex decoder dependency to fate-matroska-ms-mode
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-24 20:55:54 -03:00
James Almer 45a2f2635d avcodec/d3d12va: remove unused variables
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-24 17:34:28 -03:00
James Almer 49a7fe86fe avcodec/d3d12va_vc1: cast mapped_data to void* before passing it to mapped_data()
Fixes -Wincompatible-pointer-types warnings.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-24 17:28:05 -03:00
James Almer 9aa388e758 avcodec/d3d12va_hevc: cast mapped_data to void* before passing it to mapped_data()
Fixes -Wincompatible-pointer-types warnings.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-24 17:28:05 -03:00
James Almer 342cc1792f avcodec/d3d12va_h264: cast mapped_data to void* before passing it to mapped_data()
Fixes -Wincompatible-pointer-types warnings.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-24 17:28:04 -03:00
James Almer 04332ca35e avcodec/d3d12va_vp9.c: change the type for the ID3D12Resource_Map mapped_data argument
Fixes -Wincompatible-pointer-types warnings.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-24 17:27:58 -03:00
James Almer b4d871fdc8 avcodec/d3d12va_av1.c: change the type for the ID3D12Resource_Map mapped_data argument
Fixes -Wincompatible-pointer-types warnings.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-24 17:27:40 -03:00
James Almer cb6a488fba avcodec/vvc_mvs: remove an unnecessary AV_ZERO64() call
Should fix "member access within misaligned address 0xf00 for type 'const union
av_alias64', which requires 8 byte alignment" errors as reported by GCC ubsan.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-24 12:41:01 -03:00
James Almer bc1d8a9b76 avcodec/vvc_mvs: align local motion vector fields
Should fix "member access within misaligned address 0xf00 for type 'const union
av_alias64', which requires 8 byte alignment" errors as reported by GCC ubsan.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-24 12:41:01 -03:00
Andreas Rheinhardt 3435565e26 avcodec/d3d12va_(av1|hevc|vp9): Don't use deprecated FF_PROFILE_*
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-24 15:49:12 +01:00
Andreas Rheinhardt 280df9d0eb avutil/hwcontext_d3d12va: Use av_image_copy() wrapper
Avoids casts all over the place; in this case, it also
replaces the unsafe cast uint8_t**->const uint8_t **
by the safe cast uint8_t**->const uint8_t * const*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-01-24 15:48:54 +01:00
James Almer 0b8e51b584 avformat/iamf_parse: use the public iamf helpers to allocate structs
Should fix memory leaks from non-freed fields due to missing AVClass
in the allocated structs.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-23 20:57:41 -03:00
Michael Niedermayer d6c62b4bce
tests/checkasm/aacencdsp: Use float_near_ulp_array() for abs_pow34() test
Fixes: ticket/10818
Approved-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-24 00:42:13 +01:00
Michael Niedermayer 88a9142cac
avformat/mxfenc: Remove AVERROR²
Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-24 00:42:13 +01:00
Stefano Sabatini 792c713504 doc/muxers: add MPEG-1/2 muxers section 2024-01-24 00:20:03 +01:00
Stefano Sabatini 02e4598f8f lavf/mpegenc: extend options definition 2024-01-24 00:09:21 +01:00
Stefano Sabatini 58d13d6377 doc/muxers: add dv 2024-01-24 00:09:21 +01:00
Stefano Sabatini f6f781625a doc/muxers/raw: drop duplicated whitespace 2024-01-24 00:09:21 +01:00
Stefano Sabatini 8bcea02f6c doc/muxers/raw: add dfpwm item 2024-01-24 00:09:21 +01:00
Stefano Sabatini 916373014e doc/muxers: add daud 2024-01-24 00:09:21 +01:00
Stefano Sabatini bba784d604 lavf/daudenc: clarify error messages 2024-01-24 00:09:21 +01:00
Stefano Sabatini 9c06dedad1 doc/muxers/dash: review documentation
Sort options by name, review formatting, apply consistency fixes and
fill the gaps (e.g. missing value for constants or flags), and review
and extend content.
2024-01-24 00:09:21 +01:00
Stefano Sabatini f8b14d8bee lavf/dashenc: sort options by name 2024-01-24 00:09:21 +01:00
James Almer eee3b7e2fb avformat/mov: zero initialize the index ranges buffer
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-23 18:39:52 -03:00
Connor Worley dfbbd11a4b lavc/dxvenc: add DXV encoder with support for DXT1 texture format
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2024-01-23 21:31:22 +01:00
James Almer 1496ce8f6b avcodec/vvc_ctu: align motion vector fields
Should fix "member access within misaligned address 0xf00 for type 'const union
av_alias64', which requires 8 byte alignment" errors as reported by GCC ubsan.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-23 17:24:15 -03:00
James Almer 67b5012cb1 fate: remove unused filtergraph files
They were added by mistake.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-23 13:49:41 -03:00
James Almer e8759580b1 fate/iamf: add an ambisonic test
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-23 13:35:28 -03:00
Frank Plowman 8157b5d405 lavc/vvc: Remove left shifts of negative values
VVC specifies << as arithmetic left shift, i.e. x << y is equivalent to
x * pow2(y).  C's << on the other hand has UB if x is negative.  This
patch removes all UB resulting from this, mostly by replacing x << y
with x * (1 << y), but there are also a couple places where the OOP was
changed instead.

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-23 11:17:05 -03:00
James Almer 2d712314ec fate: add VVC decoder tests
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-23 11:15:25 -03:00
James Almer 9813df77d6 avformat/iamf_writer: remove bogus check
Probably an artifact of a rebase, as this check is done below.

Fixes "Conditional jump or move depends on uninitialised value(s)" errors as
reported by Valgrind.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-23 10:14:10 -03:00
James Almer b6af126c72 avformat/iamfdec: free superfluous objects
The AVIAMFAudioElement and AVIAMFMixPresentation that are ultimately used
are allocated by ff_iamfdec_read_descriptors().

Fixes some memory leaks reported by Valgrind.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-23 09:58:47 -03:00
James Almer a47072d643 avutil/iamf: change the opt type for some options
AV_OPT_TYPE_INT64 should not be used for ints.
Should fix warnings about store to misaligned address for type 'int64_t'

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-22 21:57:55 -03:00
James Almer d2eb6f4d44 fftools/ffmpeg_mux_init: don't free the AVDictionaryEntry until after it's been used
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-22 13:46:57 -03:00
James Almer ab39cc36c7 avcodec/speexdec: fix setting frame_size from extradata
Finishes fixing vp5/potter512-400-partial.avi

The fate-matroska-ms-mode test ref is updated to reflect that the Speex decoder
can now read the stream.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-22 10:58:12 -03:00
James Almer cad35f0a77 avcodec/speexdec: relax the extradata check for the speex string
There could be bogus bytes at the start, as is the case of
vp5/potter512-400-partial.avi from the FATE suite, which could be a case of bad
remuxing from an OGG source.

Partially fixes decoding of vp5/potter512-400-partial.avi

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-22 10:58:12 -03:00
James Almer 0f4a72b22b fate: add raw IAMF tests
Covers muxing from raw pcm audio input into FLAC, using several scalable layouts,
and demuxing the result.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-22 10:58:12 -03:00
James Almer 04a37e238f fftools/ffmpeg_mux_init: remove whitespaces from input arguments when parsing stream groups
If the arguments are read from a file, things like line breaks could be present

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-22 10:58:12 -03:00
James Almer 6c4388b468 avformat/dump: be less verbose when printing streams within a group
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-20 09:21:46 -03:00
James Almer 9da0594f1d avformat/iamfenc: don't write empty packets
And return an error if they are not side data only packets.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-20 09:19:21 -03:00
Stefano Sabatini 3423a680bf doc/muxers/mov: add missing parameter for use_stream_ids_as_track_ids 2024-01-20 13:03:40 +01:00
Stefano Sabatini e36dbea389 doc/muxers/crc: apply consistency fixes 2024-01-20 12:56:57 +01:00
Stefano Sabatini fe1800b3fc doc/muxers: add codec2 2024-01-20 12:53:14 +01:00
Stefano Sabatini 0726709e6d doc/muxers/chromaprint: review and extend
In particular, apply formatting and consistency fixes and sort options
by name.
2024-01-20 12:53:14 +01:00
Stefano Sabatini 83413c8cd9 doc/muxers: add caf 2024-01-20 12:46:33 +01:00
Stefano Sabatini 252bb9c818 doc/muxers: add bit 2024-01-20 12:46:33 +01:00
Stefano Sabatini a57e3b8dcc doc/muxers: document avs3, expand AVS acronyms 2024-01-20 12:46:33 +01:00
Stefano Sabatini 5ec53db350 doc/muxers: add avm2 2024-01-20 12:46:33 +01:00
Stefano Sabatini f7b410fac2 doc/muxers: add avif 2024-01-20 12:46:33 +01:00
Stefano Sabatini 261fd5c841 doc/muxer: lowercase raw in raw PCM muxers section
Because this is not an acronym.
2024-01-20 12:46:33 +01:00
Haihao Xiang 6e4d85a94e doc/ffmpeg: update the documentation about vaapi device creation
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-01-20 12:46:33 +01:00
Haihao Xiang 6414ecd857 doc/ffmpeg: update the documentation about qsv device creation
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-01-20 12:46:33 +01:00
Anton Khirnov 344d3a7d45 fftools/ffmpeg_opt: improve wording in option descriptions 2024-01-20 10:37:32 +01:00
Anton Khirnov 9cb52927b9 fftools/cmdutils: surround option arguments by <> in help output
Makes it more clear that they are placeholders for actual values.
2024-01-20 10:37:32 +01:00
Anton Khirnov 0b95e71aa0 fftools/ffmpeg_opt: briefly mention stream specifier syntax in help output 2024-01-20 10:37:32 +01:00
Anton Khirnov 68af3e37cc fftools/cmdutils: indicate specifiers in option syntax in help output 2024-01-20 10:37:32 +01:00
Anton Khirnov 43323c3802 fftools/ffmpeg_opt: add more structure to long help output
Split the "Per-file main options" section into
* per-file input and output
* per-file input-only
* per-file output-only
* per-stream
2024-01-20 10:37:32 +01:00
Anton Khirnov 67529ad8a4 fftools/cmdutils: drop alt_flags parameter from show_help_options()
No user sets it to more than one flag, so it is redundant with
req_flags.
2024-01-20 10:37:32 +01:00
Anton Khirnov 03aedbdd40 fftools/cmdutils: add a flag for per-stream options
Not all OPT_SPEC options are per-stream, this will allow identifying
those that are, which will be useful in following commits.
2024-01-20 10:37:32 +01:00
Anton Khirnov d8173cfcaf fftools/cmdutils: hide some information listing options from basic help
They are for advanced usage only and should not clutter basic output.
2024-01-20 10:37:32 +01:00
Anton Khirnov 08bebeb1be Revert "all: Don't set AVClass.item_name to its default value"
Some callers assume that item_name is always set, so this may be
considered an API break.

This reverts commit 0c6203c97a.
2024-01-20 10:34:48 +01:00
Anton Khirnov a8bc79c3fd fftools/ffmpeg: deprecate -filter_script
It is equivalent to -/filter.
2024-01-20 10:23:24 +01:00
Anton Khirnov c316c4c77b fftools/ffmpeg: deprecate -filter_complex_script
It is equivalent to -/filter_complex.
2024-01-20 10:23:24 +01:00
Anton Khirnov 6d17991b7e fftools/cmdutils: add option syntax for loading arbitrary arguments from a file
Aligned with analogous feature for filter options in ffmpeg CLI.
2024-01-20 10:23:24 +01:00
Anton Khirnov 8aed3911fc fftools/ffmpeg: make attachment filenames dynamically allocated
Do not store the supplied arg pointer directly. While that is valid for
now, it will become ephemeral in the future commits.
2024-01-20 10:23:24 +01:00
Anton Khirnov fcddd233fe fftools/ffplay: make option strings dynamically allocated
Do not store the supplied arg pointer directly. While that is valid for
now, it will become ephemeral in the future commits.
2024-01-20 10:23:24 +01:00
Anton Khirnov 4ce1987abc fftools/ffprobe: make option strings dynamically allocated
Do not store the supplied arg pointer directly. While that is valid for
now, arg will become ephemeral in the future commits.
2024-01-20 10:23:24 +01:00
Anton Khirnov 568dfed06f fftools/ffmpeg_opt: mark -stream_group as expert option 2024-01-19 17:54:10 +01:00
Anton Khirnov ae06111d74 fftools/ffmpeg_demux: implement -bsf for input
Previously bitstream filters could only be applied right before muxing,
this allows to apply them right after demuxing.
2024-01-19 17:54:10 +01:00
Anton Khirnov 6cb7295abf fftools/ffmpeg_demux: add demuxing thread private data
To be used for data that never needs to be visible outside of the
demuxer thread, similarly as was previously done for other components.
2024-01-19 17:54:10 +01:00
Anton Khirnov 50448ca290 fftools/ffmpeg_demux: only allocate the decoder when actually decoding
It is not needed otherwise.
2024-01-19 17:54:10 +01:00
Anton Khirnov 2ee1c6ffb2 fftools/ffmpeg_demux: set options on codec parameters rather than decoder
This avoids the requirement to always have a decoder context.
2024-01-19 17:54:10 +01:00
Anton Khirnov 7e33534506 fftools/ffmpeg_demux: do not set bitexact directly on the decoder
Add it to decoder options instead, to be processed when opening the
decoder. This way it won't be overridden by flags the user might be
setting otherwise.
2024-01-19 17:54:10 +01:00
Anton Khirnov cdb65857c3 doc/ffmpeg: drop documentation for non-existent -sbsf 2024-01-19 17:54:10 +01:00
Anton Khirnov f8939bad1e fftools/ffmpeg_demux: replace abort() by av_assert0(0)
This is the standard way to mark unreachable cases in a switch
2024-01-19 17:54:10 +01:00
James Almer 0a5813fc68 avcodec/vvcdec: allocate and store structs on their own within the table list
Fixes "runtime error: member access within misaligned address 0xf00 for type
'struct bar', which requires # byte alignment" errors under GCC ubsan.

Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-19 08:53:32 -03:00
sunyuechi 8e23ebe6f9 lavc/svq1enc: R-V V ssd_int8_vs_int16
C908
ssd_int8_vs_int16_c: 207.7
ssd_int8_vs_int16_rvv_i32: 14.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-01-17 17:49:54 +02:00
Nuo Mi d595e0a0b6 avcodec/vvcdec: misc, constify hor_ctu_edge
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-17 10:14:50 -03:00
Nuo Mi 375dcf469e avcodec/vvcdec: deblock, fix uninitialized values
see https://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-valgrind&time=20240105201935
If tc is zero, the max_len_q, max_len_p are uninitialized.

Reported-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-17 10:14:35 -03:00
James Almer be4fcf027b avformat/mov: reset a log message as trace level
Accidentally changed in d9fed9df2a

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-15 22:17:50 -03:00
Paul Orlyk de8305e097
avformat/rtsp: Send mode=record instead of mode=receive in Transport header
Fixes server compatibility issues with rtspclientsink GStreamer plugin.

>From specification:
RFC 7826 "Real-Time Streaming Protocol Version 2.0" (https://datatracker.ietf.org/doc/html/rfc7826), section 18.54:
   mode: The mode parameter indicates the methods to be supported for
         this session.  The currently defined valid value is "PLAY".  If
         not provided, the default is "PLAY".  The "RECORD" value was
         defined in RFC 2326; in this specification, it is unspecified
         but reserved.  RECORD and other values may be specified in the
         future.
RFC 2326 "Real Time Streaming Protocol (RTSP)" (https://datatracker.ietf.org/doc/html/rfc2326), section 12.39:
   mode:
          The mode parameter indicates the methods to be supported for
          this session. Valid values are PLAY and RECORD. If not
          provided, the default is PLAY.

mode=receive was always like this, from the initial commit 'a8ad6ffa rtsp: Add listen mode'.

For comparison, Wowza was used to push RTSP stream to. Both GStreamer and FFmpeg had no issues.
Here is the capture of Wowza responding to SETUP request:
200 OK
CSeq: 3
Server: Wowza Streaming Engine 4.8.26+4 build20231212155517
Cache-Control: no-cache
Expires: Mon, 15 Jan 2024 19:40:31 GMT
Transport: RTP/AVP/UDP;unicast;client_port=11640-11641;mode=record;source=172.17.0.2;server_port=6976-6977
Date: Mon, 15 Jan 2024 19:40:31 GMT
Session: 1401457689;timeout=60

Test setup:
    Server: ffmpeg -loglevel trace -y -rtsp_flags listen -i rtsp://0.0.0.0:30800/live.stream t.mp4
    FFmpeg client: ffmpeg -re -i "Big Buck Bunny - FULL HD 30FPS.mp4" -c:v libx264 -f rtsp rtsp://127.0.0.1:30800/live.stream
    GStreamer client: gst-launch-1.0 videotestsrc is-live=true pattern=smpte ! queue ! videorate ! videoscale ! video/x-raw,width=640,height=360,framerate=60/1 ! timeoverlay font-desc="Sans, 84" halignment=center valignment=center ! queue ! videoconvert ! tee name=t t. ! x264enc bitrate=9000 pass=cbr speed-preset=ultrafast byte-stream=false key-int-max=15 threads=1 ! video/x-h264,profile=baseline ! queue ! rsink. audiotestsrc ! voaacenc ! queue ! rsink. t. ! queue ! autovideosink rtspclientsink name=rsink location=rtsp://localhost:30800/live.stream

Test results:
modified FFmpeg client -> stock server    : ok
stock FFmpeg client    -> modified server : ok
modified FFmpeg client -> modified server : ok
GStreamer client       -> modified server : ok

Signed-off-by: Paul Orlyk <paul.orlyk@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-16 01:34:58 +01:00
Paul Orlyk 57648ee091
avformat/rtsp: Support mode field of Transport header being sent in upper case
Fixes server compatibility issues with rtspclientsink GStreamer plugin

Signed-off-by: Paul Orlyk <paul.orlyk@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-16 01:34:57 +01:00
Jeffrey Knockel 0e20146db0
avutil/pixfmt: fix AV_PIX_FMT_RGB8 description
Previously AV_PIX_FMT_RGB8 was documented as "RGB 3:3:2,
(msb)2R 3G 3B(lsb)".  While the RGB 3:3:2 part is correct, the latter
part should be: (msb)3R 3G 2B(lsb).  This commit also updates the
format's pixdesc description to be (msb)3R 3G 2B(lsb).

Signed-off-by: Jeffrey Knockel <jeff@jeffreyknockel.com>
Reviewed-by: "Diederick C. Niehorster" <dcnieho@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-16 01:34:57 +01:00
Michael Niedermayer 278fea3664
avutil/eval: Use even better PRNG
This is the 64bit version of Chris Doty-Humphreys SFC64

Compared to the LCGs these produce much better quality numbers.
Compared to LFGs this needs less state. (our LFG has 224 byte
state for its 32bit version) this has 32byte state
Also the initialization for our LFG is slower.
This is also much faster than KISS or PCG.

This commit replaces the broken LCG used before.
(broken as it had only a period ~200M due to being put in a double)

This changes the output from random() which is why libswresample.mak
is updated, update was done using the command in libswresample.mak

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-16 01:34:57 +01:00
aybe aybe 36b402f80d
avcodec/mdec: DC reading for STRv1 is like STRv2
As I understand, support for .STR files is broken for almost 10 years now (since 161442ff2c it seems).

Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. Wipeout 1:
[mdec @ 00000000027c72c0] ac-tex damaged at 1 9

What happens is that only the audio is present in the video file.

Anyway, that one character patch fixes the problem, video is now rendered.

Signed-off-by: aybe <aybe@users.noreply.github.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-16 01:34:56 +01:00
Haixia Shi e664f4465a doc/utils: fix atan2 parameter order
The C library function double atan2(double y, double x) takes y as the first
parameter and x as the second parameter.

Signed-off-by: Haixia Shi <hshi@meta.com>
2024-01-16 01:07:51 +01:00
Martin Storsjö ac40c3bb07 checkasm: Test whether the native FFmpeg timers work
On some platforms (in particular, ARM/AArch64), the implementation
of AV_READ_TIME() may use a privileged instruction - in such
cases, benchmarking just fails with a SIGILL.

Instead of crashing, try executing AV_READ_TIME() once within
a region with the signal handler active, to allow gracefully
informing the user about the issue.

This matches the dav1d checkasm commit
95a192549a448b70d9542e840c4e34b60d09b093.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-01-15 23:29:12 +02:00
James Almer d8f3cc90ac avutil/iamf: add some more doxy to structs
Particularly, state that their size is not part of the ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-15 18:16:07 -03:00
James Almer c35f1935bf avutil/iamf: fix doxygen group names
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-15 16:30:20 -03:00
James Almer 6f02dcc091 fate/mov: add dependencies to heif tests
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-15 15:10:15 -03:00
James Almer de01ea4caf fate/subtitles: add missing ref for fate-sub-rcwt
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-15 15:10:15 -03:00
James Almer d9fed9df2a avformat/mov: improve HEIF parsing
Parse iprp and iinf boxes and its child boxes to get the actual codec used
(AV1 for avif, HEVC for heic), and properly export extradata and other
properties in a generic way.
The avif tests reference files are updated as the extradata is now exported.

Based on a patch by Swaraj Hota

Co-authored-by: Swaraj Hota <swarajhota353@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-15 15:10:15 -03:00
sunyuechi 202a35ecdb checkasm/svqenc: add ssd_int8_vs_int16 test
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-01-15 19:03:03 +02:00
sunyuechi 0befc1fca7 lvac/svqenc: add ff_svq1enc_init
This is for clarity and use in testing, consistent with other parts of the code

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-01-15 19:03:03 +02:00
Rémi Denis-Courmont 278b4b60d6 lavc/takdsp: R-V V decorrelate_sf
decorrelate_sf_c:      259.2
decorrelate_sf_rvv_i32: 45.5
2024-01-15 19:00:25 +02:00
Marth64 34a47b97de libavutil/timecode: fix parameter order in documentation
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-14 14:58:57 +01:00
Marth64 3525544e48 libavformat: add RCWT closed caption muxex
Signed-off-by: Marth64 <marth64@proxyid.net>

Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
used open source tool for processing 608/708 closed caption (CC) sources.
It can be used to archive the original, raw CC bitstream and to produce
a source file file for later CC processing or conversion. As a result,
it also allows for interopability with ccextractor for processing CC data
extracted via ffmpeg. The format is simple to parse and can be used
to retain all lines and variants of CC.

A free specification of RCWT can be found here:
https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT
This muxer implements the specification as of 01/05/2024, which has
been stable and unchanged for 10 years as of this writing.

This muxer will have some nuances from the way that ccextractor muxes RCWT.
No compatibility issues when processing the output with ccextractor
have been observed as a result of this so far, but mileage may vary
and outputs will not be a bit-exact match.

Specifically, the differences are:
(1)  This muxer will identify as "FF" as the writing program identifier, so
as to be honest about the output's origin.

(2)  ffmpeg's MPEG-1/2, H264, HEVC, etc. decoders extract closed captioning
data differently than ccextractor from embedded SEI/user data.
For example, DVD captioning bytes will be translated to ATSC A53 format.
This allows ffmpeg to handle 608/708 in a consistant way downstream.
This is a lossless conversion and the meaningful data is retained.

(3)  This muxer will not alter the extracted data except to remove invalid
packets in between valid CC blocks. On the other hand, ccextractor
will by default remove mid-stream padding, and add padding at the end
of the stream (in order to convey the end time of the source video).
2024-01-14 14:49:12 +01:00
Stefano Sabatini 5a9f1fc53f doc/muxers/avi: apply misc changes
In particular:
* sort options by name
* apply misc formatting and consistency fixes
* add introduction explaining the need to set some options
2024-01-14 12:22:21 +01:00
Stefano Sabatini f0b69d256d doc/muxers: add au 2024-01-14 12:22:21 +01:00
Stefano Sabatini 4143afc70d doc/muxers: add ast 2024-01-14 12:22:21 +01:00
Stefano Sabatini a600f593a8 lavf/astenc: fix weird indent, use braces in else statements
Braces are employed to improve readability.
2024-01-14 12:22:21 +01:00
yuanhecai a87a52ed0b
avcodec/hevc: Add ff_hevc_idct_32x32_lasx asm opt
tests/checkasm/checkasm:

                          C          LSX       LASX
hevc_idct_32x32_8_c:      1243.0     211.7     101.7

Speedup of decoding H265 4K 30FPS 30Mbps on
3A6000 with 8 threads is 1fps(56fps-->57fps).

Reviewed-by: yinshiyou-hf@loongson.cn
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-12 23:35:40 +01:00
jinbo 9239081db3
avcodec/hevc: Add asm opt for the following functions
tests/checkasm/checkasm:           C       LSX     LASX
put_hevc_qpel_uni_h4_8_c:          5.7     1.2
put_hevc_qpel_uni_h6_8_c:          12.2    2.7
put_hevc_qpel_uni_h8_8_c:          21.5    3.2
put_hevc_qpel_uni_h12_8_c:         47.2    9.2     7.2
put_hevc_qpel_uni_h16_8_c:         87.0    11.7    9.0
put_hevc_qpel_uni_h24_8_c:         188.2   27.5    21.0
put_hevc_qpel_uni_h32_8_c:         335.2   46.7    28.5
put_hevc_qpel_uni_h48_8_c:         772.5   104.5   65.2
put_hevc_qpel_uni_h64_8_c:         1383.2  142.2   109.0

put_hevc_epel_uni_w_v4_8_c:        5.0     1.5
put_hevc_epel_uni_w_v6_8_c:        10.7    3.5     2.5
put_hevc_epel_uni_w_v8_8_c:        18.2    3.7     3.0
put_hevc_epel_uni_w_v12_8_c:       40.2    10.7    7.5
put_hevc_epel_uni_w_v16_8_c:       70.2    13.0    9.2
put_hevc_epel_uni_w_v24_8_c:       158.2   30.2    22.5
put_hevc_epel_uni_w_v32_8_c:       281.0   52.0    36.5
put_hevc_epel_uni_w_v48_8_c:       631.7   116.7   82.7
put_hevc_epel_uni_w_v64_8_c:       1108.2  207.5   142.2

put_hevc_epel_uni_w_h4_8_c:        4.7     1.2
put_hevc_epel_uni_w_h6_8_c:        9.7     3.5     2.7
put_hevc_epel_uni_w_h8_8_c:        17.2    4.2     3.5
put_hevc_epel_uni_w_h12_8_c:       38.0    11.5    7.2
put_hevc_epel_uni_w_h16_8_c:       69.2    14.5    9.2
put_hevc_epel_uni_w_h24_8_c:       152.0   34.7    22.5
put_hevc_epel_uni_w_h32_8_c:       271.0   58.0    40.0
put_hevc_epel_uni_w_h48_8_c:       597.5   136.7   95.0
put_hevc_epel_uni_w_h64_8_c:       1074.0  252.2   168.0

put_hevc_epel_bi_h4_8_c:           4.5     0.7
put_hevc_epel_bi_h6_8_c:           9.0     1.5
put_hevc_epel_bi_h8_8_c:           15.2    1.7
put_hevc_epel_bi_h12_8_c:          33.5    4.2     3.7
put_hevc_epel_bi_h16_8_c:          59.7    5.2     4.7
put_hevc_epel_bi_h24_8_c:          132.2   11.0
put_hevc_epel_bi_h32_8_c:          232.7   20.2    13.2
put_hevc_epel_bi_h48_8_c:          521.7   45.2    31.2
put_hevc_epel_bi_h64_8_c:          949.0   71.5    51.0

After this patch, the peformance of decoding H265 4K 30FPS
30Mbps on 3A6000 with 8 threads improves 1fps(55fps-->56fsp).

Change-Id: I8cc1e41daa63ca478039bc55d1ee8934a7423f51
Reviewed-by: yinshiyou-hf@loongson.cn
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-12 23:35:40 +01:00
jinbo 1f642b99af
avcodec/hevc: Add epel_uni_w_hv4/6/8/12/16/24/32/48/64 asm opt
tests/checkasm/checkasm:           C       LSX     LASX
put_hevc_epel_uni_w_hv4_8_c:       9.5     2.2
put_hevc_epel_uni_w_hv6_8_c:       18.5    5.0     3.7
put_hevc_epel_uni_w_hv8_8_c:       30.7    6.0     4.5
put_hevc_epel_uni_w_hv12_8_c:      63.7    14.0    10.7
put_hevc_epel_uni_w_hv16_8_c:      107.5   22.7    17.0
put_hevc_epel_uni_w_hv24_8_c:      236.7   50.2    31.7
put_hevc_epel_uni_w_hv32_8_c:      414.5   88.0    53.0
put_hevc_epel_uni_w_hv48_8_c:      917.5   197.7   118.5
put_hevc_epel_uni_w_hv64_8_c:      1617.0  349.5   203.0

After this patch, the peformance of decoding H265 4K 30FPS 30Mbps
on 3A6000 with 8 threads improves 3fps (52fps-->55fsp).

Change-Id: If067e394cec4685c62193e7adb829ac93ba4804d
Reviewed-by: yinshiyou-hf@loongson.cn
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-12 23:35:40 +01:00
jinbo 6c6bf18ce8
avcodec/hevc: Add qpel_uni_w_v|h4/6/8/12/16/24/32/48/64 asm opt
tests/checkasm/checkasm:           C       LSX     LASX
put_hevc_qpel_uni_w_h4_8_c:        6.5     1.7     1.2
put_hevc_qpel_uni_w_h6_8_c:        14.5    4.5     3.7
put_hevc_qpel_uni_w_h8_8_c:        24.5    5.7     4.5
put_hevc_qpel_uni_w_h12_8_c:       54.7    17.5    12.0
put_hevc_qpel_uni_w_h16_8_c:       96.5    22.7    13.2
put_hevc_qpel_uni_w_h24_8_c:       216.0   51.2    33.2
put_hevc_qpel_uni_w_h32_8_c:       385.7   87.0    53.2
put_hevc_qpel_uni_w_h48_8_c:       860.5   192.0   113.2
put_hevc_qpel_uni_w_h64_8_c:       1531.0  334.2   200.0

put_hevc_qpel_uni_w_v4_8_c:        8.0     1.7
put_hevc_qpel_uni_w_v6_8_c:        17.2    4.5
put_hevc_qpel_uni_w_v8_8_c:        29.5    6.0     5.2
put_hevc_qpel_uni_w_v12_8_c:       65.2    16.0    11.7
put_hevc_qpel_uni_w_v16_8_c:       116.5   20.5    14.0
put_hevc_qpel_uni_w_v24_8_c:       259.2   48.5    37.2
put_hevc_qpel_uni_w_v32_8_c:       459.5   80.5    56.0
put_hevc_qpel_uni_w_v48_8_c:       1028.5  180.2   126.5
put_hevc_qpel_uni_w_v64_8_c:       1831.2  319.2   224.2

Speedup of decoding H265 4K 30FPS 30Mbps on
3A6000 with 8 threads is 4fps(48fps-->52fps).

Change-Id: I1178848541d90083869225ba98a02e6aa8bb8c5a
Reviewed-by: yinshiyou-hf@loongson.cn
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-12 23:35:40 +01:00
jinbo a28eea2a27
avcodec/hevc: Add pel_uni_w_pixels4/6/8/12/16/24/32/48/64 asm opt
tests/checkasm/checkasm:           C       LSX     LASX
put_hevc_pel_uni_w_pixels4_8_c:    2.7     1.0
put_hevc_pel_uni_w_pixels6_8_c:    6.2     2.0     1.5
put_hevc_pel_uni_w_pixels8_8_c:    10.7    2.5     1.7
put_hevc_pel_uni_w_pixels12_8_c:   23.0    5.5     5.0
put_hevc_pel_uni_w_pixels16_8_c:   41.0    8.2     5.0
put_hevc_pel_uni_w_pixels24_8_c:   91.0    19.7    13.2
put_hevc_pel_uni_w_pixels32_8_c:   161.7   32.5    16.2
put_hevc_pel_uni_w_pixels48_8_c:   354.5   73.7    43.0
put_hevc_pel_uni_w_pixels64_8_c:   641.5   130.0   64.2

Speedup of decoding H265 4K 30FPS 30Mbps on 3A6000 with
8 threads is 1fps(47fps-->48fps).

Reviewed-by: yinshiyou-hf@loongson.cn
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-12 23:35:40 +01:00
jinbo cfbdda607d
avcodec/hevc: Add add_residual_4/8/16/32 asm opt
After this patch, the peformance of decoding H265 4K 30FPS 30Mbps
on 3A6000 with 8 threads improves 2fps (45fps-->47fsp).

Reviewed-by: yinshiyou-hf@loongson.cn
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-12 23:35:40 +01:00
Vladimir Petrov c915dc4c50
avfilter/vsrc_testsrc: fix colorchart black stripe
Fixed blackstripe on bottom or segmentation fault in case
when patch width and height differ.

Signed-off-by: Vladimir Petrov <vppetrovmms@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-12 23:35:40 +01:00
Niklas Haas bfa1b7577d avfilter/vf_zscale: fix query_formats
Wrong field assignment as a result of copy/paste error.
2024-01-12 14:12:44 +01:00
Zhao Zhili 564a15b2ee fftools/ffplay_renderer: Add device selection support
The device can be selected by GPU name or index. For example,

ffplay -hwaccel cuda \
	-vulkan_params device="NVIDIA GeForce RTX 3060" \
	foo.mp4

ffplay -hwaccel cuda -vulkan_params device="0" foo.mp4

Please note that select device by index only supported by hwcontext,
not by libplacebo.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-12 10:49:54 +08:00
Zhao Zhili 38aca1dc9a fftools/ffplay: fix missing hw_frames_ctx when config avfilter
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-12 10:49:46 +08:00
Zhao Zhili bba5a563c8 avutil/hwcontext_vt: add pixel format map for full range YUV420P
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-12 10:49:36 +08:00
Zhao Zhili 13c1fea92f avcodec/videotoolboxenc: fix setting avctx color_range doesn't work
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-12 10:49:18 +08:00
Brad Smith 6d3cd399bd configure: remove Bitrig OS
Bitrig has been defunct for 7 years.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-12 10:38:15 +08:00
aybe aybe f89a6e7576
avformat/psxstr: fix demuxing I/O error at EOF
This second patch fixes the following error at the end of a .STR stream conversion:

[in#0/psxstr @ 0000000000681e80] Error during demuxing: I/O error

It's been a bit of trial and error as I've never used ffmpeg, but returning AVERROR_EOF appears to be the way to go (doesn't complain anymore).

Signed-off-by: aybe <aybe@users.noreply.github.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-11 17:09:45 +01:00
aybe aybe 21ed52916d
avformat/psxstr: fix unknown sector type 00/80
This third patch fixes warnings that are false positives (still on STRv1).

That's because these sectors are simply empty ones as can be read in "System Description CD-ROM XA, May 1991,
4.3.2.3".

Haven't attempted significant refactoring as it just works, left a comment instead about the situation.

The result is that there are no more false warnings when converting.

Signed-off-by: aybe <aybe@users.noreply.github.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-11 17:09:14 +01:00
Nuo Mi 8d0dda8260 vvcdec: reuse h26x/h2656_deblock_template.c 2024-01-11 22:53:05 +08:00
Nuo Mi ae0a83477b hevcdec: move deblock template to h26x/h2656_deblock_template.c 2024-01-11 22:53:05 +08:00
Nuo Mi 69e179e8bf vvcdec: reuse h26x/h2656_sao_template.c 2024-01-11 22:53:05 +08:00
Nuo Mi d2fe23b835 hevcdec: move sao template to h26x/h2656_sao_template.c 2024-01-11 22:53:05 +08:00
Martin Storsjö 65739691b9 checkasm: Generalize crash handling
This replaces the riscv specific handling from
7212466e73 (which essentially is
reverted), with a different implementation of the same (plus a bit
more), based on the corresponding feature in dav1d's checkasm,
supporting both Unix and Windows.

See in particular the dav1d commits
0b6ee30eab2400e4f85b735ad29a68a842c34e21,
0421f787ea592fd2cc74c887f20b8dc31393788b,
8501a4b20135f93a4c3b426468e2240e872949c5 and
d23e87f7aee26ddcf5f7a2e185112031477599a7, authored by Henrik Gramner.

The overall approach compared to the existing implementation for
riscv is the same; set up a signal handler, store the state with
sigsetjmp, jump out of the crashing function with siglongjmp.

The main difference is in what happens when the signal handler
is invoked. In the previous implementation, it would resume from
right before calling the crashing function, and then skip that call
based on the setjmp return value.

In the imported implementation from dav1d, we return to right before
the check_func() call, which will skip testing the current function
(as the pointer is the same as it was before).

Other differences are:
- Support for other signal handling mechanisms (Windows
  AddVectoredExceptionHandler)
- Using RtlCaptureContext/RtlRestoreContext instead of setjmp/longjmp
  on Windows with SEH
- Only catching signals once per function - if more than one
  signal is delivered before signal handling is reenabled, any
  signal is handled as it would without our handler
- Not using an arch specific signal handler written in assembly

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-01-11 14:48:53 +02:00
Niklas Haas 5e751dabc5 doc/APIchanges: document newly added buffersrc field
This was accidentally removed in a prior revision of the series,
alongside the corresponding (separate) version bump. Instead coalesce it
into the follow-up commit's entry, since that's the lowest version
actually supporting the new fields.
2024-01-11 07:05:55 +01:00
Niklas Haas 3a061facff doc/APIchanges: fix wrong version number
Major version was incorrectly copied.
2024-01-11 07:05:55 +01:00
Leo Izen 40bd65a72a
MAINTAINERS: add my new PGP key
Adding my new gpg key that I will be using from now on.
This key is ed25519, which is more secure than the old rsa4096.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-01-10 23:07:28 -05:00
Clément Bœsch af509f9957 avcodec/proresenc_anatoliy: do not write into chroma reserved bitfields
The layout for the frame flags is as follow:

   chroma_format  u(2)
   reserved       u(2)
   interlace_mode u(2)
   reserved       u(2)

chroma_format has 2 allowed values:
   0: reserved
   1: reserved
   2: 4:2:2
   3: 4:4:4

interlace_mode has 3 allowed values:
   0: progressive
   1: tff
   2: bff
   3: reserved

0x80 is what we expect for "422 not interlaced", and the extra 0x2 from
0x82 is actually writing into the reserved bits.
2024-01-10 23:33:02 +01:00
Clément Bœsch 21f7a814ea avcodec/proresenc_anatoliy: do not write into alpha reserved bitfields
This byte represents 4 reserved bits followed by 4 alpha_channel_type bits.

alpha_channel_type currently has 3 differents defined values: 0 (no
alpha), 1 (8b alpha), and 2 (16b alpha), all the other values are
reserved. The 4 initial reserved bits are expected to be 0.
2024-01-10 23:33:02 +01:00
Clément Bœsch 6d35911667 avcodec/proresenc_kostya: do not write into alpha reserved bitfields
This byte represents 4 reserved bits followed by 4 alpha_channel_type bits.

alpha_channel_type currently has 3 differents defined values: 0 (no
alpha), 1 (8b alpha), and 2 (16b alpha), all the other values are
reserved. This part is correctly written (alpha_bits>>3 does the correct
thing), but the 4 initial bits are reserved.
2024-01-10 23:33:02 +01:00
Clément Bœsch aa7ccd0ce9 avcodec/proresenc_kostya: use a compatible bitstream version
Quoting SMPTE RDD 36:2015:
  A decoder shall abort if it encounters a bitstream with an unsupported
  bitstream_version value. If 0, the value of the chroma_format syntax
  element shall be 2 (4:2:2 sampling) and the value of the
  alpha_channel_type element shall be 0 (no encoded alpha); if 1, any
  permissible value may be used for those syntax elements.

So if we're not in 4:2:2 or if there is alpha, we are not allowed to use
version 0.
2024-01-10 23:33:02 +01:00
Clément Bœsch 85cb1b9b20 avcodec/proresenc_anatoliy: use a compatible bitstream version
Quoting SMPTE RDD 36:2015:
  A decoder shall abort if it encounters a bitstream with an unsupported
  bitstream_version value. If 0, the value of the chroma_format syntax
  element shall be 2 (4:2:2 sampling) and the value of the
  alpha_channel_type element shall be 0 (no encoded alpha); if 1, any
  permissible value may be used for those syntax elements.

So if we're not in 4:2:2 or if there is alpha, we are not allowed to use
version 0.
2024-01-10 23:33:02 +01:00
James Almer 0405f71e19 avformat/mov: rename avif fields to heif
They are no longer avif specific.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-10 18:26:53 -03:00
Stefano Sabatini 82ad55f5ff doc/muxers: add ass 2024-01-10 19:56:54 +01:00
Stefano Sabatini 81960c09d6 doc/muxers/asf: extend and apply consistency fixes
Mention asf_stream variant, and clarify the unit used for the packet_size option.
2024-01-10 19:56:54 +01:00
Stefano Sabatini d311e46284 doc/muxers: add argo_cvg 2024-01-10 19:56:54 +01:00
Stefano Sabatini 2a0abf06e4 doc/muxers: add argo_asf 2024-01-10 19:56:54 +01:00
Stefano Sabatini e2b1988c19 doc/muxers: add apng 2024-01-10 19:56:50 +01:00
Stefano Sabatini d9480cebd9 doc/muxers: add apm 2024-01-10 19:56:45 +01:00
Stefano Sabatini 05d92850ec doc/muxers: add amv 2024-01-10 19:56:40 +01:00
Stefano Sabatini afcd9d8991 doc/muxers: add amr 2024-01-10 19:56:34 +01:00
Stefano Sabatini 92a5c93ee9 doc/muxers/alp: apply consistency formatting fixes 2024-01-10 19:56:34 +01:00
Stefano Sabatini b894cb45c4 doc/muxers: add section for audio PCM muxers 2024-01-10 19:56:34 +01:00
Stefano Sabatini 1daf10e51d doc/muxers/aiff: apply formatting fixes 2024-01-10 19:56:34 +01:00
Stefano Sabatini 4d54f022b3 doc/muxer/adts: apply consistency fixes 2024-01-10 19:56:34 +01:00
Stefano Sabatini bdb1738cda doc/muxers: add ac4 2024-01-10 19:56:28 +01:00
Stefano Sabatini 14aa4b08fe doc/muxers/a64: re-format description 2024-01-10 19:52:24 +01:00
Stefano Sabatini c7e26d192a doc/muxers: review rawvideo muxers section
Move section to the top of the file, use table in place of subsection
to list the comprising muxers, and show media type information and
extensions in the item entry names.
2024-01-10 19:52:24 +01:00
Stefano Sabatini f038cd7945 doc/muxers: extend documentation for MOV muxers 2024-01-10 19:52:24 +01:00
Stefano Sabatini 14a1ece3aa lavf/movenc: sort options by name 2024-01-10 19:52:23 +01:00
Marth64 468e0a0d8b doc/faq: use texi's @tie instead of 0xA0 for non-breaking space
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-10 19:52:23 +01:00
Clément Bœsch 1081bae94d avcodec/proresenc_kostya: make a few cosmetics in encode_acs()
Unify cosmetics with encode_acs() from proresenc_anatoliy.
2024-01-10 14:08:00 +01:00
Clément Bœsch cc2206d142 avcodec/proresenc_anatoliy: make a few cosmetics in encode_acs()
This makes the function pretty much identical to the function of the
same name in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 8fb2e96d7e avcodec/proresenc_anatoliy: execute AC run/level FFMIN() at assignment
This matches the logic from the function of the same name in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 096a69ad43 avcodec/proresenc_anatoliy: rework inner loop in encode_acs()
This matches the logic from the function of the same name in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 25f28b9308 avcodec/proresenc_anatoliy: avoid using ff_ prefix in function arguments 2024-01-10 14:08:00 +01:00
Clément Bœsch 29fd3f75fe avcodec/proresenc_anatoliy: rework encode_ac_coeffs() prototype
This makes the prototype closer to the function of the same name in
proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 3543100a05 avcodec/proresenc_anatoliy: replace get_level() with FFABS()
This matches the code from proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch ed8692446c avcodec/proresenc_anatoliy: cosmetics to make encode_dcs() identical to the one in Kostya encoder 2024-01-10 14:08:00 +01:00
Clément Bœsch e87bc5641c avcodec/proresenc_anatoliy: remove TO_GOLOMB2()
A few cosmetics aside, this makes the function identical to the one with
the same name in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch a026f98f29 avcodec/proresenc_anatoliy: only pass down the first scale to encode_dcs()
This matches encode_dcs() prototype from proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 1aa7d504ec avcodec/proresenc_anatoliy: shuffle declarations around in encode_dcs()
This makes the function closer to the same function in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 87ba89281c avcodec/proresenc_anatoliy: rename TO_GOLOMB() to MAKE_CODE()
This matches the name in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 7af42088d7 avcodec/proresenc_kostya: add Anatoliy copyright
Both encoders share a lot of code from both authors.
2024-01-10 14:08:00 +01:00
Clément Bœsch d269f84199 avcodec/proresenc_anatoliy: remove IS_NEGATIVE() macro
This makes the function closer to encode_acs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 9c7f6d89fd avcodec/proresenc_anatoliy: rename new_dc to dc
This makes the function closer to encode_dcs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 9258f4eaf9 avcodec/proresenc_anatoliy: compute sign only once
This makes the function closer to encode_dcs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 17392ca84f avcodec/proresenc_anatoliy: import GET_SIGN() macro from Kostya encoder and use it 2024-01-10 14:08:00 +01:00
Clément Bœsch 273f591a3d avcodec/proresenc_anatoliy: directly work with blocks in encode_dcs()
This makes the function closer to encode_dcs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch dadc5ac24a avcodec/proresenc_anatoliy: reduce DC encoding function prototype differences with Kostya encoder 2024-01-10 14:08:00 +01:00
Clément Bœsch 8e42d3aba0 avcodec/proresenc_anatoliy: execute codebook FFMIN() at assignment
This makes the function closer to encode_dcs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 43baba4647 avcodec/proresenc_anatoliy: rename new_code/code to code/codebook
This makes the function closer to encode_dcs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch c44cd371ca avcodec/proresenc_anatoliy: inline QSCALE()
Also replaces 16384 with 0x4000.

This makes the function slightly closer to same function in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 1574475033 avcodec/proresenc_anatoliy: rework encode_codeword() prototype
This matches the function of the same name in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 1832bd7838 avcodec/proresenc_anatoliy: shuffle encode_codeword() code to match Kostya encoder
Code is functionally identical, it's just rename of variables, cosmetics
and branch logic shuffling.
2024-01-10 14:08:00 +01:00
Clément Bœsch 3885d2493d avcodec/proresenc_anatoliy: use FRAME_ID defined in proresdata.h 2024-01-10 14:08:00 +01:00
Clément Bœsch d6e0fb7c92 avcodec/proresenc_kostya: simplify quantization matrix bytestream writing 2024-01-10 14:08:00 +01:00
Clément Bœsch cbee015867 avcodec/proresenc_kostya: fix chroma quantisation matrix in frame header
Most of the time the quantisation matrices are the same, it only matters
with the proxy profile.
2024-01-10 14:08:00 +01:00
Clément Bœsch 631fa19ee0 avcodec/proresenc_kostya: save a few operations in DC encoding
This matches the logic from proresenc_anatoliy.
2024-01-10 14:08:00 +01:00
Clément Bœsch f06f2cf16a avcodec/proresenc_anatoliy: move DC codebook LUT to shared proresdata
This is going to be shared with proresenc_kostya in the upcoming commit.
2024-01-10 14:08:00 +01:00
Clément Bœsch 9f547e2f15 avcodec/proresenc_anatoliy: remove duplicated define
This is already defined in proresdata.h
2024-01-10 14:08:00 +01:00
Clément Bœsch c35733006a avcodec/proresenc_kostya: remove one LUT indirection for run/level to codebook mapping
This is following the same logic as proresenc_anatoliy.
2024-01-10 14:08:00 +01:00
Clément Bœsch 3ba52f18e4 avcodec/proresenc_anatoliy: move run/lev to codebook LUT to shared proresdata
This is going to be shared with proresenc_kostya in the upcoming commit.
2024-01-10 14:08:00 +01:00
Clément Bœsch e940baa65b avcodec/proresenc_kostya: remove redundant codebook assignments
This is already assigned at declaration.
2024-01-10 14:08:00 +01:00
Clément Bœsch e453efcfbc avcodec/proresenc_kostya: remove unused plane factor variables 2024-01-10 14:08:00 +01:00
Clément Bœsch 2ac88c1362 avcodec/proresenc_kostya: remove an unnecessary parenthesis level in MAKE_CODE() macro 2024-01-10 14:08:00 +01:00
James Almer 6d2f64534d fate/mov: force the native av1 decoder for the avif tests
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-09 20:45:01 -03:00
Vignesh Venkatasubramanian via ffmpeg-devel a0821345eb avformat/mov: Add support for demuxing still HEIC images
They are similar to AVIF images (both use the HEIF container).
The only additional work needed is to parse the hvcC box and put
it in the extradata.

With this patch applied, ffmpeg (when built with an HEVC decoder)
is able to decode the files in
https://github.com/nokiatech/heif/tree/gh-pages/content/images

Also add a couple of fate tests with samples from
https://github.com/nokiatech/heif_conformance/tree/master/conformance_files

Partially fixes trac ticket #6521.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-09 16:44:14 -03:00
James Almer bb819a4ef8 fate/mov: enable the AVIF tests
The samples were uploaded long ago, but this was forgotten.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-09 09:33:57 -03:00
Haihao Xiang 440e08e4bb configure: autodetect libdrm
option kernel_driver for vaapi device creation can be used to choose the
desired device on Linux, which is more convenient than DRM render node
in a multiple-device system (e.g. Intel iGPU + AMD dGPU or inverse), but
this option requires libdrm works. vaapi is autodetected at
configuration time, let's make libdrm autodetected too.

Reviewed-by: Zhao Zhili <quinkblack@foxmail.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-01-09 09:47:56 +08:00
Marton Balint 90bef6390f fftools/ffmpeg_filter: log an information message about filter graph reconfigurations
Filter graph reconfigurations can cause nontrivial issues, e.g. PTS
discontinuities, so it is better to warn the user about them.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-01-07 22:47:22 +01:00
Marton Balint 324be730fc fftools/ffmpeg_filter: honor -reinit_filters 0 even on changed display matrix
Not sure about honoring it also in case of a hwaccel change, so left that as is
for now.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-01-07 22:47:22 +01:00
Marton Balint 363b3ec98a all: use av_channel_layout_describe_bprint instead of av_channel_layout_describe in a few places
Where an AVBPrint buffer is used later anyway.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-01-07 22:47:22 +01:00
Marth64 e4c96dc96c doc/filters/idet: add example
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-07 15:42:54 +01:00
Marth64 b98d87376b doc/encoders/opus: fix typo
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-07 15:42:40 +01:00
Thilo Borgmann c03c675d89 avfilter/fsync: Fix memory leak
Fixes a leak if s->last_frame is still set at the end of filtering.

Found-by: James Almer
2024-01-07 13:59:02 +01:00
James Almer b95ccfcada avcodec/vvc_thread: don't use an anonymous union
Should fix compilation with old GCC.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-06 23:28:03 -03:00
Nuo Mi 02d600c568 vvcdec: add TODO for combining transform, lmcs_scale_chroma, and add_residual
Thanks for the suggestion from Lynne.
2024-01-07 09:01:04 +08:00
Nuo Mi 26769024d1 avcodec/vvcdec: decode extradata to support container formats
For example:
wget https://www.elecard.com/storage/video/NovosobornayaSquare_1920x1080.mp4
./ffplay NovosobornayaSquare_1920x1080.mp4
2024-01-07 08:58:43 +08:00
Sam James 2f24f10d9c libavcodec: fix -Wint-conversion in vulkan
FIx warnings (soon to be errors in GCC 14, already so in Clang 15):
```
src/libavcodec/vulkan_av1.c: In function ‘vk_av1_create_params’:
src/libavcodec/vulkan_av1.c:183:43: error: initialization of ‘long long unsigned int’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
  183 |         .videoSessionParametersTemplate = NULL,
      |                                           ^~~~
src/libavcodec/vulkan_av1.c:183:43: note: (near initialization for ‘(anonymous).videoSessionParametersTemplate’)
```

Use Vulkan's VK_NULL_HANDLE instead of bare NULL.

Fix Trac ticket #10724.

Was reported downstream in Gentoo at https://bugs.gentoo.org/919067.

Signed-off-by: Sam James <sam@gentoo.org>
2024-01-06 22:38:55 +01:00
Clément Bœsch 9109273e3b avcodec/proresenc: fix alpha plane encoding bitstream
These functions encode a slice of alpha (1 to 8 macroblocks) which are
expected to be encoded as a repeated sequence of "[diff][run-1]", where
diff is the running difference of the alpha value and run is how many
times that value is expected to be duplicated (within the limit of a
grand total of 2048 unpacked samples, corresponding to a slice of 8 MB).

Even when run==0 (the run variable semantic is actually "run minus 1"),
there is always a diff previously encoded that needs a counter of at
least 1. This means we need to call put_alpha_run() unconditionally at
the end of the bitstream to account for the last running diff.

This commit fixes glitchy playbacks on QuickTime with M2 and M3 hardware
(but not M1 for some mysterious reason) with files generated with
commands such as:

  ffmpeg -f lavfi -i testsrc2=d=5:s=912x320,chromakey -c:v prores_aw -profile:v 4    -y aw.mov
  ffmpeg -f lavfi -i testsrc2=d=5:s=912x320,chromakey -c:v prores_ks -profile:v 4444 -y ks.mov

The glitch expresses itself deterministically as blinking black
rectangles on random frames (for example on frame 21, 54, 71, 79, ...).

Even with the proresdec from FFmpeg, overreads actually happens while
reading the run-minus-1 value (around val = get_bits(gb, 4) in
unpack_alpha()). This doesn't seem to cause any particular issue because
it simply overreads into the next slice, and because the decoder is
resilient, but it's still a problem.

The investigation leading to this fix was made possible because of paid
work for Jitter (https://jitter.video).

Fixes ticket #10255.
2024-01-06 17:29:59 +01:00
Clément Bœsch 2142141a16 avcodec/proresenc: make transparency honored in mov/QT
In the mov muxer (in mov_write_video_tag()), bits_per_coded_sample will
be written under certain conditions and is required to be 32 for the
transparency to be honored in QuickTime.

prores_kostya already has this setting but prores_anatoliy and
prores_videotoolbox didn't.
2024-01-06 17:29:59 +01:00
Martin Storsjö de9bc4f205 configure: Don't pass -mfp16-format to MSVC on ARM
The check for this option does succeed - MSVC accepts the option,
but prints a warning about it being unknown and ignored, for
each compiled object file:

    cl : Command line warning D9002 : ignoring unknown option '-mfp16-format=ieee'

The configure script only attempts to add this option on ARM,
therefore this warning isn't seen by the majority of people
building with MSVC.

Making this option into a no-op probably isn't entirely right,
but on the other hand, we don't want to litter the code that
checks for support for the option with compiler specific
conditions either.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-01-05 13:47:57 +02:00
Martin Storsjö 102045028e configure: Disable inline assembly with nonlocal labels with LTO on Clang on Windows
The file libavcodec/x86/mlpdsp_init.c uses inline assembly with
nonlocal labels that are referenced outside of the assembly in C.
This fails to link with LTO when built with Clang when targeting
Windows.

The root cause has been reported upstream at
https://github.com/llvm/llvm-project/issues/76046.

Fixes: https://trac.ffmpeg.org/ticket/10548
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-01-05 13:46:01 +02:00
Thilo Borgmann cb6b165b16 fate: Add fsync filter tests 2024-01-05 09:29:05 +01:00
Thilo Borgmann 7ec4835386 avfilter: Add fsync filter 2024-01-05 09:29:05 +01:00
Wu Jianhua 94949d4770 avcodec/d3d12va_decode: don't change the resource state if the referenced frame is the same as the current frame
This commit removes the follow warning and error:

D3D12 WARNING: ID3D12CommandList::ResourceBarrier: Called on the same subresource(s) of
Resource(0x000002236E0E00D0:'Unnamed ID3D12Resource Object') in separate Barrier Descs
which is inefficient and likely unintentional. Desc[0] and Desc[1] on (subresource :
4294967295). [RESOURCE_MANIPULATION WARNING #1008: RESOURCE_BARRIER_DUPLICATE_SUBRESOURCE_TRANSITIONS]

D3D12 ERROR: ID3D12CommandList::ResourceBarrier: Before state (0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT])
of resource (0x000002236E0E00D0:'Unnamed ID3D12Resource Object') (subresource: 0) specified
by transition barrier does not match with the state (0x20000: D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE)
specified in the previous call to ResourceBarrier [RESOURCE_MANIPULATION ERROR #527:
RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH]

Tested-by: Tong Wu <tong1.wu@intel.com>
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-05 11:08:17 +08:00
Tong Wu 270cd14bbb avcodec/dxva2(h264|mpeg2|vc1): use av_assert0 instead of assert
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-05 11:06:57 +08:00
Tong Wu 0f01581ccd avcodec/d3d12va_decode|dxva2: add a warning to replace assertion
Previous assertion was not useful. Now a warning is added to replace it.
For get_surface_index, we should return a zero index in case the index is not found.
But a warning is necessary to notify.

Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-05 11:06:57 +08:00
Tong Wu 56c671c3b0 avcodec/d3d12va_h264: replace assert with av_assert0
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-05 11:06:57 +08:00
Tong Wu 83e0fcbe03 avcodec/d3d12va_decode: delete an empty line and fix a fuction alignment
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-05 11:06:57 +08:00
Tong Wu d18ed2ddb5 avcodec/d3d12va_vp9: fix vp9 max_num_refs value
Previous max_num_refs was based on pp.frame_refs plus 1 and it could possibly
reaches the size limit. Actually it should be the size of pp.ref_frame_map
plus 1.

Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-05 11:06:57 +08:00
Mark Thompson 8b76bae896 avfilter: Temporary hack to fix format negotiation for hw formats
hw_frames_ctx on the input link is only set when the input link is
configured, which hasn't happened yet.  This temporarily hacks around
the problem (in a way no worse than before the format negotiation
changes) until a proper fix can be applied.
2024-01-04 21:47:38 +00:00
Marton Balint d178539532 avutil/imgutils: fix half-float representation of 0.0625
We don't have a 16-bit float Y format, so no fate changes.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-01-04 21:40:22 +01:00
Frank Plowman 42982b5a5d avformat/ffrtmpcrypt: Fix int-conversion warning
The gcrypt definition of `bn_new` used to use the return statement
on errors, with an AVERROR return value, regardless of the signature
of the function where the macro is used - it is called in
`dh_generate_key` and `ff_dh_init` which return pointers. As a result,
compiling with gcrypt and the ffrtmpcrypt protocol resulted in an
int-conversion warning. GCC 14 may upgrade these to errors [1].

This patch fixes the problem by changing the macro to remove `AVERROR`
and instead set `bn` to null if the allocation fails. This is the
behaviour of all the other `bn_new` implementations and so the result is
already checked at all the callsites. AFAICT, this should be the only
change needed to get ffmpeg off Fedora's naughty list of projects with
warnings which may be upgraded to errors in GCC 14 [2].

[1]: https://gcc.gnu.org/pipermail/gcc/2023-May/241264.html
[2]: https://www.mail-archive.com/devel@lists.fedoraproject.org/msg196024.html

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-01-04 14:44:11 +02:00
xufuji456 6caf34dbe0 fftool/ffplay: avoid same name in local variable
There is a warning in XCode:"Declaration shadows a local variable"

Signed-off-by: xufuji456 <839789740@qq.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-05 02:11:21 +08:00
Zhao Zhili 33698ef891 avcodec/mpegutils: print axis in debug_info2
For example,

./ffmpeg -nostats -threads 1 -debug qp \
	-export_side_data +venc_params \
	-i reinit-small_420_9-to-small_420_8.h264 \
	-frames 2 \
	-f null -

New frame, type: B
    0       64      128     192
  0 313131313131313131313131313129
 16 292929292929292929292929292929
 32 323232323232323232323232323232
 48 323232323232323232323232323232
 64 323232323232323232323232323232
 80 323232323232323232323232323232
 96 323232323030303030303030303030
112 303030303030303030303030303030
128 303030303030303030303030303028
144 313131312929292929292929292929
160 292929292929292929292929292929
176 292929292929292929292929292931
192 312831312631313131312730283131

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-04 17:35:11 +08:00
Zhao Zhili bd48c08f80 avcodec/mpegutils: make debug_info2 thread safe
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-04 17:33:56 +08:00
Zhao Zhili 7f900a737f avcodec/videotoolbox: specify color range for hw frame ctx
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-04 17:33:38 +08:00
Zhao Zhili 5d255ba95a avutil/hwcontext_videotoolbox: add frame hwctx to specify color range
VideoToolbox use different identifiers for the same pixel format
with different color range, like

kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
kCVPixelFormatType_420YpCbCr8BiPlanarFullRange.

Before the patch, vt_pool_alloc() always use limited range, and it
will fail for pixel format AV_PIX_FMT_BGRA since there is no limited
range kCVPixelFormatType_32BGRA.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-04 17:31:49 +08:00
Zhao Zhili 0f824d792d avcodec/hevc_parser: fix missing zero_byte at frame beginning
The start code is matched against 0x000001, zero_byte was treated
as last byte of last frame rather than the beginning of next frame.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-05 01:14:33 +08:00
Zhao Zhili b7ac1f9856 avcodec/hevc_mp4toannexb_bsf: use HEVCNALUnitType instead of integer literal
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-05 01:14:33 +08:00
Zhao Zhili 99debe5f82 avfilter/vf_codecview: fix heap buffer overflow
And improve the performance by a little bit.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-05 01:14:33 +08:00
Romain Beauxis 797f0b27c1 libavformat/hlsenc.c: Populate OTI using AAC profile in write_codec_attr.
This patch populates the third entry for HLS codec attribute using the
AAC profile.

The HLS specifications[1] require this value to be the Object Type ID as
referred to in table 1.3 of ISO/IEC 14496-3:2009[2].

The numerical constants in the code refer to these OTIs minus one, as
documented in commit 372597e[3], confirmed by comparing the values in the
code with the values in the table mentioned above.

Links:
1: https://datatracker.ietf.org/doc/html/rfc6381#section-3.3
2: https://csclub.uwaterloo.ca/~ehashman/ISO14496-3-2009.pdf
3: 372597e538

Changes in this version:
- Default value set to "mp4a.40.2" when profile is unknown for backward
  compatibility.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2024-01-04 09:59:45 +08:00
Marth64 6b1fb5a940 doc/codecs: add missing comma to introduction
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-04 01:10:25 +01:00
Marth64 32a70d02f2 doc/muxers: fix duplicate word 'that' for image2 summary
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-04 01:10:14 +01:00
Marth64 b0e86bc814 doc/filter: remove duplicate word 'with' in QR filters
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-04 01:10:04 +01:00
Marth64 375c5de005 doc/filters: fix minterpolate vsbmc option typos
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-04 01:09:44 +01:00
Marth64 935da499c1 doc/encoders: libxeve doc typo, baselie->baseline 2024-01-04 01:09:04 +01:00
Marth64 6a9b526eb1 doc/ffmpeg: add missing comma
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-04 01:08:51 +01:00
Marth64 de9fe17a1f doc/codecs: fix missing guidance in channel_layout item and remove decomissioned request_channel_layout
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-04 01:08:34 +01:00
Marth64 6442d1ddd6 doc/faq: replace non-breaking spaces (0xA0) with normal space
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-04 01:07:10 +01:00
Marth64 f7fa760b39 doc/faq: fix scaling question typo
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-04 01:07:02 +01:00
Stefano Sabatini 59686eaf33 lavfi/drawtext: fix missed rename of is_newline
Fix fallout introduced in 732fb122e6, fix compilation with
--enable-libfribidi.
2024-01-03 16:49:16 +01:00
Nuo Mi 301ed950d1 vvcdec: add vvc decoder
vvc decoder plug-in to avcodec.
split frames into slices/tiles and send them to vvc_thread for further decoding
reorder and wait for the frame decoding to be done and output the frame

Features:
    + Support I, P, B frames
    + Support 8/10/12 bits, chroma 400, 420, 422, and 444 and range extension
    + Support VVC new tools like MIP, CCLM, AFFINE, GPM, DMVR, PROF, BDOF, LMCS, ALF
    + 295 conformace clips passed
    - Not support RPR, IBC, PALETTE, and other minor features yet

Performance:
    C code FPS on an i7-12700K (x86):
        BQTerrace_1920x1080_60_10_420_22_RA.vvc      93.0
        Chimera_8bit_1080P_1000_frames.vvc          184.3
        NovosobornayaSquare_1920x1080.bin           191.3
        RitualDance_1920x1080_60_10_420_32_LD.266   150.7
        RitualDance_1920x1080_60_10_420_37_RA.266   170.0
        Tango2_3840x2160_60_10_420_27_LD.266         33.7

    C code FPS on a M1 Mac Pro (ARM):
        BQTerrace_1920x1080_60_10_420_22_RA.vvc     58.7
        Chimera_8bit_1080P_1000_frames.vvc          153.3
        NovosobornayaSquare_1920x1080.bin           150.3
        RitualDance_1920x1080_60_10_420_32_LD.266   105.0
        RitualDance_1920x1080_60_10_420_37_RA.266   133.0
        Tango2_3840x2160_60_10_420_27_LD.266        21.7

    Asm optimizations still working in progress. please check
    https://github.com/ffvvc/FFmpeg/wiki#performance-data for the latest

Contributors (based on code merge order):
    Nuo Mi <nuomi2021@gmail.com>
    Xu Mu <toxumu@outlook.com>
    Frank Plowman <post@frankplowman.com>
    Shaun Loo <shaunloo10@gmail.com>
    Wu Jianhua <toqsxw@outlook.com>

Thank you for reporting issues and providing performance reports:
    Łukasz Czech <lukaszcz18@wp.pl>
    Xu Fulong <839789740@qq.com>

Thank you for providing review comments:
    Ronald S. Bultje <rsbultje@gmail.com>
    James Almer <jamrial@gmail.com>
    Andreas Rheinhardt <andreas.rheinhardt@outlook.com>

Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 23:15:12 +08:00
Nuo Mi e7ef457d6b vvcdec: add CTU thread logical
This is the main entry point for the CTU (Coding Tree Unit) decoder.
The code will divide the CTU decoder into several stages.
It will check the stage dependencies and run the stage decoder.

Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 23:15:12 +08:00
Nuo Mi 07f75d5e02 vvcdec: add CTU parser
Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 23:15:12 +08:00
Nuo Mi b49575f4cf vvcdec: add dsp init and inv transform
Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 23:15:12 +08:00
Nuo Mi 02c1455b44 vvcdec: add LMCS, Deblocking, SAO, and ALF filters
Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 23:15:12 +08:00
Nuo Mi c05ba94ce8 vvcdec: add intra prediction
Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 23:15:12 +08:00
Nuo Mi 2592cc1f96 vvcdec: add inv transform 1d
Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 23:15:11 +08:00
Nuo Mi ea49c83bad vvcdec: add inter prediction
Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 23:15:11 +08:00
Nuo Mi 603d0bd171 vvcdec: add motion vector decoder
Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 23:15:11 +08:00
Nuo Mi c1a3d17491 vvcdec: add reference management
Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 23:15:11 +08:00
Nuo Mi 976d3b7d69 vvcdec: add cabac decoder
add Context-based Adaptive Binary Arithmetic Coding (CABAC) decoder

Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 23:15:06 +08:00
Nuo Mi e97a5bbb13 vvcdec: add parameter parser for sps, pps, ph, sh
Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 16:31:59 +08:00
Nuo Mi 49db9fc171 vvcdec: add vvc_data
Co-authored-by: Xu Mu <toxumu@outlook.com>
Co-authored-by: Frank Plowman <post@frankplowman.com>
Co-authored-by: Shaun Loo <shaunloo10@gmail.com>
Co-authored-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-03 16:31:59 +08:00
Stefano Sabatini 43042931fb doc/filters/drawtext: apply second level of escaping on colon
Fix escaping on example.
2024-01-02 22:04:06 +01:00
Stefano Sabatini 4d301be9e5 doc/filters/setpts: add random jitter generation example 2024-01-01 20:12:53 +01:00
Stefano Sabatini 7769afcab4 lavu/eval: add randomi function to compute random value in interval 2024-01-01 20:12:52 +01:00
Stefano Sabatini 933c7ff0b9 lavfi/setpts: use macro to access variables array 2024-01-01 20:12:52 +01:00
Stefano Sabatini 030e140145 lavfi: add quirc filter 2024-01-01 20:12:52 +01:00
Stefano Sabatini 899302bb5f lavfi: add qrencode source and filter 2024-01-01 20:12:52 +01:00
Stefano Sabatini 732fb122e6 lavfi: introduce textutils
Generalize drawtext utilities to make them usable in other filters.
This will be needed to introduce the QR code source and filter without
duplicating functionality.
2024-01-01 20:12:52 +01:00
Stefano Sabatini c2ab41b7e0 lavfi/overlay: factorize definition of planar and packed blending functions 2024-01-01 20:12:52 +01:00
James Almer 85b8d59ec7 avcodec/d3d12va_mpeg2: change the type for the ID3D12Resource_Map input data argument
Fixes -Wincompatible-pointer-types warnings.

Reviewed-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-01 09:46:41 -03:00
James Almer e9722735fa avcodec/d3d12va_mpeg2: remove unused variables
Reviewed-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-01 09:46:06 -03:00
Gyan Doshi e1c1dc8347 configure: correct lensfun header function check
The function lf_db_new was deprecated in lensfun 09dcd3e7ad in 2017
in favour of lf_db_create. The AVfilter was adjusted in 8b78eb312d
but the configure check wasn't changed.

lensfun removed lf_db_new declaration in lf 35c0017593 so configure
fails to find lensfun.
2024-01-01 15:31:36 +05:30
Lynne b95ee2ec5f configure: update copyright year 2024-01-01 00:58:30 +01:00
Niklas Haas 44a33fccd8 avfilter/vf_format: allow empty pix_fmts list
Which will impose no restriction. This makes sense when using e.g.
`color_ranges=pc` to limit the color range, without also limiting the
pixel format.
2023-12-31 13:36:22 -08:00
Niklas Haas 796669d483 avfilter/vf_format: add color_ranges/spaces
Needed for fftools/ffmpeg_filter to be able to force specific output
formats via the filter chain.
2023-12-31 13:36:22 -08:00
Niklas Haas 2a942b4b3a avfilter/vf_format: re-use AVFilterFormats for pix_fmt parsing
Rewrite the format parsing code to make it more easily generalizable. In
particular, `invert_formats` does not depend on the type of format list
passed to it, which allows me to re-use this helper in an upcoming
commit.

Slightly shortens the code, at the sole cost of doing several malloc
(ff_add_format) instead of a single malloc.
2023-12-31 13:36:22 -08:00
Niklas Haas 475a99628d avfilter/buffersink: add color space/range accessors
Needed for fftools.
2023-12-31 13:36:12 -08:00
Niklas Haas e82277b548 avfilter/vf_libplacebo: switch to colorspace negotiation API 2023-12-31 13:35:35 -08:00
Niklas Haas ff506b8d8f avfilter/vf_libplacebo: don't force dovi frames to bt.2020-ncl
This is at odds with the YUV matrix negotiation API, in which such
dynamic changes in YUV encoding are no longer easily possible. There is
also no really strong motivating reason to do this, since the choice of
YUV matrix is essentially arbitrary and not actually related to the
Dolby Vision decoding process.
2023-12-31 13:35:35 -08:00
Niklas Haas 2ebcbe97fc avfilter/vf_zscale: switch to colorspace negotiation API
Following the same design as vf_scale.
2023-12-31 13:35:35 -08:00
Niklas Haas 3f2c49acfb avfilter/vf_zscale: remove unused variables
Only assigned, never read.
2023-12-31 13:35:35 -08:00
Niklas Haas 45e09a3041 vf_scale: use colorspace negotiation API
This filter will always accept any input format, even if the user sets
a specific in_range/in_color_matrix. This is to preserve status quo with
current behavior, where passing a specific in_color_matrix merely
overrides the incoming frames' attributes. (Use `vf_format` to force
a specific input range)

Because changing colorspace and color_range now requires reconfiguring
the link, we can lift sws_setColorspaceDetails out of scale_frame and
into config_props. (This will also get re-called if the input frame
properties change)
2023-12-31 13:35:35 -08:00
Niklas Haas 9613ba95c1 fftools/ffmpeg_filter: configure buffersrc with csp/range
Propagates input metadata to the input filter graph.
2023-12-31 13:35:35 -08:00
Niklas Haas 2d555dc82d avfilter/buffersrc: add color_space/range parameters
To allow adding proper negotiation, in particular, to fftools.

These values will simply be negotiated downstream for YUV formats, and
ignored otherwise.
2023-12-31 13:35:17 -08:00
Niklas Haas 9d0f361f7f fftools/ffmpeg_filter: don't clear buffersrc params
This memset is bogus, it accomplishes nothing in the best case and
regresses future additions to AVBufferSrcParameters in the worst case.
2023-12-31 13:35:17 -08:00
Niklas Haas 8c7934f73a avfilter: add negotiation API for color space/range
Motivated by YUVJ removal. This change will allow full negotiation
between color ranges and matrices as needed. By default, all ranges and
matrices are marked as supported.

Because grayscale formats are currently handled very inconsistently (and
in particular, assumed as forced full-range by swscale), we exclude them
from negotiation altogether for the time being, to get this API merged.

After filter negotiation is available, we can relax the
grayscale-is-forced-jpeg restriction again, when it will be more
feasible to do so without breaking a million test cases.

Note that this commit updates one FATE test as a consequence of the
sanity fallback for non-YUV formats. In particular, the test case now
writes rgb24(pc, gbr/unspecified/unspecified) to the matroska file,
instead of rgb24(unspecified/unspecified/unspecified) as before.
2023-12-31 13:35:03 -08:00
Niklas Haas e687a84854 avfilter/formats: set audio fmt lists for vaf filters
Currently, the logic inside the FF_FILTER_FORMATS_QUERY_FUNC branch
prevents this code from running in the event that we have a filter with
a single video input and a single audio output, as the resulting audio
output link will not have its channel counts / samplerates correctly
initialized to their default values, possibly triggering a segfault
downstream.

An example of such a filter is vaf_spectrumsynth. Although this
particular filter already sets up the channel counts and samplerates as
part of the query function and therefore avoids triggering this bug, the
bug still exists in principle. (And importantly, sets a wrong precedent)
2023-12-31 13:33:01 -08:00
Niklas Haas 0e9cf1abf5 avfilter: always call ff_default_query_formats
Even if a query func is set. This is safe to do, because
ff_default_query_formats is documented not to touch any filter lists
that were already set by the query func.

The reason to do this is because it allows us to extend
AVFilterFormatsConfig without having to touch every filter in existence.
An alternative implementation of this commit would be to explicitly add
a `ff_default_query_formats` call at the end of every query_formats
function, but that would end up functionally equivalent to this change
while touching a whole lot more code paths for no reason.

As a bonus, eliminates some code/logic duplication from this function.
2023-12-31 13:33:01 -08:00
Niklas Haas 1b0ca47707 avfilter/formats: document ff_default_query_formats
In particular, make it clear that this function will not touch format
lists which were already set by the caller before calling into this
function.
2023-12-31 13:32:29 -08:00
Cedric Le Barz 238f9de876 Add jpeg2000 subdescriptor (V2).
Signed-off-by: Cedric Le Barz <clebarz@ektacom.com>
2023-12-31 14:18:01 +01:00
Michael Niedermayer e063c1d079
avcodec/mpegvideo_enc: Use ptrdiff_t for stride
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-30 21:50:05 +01:00
Michael Niedermayer a066b8a809
avcodec/mpegvideo_enc: Dont copy beyond the image
Fixes: out of array access
Fixes: tickets/10754/poc17ffmpeg

Discovered by Zeng Yunxiang.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-30 21:50:04 +01:00
Michael Niedermayer 68146f06f8
avfilter/vf_minterpolate: Check pts before division
Fixes: FPE
Fixes: tickets/10758/poc20ffmpeg

Discovered by Zeng Yunxiang

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-30 21:50:04 +01:00
Michael Niedermayer 08bd2cbfeb
avfilter/avf_showwaves: Check history_nb_samples
Fixes: out of array access
Fixes: tickets/10756/poc18ffmpeg

Discovered by Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-30 21:50:04 +01:00
Wenbin Chen 56c5930ec3 libavfilter/vf_dnn_detect: Add two outputs ssd support
For this kind of model, we can directly use its output as final result
just like ssd model. The difference is that it splits output into two
tensors. [x_min, y_min, x_max, y_max, confidence] and [lable_id].

Model example refer to: https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/person-detection-0106

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-30 12:12:58 +08:00
Wenbin Chen 86435582a6 libavfilter/dnn_backend_openvino: Add dynamic output support
Add dynamic outputs support. Some models don't have fixed output size.
Its size changes according to result. Now openvino can run these kinds of
models.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-30 12:12:51 +08:00
Michael Niedermayer 029294ff54
avformat/flacdec: Avoid double AVERRORS
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:36:03 +01:00
Michael Niedermayer bb04235d72
avfilter/vf_vidstabdetect: Avoid double AVERRORS
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:36:03 +01:00
Michael Niedermayer bf1159774b
avcodec/vaapi_encode: Avoid double AVERRORS
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:36:02 +01:00
Michael Niedermayer 7deaca71b3
avfilter/vf_swaprect: round coordinates down
Fixes: out of array access:
Fixes: tickets/10745/poc12ffmpeg

Found-by: Li Zeyuan and Zeng Yunxiang.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:07:59 +01:00
Michael Niedermayer 9f4c5bd7d2
avfilter/vf_swaprect: Use height for vertical variables
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:07:58 +01:00
Michael Niedermayer 9d1ba698d2
avfilter/vf_swaprect: assert that rectangles are within memory
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:07:58 +01:00
Michael Niedermayer a88b06f9ee
avfilter/af_alimiter: Check nextpos before use
Fixes: out of array read
Fixes: tickets/10744/poc11ffmpeg

Found-by: Li Zeyuan and Zeng Yunxiang.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:07:57 +01:00
Michael Niedermayer 61e73851a3
avfilter/f_reverse: Apply PTS compensation only when pts is available
Fixes: out of array access
Fixes: tickets/10753/poc16ffmpeg

Regression since: 45dc668aea
Found-by: Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 19:29:07 +01:00
Michael Niedermayer 50f0f8c53c
avfilter/af_stereowiden: Check length
Fixes: out of array access
Fixes: tickets/10746/poc13ffmpeg

Found-by: Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 19:29:06 +01:00
Thomas Guilbert ff451df947
avformat/mov: Fix MSAN issue with stsd_id
Fixes: use of uninitialized value
Fixes: bbb-320x240-2video-2audio.mp4

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 19:24:17 +01:00
Michael Niedermayer 850ab8f6da
avcodec/jpegxl_parser: Check get_vlc2()
Fixes: shift exponent -1 is negative
Fixes: 63889/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6009343056936960

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 19:21:26 +01:00
Michael Niedermayer 0ecc1f0e48
avfilter/vf_weave: Fix odd height handling
Fixes: out of array access
Fixes: tickets/10743/poc10ffmpeg

Found-by: Zeng Yunxiang and Li Zeyuan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:28:11 +01:00
Michael Niedermayer c443658d26
avfilter/edge_template: Fix small inputs with gaussian_blur()
Fixes: out of array access
Fixes: Ticket10699
Fixes: poc5ffmpeg

Found-by: Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:28:10 +01:00
Paul B Mahol e6459abfad
avfilter/af_stereotools: round-up max size of buffer
Fixes: out of array access
Fixes: tickets/10747/poc14ffmpeg

Found-by: Zeng Yunxiang and Song Jiaxuan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:19:06 +01:00
Michael Niedermayer e4d2666bdc
avfilter/vf_gradfun: Do not overread last line
The code works in steps of 2 lines and lacks support for odd height
Implementing odd height support is better but for now this fixes the
out of array access

Fixes: out of array access
Fixes: tickets/10702/poc6ffmpe

Found-by: Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:19:05 +01:00
Michael Niedermayer ab0fdaedd1
avfilter/avf_showspectrum: fix off by 1 error
Fixes: out of array access
Fixes: tickets/10749/poc15ffmpeg

Regression since: 81df787b53

Found-by: Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:19:04 +01:00
Michael Niedermayer aec67d3d7d
avfilter/af_stereowiden: Round length to nearest
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:19:03 +01:00
Michael Niedermayer d909d8e5e0
avcodec/leaddec: Check remaining bits in decode_block()
Fixes: Timeout
Fixes: 64163/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LEAD_fuzzer-6418925835124736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:15:42 +01:00
Michael Niedermayer 5f88458bea
avcodec/jpegxl_parser: Add padding to cs_buffer
Fixes: out of array access
Fixes: 64081/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6151006496620544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:15:42 +01:00
Michael Niedermayer f1dc7b9257
tools/target_dec_fuzzer: Adjust threshold for QPEG
Fixes: 63712/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QPEG_fuzzer-456353017272729
Fixes: Timeout

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:15:41 +01:00
Michael Niedermayer cfc0a68d4d
avformat/mov: do not set sign bit for chunk_offsets
Fixes: signed integer overflow: 2314885530818453536 - -7412889664301817824 cannot be represented in type 'long'
Fixes: 64296/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6304027146846208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:00:49 +01:00
Michael Niedermayer c72a20f01a
avcodec/jpeglsdec: Check Jpeg-LS LSE
Fixes: signed integer overflow: 2147478526 + 33924 cannot be represented in type 'int'
Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 64243/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-5195717848989696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:00:48 +01:00
Michael Niedermayer d344a4191c
tools/target_dec_fuzzer: Adjust Threshold for VP6A
Fixes: Timeout
Fixes: 64220/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP6A_fuzzer-5653856213925888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:00:48 +01:00
Michael Niedermayer c75fccd1d4
avcodec/osq: Implement flush()
Fixes: out of array access
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6227491892887552
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6268561729126400
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6414805046788096
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6538151088488448
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6608131540779008

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 00:45:20 +01:00
jinbo 545686e49e
avcodec/hevc: Add init for sao_edge_filter
Forgot to init c->sao_edge_filter[idx] when idx=0/1/2/3.
After this patch, the speedup of decoding H265 4K 30FPS
30Mbps on 3A6000 is about 7% (42fps==>45fps).

Change-Id: I521999b397fa72b931a23c165cf45f276440cdfb
Reviewed-by: yinshiyou-hf@loongson.cn
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 00:45:20 +01:00
Devin Heitmueller b2c82b23b9 avcodec/bitpacked_dec: optimize bitpacked_decode_yuv422p10
Rework the code a bit to speed up the 10-bit bitpacked decoding
routine.  This is probably about as fast as I can get it without
switching to assembly language.

Demonstratable with:

./ffmpeg -f lavfi -i "smptehdbars=size=3840x2160" -c bitpacked -f image2 -frames:v 1 source.yuv
./ffmpeg -f bitpacked -pix_fmt yuv422p10le -s 3840x2160 -c:v bitpacked -i source.yuv -pix_fmt yuv422p10le out.yuv

On my development system, it went from 80ms for a 2160p frame
down to 20ms (i.e. a 4X speedup).  Good enough for now, I hope...

Comments from Marton:

Originally on my system better performance could be achieved by simply
switching to the cached bitstream reader, but for Devin it was slower than
his direct byte operations.

I changed the order of writing output from u/y/v/y to u/v/y/y, and that made
the code faster than the cached bitstream reader on my system as well.

TIMER measurement of the decode loop on Ryzen 5 3600 with command line:

./ffmpeg -stream_loop 256 -threads 1 -f bitpacked -pix_fmt yuv422p10le -s 3840x2160 -c:v bitpacked -i source.yuv -pix_fmt yuv422p10le -f null none -loglevel error

Before: 823204127 decicycles in YUV,     256 runs,      0 skips
After:  315070524 decicycles in YUV,     256 runs,      0 skips

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-12-28 23:56:14 +01:00
Marton Balint 059ea1d6f6 avcodec/mjpegdec: avoid indirection when accessing avctx
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-12-28 23:15:56 +01:00
Marton Balint e6b9bfaac3 avcodec/mjpegdec: use memset to clear alpha
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-12-28 23:15:56 +01:00
James Almer f7f4ff1b86 tests/dca: remove usage of deprecated request_channel_layout option
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-28 15:31:50 -03:00
James Almer 0b1552ef55 tests/truehd: remove usage of deprecated request_channel_layout option
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-28 15:31:36 -03:00
Gyan Doshi c1340f3439 avformat/riffenc: don't force WAVEFORMATEXTENSIBLE for flt/dbl LPCM
2c2a167ca7 forced WAVEFORMATEXTENSIBLE for all LPCM streams with greater
than 16 bits per sample. However, WAVEFORMATEX allows IEEE Float samples
or any depth where raw depth == coded depth, see Remarks section at
https://learn.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatex
and samples M1F1-float32-AFsp, M1F1-float64-AFsp at
https://www.mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Samples.html

There are hardware devices and likely software players requiring float samples
that fail to qualify files with WAVEFORMATEXTENSIBLE headers.
2023-12-28 11:11:33 +05:30
Zhao Zhili 56ca0f2918 avfilter/vf_showinfo: add udu_sei_as_ascii option
Some encoders (e.g., libx264) dump encoder configuration as user
data unregistered SEI message. This option try to print it as
ascii character when possible.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-28 21:22:54 +08:00
Leo Izen fb54c89a0d
avcodec/jpegxl_parser: check ANS cluster alphabet size vs bundle size
The specification doesn't mention that clusters cannot have alphabet
sizes greater than 1 << bundle->log_alphabet_size, but the reference
implementation rejects these entropy streams as invalid, so we should
too. Refusing to do so can overflow a stack variable that should be
large enough otherwise.

Fixes #10738.

Found-by: Zeng Yunxiang and Li Zeyuan
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-12-27 10:10:09 -05:00
James Almer 4fee63b241 x86/takdsp: add missing wrappers to AVX2 functions
Fixes compilation with old yasm.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-25 22:31:15 -03:00
Brad Smith 6066c430e3
configure: Enable section_data_rel_ro for FreeBSD and NetBSD aarch64 / arm
Fixes the build. It's a requirement when utilizing PIE.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-25 23:52:37 +01:00
Matt Oliver f5f414d9c4 Remove myself from maintainers. 2023-12-23 23:15:55 +11:00
James Almer 591dc3b4b8 x86/takdsp: add avx2 versions of all functions
On an Intel Core i7 12700k:

decorrelate_ls_c: 814.3
decorrelate_ls_sse2: 165.8
decorrelate_ls_avx2: 101.3
decorrelate_sf_c: 1602.6
decorrelate_sf_sse4: 640.1
decorrelate_sf_avx2: 324.6
decorrelate_sm_c: 1564.8
decorrelate_sm_sse2: 379.3
decorrelate_sm_avx2: 203.3
decorrelate_sr_c: 785.3
decorrelate_sr_sse2: 176.3
decorrelate_sr_avx2: 99.8

Tested-by: Lynne <dev@lynne.ee>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-23 08:39:22 -03:00
Andreas Rheinhardt 370ce305f4
avcodec/libjxlenc: Set AV_CODEC_CAP_DR1
This encoder uses ff_get_encode_buffer() to allocate the packet buffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 22:08:29 -05:00
Andreas Rheinhardt 577dd7b762
avcodec/libjxlenc: Don't refer to decoder in comments
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 22:08:29 -05:00
Leo Izen 5942cf46b6
avcodec/libjxldec: emit proper PTS to decoded AVFrame
If a sequence of JXL images is encapsulated in a container that has PTS
information, we should use the PTS information from the container. At
this time there is no container that does this, but if JPEG XL support
is ever added to NUT, AVTransport, or some other container, this commit
should allow the PTS information those containers provide to work as
expected.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-12-22 22:08:29 -05:00
Leo Izen 42f78925d7
avcodec/libjxlenc: accept rgbf32 and rgbaf32 frames
These pixel formats have always been supported by libjxl, but at the
time this plugin was written, they were not in FFmpeg yet. Now that
they are in FFmpeg, we should support them.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-12-22 22:08:29 -05:00
Leo Izen f6ef6a853c
avcodec/libjxldec: produce rgbf32 and rgbaf32 frames
These pixel formats have always been supported by libjxl, but at the
time this plugin was written, they were not in FFmpeg yet. Now that
they are in FFmpeg, we should support them.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-12-22 22:08:29 -05:00
Leo Izen 4013b8d3f0
avcodec/pngdec: improve handling of bad cICP range tags
FFmpeg doesn't support tv-range RGB throughout most of its pipeline, so
we should keep the warning. However, in case something does support it
we should at least keep it tagged properly. Additionally, the encoder
writes this tag if the space is tagged as such so this makes a round
trip work as it should.

Also, PNG doesn't support nonzero matrices but we only warn and ignore
in that case, so we have no reason to error out for illegal cICP ranges
either (i.e. greater than 1).

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Reported-by: Kacper Michajłow <kasper93@gmail.com>
2023-12-22 22:07:35 -05:00
sunyuechi 3d39b8d4e7 lavc/takdsp: R-V V decorrelate_sm
C908:
decorrelate_sm_c: 130.0
decorrelate_sm_rvv_i32: 43.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
(with minor changes)
2023-12-22 17:40:00 +02:00
Andreas Rheinhardt 0c6203c97a all: Don't set AVClass.item_name to its default value
Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9;
also avoids relocations.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 15:12:33 +01:00
James Almer 46775e64f8 avcodec/takdsp: fix const correctness
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-22 09:28:04 -03:00
James Almer c5029bb193 checkasm/takdsp: add decorrelate_sf test
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-22 09:26:38 -03:00
Martin Storsjö 935837c3d3 checkasm: Fix the takdsp tests
For memcpy and memcmp, we need to multiply by the element size,
otherwise we're copying and comparing only a fraction of the buffer.

For decorrelate_sr, the buffer p1 is the one that is mutated;
copy and check p1 instead of p2.

For decorrelate_sm, both buffers are mutated, so copy and check
both of them.

For decorrelate_sm, the memcpy initialization of p1 and p1_2 was
reversed - p1 is filled with randomize, but then memcpy copies from
p1_2 to p1. As p1_2 is uninitialized at this point, clang concluded
that the copy was bogus and omitted it entirely, triggering failures
in this test on x86 (where there was an existing assembly implementation
to test).

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-22 14:20:31 +02:00
Anton Khirnov 6325aede08 fftools/ffmpeg: remove deprecated -[av]bsf
They were marked as deprecated over 10 years ago.
2023-12-22 11:39:57 +01:00
Anton Khirnov 7f982065a8 fftools/ffmpeg: mark -vsync for future removal
It has already been deprecated over a year ago.
2023-12-22 11:39:57 +01:00
Anton Khirnov 8d8c2b410f fftools/ffmpeg_opt: fix -dn flags
It's a data, not video option.
2023-12-22 11:39:57 +01:00
Anton Khirnov 84352c9891 fftools/ffmpeg_opt: print a section for data-stream options
Only show it with show_advanced (triggered by -h long), since data
streams themselves are an advanced topic.
2023-12-22 11:39:57 +01:00
Anton Khirnov 74df1b73d4 fftools/ffmpeg_opt: refine printing type-specific options
* filter subtitle/data options out of main, video and audio sections
* add filters that were missing entirely from the subtitle section
* add a missing section for advanced subtitle options
2023-12-22 11:39:57 +01:00
Anton Khirnov 0125cab385 fftools/ffmpeg_opt: mark more options as OPT_EXPERT
Reduces the basic help output to a reasonable size and stops confusing
users with options the vast majority will not need.
2023-12-22 11:39:57 +01:00
Anton Khirnov c5a87d8bdb fftools/opt_common: mark some options as OPT_EXPERT
So they don't clutter the standard help output.

-loglevel is marked because there is no need to show two options (-v and
-loglevel) that do the same thing.
2023-12-22 11:39:57 +01:00
Anton Khirnov 86e8439994 fftools/ffmpeg_opt: update program description to match manpage
Cf. 2244722f1f
2023-12-22 11:39:57 +01:00
Anton Khirnov 41716214c2 fftools/ffmpeg: improve WARN_MULTIPLE_OPT_USAGE()
Currently it requires every single OPT_SPEC option to be accompanied by
an array of alternate names for this option. The vast majority of
options have no alternate names, resulting in a large numbers of
unnecessary single-element arrays that merely contain the option name.

Extend the option parsing API to allow marking options as having
alternate names, or as being the canonical name for some existing
alternatives. Use this new information to avoid the need for
abovementioned unnecessary single-element arrays.
2023-12-22 11:39:57 +01:00
Anton Khirnov 148fac277a fftools/ffmpeg: change the MATCH_PER_TYPE_OPT macro into a function
There is no reason for it to be a macro anymore, this makes the code
using it cleaner and simpler.
2023-12-22 11:39:57 +01:00
Anton Khirnov 0ba70a6792 fftools/cmdutils: add a struct for a list of SpecifierOpt
Significantly simplifies the code dealing with OPT_SPEC.
2023-12-22 11:39:57 +01:00
Anton Khirnov 5792382269 fftools/cmdutils: check valid flags for OPT_TYPE_FUNC
SPEC and OFFSET do not make sense for functions.
2023-12-22 11:39:57 +01:00
Anton Khirnov 2f1bc3b424 fftools/cmdutils: include OPT_PERFILE in OPT_OFFSET
And analogously OPT_OFFSET in OPT_SPEC. Previously the inclusion would
be implicit and required all code to remember this.
2023-12-22 11:39:57 +01:00
Anton Khirnov 66fcfc0009 fftools/cmdutils: renumber option flags sequentially
Also, document them.
2023-12-22 11:39:57 +01:00
Anton Khirnov 5b1b132072 fftools/cmdutils: rename HAS_ARG to OPT_FUNC_ARG
For consistent namespacing with other option flags. Also, document and
enforce that it can only be set for func-type options.
2023-12-22 11:39:57 +01:00
Anton Khirnov d2e479a429 fftools: split off option types from other flags
These values are not actually flags, as only one of them can be
meaningfully set.
2023-12-22 11:39:57 +01:00
Anton Khirnov 074abeb57e fftools/ffmpeg_opt: move deprecated options to the end of the list
This way they don't clutter this already-cluttered code even further.
2023-12-22 11:39:57 +01:00
Anton Khirnov b472c46a70 fftools/cmdutils: simplify handling of the HAS_ARG option flag
This option flag only carries nontrivial information for options that
call a function, in all other cases its presence can be inferred from
the option type (bool options do not have arguments, all other types do)
and is thus nothing but useless clutter.

Change the option parsing code to infer its value when it can, and drop
the flag from options where it's not needed.
2023-12-22 11:39:57 +01:00
Anton Khirnov 25c98566e8 fftools/ffmpeg_opt: drop HAS_ARG from auto{scale,rotate}
It causes those options to be parsed as either
* -autofoo 0/1 (with an argument)
* -noautofoo   (without an argument)
This is unnecessary, confusing, and against the documentation; these are
also the only two bool options that take an argument.

This should not affect the users, as these options are on by default,
and are supposed to be used as -nofoo per the documentation.
2023-12-22 11:39:57 +01:00
Anton Khirnov dc2fc5a919 fftools/ffmpeg_filter: only set framerate for video
Otherwise an unitialized stack value would be copied to FPSConvContext.
As it's then never used, it tends not to be a problem in practice,
however it is UB and some compilers warn about it.
2023-12-22 11:39:57 +01:00
Anton Khirnov 6916105b11 fftools/ffmpeg_demux: set discard on the AVStream directly
Avoid taking an ugly detour through the decoder AVCodecContext.
2023-12-22 11:39:21 +01:00
Anton Khirnov b26407ccb8 lavf: allow setting AVStream.discard as an AVOption 2023-12-22 11:39:08 +01:00
Martin Storsjö 4f493659fd configure: Fix linking d3d12va in UWP mode
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-22 12:04:17 +02:00
Martin Storsjö 6d04518788 configure: Remove/factorize a redundant check for UWP mode
The check for UWP mode was duplicated from right above, in
d54127c41a.

Also, instead of several lines with "enabled uwp && ...", make one
"if enabled uwp; then" block.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-22 12:04:12 +02:00
Andreas Rheinhardt 45b4781e9a avcodec/v4l2_m2m: Remove redundant av_frame_unref()
This frame will be freed in the next line.

Reviewed-by: Zhao Zhili <quinkblack@foxmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-21 23:29:02 +01:00
Vittorio Giovara 05bfc03752 Add new vf_tiltandshift filter
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2023-12-21 17:16:16 -05:00
Rémi Denis-Courmont 0f05f9ed3e mlp: move pack_output pointer to decoder context
The current pack_output function pointer is a property of the decoder,
rather than a constant method provided by the DSP code. Indeed, except
for an unused initialisation, the field is never used in DSP code.
2023-12-21 22:42:34 +02:00
sunyuechi c933ff2779 lavc/takdsp: R-V V decorrelate_sr
C908:
decorrelate_sr_c: 95.5
decorrelate_sr_rvv_i32: 28.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-12-21 22:42:34 +02:00
sunyuechi 864174dd00 lavc/takdsp: R-V V decorrelate_ls
C908:
decorrelate_ls_c: 69.7
decorrelate_ls_rvv_i32: 27.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-12-21 22:42:34 +02:00
sunyuechi 21e2b6b501 checkasm/takdsp: add decorrelate_sm test
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-12-21 22:42:34 +02:00
sunyuechi c064823b95 checkasm/takdsp: add decorrelate_sr test
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-12-21 22:42:34 +02:00
sunyuechi 3bdb0fe511 checkasm/takdsp: add decorrelate_ls test
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-12-21 22:42:34 +02:00
Rémi Denis-Courmont cdd38a2ffe lavc/aacpsdsp: fix R-V V stereo interpolate
The penultimate loop iteration could pick any vl such that:
 vlenb/4 < vl <= vlenb/2
Thus if the total length is not a multiple of vlenb/2, the vfadd.vf
on the penultimate iteration would yield corrupt values for the last
iteration.

To avoid this, force vl = vlen/2 until the last iteration. Unfortunately
this latent bug is not reproducible with either hardware or QEMU as of now.
2023-12-21 17:54:23 +02:00
Rémi Denis-Courmont db32f75c63 lavc/opusdsp: simplify R-V V postfilter
This skips the round-trip to scalar register for the sliding 'x'
coefficients, improving performance by about 5%. The trick here is that
the vector slide-up instruction preserves elements in destination vector
until the slide offset.

The switch from vfslide1up.vf to vslideup.vi also allows the elimination
of data dependencies on consecutive slides. Since the specifications
recommend sticking to power of two offsets, we could slide as follows:

        vslideup.vi v8, v0, 2
        vslideup.vi v4, v0, 1
        vslideup.vi v12, v8, 1
        vslideup.vi v16, v8, 2

However in the device under test, this seems to make performance slightly
worse, so this is left for (in)validation with future better hardware.
2023-12-21 17:54:08 +02:00
Paul B Mahol 04cb307508 avformat/iamf_parse: fix yet annother logical coding error
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-21 12:24:54 -03:00
Paul B Mahol 0c03f4c6b9 avformat/iamfenc: fix logical coding error 2023-12-21 12:22:10 -03:00
Paul B Mahol 7a9aafde3d avformat/iamf_parse: fix another logical coding error
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-21 11:39:24 -03:00
James Almer 061c864a95 avformat/options: skip the none type group in stream_group_child_iterate()
Otherwise the function will not iterate through valid group types.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-21 10:34:11 -03:00
James Almer fa961bb383 ffmpeg_mux_init: use strtoll() to parse stream and group indexes
Long is 32 bits signed on Windows, and nb_stream{s,_groups} are both unsigned
int. In a realistic scenario this wont make a difference, but it's still
proper.

Also ensure the parsed string is an integer while at it.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-21 10:32:53 -03:00
James Almer 1747c2fc33 avutil/hwcontext_d3d12va: remove unused variables
Removes -Wunused-variable warnings.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-21 10:31:02 -03:00
James Almer 4ea6121f18 avutil/hwcontext_d3d12va: fix indentation in d3d12va_transfer_data()
Removes -Wmisleading-indentation warnings.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-21 10:31:02 -03:00
James Almer 4d78a9ac14 avutil/hwcontext_d3d12va: cast the input pointer array argument on av_image_copy calls
Removes -Wincompatible-pointer-types warnings.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-21 10:31:02 -03:00
Tong Wu bc4592a778 avutil/hwcontext_d3d12va: remove an unused function
It caused lacking a public declaration build error with
-Werror=missing-prototypes.

Since DXGI_FORMAT is moved to public since patch set V10, this function
is no longer useful. Now remove it.

Signed-off-by: Tong Wu <tong1.wu@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-21 10:31:02 -03:00
Martin Storsjö 327685bafe d3d12va: Add a missing include for the declaration of ff_d3d12va_get_surface_index
This fixes the following build error:

src/libavcodec/d3d12va_decode.c:49:10: error: no previous prototype for function
 'ff_d3d12va_get_surface_index' [-Werror,-Wmissing-prototypes]
   49 | unsigned ff_d3d12va_get_surface_index(const AVCodecContext *avctx,
      |          ^

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-21 13:55:16 +02:00
Martin Storsjö 1e42a48e37 configure: Add a --disable-version-tracking option
This disables regenerating ffversion.h whenever the checked out
git commit changes, speeding up development rebuilds.

Whenever this option is set, force the version to be printed as
"unknown" rather than showing potentially stale information.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-21 11:00:34 +02:00
Wenbin Chen 9415c2c11f libavfilter/vf_dnn_detect: Add initialized value to function pointer
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-21 16:15:23 +08:00
Wenbin Chen 233c44f735 libavfilter/vf_dnn_detect: Fix a control flow issue
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-21 16:15:23 +08:00
Tong Wu 6d5fbea289 avcodec/d3d12va_hevc: enable allow_profile_mismatch flag for d3d12va msp profile
Same as d3d11va, this flag enables main still picture profile for
d3d12va. User should add this flag when decoding main still picture
profile.

Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua 8482834209 Changelog: D3D12VA hardware accelerated H264, HEVC, VP9, AV1, MPEG-2 and VC1 decoding
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua ffa158edbd avcodec: add D3D12VA hardware accelerated VC1 decoding
The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua c6c05dd34a avcodec: add D3D12VA hardware accelerated MPEG-2 decoding
The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua b16fd96c5f avcodec: add D3D12VA hardware accelerated AV1 decoding
The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua 326288c70a avcodec: add D3D12VA hardware accelerated VP9 decoding
The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua cbb93c4ff6 avcodec: add D3D12VA hardware accelerated HEVC decoding
The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua 349ce30e4e avcodec: add D3D12VA hardware accelerated H264 decoding
The implementation is based on:
https://learn.microsoft.com/en-us/windows/win32/medfound/direct3d-12-video-overview

With the Direct3D 12 video decoding support, we can render or process
the decoded images by the pixel shaders or compute shaders directly
without the extra copy overhead, which is beneficial especially if you
are trying to render or post-process a 4K or 8K video.

The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua 142f727b9c libavutil: add hwcontext_d3d12va and AV_PIX_FMT_D3D12
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Zhao Zhili f72d781339 fftools/ffmpeg_enc: assert necessary frame fields before create encoder
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-21 19:30:25 +08:00
Zhao Zhili 42a4c59e59 fftools/ffmpeg_filter: remove semicolon after code block
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-21 19:30:11 +08:00
Zhao Zhili 7cd416792a fftools/ffmpeg_filter: fix NULL pointer dereference
In close_output(), a dummy frame is created with format NONE passed
to enc_open(), which isn't prepared for it. The NULL pointer
dereference happened at
av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth.

When fgt.graph is NULL, skip fg_output_frame() since there is
nothing to output.

frame #0: 0x0000005555bc34a4 ffmpeg_g`enc_open(opaque=0xb400007efe2db690, frame=0xb400007efe2d9f70) at ffmpeg_enc.c:235:44
frame #1: 0x0000005555bef250 ffmpeg_g`enc_open(sch=0xb400007dde2d4090, enc=0xb400007e4e2daad0, frame=0xb400007efe2d9f70) at ffmpeg_sched.c:1462:11
frame #2: 0x0000005555bee094 ffmpeg_g`send_to_enc(sch=0xb400007dde2d4090, enc=0xb400007e4e2daad0, frame=0xb400007efe2d9f70) at ffmpeg_sched.c:1571:19
frame #3: 0x0000005555bee01c ffmpeg_g`sch_filter_send(sch=0xb400007dde2d4090, fg_idx=0, out_idx=0, frame=0xb400007efe2d9f70) at ffmpeg_sched.c:2154:12
frame #4: 0x0000005555bcf124 ffmpeg_g`close_output(ofp=0xb400007e4e2d85b0, fgt=0x0000007d1790eb08) at ffmpeg_filter.c:2225:15
frame #5: 0x0000005555bcb000 ffmpeg_g`fg_output_frame(ofp=0xb400007e4e2d85b0, fgt=0x0000007d1790eb08, frame=0x0000000000000000) at ffmpeg_filter.c:2317:16
frame #6: 0x0000005555bc7e48 ffmpeg_g`filter_thread(arg=0xb400007eae2ce7a0) at ffmpeg_filter.c:2836:15
frame #7: 0x0000005555bee568 ffmpeg_g`task_wrapper(arg=0xb400007d8e2db478) at ffmpeg_sched.c:2200:21

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-21 19:29:53 +08:00
Zhao Zhili 5c3d2177e7 avformat/file: seek back to initial position for fd protocol
So user's fd can be passed to libavformat multiple times in sequence
without changing the position.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-21 19:29:18 +08:00
Zhao Zhili 287e22f745 avcodec/mediacodecenc: set quality in cq mode
From AOSP doc, these values are device and codec specific, but lower
values generally result in more efficient (smaller-sized) encoding.

For example, global_quality 50 on Pixel 6 results a 1080P 30 FPS
HEVC with 3744 kb/s, while global_quality 80 results 28178 kb/s.

Fix #10689

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-21 19:28:47 +08:00
Martin Storsjö f5e3e9e04e checkasm: Remove unnecessary const on scalar parameters
The ffmpeg coding style doesn't usually use const on scalar
parameters (or on the pointer values - as opposed to the type
that is pointed to, where it has a semantic meaning), contrary
to the dav1d coding style (where this was imported from).

This avoids warnings about differences in the type signatures
between declaration and definition of this function, with older
versions of MSVC.

The issue was observed with one version of MSVC 2017,
19.16.27024.1, with warnings like these:

    src/tests/checkasm/checkasm.c(969): warning C4028: formal parameter 3 different from declaration

The warning itself is bogus as the const here is harmless, and
newer versions of MSVC no longer warn about this.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-21 00:14:41 +02:00
James Almer 89215237dd avformat: remove ff_remove_stream_group()
It's unused.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-20 00:17:59 -03:00
James Almer 0a87bd02ee avutil/iamf: add missing doxy to free functions
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-19 11:15:44 -03:00
Martin Storsjö 76cd71bf0c fate: Allow running multiple rounds of tests with differing settings
This can be used to run tests multple times, with e.g. differing
QEMU settings, by adding something like this to the FATE configuration
file:

    target_exec="qemu-aarch64-static"
    fate_targets="fate-checkasm fate-cpu"

    fate_environments="sve128 sve256 sve512"
    sve128_env="QEMU_CPU=max,sve128=on"
    sve256_env="QEMU_CPU=max,sve256=on"
    sve512_env="QEMU_CPU=max,sve512=on"

It's also possible to customize the target_exec command further
by injecting a sufficiently quoted variable into it, which then can
be updated for each run, e.g. target_exec="\$(CUR_EXEC_CMD)".

For each of the environment names in fate_environments, the tests
that are run get the name suffixed on the fate tests in the
test log and fate report, e.g. "fate-checkasm-h264dsp_sve128".

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-19 13:34:25 +02:00
Martin Storsjö d0e215fffc fate: Allow overriding what targets to make for running the tests
This can be useful if doing testing of uncommon CPU extensions by
running tests with QEMU (by configuring with e.g.
"target_exec=qemu-aarch64"), by only running the checkasm tests,
to get a reasonable test coverage without excessive test runtime.

For such a config, setting fate_targets="fate-checkasm fate-cpu"
can be a good tradeoff.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-19 13:34:23 +02:00
Frank Plowman 7d7ba2175c libavformat/vvc: Make probe more conservative
Reduce false positives for VVC files by adding additional checks in
`vvc_probe`. Specifically, `nuh_temporal_id_plus1` is tested for valid
values in extra cases depending on the NAL unit type, as per ITU-T H.266
section 7.4.2.2.

Resolves trac #10703.

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-19 19:44:38 +08:00
Michael Niedermayer a6a553ba94
avcodec/cbs_vp8: fix GetBitContext setup
Fixes: abort()
Fixes: 64232/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5417957987319808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-19 00:27:26 +01:00
Martin Storsjö f80b2ce9fa gdigrab: Fix hwnd parameter issues
Converting from an integer to HWND (which is a pointer) requires
an explicit cast, otherwise Clang errors out like this:

    src/libavdevice/gdigrab.c:280:14: error: incompatible integer to pointer conversion assigning to 'HWND' (aka 'struct HWND__ *') from 'long' [-Wint-conversion]
      280 |         hwnd = strtol(name, &p, 0);
          |              ^ ~~~~~~~~~~~~~~~~~~~

(With GCC and MSVC, this was a mere warning, but with recent Clang,
this is an error.)

After adding a cast, all compilers also warn something like this:

    src/libavdevice/gdigrab.c:280:16: warning: cast to 'HWND' (aka 'struct HWND__ *') from smaller integer type 'long' [-Wint-to-pointer-cast]
      280 |         hwnd = (HWND) strtol(name, &p, 0);
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~

On Windows, long types are 32 bit, so to get a usable pointer, we
need to use long long. And interpret it as unsigned long long
while at it - i.e. using strtoull.

Finally, right above it, the code triggered the following warning:

    src/libavdevice/gdigrab.c:278:15: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
      278 |         char *p;
          |               ^

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-19 00:07:26 +02:00
Kalev Lember b391fdbf1a lavc/libopenh264: Drop openh264 runtime version checks
With the way the runtime checks are currently set up, every single
openh264 release, no matter how minor, is considered an ABI break and
requires ffmpeg recompilation. This is unnecessarily strict because it
doesn't allow downstream distributions to ship any openh264 bug fix
version updates without breaking ffmpeg's openh264 support.

Years ago, at the time when ffmpeg's openh264 support was merged,
openh264 releases were done without a versioned soname (the library was
just libopenh264.so, unversioned). Since then, starting with version
1.3.0, openh264 has started using versioned sonames and the intent has
been to bump the soname every time there's a new release with an ABI
change.

This patch drops the exact version check and instead adds a minimum
requirement on 1.3.0 to the configure script.

Signed-off-by: Kalev Lember <klember@redhat.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-18 23:59:51 +02:00
James Almer 25835e2593 avformat: Immersive Audio Model and Formats muxer
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:21:47 -03:00
James Almer 4ee05182b7 avformat: Immersive Audio Model and Formats demuxer
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:20:59 -03:00
James Almer 7f9308380f avformat/aviobuf: add ffio_read_leb() and ffio_write_leb()
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:19:36 -03:00
James Almer 0cc0d8c0b5 avcodec/get_bits: add get_leb()
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:19:36 -03:00
James Almer 12eac23637 avcodec/packet: add IAMF Parameters side data types
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:19:30 -03:00
James Almer ed670b9b98 ffmpeg: add support for muxing AVStreamGroups
Starting with IAMF support.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:18:09 -03:00
James Almer 556b596d1d avformat: introduce AVStreamGroup
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:18:05 -03:00
James Almer d2af93bbef avutil: introduce an Immersive Audio Model and Formats API
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:07:11 -03:00
Gyan Doshi be8a4f80b9 swr/swresample: avoid reapplication of firstpts
During a resampling operation where

1) user has specified first_pts
2) SWR_FLAG_RESAMPLE is not set initially (directly or otherwise)
3) first_pts has been fulfilled (always using hard compensation)

then upon first encountering a delay where a soft compensation is
required, swr_set_compensation will lead to another init of swr which
will reset outpts to the specified firstpts thus leading to an output
frame having its pts = firstpts. When the next input frame is received,
swr will see a large delay and inject silence from firstpts to the
current frame's pts. This can lead to severe desync and in worst case,
loss of audio playback.

Parameter firstpts initialized to AV_NOPTS_VALUE in swr_alloc and then
checked in swr_init to avoid resetting outpts, thus avoiding reapplication
of firstpts.

Fixes #4131.
2023-12-18 15:47:04 +05:30
Anton Khirnov 2ad0b8e0ea fftools/ffmpeg: use a mutex for enc_stats_write()
It may be called concurrently from different threads to write into the
same file.
2023-12-18 08:50:02 +01:00
Anton Khirnov 244d2fcc49 fftools/ffmpeg_mux: deduplicate uniniting EncStats 2023-12-18 08:50:02 +01:00
Anton Khirnov 6cb231e378 doc/ffmpeg: drop misleading claims from -stats_*_fmt
The {br}/{abr} directives are not limited to post-encoding, they can
also be used pre-muxing. The already-present {packet} tag describes this
more accurately, so just drop the assertions.
2023-12-18 08:50:02 +01:00
Anton Khirnov 02a4393647 fftools/ffmpeg: print keyframe information with -stats_* 2023-12-18 08:50:02 +01:00
Anton Khirnov 23c00d8c89 fftools/ffmpeg_mux_init: change 1-bit bitfields from int to unsigned
They cannot store 1 as signed, only 0 and -1.

Avoids warnings such as:
  implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
2023-12-18 08:50:02 +01:00
Anton Khirnov ca6f0192f2 fftools/cmdutils: change option flags to (1 << N) style
It is easier to read.
2023-12-18 08:50:02 +01:00
Anton Khirnov 7a7550ec28 fftools/ffmpeg_mux: factor timestamps processing out of write_packet() 2023-12-18 08:50:02 +01:00
Anton Khirnov 3dc319587f fftools/ffmpeg: deprecate -fps_mode/vsync drop
It depends on the ability of muxers to generate timestamps, which is
itself deprecated.
2023-12-18 08:50:02 +01:00
Anton Khirnov 8a11724a02 fftools/ffmpeg_mux: stop logging to AVFormatContext
Only the muxer itself is supposed to do that. Log to OutputStream
instead.

Drop now-redundant information from the logged string.
2023-12-18 08:50:02 +01:00
hung kuishing 6d129d8df5 doc/examples/qsv_transcode: EINVAL is more appropriate and ENAVAIL will fail build with visual studio
Signed-off-by: clarkh <hungkuishing@outlook.com>
2023-12-18 09:39:24 +08:00
Martin Storsjö 8d24a28d06 riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
The names of the cpu flags, when parsed from a string with
av_parse_cpu_caps, are parsed by the libavutil eval functions. These
interpret dashes as subtractions. Therefore, these previous cpu flag
names haven't been possible to set.

Use the official names for these extensions, as the previous ad-hoc
names wasn't parseable.

libavutil/tests/cpu tests that the cpu flags can be set, and prints
the detected flags.

Acked-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-17 23:47:04 +02:00
Lena d7ac7101ee gdigrab: allow capturing a window by its handle
x11grab can capture windows by their ID, but gdigrab can only capture
windows by their names, internally calling FindWindowW to lookup its
handle.

This patch simply allows the user to specify a window handle directly.
Signed-off-by: Lena <lena@nihil.gay>
2023-12-17 19:14:08 +01:00
Rémi Denis-Courmont 419145c11b lavc/vc1dsp: fix R-V V vector lengths
The 8x4 and 4x4 use a needlessly large multiplier (unless/until we care
about embedded 64-bit-vector hardware). This is merely suboptimal.

The 8x4 case also uses an incorrect vector length, which leads to incorrect
behaviour on future/hypothetical hardware with 256-bit or larger vectors.

Pointed-out-by: Martin Storsjö <martin@martin.st>
2023-12-17 09:27:52 +02:00
Zhao Zhili eddac2aed4 configure: check VTPixelTransferSessionCreate for scale_vt
It's available on macOS since 10.8, but not available on iOS until
16.0.

Reported and tested by xufuji456.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-17 13:52:14 +08:00
Martin Storsjö b51d9eb58e riscv: vc1dsp: Don't check vlenb before checking the CPU flags
We can't call ff_get_rv_vlenb() if we don't have RVV available
at all.

Acked-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-16 22:30:26 +02:00
Wenbin Chen 1fa3346c70 libavfilter/vf_dnn_detect: Add yolov4 support
The difference of yolov4 is that sigmoid function needed to be applied
on x, y coordinates. Also make it compatiple with NHWC output as the
yolov4 model from openvino model zoo has NHWC output layout.

Model refer to: https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v4-tf

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:51:52 +08:00
Wenbin Chen a882fc0294 libavfilter/vf_dnn_detect: Add yolov3 support
Add yolov3 support. The difference of yolov3 is that it has multiple
outputs in different scale to perform better on both large and small
object.

The model detail refer to: https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v3-tf

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:50:50 +08:00
Wenbin Chen da02836b9d libavfilter/vf_dnn_detect: Add input pad
Add input pad to get model input resolution. Detection models always
have fixed input size. And the output coordinators are based on the
input resolution, so we need to get input size to map coordinators to
our real output frames.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:50:37 +08:00
Wenbin Chen 22652b576c libavfiter/dnn_backend_openvino: Add multiple output support
Add multiple output support to openvino backend. You can use '&' to
split different output when you set output name using command line.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:50:16 +08:00
Leo Izen 1f56bfc986
avformat/hls: use av_strlcopy instead of strncpy
Avoids a -Wstringop-truncation warning by using av_strlcopy instead of
strncpy. Additionally, prints a warning to the log context if this
truncation occurred.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-12-16 04:28:20 -05:00
Rémi Denis-Courmont 918b3ed2d5 lavc/lpc: R-V V compute_autocorr
The loop iterates over the length of the vector, not the order. This is
to avoid reloading the same data for each lag value. However this means
the loop only works if the maximum order is no larger than VLENB.

The loop is roughly equivalent to:

    for (size_t j = 0; j < lag; j++)
        autoc[j] = 1.;

    while (len > lag) {
        for (ptrdiff_t j = 0; j < lag; j++)
            autoc[j] += data[j] * *data;
        data++;
        len--;
    }

    while (len > 0) {
        for (ptrdiff_t j = 0; j < len; j++)
            autoc[j] += data[j] * *data;
        data++;
        len--;
    }

Since register pressure is only at 50%, it should be possible to implement
the same loop for order up to 2xVLENB. But this is left for future work.

Performance numbers are all over the place from ~1.25x to ~4x speedups,
but at least they are always noticeably better than nothing.
2023-12-16 11:18:01 +02:00
Leo Izen 1a04959532
fate/jpegxl: add multiframe permuted TOC image parser test
This test verifies the parser's handling of multiframe JXL files that
have an entropy-encoded permuted table of contents for each frame. The
testcase is actually six JXL codestreams concatenated together, and the
parser needs to be able to find the boundaries.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-12-15 11:52:43 -05:00
Wenbin Chen 22bebfa5e6 libavfilter/vf_dnn_detect: Set used pointer to NULL
Set used pointer to NULL in case it leaks the storage.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Wenbin Chen a1e8892a8a libavfilter/vf_dnn_detect: Fix uninitialized variables error
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Wenbin Chen 833722343a libavfilter/vf_dnn_detect: Add NULL pointer check
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Wenbin Chen e01afa1c6d libavfilter/vf_dnn_detect: Fix an incorrect expression
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Martin Storsjö 081d69b78d avfoundation: Fix version checks
<OS>_VERSION_MAX_ALLOWED indicates what version is available in
the SDK, while <OS>_VERSION_MIN_REQUIRED is the version we can
assume is available, i.e. similar to what is set with e.g.
-miphoneos-version-min on the command line.

This fixes build errors like these:

src/libavdevice/avfoundation.m:788:37: error: 'AVCaptureDeviceTypeContinuityCamera' is only available on macOS 14.0 or newer [-Werror,-Wunguarded-availability-new]
            [deviceTypes addObject: AVCaptureDeviceTypeContinuityCamera];
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDevice.h:551:38: note: 'AVCaptureDeviceTypeContinuityCamera' has been marked as being introduced in macOS 14.0 here, but the deployment target is macOS 13.0.0
AVF_EXPORT AVCaptureDeviceType const AVCaptureDeviceTypeContinuityCamera API_AVAILABLE(macos(14.0), ios(17.0), macCatalyst(17.0), tvos(17.0)) API_UNAVAILABLE(visionos) API_UNAVAILABLE(watchos);
                                     ^

Alternatively, we could use these more modern APIs, if enclosed
in suitable @available() checks.
2023-12-15 11:27:23 +01:00
Nuo Mi ce0c178a40
avcodec/cbs_h266: more restrictive check on pps_tile_idx_delta_val
Fixes: out of array access
Fixes: 62603/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5837632490569728

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-14 23:53:10 +01:00
Pierre-Anthony Lemieux a1384b4e86
avcodec/jpeg2000htdec: check if block decoding will exceed internal precision
Intended to replace https://patchwork.ffmpeg.org/project/ffmpeg/patch/20230802000135.26482-3-michael@niedermayer.cc/
with a more accurate block decoding magnitude bound.

Fixes: 62433/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5828618092937216
Fixes: 58299/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5828618092937216
Previous-version-reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-14 23:53:10 +01:00
Michael Niedermayer aa1e768120
tools/target_dec_fuzzer: Adjust threshold for VMIX
Fixes: Timeout
Fixes: 62286/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMIX_fuzzer-5155237134204928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-14 23:34:46 +01:00
Paul B Mahol bc45a9c6de
tests/fate: add pixelize filter tests
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-14 23:34:46 +01:00
Paul B Mahol 41ee95dc52
tests/fate: add median filter test
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-14 23:34:46 +01:00
Anton Khirnov 5c5140ded2 fftools/ffmpeg_sched: track dts+duration as last_dts
This should be slightly (probably negligibly) more accurate for
scheduling, but mainly it improves the final reported time.

Reported-by: Paul B Mahol
2023-12-14 20:16:54 +01:00
Anton Khirnov 2305091a3a fftools/ffmpeg: update the reported timestamp at the end
Reported-by: microchip
2023-12-14 20:16:54 +01:00
Anton Khirnov 98d706b818 fftools/ffmpeg_sched: move trailing_dts() higher up
Will be useful in following commit.
2023-12-14 20:16:54 +01:00
Anton Khirnov 4549f20222 fftools/ffmpeg: drop OutputFile.sq_encode
It is unused since d119ae2fd8
2023-12-14 20:16:54 +01:00
Anton Khirnov 0d01e61807 fftools/ffmpeg_mux: move OutputStream.sq_idx_mux to private data
It should not be accessed outside of ffmpeg_mux*
2023-12-14 20:16:54 +01:00
Anton Khirnov 2c54097614 fftools/ffmpeg_demux: move InputFile.readrate to private data
It is not used outside of ffmpeg_demux.
2023-12-14 20:16:53 +01:00
Anton Khirnov 116bc5a9f3 fftools/ffmpeg: drop unused InputFile.eof_reached 2023-12-14 20:16:53 +01:00
Anton Khirnov 882bc8049d fftools/ffmpeg: move InputStream.codec_desc to private data
It is not used outside of ffmpeg_demux.
2023-12-14 20:16:53 +01:00
Anton Khirnov 9afe3f5274 fftools/ffmpeg: move InputStream.discard to private data
It is not used outside of ffmpeg_demux.
2023-12-14 20:16:53 +01:00
Anton Khirnov 4224895a87 fftools/ffmpeg: replace OutputStream.file_index by a pointer
Reduces the need to use the output_files global array.
2023-12-14 20:16:53 +01:00
Anton Khirnov 0fcea80b2a fftools/ffmpeg: replace InputStream.file_index by a pointer
Reduces the need to use the input_files global array.
2023-12-14 20:16:53 +01:00
Anton Khirnov 84201d8af6 fftools/ffmpeg_filter: move FilterGraph.graph to FilterGraphThread
The AVFilterGraph is fully owned by the filtering thread and should
never be accessed outside of it.
2023-12-14 20:16:53 +01:00
Anton Khirnov 06d5dc11db fftools/ffmpeg_sched: actually initialize/destroy schedule_lock 2023-12-14 10:16:39 +01:00
Anton Khirnov 5256b2fbe6 fftools/ffmpeg_mux: print latency information in -debug_ts muxing output 2023-12-14 08:11:05 +01:00
Anton Khirnov 9d7000b1be fftools/ffmpeg: attach wallclock timing information to packets and frames
Will become useful in following commits.
2023-12-14 08:11:05 +01:00
Anton Khirnov c9f38210fc fftools/ffmpeg: merge DemuxPktData into FrameData
This way we can propagate arbitrary data from the demuxer all the way
into the muxer, using a single struct.
2023-12-14 08:11:05 +01:00
Marton Balint 5475f665f6 avutil/imgutils: add new function av_image_fill_color()
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-12-13 18:51:32 +01:00
Marton Balint 0ae8afffb4 avutil/imgutils: factorize a fill color function
In preparation for making it public.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-12-13 18:51:32 +01:00
Marton Balint 74a269c3ce avutil/imgutils: add support for 32bit pixel format for av_image_fill_black()
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-12-13 18:51:32 +01:00
Marton Balint 32cb4504f3 avutil/imgutils: fix av_image_fill_black() for some pixel formats
- Fixes YA formats, because previous code always assumed alpha as the 4th
  component.
- Fixes PAL format (as long as 0 is black, as in a systematic palette), because
  previous code assumed it as limited Y.
- Fixes XYZ format because it does not need nonzero chroma components
- Fixes xv30be as the bitstream mode got merged to the non-bitstream mode.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-12-13 18:51:32 +01:00
Marton Balint 1f721beeff avutil/tests/imgutils: add tests for av_image_fill_black()
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-12-13 18:51:32 +01:00
Marton Balint 3c5e82316e avutil/tests/imgutils: factorize basic tests to new function
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-12-13 18:51:32 +01:00
Thilo Borgmann 03ac6aa627 avdevice/audiotoolbox: Fix availability macro check
Since OSX 10.10 the availability macros expand into a 6 digit number instead of a 4 digit number.
Fixes compilation for OSX version [10.0, 12.0[.
2023-12-12 22:01:14 +01:00
James Almer 7cc4b306eb ffmpeg_sched: initialize have_unchoked
Should fix valgrind warnings about Conditional jump or move depends on uninitialised value.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-12 16:10:28 -03:00
James Almer 34d56e1766 x86/aacencdsp: clear the high bits for size in ff_abs_pow34_sse
Fixes checkasm failures on win64.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-12 15:24:08 -03:00
James Almer 96f646cdc2 avformat/movenc: rename MOVMuxContext.nb_streams to nb_tracks
It's more appropiate given what it keeps a count of.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-12 08:54:40 -03:00
Anton Khirnov d119ae2fd8 fftools/ffmpeg: convert to a threaded architecture
Change the main loop and every component (demuxers, decoders, filters,
encoders, muxers) to use the previously added transcode scheduler. Every
instance of every such component was already running in a separate
thread, but now they can actually run in parallel.

Changes the results of ffmpeg-fix_sub_duration_heartbeat - tested by
JEEB to be more correct and deterministic.
2023-12-12 08:24:18 +01:00
Anton Khirnov 9b8cc36ce0 fftools/ffmpeg: add thread-aware transcode scheduling infrastructure
See the comment block at the top of fftools/ffmpeg_sched.h for more
details on what this scheduler is for.

This commit adds the scheduling code itself, along with minimal
integration with the rest of the program:
* allocating and freeing the scheduler
* passing it throughout the call stack in order to register the
  individual components (demuxers/decoders/filtergraphs/encoders/muxers)
  with the scheduler

The scheduler is not actually used as of this commit, so it should not
result in any change in behavior. That will change in future commits.
2023-12-12 08:24:18 +01:00
Anton Khirnov ee2a8cbfd1 fftools/ffmpeg_enc: move encoding to a separate thread
As for the analogous decoding change, this is only a preparatory step to
a fully threaded architecture and does not yet make encoding truly
parallel. The main thread will currently submit a frame and wait until
it has been fully processed by the encoder before moving on. That will
change in future commits after filters are moved to threads and a
thread-aware scheduler is added.

This code suffers from a known issue -  if an encoder with a sync queue
receives EOF it will terminate after processing everything it currently
has, even though the sync queue might still be triggered by other
threads. That will be fixed in following commits.
2023-12-12 08:24:18 +01:00
Anton Khirnov 66e78e9680 fftools/ffmpeg_demux: switch from AVThreadMessageQueue to ThreadQueue
* the code is made shorter and simpler
* avoids constantly allocating and freeing AVPackets, thanks to
  ThreadQueue integration with ObjPool
* is consistent with decoding/filtering/muxing
* reduces the diff in the future switch to thread-aware scheduling

This makes ifile_get_packet() always block. Any potential issues caused
by this will be resolved by the switch to thread-aware scheduling in
future commits.
2023-12-12 08:24:18 +01:00
Anton Khirnov 75efe530ce fftools/ffmpeg_mux: move bitstream filtering to the muxer thread
This will be the appropriate place for it after the rest of transcoding
is switched to a threaded architecture.
2023-12-12 08:24:18 +01:00
Anton Khirnov 1983507b6e fftools/ffmpeg_mux: add muxing thread private data
To be used for data that never needs to be visible outside of the muxer
thread. Start by moving the muxed AVPacket in there.
2023-12-12 08:24:18 +01:00
Anton Khirnov f37a741f42 fftools/ffmpeg_filter: reindent 2023-12-12 08:24:18 +01:00
Anton Khirnov 40e1cf1cd2 fftools/ffmpeg_filter: buffer sub2video heartbeat frames like other frames
Otherwise they'd be silently ignored if received by the filtering thread
before the filtergraph can be initialized, which would make the output
dependent on the order in which frames from different inputs arrive.
2023-12-12 08:24:18 +01:00
Anton Khirnov d35c05cb9e fftools/ffmpeg_filter: move filtering to a separate thread
As previously for decoding, this is merely "scaffolding" for moving to a
fully threaded architecture and does not yet make filtering truly
parallel - the main thread will currently wait for the filtering thread
to finish its work before continuing. That will change in future commits
after encoders are also moved to threads and a thread-aware scheduler is
added.
2023-12-12 08:24:18 +01:00
Anton Khirnov 4b8a171beb fftools/ffmpeg_filter: make sub2video heartbeat more robust
Avoid making decisions based on current graph input state, which makes
the output dependent on the order in which the frames from different
inputs are interleaved.

Makes the output of fate-filter-overlay-dvdsub-2397 more correct - the
subtitle appears two frames later, which is closer to its PTS as stored
in the file.
2023-12-12 08:24:18 +01:00
Zhao Zhili 7665139656 examples/transcode: fix log message
'encoder' can be audio or video encoder.
2023-12-12 00:35:49 +01:00
Vittorio Giovara 944936ee1d lavd/avfoundation: Use correct preprocessing directive
Fixes compilation, introduced in e37b15e.

src/libavdevice/avfoundation.m:799:10: error: invalid preprocessing directive
        #elseif (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED < 140000)
2023-12-11 18:38:09 +01:00
sunyuechi 98596f90f4 lavc/aacencdsp: R-V V abs_pow34
C908:
abs_pow34_c: 535.5
abs_pow34_rvv_f32: 337.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-12-11 18:42:07 +02:00
sunyuechi 1c3620b2bb checkasm: test for abs_pow34
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-12-11 18:42:07 +02:00
sunyuechi e880a97e7c lvac/aacenc: add ff_aac_dsp_init
This is for clarity and use in testing, consistent with other parts of the code.

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-12-11 18:42:04 +02:00
Rémi Denis-Courmont 272d0c164d lavc/lpc: R-V V apply_welch_window
apply_welch_window_even_c:       617.5
apply_welch_window_even_rvv_f64: 235.0
apply_welch_window_odd_c:        709.0
apply_welch_window_odd_rvv_f64:  256.5
2023-12-11 18:17:43 +02:00
xufuji456 341a483b08 avdevice/audiotoolbox: silence warning with new api
Building with macOS platform, the compiler has a warning: 'kAudioObjectPropertyElementMaster' is deprecated in macOS 12.0

Signed-off-by: xufuji456 <839789740@qq.com>
2023-12-11 16:39:21 +01:00
Benjamin Cheng 185871fdd3 hwcontext_vulkan: guard unistd.h include
win32 typically doesn't have unistd.h, so always including it will break
MSVC builds. The usage of those POSIX functions are already guarded by
_WIN32, so use that to guard unistd.h include as well.
2023-12-11 16:36:56 +01:00
xufuji456 e37b15e26f avdevice/avfoundation: replace deprecated AVCaptureDevice
Building with iOS platform, the compiler has a warning: "'devicesWithMediaType:' is deprecated: first deprecated in iOS 10.0 - Use AVCaptureDeviceDiscoverySession instead"

Signed-off-by: xufuji456 <839789740@qq.com>
2023-12-11 15:47:26 +01:00
Marth64 1439784ff0 doc/ffmpeg: fix -copy_ts typo, should be -copyts
Signed-off-by: Marth64 <marth64@proxyid.net>
2023-12-11 16:17:15 +05:30
Anton Khirnov 5fdbc2a1f9 tools/general_assembly: avoid using DateTime->is_between()
It was added relatively recently and is not available everywhere.
2023-12-11 10:01:44 +01:00
Vittorio Giovara 12e25af7a8 MAINTAINERS: Remove older s3tc entry
Missed from a5b2b22d9a.
2023-12-10 03:25:23 -05:00
Gyan Doshi b9fd3e7a88 avfilter/select: initialize prev_selected_n to NAN
As per the doc, prev_selected_n should be NAN at the start.
However, this was never set.
2023-12-10 09:29:50 +05:30
Marth64 715e5e3e23 doc/bitstream_filters: add setts example 2023-12-10 01:44:38 +01:00
Marth64 d06518e448 doc/ffmpeg: AV_FMT_DISCONT typo should be AVFMT_TS_DISCONT 2023-12-10 01:36:00 +01:00
Andreas Rheinhardt b021bc4a47 avformat/webpenc: Write correct size for single images when unseekable
The earlier code writes the file and then tries to patch up
the size later. This is avoidable for the common case of
a single image because one can know the complete size
in advance and write it.

Fixes ticket #4609.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-09 06:29:42 +01:00
Andreas Rheinhardt 8283db7fb0 avformat/webpenc: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-09 06:29:42 +01:00
Andreas Rheinhardt 18d7a97f9e avformat/webpenc: Return early to reduce indentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-09 06:29:42 +01:00
nilfm 5f4b7bf2b5 avfilter/vf_libvmaf: fix string comparison bug
The libvmaf filter was doing substring checks in place of string equality
comparisons. This led to a bug when the user specified the pooling method
"harmonic_mean", since "mean" was checked first and the substring comparison
returned true. This patch changes all substring comparisons for string equality
comparisons. This is both correct and more efficient than the existing method.

Signed-off-by: nilfm <nilf@netflix.com>
2023-12-08 10:32:46 -08:00
Rémi Denis-Courmont b3825bbe45 riscv: test for assembler support
This should fix the build on LLVM 16 and earlier, at the cost of turning
all non-RVV optimisations off.
2023-12-08 17:21:09 +02:00
sunyuechi 0b9d009b4a lavc/vc1dsp: R-V V inv_trans
C908:
vc1dsp.vc1_inv_trans_4x4_dc_c:      125.7
vc1dsp.vc1_inv_trans_4x4_dc_rvv_i32: 53.5
vc1dsp.vc1_inv_trans_4x8_dc_c:      230.7
vc1dsp.vc1_inv_trans_4x8_dc_rvv_i32: 65.5
vc1dsp.vc1_inv_trans_8x4_dc_c:      228.7
vc1dsp.vc1_inv_trans_8x4_dc_rvv_i64: 64.5
vc1dsp.vc1_inv_trans_8x8_dc_c:      476.5
vc1dsp.vc1_inv_trans_8x8_dc_rvv_i64: 80.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-12-08 17:20:48 +02:00
Mikhail Nitenko 0f745b74ec lavc/aarch64: h264qpel, add 10-bit lowpass_8_10 based functions
Benchmarks                         A53      A55     A72     A76
avg_h264_qpel_8_mc01_10_c:        936.5    924.0   656.0   504.7
avg_h264_qpel_8_mc01_10_neon:     234.7    202.0   120.7    63.2
avg_h264_qpel_8_mc02_10_c:        921.0    920.0   669.2   493.7
avg_h264_qpel_8_mc02_10_neon:     202.0    173.2   102.7    58.5
avg_h264_qpel_8_mc03_10_c:        936.5    924.0   656.0   509.5
avg_h264_qpel_8_mc03_10_neon:     236.2    203.7   120.0    63.2
avg_h264_qpel_8_mc10_10_c:       1441.0   1437.7   806.7   478.5
avg_h264_qpel_8_mc10_10_neon:     325.7    324.0   153.7    94.2
avg_h264_qpel_8_mc11_10_c:       2160.7   2148.2  1366.7   906.7
avg_h264_qpel_8_mc11_10_neon:     492.0    464.0   242.5   134.5
avg_h264_qpel_8_mc13_10_c:       2157.0   2138.2  1357.0   908.2
avg_h264_qpel_8_mc13_10_neon:     494.0    467.2   242.0   140.0
avg_h264_qpel_8_mc20_10_c:       1433.5   1410.0   785.2   486.0
avg_h264_qpel_8_mc20_10_neon:     293.7    289.7   138.0    91.5
avg_h264_qpel_8_mc30_10_c:       1458.5   1461.7   813.7   483.2
avg_h264_qpel_8_mc30_10_neon:     341.7    339.2   154.0    95.2
avg_h264_qpel_8_mc31_10_c:       2194.7   2197.2  1358.7   928.0
avg_h264_qpel_8_mc31_10_neon:     520.0    495.0   245.5   142.5
avg_h264_qpel_8_mc33_10_c:       2188.0   2205.5  1356.7   910.7
avg_h264_qpel_8_mc33_10_neon:     521.0    494.5   245.7   145.7
avg_h264_qpel_16_mc01_10_c:      3717.2   3595.0  2610.0  2012.0
avg_h264_qpel_16_mc01_10_neon:    920.5    791.5   483.2   240.5
avg_h264_qpel_16_mc02_10_c:      3684.0   3633.0  2659.0  1919.7
avg_h264_qpel_16_mc02_10_neon:    790.7    678.2   409.2   217.0
avg_h264_qpel_16_mc03_10_c:      3726.5   3596.0  2606.7  2010.0
avg_h264_qpel_16_mc03_10_neon:    922.0    792.5   483.2   239.7
avg_h264_qpel_16_mc10_10_c:      5912.0   5803.2  3241.5  1916.7
avg_h264_qpel_16_mc10_10_neon:   1267.5   1277.2   616.5   365.0
avg_h264_qpel_16_mc11_10_c:      8599.2   8482.5  5338.0  3616.2
avg_h264_qpel_16_mc11_10_neon:   1913.0   1827.0   956.2   542.2
avg_h264_qpel_16_mc13_10_c:      8643.7   8488.5  5388.0  3628.5
avg_h264_qpel_16_mc13_10_neon:   1914.7   1828.7   969.2   530.5
avg_h264_qpel_16_mc20_10_c:      5719.5   5641.0  3147.0  1946.2
avg_h264_qpel_16_mc20_10_neon:   1139.5   1150.0   539.5   344.0
avg_h264_qpel_16_mc30_10_c:      5930.0   5872.5  3267.5  1918.0
avg_h264_qpel_16_mc30_10_neon:   1331.5   1341.2   616.5   369.5
avg_h264_qpel_16_mc31_10_c:      8758.7   8697.7  5353.0  3630.7
avg_h264_qpel_16_mc31_10_neon:   2018.7   1941.7   982.2   574.7
avg_h264_qpel_16_mc33_10_c:      8683.2   8675.2  5339.2  3634.7
avg_h264_qpel_16_mc33_10_neon:   2019.7   1940.2   994.5   566.0
put_h264_qpel_8_mc01_10_c:        854.2    843.0   599.2   478.0
put_h264_qpel_8_mc01_10_neon:     192.7    168.0   101.7    56.7
put_h264_qpel_8_mc02_10_c:        766.5    760.0   550.2   441.0
put_h264_qpel_8_mc02_10_neon:     160.0    139.2    88.7    53.0
put_h264_qpel_8_mc03_10_c:        854.2    843.0   599.2   479.0
put_h264_qpel_8_mc03_10_neon:     194.2    169.7   102.0    56.2
put_h264_qpel_8_mc10_10_c:       1352.7   1353.7   749.7   446.7
put_h264_qpel_8_mc10_10_neon:     289.7    294.2   135.5    88.5
put_h264_qpel_8_mc11_10_c:       2080.0   2066.2  1309.5   876.7
put_h264_qpel_8_mc11_10_neon:     450.0    429.7   229.7   131.2
put_h264_qpel_8_mc13_10_c:       2074.7   2060.2  1294.5   870.5
put_h264_qpel_8_mc13_10_neon:     452.5    434.5   226.5   130.0
put_h264_qpel_8_mc20_10_c:       1221.5   1216.0   684.5   399.7
put_h264_qpel_8_mc20_10_neon:     257.7    262.5   121.2    78.7
put_h264_qpel_8_mc30_10_c:       1379.0   1374.7   757.2   449.5
put_h264_qpel_8_mc30_10_neon:     305.7    310.2   135.5    86.5
put_h264_qpel_8_mc31_10_c:       2109.2   2119.7  1299.5   878.0
put_h264_qpel_8_mc31_10_neon:     478.0    458.5   226.0   137.2
put_h264_qpel_8_mc33_10_c:       2101.5   2115.2  1306.5   887.0
put_h264_qpel_8_mc33_10_neon:     479.0    458.7   229.7   141.7
put_h264_qpel_16_mc01_10_c:      3485.7   3396.7  2460.5  1914.5
put_h264_qpel_16_mc01_10_neon:    752.5    665.5   397.0   213.2
put_h264_qpel_16_mc02_10_c:      3103.5   3023.2  2154.7  1720.7
put_h264_qpel_16_mc02_10_neon:    622.7    551.2   347.7   196.2
put_h264_qpel_16_mc03_10_c:      3486.2   3394.0  2436.5  1917.7
put_h264_qpel_16_mc03_10_neon:    754.0    666.5   397.0   215.7
put_h264_qpel_16_mc10_10_c:      5533.0   5488.5  2989.0  1783.0
put_h264_qpel_16_mc10_10_neon:   1123.5   1165.2   535.2   334.7
put_h264_qpel_16_mc11_10_c:      8437.7   8281.2  5209.0  3510.7
put_h264_qpel_16_mc11_10_neon:   1745.0   1697.0   878.5   513.5
put_h264_qpel_16_mc13_10_c:      8567.7   8468.0  5221.5  3528.0
put_h264_qpel_16_mc13_10_neon:   1751.7   1698.2   889.2   507.0
put_h264_qpel_16_mc20_10_c:      4907.5   4885.0  2786.2  1607.5
put_h264_qpel_16_mc20_10_neon:    995.5   1034.5   475.5   307.0
put_h264_qpel_16_mc30_10_c:      5579.7   5537.7  3045.2  1789.5
put_h264_qpel_16_mc30_10_neon:   1187.5   1231.2   532.5   334.5
put_h264_qpel_16_mc31_10_c:      8677.2   8672.5  5204.2  3516.0
put_h264_qpel_16_mc31_10_neon:   1850.7   1813.2   893.0   545.2
put_h264_qpel_16_mc33_10_c:      8688.7   8671.2  5223.2  3512.0
put_h264_qpel_16_mc33_10_neon:   1851.7   1814.2   908.5   535.2

Signed-off-by: Mikhail Nitenko <mnitenko@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-07 23:20:14 +02:00
Haihao Xiang f89cff96d0 lavu/hwcontext_qsv: Make sure hardware vendor is Intel for qsv on d3d11va
When multiple hardwares are available, the default one might not be
Intel Hardware. We can use option vendor_id to choose the required
vendor.

Tested-by: Artem Galin <artem.galin@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-12-07 10:32:16 +08:00
Haihao Xiang e5f8b5313e doc/ffmpeg: Update the description about d3d11va
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-12-07 10:32:16 +08:00
Artem Galin a556be69a7 lavu/hwcontext_d3d11va: Add option vendor_id
User may choose the hardware via option vendor_id when multiple
hardwares are available.

Signed-off-by: Artem Galin <artem.galin@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-12-07 10:32:16 +08:00
Cosmin Stejerean 737ede405b avfilter/bwdif: account for chroma sub-sampling in min size calculation
The current logic for detecting frames that are too small for the
algorithm does not account for chroma sub-sampling, and so a sample
where the luma plane is large enough, but the chroma planes are not
will not be rejected. In that event, a heap overflow will occur.

This change adjusts the logic to consider the chroma planes and makes
the change to all three bwdif implementations.

Fixes #10688

Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at>
Reviewed-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Philip Langdale <philipl@overt.org>
2023-12-07 10:00:12 +08:00
sunyuechi 8bdb663062 lavc/ac3dsp: R-V V float_to_fixed24
c910
    float_to_fixed24_c: 2207.2
    float_to_fixed24_rvv_f32: 696.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-12-06 16:04:22 +02:00
Paul B Mahol ebfd3912e9 avfilter/asrc_flite: use streaming function
Fix continuous accumulation of audio samples for big txt inputs.
2023-12-06 10:52:46 +01:00
Paul B Mahol d793af982e avfilter/asrc_flite: switch to activate
Allows to set EOF timestamp.
2023-12-06 10:52:45 +01:00
Anton Khirnov 99d2fa38ad fftools/ffmpeg: make sure FrameData is writable when we modify it
Also, add a function that returns const FrameData* for cases that only
read from it.
2023-12-06 10:30:28 +01:00
Anton Khirnov 1d536e0283 fftools/ffmpeg_filter: track input/output index in {Input,Output}FilterPriv
Will be useful in following commits.
2023-12-06 10:01:21 +01:00
Anton Khirnov c6483f1c2a lavfi/buffersink: avoid leaking peeked_frame on uninit 2023-12-06 10:01:09 +01:00
Nuo Mi e78c6a1f2c MAINTAINERS: add myself as vvc maintainer 2023-12-05 20:51:37 +01:00
Paul B Mahol 3047f05a99 tests/fate: add asegment filter tests 2023-12-05 14:50:40 +01:00
Paul B Mahol 7e453dad3c avcodec/qoadec: fix overreads and fix packet size check 2023-12-05 14:50:21 +01:00
Jean-Baptiste Kempf 6e26a5a64e doc/developer: require asm for RISC-V
Explicitly document our usage of assembly, following suit with other
architectures.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2023-12-05 14:44:18 +01:00
Michael Niedermayer 22daf2148f
avcodec/av1dec: Fix resolving zero divisor
Fixes: Out of array read
Fixes: global-buffer-overflow-AV1

Found-by: "Leonelli, Matteo" <matteo.leonelli@cispa.de>
Tested-by: "Wang, Fei W" <fei.w.wang@intel.com>
Reviewed-by: "Wang, Fei W" <fei.w.wang@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-05 12:38:16 +01:00
Michael Niedermayer 4cdf2c7f76
avformat/mov: Ignore duplicate ftyp
Fixes: switch_1080p_720p.mp4
Found-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-05 12:12:10 +01:00
Leo Izen b60d39fbe2
fate/jpegxl: add parser test for extboxes and small files
Add a fate test for the above commits fixing extremely small files or
files with extended box sizes.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-12-05 05:54:58 -05:00
Leo Izen c4be080e65
avcodec/jpegxl_parser: fix parsing sequences of extremely small files
This patch allows the JXL parser to parse sequences of extremely small
files concatenated together. (e.g. smaller than the parser buffer)

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-12-05 05:54:34 -05:00
Leo Izen 019b3ea65a
avcodec/jpegxl_parse{,r}: use correct ISOBMFF extended size location
According to ISO/IEC 14996-12, size == 1 means a 64-bit extended-size
field occurs *after* the 32-bit box type, not before. This fix should
allow correct parsing of JXL files with extended-size boxes.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-12-05 05:53:32 -05:00
Haihao Xiang 35a555e2b9 lavfi/vf_vpp_qsv: set the default value of async_depth to 4
Both qsv encoders and decoders use 4 as the default value of
async_depth, let's use 4 as the default value for vpp_qsv filter too.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-12-05 10:12:16 +08:00
Haihao Xiang 05debdaa5f lavu/hwcontext_qsv: use mfxImplDescription instead of mfxExtendedDeviceId on Linux
mfxExtendedDeviceId mightn't be supported in certain configurations of
oneVPL on Linux, so we can't ensure a property filter for
mfxExtendedDeviceId.DeviceID or mfxExtendedDeviceId.VendorID works as
expected. This fixed the issue mentioned in [1]

[1] http://ffmpeg.org/pipermail/ffmpeg-user/2023-October/056983.html

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-12-05 10:11:19 +08:00
Haihao Xiang fc73b372cd lavc/qsvdec: reduce info message when more data is required
demote the info to AV_LOG_VERBOSE

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-12-05 10:10:57 +08:00
Haihao Xiang e233f3e75f lavc/qsvdec: return 0 if more data is required
The type of qsv decoders is FF_CODEC_CB_TYPE_DECODE which must not
return AVERROR(EAGAIN). commit 42b20c9 added an assertion to check the
returned value.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-12-05 10:10:57 +08:00
Haihao Xiang 5717fbbea2 configure: don't warn deprecated symbols from libvpl
libvpl deprecated some symbols (e.g. MFX_EXTBUFF_VPP_DENOISE2 is used to
replace MFX_EXTBUFF_VPP_DENOISE), however the new symbols aren't support
by MediaSDK runtime. In order to support the combination of libvpl and
MediaSDK runtime on legacy devices, we continue to use the deprecated
symbols in FFmpeg. This patch added -DMFX_DEPRECATED_OFF to CFLAGS to
silence the corresponding compilation warnings.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-12-05 10:10:29 +08:00
Haihao Xiang d36d9994e4 lavu/hwcontext_vaapi: ignore nonexistent device in default DRM device selection
It is possible that renderD128 doesn't exist but renderD129 is
available in a system (see [1]). This change can make sure the default
DRM device selection works even if renderD128 doesn't exist.

[1] https://github.com/intel/intel-device-plugins-for-kubernetes/blob/main/cmd/gpu_plugin/README.md#issues-with-media-workloads-on-multi-gpu-setups

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-12-05 10:09:55 +08:00
Paul B Mahol 9e74c7ae87 avfilter/af_dialoguenhance: add double-floating point sample format support 2023-12-04 23:14:40 +01:00
Paul B Mahol 704ef556fe avfilter/af_surround: refactor some code 2023-12-04 23:14:39 +01:00
Cosmin Stejerean 634216dc40 fate: Add tests for QOA decoder 2023-12-04 23:14:38 +01:00
Kyle Swanson 9f1dbca820 avfilter/libvmaf: small cleanup for style, whitespace, unused LIBVMAFContext struct members
Signed-off-by: Kyle Swanson <kswanson@netflix.com>
2023-12-04 10:00:01 -08:00
Lynne 8c117b75af
lavc/Makefile: build vulkan decode code if vulkan_av1 has been enabled
Forgotten.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Tested-by: Neal Gompa <ngompa13@gmail.com>
2023-12-04 07:57:27 +01:00
Paul B Mahol d9e41ead82 avfilter/avfilter: fix OOM case for default activate
Fixes OOM when caller keeps adding frames into filtergraph
that reached EOF by other means, for example EOF is signalled
by other filter in filtergraph or by buffersink.
2023-12-03 23:26:43 +01:00
Paul B Mahol e3e3531d1e avfilter/vsrc_gradients: make rotation always continuous if speed changes 2023-12-03 18:43:26 +01:00
Paul B Mahol 8888574d10 avfilter/vsrc_gradients: add commands support 2023-12-03 18:30:06 +01:00
Stefano Sabatini ddecc39c39 doc/encoders/libx264: review and extend option description
Also, merge x264opts and x264-opts option docs to avoid duplication
and make it clearer that they provide mostly the same functionality.
2023-12-03 13:03:01 +01:00
Paul B Mahol f84412d6f4 avfilter/vf_corr: for all zero returns zero score instead of 1 2023-12-03 03:10:05 +01:00
Paul B Mahol aad3223978 avfilter/vf_corr: add slice threading support 2023-12-03 03:10:03 +01:00
Martin Storsjö 12598e72e3 checkasm: Fix the signature of float_to_fixed24
The len parameter was changed from unsigned int to size_t in
567c67c6c8.

This fixes crashes in the reference C code, when running checkasm
on aarch64.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-02 18:16:09 +02:00
Paul B Mahol 0a13178de8 avcodec/qoadec: add support for midstream sample rate/layout changes 2023-12-02 16:51:00 +01:00
Anton Khirnov 5230257ea1 lavc/dvdsubenc: only check canvas size when it is actually set
Fixes #10650
2023-12-02 11:22:46 +01:00
Anton Khirnov 6a22d80041 doc/filters:ddagrab: elaborate on the semantics of framerate 2023-12-02 11:22:46 +01:00
Alfred Wingate e5ce473040 swscale/x86/rgb_2_rgb: Add opaque pointer to missed definitions of ff_nv12ToUV
Opaque parameters were previously added to the original definition of
ff_nv12ToUV, leading to gcc noticing a type mismatch with -Wlto-type-mismatch.

f2de911818
https://bugs.gentoo.org/907484

Signed-off-by: Alfred Wingate <parona@protonmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-12-02 11:22:46 +01:00
Dale Curtis 2182173a69
avformat/mov: Fix integer overflow in mov_read_packet().
Fixes https://crbug.com/1499669:
runtime error: signed integer overflow: 9223372036853334272 + 1375731456
cannot be represented in type 'int64_t' (aka 'long')

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-02 00:25:15 +01:00
Paul B Mahol db7b838237 avfilter/vf_chromanr: compare correct variables for advanced mode 2023-12-01 21:31:38 +01:00
Logan Lyu fa0470347e lavc/aarch64: new optimization for 8-bit hevc_qpel_bi_hv
put_hevc_qpel_bi_hv4_8_c: 433.7
put_hevc_qpel_bi_hv4_8_i8mm: 117.9
put_hevc_qpel_bi_hv6_8_c: 803.9
put_hevc_qpel_bi_hv6_8_i8mm: 252.7
put_hevc_qpel_bi_hv8_8_c: 1296.4
put_hevc_qpel_bi_hv8_8_i8mm: 316.2
put_hevc_qpel_bi_hv12_8_c: 2867.4
put_hevc_qpel_bi_hv12_8_i8mm: 669.2
put_hevc_qpel_bi_hv16_8_c: 4709.4
put_hevc_qpel_bi_hv16_8_i8mm: 929.9
put_hevc_qpel_bi_hv24_8_c: 9639.7
put_hevc_qpel_bi_hv24_8_i8mm: 2072.4
put_hevc_qpel_bi_hv32_8_c: 16663.7
put_hevc_qpel_bi_hv32_8_i8mm: 3391.4
put_hevc_qpel_bi_hv48_8_c: 36972.9
put_hevc_qpel_bi_hv48_8_i8mm: 7505.7
put_hevc_qpel_bi_hv64_8_c: 64106.4
put_hevc_qpel_bi_hv64_8_i8mm: 13145.2

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-01 21:25:39 +02:00
Logan Lyu 595f97028b lavc/aarch64: new optimization for 8-bit hevc_qpel_bi_v
put_hevc_qpel_bi_v4_8_c: 166.1
put_hevc_qpel_bi_v4_8_neon: 61.9
put_hevc_qpel_bi_v6_8_c: 309.4
put_hevc_qpel_bi_v6_8_neon: 75.6
put_hevc_qpel_bi_v8_8_c: 531.1
put_hevc_qpel_bi_v8_8_neon: 78.1
put_hevc_qpel_bi_v12_8_c: 1139.9
put_hevc_qpel_bi_v12_8_neon: 238.1
put_hevc_qpel_bi_v16_8_c: 2063.6
put_hevc_qpel_bi_v16_8_neon: 308.9
put_hevc_qpel_bi_v24_8_c: 4317.1
put_hevc_qpel_bi_v24_8_neon: 629.9
put_hevc_qpel_bi_v32_8_c: 8241.9
put_hevc_qpel_bi_v32_8_neon: 1140.1
put_hevc_qpel_bi_v48_8_c: 18422.9
put_hevc_qpel_bi_v48_8_neon: 2533.9
put_hevc_qpel_bi_v64_8_c: 37508.6
put_hevc_qpel_bi_v64_8_neon: 4520.1

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-01 21:25:39 +02:00
Logan Lyu 00290a64f7 lavc/aarch64: new optimization for 8-bit hevc_epel_bi_hv
put_hevc_epel_bi_hv4_8_c: 242.9
put_hevc_epel_bi_hv4_8_i8mm: 68.6
put_hevc_epel_bi_hv6_8_c: 402.4
put_hevc_epel_bi_hv6_8_i8mm: 135.9
put_hevc_epel_bi_hv8_8_c: 636.4
put_hevc_epel_bi_hv8_8_i8mm: 145.6
put_hevc_epel_bi_hv12_8_c: 1363.1
put_hevc_epel_bi_hv12_8_i8mm: 324.1
put_hevc_epel_bi_hv16_8_c: 2222.1
put_hevc_epel_bi_hv16_8_i8mm: 509.1
put_hevc_epel_bi_hv24_8_c: 4793.4
put_hevc_epel_bi_hv24_8_i8mm: 1091.9
put_hevc_epel_bi_hv32_8_c: 8393.9
put_hevc_epel_bi_hv32_8_i8mm: 1720.6
put_hevc_epel_bi_hv48_8_c: 19526.6
put_hevc_epel_bi_hv48_8_i8mm: 4285.9
put_hevc_epel_bi_hv64_8_c: 33915.4
put_hevc_epel_bi_hv64_8_i8mm: 6783.6

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-01 21:25:39 +02:00
Logan Lyu 0448f27f41 lavc/aarch64: new optimization for 8-bit hevc_epel_bi_v
put_hevc_epel_bi_v4_8_c: 138.4
put_hevc_epel_bi_v4_8_neon: 33.7
put_hevc_epel_bi_v6_8_c: 302.9
put_hevc_epel_bi_v6_8_neon: 46.7
put_hevc_epel_bi_v8_8_c: 408.7
put_hevc_epel_bi_v8_8_neon: 48.7
put_hevc_epel_bi_v12_8_c: 779.4
put_hevc_epel_bi_v12_8_neon: 139.7
put_hevc_epel_bi_v16_8_c: 1344.9
put_hevc_epel_bi_v16_8_neon: 160.2
put_hevc_epel_bi_v24_8_c: 2981.7
put_hevc_epel_bi_v24_8_neon: 344.9
put_hevc_epel_bi_v32_8_c: 5280.9
put_hevc_epel_bi_v32_8_neon: 618.4
put_hevc_epel_bi_v48_8_c: 12494.9
put_hevc_epel_bi_v48_8_neon: 1364.4
put_hevc_epel_bi_v64_8_c: 22127.7
put_hevc_epel_bi_v64_8_neon: 2473.7

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-01 21:25:39 +02:00
Logan Lyu 216275bd80 lavc/aarch64: new optimization for 8-bit hevc_epel_bi_h
put_hevc_epel_bi_h4_8_c: 96.0
put_hevc_epel_bi_h4_8_neon: 36.3
put_hevc_epel_bi_h6_8_c: 288.3
put_hevc_epel_bi_h6_8_neon: 59.3
put_hevc_epel_bi_h8_8_c: 358.5
put_hevc_epel_bi_h8_8_neon: 61.5
put_hevc_epel_bi_h12_8_c: 759.8
put_hevc_epel_bi_h12_8_neon: 159.5
put_hevc_epel_bi_h16_8_c: 1307.0
put_hevc_epel_bi_h16_8_neon: 182.0
put_hevc_epel_bi_h24_8_c: 2778.3
put_hevc_epel_bi_h24_8_neon: 430.5
put_hevc_epel_bi_h32_8_c: 4952.3
put_hevc_epel_bi_h32_8_neon: 679.5
put_hevc_epel_bi_h48_8_c: 11803.3
put_hevc_epel_bi_h48_8_neon: 1443.5
put_hevc_epel_bi_h64_8_c: 20654.8
put_hevc_epel_bi_h64_8_neon: 2737.0
put_hevc_qpel_bi_h4_8_c: 140.0
put_hevc_qpel_bi_h4_8_neon: 111.5
put_hevc_qpel_bi_h6_8_c: 318.0
put_hevc_qpel_bi_h6_8_neon: 85.8
put_hevc_qpel_bi_h8_8_c: 536.5
put_hevc_qpel_bi_h8_8_neon: 95.3
put_hevc_qpel_bi_h12_8_c: 1188.5
put_hevc_qpel_bi_h12_8_neon: 291.3
put_hevc_qpel_bi_h16_8_c: 2064.3
put_hevc_qpel_bi_h16_8_neon: 365.3
put_hevc_qpel_bi_h24_8_c: 4757.5
put_hevc_qpel_bi_h24_8_neon: 1010.0
put_hevc_qpel_bi_h32_8_c: 8351.8
put_hevc_qpel_bi_h32_8_neon: 2917.8
put_hevc_qpel_bi_h48_8_c: 19299.8
put_hevc_qpel_bi_h48_8_neon: 2976.8
put_hevc_qpel_bi_h64_8_c: 34182.5
put_hevc_qpel_bi_h64_8_neon: 5236.3

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-01 21:25:39 +02:00
Logan Lyu 40cf4a5ca3 lavc/aarch64: new optimization for 8-bit hevc_pel_bi_pixels
put_hevc_pel_bi_pixels4_8_c: 54.7
put_hevc_pel_bi_pixels4_8_neon: 43.0
put_hevc_pel_bi_pixels6_8_c: 94.7
put_hevc_pel_bi_pixels6_8_neon: 37.0
put_hevc_pel_bi_pixels8_8_c: 171.0
put_hevc_pel_bi_pixels8_8_neon: 24.0
put_hevc_pel_bi_pixels12_8_c: 354.0
put_hevc_pel_bi_pixels12_8_neon: 68.7
put_hevc_pel_bi_pixels16_8_c: 588.2
put_hevc_pel_bi_pixels16_8_neon: 77.5
put_hevc_pel_bi_pixels24_8_c: 1670.7
put_hevc_pel_bi_pixels24_8_neon: 173.0
put_hevc_pel_bi_pixels32_8_c: 2267.7
put_hevc_pel_bi_pixels32_8_neon: 281.2
put_hevc_pel_bi_pixels48_8_c: 5787.5
put_hevc_pel_bi_pixels48_8_neon: 673.5
put_hevc_pel_bi_pixels64_8_c: 9897.0
put_hevc_pel_bi_pixels64_8_neon: 1159.5

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-01 21:25:39 +02:00
sunyuechi d0ec826077 checkasm/ac3dsp: add float_to_fixed24 test
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-12-01 20:26:48 +02:00
James Almer 6d19611251 avcodec/ac3dsp: add missing stddef.h include
Should fix make checkheaders

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-01 12:42:22 -03:00
Paul B Mahol a30adf9f96 avfilter/framesync: fix OOM case
Fixes OOM when caller keeps adding frames into filtergraph
that reached EOF by other means, for example EOF is signalled
by other filter in filtergraph or by buffersink.
2023-11-30 11:08:34 +01:00
Paul B Mahol 47e214245b avfilter/arls_template: use defines for all constants 2023-11-28 16:09:12 +01:00
Paul B Mahol f66536cc58 avfilter: add Affine Projection adaptive audio filter 2023-11-28 15:40:34 +01:00
xufuji456 cc86343b96 lavc/hevcdsp_qpel_neon: using movi.16b instead of movi.2d
Building iOS platform with arm64, the compiler has a warning: "instruction movi.2d with immediate #0 may not function correctly on this CPU, converting to movi.16b"

Signed-off-by: xufuji456 <839789740@qq.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-11-28 15:54:49 +02:00
Paul B Mahol 67ce690bc6 avfilter/af_anlms: set output frame duration 2023-11-28 13:17:19 +01:00
Paul B Mahol 411c516453 avfilter/af_arls: set output frame duration 2023-11-28 13:17:13 +01:00
Paul B Mahol bafbb0697e avfilter/af_amix: set output frame duration 2023-11-28 13:17:13 +01:00
Paul B Mahol 358aced447 avfilter/af_amultiply: set output frame duration 2023-11-28 13:17:12 +01:00
Paul B Mahol 8b9c400f1d avfilter/af_amerge: use already provided outlink 2023-11-28 13:17:12 +01:00
Paul B Mahol c979ccdfd7 avfilter: no need to request more samples if internal frame is available 2023-11-28 13:16:18 +01:00
Anton Khirnov 66a02a8508 tools/general_assembly: add newly voted-in extra GA members
Cf.
* https://vote.ffmpeg.org/cgi-bin/civs/results.pl?id=E_d0b225b9aa8d45d5
* http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-November/317496.html
  Message-Id <170115613784.8914.4950266152609138336@lain.khirnov.net>
2023-11-28 09:07:23 +01:00
Paul B Mahol 3bca828d39 avfilter/af_arls: add double sample format support 2023-11-27 20:27:27 +01:00
Paul B Mahol 42e45ea8ff avfilter/af_anlms: add double sample format support 2023-11-27 20:27:25 +01:00
sunyuechi ea6817d2a7 checkasm: test for dcmul_add
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-11-27 17:55:24 +02:00
Zhao Zhili d526a34c20 avcodec/videotoolboxenc: refactor dump encoder name
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-27 23:49:01 +08:00
Zhao Zhili cb049d377f avcodec/videotoolboxenc: Fix build failure due to PropertyKey_EncoderID
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-27 23:48:55 +08:00
Leo Izen 36980179a0 fftools/ffplay_renderer: declare function argument as const
Declaring the function argument as const fixes a warning down the line
that the const parameter is stripped. We don't modify this argument.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-27 23:39:48 +08:00
Paul B Mahol 5f87a68cf7 avfilter/vf_colorcorrect: fix memory leaks 2023-11-27 12:10:26 +01:00
Paul B Mahol f1f973313b avfilter/af_dialoguenhance: do output scaling once 2023-11-27 11:56:27 +01:00
Paul B Mahol b1942734c7 avfilter/af_afwtdn: fix crash with EOF handling 2023-11-27 11:56:26 +01:00
Paul B Mahol 4671fb7dfb avfilter/af_dialoguenhance: simplify channels copy 2023-11-27 11:56:23 +01:00
Gyan Doshi 0ea9e26636 doc/filters: restore entry for libvmaf option pool
3d29724c00 removed the doc entry for the option pool while adding
a parser function for it at the same time!

The option remains available and undeprecated.

Fixes trac #10693
2023-11-27 15:37:01 +05:30
Paul B Mahol 44e9cccffa avformat: add QOA demuxer 2023-11-26 17:49:11 +01:00
Paul B Mahol 3609d2b783 avcodec: add QOA decoder 2023-11-26 17:49:09 +01:00
Geoffrey McRae 93b5d9030b libavcodec/mlpdec: add missing correction to ch_layout when downmixing
This fixes corrupted audio for applications relying on ch_layout when
codec downmixing is active.

Signed-off-by: Geoffrey McRae <geoff@hostfission.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-26 10:18:33 -03:00
Geoffrey McRae a8677bcc8f libavcodec/dcadec: adjust the `ch_layout` when downmix is active
Applications making use of this codec with the `downmix` option are
segfaulting unless the `ch_layout` is overridden after `avcodec_open2`
as can be seen in projects like MythTV[1]

This patch fixes this by overriding the ch_layout as done in other
decoders such as AC3.

1: af6f362a14/mythtv/libs/libmythtv/decoders/avformatdecoder.cpp (L4607)

Signed-off-by: Geoffrey McRae <geoff@hostfission.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-26 10:18:33 -03:00
Wenbin Chen 47b2328076 libavfilter/vf_dnn_detect: Add yolo support
Add yolo support. Yolo model doesn't output final result. It outputs
candidate boxes, so we need post-process to remove overlap boxes to
get final results. Also, the box's coordinators relate to cell and
anchors, so we need these information to calculate boxes as well.

Model detail please refer to: https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v2-tf

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-11-26 20:38:36 +08:00
Wenbin Chen caa5d123a7 libavfilter/vf_dnn_detect: Add model_type option.
There are many kinds of detection DNN model and they have different
preprocess and postprocess methods. To support more models,
"model_type" option is added to help to choose preprocess and
postprocess function.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-11-26 20:15:55 +08:00
Anton Khirnov 2020ef9770 tools/general_assembly: restore printing HEAD 2023-11-26 10:12:01 +01:00
Anton Khirnov 56a8b34b64 tools/general_assembly: implement extra GA members 2023-11-26 10:12:01 +01:00
Paul B Mahol e7111ba44a avfilter/vsrc_gradients: allow zero speed 2023-11-26 02:07:45 +01:00
Paul B Mahol f1acb0d843 avfilter/vsrc_gradients: add square type 2023-11-26 02:07:44 +01:00
James Almer 72390dea00 mips/ac3dsp_mips: add missing stddef.h header include
Fixes compilation failures after 567c67c6c8.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-25 21:51:04 -03:00
James Almer e40ea9f34b x86/ac3dsp: add ff_float_to_fixed24_avx()
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-25 21:50:56 -03:00
James Almer d8b1a34433 x86/ac3dsp: reduce instruction count inside the float_to_fixed24 loop
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-25 21:50:56 -03:00
Paul B Mahol 2d9ed64859 avfilter/af_dialoguenhance: fix overreads 2023-11-25 13:05:31 +01:00
Paul B Mahol 37c5bcc4e8 avfilter/af_channelmap: do not override set channel layout 2023-11-25 13:05:31 +01:00
Zhao Zhili bbdedd9663 Revert "avformat/rtmpproto: Pass rw_timeout to underlying transport protocol"
This reverts commit bec6dfcd5c.

The patch is NOP since ffurl_open_whitelist copy options from parent
automatically.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-25 10:56:00 +08:00
Rémi Denis-Courmont 7212466e73 checkasm/riscv: report an error upon SIGILL
Terminating the whole checkasm process is not very helpful. This will
report if an illegal instruction occurs while executing a tested
function. This is a common occurrence whilst developping RISC-V
assembler, due to the compatibility between vector configuration and
instruction done at run-time.
2023-11-23 19:04:07 +02:00
Rémi Denis-Courmont 286d674221 checkasm: add helper to report a fatal signal 2023-11-23 18:57:18 +02:00
Rémi Denis-Courmont 0fa421c8f1 lavc/llvidencdsp: add R-V V diff_bytes
diff_bytes_c:      163.0
diff_bytes_rvv_i32: 52.7
2023-11-23 18:57:18 +02:00
Rémi Denis-Courmont 0183c2c830 lavc/aacpsdsp: use LMUL=2 and amortise strides
The input is laid out in 16 segments, of which 13 actually need to be
loaded. There are no really efficient ways to deal with this:
1) If we load 8 segments wit unit stride, then narrow to 16 segments with
   right shifts, we can only get one half-size vector per segment, or just 2
   elements per vector (EMUL=1/2) - at least with 128-bit vectors.
   This ends up unsurprisingly about as fas as the C code.
2) The current approach is to load with strides. We keep that approach,
   but improve it using three 4-segmented loads instead of 12 single-segment
   loads. This divides the number of distinct loaded addresses by 4.
3) A potential third approach would be to avoid segmentation altogether
   and splat the scalar coefficient into vectors. Then we can use a
   unit-stride and maximum EMUL. But the downside then is that we have to
   multiply the 3 (of 16) unused segments with zero as part of the
   multiply-accumulate operations.

In addition, we also reuse vectors mid-loop so as to increase the EMUL
from 1 to 2, which also improves performance a little bit.

Oeverall the gains are quite small with the device under test, as it does
not deal with segmented loads very well. But at least the code is tidier,
and should enjoy bigger speed-ups on better hardware implementation.

Before:
ps_hybrid_analysis_c:       1819.2
ps_hybrid_analysis_rvv_f32: 1037.0 (before)
ps_hybrid_analysis_rvv_f32:  990.0 (after)
2023-11-23 18:57:18 +02:00
Rémi Denis-Courmont b88d4058f9 lavc/g722dsp: optimise R-V V apply_qmf
This stores the constant coefficients deinterleaved, so that they can be
loaded directly with NF=0. Unfortunately, we cannot optimise loading the
input, due to insufficient memory alignment (not 32-bit).

Before:
g722_apply_qmf_c:       82.5
g722_apply_qmf_rvv_i32: 78.2

After:
g722_apply_qmf_c:       82.5
g722_apply_qmf_rvv_i32: 65.2
2023-11-23 18:57:18 +02:00
Rémi Denis-Courmont e33ce0d9dd lavu/fixed_dsp: R-V V fmul_window_scaled
vector_fmul_window_scaled_fixed_c:       4393.7
vector_fmul_window_scaled_fixed_rvv_i64: 1642.7
2023-11-23 18:57:18 +02:00
Rémi Denis-Courmont e49f41fb27 lavu/float_dsp: optimise R-V V fmul_reverse & fmul_window
Roll the loop to avoid slow gathers.

Before:
vector_fmul_reverse_c:       1561.7
vector_fmul_reverse_rvv_f32: 2410.2
vector_fmul_window_c:        2068.2
vector_fmul_window_rvv_f32:  1879.5

After:
vector_fmul_reverse_c:       1561.7
vector_fmul_reverse_rvv_f32:  916.2
vector_fmul_window_c:        2068.2
vector_fmul_window_rvv_f32:  1202.5
2023-11-23 18:57:18 +02:00
Rémi Denis-Courmont 3a134e8299 lavu/fixed_dsp: optimise R-V V fmul_reverse
Gathers are (unsurprisingly) a notable exception to the rule that R-V V
gets faster with larger group multipliers. So roll the function to speed
it up.

Before:
vector_fmul_reverse_fixed_c:       2840.7
vector_fmul_reverse_fixed_rvv_i32: 2430.2

After:
vector_fmul_reverse_fixed_c:       2841.0
vector_fmul_reverse_fixed_rvv_i32:  962.2

It might be possible to further optimise the function by moving the
reverse-subtract out of the loop and adding ad-hoc tail handling.
2023-11-23 18:57:18 +02:00
Paul B Mahol 4adb93dff0 avfilter/asrc_afirsrc: fix by one smaller allocation of buffer 2023-11-23 15:01:55 +01:00
James Almer 0008e1c5d5 avfilter/asrc_anullsrc: fix allowed range for sample_rate
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-22 19:41:15 -03:00
James Almer 567c67c6c8 avcodec/ac3dsp: make len a size_t in float_to_fixed24
Should simplify asm implementations, and prevent UB on at least win64.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-22 18:33:00 -03:00
Paul B Mahol 4af412be71 avfilter: use AV_OPT_TYPE_CHLAYOUT 2023-11-22 19:28:40 +01:00
James Almer 707e46dc54 test/checkasm: test llauddsp
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-22 14:22:19 -03:00
James Almer 2d9fd814d0 x86/: clear the high bits for order in scalarproduct_and_madd functions
Should fix checkasm failures on win64.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-22 14:18:42 -03:00
Michael Niedermayer 3c154e8579 doc/git-howto: use less weird username for git URL
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: J. Dekker <jdek@itanimul.li>
2023-11-22 10:21:50 +01:00
Zhao Zhili e8a49b1424 avcodec/mmaldec: Fix build error
Fix #10670.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-22 21:02:04 +08:00
Zhao Zhili bec6dfcd5c avformat/rtmpproto: Pass rw_timeout to underlying transport protocol
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-22 21:02:04 +08:00
Zhao Zhili e1d6b3cb5a avformat/flvenc: add extract_extradata bsf for new video codecs
When encoders don't support global header like MediaCodec, FLV
muxer needs to add extract_extradata bsf automatically. The codec
list doesn't include VP9 since it's not supported by
extract_extradata.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-22 21:02:04 +08:00
Zhao Zhili f27fce0c0c avcodec/mediacodecdec: fix return EAGAIN after EOF
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-22 21:02:04 +08:00
Dmitry Rogozhkin e9c93009fc avcodec/decode: validate hw_frames_ctx when AVHWAccel.free_frame_priv is used
Validate that a hw_frames_ctx is available before using it for
the AVHWAccel.free_frame_priv callback, and don't require it to
be present when the callback is not in use by the HWAccel.

v2: check for free_frame_priv (Hendrik)
v3: return EINVAL (Christoph Reiter)
v4: better commit message (Hendrik)
v5: fix typo with missed frames_ctx (Lynne)

See[1]: https://github.com/msys2/MINGW-packages/pull/19050
Fixes: be07145109 ("avcodec: add AVHWAccel.free_frame_priv callback")
CC: Lynne <dev@lynne.ee>
CC: Christoph Reiter <reiter.christoph@gmail.com>
Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
2023-11-22 05:01:16 +01:00
Zhao Zhili 641f8a71fb fate/h264: move mp4toannexb_ticket5927 test to fate-h264
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-22 19:42:15 +08:00
Zhao Zhili aa3b857101 avcodec/h264_mp4toannexb_bsf: process new extradata
For fate-h264_mp4toannexb_ticket5927 and
fate-h264_mp4toannexb_ticket5927_2, they work by accident
previously. The sample file has two 'avc1' entries, and video
samples use the second one. It means packets should be decoded with
new extradata in side data. Before this patch, only extradata was
kept in the output, new extradata has been dropped. The output can
be decoded because the two extradata are almost the same, except
level indication. This patch fixed the issue, and add another
fate test.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-22 19:42:14 +08:00
Zhao Zhili d3aa0cd16f avcodec/h264_mp4toannexb_bsf: fix missing PS before IDR frames
If there is a single group of SPS/PPS before an IDR frame, but no
SPS/PPS after that, we will miss the chance to reset
idr_sps_seen/idr_pps_seen. No SPS/PPS are inserted afterwards.

This patch saves in-band SPS/PPS and insert them before IDR frames
when necessary.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-22 19:42:14 +08:00
Zhao Zhili 4c4b833abd avcodec/h264_mp4toannexb_bsf: remove pass padding size as argument
It's a fixed value. There is no use case to change that.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-22 19:42:14 +08:00
Zhao Zhili 91cbae2f6c avcodec/h264_mp4toannexb_bsf: refactor start_code_size handling
start_code_size depends on whether PS comes from out-of-band or
in-band. Make the code more readable.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-22 19:42:14 +08:00
Michael Niedermayer fb52070848
avcodec/h264dec: use BOOL for skip_gray, noref_gray
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-22 01:22:31 +01:00
Jun Zhao c961ac4b0c vulkan_decode: fix the print format of VkDeviceSize
VkDeviceSize represents device memory size and offset
values as uint64_t in Spec.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-11-21 08:02:43 +08:00
Jun Zhao ab3bd5ead0 avdevice/decklink_dec: add explicit specifier
The explicit specifier used with a single argument constructor
to prevent implicit type conversions.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-11-21 08:02:29 +08:00
James Almer 1258f99978 avcodec: bump version after EVC additions
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-20 11:55:51 -03:00
Dawid Kozinski cfe2947887 avcodec/evc_decoder: Provided support for EVC decoder
- Added EVC decoder wrapper
- Changes in project configuration file and libavcodec Makefile
- Added documentation for xevd wrapper

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-20 11:55:51 -03:00
Dawid Kozinski c59a96fd08 avcodec/evc_encoder: Provided support for EVC encoder
- Added EVC encoder wrapper
- Changes in project configuration file and libavcodec Makefile
- Added documentation for xeve wrapper

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-20 11:55:51 -03:00
Michael Niedermayer e56d91f8a8
avcodec/h264dec: Support skipping frames that used gray gap frames
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-20 00:19:25 +01:00
Michael Niedermayer 6364fa9e9a
avcodec/h264: Avoid using gray gap frames as references
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-20 00:19:25 +01:00
Michael Niedermayer 29f6c9b04d
avcodec/h264: keep track of which frames used gray references
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-20 00:19:04 +01:00
Michael Niedermayer e4337606e1
avcodec/h264dec: More elaborate documentation for frame_recovered
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-20 00:12:30 +01:00
Michael Niedermayer 68e1cf204a
avcodec/h264: Use FRAME_RECOVERED_HEURISTIC instead of IDR/SEI
This keeps IDR/SEI and heuristically detected recovery points cleaner seperated

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-20 00:12:30 +01:00
Michael Niedermayer 3f4a1a24a5
avcodec/h264: Seperate SEI and IDR recovery handling
This avoids SEI and IDR recovery flags affecting each other

Also eliminate litteral numbers from recovery handling
This should make the code clearer

Improves: tickets/4738/tickets_cut.ts

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-20 00:12:29 +01:00
Paul B Mahol d55d0bba48 avfilter/af_afir: remove flag that is not needed 2023-11-19 23:59:23 +01:00
Paul B Mahol 28a43cf7fe avfilter/af_afir: no need to dynamically add outpad 2023-11-19 23:55:54 +01:00
Paul B Mahol 6579d95df3 avfilter/af_afir: refactor crossfade code 2023-11-19 23:47:52 +01:00
Paul B Mahol bbdd604b9e avfilter/af_afir: add timeline support 2023-11-19 23:47:51 +01:00
Rémi Denis-Courmont 954d50e2ae riscv: set fast half-precision conversion
This is only supported at compilation time. If Zfhmin is supported, then
conversions are fast, which is what the flag is used for. At this time,
run-tiem detection is not possible, as in not supported by Linux. But even
if it were, the current FFmpeg approach seems unable to deal with it (same
problem as on x86, really).
2023-11-19 20:06:20 +02:00
Paul B Mahol a9205620b1 avfilter/af_afir: remove IR response video rendering support
And deprecate related options.
The same functionality can be done with specialized audio visualization filters.
2023-11-19 13:41:13 +01:00
Paul B Mahol 496df68815 doc/filters: add one more example for afir filter usage 2023-11-19 13:40:35 +01:00
Anton Khirnov 6fb1eaf73a tools/general_assembly: update to conform to new rules 2023-11-19 12:58:47 +01:00
Anton Khirnov 4cad7c0522 tools/general_assembly: make the script executable 2023-11-19 12:58:47 +01:00
Paul B Mahol 7c16bf0829 avfilter/avf_showvolume: improve step for vertical orientation 2023-11-18 23:50:39 +01:00
Paul B Mahol 3ed2225a9d avfilter/avf_showvolume: draw channel names directly into output frame 2023-11-18 23:50:38 +01:00
Rémi Denis-Courmont fbc7adba67 lavc/llviddsp: R-V V add_bytes
add_bytes_c:      2077.2
add_bytes_rvv_i32: 105.0
2023-11-18 22:07:14 +02:00
Rémi Denis-Courmont ca664f2254 lavc/flacdsp: R-V V LPC16 function
In this case, the inner loop computing the scalar product can be reduced
to just one multiplication and one sum even with 128-bit vectors. The
result is a lot simpler, but also brings more modest performance gains:

flac_lpc_16_13_c:       15241.0
flac_lpc_16_13_rvv_i32: 11230.0
flac_lpc_16_16_c:       17884.0
flac_lpc_16_16_rvv_i32: 12125.7
flac_lpc_16_29_c:       27847.7
flac_lpc_16_29_rvv_i32: 10494.0
flac_lpc_16_32_c:       30051.5
flac_lpc_16_32_rvv_i32: 10355.0
2023-11-18 22:06:57 +02:00
Rémi Denis-Courmont 295092b46d lavc/flacdsp: R-V V LPC32
The entire set of 32 coefficients and corresponding past 32 samples can
fit in a single vector (with LMUL=8) exactly, but... since widening
double the needed vector sizes, we still end up too short with 128-bit
vectors. This adds a very simple version for future 256+-bit hardware,
and for pred_orders values up to 16, and a bit more involved loop for
for 128-bit hardware with pred_orders between 17 and 32.

With 128-bit hardware, the benchmarks look like this:
flac_lpc_32_13_c:       30152.0
flac_lpc_32_13_rvv_i32: 10244.7
flac_lpc_32_16_c:       37314.2
flac_lpc_32_16_rvv_i32: 10126.2
flac_lpc_32_29_c:       61910.0
flac_lpc_32_29_rvv_i32: 14495.2
flac_lpc_32_32_c:       68204.0
flac_lpc_32_32_rvv_i32: 13273.7
2023-11-18 22:05:43 +02:00
Rémi Denis-Courmont 8a984aca59 checkasm/flacdsp: add LPC test 2023-11-18 22:01:59 +02:00
Rémi Denis-Courmont cd6089dc9c riscv: fix builds without Zbb support 2023-11-18 22:01:59 +02:00
Jun Zhao 2d4aef8982 lavfi/Makefile: fix vf_cropdetect missed edge_common
vf_cropdetect depends on edge_common, it's missing in Makefile.

Fix trac issue:
http://trac.ffmpeg.org/ticket/10664

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-11-18 20:19:39 +01:00
Diederik de Haas via ffmpeg-devel c07ed10b0e apply spelling fixes
Fix spelling issue as reported by Debian's lintian tool:
accomodate -> accommodate
addtional -> additional
auxillary -> auxiliary
bellow -> below
betweeen -> between
Calulate -> Calculate
coefficents -> coefficients
Defalt -> Default
defaul -> default
higer -> higher
neccesary -> necessary
orignal -> original
ouput -> output
precison -> precision
processsing -> processing
substract -> subtract
Transfered -> Transferred
upto -> up to

Also add several of them to the 'common typos' check in patcheck.

Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
2023-11-18 19:55:42 +01:00
Paul B Mahol 5452cbdc15 avfilter/af_afir: add irnorm and irlink options
Deprecate gtype option.
2023-11-18 17:04:53 +01:00
Rémi Denis-Courmont 07c303b708 lavc/flacdsp: R-V V decorrelate_indep 16-bit packed
flac_decorrelate_indep2_16_c:        981.7
flac_decorrelate_indep2_16_rvv_i32:  199.2
flac_decorrelate_indep4_16_c:       1749.7
flac_decorrelate_indep4_16_rvv_i32:  401.2
flac_decorrelate_indep6_16_c:       2517.7
flac_decorrelate_indep6_16_rvv_i32:  858.0
flac_decorrelate_indep8_16_c:       3285.7
flac_decorrelate_indep8_16_rvv_i32: 1123.5
2023-11-17 23:59:56 +02:00
Rémi Denis-Courmont fb0295e5fd lavc/flacdsp: R-V V decorrelate_indep 32-bit packed
flac_decorrelate_indep2_32_c:       981.7
flac_decorrelate_indep2_32_rvv_i32: 183.7
flac_decorrelate_indep4_32_c:      1749.7
flac_decorrelate_indep4_32_rvv_i32: 362.5
flac_decorrelate_indep6_32_c:      2517.7
flac_decorrelate_indep6_32_rvv_i32: 715.2
flac_decorrelate_indep8_32_c:      3285.7
flac_decorrelate_indep8_32_rvv_i32: 909.0
2023-11-17 23:59:56 +02:00
Rémi Denis-Courmont 6183a69c0b lavc/flacdsp: R-V V decorrelate_ms packed
flac_decorrelate_ms_16_c:       585.5
flac_decorrelate_ms_16_rvv_i32: 263.0
flac_decorrelate_ms_32_c:       584.7
flac_decorrelate_ms_32_rvv_i32: 250.0
2023-11-17 23:59:23 +02:00
Rémi Denis-Courmont 636ae0e0bc lavc/flacdsp: R-V V packed decorrelate_{l,r}s
flac_decorrelate_ms_16_c:       457.2
flac_decorrelate_ms_16_rvv_i32: 203.0
flac_decorrelate_ms_32_c:       457.2
flac_decorrelate_ms_32_rvv_i32: 203.5
flac_decorrelate_rs_16_c:       456.2
flac_decorrelate_rs_16_rvv_i32: 207.0
flac_decorrelate_rs_32_c:       456.2
flac_decorrelate_rs_32_rvv_i32: 210.5
2023-11-17 23:59:22 +02:00
Rémi Denis-Courmont be1675035f checkasm/flacdsp: fix ls/rs/ms tests
decorrelate_ls, _rs and _ms are decorrelate[1], [2] and [3] respectively.
The code ended up testing indep ([0]) as twice, ms never, and misnaming
the other two.
2023-11-17 23:59:22 +02:00
Paul B Mahol 08e97dae20 avfilter/af_adynamicequalizer: add adaptive detection mode 2023-11-17 00:17:54 +01:00
Paul B Mahol 82be1e5c0d avfilter/af_adynamicequalizer: do gain calculations in log domain 2023-11-17 00:17:54 +01:00
sunyuechi afb967b81e af_afir: RISC-V V fcmul_add
Segmented loads are slow, so here we use unit-strided load and narrowing shifts.

c910:
fcmul_add_c: 2179
fcmul_add_rvv_f64: 1652

c908:
fcmul_add_c: 4891.2
fcmul_add_rvv_f64: 2399.5

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-11-16 20:53:18 +02:00
Rémi Denis-Courmont d076517056 lavc/llauddsp: R-V V scalarproduct_and_madd_int32
scalarproduct_and_madd_int32_c:      10899.7
scalarproduct_and_madd_int32_rvv_i32: 1749.0
2023-11-16 16:53:44 +02:00
Rémi Denis-Courmont 45d0eb3f70 lavc/llauddsp: R-V V scalarproduct_and_madd_int16
scalarproduct_and_madd_int16_c:      10355.7
scalarproduct_and_madd_int16_rvv_i32: 1480.0
2023-11-16 16:53:44 +02:00
Rémi Denis-Courmont 6720a509a7 checkasm: add lossless audio DSP 2023-11-16 16:53:44 +02:00
James Almer 78f55457c9 x86/flacds: clear the high bits from pred_order in lpc_32 functions
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-15 16:10:15 -03:00
Dai, Jianhui J c9fe9fb863 avcodec/cbs_vp8: Add support for VP8 codec bitstream
This commit adds support for VP8 bitstream read methods to the cbs
codec. This enables the trace_headers bitstream filter to support VP8,
in addition to AV1, H.264, H.265, and VP9. This can be useful for
debugging VP8 stream issues.

The CBS VP8 implements a simple VP8 boolean decoder using GetBitContext
to read the bitstream.

Only the read methods `read_unit` and `split_fragment` are implemented.
The write methods `write_unit` and `assemble_fragment` return the error
code AVERROR_PATCHWELCOME. This is because CBS VP8 write is unlikely to
be used by any applications at the moment. The write methods can be
added later if there is a real need for them.

TESTS: ffmpeg -i fate-suite/vp8/frame_size_change.webm -vcodec copy
-bsf:v trace_headers -f null -

Signed-off-by: Jianhui Dai <jianhui.j.dai@intel.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2023-11-15 10:29:03 -05:00
Dai, Jianhui J 5cb8accd09 avcodec/vp8: Export `vp8_token_update_probs` variable
This commit exports the `vp8_token_update_probs` variable to internal
library scope to facilitate its reuse within the library.

Signed-off-by: Jianhui Dai <jianhui.j.dai@intel.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2023-11-15 10:29:03 -05:00
Rémi Denis-Courmont 90a779bed6 lavc/huffyuvdsp: basic R-V V add_hfyu_left_pred_bgr32
Better performance can probably be achieved with a more intricate
unrolled loop, but this is a start:

add_hfyu_left_pred_bgr32_c: 15084.0
add_hfyu_left_pred_bgr32_rvv_i32: 10280.2

This would actually be cleaner with the RISC-V P extension, but that is
not ratified yet (I think?) and usually not supported if V is supported.
2023-11-15 16:51:07 +02:00
Rémi Denis-Courmont 6b708cd783 checkasm/huffyuvdsp: test for add_hfyu_left_pred_bgr32 2023-11-15 16:51:07 +02:00
Cosmin Stejerean via ffmpeg-devel 575efc0406 tools/general_assembly.pl - add options to print names, emails or both
Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-11-14 18:33:07 +01:00
James Almer b360c91752 avcodec/codecpar: mention how to allocate coded_side_data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-14 14:26:42 -03:00
Zhao Zhili a1a6a328f0 fftools/ffplay: add hwaccel decoding support
Add vulkan renderer via libplacebo.

Simple usage:
$ ffplay -hwaccel vulkan foo.mp4

Use cuda to vulkan map:
$ ffplay -hwaccel cuda foo.mp4

Create vulkan instance by libplacebo, and enable debug:
$ ffplay -hwaccel vulkan \
	-vulkan_params create_by_placebo=1:debug=1 foo.mp4

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-15 01:20:11 +08:00
Anton Khirnov 889a022cce fftools/ffmpeg: rework keeping track of file duration for -stream_loop
Current code tracks min/max pts for each stream separately; then when
the file ends it combines them with last frame's duration to compute the
total duration of each stream; finally it selects the longest of those
durations as the file duration.

This is incorrect - the total file duration is the largest timestamp
difference between any frames, regardless of the stream.

Also change the way the last frame information is reported from decoders
to the muxer - previously it would be just the last frame's duration,
now the end timestamp is sent, which is simpler.

Changes the result of the fate-ffmpeg-streamloop-transcode-av test,
where the timestamps are shifted slightly forward. Note that the
matroska demuxer does not return the first audio packet after seeking
(due to buggy interaction betwen the generic code and the demuxer), so
there is a gap in audio.
2023-11-14 18:18:26 +01:00
Anton Khirnov 87016e031f fftools/thread_queue: count receive-finished streams as finished
This ensures that tq_receive() will always return EOF after all streams
were receive-finished, even though the sending side might not have
closed them yet. This may allow the receiver to avoid manually tracking
which streams it has already closed.
2023-11-14 18:18:26 +01:00
Anton Khirnov 4f7b91a698 fftools/thread_queue: do not return elements for receive-finished streams
It does not cause any issues in current callers, but still should not
happen.
2023-11-14 18:18:26 +01:00
Anton Khirnov 7c97a0c63f fftools/ffmpeg: move a few inline function into a new header
Will allow to use them in future commits without including the whole
ffmpeg.h.
2023-11-14 18:18:26 +01:00
Anton Khirnov 6dbde68cb5 lavc/8bps: fix exporting palette after 63767b79a5
It would be left empty on each frame whose packet does not come with
palette attached.
2023-11-14 18:18:26 +01:00
Paul B Mahol 7282137f48 lavfi/af_amix: make sure the output does not depend on input ordering
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-11-14 18:18:26 +01:00
Anton Khirnov de85815bfa lavf/mux: do not apply max_interleave_delta to subtitles
It is common for subtitle streams to have large gaps between packets.
When the caller is interleaving packets from multiple files, it can
easily happen that two successive subtitle packets trigger this limit,
even though no excessive buffering is happening.

Should fix #7064
2023-11-14 18:18:26 +01:00
Anton Khirnov 436b972fc8 doc/ffmpeg: expand -bsf documentation
Explain how to pass options to filters.
2023-11-14 18:18:26 +01:00
Anton Khirnov a8d9d6b08d tests/fate: replace deprecated -vsync with -fps_mode 2023-11-14 18:18:26 +01:00
Anton Khirnov 23de85d1ec tests/fate/ffmpeg: replace deprecated -vbsf with -bsf:v 2023-11-14 18:18:26 +01:00
Rémi Denis-Courmont ce467421dc lavc/exrdsp: unroll predictor
With explicit unrolling, we can skip half of the sign bit flips, and
the compiler is then better able to optimise the scalar loop:

predictor_c: 31376.0 (before)
predictor_c: 23703.0 (after)
2023-11-14 19:15:51 +02:00
Rémi Denis-Courmont c536e92207 lavc/sbrdsp: R-V V hf_apply_noise functions
This is restricted to 128-bit vectors as larger vector sizes could read
past the end of the noise array. Support for future hardware with larger
vector sizes is left for some other time.

hf_apply_noise_0_c:       2319.7
hf_apply_noise_0_rvv_f32: 1229.0
hf_apply_noise_1_c:       2539.0
hf_apply_noise_1_rvv_f32: 1244.7
hf_apply_noise_2_c:       2319.7
hf_apply_noise_2_rvv_f32: 1232.7
hf_apply_noise_3_c:       2541.2
hf_apply_noise_3_rvv_f32: 1244.2
2023-11-13 18:34:29 +02:00
Rémi Denis-Courmont 20e6195c54 checkasm: test the noise case of sbrdsp.hf_apply_noise
The tested functions treat s_m[i] == 0 as a special case. Other than
that, the functions are slightly complicated vector additions.

This actually makes the zero case happen pseudorandomly.
2023-11-13 18:34:29 +02:00
Rémi Denis-Courmont 6d60cc7baf sws/rgb2rgb: fix unaligned accesses in R-V V YUYV to I422p
In my personal opinion, we should not need to support unaligned YUY2
pixel maps. They should always be aligned to at least 32 bits, and the
current code assumes just 16 bits. However checkasm does test for
unaligned input bitmaps. QEMU accepts it, but real hardware dose not.

In this particular case, we can at the same time improve performance and
handle unaligned inputs, so do just that.

uyvytoyuv422_c:      104379.0
uyvytoyuv422_c:      104060.0
uyvytoyuv422_rvv_i32: 25284.0 (before)
uyvytoyuv422_rvv_i32: 19303.2 (after)
2023-11-13 18:34:29 +02:00
Rémi Denis-Courmont 5b8b5ec9c5 sws/rgb2rgb: rework R-V V YUY2 to 4:2:2 planar
This saves three scratch registers and three instructions per line. The
performance gains are mostly negligible. The main point is to free up
registers for further rework.
2023-11-13 18:34:29 +02:00
Rémi Denis-Courmont 5b33104fca lavc/sbrdsp: R-V V hf_gen
hf_gen_c:      2922.7
hf_gen_rvv_f32: 731.5
2023-11-13 18:33:02 +02:00
Gyan Doshi 67a2571a55 avcodec/libsvtav1: add version guard for external param
Setting of external param 'force_key_frames' was added in 7bcc1b4eb8.
It is available since v1.1.0 but ffmpeg allows linking against v0.9.0.
2023-11-13 13:14:43 +05:30
Paul B Mahol 84e400ae37 avfilter/buffersrc: switch to activate
Fixes OOM when caller keeps adding frames into filtergraph
that reached EOF by other means, for example EOF is signalled
by other filter in filtergraph or by buffersink.
2023-11-12 23:48:10 +01:00
Evgeny Pavlov da3ce21f68 libavcodec/amfenc: Fix issue with missing headers in AV1 encoder
This commit fixes issue with missing SPS/PPS headers in video
encoded by AMF AV1 encoder.
Missing headers leads to broken seek in MPV video player.
Default value for property AV1_HEADER_INSERTION_MODE shouldn't be setup
to NONE (no headers insertion). We need to skip definition of this property,
because default value depends on USAGE property.

Signed-off-by: Dmitrii Ovchinnikov <ovchinnikov.dmitrii@gmail.com>
2023-11-12 22:57:17 +01:00
Rémi Denis-Courmont 427347309b checkasm: test with random bw value
With a value of zero, the function is a glorified memory copy.
2023-11-12 22:33:11 +02:00
Sebastian Ramacher 250471ea17 avcoded/fft: Fix memory leak if ctx2 is used
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-12 14:47:56 -03:00
Sebastian Ramacher a562cfee2e avcodec/fft: Use av_mallocz to avoid invalid free/uninit
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-12 14:47:56 -03:00
Rémi Denis-Courmont cd7b352c53 lavc/sbrdsp: R-V V autocorrelate
With 5 accumulator vectors and 6 inputs, this can only use LMUL=2.
Also the number of vector loop iterations is small, just 5 on 128-bit
vector hardware.

The vector loop is somewhat unusual in that it processes data in
descending memory order, in order to save on vector slides:
in descending order, we can extract elements to carry over to the next
iteration from the bottom of the vectors directly. With ascending order
(see in the Opus postfilter function), there are no ways to get the top
elements directly. On the downside, this requires the use of separate
shift and sub (the would-be SH3SUB instruction does not exist), with
a small pipeline stall on the vector load address.

The edge cases in scalar are done in scalar as this saves on loads
and remains significantly faster than C.

autocorrelate_c: 669.2
autocorrelate_rvv_f32: 421.0
2023-11-12 14:03:09 +02:00
Rémi Denis-Courmont f576a0835b lavc/aacpsdsp: rework R-V V hybrid_synthesis_deint
Given the size of the data set, strided memory accesses cannot be avoided.
We can still do better than the current code.

ps_hybrid_synthesis_deint_c:       12065.5
ps_hybrid_synthesis_deint_rvv_i32: 13650.2 (before)
ps_hybrid_synthesis_deint_rvv_i64:  8181.0 (after)
2023-11-12 14:03:09 +02:00
Rémi Denis-Courmont eb508702a8 lavc/aacpsdsp: rework R-V V add_squares
Segmented loads may be slower than not. So this advantageously uses a
unit-strided load and narrowing shifts instead.

Before:
ps_add_squares_c: 60757.7
ps_add_squares_rvv_f32: 22242.5

After:
ps_add_squares_c: 60516.0
ps_add_squares_rvv_i64: 17067.7
2023-11-12 14:03:09 +02:00
Dave Johansen ab78d22553 avformat/hlsenc: Fix name of flag in error message
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2023-11-12 16:47:40 +08:00
Dave Johansen 39878fc504 avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-11-12 16:44:47 +08:00
Léon Spaans 9bcbe04aa0 avformat/hlsenc: set HTTP options before writing WebVTT HLS playlists
Fixes: Erroneous HTTP POST instead of HTTP PUT for WebVTT HLS variant playlists.

Signed-off-by: Léon Spaans <leons@gridpoint.nl>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2023-11-12 11:19:31 +08:00
Paul B Mahol 3ff811a41f avfilter/vf_colortemperature: add gbr(a)pf support 2023-11-12 02:39:44 +01:00
Paul B Mahol 10440a489a avcodec/gif_parser: split correctly also bitstreams that do not have extension blocks 2023-11-12 02:19:53 +01:00
Paul B Mahol 553b31da68 avfilter/avf_showcwt: fix invalid write for full bargraph 2023-11-11 23:29:45 +01:00
Paul B Mahol fa4c2884dd avfilter/avf_showcwt: do not return initial black frames with negative timestamps 2023-11-11 17:53:26 +01:00
Nuo Mi 09f783692e avcodec/cbs_h266: H266RawSliceHeader, expose curr_subpic_idx
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-11 11:53:21 -03:00
Wenbin Chen fa81de4af0 libavfilter/dnn/openvino: Reduce redundant memory allocation
We can directly get data ptr from tensor, so that extral memory
allocation can be removed.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-11-11 09:32:31 +08:00
Paul B Mahol 49719d3cb5 avfilter/avf_showcwt: add fm frequency scaler 2023-11-11 01:19:44 +01:00
Michael Niedermayer 409b29d3f9
doc/APIchanges: Fill in missing values
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-10 02:04:25 +01:00
Michael Niedermayer ac4e3e188a
avcodec/evc_parse: Check num_remaining_tiles_in_slice_minus1
Fixes: out of array access
Fixes: 62467/clusterfuzz-testcase-minimized-ffmpeg_BSF_EVC_FRAME_MERGE_fuzzer-6092990982258688

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: "Dawid Kozinski/Multimedia (PLT) /SRPOL/Staff Engineer/Samsung Electronics" <d.kozinski@samsung.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-10 00:15:28 +01:00
Michael Niedermayer bb0a684d93
avcodec/4xm: Check for cfrm exhaustion
Fixes: index -1 out of bounds for type 'CFrameBuffer [100]'
Fixes: 63877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5854263397711872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-10 00:14:02 +01:00
Michael Niedermayer 19fcf43131
avformat/mov: Disallow FTYP after streams
Fixes: Assertion !c->fc->nb_streams failed at libavformat/mov.c:7799
Fixes: 63875/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5479178702815232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-10 00:14:02 +01:00
Niklas Haas 96d2a40b9e avcodec/pnm: explicitly tag color range
PGMYUV seems to be always limited range. This was a format originally
invented by FFmpeg at a time when YUVJ distinguished limited from full
range YUV, and this codec never appeared to output YUVJ in any
circumstance, so hard-coding limited range preserves the status quo.

The other formats are explicitly documented to be full range RGB/gray
formats. That said, don't tag them yet, due to outstanding bugs w.r.t
grayscale formats and color range handling.

This change in behavior updates a bunch of FATE tests in trivial ways
(added tagging being the only difference).
2023-11-09 12:53:35 +01:00
Niklas Haas cf60046cdc avfilter/vf_scale: tag output color space
When using vf_scale to force a specific output color space, also tag
this on the AVFrame. (Mirroring existing logic for output range)

Move the sanity fix for RGB after the new assignment, to avoid leaking
bogus YUV colorspace metadata for RGB spaces.
2023-11-09 12:53:35 +01:00
Niklas Haas 5d5bb77af1 avfilter/vf_scale: simplify color matrix parsing logic
No need to write a custom string parser when we can just use an integer
option with preset values. The various bits of fallback logic are wholly
redundant with equivalent logic already inside sws_getCoefficients.

Note: I disallowed setting 'out_color_matrix=auto', because this does
not do anything meaningful in the current code (just hard-codes
AVCOL_SPC_BT470BG fallback).
2023-11-09 12:53:35 +01:00
Niklas Haas ea9557043e avfilter/vf_alphamerge: warn if input not full range
Alpha planes must always be full range, so complain loudly if fed
limited range grayscale input.
2023-11-09 12:53:35 +01:00
Niklas Haas b7284f2410 avfilter/vf_extractplanes: tag alpha plane as full range
Alpha planes are explicitly full range, even for limited range YUVA
formats. Mark them as such.
2023-11-09 12:53:35 +01:00
Niklas Haas 736284e7b9 swscale/yuv2rgb: fix sws_getCoefficients for colorspace=0
The documentation states that invalid entries default to SWS_CS_DEFAULT.
A value of 0 is not a valid SWS_CS_*, yet the code incorrectly
hard-codes it to BT.709 coefficients instead of SWS_CS_DEFAULT.
2023-11-09 12:53:35 +01:00
Niklas Haas d043e5c54c swscale: don't omit ff_sws_init_range_convert for high-bit
This was a complete hack seemingly designed to work around a different
bug, which was fixed in the previous commit. As such, there is no more
reason not to do this, as it simply breaks changing color range in
sws_setColorspaceDetails for no reason.
2023-11-09 12:53:35 +01:00
Niklas Haas cedf589c09 swscale: fix sws_setColorspaceDetails after sws_init_context
More commonly, this fixes the case of sws_setColorspaceDetails after
sws_getContext, since the latter implies sws_init_context.

The problem here is that sws_init_context sets up the range conversion
and fast path tables based on the values of srcRange/dstRange at init
time. This may result in locking in a "wrong" path (either using
unscaled fast path when range conversion later required, or using
scaled slow path when range conversion becomes no longer required).

There are two way outs:

1. Always initialize range conversion and unscaled converters, even if
   they will be unused, and extend the runtime check.
2. Re-do initialization if the values change after
   sws_setColorspaceDetails.

I opted for approach 1 because it was simpler and easier to reason
about.

Reword the av_log message to make it clear that this special converter
is not necessarily used, depending on whether or not there is range
conversion or YUV matrix conversion going on.
2023-11-09 12:53:35 +01:00
Anton Khirnov acf63d5350 lavu/log: do not assume AVClass.item_name is always set 2023-11-09 11:25:17 +01:00
Anton Khirnov 26ebd96371 fftools/ffmpeg_filter: return an error on ofilter_alloc() failure 2023-11-09 11:25:17 +01:00
Anton Khirnov 5db07311a0 fftools/ffmpeg_filter: fail on ifilter_alloc() failure 2023-11-09 11:25:17 +01:00
Anton Khirnov ed0a50923a fftools/cmdutils: only set array size after allocation succeeded 2023-11-09 11:25:17 +01:00
Marvin Scholz e900a559c2 fate: enhance tpad filter test
Adds another test that uses the start_duration and stop_duration
options instead of start and stop.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-11-09 11:11:00 +01:00
Marvin Scholz 6667741029 avfilter/vf_tpad: fix check for drawing initialization
The check if drawing needs to be initialized and supported formats
should be drawable ones was flawed, as pad_stop/pad_start is only
populated from stop_duration/start_duration after these checks.

To fix that, check the _duration variants as well and for better
readability and maintainability break the check out into its own
helper.

Fixes a regression from 86b252ea9d
Fix #10621

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-11-09 11:11:00 +01:00
Lynne 99fcdee5e8
nlmeans_vulkan: fix offsets calculation and various stride issues
We calculated offsets as pairs, but addressed them in the shader
as single float values, while reading them as ivec2s.

Also removes unused code (was provisionally added if cooperative matrices
could be used, but that turned out to be impossible).
2023-11-09 09:14:18 +01:00
Víctor Manuel Jáquez Leal 854012ec59 avutil/hwcontext_vulkan: get VkFormatFeatureFlagBits2
Rather than the VkFormatFeatureFlagBits enum

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2023-11-09 09:13:47 +01:00
Zhao Zhili 6f39dee974 avutil/hwcontext_vulkan: fix run on macOS
VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME is required on macOS,
and VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR flag should
be set.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-09 19:23:01 +08:00
Frank Plowman f16900bda2 doc/html: fix styling issue with Texinfo 7.0
Texinfo 7.0 produces quite different HTML to Texinfo 6.8. Without
this change, enumerated option flags (i.e. Possible values of x
are...) render as white text on a white background with Texinfo 7.0
and are unreadable. This change removes a style for the selector
`.table .table` which causes the background to turn white for these
elements. As far as I can tell, it is not actually used anywhere in
files generated by Texinfo 6.8.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2023-11-08 23:54:23 +01:00
Frank Plowman f01fdedb69 doc/html: support texinfo 7.0
Resolves trac ticket #10636 (http://trac.ffmpeg.org/ticket/10636).

Texinfo 7.0, released in November 2022, changed the names of various
functions. Compiling docs with Texinfo 7.0 resulted in warnings and
improperly formatted documentation. More old names appear to have
been removed in Texinfo 7.1, released October 2023, which causes docs
compilation to fail.

This commit addresses the issue by adding logic to switch between the old
and new function names depending on the Texinfo version. Texinfo 6.8
produces identical documentation before and after the patch.

CC
https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1938238.html
https://bugs.gentoo.org/916104

Signed-off-by: Frank Plowman <post@frankplowman.com>
2023-11-08 23:53:19 +01:00
Anton Khirnov 2b4035d1dc doc/community: improve wording
By intent, and in practice, the "active contributor" criterion applies
to the person authoring the commits, not the one pushing them into the
repository.
2023-11-08 17:01:50 +01:00
Anton Khirnov 88f9164f97 doc/community: update the rules according to voting results
Cf.:
* http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-October/316054.html
* http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-November/316618.html
2023-11-08 17:01:50 +01:00
James Almer b82957a66a avutil: bump minor version after recent commits
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-08 10:13:50 -03:00
James Almer 04e53927ad avutil/channel_layout: add a 9.1.4 channel layout
Mapping to ITU-R BS.2051-3 "Sound System G" and ITU-R BS.1196-8 "Channel
Configuration 20".

Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-08 10:09:46 -03:00
James Almer b4169760b0 avutil/channel_layout: add a 7.2.3 channel layout
Mapping to ITU-R BS.2051-3 "Sound System F" and ITU-R BS.1196-8 "Channel
Configuration 15".

Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-08 10:09:46 -03:00
Henrik Gramner ed8ddf0bd3 x86inc: Add REPX macro to repeat instructions/operations
When operating on large blocks of data it's common to repeatedly use
an instruction on multiple registers. Using the REPX macro makes it
easy to quickly write dense code to achieve this without having to
explicitly duplicate the same instruction over and over.

For example,

    REPX {paddw x, m4}, m0, m1, m2, m3
    REPX {mova [r0+16*x], m5}, 0, 1, 2, 3

will expand to

    paddw       m0, m4
    paddw       m1, m4
    paddw       m2, m4
    paddw       m3, m4
    mova [r0+16*0], m5
    mova [r0+16*1], m5
    mova [r0+16*2], m5
    mova [r0+16*3], m5

Commit taken from x264:
6d10612ab0

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-11-08 13:49:08 +01:00
Zhao Zhili 5a2ca4bf7a MAINTAINERS: add myself as a mediacodec and videotoolbox maintainer
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-08 16:15:04 +08:00
Peter Ross 10869cd849 avcodec: LEAD MCMP decoder
Partially fixes ticket #798

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Peter Ross <pross@xvid.org>
2023-11-08 17:37:58 +11:00
Zhao Zhili f084e9b0be avdevice/android_camera: fix build failure due to typo
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-07 11:10:07 +08:00
Rémi Denis-Courmont adc87a5f7c lavc/opusdsp: rewrite R-V V postfilter
This uses a more traditional approach allowing up processing of up to
period minus two elements per iteration. This also allows the algorithm
to work for all and any vector length.

As the T-Head C908 device under test can load 16 elements loop, there is
unsurprisingly a little performance drop when the period is minimal and
the parallelism is capped at 13 elements:

Before:
postfilter_15_c:         21222.2
postfilter_15_rvv_f32:   22007.7
postfilter_512_c:        20189.7
postfilter_512_rvv_f32:  22004.2
postfilter_1022_c:       20189.7
postfilter_1022_rvv_f32: 22004.2

After:
postfilter_15_c:         20189.5
postfilter_15_rvv_f32:    7057.2
postfilter_512_c:        20189.5
postfilter_512_rvv_f32:   5667.2
postfilter_1022_c:       20192.7
postfilter_1022_rvv_f32:  5667.2
2023-11-06 22:09:30 +02:00
Rémi Denis-Courmont 02594c8c01 lavc/pixblockdsp: rework R-V V get_pixels_unaligned
As in the aligned case, we can use VLSE64.V, though the way of doing so
gets more convoluted, so the performance gains are more modest:

get_pixels_unaligned_c:       126.7
get_pixels_unaligned_rvv_i32: 145.5 (before)
get_pixels_unaligned_rvv_i64:  62.2 (after)

For the reference, those are the aligned benchmarks (unchanged) on the
same T-Head C908 hardware:

get_pixels_c:                 126.7
get_pixels_rvi:                85.7
get_pixels_rvv_i64:            33.2
2023-11-06 19:42:49 +02:00
Rémi Denis-Courmont f68ad5d2de lavc/sbrdsp: R-V V sbr_hf_g_filt
hf_g_filt_c:      1552.5
hf_g_filt_rvv_f32: 679.5
2023-11-06 19:42:49 +02:00
Paul B Mahol 44a0148fad avfilter/af_adynamicequalizer: do detection of threshold first
Makes better results in final output if multiple filters are cascaded at once.
2023-11-05 16:00:29 +01:00
Paul B Mahol 799fad1828 avfilter/af_adynamicequalizer: always start filtering from unit gain 2023-11-05 16:00:28 +01:00
Anton Khirnov f9fdaa2ca9 configure: warn when threading is disabled
Explicitly state what the implications of this are.
2023-11-05 11:30:13 +01:00
Anton Khirnov ad3df6bf35 lavf/smacker: export sample_aspect_ratio
Partially fixes #10617
2023-11-05 11:30:13 +01:00
Rob Hall 1a7a85137e ffbuild: Add gzip -n flag to fix reproducible builds
Without this flag, timestamps were embedded into the final
binary if CUDA was enabled.

Signed-off-by: Rob Hall <robxnanocode@outlook.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-11-05 11:30:13 +01:00
Paul B Mahol fd1712b6fb avfilter/af_adynamicequalizer: merge direction option with mode option
More user-friendly and self-explanatory what certain mode does.
2023-11-04 15:39:24 +01:00
Paul B Mahol 43226efc21 avfilter/af_adynamicequalizer: add new structure to hold filtering state 2023-11-04 15:39:23 +01:00
Andreas Rheinhardt 3f890fbfd9 avcodec/cbs_h2645: Fix leak of SPS VUI extension data
Fixes: VUI extension leak
Fixes: 63004/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_METADATA_fuzzer-4928832253329408

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:27:41 +01:00
Andreas Rheinhardt de4846dd18 avfilter/deshake: Merge header into its only user
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:26:25 +01:00
Andreas Rheinhardt 2fdaeec41b avfilter/vf_deshake: Remove unnecessary emms_c
Redundant since ea043cc53e
(which made 16x16 no longer use MMX).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:26:25 +01:00
Andreas Rheinhardt 392ab35db1 avfilter/vf_mpdecimate: Remove emms_c
Unnecessary now that the pixelutils API abides by the ABI.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:26:25 +01:00
Andreas Rheinhardt 5b85ca5317 avutil/x86/pixelutils: Empty MMX state in ff_pixelutils_sad_8x8_mmxext
We currently mostly do not empty the MMX state in our MMX
DSP functions; instead we only do so before code that might
be using x87 code. This is a violation of the System V i386 ABI
(and maybe of other ABIs, too):
"The CPU shall be in x87 mode upon entry to a function. Therefore,
every function that uses the MMX registers is required to issue an
emms or femms instruction after using MMX registers, before returning
or calling another function." (See 2.2.1 in [1])
This patch does not intend to change all these functions to abide
by the ABI; it only does so for ff_pixelutils_sad_8x8_mmxext, as this
function can by called by external users, because it is exported
via the pixelutils API. Without this, the following fragment will
assert (on x86/x64):
    uint8_t src1[8 * 8], src2[8 * 8];
    av_pixelutils_sad_fn fn = av_pixelutils_get_sad_fn(3, 3, 0, NULL);
    fn(src1, 8, src2, 8);
    av_assert0_fpu();

[1]: https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/intel386-psABI-1.1.pdf

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:26:03 +01:00
Andreas Rheinhardt 8661b5e8f9 avfilter/vf_format: Deduplicate inputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt c32c1a18b9 avfilter/vsrc_testsrc: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt 748c168f8e avfilter/vf_xmedian: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt 93abb9b560 avfilter/vf_hsvkey: Deduplicate inputs and outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt 50d3c5bd8c avfilter/vf_convolve: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt e557d89ac1 avfilter/vf_chromakey: Deduplicate inputs and outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt 2e2c28119f avfilter/vf_blend: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt 1d33a310df avfilter/vf_aspect: Deduplicate inputs
Also avoid using the avfilter-prefix for static objects.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt a40f833bac avfilter/f_graphmonitor: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt a02670ded7 avfilter/f_drawgraph: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt 5935423e1e avcodec/aactab: Deduplicate swb_offset_960 tabs
swb_offset_960_48 and swb_offset_960_32 coincide.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Michael Niedermayer 4fb9d94688
avformat/lafdec: Check for 0 parameters
Fixes: Timeout
Fixes: 63661/clusterfuzz-testcase-minimized-ffmpeg_dem_LAF_fuzzer-6615365234589696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-03 22:16:33 +01:00
Michael Niedermayer 03a4aa9699
avcodec/flicvideo: consider width in copy loops
Fixes: out of array write
Fixes: 63520/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-4876198087622656
Regression since: c7f8d42c12 (was not posted to ffmpeg-devel)

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-03 22:16:33 +01:00
Michael Niedermayer c0a18e884c
avfilter/buffersink: fix order of operation with = and <0
Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-03 22:17:18 +01:00
Michael Niedermayer 9450a4a7fe
avfilter/framesync: fix order of operation with = and <0
Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-03 22:16:33 +01:00
Andreas Rheinhardt 155f0c8ef7 avformat/webpenc: Check seeks
Addresses the issue reported in ticket #4609.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-03 14:47:57 +01:00
Zhao Zhili e920a84801 mailmap: remap my email accounts
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-11-03 20:57:49 +08:00
Reimar Döffinger 9dd49c8b52 libavutil/log.c: only include valgrind header when used.
This is cleaner, but it is also a workaround for when
the header exists, but cannot be compiled.
This will happen when the compiler has no inline asm
support.
Possibly the configure check should be improved as well.
2023-11-02 21:03:43 +01:00
Reimar Döffinger 0ea184fc39 libavutil/aarch64/cpu.c: HWCAPS requires inline asm support.
Fixes compilation with tcc, which does not have aarch64
inline asm support.
2023-11-02 21:03:43 +01:00
Reimar Döffinger a31992634f configure: fix _Pragma check.
The test can currently pass when _Pragma is not supported, since
_Pragma might be treated as a implicitly declared function.
This happens e.g. with tinycc.
Extending the check to 2 pragmas both matches the actual use
better and avoids this misdetection.
2023-11-02 21:03:43 +01:00
Andreas Rheinhardt 02064ba3a3 fftools/ffmpeg_mux_init: Restrict disabling automatic copying of metadata
Fixes ticket #10638 (and should also fix ticket #10482)
by restoring the behaviour from before
3c7dd5ed37.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-02 13:24:21 +01:00
zheng qian 4dbfb52230 doc/decoders: correctly note an option's default in libaribcaption
The `-caption_encoding` option was reported as having a default value of
'ass', whereas it's actually 'auto'.

Signed-off-by: zheng qian <xqq@xqq.im>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2023-11-02 14:07:00 +05:30
Rémi Denis-Courmont d06fd18f8f lavc/sbrdsp: R-V V neg_odd_64
With 128-bit vectors, this is mostly pointless but also harmless.
Performance gains should be more noticeable with larger vector sizes.

neg_odd_64_c:       76.2
neg_odd_64_rvv_i64: 74.7
2023-11-01 22:53:26 +02:00
Rémi Denis-Courmont b0aba7dd0c lavc/sbrdsp: R-V V sum_square
sum_square_c:       803.5
sum_square_rvv_f32: 283.2
2023-11-01 22:53:26 +02:00
Rémi Denis-Courmont 86bee42473 lavc/sbrdsp: R-V V sum64x5
sum64x5_c:       385.0
sum64x5_rvv_f32: 116.0
2023-11-01 22:53:26 +02:00
Andreas Rheinhardt eba73142ad avcodec/vp9: Join extradata buffer pools
Up until now each thread had its own buffer pool for extradata
buffers when using frame-threading. Each thread can have at most
three references to extradata and in the long run, each thread's
bufferpool seems to fill up with three entries. But given
that at any given time there can be at most 2 + number of threads
entries used (the oldest thread can have two references to preceding
frames that are not currently decoded and each thread has its own
current frame, but there can be no references to any other frames),
this is wasteful. This commit therefore uses a single buffer pool
that is synced across threads.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-01 20:16:02 +01:00
Andreas Rheinhardt 0c44f63b02 avcodec/refstruct: Allow to share pools
To do this, make FFRefStructPool itself refcounted according
to the RefStruct API.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-01 20:15:54 +01:00
Andreas Rheinhardt 92abc7266b avcodec/vaapi_encode: Use RefStruct pool API, stop abusing AVBuffer API
Up until now, the VAAPI encoder uses fake data with the
AVBuffer-API: The data pointer does not point to real memory,
but is instead just a VABufferID converted to a pointer.
This has probably been copied from the VAAPI-hwcontext-API
(which presumably does it to avoid allocations).

This commit changes this without causing additional allocations
by switching to the RefStruct-pool API. This also fixes an
unchecked av_buffer_ref().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-01 20:14:22 +01:00
Andreas Rheinhardt 8c0350f57e avcodec/vp9: Use RefStruct-pool API for extradata
It avoids allocations and corresponding error checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-01 20:14:06 +01:00
Andreas Rheinhardt 090d9956fd avcodec/refstruct: Allow to always return zeroed pool entries
This is in preparation for the following commit.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-01 20:13:40 +01:00
Andreas Rheinhardt e01e30ede1 avcodec/nvdec: Use RefStruct-pool API for decoder pool
It involves less allocations, in particular no allocations
after the entry has been created. Therefore creating a new
reference from an existing one can't fail and therefore
need not be checked. It also avoids indirections and casts.

Also note that nvdec_decoder_frame_init() (the callback
to initialize new entries from the pool) does not use
atomics to read and replace the number of entries
currently used by the pool. This relies on nvdec (like
most other hwaccels) not being run in a truely frame-threaded
way.

Tested-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-01 20:13:01 +01:00
Andreas Rheinhardt fd2e65871c avcodec/hevcdec: Use RefStruct-pool API instead of AVBufferPool API
It involves less allocations and therefore has the nice property
that deriving a reference from a reference can't fail,
simplifying hevc_ref_frame().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-01 20:10:20 +01:00
Andreas Rheinhardt 736b510fcc avcodec/h264dec: Use RefStruct-pool API instead of AVBufferPool API
It involves less allocations and therefore has the nice property
that deriving a reference from a reference can't fail.
This allows for considerable simplifications in
ff_h264_(ref|replace)_picture().
Switching to the RefStruct API also allows to make H264Picture
smaller, because some AVBufferRef* pointers could be removed
without replacement.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-01 20:07:56 +01:00
Andreas Rheinhardt 26c0a7321f avcodec/refstruct: Add RefStruct pool API
Very similar to the AVBufferPool API, but with some differences:
1. Reusing an already existing entry does not incur an allocation
at all any more (the AVBufferPool API needs to allocate an AVBufferRef).
2. The tasks done while holding the lock are smaller; e.g.
allocating new entries is now performed without holding the lock.
The same goes for freeing.
3. The entries are freed as soon as possible (the AVBufferPool API
frees them in two batches: The first in av_buffer_pool_uninit() and
the second immediately before the pool is freed when the last
outstanding entry is returned to the pool).
4. The API is designed for objects and not naked buffers and
therefore has a reset callback. This is called whenever an object
is returned to the pool.
5. Just like with the RefStruct API, custom allocators are not
supported.

(If desired, the FFRefStructPool struct itself could be made
reference counted via the RefStruct API; an FFRefStructPool
would then be freed via ff_refstruct_unref().)

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-01 20:07:23 +01:00
Rémi Denis-Courmont 92bcc6703a lavc/pixblockdsp: remove R-V V get_pixels_16
In the aligned case, the existing RVI assembler is actually much
faster. In the unaligned case, there is nothing much to gain over C.
2023-11-01 19:27:22 +02:00
Rémi Denis-Courmont 28840cf499 lavc/jpeg2000dsp: R-V V rct_int
jpeg2000_rct_int_c:       2592.2
jpeg2000_rct_int_rvv_i32: 1154.2
2023-11-01 18:52:55 +02:00
Rémi Denis-Courmont 73dea2bb91 lavc/jpeg2000dsp: R-V V ict_float
jpeg2000_ict_float_c:       3112.2
jpeg2000_ict_float_rvv_f32: 1225.0
2023-11-01 18:52:55 +02:00
Rémi Denis-Courmont b2a441a3be lavc/jpeg2000dsp: make coefficients extern
This is so that they can be loaded from assembler, rather than
duplicated.
2023-11-01 18:52:55 +02:00
Michael Niedermayer a5259f326b
avcodec/vlc: Pass VLC_MULTI_ELEM directly not by pointer
This makes the code more testable as uninitialized fields are 0
and not random values from the last call

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-01 16:40:22 +01:00
Michael Niedermayer 8516609edd
avcodec/vlc: Replace mysterious max computation code in multi vlc
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-01 16:40:21 +01:00
Michael Niedermayer 356b1ba765
avcodec/vlc: Skip subtable entries in multi VLC
These entries do not correspond to VLC symbols that can be used
they do corrupt various variables like min/max bits

This also no longer assumes that there is a single non subtable
entry
Probably fixes some infinite loops too

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-01 16:40:21 +01:00
Michael Niedermayer c2f2bf82c1
tools/target_dec_fuzzer: Adjust threshold for CSCD
Fixes: Timeout
Fixes: 63362/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CSCD_fuzzer-4694620065628160

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-01 16:40:21 +01:00
Michael Niedermayer 2817efbba3
avcodec/dovi_rpu: Use 64 bit in get_us/se_coeff()
Fixes: shift exponent 32 is too large for 32-bit type 'int'
Fixes: 63151/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5067531154751488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-01 16:40:20 +01:00
Michael Niedermayer 2def617787
avcodec/apedec: Fix integer overflow in predictor_decode_stereo_3950()
Fixes: signed integer overflow: 1900031961 + 553590817 cannot be represented in type 'int'
Fixes: 63061/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5166188298371072

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-01 16:40:20 +01:00
Michael Niedermayer 98c2711b58
avformat/mov: Check that is_still_picture_avif has no trak based streams
Fixes: Assertion failure in mov_read_iloc( in mov_read_iloc())
Fixes: 62866/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5282997370486784

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-01 16:40:20 +01:00
Michael Niedermayer 68cc1744db
avcodec/evc_parse: Check tid
The check is based on not infinite looping. It is likely
a more strict check can be done

Fixes: Infinite loop
Fixes: 62473/clusterfuzz-testcase-minimized-ffmpeg_BSF_EVC_FRAME_MERGE_fuzzer-5719883750703104
Fixes: 62765/clusterfuzz-testcase-minimized-ffmpeg_dem_EVC_fuzzer-6448531252314112
Fixes: 63378/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGPS_fuzzer-6504993844494336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: "Dawid Kozinski/Multimedia (PLT) /SRPOL/Staff Engineer/Samsung Electronics" <d.kozinski@samsung.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-01 16:40:19 +01:00
Michael Niedermayer d35eecd24f
avcodec/evc_parse: remove pow() and log2()
The use of float based functions is both unneeded and wrong due to unpredictable rounding

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-01 16:40:03 +01:00
Andreas Rheinhardt f2687a3b69 avcodec/wmavoice: Avoid unnecessary VLC structure
Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 5615f9dab4 avcodec/wmaprodec: Avoid superfluous VLC structures
For all VLCs here, the number of bits of the VLC is write-only,
because it is hardcoded at the call site. Therefore one can replace
these VLC structures with the only thing that is actually used:
The pointer to the VLCElem table. And in most cases one can even
avoid this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 7e2120c4d9 avcodec/mpeg12: Avoid unnecessary VLC structures
Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying tables directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt c9aa80c313 avcodec/mpegaudiodec_common: Avoid superfluous VLC structures
For some VLCs here, the number of bits of the VLC is
write-only, because it is hardcoded at the call site.
Therefore one can replace these VLC structures with
the only thing that is actually used: The pointer
to the VLCElem table.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 5dc31bc67b avcodec/aacps_common: Apply offset for VLCs during init
This avoids having to apply it later after every get_vlc2().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 40a8cb9e6c avcodec/aacps_common: Combine huffman tabels
This allows to avoid the relocations inherent in an array
to individual tables; it also reduces padding.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 774611a349 avcodec/aacps_common: Switch to ff_vlc_init_tables_from_lengths()
It allows to replace codes of type uint16_t or uint32_t
by symbols of type uint8_t.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt eb422c606a avcodec/aacps_common: Avoid superfluous VLC structures
For all VLCs here, the number of bits of the VLC is
write-only, because it is hardcoded at the call site.
Therefore one can replace these VLC structures with
the only thing that is actually used: The pointer
to the VLCElem table.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 4fe91e3676 avcodec/aacps: Move initializing common stuff to aacdec_common.c
ff_ps_init() initializes some tables for AAC parametric stereo
and some of them are only valid for the fixed- or floating-point
decoder, whereas others (namely VLCs) are valid for both.
The latter are therefore initialized by ff_ps_init_common()
and because the two versions of ff_ps_init() can be run
concurrently, it is guarded by an AVOnce.

Yet now that there is ff_aacdec_common_init_once() there is
a better way to do this: Call ff_ps_init_common()
from ff_aacdec_common_init_once(). That way there is no need
to guard ff_ps_init_common() by an AVOnce any more.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 7f66d9d6c5 avcodec/aacdec_common: Apply offset for SBR VLCs during init
This avoids having to apply it later after every get_vlc2().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 1aca4e7fc5 avcodec/aacdec_common: Combine huffman tabs
This allows to avoid the relocations inherent in a table
to individual tables; it also reduces padding.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 2c131f126d avcodec/aacdec_common: Switch to ff_vlc_init_tables_from_lengths()
It allows to replace code tables of type uint32_t or uint16_t
by symbols of type uint8_t. It is also faster.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 0b4e69cc87 avcodec/aacdec_common: Avoid superfluous VLC structures for SBR VLCs
For all VLCs here, the number of bits of the VLC is
write-only, because it is hardcoded at the call site.
Therefore one can replace these VLC structures with
the only thing that is actually used: The pointer
to the VLCElem table.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 22d60524d8 avcodec/aacsbr_template: Deduplicate VLCs
The VLCs, their init code and the tables used for initialization
are currently duplicated for the floating- and fixed-point decoders.
This commit stops doing so and moves this stuff to aacdec_common.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 4d6042e9d7 avcodec/aacdec_common: Avoid superfluous VLC structures
For all VLCs here, the number of bits of the VLC is
write-only, because it is hardcoded at the call site.
Therefore one can replace these VLC structures with
the only thing that is actually used: The pointer
to the VLCElem table. And in some cases one can even
avoid this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Lynne 0e8abf2698
bwdif_vulkan: fix artifacts on vulkan decode images
Due to making the decode frames context use the coded size, the
filter started to display those artifacts as it reused the input frame's size.

Change it to instead output the real image size for images, not the input.
2023-10-31 21:35:28 +01:00
Benjamin Cheng 4536de3769 vulkan_h264: fix long-term ref handling
h->long_ref isn't guaranteed to be contiguously filled. Use the approach
from both vaapi_h264 and vdpau_h264 which goes through the 16 frames in
h->long_ref to find the LTR entries.

Fixes MR2_MW_A.264 from JVT-AVC_V1.
2023-10-31 21:35:23 +01:00
Andreas Rheinhardt 1e63e24c76 avcodec/aactab: Improve included headers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 30deaba97b avcodec/aacdec_template: Don't init unused table for fixed-point decoder
The fixed-point decoder actually does not use the floating-point
tables initialized by ff_aac_tableinit() at all. So don't
initialize them for it; instead merge initializing these tables
into ff_aac_float_common_init() which is already the function
for the common static initializations of the floating-point
AAC decoder and the (also floating-point) AAC encoder.
Doing so saves also one AVOnce.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 3b080fe7af avcodec/aacdec_template: Deduplicate VLCs
They (as well as their init code) are currently duplicated
for the floating- and fixed-point decoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 1f15a7e9a8 avcodec/aacdectab: Deduplicate common decoder tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 8c1e71a811 avcodec/aacps: Pass logctx as void* instead of AVCodecContext*
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 70b5d9c569 avcodec/aacps: Remove unused AVCodecContext* parameter from ff_ps_apply
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 36b5f71b1f avcodec/msmpeg4dec: Avoid superfluous VLC structures
For all VLCs here, the number of bits of the VLC is write-only,
because it is hardcoded at the call site. Therefore one can replace
these VLC structures with the only thing that is actually used:
The pointer to the VLCElem table. And in some cases one can even
avoid this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 5a694d62c5 avcodec/mpeg4videodec: Avoid superfluous VLC structures
For all VLCs here, the number of bits of the VLC is
write-only, because it is hardcoded at the call site.
Therefore one can replace these VLC structures with
the only thing that is actually used: The pointer
to the VLCElem table. And in some cases one can even
avoid this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 8c39b2bca7 avcodec/mss4: Partially inline max_depth and nb_bits of VLC
It is known at compile-time for the vec_entry_vlcs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 05577d2c76 avcodec/indeo2: Avoid unnecessary VLC structure
Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 25b9ff2780 avcodec/4xm: Avoid unnecessary VLC structures
Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt e5dcde620d avcodec/vc1: Avoid superfluous VLC structures
For all VLCs here, the number of bits of the VLC is
write-only, because it is hardcoded at the call site.
Therefore one can replace these VLC structures with
the only thing that is actually used: The pointer
to the VLCElem table. And in some cases one can even
avoid this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt fd4cb6ebee avcodec/speedhqdec: Avoid unnecessary VLC structure
Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 0a610e22c1 avcodec/lagarith: Avoid unnecessary VLC structure
Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt e3ad5b9784 avcodec/imm4: Avoid unnecessary VLC structure
Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt f6c5d04b6d avcodec/mimic: Avoid unnecessary VLC structure
Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 827d0325a9 avcodec/mobiclip: Avoid unnecessary VLC structure
Everything besides VLC.table is basically write-only
and only VLC.table needs to be retained.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 36e7f9b339 avcodec/vqcdec: Avoid unnecessary VLC structure
Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 99ed510d4b avcodec/mv30: Avoid unnecessary VLC structure
Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt b60a3f70be avcodec/wnv1: Avoid unnecessary VLC structure
Everything besides VLC.table is basically write-only
and even VLC.table can be removed by accessing the
underlying table directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 1ae750a16e avcodec/rv34: Constify pointer to static object
Said object is only allowed to be modified during its
initialization and is immutable afterwards.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 716ddc8c62 avcodec/rv34: Avoid superfluous VLC structures
For most VLCs here, the number of bits of the VLC is
write-only, because it is hardcoded at the call site.
Therefore one can replace these VLC structures with
the only thing that is actually used: The pointer
to the VLCElem table.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 73fa6d486d avcodec/vp3: Reindent after the previous commits
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 75c6a253a4 avcodec/vp3: Avoid complete VLC struct, only use VLCElem*
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 6c7a344b65 avcodec/vp3: Share coefficient VLCs between threads
These VLCs are very big: The VP3 one have 164382 elements
but due to the overallocation enough memory for 313344 elements
are allocated (1.195 MiB with sizeof(VLCElem) == 4);
for VP4 the numbers are very similar, namely 311296 and 164392
elements. Since 1f4cf92cfb, each
frame thread has its own copy of these VLCs.

This commit fixes this by sharing these VLCs across threads.
The approach used here will also make it easier to support
stream reconfigurations in case of frame-multithreading
in the future.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 7fee90efac avcodec/imc: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 6fb96ef755 avcodec/atrac9dec: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 4c7e8b969e avcodec/clearvideo: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt c95e123e8c avcodec/intrax8: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 886fbec82f avcodec/mpc7: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt e5e05fd3c8 avcodec/rv40: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 460c6ae597 avcodec/svq1dec: Increase size of VLC
It allows to reduce the number of maximum reloads by one.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 7d542e26a9 avcodec/svq1dec: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt 7902c0df4c avcodec/msmpeg4_vc1_data: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.
Also combine the ff_msmp4_dc_(luma|chroma)_vlcs as well
as the tables used to generate them to simplify the code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Andreas Rheinhardt ff886fc282 avcodec/ituh263dec: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Andreas Rheinhardt 5a9e185dfc avcodec/h261dec: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Andreas Rheinhardt 363837de0e avcodec/faxcompr: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Andreas Rheinhardt a99285aedf avcodec/asvdec: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Andreas Rheinhardt ab8a8246c8 avcodec/h264_cavlc: Remove code duplication
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Andreas Rheinhardt bd4c778e19 avcodec/h264_cavlc: Avoid indirection for coefficient table VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Andreas Rheinhardt fe748ddf62 avcodec/h264_cavlc: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Andreas Rheinhardt c630d76b27 avcodec/vp3: Increase some VLC tables
These are quite small and therefore force reloads
that can be avoided by modest increases in the number of bits used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Andreas Rheinhardt 1fee3a3dce avcodec/vp3: Make VLC tables static where possible
This is especially important for frame-threaded decoders like
this one, because up until now each thread had an identical
copy of all these VLC tables.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Andreas Rheinhardt edc50658d9 avcodec/vlc: Add functions to init static VLCElem[] without VLC
For lots of static VLCs, the number of bits is not read from
VLC.bits, but rather a compile-constant that is hardcoded
at the callsite of get_vlc2(). Only VLC.table is ever used
and not using it directly is just an unnecessary indirection.

This commit adds helper functions and macros to avoid the VLC
structure when initializing VLC tables; there are 2x2 functions:
Two choices for init_sparse or from_lengths and two choices
for "overlong" initialization (as used when multiple VLCs are
initialized that share the same underlying table).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Rémi Denis-Courmont 424c8ceb08 lavc/huffyuvdsp: R-V V add_int16
add_int16_128_c:      2390.5
add_int16_128_rvv_i32: 832.0
add_int16_rnd_width_c:      2390.2
add_int16_rnd_width_rvv_i32: 832.5
2023-10-31 21:33:25 +02:00
Rémi Denis-Courmont 7e1cdc69fb lavc/utvideodsp: R-V V restore_rgb_planes10
restore_rgb_planes10_c:      185852.2
restore_rgb_planes10_rvv_i32: 90130.5
2023-10-31 21:33:25 +02:00
Rémi Denis-Courmont 4aea0da230 lavc/utvideodsp: R-V V restore_rgb_planes
restore_rgb_planes_c:      133065.7
restore_rgb_planes_rvv_i32: 33317.2
2023-10-31 21:33:25 +02:00
Niklas Haas 6aff17a451 avformat/vf_vapoursynth: simplify xyz format check 2023-10-31 15:46:38 +01:00
Niklas Haas 93f07d98d9 avutil/pixdesc: simplify xyz pixfmt check 2023-10-31 15:46:38 +01:00
Niklas Haas d312a33ed2 avfilter/drawutils: remove redundant xyz format check
The code above this does a whitelist on desc->flags, which now includes
the (disallowed) AV_PIX_FMT_FLAG_XYZ for XYZ formats. So there is no
more need for a separate check, here.
2023-10-31 15:46:38 +01:00
Niklas Haas 57c16323f2 avutil/pixdesc: add AV_PIX_FMT_FLAG_XYZ
There are already several places in the codebase that match desc->name
against "xyz", and many downstream clients replicate this behavior.
I have no idea why this is not just a flag.

Motivated by my desire to add yet another check for XYZ to the codebase,
and I'd rather not keep copy/pasting a string comparison hack.
2023-10-31 15:46:07 +01:00
Niklas Haas 96dfc4481b avfilter/drawutils: ban XYZ formats
These are not supported by the drawing functions at all, and were
incorrectly advertised as supported in the past.

Note: This check is added only to separate the logic change from the API
change in the following commit, and will be removed again after it
becomes redundant.
2023-10-31 15:43:30 +01:00
Logan Lyu 55f28eb627 lavc/aarch64: new optimization for 8-bit hevc_qpel_hv
checkasm bench:
put_hevc_qpel_hv4_8_c: 422.1
put_hevc_qpel_hv4_8_i8mm: 101.6
put_hevc_qpel_hv6_8_c: 756.4
put_hevc_qpel_hv6_8_i8mm: 225.9
put_hevc_qpel_hv8_8_c: 1189.9
put_hevc_qpel_hv8_8_i8mm: 296.6
put_hevc_qpel_hv12_8_c: 2407.4
put_hevc_qpel_hv12_8_i8mm: 552.4
put_hevc_qpel_hv16_8_c: 4021.4
put_hevc_qpel_hv16_8_i8mm: 886.6
put_hevc_qpel_hv24_8_c: 8992.1
put_hevc_qpel_hv24_8_i8mm: 1968.9
put_hevc_qpel_hv32_8_c: 15197.9
put_hevc_qpel_hv32_8_i8mm: 3209.4
put_hevc_qpel_hv48_8_c: 32811.1
put_hevc_qpel_hv48_8_i8mm: 7442.1
put_hevc_qpel_hv64_8_c: 58106.1
put_hevc_qpel_hv64_8_i8mm: 12423.9

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-31 14:14:21 +02:00
Logan Lyu 97a9d12657 lavc/aarch64: new optimization for 8-bit hevc_qpel_v
checkasm bench:

put_hevc_qpel_v4_8_c: 138.1
put_hevc_qpel_v4_8_neon: 41.1
put_hevc_qpel_v6_8_c: 276.6
put_hevc_qpel_v6_8_neon: 60.9
put_hevc_qpel_v8_8_c: 478.9
put_hevc_qpel_v8_8_neon: 72.9
put_hevc_qpel_v12_8_c: 1072.6
put_hevc_qpel_v12_8_neon: 203.9
put_hevc_qpel_v16_8_c: 1852.1
put_hevc_qpel_v16_8_neon: 264.1
put_hevc_qpel_v24_8_c: 4137.6
put_hevc_qpel_v24_8_neon: 586.9
put_hevc_qpel_v32_8_c: 7579.1
put_hevc_qpel_v32_8_neon: 1036.6
put_hevc_qpel_v48_8_c: 16355.6
put_hevc_qpel_v48_8_neon: 2326.4
put_hevc_qpel_v64_8_c: 33545.1
put_hevc_qpel_v64_8_neon: 4126.4

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-31 14:14:21 +02:00
Logan Lyu 265450b89e lavc/aarch64: new optimization for 8-bit hevc_epel_hv
checkasm bench:
put_hevc_epel_hv4_8_c: 213.7
put_hevc_epel_hv4_8_i8mm: 59.4
put_hevc_epel_hv6_8_c: 350.9
put_hevc_epel_hv6_8_i8mm: 130.2
put_hevc_epel_hv8_8_c: 548.7
put_hevc_epel_hv8_8_i8mm: 136.9
put_hevc_epel_hv12_8_c: 1126.7
put_hevc_epel_hv12_8_i8mm: 302.2
put_hevc_epel_hv16_8_c: 1925.2
put_hevc_epel_hv16_8_i8mm: 459.9
put_hevc_epel_hv24_8_c: 4301.9
put_hevc_epel_hv24_8_i8mm: 1024.9
put_hevc_epel_hv32_8_c: 7509.2
put_hevc_epel_hv32_8_i8mm: 1680.4
put_hevc_epel_hv48_8_c: 16566.9
put_hevc_epel_hv48_8_i8mm: 3945.4
put_hevc_epel_hv64_8_c: 29134.2
put_hevc_epel_hv64_8_i8mm: 6567.7

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-31 14:02:53 +02:00
Logan Lyu 22c7291506 lavc/aarch64: new optimization for 8-bit hevc_epel_v
checkasm bench:
put_hevc_epel_v4_8_c: 79.9
put_hevc_epel_v4_8_neon: 25.7
put_hevc_epel_v6_8_c: 151.4
put_hevc_epel_v6_8_neon: 46.4
put_hevc_epel_v8_8_c: 250.9
put_hevc_epel_v8_8_neon: 41.7
put_hevc_epel_v12_8_c: 542.7
put_hevc_epel_v12_8_neon: 108.7
put_hevc_epel_v16_8_c: 939.4
put_hevc_epel_v16_8_neon: 169.2
put_hevc_epel_v24_8_c: 2104.9
put_hevc_epel_v24_8_neon: 307.9
put_hevc_epel_v32_8_c: 3713.9
put_hevc_epel_v32_8_neon: 524.2
put_hevc_epel_v48_8_c: 8175.2
put_hevc_epel_v48_8_neon: 1197.2
put_hevc_epel_v64_8_c: 16049.4
put_hevc_epel_v64_8_neon: 2094.9

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-31 14:02:53 +02:00
Logan Lyu 772865717b lavc/aarch64: new optimization for 8-bit hevc_epel_pixels and and hevc_qpel_pixels
checkasm bench:
put_hevc_pel_pixels4_8_c: 33.7
put_hevc_pel_pixels4_8_neon: 20.2
put_hevc_pel_pixels6_8_c: 61.4
put_hevc_pel_pixels6_8_neon: 25.4
put_hevc_pel_pixels8_8_c: 121.4
put_hevc_pel_pixels8_8_neon: 16.9
put_hevc_pel_pixels12_8_c: 199.9
put_hevc_pel_pixels12_8_neon: 40.2
put_hevc_pel_pixels16_8_c: 355.9
put_hevc_pel_pixels16_8_neon: 43.4
put_hevc_pel_pixels24_8_c: 774.7
put_hevc_pel_pixels24_8_neon: 78.9
put_hevc_pel_pixels32_8_c: 1345.2
put_hevc_pel_pixels32_8_neon: 152.2
put_hevc_pel_pixels48_8_c: 2963.7
put_hevc_pel_pixels48_8_neon: 309.4
put_hevc_pel_pixels64_8_c: 5236.2
put_hevc_pel_pixels64_8_neon: 514.2

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-31 14:02:53 +02:00
Martin Storsjö 2c3d2a0245 configure: Improve aarch64 feature detection on older, broken Clang versions
Clang versions before 17 (Xcode versions up to and including 15.0)
had a very annoying bug in its behaviour of the ".arch" directive
in assembly. If the directive only contained a level, such as
".arch armv8.2-a", it did validate the name of the level, but it
didn't apply the level to what instructions are allowed. The level
was applied if the directive contained an extra feature enabled,
such as ".arch armv8.2-a+crc" though. It was also applied on the
next ".arch_extension" directive.

This bug, combined with the fact that the same versions of Clang
didn't support the dotprod/i8mm extension names in either
".arch <level>+<feature>" or in ".arch_extension", could lead to
unexepcted build failures.

As the dotprod/i8mm extensions couldn't be enabled dynamically
via the ".arch_extension" directive, someone building ffmpeg could
try to enable them by configuring their build with
--extra-cflags="-march=armv8.6-a".

During configure, we test for support for the i8mm instructions
like this:

    # Built with -march=armv8.6-a
    .arch armv8.2-a             # Has no visible effect here
    #.arch_extension i8mm       # Omitted as the extension name isn't known
    usdot v0.4s, v0.16b, v0.16b
    # Successfully assembled as armv8.6-a is the effective level,
    # and i8mm is enabled implicitly in armv8.6-a.

Thus, we would enable assembling those instructions. However if
we later check for another extension, such as sve (which those
versions of Clang actually do support), we can later run into the
following situation when building actual code:

    # Built with -march=armv8.6-a
    .arch armv8.2-a             # Has no visible effect here
    #.arch_extension i8mm       # Omitted as the extension name isn't known
    .arch_extension sve         # Included as "sve" is as supported extension name
    # .arch_extension effectively activates the previous .arch directive,
    # so the effective level is armv8.2-a+sve now.
    usdot v0.4s, v0.16b, v0.16b
    # Fails to build the instructions that require i8mm. Despite the
    # configure check, the unrelated ".arch_extension sve" directive
    # breaks the functionality of the i8mm feature.

This patch avoids this situation:
- By adding a dummy feature such as "+crc" on the .arch directive
  (if supported), we make sure that it does get applied immediately,
  avoiding it taking effect spuriously at a later unrelated
  ".arch_extension" directive.
- By checking for higher arch levels such as armv8.4-a and armv8.6-a,
  we can assemble the dotprod and i8mm extensions without the user
  needing to pass -march=armv8.6-a. This allows using the dotprod/i8mm
  codepaths via runtime detection while keeping the binary runnable
  on older versions. I.e. this enables the i8mm codepaths on Apple M2
  machines while built with Xcode's Clang.

TL;DR: Enable the I8MM extensions for Apple M2 without the user needing
to do a custom configuration; avoid potential build breakage if a user
does such a custom configuration.

Once Xcode versions that have these issues fixed are prevalent, we
can consider reverting this change.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-31 12:23:31 +02:00
Martin Storsjö f05948ada4 aarch64: Simplify the linux runtime cpu detection code
Skip doing the whole getauxval(AT_HWCAP) if HWCAP_CPUID isn't
defined.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-31 12:23:27 +02:00
Rémi Denis-Courmont ae72412aa8 lavc/idctdsp: improve R-V V put_pixels_clamped 2023-10-30 18:14:16 +02:00
Rémi Denis-Courmont d48810f3a5 lavc/idctdsp: improve R-V V add_pixels_clamped 2023-10-30 18:14:16 +02:00
Rémi Denis-Courmont 600c6f1b55 lavc/idctdsp: improve R-V V put_signed_pixels_clamped
This follows the same idea as with pixblockdsp, but applied at the
other end, whilst writing data at the end of the function.
2023-10-30 18:14:16 +02:00
Rémi Denis-Courmont 3ea2310e89 lavc/idctdsp: require Zve64x for R-V V functions
This will be required for the following changesets.
2023-10-30 18:14:16 +02:00
Rémi Denis-Courmont 300ee8b02d lavc/pixblockdsp: aligned R-V V 8-bit functions
If the scan lines are aligned, we can load each row as a 64-bit value,
thus avoiding segmentation. And then we can factor the conversion or
subtraction.

In principle, the same optimisation should be possible for high depth,
but would require 128-bit elements, for which no FFmpeg CPU flag
exists.
2023-10-30 18:14:16 +02:00
Rémi Denis-Courmont 722765687b lavc/pixblockdsp: rename unaligned R-V V functions 2023-10-30 18:14:16 +02:00
Paul B Mahol 6323ca5902 avfilter/vf_feedback: add timeline support 2023-10-30 16:06:46 +01:00
Paul B Mahol 2f268505b9 doc/filters: add one more example for feedback filter 2023-10-30 15:12:12 +01:00
James Almer 4cba3e0f07 avutil/video_enc_params: fix doxy for av_video_enc_params_block()
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-30 10:30:05 -03:00
Kieran Kunhya 2532e832d2 libavcodec/mpeg12: Reindent 2023-10-29 22:12:05 +00:00
Kieran Kunhya 7d497a1119 libavcodec/mpeg12: Remove "fast" mode 2023-10-29 22:12:02 +00:00
Rémi Denis-Courmont 04b49fb3c5 lavu/riscv: fix typo 2023-10-29 22:15:15 +02:00
TADANO Tokumei a824c6f2f6 lavc/libaribcaption: rename `replace_fullwidth_ascii` to `replace_msz_ascii`
This should hopefully clarify that the option only affects MSZ
full-width characters, and not all full-width ASCII. Additionally,
this matches the prefix with the upstream option.

Signed-off-by: TADANO Tokumei <aimingoff@pc.nifty.jp>
2023-10-29 18:21:05 +02:00
TADANO Tokumei 21bfadd9b4 lavc/libaribcaption: add MSZ character related options
This patch adds two MSZ (Middle Size; half width) character
related options, mapping against newly added upstream
functionality:

* `replace_msz_japanese`, which was introduced in version 1.0.1
  of libaribcaption.
* `replace_msz_glyph`, which was introduced in version 1.1.0
  of libaribcaption.

The latter option improves bitmap type rendering if specified
fonts contain half-width glyphs (e.g., BIZ UDGothic), even
if both ASCII and Japanese MSZ replacement options are set
to false.

As these options require newer versions of libaribcaption, the
configure requirement has been bumped accordingly.

Signed-off-by: TADANO Tokumei <aimingoff@pc.nifty.jp>
2023-10-29 18:20:43 +02:00
TADANO Tokumei 82faba8a6c lavc/libaribcaption: switch all `bool` context variables to `int`
On some environments, a `bool` variable is of smaller size than `int`.
As AV_OPT_TYPE_BOOL is internally handled as sizeof(int), if a `bool`
option was set on such an environment, the memory of following
variables would be filled. Additionally, set values may be destroyed
by av_opt_copy().

Signed-off-by: TADANO Tokumei <aimingoff@pc.nifty.jp>
2023-10-29 18:19:58 +02:00
James Almer ff3429991e Changelog: mark 6.1
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-29 12:55:37 -03:00
Michael Niedermayer 47e784f881
Bump versions after 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 16:19:14 +01:00
Michael Niedermayer 0e15b2b828
doc/APIchanges: Add 6.1 cut point
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 16:19:14 +01:00
Michael Niedermayer 9d3a7d30c4
Bump versions prior to 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 15:34:05 +01:00
Zhao Zhili 105657540b avutil/hwcontext_vaapi: return ENOSYS for unsupported operation
av_hwframe_transfer_data try with src_ctx first. If the operation
failed with AVERROR(ENOSYS), it will try again with dst_ctx. Return
AVERROR(EINVAL) makes the second step being skipped.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-29 13:58:52 +08:00
Zhao Zhili 63078b4599 avutil/hwcontext_vulkan: cuda doesn't belong to valid_sw_formats
Move it to transfer_get_formats.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-29 13:58:30 +08:00
Zhao Zhili 891f70c6d5 avutil/hwcontext_vulkan: fix memleak when device_create is skipped
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-29 13:57:43 +08:00
Lynne 1a8e766984
vulkan: return VK_NOT_READY when no queries are available
Fixes a validation issue.
The issue is that the function gets called before we've sumitted a frame
for decoding to that context. However, we cannot run queries before
they've been reset, which happens at submission time.
As we'd need to otherwise run a command queue at init-time, just check
if submissions have happened.
2023-10-28 21:16:15 +02:00
James Almer 1ad7bd0fe5 avutil/channel_layout: simplify 22.2 layout bitmask define
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-28 12:49:48 -03:00
Kyle Swanson e5f774268a avfilter/libvmaf: fix broken cuda build
Signed-off-by: Kyle Swanson <kswanson@netflix.com>
2023-10-27 15:00:58 -07:00
Michael Niedermayer e4d5ac8d7d
avformat/rtsp: Use rtsp_st->stream_index
Fixes: out of array access
Fixes: rtpdec_h264.c149/poc

Found-by: Hardik Shah of Vehere
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-27 18:10:47 +02:00
Michael Niedermayer 907743239d
avutil/tx_template: fix integer ovberflwo in fft3()
Fixes: signed integer overflow: -1028966111 + -1314089526 cannot be represented in type 'int'
Fixes: 63174/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5853273711837184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-27 18:10:47 +02:00
Michael Niedermayer 88453250db
avcodec/jpeg2000dec: Check image offset
Fixes: left shift of negative value -538967841
Fixes: 62447/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-6427134337613824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-27 18:10:47 +02:00
Michael Niedermayer 9690d71f11
avcodec/vlc: dont pass nb_elems into multi vlc code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-27 18:10:46 +02:00
Michael Niedermayer 9b546a0717
avcodec/vlc: merge lost 16bit end of array check
Also cleanup related code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-27 18:10:46 +02:00
Michael Niedermayer a23d527ec5
avcodec/magicyuv: remove redundant check in inner loop
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-27 18:10:46 +02:00
Michael Niedermayer 4ddf4f5001
avcodec/magicyuv: correct end of array check in multi VLC parsing
Fixes: out of array write
Fixes: 63390/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MAGICYUV_fuzzer-5144552979431424.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-27 18:10:45 +02:00
Michael Niedermayer ffac64a270
avcodec/bitstream_template: Basic documentation for read_vlc_multi()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-27 18:10:28 +02:00
James Almer 52a9764260 avutil: bump minor version after recent commits
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-27 08:52:35 -03:00
James Almer 35b06853d1 avutil/channel_layout: add a 3.1.2 channel layout
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-27 08:46:34 -03:00
Will Wolcott e9397ae054 avutil/channel_layout: add a 7.1.4 channel layout
Mapping to ITU-R BS.2051-3 "Sound System J" and ITU-R BS.1196-8 "Channel
Configuration 19".

Signed-off-by: Will Wolcott <wwolcott@netflix.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-27 08:46:34 -03:00
James Almer a41c4b923d avutil/channel_layout: add a 7.1.2 channel layout
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-27 08:46:34 -03:00
James Almer 8d46cbce4f avutil/channel_layout: add a 5.1.4 channel layout
Mapping to ITU-R BS.2051-3 "Sound System D" and ITU-R BS.1196-8 "Channel
Configuration 16".

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-27 08:46:34 -03:00
James Almer 4b8404815d avutil/channel_layout: rename 7.1(top) channel layout to 5.1.2
This layout maps to ITU-R BS.2051-3 "Sound System C" and ITU-R BS.1196-8 "Channel
Configuration 14", and it being the first layout with top layer channels, it's
best to use a different scheme to properly convey the presence and amount of said
channels.
The new name will also be a better fit for the additions in the following commits.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-27 08:46:34 -03:00
Paul B Mahol 36eb774ad4 avcodec/mlpenc: try different filter parameters in case of out of range output from LPC 2023-10-27 12:45:23 +02:00
Paul B Mahol 567af48fba avcodec/mlpenc: add support for 4.0/4.1 ch layout 2023-10-27 12:45:23 +02:00
Paul B Mahol 210e844def avcodec/mlpdec: support for truehd with channels not representable with 5bit field in second stream
Fixes decoding for 4.0/4.1 layouts.
2023-10-27 12:45:23 +02:00
Paul B Mahol deb4c28dcc avcodec/mlpenc: add 3.1 ch layout support for truehd 2023-10-27 12:45:23 +02:00
Andreas Rheinhardt ba6a5e7a3d avcodec/hevcdec: Move collocated_ref to HEVCContext
Only the collocated_ref of the current frame (i.e. HEVCContext.ref)
is ever used*, so move it to HEVCContext directly after ref.

*: This goes so far that collocated_ref was not even synced across
threads in case of frame-threading.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-26 13:18:01 +02:00
Gyan Doshi 2b300eb533 avfilter/vidstab: add option for file format specification
The vidstab library added support in Nov 2020 for writing/reading
the transforms data in binary in addition to ASCII. The library default
was changed to binary format but no changes were made to the AVfilters
resulting in data file for writing or reading being always opened as text.
This effectively broke the filters.

Option added to vidstabdetect to specify file format and open files in
both filters with the correct attributes.
2023-10-26 15:46:18 +05:30
James Almer ef01ab2627 ffprobe: print the non-diegetic stream disposition flag
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-25 21:55:01 -03:00
Lynne 70864e6adb
vulkan_decode: correct flipped condition in image layout
Changed by the previous commit.
Caused validation issues on hardware with !reuse_dpb_dst but not layered_dpb.
2023-10-25 22:01:21 +02:00
Lynne 0b3616231d
vulkan_decode: fix another validation issue
Surprising no one, the insane usage rule has a catch.
2023-10-25 20:51:55 +02:00
Lynne 467e411839
vulkan_decode: fix pedantic validation issue
"Validation Error: [ VUID-VkImageViewCreateInfo-imageViewType-04974 ] Object 0: handle = 0x9f9b41000000003c, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0xc120e150 | vkCreateImageView():
Using pCreateInfo->viewType VK_IMAGE_VIEW_TYPE_2D and the subresourceRange.layerCount VK_REMAINING_ARRAY_LAYERS=(17) and must 1 (try looking into VK_IMAGE_VIEW_TYPE_*_ARRAY).
The Vulkan spec states: If viewType is VK_IMAGE_VIEW_TYPE_1D, VK_IMAGE_VIEW_TYPE_2D, or VK_IMAGE_VIEW_TYPE_3D; and subresourceRange.layerCount is VK_REMAINING_ARRAY_LAYERS,
then the remaining number of layers must be 1"
2023-10-25 20:51:54 +02:00
Lynne 9ee4f47c94
vulkan_decode: use coded_width/height instead of the non-coded width and height
Partially fixes https://streams.videolan.org/issues/19938/20000_20180305-15.04.59.ts
The is coded as 1920x1080, meant to be rendered at 1440x1080 with cropping,
or 1680x1080 before cropping. Currently, the created DPB is 1440x1080, which results
in the image being decoded incorrectly, as the decoder overwrites output memory.
This commit fixes this.
2023-10-25 20:51:05 +02:00
James Almer 3c5bceb751 avformat/options: add missing disposition flag to AVStream class options
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-25 09:28:14 -03:00
Martin Storsjö a4877f1ec1 aarch64: Only enable extensions in the intended files/regions
This eases actual development of the assembly functions, by only
allowing extension instructions within the sections that explicitly
enable them, instead of having all extensions enabled everywhere.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-24 14:46:20 +03:00
Martin Storsjö 0679e85331 aarch64: Stop using asm/hwcap.h for the HWCAP_* detection
Including sys/auxv.h should be enough (it pulls in bits/hwcap.h,
which provides the same defines).

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-24 14:46:14 +03:00
Lynne c258623c0a
hwcontext_vulkan: improve queue family init code
When users zero-init'd the struct, or left it as-is, the encode
queue family matched the graphics queue family, which led it to be
incorrectly logged as being used for encode.

This just improves the logging so this isn't printed anymore.
2023-10-24 06:07:09 +02:00
Martin Storsjö ff5a3575fe fftools: Check HAVE_GETSTDHANDLE before using GetStdHandle
GetStdHandle is unavailable outside of the desktop API subset.

This didn't use to be a problem with earlier WinSDKs, as kbhit also
used to be available only for desktop apps, and this whole section is
wrapped in #if HAVE_KBHIT. With newer WinSDKs, kbhit() is available also
for non-desktop apps, while GetStdHandle still isn't.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-23 13:08:39 +03:00
Martin Storsjö 1762975ba1 libavcodec/aarch64/hevc: Require consistent use of trailing semicolon
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-23 10:39:12 +03:00
Andreas Rheinhardt 6e4030a07b avcodec/av1dec, vaapi_av1: Remove excessive logmessages
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-22 22:11:37 +02:00
Andreas Rheinhardt 315c956cbd avcodec/pthread_frame: Remove ff_thread_release_buffer()
It is unnecessary since the removal of non-thread-safe callbacks
in e0786a8eeb. Since then, the
AVCodecContext has only been used as logcontext.

Removing ff_thread_release_buffer() allowed to remove AVCodecContext*
parameters from several other functions (not only unref functions,
but also e.g. ff_h264_ref_picture() which calls ff_h264_unref_picture()
on error).

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-22 22:09:59 +02:00
Leo Izen 86ed68420d
avcodec/librsvgdec: fix memory leaks and deprecated functions
At various points through the function librsvg_decode_frame, errors are
returned from immediately without deallocating any allocated structs.
This patch both fixes those leaks, and also fixes the use of functions
that are deprecated since librsvg version 2.52.0. The older calls are
still used, guarded by #ifdefs while the newer replacements are used if
librsvg >= 2.52.0. One of the deprecated functions is used as a check
for the configure shell script, so it was replaced with a different
function.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-22 15:18:13 -04:00
Martin Storsjö a76b409dd0 aarch64: Reindent all assembly to 8/24 column indentation
libavcodec/aarch64/vc1dsp_neon.S is skipped here, as it intentionally
uses a layered indentation style to visually show how different
unrolled/interleaved phases fit together.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:54 +03:00
Martin Storsjö cada4597ca aarch64: Manually tweak vertical alignment/indentation in tx_float_neon.S
Favour left aligned columns over right aligned columns.

In principle either style should be ok, but some of the cases
easily lead to incorrect indentation in the surrounding code (see
a couple of cases fixed up in the preceding patch), and show up in
automatic indentation correction attempts.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:39 +03:00
Martin Storsjö 7f905f3672 aarch64: Make the indentation more consistent
Some functions have slightly different indentation styles; try
to match the surrounding code.

libavcodec/aarch64/vc1dsp_neon.S is skipped here, as it intentionally
uses a layered indentation style to visually show how different
unrolled/interleaved phases fit together.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:29 +03:00
Martin Storsjö 93cda5a9c2 aarch64: Lowercase UXTW/SXTW and similar flags
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:23 +03:00
Martin Storsjö 184103b310 aarch64: Consistently use lowercase for vector element specifiers
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:18 +03:00
Paul B Mahol 393d1ee541 avcodec/mlpenc: add 2.1 layout support for truehd 2023-10-20 23:29:45 +02:00
Stefano Sabatini 7bf414408e ffprobe: add -output_format as an alias of -of
Currently we have -of and -print_format, which is a bit confusing. Add
-output_format as an alias of -of to match the short name.
2023-10-20 18:42:41 +02:00
Stefano Sabatini 0d11a6bc12 doc/ffprobe.xsd: apply consistent indent
Use 2-spaces indent all over the file.
2023-10-20 18:42:41 +02:00
Stefano Sabatini bf84ec0049 ffprobe: factorize xml_print_str and xml_print_int
Introduce xml_print_value to avoid logic duplication.
2023-10-20 18:42:41 +02:00
Stefano Sabatini 9dc834e71f ffprobe: reindent after 2b0973d 2023-10-20 18:42:12 +02:00
Stefano Sabatini 2b0973dedb ffprobe: fix XML rendering, review XML layout
Fix rendering of int values within a side data element, which was
broken since commit d2d3a83ad9, where the side data element was
correctly marked as a variable fields element. Logic to render a
string variable was implemented already, but it was not implemented
for the int fields path, which was enabled by that commit.

Also, code and schema is changed in order to account for multiple
variable-fields elements - such as side data, contained within the
same parent. Previously it was assumed that a single variable-fields
element was contained within the parent, which was the case for tags,
but is not the case for side-data.

Previously data was rendered as:
<side_data_list>
    <side_data side_data_type="CPB properties" max_bitrate="0" min_bitrate="0" avg_bitrate="0" buffer_size="327680" vbv_delay="-1"/>
</side_data_list>

Now as:
<side_data_list>
   <side_data type="CPB properties">
       <side_datum key="side_data_type" value="CPB properties"/>
       <side_datum key="max_bitrate" value="0"/>
       <side_datum key="min_bitrate" value="0"/>
       <side_datum key="avg_bitrate" value="0"/>
       <side_datum key="buffer_size" value="49152"/>
       <side_datum key="vbv_delay" value="-1"/>
   </side_data>
</side_data_list>

Variable-fields elements are rendered as a containing element wrapping
generic key/values elements, enabling use of strict XML schema.

Fix trac issue:
https://trac.ffmpeg.org/ticket/10613
2023-10-20 18:42:01 +02:00
Paul B Mahol 79c568dd4e avcodec/mlpenc: add proper support for output bit shift 2023-10-20 17:07:25 +02:00
Paul B Mahol 3f773d8d02 avcodec/mlpenc: add support for TrueHD substreams
Add 3.0 channel layout support for truehd encoder.
2023-10-20 17:07:24 +02:00
Paul B Mahol 98857ece48 avcodec/mlpenc: use ctx->num_substreams when writing headers 2023-10-20 17:07:23 +02:00
Paul B Mahol 94abb4df32 avcodec/mlpenc: add helper function to derive TrueHD ch map from ch_layout 2023-10-20 17:07:22 +02:00
Niklas Haas 2d1aeba8f2 avfilter/vf_scale: fix interlaced chroma for other formats
This logic only covers the case of yuv420p. Extend this logic to cover
*all* vertically subsampled YUV formats, which require the same
interlaced scaling logic.

Fortunately, we can get away with re-using the same code for both JPEG
and MPEG range YUV, because the only difference here is the horizontal
alignment. (Which I omit touching for now, to avoid introducing possibly
unintended changes in default behavior)
2023-10-20 15:20:09 +02:00
Sean McGovern d799ad2404
libavutil/ppc/cpu.c: check that AT_HWCAP2 is defined
It was not introduced until glibc 2.18.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-19 20:46:55 +02:00
Michael Niedermayer 5feceed008
avcodec/hevc_ps: Check cpb_cnt_minus1 before storing it
Fixes: index 32 out of bounds for type 'uint32_t [32]'
Fixes: 63003/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4685160840560640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-19 20:46:55 +02:00
Michael Niedermayer 70f5fa6325
avformat/mxfdec: Check klv offset
Fixes: Assertion klv_offset >= mxf->run_in failed at libavformat/mxfdec.c:736
Fixes: 62936/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5778404366221312.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-19 20:44:56 +02:00
Elias Carotti 644b2235c5 avcodec/libx264: Add the SSE computation for libx264.
Since libx264 only provides a per-frame per-channel PSNR, this is
inverted to get back the SSE.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-10-19 13:34:37 +02:00
Paul B Mahol e7a6bba51a avcodec/mlp*: merge flags used by encoder and decoder 2023-10-18 23:01:40 +02:00
Paul B Mahol be2bbfe71d avcodec/mlpenc: cleanup filtering 2023-10-18 23:01:39 +02:00
Paul B Mahol c1053e2e35 avcodec/mlpenc: allow smaller shift for LPC 2023-10-18 23:01:38 +02:00
Paul B Mahol b206056c82 avcodec/mlpenc: implement advanced stereo rematrix 2023-10-18 23:01:37 +02:00
Paul B Mahol 727ee32da7 avcodec/mlpenc: remove TODO comment, sample rate is always fixed 2023-10-18 23:01:36 +02:00
Paul B Mahol 9adc5d8bfe avcodec/mlpenc: restructure code even more
Implement lsb_bypass for lossless rematrix.
2023-10-18 23:01:35 +02:00
Zhao Zhili 2361970880 avcodec/videotoolboxenc: Check and set hevc profile
1. If user don't specify the profile, set it to main10 when pixel
   format is 10 bits. Before the patch, videotoolbox output main
   profile bitstream with 10 bit input, which can be confusing.
2. Warning when user set profile to main explicitly with 10 bit
   input. It works, but not the best choice.
3. Reject main 10 profile with 8 bit input, it doesn't work.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-18 23:05:14 +08:00
Zhao Zhili cbb6199ff8 avcodec/videotoolboxenc: add hw_configs
Will be used in the following patch. With hw_config we can get
avctx->hw_frames_ctx, and with avctx->hw_frames_ctx we get
sw_pix_fmt. Otherwise sw_pix_fmt is none. I need sw_pix_fmt
before get the first frame to set hevc encoder profile.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-18 23:02:12 +08:00
Zhao Zhili ade0612cfb fate/screen: workaround test failure on mac M1
The last frame is corrupted. It has different results on different
platform.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-18 23:01:51 +08:00
Michael Riedl 721857483f avformat/mxfenc: fix static building
MXF muxer requires rangecoder otherwise static linking fails.

Signed-off-by: Michael Riedl <michael.riedl@nativewaves.com>
2023-10-17 14:46:34 +02:00
Leo Izen 95fbb6cce8
MAINTAINERS: add entry for jpegxl*
Adding myself for jpegxl* in avcodec as I'm the maintainer of this
parser.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-17 08:44:23 -04:00
Leo Izen bf814387f4
avcodec/jpegxl_parser: fix OOB read regression
In f7ac3512f5 the size of the dynamically
allocated buffer was shrunk, but it was made too small for very small
alphabet sizes. This patch restores the size to prevent an OOB read.

Reported-by: Cole Dilorenzo <coolkingcole@gmail.com>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-17 08:40:49 -04:00
Michael Niedermayer 5ddab49d48
avcodec/h2645_parse: Avoid EAGAIN
EAGAIN causes an assertion failure when it is returned from the decoder

Fixes: Assertion consumed != (-(11)) failed at libavcodec/decode.c:462
Fixes: assertion_IOT_instruction_decode_c_462/poc

Found-by: Hardik Shah of Vehere (Dawn Treaders team)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:16:19 +02:00
Michael Niedermayer f7e5537dc1
avcodec/xvididct: Make c* unsigned to avoid undefined overflows
Fixes: signed integer overflow: 1496950099 + 728014168 cannot be represented in type 'int'
Fixes: 62667/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-6511785170305024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:14:10 +02:00
Michael Niedermayer 61b86add52
avcodec/cbs_h2645: Fix showing bits at the end in cbs_read_se_golomb()
Fixes: Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:375
Fixes: 62618/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_REDUNDANT_PPS_fuzzer-5145745046765568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:14:09 +02:00
Michael Niedermayer 75eb698bdc
avcodec/cbs_h2645: Fix showing bits at the end in cbs_read_ue_golomb()
Fixes: Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:375
Fixes: 62617/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5156555663998976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:14:08 +02:00
Michael Niedermayer fff875a7f4
avformat/usmdec: do not return 0 when no packet was produced
Fixes: Assertion pkt->stream_index < (unsigned)s->nb_streams && "Invalid stream index.\n" failed at libavformat/demux.c:617
Fixes: 62498/clusterfuzz-testcase-minimized-ffmpeg_dem_USM_fuzzer-4734740995112960

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:09:09 +02:00
Michael Niedermayer cd66606a8f
avcodec/bonk: Fix undefined overflow in predictor_calc_error()
Fixes: signed integer overflow: -2146469728 - 1488954 cannot be represented in type 'int'
Fixes: 62490/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5612782399389696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:05:07 +02:00
Michael Niedermayer ef3b42738b
avcodec/evc_ps: Check chroma_format_idc
Fixes: out of array access
Fixes: 62678/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4858264984354816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 00:54:37 +02:00
Michael Niedermayer b79fc70596
avformat/tmv: Check video chunk size
This check matches the audio chunk check

Fixes: Timeout
Fixes: 62681/clusterfuzz-testcase-minimized-ffmpeg_dem_TMV_fuzzer-5299107876700160

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-15 18:54:37 +02:00
Lynne fec6e84b18
configure: disable libglslang/libshaderc if the vulkan is disabled
Fixes build failures when the Vulkan headers are too old and libglslang
or libshaderc are enabled.
2023-10-15 17:11:47 +02:00
Leo Izen 1e888462a1
configure: improve libmfx deprecation warning
The libmfx deprecation warning tells you to build against libmfx 1.x,
but the actual solution is to use --enable-libvpl instead of using
--enable-libmfx. Update the warning message to reflect this.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-14 20:55:23 -04:00
Andreas Rheinhardt 66908a43e2 avcodec/h261dec: Don't set write-only macroblock dimensions
They are generally set in ff_mpv_init_context_frame()
(mostly called by ff_mpv_common_init()); setting them
somewhere else should be avoided.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-14 23:36:46 +02:00
Niklas Haas 90d327d607 avfilter/vf_showinfo: also print chroma loc
Curiously absent.
2023-10-14 00:16:57 +02:00
Andreas Rheinhardt 4e6cf5e52b avcodec/h264dec: Constify H.264 decoder
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-13 14:35:07 +02:00
Andreas Rheinhardt 8e1bb594fb avcodec/h264idct_template: Don't include h264dec.h
It is only needed for scan8 which is in h264_parse.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-13 14:35:07 +02:00
Andreas Rheinhardt a7663c9604 avcodec/error_resilience: Constify ThreadFrame*
Forgotten in 0eb399ac39.
While just at it, also use a forward declaration.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-12 22:50:34 +02:00
Timo Rothenpieler 68f9dfa5cc avcodec/nvdec_hevc: fail to initialize on unsupported profiles 2023-10-12 20:57:35 +02:00
Kyle Swanson 2e33f5ced0 avfilter/libvmaf: update pix_fmts
Signed-off-by: Kyle Swanson <kswanson@netflix.com>
2023-10-12 10:37:36 -07:00
Andreas Rheinhardt ab95338a20 avcodec/mpeg4video_parser: Don't set write-only current_picture_ptr
It is unused by ff_mpeg4_decode_picture_header() (unsurprisingly given
that when decoding this function is called before the context has been
initialized).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-11 22:28:24 +02:00
Andreas Rheinhardt b561dafd56 avcodec/h261dec: Discard whole packet when discarding
(The return value doesn't really matter: For video decoders
every return value >= 0 is treated as "consumed all of the input".)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-11 22:28:24 +02:00
Andreas Rheinhardt c995311bcf avcodec/h261dec: Don't set write-only picture_number
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-11 22:28:24 +02:00
John Mather a2175ca861 avcodec/libkvazaar: Respect codec context color settings.
This patch makes the libkvazaar encoder respect color settings that are
present on the codec context, including color range, primaries, transfer
function and colorspace.
2023-10-11 21:50:47 +03:00
John Mather 7251dfdcee avcodec/libkvazaar: Bump minimum version to 2.0.0
0cd8769207 utilized the rc_algorithm member of the kvz_config struct, which
was introduced in Kvazaar 2.0.0. This patch bumps the minimum version of
Kvazaar to 2.0.0 so that FFmpeg compiles successfully.

Signed-off-by: John Mather <johnmather@sidefx.com>
2023-10-11 21:26:52 +03:00
Lynne f31d0f1141
nlmeans_vulkan: parallelize workgroup invocations 2023-10-11 16:53:06 +02:00
Lynne 658b01b5ee
nlmeans_vulkan: reduce dispatches by parallelizing the planes 2023-10-11 16:53:04 +02:00
Lynne 6bc8ff7d93
nlmeans_vulkan: fix width/height for chroma plane weights calculation 2023-10-11 16:53:00 +02:00
Kyle Swanson 6028728bb8 avfilter/libvmaf: remove deprecated options 2023-10-10 11:00:20 -07:00
Andreas Rheinhardt c06d3d2404 fftools/ffmpeg_demux: Fix leak on error
An AVFormatContext leaks on errors that happen before it is attached
to its permanent place (an InputFile). Fix this by attaching
it earlier.

Given that it is not documented that avformat_close_input() is usable
with an AVFormatContext that has only been allocated with
avformat_alloc_context() and not opened with avformat_open_input(),
one error path before avformat_open_input() had to be treated
specially: It uses avformat_free_context().

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 14:30:07 +02:00
Andreas Rheinhardt d98dfcecad fftools/ffmpeg_demux: Don't use fake object with av_opt_eval
The av_opt_eval family of functions emits errors messages on error
and can therefore not be used with fake objects when the AVClass
has a custom item_name callback. The AVClass for AVCodecContext
has such a custom callback (it searches whether an AVCodec is set
to use its name). In practice it means that whatever is directly
after the "cc" pointer to the AVClass for AVCodec in the stack frame
of ist_add() will be treated as a pointer to an AVCodec with
unpredictable consequences.

Fix this by using an actual AVCodecContext instead of a fake object.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 14:29:54 +02:00
Paul B Mahol 44dc42e4ac avcodec/mlpenc: export lpc_coeff_precision option
Change default precision from 11 to 15, improves compression.
2023-10-10 13:53:11 +02:00
Anton Khirnov 33f058f2ec fftools/ffmpeg_enc: constify the frame passed to enc_open() 2023-10-10 12:41:31 +02:00
Anton Khirnov 2ef50c17ab fftools/ffmpeg_filter: fail on filtering errors
These should be considered serious errors - don't just print a log
message and continue as if nothing happened.
2023-10-10 12:41:31 +02:00
Anton Khirnov 9196be2fb1 fftools/ffmpeg_enc: move fps conversion code to ffmpeg_filter
Its function is analogous to that of the fps filter, so filtering is a
more appropriate place for this.

The main practical reason for this move is that it places the encoding
sync queue right at the boundary between filters and encoders. This will
be important when switching to threaded scheduling, as the sync queue
involves multiple streams and will thus need to do nontrivial
inter-thread synchronization.

In addition to framerate conversion, the closely-related
* encoder timebase selection
* applying the start_time offset
are also moved to filtering.
2023-10-10 12:41:31 +02:00
Anton Khirnov f0f6d6d0e1 fftools/ffmpeg_enc: move framerate conversion state into a separate struct
Makes it more clear what state is specific to framerate conversion,
which will be useful in the following commit.
2023-10-10 12:41:31 +02:00
Anton Khirnov 61777c62d7 fftools/ffmpeg: stop accessing OutputStream.last_dropped in print_report()
That field is used by the framerate code to track whether any output has
been generated for the last input frame(*). Its use in the last
invocation of print_report() is meant to account for the very last
filtered frame being dropped in the number of dropped frames printed in
the log. However, that is a highly inappropriate place to do so, as it
makes assumptions about vsync logic in completely unrelated code. Move
the increment to encoder flush instead.

(*) the name is misleading, as the input frame has not yet been dropped
    and may still be output in the future
2023-10-10 12:41:31 +02:00
Anton Khirnov d2c416fdf1 fftools/ffmpeg_enc: merge -force_key_frames source/source_no_drop
Always use the functionality of the latter, which makes more sense as it
avoids losing keyframes due to vsync code dropping frames.

Deprecate the 'source_no_drop' value, as it is now redundant.
2023-10-10 12:41:31 +02:00
Anton Khirnov 735b082231 fftools/ffmpeg_enc: unbreak -force_key_frames source_no_drop
Unlike the 'source' mode, which preserves source keyframe-marking as-is,
the 'source_no_drop' mode attempts to keep track of keyframes dropped by
framerate conversion and mark the next output frame as key in such
cases. However,
* c75be06148 broke this functionality entirely, and made it equivalent
  to 'source'
* even before it would only work when the frame immediately following
  the dropped keyframe is preserved and not dropped as well

Also, drop a redundant check for 'frame' in setting dropped_keyframe, as
it is redundant with the check on the above line.
2023-10-10 12:41:31 +02:00
Anton Khirnov a07b2f5f11 tests/fate/ffmpeg: add tests for -force_key_frames source 2023-10-10 12:41:31 +02:00
Anton Khirnov e35d36eb72 ffools/ffmpeg_filter: stop trying to handle an unreachable state
ifilter_send_eof() will fail if the input has no real or fallback
parameters, so there is no need to handle the case of some inputs being
in EOF state yet having no parameters.
2023-10-10 12:41:31 +02:00
Anton Khirnov 99567ee870 fftools/ffmpeg_enc: simplify adjust_frame_pts_to_encoder_tb() signature
It does not need an OutputFile and an OutputStream, only the target
timebase and the timestamp offset.
2023-10-10 12:41:31 +02:00
Anton Khirnov 096d88dcc6 fftools/ffmpeg_enc: move remaining vsync-related code to video_sync_process() 2023-10-10 12:41:31 +02:00
Anton Khirnov a9b9e771b3 fftools/ffmpeg_enc: move handling video frame duration to video_sync_process()
That is a more appropriate place for this.
2023-10-10 12:41:31 +02:00
Paul B Mahol 394106a138 avcodec/mlpenc: fix regression in encoding only zeroes
Previously it would use more bits than neccessary.
2023-10-10 10:31:37 +02:00
Andreas Rheinhardt 9c1294eadd avcodec/vdpau_vc1: Fix indentation
Forgotten after af6e232ccf.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:22:55 +02:00
Andreas Rheinhardt c77aee61b8 avcodec/mpeg(picture|video_dec): Move comment to more appropriate place
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:22:35 +02:00
Andreas Rheinhardt 52509f63ce avcodec/mpegpicture: Move caller-specific parts of function to callers
Since at least commit c954cf1e1b
(adding ff_encode_alloc_frame()), a large part of ff_alloc_picture()
is completely separate for the two callers. Move the caller-specific
parts out to the callers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:22:19 +02:00
Andreas Rheinhardt 2a8ac5a780 avcodec/mpegvideo_enc: Don't call av_frame_copy_props() unnecessarily
It is unnecessary in case of user-supplied frames, because
it happens directly after a av_frame_ref() with the same
src and dst.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:22:15 +02:00
Andreas Rheinhardt 22b0141d87 avcodec/mpegvideo_enc: Don't allocate buffers unnecessarily
ff_alloc_picture() performs two tasks: a) In most instances,
it allocates frame buffers and b) it allocates certain
auxiliary buffers.

The exception to a) is the case when the encoder can reuse
user-supplied frames. And for these frames the auxiliary buffers
are unused, because this frame will never be used as current_picture
(and therefore also not as next_picture or last_picture);
see select_input_picture().

This means that we can simply avoid calling ff_alloc_picture()
with user-supplied frames at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:21:48 +02:00
Andreas Rheinhardt d87c358ee6 avcodec/mpegvideo_enc: Remove dead block
None of the mpegvideo encoders support anything but coded frames;
and if this were to change, it is unclear whether they would need
the adjustment here. So remove it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:21:46 +02:00
Andreas Rheinhardt 070bc4d2c5 avcodec/mpegvideo_enc: Don't set write-only properties
The frame is immediately reset in the ff_mpeg_unref_picture()
call below.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:21:40 +02:00
Andreas Rheinhardt 3937a21f21 avcodec/mpegvideo_enc: Don't overallocate arrays
Only entries 0..max_b_frames are ever used.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:21:20 +02:00
Andreas Rheinhardt 0524b4ec3e avcodec/mpegvideo_enc: Don't reget known values
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:20:57 +02:00
Andreas Rheinhardt 18f7d8d880 avcodec/mpegvideo_enc: Don't pretend input to be non-refcounted
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:20:44 +02:00
Andreas Rheinhardt f5220475de avcodec/mpegvideo_enc: Reindentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:20:39 +02:00
Andreas Rheinhardt 5aaaa7dbee avcodec/mpegvideo_enc: Remove always-false checks
In case "!direct" we are not reusing the input buffers
(due to e.g. insufficient alignment), but allocating
new ones. These of course do not alias with the ones
provided by the user, so these checks are always-false.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:20:09 +02:00
Andreas Rheinhardt b96ba62bdd avcodec/mpegvideo_enc: Fix abort on allocation errors
mpegvideo_enc uses a fixed-size array of Pictures; a slot is
considered taken if the Picture's AVFrame is set.
When an error happens after a slot has been taken, this Picture
has typically not been reset and is therefore not usable for
future requests. The code aborts when one runs out of slots
and this can happen in case of allocation failures.
Fix this by always unreferencing a Picture in case of errors.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-10 00:19:52 +02:00
Paul B Mahol 78fa1cff70 avcodec/mlpenc: export max_interval option 2023-10-09 23:48:00 +02:00
Paul B Mahol ee9fb28429 avcodec/mlpenc: export codebook_search option too 2023-10-09 23:47:58 +02:00
Paul B Mahol 1703bfa133 avcodec/hcadec: implement proper .flush callback 2023-10-09 21:23:25 +02:00
Timo Rothenpieler 8b6ee74d50 avfilter/ddagrab: create secondary xor mouse texture 2023-10-09 20:17:50 +02:00
Timo Rothenpieler 0e7ae95cc2 avfilter/ddagrab: actually use provided texture pointer 2023-10-09 20:17:49 +02:00
Timo Rothenpieler e006680d8e avcodec/nvenc: add option to control subsampling of packed rgb input 2023-10-09 20:17:44 +02:00
Timo Rothenpieler 3914abf76e configure: fix --custom-allocator
The custom-allocator logic has been completely defunct since a while,
since nothing depends on those targets, they never get used.
This updates jemalloc to pkg-config, adds the fallback option for
potential arbitrary allocators, and finally actually adds the libraries
to LDFLAGS.
2023-10-09 20:14:07 +02:00
Rémi Denis-Courmont 3c6516330f lavc/exrdsp: R-V V reoder_pixels 2023-10-09 19:52:51 +03:00
Rémi Denis-Courmont f39a8790e1 lavu/fixed_dsp: R-V V vector_fmul_window 2023-10-09 19:52:28 +03:00
Rémi Denis-Courmont 10eb3b9c9f lavu/fixed_dsp: R-V V vector_fmul
vector_fmul_fixed_c: 4.0
vector_fmul_fixed_rvv_i64: 0.5
2023-10-09 19:52:28 +03:00
Rémi Denis-Courmont da7a77fb0a lavu/fixed_dsp: R-V V vector_fmul_reverse 2023-10-09 19:52:28 +03:00
Rémi Denis-Courmont bf911cc1bf lavu/fixed_dsp: R-V V vector_fmul_add
vector_fmul_add_fixed_c: 2.2
vector_fmul_add_fixed_rvv_i64: 0.5
2023-10-09 19:52:28 +03:00
Rémi Denis-Courmont 9091ffb006 lavu/float_dsp: adjust multipler in R-V V fmul_window
The gather index vector is only used as double-length (due to register
pressure), so no need to initialise it for quad-length. Basically this
matches the multiplier in the prologue to the the multipler in the loop.
2023-10-09 19:52:28 +03:00
Paul B Mahol 8786b91607 avcodec/mlpenc: change flag for shorten_by in THD case 2023-10-09 18:42:43 +02:00
Paul B Mahol 27c623b3d5 avcodec/mlpenc: fix stereo decorrelation 2023-10-09 18:42:42 +02:00
Andreas Rheinhardt 12c4cf9f72 avcodec/refstruct: Inline ff_refstruct_allocz()
Suggested by James Almer.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-09 15:54:09 +02:00
Andreas Rheinhardt fc880c7032 avcodec/h261dec: Remove pointless goto
There is no need to parse the header twice; doing so does nothing.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-09 15:53:06 +02:00
Andreas Rheinhardt cae30c5ed2 avcodec/wmv2dec: Parse extradata during init
And stop setting picture_number which was only done to not parse
extradata multiple times.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-09 15:52:23 +02:00
Andreas Rheinhardt 37b5f4a1f6 avformat/matroskadec, mov: Fix declaration-after-statement warnings
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-09 00:21:43 +02:00
Michael Niedermayer 7fedbc7606
avcodec/h264_parser: saturate dts a bit
Fixes: signed integer overflow: 0 - -9223372036854775808 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6112289464123392

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:09 +02:00
Michael Niedermayer cedb4736f5
avformat/asfdec_f: Saturate presentation time in marker
Fixes: signed integer overflow: -9223372036315799520 - 3873890816 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5009302746431488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:08 +02:00
Michael Niedermayer fe6ce28d11
avformat/xwma: sanity check bits_per_coded_sample
Fixes: signed integer overflow: 65312 * 524296 cannot be represented in type 'int'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_XWMA_fuzzer-6595971445555200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:07 +02:00
Michael Niedermayer 2d6df3719d
avformat/matroskadec: Check prebuffered_ns for overflow
Fixes: signed integer overflow: 9223372036630775808 + 1000000000 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-5406131992526848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:06 +02:00
Michael Niedermayer 929ddef3f4
avformat/wavdec: Check left avio_tell for overflow
Fixes: signed integer overflow: 155 + 9223372036854775655 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5364032278495232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:05 +02:00
Michael Niedermayer 5f0d00464a
avformat/tta: Better totalframes check
Fixes: signed integer overflow: 4 * 740491135 cannot be represented in type 'int'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_TTA_fuzzer-6298893367508992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:04 +02:00
Michael Niedermayer b3c973acbe
avformat/rpl: Check for number_of_chunks overflow
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int32_t' (aka 'int')
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-6086131095830528

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:02 +02:00
Michael Niedermayer 3508b496e1
avformat/mov: compute absolute dts difference without overflow in mov_find_next_sample()
Fixes: signed integer overflow: -9223372036854775808 - 9222726413022000000 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5959420033761280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:01 +02:00
Michael Niedermayer 51f0ab8b12
avformat/jacosubdec: Check timeres
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:36:00 +02:00
Michael Niedermayer 32447b149f
avformat/jacosubdec: avoid signed integer overflows in get_shift()
Fixes: signed integer overflow: 22014562800 * 934633746 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_JACOSUB_fuzzer-5189603246866432

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:35:59 +02:00
Michael Niedermayer 6490b9aed6
avformat/jacosubdec: Factorize code in get_shift() a bit
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 21:34:55 +02:00
Vignesh Venkatasubramanian via ffmpeg-devel 9132a0fbe2
avformat/mov: Disallow more than one meta box for AVIF
This is not allowed per the spec.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Reviewed-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 18:56:34 +02:00
Michael Niedermayer 9b00b5734d
avformat/sbgdec: Check for negative duration or un-representable end pts
Fixes: signed integer overflow: 9230955872951340 - -9223372036854775808 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6330481893572608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-08 18:56:27 +02:00
Andreas Rheinhardt c7fb4d0eb6 avcodec/nvdec: Use RefStruct API for decoder_ref
Avoids allocations and error checks as well as the boilerplate
code for creating an AVBuffer with a custom free callback.
Also increases type safety.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Tested-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:36:21 +02:00
Andreas Rheinhardt 2ec62b1ca6 avcodec/pthread_frame: Use RefStruct API for ThreadFrame.progress
Avoids allocations and error checks and allows to remove
cleanup code for earlier allocations. Also avoids casts
and indirections.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:36:04 +02:00
Andreas Rheinhardt 452089ee23 avcodec/hevcdec: Use RefStruct API for RefPicListTab buffer
Given that the RefStruct API relies on the user to know
the size of the objects and does not provide a way to get it,
we need to store the number of elements allocated ourselves;
but this is actually better than deriving it from the size
in bytes.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:35:56 +02:00
Andreas Rheinhardt 6695c0af0e avcodec/vulkan_decode: Use RefStruct API for shared_ref
Avoids allocations, error checks and indirections.
Also increases type-safety.

Reviewed-by: Lynne <dev@lynne.ee>
Tested-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:35:50 +02:00
Andreas Rheinhardt f8252d6ce3 avcodec/decode: Use RefStruct API for hwaccel_picture_private
Avoids allocations and therefore error checks: Syncing
hwaccel_picture_private across threads can't fail any more.
Also gets rid of an unnecessary pointer in structures and
in the parameter list of ff_hwaccel_frame_priv_alloc().

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Lynne <dev@lynne.ee>
Tested-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:35:22 +02:00
Andreas Rheinhardt 3ba4f9c21e avcodec/cbs_sei: Use RefStruct API for SEI messages
The SEI message code uses the AVBuffer API for its SEI messages
and contained buffers (like the extension buffer for HEVC
or the user data (un)registered payload buffers).

Contrary to the ordinary CBS code (where some of these
contained buffer references are actually references
to the provided AVPacket's data so that one can't replace
them with the RefStruct API), the CBS SEI code never uses
outside buffers at all and can therefore be switched entirely
to the RefStruct API. This avoids the overhead inherent
in the AVBuffer API (namely the separate allocations etc.).

Notice that the refcounting here is actually currently unused;
the refcounts are always one (or zero in case of no refcounting);
its only advantage is the flexibility provided by custom
free functions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:35:14 +02:00
Andreas Rheinhardt 3e9b8d14e5 avcodec/cbs: Use RefStruct-API for unit content
This avoids allocations and error checks etc. as well
as duplicate pointer lists in the CodedBitstreamFooContexts.
It also avoids casting const away for use as opaque,
as the RefStruct API supports const opaques.

The fact that some of the units are not refcounted
(i.e. they are sometimes part of an encoding context
like VAAPIEncodeH264Context) meant that CodedBitstreamUnit
still contains two pointers, one to the content
and another ownership pointer, replacing the AVBufferRef* pointer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:35:05 +02:00
Andreas Rheinhardt 56dd585146 avcodec/refstruct: Allow checking for exclusive ownership
This is the analog of av_buffer_is_writable();
it will be used in the next commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:34:57 +02:00
Andreas Rheinhardt 61bc8764d4 avcodec/dovi_rpu: Use RefStruct API for Vdr data
It avoids allocations and the corresponding error checks.
Also avoids casts and indirections.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:34:49 +02:00
Andreas Rheinhardt 05f557b259 avcodec/wavpack: Use RefStruct API for DSD context
It avoids allocations and the corresponding error checks.
It also avoids indirections and casts.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:34:43 +02:00
Andreas Rheinhardt e1ba00ac8f avcodec/vp8: Use RefStruct API for seg_map
Avoids allocations and error checks when syncing the buffers.
Also avoids indirections.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:34:36 +02:00
Andreas Rheinhardt 2db94a96c8 avcodec/hevc_ps: Use RefStruct API for parameter sets
Avoids allocations and error checks for these allocations;
e.g. syncing buffers across threads can't fail any more
and needn't be checked. It also gets rid of casts and
indirections.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:34:28 +02:00
Andreas Rheinhardt 787351a68e avcodec/h264_ps: Use RefStruct API for SPS/PPS
Avoids allocations and error checks for these allocations;
e.g. syncing buffers across threads can't fail any more
and needn't be checked. It also avoids having to keep
H264ParamSets.pps and H264ParamSets.pps_ref and PPS.sps
and PPS.sps_ref in sync and gets rid of casts and indirections.

(The removal of these checks and the syncing code even more
than offset the additional code for RefStruct.)

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:34:20 +02:00
Andreas Rheinhardt 78c9ed26b6 avcodec/get_buffer: Use RefStruct API for FramePool
Avoids allocations and frees and error checks for said allocations;
also avoids a few indirections and casts.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:34:10 +02:00
Andreas Rheinhardt 9281dcb801 avcodec/refstruct: Add simple API for refcounted objects
For now, this API is supposed to replace all the internal uses
of reference counted objects in libavcodec; "internal" here
means that the object is created in libavcodec and is never
put directly in the hands of anyone outside of it.

It is intended to be made public eventually, but for now
I enjoy the ability to modify it freely.

Several shortcomings of the AVBuffer API motivated this API:
a) The unnecessary allocations (and ensuing error checks)
when using the API. Besides the need for runtime checks it
imposes upon the developer the burden of thinking through
what happens in case an error happens. Furthermore, these
error paths are typically not covered by FATE.
b) The AVBuffer API is designed with buffers and not with
objects in mind: The type for the actual buffers used
is uint8_t*; it pretends to be able to make buffers
writable, but this is wrong in case the buffer is not a POD.
Another instance of this thinking is the lack of a reset
callback in the AVBufferPool API.
c) The AVBuffer API incurs unnecessary indirections by
going through the AVBufferRef.data pointer. In case the user
tries to avoid this indirection and stores a pointer to
AVBuffer.data separately (which also allows to use the correct
type), the user has to keep these two pointers in sync
in case they can change (and in any case has two pointers
occupying space in the containing context). See the following
commit using this API for H.264 parameter sets for an example
of the removal of such syncing code as well as the casts
involved in the parts where only the AVBufferRef* pointer
was stored.
d) Given that the AVBuffer API allows custom allocators,
creating refcounted objects with dedicated free functions
often involves a lot of boilerplate like this:
obj = av_mallocz(sizeof(*obj));
ref = av_buffer_create((uint8_t*)obj, sizeof(*obj), free_func, opaque, 0);
if (!ref) {
    av_free(obj);
    return AVERROR(ENOMEM);
}
(There is also a corresponding av_free() at the end of free_func().)
This is now just
obj = ff_refstruct_alloc_ext(sizeof(*obj), 0, opaque, free_func);
if (!obj)
    return AVERROR(ENOMEM);
See the subsequent patch for the framepool (i.e. get_buffer.c)
for an example.

This API does things differently; it is designed to be lightweight*
as well as geared to the common case where the allocator of the
underlying object does not matter as long as it is big enough and
suitably aligned. This allows to allocate the user data together
with the API's bookkeeping data which avoids an allocation as well
as the need for separate pointers to the user data and the API's
bookkeeping data. This entails that the actual allocation of the
object is performed by RefStruct, not the user. This is responsible
for avoiding the boilerplate code mentioned in d).

As a downside, custom allocators are not supported, but it will
become apparent in subsequent commits that there are enough
usecases to make it worthwhile.

Another advantage of this API is that one only needs to include
the relevant header if one uses the API and not when one includes
the header or some other component that uses it. This is because there
is no RefStruct type analog of AVBufferRef. This brings with it
one further downside: It is not apparent from the pointer itself
whether the underlying object is managed by the RefStruct API
or whether this pointer is a reference to it (or merely a pointer
to it).

Finally, this API supports const-qualified opaque pointees;
this will allow to avoid casting const away by the CBS code.

*: Basically the only exception to the you-only-pay-for-what-you-use
rule is that it always uses atomics for the refcount.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-07 22:33:32 +02:00
Rémi Denis-Courmont eb73d178ea lavu/fixed_dsp: R-V V scalarproduct 2023-10-07 17:45:39 +03:00
Paul B Mahol 71716406e6 avformat/wavdec: w64: do not error out for broken files if data start is found
Also attempt to fix invalid block_align value.
2023-10-07 11:19:54 +02:00
Paul B Mahol 84e0e2f43e avcodec/mlpenc: rename some variables related to thd
Remove warning message that is no longer needed.
2023-10-07 11:19:53 +02:00
Andreas Rheinhardt 4c422de1db avcodec/mpegvideo: Move allocating new_picture to the encoder
It is only used by encoders; this unfortunately necessitated
to add separate allocations to the SVQ1 encoder which uses
motion estimation without being a full member of mpegvideo.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-06 20:47:53 +02:00
James Almer 27fcc8dd9f fftools/ffplay: stop injecting stream side data in packets
This is no longer needed as the side data is available for decoders in the
AVCodecContext.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:11:19 -03:00
James Almer d372c2f3d3 fftools/ffmpeg: stop injecting stream side data in packets
This is no longer needed as the side data is available for decoders in the
AVCodecContext.
The tests affected reflect the removal of useless CPB and Stereo 3D side
data in packets.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:11:19 -03:00
James Almer ae22271620 avcodec/decode: propagate global side data to frames
The changed references for fate-hevc-dv-rpu fate-mov-zombie happen because,
unlike ffmpeg and ffplay, ffprobe never injected packet side data, so the
display matrix side data at the container level is now present in the output
frames.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:11:18 -03:00
James Almer 804be7f9e3 avcodec/hevcdec: check for DOVI configuration record in AVCodecContext side data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:11:18 -03:00
James Almer d76b0c4a35 fftools/ffprobe: stop using AVStream.side_data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:11:18 -03:00
James Almer 235a66a143 fftools/ffplay: stop using AVStream.side_data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:11:18 -03:00
James Almer 3fd37b5268 fftools/ffmpeg: stop using AVStream.side_data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:11:00 -03:00
James Almer e500eb5a95 avcodec/packet: add some documentation for AVPacketSideData
Explaining what or who may use it, and in what scenarios.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:04:02 -03:00
James Almer 5432d2aaca avformat/avformat: use the side data from AVStream.codecpar
Deprecate AVStream.side_data and its helpers in favor of the AVStream's
codecpar.coded_side_data.

This will considerably simplify the propagation of global side data to decoders
and from encoders. Instead of having to do it inside packets, it will be
available during init().
Global and frame specific side data will therefore be distinct.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:03:57 -03:00
James Almer 21d7cc6fa9 avcodec/codec_par: add side data to AVCodecParameters
This will simplify the propagation of side data to decoders and from encoders.
Global side data will now reside in the AVCodecContext, thus be available
during init(), removing the need to propagate it inside packets.

Global and frame specific side data will therefore be distinct.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 09:56:41 -03:00
James Almer 74279227dd avcodec/packet: add generic side data helpers
Handling AVPacketSideData directly, which can used on structs other than
AVPacket.
This will be useful in the following commits.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 09:53:22 -03:00
Andreas Rheinhardt f62c441e7a avfilter/vulkan_filter: Remove unused label
Unused since 81cc0e1345.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-06 12:28:45 +02:00
Paul B Mahol d58e0af55c avcodec/mlpdec: set extended_substream_info from header
To be used later.
2023-10-06 11:31:03 +02:00
Stefano Sabatini 00eb4966aa doc/encoders/libopus: clarify lowdelay and cutoff options
Extend descriptions for the application=lowdelay and cutoff options.
Based on notes by Mingye Wang.

Address issues:
http://trac.ffmpeg.org/ticket/10330
http://trac.ffmpeg.org/ticket/10343
2023-10-06 09:49:47 +02:00
Stefano Sabatini 7449a00d2d doc/encoders/libxvid: fix references for me_quality option
Drop reference to constants removed in 94eed68ace.

In particular, rename me_method to me_quality and add description for
supported values.

Address trac issue:
http://trac.ffmpeg.org/ticket/10003
2023-10-06 09:49:47 +02:00
Stefano Sabatini d0f071dfe7 doc/encoders/libx264: clarify meaning of level option
In particular, clarify that it can either be set as a field of
AVCodecContext or as an x264 option, using a different specification.

Should address trac issue:
http://trac.ffmpeg.org/ticket/3947
2023-10-06 09:49:47 +02:00
Stefano Sabatini 6f421d9d4e lavc: clarify meaning of avctx.level option 2023-10-06 09:49:47 +02:00
Leo Izen f7ac3512f5
avcodec/jpegxl_parser: fix various memory issues
The spec caps the prefix alphabet size to 32768 (i.e. 1 << 15) so we
should check for that and reject alphabets that are too large, in order
to prevent over-allocating.

Additionally, there's no need to allocate buffers that are as large as
the maximum alphabet size as these aren't stack-allocated, they're heap
allocated and thus can be variable size.

Added an overflow check as well, which fixes leaking the buffer, and
capping the alphabet size fixes two potential overruns as well.

Fixes: out of array access
Fixes: 62089/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-
    5437089094959104.fuzz

Found-by: continuous fuzzing process
    https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Found-by: Hardik Shah of Vehere (Dawn Treaders team)
Co-authored-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-05 19:28:55 -04:00
Leo Izen ec74553205
avcodec/jpegxl_parser: add some icc profile checks
This patch will cause the parser to abort if it detects an icc profile
with an invalid size. This is particularly important if the icc profile
is entropy-encoded with zero bits per symbol, as it can prevent a
seemingly infinite loop during parsing.

Fixes: infinite loop
Fixes: 62374/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer
    -5551878085410816

Found-by: continuous fuzzing process
    https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reported-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-05 19:28:50 -04:00
Stefano Sabatini d2d3a83ad9 ffprobe: introduce section type, use for the compact output
Also, avoid spurious end-of-line after side data entries, and improve
rendering of compact output, by adding an indication of the side data
type for each entry.

Also fixes issue:
http://trac.ffmpeg.org/ticket/9266
2023-10-06 00:17:02 +02:00
Stefano Sabatini 8eecd52d8b ffprobe: correct section name for side data piece 2023-10-06 00:17:01 +02:00
Stefano Sabatini 01edb505c6 ffprobe: factorize side data printing to dedicated function 2023-10-06 00:17:01 +02:00
Paul B Mahol d7579189f7 avcodec/mlpenc: restructure code and resolve several bugs
Do not use put_sbits() where only unsigned is stored.
Reduce size of data_check_present field.
Reduce size of table of codebook_extremes[].
Avoid anonymously typedeffed structs.
Use encoder private context to store parameters.
Fix wrapping when calculating offsets.
Restructure arrays in encoder private context so to keep
arrays belonging to same subblock into separate structure.
Disable matrix coefficients as they are sometimes
producing wrong results.
2023-10-06 00:05:56 +02:00
Lynne 81cc0e1345
hwcontext_vulkan: properly support STORAGE usage for mutliplane images
Fixes multiplane support on Nvidia.

Also, remove the ENCODE usage, even if the driver signals it as supported.
Currently, it's not used, and when it is used, it'll be gated behind
two extension checks.
2023-10-05 23:50:30 +02:00
Benjamin Cheng 2a36e44af3
vulkan_hevc: handle non-contiguous SPS/PPS/VPS ids
Some clips (i.e. SLIST_B_Sony_9) will use PPS 0 and 8, before PPS 1-7.
vulkan_hevc expects {sps,pps,vps}_list to be filled in order, which
causes PPS 8 to not be added to the Vulkan session params when it is
being used by a picture.

This removes the expectation that these lists are filled in order. The
indicies into vps_list are saved since there are multiple usages of it.

This also fixes a bug with some clips (i.e. PPS_A_qualcomm_7) which use
all 64 available PPS slots, causing the old loop to think there are more
than 64 PPS-es.
2023-10-05 23:50:26 +02:00
Vignesh Venkatasubramanian via ffmpeg-devel e8465aa5dd avcodec/svt-av1: Set force_key_frames only when gop_size == 1
SVT-AV1 does not support requesting keyframes at arbitrary points
by setting pic_type to EB_AV1_KEY_PICTURE. So set force_key_frames
to 1 only when gop_size == 1.

Please see the comments in
https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/2076 for a bit more
details.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2023-10-05 16:05:59 -04:00
Andreas Rheinhardt f0f6acde1a avcodec/h261dec, mpeg12dec, vc1dec: Remove setting write-only flags
These flags will be overwritten later in ff_mpv_frame_start().

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-05 22:05:21 +02:00
Andreas Rheinhardt 951bcc3c03 avcodec/rv10: Replace switch by LUT
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-05 22:05:21 +02:00
Andreas Rheinhardt cd08bace55 avcodec/rv10: Remove dead code
Dead since 248a1aa54c.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-05 22:05:21 +02:00
Andreas Rheinhardt ca3dea8a36 avcodec/h263dec, mpeg4videodec: Parse extradata during init
Possible now that the IDCT is already initialized at this point.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-05 22:05:21 +02:00
Andreas Rheinhardt 49b4ed7237 avcodec/mpegvideo_dec: Always initialize IDCTDSPContext during init
It has currently not been done for H263, H263P and MPEG4.
Doing so avoids having to initialize the IDCT permutation
lateron when decoding packets in order to be able to parse
a quant matrix; it means that every mpegvideo decoder always
has an initialized IDCTDSPContext after init.
Initializing is done generically in ff_mpv_decode_init().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-05 22:05:21 +02:00
Andreas Rheinhardt d86f7603cf avcodec/mpegvideo_dec: Don't zero context on init failure
Up until now, ff_mpeg_update_thread_context() zeroes
the context to initialize on initialization failure.
This has been added in e1d7d4bd13.

Just as now, ff_mpeg_update_thread_context() simply
copied the src MpegEncContext over the dst MpegEncContext
to initialize it, but clear_context() was only added in
b160fc290c, so that cleaning up
on init failure was a minefield if performed.

It was not always performed, namely not before the first
allocation needed to be freed. In the fuzzer sample that
led to e1d7d4bd13, the call
to av_image_check_size() failed and before said commit,
the context contained lots of pointers from the src context,
leading to assert violations lateron.

Of course, the proper fix for this is resetting the pointers
(or even better, not copying them in the first place), so
this zeroing is unnecessary since commit
b160fc290c. It is also harmful,
because it makes initializing something only once during init
more complicated; See the h264chroma handling in the diff
for an example. Therefore it is removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-05 22:05:21 +02:00
Andreas Rheinhardt bc7de8b63c avcodec/mpeg12dec: Don't initialize IDCT more than once
Before 998c9f15d1, the IDCTDSPContext
has only been initialized in ff_mpv_common_init() which is deferred
until immediately before decoding a picture; to nevertheless parse
the quant matrices in sequence headers or quant matrix extensions,
a dummy (identity) permutation has been stored in the codec's init
function; after ff_mpv_common_init() which could change the permutation
the matrices were repermutated.

Yet since said commit, the IDCTDSPContext is initialized during init
and does not change afterwards (unless the user forces different CPU
flags), so there is no need to reinitialize it; the repermutation code
can be removed as well.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-05 22:05:21 +02:00
Rémi Denis-Courmont 89c10d8d20 lavc/ac3: add R-V Zbb extract_exponents 2023-10-05 18:13:00 +03:00
James Almer 9078dc0c52 avcodec/hcadec: add a flush callback
Fixes unexpected behavior during seeking and with fuzzed samples.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-04 15:40:57 -03:00
Rémi Denis-Courmont 19baf4e009 swscale/rgb2rgb: R-V V deinterleaveBytes 2023-10-03 22:53:20 +03:00
Rémi Denis-Courmont ede3215115 swscale/rgb2rgb: fix extra iteration in R-V V interleave
There was an additional iteration doing nothing for each line,
due to checking the selected vector length instead of the available
vector length.
2023-10-03 22:53:20 +03:00
Rémi Denis-Courmont 9240035c0e lavu/float_dsp: avoid reg-stride in R-V V fmul_window 2023-10-03 22:48:10 +03:00
Michael Niedermayer fe6d46490f
avcodec/escape124: Do not return random numbers
Fixes: out of array access
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE124_fuzzer-6035022714634240
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE124_fuzzer-6422176201572352

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer 515c0247a3
avcodec/apedec: Fix an integer overflow in predictor_update_filter()
Fixes: signed integer overflow: -2147483506 + -801380 cannot be represented in type 'int'
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6578985923117056

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer bb9f8a1cb7
tools/target_dec_fuzzer: Adjust wmapro threshold
Fixes: Timeout
Fixes: 62266/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAPRO_fuzzer-5125460729921536

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer 9cef555bc5
avcodec/wavarc: Check k in decode_5elp()
regression since 18b2ecc247

Fixes: assertion failure
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6280165808013312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer dbcf285abd
avcodec/wavarc: Allocate AV_INPUT_BUFFER_PADDING_SIZE
Fixes: overread
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5963163952349184
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6048030137909248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer f3c986200d
avcodec/wavarc: Fix integer overflwo in do_stereo()
Fixes: signed integer overflow: 148676193 - -2006512262 cannot be represented in type 'int'
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5963163952349184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer c42a89309a
avutil/tx_template: Fix some signed integer overflows in DECL_FFT5()
Fixes: signed integer overflow: -1364715454 + -1468954671 cannot be represented in type 'int'
Fixes: 62093/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5538774254485504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer 7f4fed5216
avcodec/aacdec_template: Better avoidance of signed integer overflow in imdct_and_windowing_eld()
Fixes: 62171/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5644657180409856
Fixes: signed integer overflow: 2 * 1079352273 cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer 6359b2ce03
tools/target_dec_fuzzer: Adjust threshold for MVHA
Fixes: Timeout
Fixes: 62120/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MVHA_fuzzer-5647877768347648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer 52d666edec
avformat/avs: Check if return code is representable
Fixes: leak
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-6738814988320768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer 53948d6200
avcodec/utvideodec: move allocation to the end of init
Fixes: mem leak
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_UTVIDEO_fuzzer-6666804266926080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer 112a077d06
avcodec/flacdec: Fix integer overflow in "33bit" DECODER_SUBFRAME_FIXED_WIDE()
Fixes: signed integer overflow: 4 * 2307917133220067266 cannot be represented in type 'long'
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-6307690022043648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer 35e6960a6b
avcodec/flacdec: Fix overflow in "33bit" decorrelate
Fixes: signed integer overflow: 538976288 - -9223372036854775808 cannot be represented in type 'long'
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-6275845531238400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer d11b8bd0c6
avcodec/lcldec: Make PNG filter addressing match the code afterwards
Also update check accordingly

Fixes: tickets/10237/mszh_306_306_yuv422_nocompress.avi
Fixes: tickets/10237/mszh_306_306_yuv411_nocompress.avi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer 5c0df3da0b
avformat/westwood_vqa: Check chunk size
the type is also changed to int as it is interpreted as int in av_get_packet()

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_WSVQA_fuzzer-6593408795279360
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_WSVQA_fuzzer-4613908817903616

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Michael Niedermayer a9137110ed
avformat/sbgdec: Check for period overflow
Fixes: signed integer overflow: 4481246996173000000 - -4778576820000000000 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-5063670588899328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:51 +02:00
Michael Niedermayer dedc78b4b5
avformat/concatdec: Check in/outpoint for overflow
Fixes: signed integer overflow: 91542414454000000 - -9154241494546000000 cannot be represented in type 'long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-4739147999084544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-03 20:09:27 +02:00
Rémi Denis-Courmont 446b0090cb lavu/float_dsp: avoid reg-stride in R-V V reverse_fmul
This revectors the inner loop to reverse vectors element in vectors,
thus eliminating the negative register stride. Note that RVV does not
have a vector reverse instruction, so this uses a gather.
2023-10-03 20:48:47 +03:00
Rémi Denis-Courmont d14130aea3 swscale/rgb2rgb: unroll R-V V interleave_bytes 2023-10-03 20:48:47 +03:00
Rémi Denis-Courmont 6269c4a440 swscale/rgb2rgb: unroll RISC-V V uyvytoyuv422 2023-10-03 20:48:39 +03:00
Rémi Denis-Courmont e50f8e861b swscale/rgb2rgb: avoid S-regs in RISC-V V uyvytoyuv422
We can make do with callee-clobbered registers only now.
As an added bonus, this makes the code XLEN-independent.
2023-10-03 20:48:39 +03:00
Rémi Denis-Courmont be37a2e364 swscale/rgb2rgb: rework RISC-V V uyvytoyuv422
This avoids using relatively slow register strides.
2023-10-03 20:48:39 +03:00
Andreas Rheinhardt e1f3041b93 avcodec/h264_slice: Don't keep AVCodecContext props in sync manually
It is already done generically in update_context_from_thread()
before this function is called.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-03 18:53:25 +02:00
Andreas Rheinhardt 06388250d9 avcodec/mpegvideo_dec: Don't memset twice
This has been done for the luma plane of missing FLV1 and H263
references.
Also remove code duplication by reusing gray_frame(), which
has been renamed to color_frame() for this purpose.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-03 18:53:25 +02:00
Andreas Rheinhardt 3ede6cc0f1 avcodec/mpegvideo_dec: Check for existence of planes before accesses
Fixes segfaults with -debug +nomc -flags +gray (presuming
a build with --enable-gray).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-03 18:53:25 +02:00
Anton Khirnov 8d12762b42 fftools/ffmpeg: move derivation of frame duration from filter framerate
From ffmpeg_enc to ffmpeg_filter, which is a more appropriate
place for it.
2023-10-03 16:57:02 +02:00
Anton Khirnov 9d4ca76c08 fftools/ffmpeg_enc: do not round frame durations prematurely
Changes the results of fate-idroq-video-encode and fate-lavf* tests,
where different frames now get duplicated by framerate conversion code.
2023-10-03 16:57:02 +02:00
Anton Khirnov 303f10d4dd fftools/ffmpeg_dec: disregard demuxer timestamps for NOTIMESTAMPS formats
In this case any timestamps are guessed by compute_pkt_fields() in
libavformat. Since we are decoding the stream, we have more accurate
information from the decoder and do not need any guesses.

Eliminates spurious PTS gaps in a number of FATE tests.

Also avoids dropping the majority of frames in fate-dirac*
2023-10-03 16:57:02 +02:00
Anton Khirnov cdfd15f4d8 lavc/mpeg4videodec: do not invent a framerate from guessed numbers
Improves timestamps for fate-m4v*
2023-10-03 16:57:02 +02:00
Anton Khirnov 4a376f45ab lavc/mpegvideo_parser: improve exporting field-coding information
* export AVCodecParserContext.picture_structure.
* when there are two field pictures in the packet, set
  the interlacing parameters accordingly:
        * repeat_pict=1 and picture_structure=FRAME to indicate 2 fields
        * field_order to indicate the first field of the two
2023-10-03 16:57:02 +02:00
Anton Khirnov 2c9eb49122 lavc/mpegvideo_parser: reduce variable scopes
Drop some variables only used in a switch().
2023-10-03 16:57:02 +02:00
Anton Khirnov 3562993d82 lavf/gifdec: do not mark as notimestamps
The demuxer does not set packet timestamps itself after
c6b6356635 and instead relies on the
parser to do it. However, this does not matter from the caller
perspective as it still happens inside the demuxer. The demuxer should
thus not be flagged as not having timestamps.
2023-10-03 16:57:02 +02:00
Anton Khirnov 80401b86d3 lavf/demux: restrict video parser duration handling to just GIF
The parser does not have a timebase associated with it, so in general it
makes no sense for it to be exporting durations. Longer-term this
should be handled more cleanly with a new parser API.
2023-10-03 16:57:02 +02:00
Anton Khirnov 63bc6430a6 lavfi/yadif: update output frame durations 2023-10-03 16:57:02 +02:00
Anton Khirnov 99fe00ab4b doc/developer: deduplicate commit message rules
The patches/committing section currently contains several
partially-overlapping rules on commit messages. Merge and simplify them
into one item.
2023-10-03 15:58:22 +02:00
Anton Khirnov 4c4bf54d99 doc/developer: drop an outdated item
It dates back to pre-2005 days, when people generally tended to commit
their work directly without going through the mailing list. Few
developers do it today, and never outside of their standalone modules.
This item is thus confusing and misleading and is better removed.
2023-10-03 15:58:22 +02:00
Anton Khirnov e898447661 doc/developer: add a code behaviour section to development policy
Document our longstanding de facto policies on things like correctness,
thread-safety, undefined behaviour, etc.
2023-10-03 15:58:22 +02:00
Anton Khirnov 836a8e116a doc/developer: fix a nonsense statement
Adding new fields to _functions_ makes no sense, it was supposed to be
structs.
2023-10-03 15:09:32 +02:00
Anton Khirnov f3ba1158e4 doc/developer: merge the 'contributing code' section into its parent chapter
The section consistes of a single short paragraph linking to other
chapters. The enclosing chapter also has no other sections, all other
text is placed in the chapter directly.
Keeping a separate section for this paragraph just adds more clutter.
2023-10-03 15:09:23 +02:00
Anton Khirnov 491a0ad0b9 doc/developer: move a sentence to a more appropriate place
It's targeted at our users, not developers, so it makes more sense to
group it with other text targeted at our users.
2023-10-03 15:09:13 +02:00
Dawid Kozinski 3ba3e188b3 avcodec/hevcpred_template: Removed unreachable code
Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2023-10-03 08:33:42 -04:00
Andreas Rheinhardt f58038d498 avcodec/avcodec: Avoid codec_desc.h, codec_par.h inclusions
Instead, use forward declarations; and in order not to affect
any user include these headers for them, but not internally.
This has the advantage of removing implicit inclusions of these
headers from almost all files providing codecs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-03 01:59:07 +02:00
Andreas Rheinhardt ea14e8bc30 avcodec/codec_par: Move enum AVFieldOrder to defs.h
It is also used by AVCodecContext.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-03 01:58:37 +02:00
Andreas Rheinhardt dd48e49d54 avformat/avformat: Deprecate AVFMT_ALLOW_FLUSH
It is of no value to the user, because every muxer can always
be flushed with a NULL packet. As its documentation shows
("If not set, the muxer will not receive a NULL packet in
the write_packet function") it is actually an internal flag
that has been publically exposed because there was no internal
flags field for output formats for a long time. But now there is
and so use it by replacing the public flag with a private one.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-03 01:45:46 +02:00
Niklas Haas 0d596776c6 avcodec/decode: use ff_icc_profile_sanitize
Fixes: https://trac.ffmpeg.org/ticket/9673
2023-10-03 00:28:50 +02:00
Niklas Haas 443471356f avfilter/vf_iccdetect: use ff_icc_profile_sanitize 2023-10-03 00:28:50 +02:00
Niklas Haas beac4a999c avcodec/fflcms2: add ff_icc_profile_sanitize
Buggy ICCv4 profiles are unfortunately used in the wild, and it's quite
easy to work around them by just forcing the white point to the correct
value. Display a warning just in case.

See-Also: https://trac.ffmpeg.org/ticket/9673
2023-10-03 00:28:50 +02:00
Niklas Haas 22530ad1ce lavc/h274: transpose IDCT
This is mathematically equivalent to what we were doing before, but
gives subtly different results due to rounding (rows first vs columns
first). Doing it this way makes our film grain database generation match
reference implementation and now produces bit-exact outputs in my
testing.

Rename the transposed variables to be a bit less confusing.
2023-10-03 00:27:14 +02:00
Martin Storsjö 2b9c6c70e6 tools: Don't include the direct library names when linking
When linking the main tools, the object files to link are set up
via the variable OBJS-<name>, but for the tools, we've only
used the target's list of dependencies.

In most cases, this has been fine, but it has caused specifying
the libraries to link in a duplicate fashion; the linking command
has looked like this:

    $CC -Llibavutil ... tools/tool.o libavutil/libavutil.a -lavutil

Normally, the libraries to link are handled with "-Llibavutil -lavutil";
when linking the main fftools, this is how they are linked.

In the case of the binaries under the "tools" directory (within the
make variable TOOLS), we've passed the full set of dependencies
to the linker, via $^, which does contain the names of the
dependency libraries as well.

When libraries are built as regular static libraries, or shared
unix libraries, this has all worked fine. When libraries are
built as DLLs for Windows, though, the norm is not to pass the
actual DLL to the linker, but an import library.

Mingw tools generally can handle linking directly against a DLL
as well, but MSVC tools don't support that, and error out with
a very cryptic error message:

    libavdevice\avdevice.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2D8

By omitting these parts of the dependencies, linking of these tool
executables succeed in MSVC builds with shared libraries enabled.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-02 22:49:07 +03:00
Mark Thompson 014c138633 cbs_av1: Make fake OBU size length field a write option
This is an option to modify the behaviour of the writer, not a syntax
field.
2023-10-02 20:32:03 +01:00
Rémi Denis-Courmont 1a4bd76ea5 swscale/rgb2rgb: remove R-V V shuffle_bytes_3012
This is slower than the Zbb version on real hardware due to register
strides. Proper support for vector byte-swap requires the Zvbb
extension, but it's much too early for me to worry about it.
2023-10-02 22:28:38 +03:00
Rémi Denis-Courmont c4a144c29d swscale/rgb2rgb: add R-V Zbb shuffle_bytes_3210 2023-10-02 22:28:25 +03:00
Rémi Denis-Courmont cec48e3b32 riscv: factor out the bswap32 assembler 2023-10-02 22:28:21 +03:00
Paul B Mahol 4fe0a31cab avcodec/mlpenc: allow changing some LPC parameters 2023-10-02 20:31:30 +02:00
Paul B Mahol a1b29ab60d avcodec/mlpenc: increase compression ratio even more, fix LPC parameters 2023-10-02 20:31:28 +02:00
Paul B Mahol 0be5da9cfa avcodec/mlpenc: increase compression ratio when input is of lower bit depth 2023-10-02 20:31:27 +02:00
Rémi Denis-Courmont b36f3d5330 lavc/fmtconvert: unroll R-V V int32_to_float_fmul_scalar 2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont f3dfd4ccf2 lavc/aacpsdsp: unroll RISC-V V hybrid_synthesis_deint 2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont 0f1336b285 lavc/aacpsdsp: unroll RISC-V V hybrid_analysis_ileave 2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont 69d7486e59 lavc/aacpsdsp: unroll RISC-V V mul_pair_single 2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont c270928cc0 lavc/aacpsdsp: unroll R-V V stereo interpolate 2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont 27d74fc1ef lavc/aacpsdsp: simplify R-V V stereo interpolate
Remove some useless vector splat.
2023-10-02 18:08:23 +03:00
Rémi Denis-Courmont 3575ee2ea3 lavc/audiodsp: unroll RISC-V clip functions
audiodsp.vector_clip_int32_c: 17500.7
audiodsp.vector_clip_int32_rvv_i32: 8404.7  (m1)
audiodsp.vector_clip_int32_rvv_i32: 2689.9  (m8)

audiodsp.vector_clipf_c: 33679.7
audiodsp.vector_clipf_rvf: 7019.7
audiodsp.vector_clipf_rvv_f32: 8328.0       (m1)
audiodsp.vector_clipf_rvv_f32: 2209.4       (m8)
2023-10-02 18:07:54 +03:00
Andreas Rheinhardt b6e5136ba3 avcodec/mpegvideo_dec: Remove commented-out legacy cruft
Added in 80e9e63c94 for reasons
unknown to me.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:23:28 +02:00
Andreas Rheinhardt f52b4a6e69 avcodec/snow: Move dsp helper functions to snow_dwt.h
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:23:16 +02:00
Andreas Rheinhardt 155e7e126b avcodec/snow: Move encoder-only stuff out of SnowContext
Put it into an encoder-specific context with a SnowContext
at its front. This also avoids having to include mpegvideo.h
in snow.c and snowdec.c.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:23:00 +02:00
Andreas Rheinhardt 259e1d2bd7 avformat/matroskaenc: Write default duration for audio
This is easily possible for those codecs with a fixed frame-size
(in samples).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:22:20 +02:00
Andreas Rheinhardt 0c1103d4dc avformat/matroskaenc: Don't create wrong packet durations
We have to write an explicit BlockDuration element (and use
a BlockGroup instead of a SimpleBlock) in case the Track
has a DefaultDuration that is inconsistent with the duration
of the packet.

The matroska-h264-remux test uses a file with coded fields
where the duration of a Block is the duration of a field,
not of a frame, therefore this patch writes said BlockDuration
elements.

(When using a BlockGroup, one has to add ReferenceBlock elements
to distinguish keyframes from non-keyframes. Unfortunately,
the AV1 codec mapping [1] requires us to reference all references
and to really use the real references, which requires a lot of
effort for basically no gain. When BlockGroups are used with AV1,
the created files are most likely invalid, both before and after
this patch, but this patch makes this more likely to happen.)

[1]: https://github.com/ietf-wg-cellar/matroska-specification/blob/master/codec/av1.md

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-02 12:22:05 +02:00
Paul B Mahol 9e531370b3 avformat/aea: fix bitrate for mono 2023-10-02 01:28:14 +02:00
Paul B Mahol edb6d6d536 avformat/aea: improve probe function 2023-10-02 01:28:11 +02:00
Paul B Mahol 7a444501d5 avcodec/mlpenc: fix quant_step_size for 16bit sample format input 2023-10-01 23:24:17 +02:00
Paul B Mahol ffc783dea7 avcodec/mlpenc: fix writing end of stream marker 2023-10-01 23:24:16 +02:00
Paul B Mahol 873ce68f54 avcodec/flicvideo: add 1bit support 2023-10-01 18:44:13 +02:00
Andreas Rheinhardt 6f7bf64dbc avcodec: Remove DCT, FFT, MDCT and RDFT
They were replaced by TX from libavutil; the tremendous work
to get to this point (both creating TX as well as porting
the users of the components removed in this commit) was
completely performed by Lynne alone.

Removing the subsystems from configure may break some command lines,
because the --disable-fft etc. options are no longer recognized.

Co-authored-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 02:25:09 +02:00
Andreas Rheinhardt d9464f3e34 avcodec/mpegaudiodsp: Init dct32 directly
This avoids using dct.c and will allow removing it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:53:32 +02:00
Andreas Rheinhardt 145db38f9b avcodec/bgmc: Use void* instead of AVCodecContext* as logctx
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:02:53 +02:00
Andreas Rheinhardt 7a9bc09176 avcodec/flac_parse: Use void* instead of AVCodecContext* as logctx
It more directly shows that ff_flac_decode_frame_header() does not
modify the AVCodecContext given to it at all; and it would not be
allowed to do so, given that it is used by the parser when it is
still unknown whether said frame header is even valid.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:02:53 +02:00
Andreas Rheinhardt 3ea73bc78a avcodec/lagarith: Use void* instead of AVCodecContext* as logctx
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:02:53 +02:00
Andreas Rheinhardt 08dd036b9f avcodec/roqvideo: Use void*, not AVCodecContext* for logctx
Also stop setting the field once per encode-frame.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:02:53 +02:00
Andreas Rheinhardt 7d1401ed02 avcodec/sipr: Remove write-only AVCodecContext*
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:02:53 +02:00
Andreas Rheinhardt b2f5899ec2 avcodec/utvideo: Split UTvideoContext into decoder and encoder contexts
In particular the encoder used only a small part of the context:
The new encoder context is only 128B here. It used to be 32992.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 01:01:50 +02:00
Andreas Rheinhardt 0e18f1e9a3 avcodec/vorbis: Use void* logctx instead of AVCodecContext*
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-01 00:50:38 +02:00
Andreas Rheinhardt bdbf9aa402 avcodec/ffv1dec: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-30 23:05:42 +02:00
Andreas Rheinhardt 0cfc7418bb avcodec/ffv1dec: Fix data races emanating from copying whole context
When using frame threading, the FFV1 decoder's update_thread_context()
function copies the whole context and afterwards restores some allocated
fields with backups made earlier. Among these fields are the
ThreadFrames and the source context's ThreadFrames can change
concurrently without any synchronization, leading to data races which
are undefined behaviour even if they don't lead to problems in
practice (as the destination's own ThreadFrames are restored directly
thereafter).

Fix this by only copying the actually needed fields.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-30 23:05:42 +02:00
James Almer 5ba06ad0b8 avcodec/decode: reduce scope of a variable in ff_decode_frame_props()
Signed-off-by: James Almer <jamrial@gmail.com>
2023-09-30 11:14:32 -03:00
Paul B Mahol ead1426a68 avcodec/rka: improve VRQ mode decoding 2023-09-30 15:35:04 +02:00
Paul B Mahol 8bfadacfd1 avcodec/rka: rename variable to something more representative 2023-09-30 15:35:03 +02:00
Andreas Rheinhardt 2cb2465cc7 avdevice/lavfi: Fix double-free on error
After the AVFrame has been wrapped into a buffer,
it is owned by the buffer and must not be freed manually
any more. Yet this happens on subsequent errors.

This bug was introduced in 6ca43a9675.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-30 12:27:44 +02:00
Michael Niedermayer 9a3bbf89bd
avformat/mov: Check avif_info
Fixes: leak
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6674082962997248
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6674082962997248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-29 23:08:38 +02:00
Roman Arzumanyan f904e60c32 libavutil/hwcontext_cuda: don't destroy external context when using current CUDA context
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2023-09-29 19:42:11 +02:00
Michael Niedermayer 442d9412d2
avformat/mxfdec: Remove this_partition
Suggested-by: Tomas Härdin <git@haerdin.se>
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5130394286817280

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-09-29 19:23:36 +02:00
Paul B Mahol 3bbc7d799c avcodec/ffv1*: add GBRAP14, GRAY14, YUVA422P12, YUVA444P12 formats support 2023-09-29 18:59:08 +02:00
Paul B Mahol 41f5b73903 avfilter/f_ebur128: do not print summary log if nothing was processed 2023-09-29 18:40:54 +02:00
Paul B Mahol 8623067e8d avformat/isom_tags: add missing CFHD tag 2023-09-29 18:40:52 +02:00
2124 changed files with 120689 additions and 60475 deletions

1
.gitattributes vendored
View File

@ -1,2 +1 @@
*.pnm -diff -text
tests/ref/fate/sub-scc eol=crlf

View File

@ -1,8 +1,8 @@
<jeebjp@gmail.com> <jan.ekstrom@aminocom.com>
<sw@jkqxz.net> <mrt@jkqxz.net>
<u@pkh.me> <cboesch@gopro.com>
<zhilizhao@tencent.com> <quinkblack@foxmail.com>
<zhilizhao@tencent.com> <wantlamy@gmail.com>
<quinkblack@foxmail.com> <wantlamy@gmail.com>
<quinkblack@foxmail.com> <zhilizhao@tencent.com>
<modmaker@google.com> <modmaker-at-google.com@ffmpeg.org>
<stebbins@jetheaddev.com> <jstebbins@jetheaddev.com>
<barryjzhao@tencent.com> <mypopydev@gmail.com>
@ -17,8 +17,10 @@
<atomnuker@gmail.com> <rpehlivanov@obe.tv>
<lizhong1008@gmail.com> <zhong.li@intel.com>
<lizhong1008@gmail.com> <zhongli_dev@126.com>
<andreas.rheinhardt@gmail.com> <andreas.rheinhardt@googlemail.com>
<andreas.rheinhardt@outlook.com> <andreas.rheinhardt@gmail.com>
<andreas.rheinhardt@outlook.com> <andreas.rheinhardt@googlemail.com>
rcombs <rcombs@rcombs.me> <rodger.combs@gmail.com>
<thilo.borgmann@mail.de> <thilo.borgmann@googlemail.com>
<liuqi05@kuaishou.com> <lq@chinaffmpeg.org>
<lq@chinaffmpeg.org> <liuqi05@kuaishou.com>
<ruiling.song83@gmail.com> <ruiling.song@intel.com>
Cosmin Stejerean <cosmin@cosmin.at> Cosmin Stejerean via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>

View File

@ -2,6 +2,42 @@ Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version <next>:
- DXV DXT1 encoder
- LEAD MCMP decoder
- EVC decoding using external library libxevd
- EVC encoding using external library libxeve
- QOA decoder and demuxer
- aap filter
- demuxing, decoding, filtering, encoding, and muxing in the
ffmpeg CLI now all run in parallel
- enable gdigrab device to grab a window using the hwnd=HANDLER syntax
- IAMF raw demuxer and muxer
- D3D12VA hardware accelerated H264, HEVC, VP9, AV1, MPEG-2 and VC1 decoding
- tiltandshift filter
- qrencode filter and qrencodesrc source
- quirc filter
- lavu/eval: introduce randomi() function in expressions
- VVC decoder
- fsync filter
- Raw Captions with Time (RCWT) closed caption muxer
- ffmpeg CLI -bsf option may now be used for input as well as output
- ffmpeg CLI options may now be used as -/opt <path>, which is equivalent
to -opt <contents of file <path>>
- showinfo bitstream filter
- a C11-compliant compiler is now required; note that this requirement
will be bumped to C17 in the near future, so consider updating your
build environment if it lacks C17 support
- Change the default bitrate control method from VBR to CQP for QSV encoders.
- removed deprecated ffmpeg CLI options -psnr and -map_channel
- DVD-Video demuxer, powered by libdvdnav and libdvdread
- ffprobe -show_stream_groups option
- ffprobe (with -export_side_data film_grain) now prints film grain metadata
- AEA muxer
- ffmpeg CLI loopback decoders
- Support PacketTypeMetadata of PacketType in enhanced flv format
version 6.1:
- libaribcaption decoder
- Playdate video decoder and demuxer
- Extend VAAPI support for libva-win32 on Windows
@ -35,6 +71,9 @@ version <next>:
- CRI USM demuxer
- ffmpeg CLI '-top' option deprecated in favor of the setfield filter
- VAAPI AV1 encoder
- ffprobe XML output schema changed to account for multiple
variable-fields elements within the same parent element
- ffprobe -output_format option added as an alias of -of
version 6.0:

View File

@ -144,7 +144,6 @@ Codecs:
bgmc.c, bgmc.h Thilo Borgmann
binkaudio.c Peter Ross
cavs* Stefan Gehrer
cdxl.c Paul B Mahol
celp_filters.* Vitor Sessak
cinepak.c Roberto Togni
cinepakenc.c Rl / Aetey G.T. AB
@ -163,7 +162,6 @@ Codecs:
dv.c Roman Shaposhnik
dvbsubdec.c Anshul Maheshwari
eacmv*, eaidct*, eat* Peter Ross
evrc* Paul B Mahol
exif.c, exif.h Thilo Borgmann
ffv1* Michael Niedermayer
ffwavesynth.c Nicolas George
@ -181,6 +179,7 @@ Codecs:
interplayvideo.c Mike Melanson
jni*, ffjni* Matthieu Bouron
jpeg2000* Nicolas Bertrand
jpegxl* Leo Izen
jvdec.c Peter Ross
lcl*.c Roberto Togni, Reimar Doeffinger
libcelt_dec.c Nicolas George
@ -216,7 +215,6 @@ Codecs:
nvdec*, nvenc* Timo Rothenpieler
omx.c Martin Storsjo, Aman Gupta
opus* Rostislav Pehlivanov
paf.* Paul B Mahol
pcx.c Ivo van Poorten
pgssubdec.c Reimar Doeffinger
ptx.c Ivo van Poorten
@ -230,7 +228,6 @@ Codecs:
rpza.c Roberto Togni
rtjpeg.c, rtjpeg.h Reimar Doeffinger
rv10.c Michael Niedermayer
s3tc* Ivo van Poorten
smc.c Mike Melanson
snow* Michael Niedermayer, Loren Merritt
sonic.c Alex Beregszaszi
@ -238,16 +235,13 @@ Codecs:
srt* Aurelien Jacobs
sunrast.c Ivo van Poorten
svq3.c Michael Niedermayer
tak* Paul B Mahol
truemotion1* Mike Melanson
tta.c Alex Beregszaszi, Jaikrishnan Menon
ttaenc.c Paul B Mahol
txd.c Ivo van Poorten
v4l2_* Jorge Ramirez-Ortiz
vc2* Rostislav Pehlivanov
vcr1.c Michael Niedermayer
videotoolboxenc.c Rick Kern, Aman Gupta
vima.c Paul B Mahol
vorbisdec.c Denes Balatoni, David Conrad
vorbisenc.c Oded Shimon
vp3* Mike Melanson
@ -256,22 +250,21 @@ Codecs:
vp8 David Conrad, Ronald Bultje
vp9 Ronald Bultje
vqavideo.c Mike Melanson
vvc Nuo Mi
wmaprodec.c Sascha Sommer
wmavoice.c Ronald S. Bultje
wmv2.c Michael Niedermayer
xan.c Mike Melanson
xbm* Paul B Mahol
xface Stefano Sabatini
xwd* Paul B Mahol
Hardware acceleration:
dxva2* Hendrik Leppkes, Laurent Aimar, Steve Lhomme
d3d11va* Steve Lhomme
mediacodec* Matthieu Bouron, Aman Gupta
mediacodec* Matthieu Bouron, Aman Gupta, Zhao Zhili
vaapi* Haihao Xiang
vaapi_encode* Mark Thompson, Haihao Xiang
vdpau* Philip Langdale, Carl Eugen Hoyos
videotoolbox* Rick Kern, Aman Gupta
videotoolbox* Rick Kern, Aman Gupta, Zhao Zhili
libavdevice
@ -306,64 +299,34 @@ Generic parts:
motion_estimation.c Davinder Singh
Filters:
f_drawgraph.c Paul B Mahol
af_adelay.c Paul B Mahol
af_aecho.c Paul B Mahol
af_afade.c Paul B Mahol
af_amerge.c Nicolas George
af_aphaser.c Paul B Mahol
af_aresample.c Michael Niedermayer
af_astats.c Paul B Mahol
af_atempo.c Pavel Koshevoy
af_biquads.c Paul B Mahol
af_chorus.c Paul B Mahol
af_compand.c Paul B Mahol
af_firequalizer.c Muhammad Faiz
af_hdcd.c Burt P.
af_ladspa.c Paul B Mahol
af_loudnorm.c Kyle Swanson
af_pan.c Nicolas George
af_sidechaincompress.c Paul B Mahol
af_silenceremove.c Paul B Mahol
avf_aphasemeter.c Paul B Mahol
avf_avectorscope.c Paul B Mahol
avf_showcqt.c Muhammad Faiz
vf_blend.c Paul B Mahol
vf_bwdif Thomas Mundt (CC <thomas.mundt@hr.de>)
vf_chromakey.c Timo Rothenpieler
vf_colorchannelmixer.c Paul B Mahol
vf_colorconstancy.c Mina Sami (CC <minas.gorgy@gmail.com>)
vf_colorbalance.c Paul B Mahol
vf_colorkey.c Timo Rothenpieler
vf_colorlevels.c Paul B Mahol
vf_coreimage.m Thilo Borgmann
vf_deband.c Paul B Mahol
vf_dejudder.c Nicholas Robbins
vf_delogo.c Jean Delvare (CC <jdelvare@suse.com>)
vf_drawbox.c/drawgrid Andrey Utkin
vf_extractplanes.c Paul B Mahol
vf_histogram.c Paul B Mahol
vf_fsync.c Thilo Borgmann
vf_hqx.c Clément Bœsch
vf_idet.c Pascal Massimino
vf_il.c Paul B Mahol
vf_(t)interlace Thomas Mundt (CC <thomas.mundt@hr.de>)
vf_lenscorrection.c Daniel Oberhoff
vf_libplacebo.c Niklas Haas
vf_mergeplanes.c Paul B Mahol
vf_mestimate.c Davinder Singh
vf_minterpolate.c Davinder Singh
vf_neighbor.c Paul B Mahol
vf_psnr.c Paul B Mahol
vf_random.c Paul B Mahol
vf_readvitc.c Tobias Rapp (CC t.rapp at noa-archive dot com)
vf_scale.c Michael Niedermayer
vf_separatefields.c Paul B Mahol
vf_ssim.c Paul B Mahol
vf_stereo3d.c Paul B Mahol
vf_telecine.c Paul B Mahol
vf_tonemap_opencl.c Ruiling Song
vf_yadif.c Michael Niedermayer
vf_zoompan.c Paul B Mahol
Sources:
vsrc_mandelbrot.c Michael Niedermayer
@ -385,7 +348,6 @@ Muxers/Demuxers:
4xm.c Mike Melanson
aadec.c Vesselin Bontchev (vesselin.bontchev at yandex dot com)
adtsenc.c Robert Swain
afc.c Paul B Mahol
aiffdec.c Baptiste Coudurier, Matthieu Bouron
aiffenc.c Baptiste Coudurier, Matthieu Bouron
alp.c Zane van Iperen
@ -396,16 +358,12 @@ Muxers/Demuxers:
argo_brp.c Zane van Iperen
argo_cvg.c Zane van Iperen
ass* Aurelien Jacobs
astdec.c Paul B Mahol
astenc.c James Almer
avi* Michael Niedermayer
avisynth.c Stephen Hutchinson
avr.c Paul B Mahol
bink.c Peter Ross
boadec.c Michael Niedermayer
brstm.c Paul B Mahol
caf* Peter Ross
cdxl.c Paul B Mahol
codec2.c Tomas Härdin
crc.c Michael Niedermayer
dashdec.c Steven Liu
@ -414,10 +372,9 @@ Muxers/Demuxers:
dfpwmdec.c Jack Bruienne
dss.c Oleksij Rempel
dtsdec.c foo86
dtshddec.c Paul B Mahol
dv.c Roman Shaposhnik
dvdvideodec.c Marth64
electronicarts.c Peter Ross
epafdec.c Paul B Mahol
evc* Samsung (Dawid Kozinski)
ffm* Baptiste Coudurier
flic.c Mike Melanson
@ -432,23 +389,19 @@ Muxers/Demuxers:
imf* Pierre-Anthony Lemieux
img2*.c Michael Niedermayer
ipmovie.c Mike Melanson
ircam* Paul B Mahol
iss.c Stefan Gehrer
jpegxl_anim_dec.c Leo Izen
jpegxl_probe.* Leo Izen
jpegxl* Leo Izen
jvdec.c Peter Ross
kvag.c Zane van Iperen
libmodplug.c Clément Bœsch
libopenmpt.c Josh de Kock
lmlm4.c Ivo van Poorten
lvfdec.c Paul B Mahol
lxfdec.c Tomas Härdin
matroska.c Aurelien Jacobs, Andreas Rheinhardt
matroskadec.c Aurelien Jacobs, Andreas Rheinhardt
matroskaenc.c David Conrad, Andreas Rheinhardt
matroska subtitles (matroskaenc.c) John Peebles
metadata* Aurelien Jacobs
mgsts.c Paul B Mahol
microdvd* Aurelien Jacobs
mm.c Peter Ross
mov.c Baptiste Coudurier
@ -461,7 +414,6 @@ Muxers/Demuxers:
msnwc_tcp.c Ramiro Polla
mtv.c Reynaldo H. Verdejo Pinochet
mxf* Baptiste Coudurier, Tomas Härdin
nistspheredec.c Paul B Mahol
nsvdec.c Francois Revol
nut* Michael Niedermayer
nuv.c Reimar Doeffinger
@ -469,13 +421,12 @@ Muxers/Demuxers:
oggenc.c Baptiste Coudurier
oggparse*.c David Conrad
oma.c Maxim Poliakovski
paf.c Paul B Mahol
pp_bnk.c Zane van Iperen
psxstr.c Mike Melanson
pva.c Ivo van Poorten
pvfdec.c Paul B Mahol
r3d.c Baptiste Coudurier
raw.c Michael Niedermayer
rcwtenc.c Marth64
rdt.c Ronald S. Bultje
rl2.c Sascha Sommer
rmdec.c, rmenc.c Ronald S. Bultje
@ -494,11 +445,9 @@ Muxers/Demuxers:
sdp.c Martin Storsjo
segafilm.c Mike Melanson
segment.c Stefano Sabatini
smjpeg* Paul B Mahol
spdif* Anssi Hannula
srtdec.c Aurelien Jacobs
swf.c Baptiste Coudurier
takdec.c Paul B Mahol
tta.c Alex Beregszaszi
txd.c Ivo van Poorten
voc.c Aurelien Jacobs
@ -508,7 +457,6 @@ Muxers/Demuxers:
webvtt* Matthew J Heaney
westwood.c Mike Melanson
wtv.c Peter Ross
wvenc.c Paul B Mahol
Protocols:
async.c Zhang Rui
@ -549,8 +497,7 @@ Linux / PowerPC Lauri Kasanen
RISC-V Rémi Denis-Courmont
Windows MinGW Alex Beregszaszi, Ramiro Polla
Windows Cygwin Victor Paesa
Windows MSVC Matthew Oliver, Hendrik Leppkes
Windows ICL Matthew Oliver
Windows MSVC Hendrik Leppkes
ADI/Blackfin DSP Marc Hoffman
Sparc Roman Shaposhnik
OS/2 KO Myung-Hun
@ -619,6 +566,7 @@ Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368
James Almer 7751 2E8C FD94 A169 57E6 9A7A 1463 01AD 7376 59E0
Jean Delvare 7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A
Leo Izen (Traneptora) B6FD 3CFC 7ACF 83FC 9137 6945 5A71 C331 FD2F A19A
Leo Izen (Traneptora) 1D83 0A0B CE46 709E 203B 26FC 764E 48EA 4822 1833
Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
Lynne FE50 139C 6805 72CA FD52 1F8D A2FE A5F0 3F03 4464
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB

View File

@ -47,7 +47,7 @@ FF_DEP_LIBS := $(DEP_LIBS)
FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
$(TOOLS): %$(EXESUF): %.o
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(filter-out $(FF_DEP_LIBS), $^) $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS)
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
@ -64,6 +64,9 @@ tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS)
tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
tools/target_sws_fuzzer$(EXESUF): tools/target_sws_fuzzer.o $(FF_DEP_LIBS)
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
@ -93,10 +96,10 @@ ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
ALTIVEC-OBJS VSX-OBJS RVV-OBJS MMX-OBJS X86ASM-OBJS \
ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
MMI-OBJS LSX-OBJS LASX-OBJS OBJS SLIBOBJS SHLIBOBJS \
STLIBOBJS HOSTOBJS TESTOBJS
MMI-OBJS LSX-OBJS LASX-OBJS RV-OBJS RVV-OBJS \
OBJS SLIBOBJS SHLIBOBJS STLIBOBJS HOSTOBJS TESTOBJS
define RESET
$(1) :=
@ -133,13 +136,18 @@ endif
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
VERSION_SH = $(SRC_PATH)/ffbuild/version.sh
ifeq ($(VERSION_TRACKING),yes)
GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
endif
.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) ffbuild/config.mak
.version: M=@
ifneq ($(VERSION_TRACKING),yes)
libavutil/ffversion.h .version: REVISION=unknown
endif
libavutil/ffversion.h .version:
$(M)$(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h $(EXTRA_VERSION)
$(M)revision=$(REVISION) $(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h $(EXTRA_VERSION)
$(Q)touch .version
# force version.sh to run whenever version might have changed

298
configure vendored
View File

@ -136,13 +136,9 @@ Component options:
--disable-w32threads disable Win32 threads [autodetect]
--disable-os2threads disable OS/2 threads [autodetect]
--disable-network disable network support [no]
--disable-dct disable DCT code
--disable-dwt disable DWT code
--disable-error-resilience disable error resilience code
--disable-lsp disable LSP code
--disable-mdct disable MDCT code
--disable-rdft disable RDFT code
--disable-fft disable FFT code
--disable-faan disable floating point AAN (I)DCT code
--disable-pixelutils disable pixel utils in libavutil
@ -231,6 +227,8 @@ External library support:
--enable-libdavs2 enable AVS2 decoding via libdavs2 [no]
--enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
--enable-libdvdnav enable libdvdnav, needed for DVD demuxing [no]
--enable-libdvdread enable libdvdread, needed for DVD demuxing [no]
--enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
--enable-libflite enable flite (voice synthesis) support via libflite [no]
--enable-libfontconfig enable libfontconfig, useful for drawtext filter [no]
@ -260,6 +258,8 @@ External library support:
--enable-libopus enable Opus de/encoding via libopus [no]
--enable-libplacebo enable libplacebo library [no]
--enable-libpulse enable Pulseaudio input via libpulse [no]
--enable-libqrencode enable QR encode generation via libqrencode [no]
--enable-libquirc enable QR decoding via libquirc [no]
--enable-librabbitmq enable RabbitMQ library [no]
--enable-librav1e enable AV1 encoding via rav1e [no]
--enable-librist enable RIST via librist [no]
@ -293,6 +293,8 @@ External library support:
--enable-libwebp enable WebP encoding via libwebp [no]
--enable-libx264 enable H.264 encoding via x264 [no]
--enable-libx265 enable HEVC encoding via x265 [no]
--enable-libxeve enable EVC encoding via libxeve [no]
--enable-libxevd enable EVC decoding via libxevd [no]
--enable-libxavs enable AVS encoding via xavs [no]
--enable-libxavs2 enable AVS2 encoding via xavs2 [no]
--enable-libxcb enable X11 grabbing using XCB [autodetect]
@ -338,9 +340,10 @@ External library support:
--disable-cuda-llvm disable CUDA compilation using clang [autodetect]
--disable-cuvid disable Nvidia CUVID support [autodetect]
--disable-d3d11va disable Microsoft Direct3D 11 video acceleration code [autodetect]
--disable-d3d12va disable Microsoft Direct3D 12 video acceleration code [autodetect]
--disable-dxva2 disable Microsoft DirectX 9 video acceleration code [autodetect]
--disable-ffnvcodec disable dynamically linked Nvidia code [autodetect]
--enable-libdrm enable DRM code (Linux) [no]
--disable-libdrm disable DRM code (Linux) [autodetect]
--enable-libmfx enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
--enable-libvpl enable Intel oneVPL code via libvpl if libmfx is not used [no]
--enable-libnpp enable Nvidia Performance Primitives-based code [no]
@ -506,6 +509,7 @@ Developer options (useful when working on FFmpeg itself):
--enable-macos-kperf enable macOS kperf (private) API
--disable-large-tests disable tests that use a large amount of memory
--disable-ptx-compression don't compress CUDA PTX code even when possible
--disable-version-tracking don't include the git/release version in the build
NOTE: Object files are built at the place where configure is launched.
EOF
@ -1804,6 +1808,8 @@ EXTERNAL_LIBRARY_GPL_LIST="
frei0r
libcdio
libdavs2
libdvdnav
libdvdread
librubberband
libvidstab
libx264
@ -1855,7 +1861,6 @@ EXTERNAL_LIBRARY_LIST="
libcodec2
libdav1d
libdc1394
libdrm
libflite
libfontconfig
libfreetype
@ -1881,6 +1886,8 @@ EXTERNAL_LIBRARY_LIST="
libopus
libplacebo
libpulse
libqrencode
libquirc
librabbitmq
librav1e
librist
@ -1905,6 +1912,8 @@ EXTERNAL_LIBRARY_LIST="
libvorbis
libvpx
libwebp
libxevd
libxeve
libxml2
libzimg
libzmq
@ -1921,13 +1930,14 @@ EXTERNAL_LIBRARY_LIST="
HWACCEL_AUTODETECT_LIBRARY_LIST="
amf
audiotoolbox
crystalhd
cuda
cuda_llvm
cuvid
d3d11va
d3d12va
dxva2
ffnvcodec
libdrm
nvdec
nvenc
vaapi
@ -2004,17 +2014,13 @@ PROGRAM_LIST="
"
SUBSYSTEM_LIST="
dct
dwt
error_resilience
faan
fast_unaligned
fft
lsp
mdct
pixelutils
network
rdft
"
# COMPONENT_LIST needs to come last to ensure correct dependency checking
@ -2158,6 +2164,7 @@ ARCH_EXT_LIST_PPC="
"
ARCH_EXT_LIST_RISCV="
rv
rvv
"
@ -2210,7 +2217,6 @@ HAVE_LIST_PUB="
HEADERS_LIST="
arpa_inet_h
asm_hwcap_h
asm_types_h
cdio_paranoia_h
cdio_paranoia_paranoia_h
@ -2236,6 +2242,7 @@ HEADERS_LIST="
opencv2_core_core_c_h
OpenGL_gl3_h
poll_h
pthread_np_h
sys_param_h
sys_resource_h
sys_select_h
@ -2338,6 +2345,8 @@ SYSTEM_FUNCS="
posix_memalign
prctl
pthread_cancel
pthread_set_name_np
pthread_setname_np
sched_getaffinity
SecItemImport
SetConsoleTextAttribute
@ -2454,6 +2463,7 @@ HAVE_LIST="
opencl_dxva2
opencl_vaapi_beignet
opencl_vaapi_intel_media
opencl_videotoolbox
perl
pod2man
texi2html
@ -2480,6 +2490,7 @@ CONFIG_EXTRA="
cbs_h266
cbs_jpeg
cbs_mpeg2
cbs_vp8
cbs_vp9
deflate_wrapper
dirac_parse
@ -2509,6 +2520,8 @@ CONFIG_EXTRA="
huffman
huffyuvdsp
huffyuvencdsp
iamfdec
iamfenc
idctdsp
iirfilter
inflate_wrapper
@ -2579,6 +2592,7 @@ CMDLINE_SELECT="
optimizations
rpath
stripping
version_tracking
"
PATHS_LIST="
@ -2683,7 +2697,8 @@ ppc4xx_deps="ppc"
vsx_deps="altivec"
power8_deps="vsx"
rvv_deps="riscv"
rv_deps="riscv"
rvv_deps="rv"
loongson2_deps="mips"
loongson3_deps="mips"
@ -2765,8 +2780,8 @@ cbs_h265_select="cbs"
cbs_h266_select="cbs"
cbs_jpeg_select="cbs"
cbs_mpeg2_select="cbs"
cbs_vp8_select="cbs"
cbs_vp9_select="cbs"
dct_select="rdft"
deflate_wrapper_deps="zlib"
dirac_parse_select="golomb"
dovi_rpu_select="golomb"
@ -2786,18 +2801,15 @@ frame_thread_encoder_deps="encoders threads"
inflate_wrapper_deps="zlib"
intrax8_select="blockdsp wmv2dsp"
iso_media_select="mpeg4audio"
mdct_select="fft"
me_cmp_select="idctdsp"
mpeg_er_select="error_resilience"
mpegaudio_select="mpegaudiodsp mpegaudioheader"
mpegaudiodsp_select="dct"
mpegvideo_select="blockdsp hpeldsp idctdsp videodsp"
mpegvideodec_select="h264chroma mpegvideo mpeg_er"
mpegvideoenc_select="aandcttables fdctdsp me_cmp mpegvideo pixblockdsp"
msmpeg4dec_select="h263_decoder"
msmpeg4enc_select="h263_encoder"
vc1dsp_select="h264chroma qpeldsp startcode"
rdft_select="fft"
# decoders / encoders
aac_decoder_select="adts_header mpeg4audio sinewin"
@ -2848,6 +2860,7 @@ dvvideo_decoder_select="dvprofile idctdsp"
dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
dxa_decoder_deps="zlib"
dxv_decoder_select="lzf texturedsp"
dxv_encoder_select="texturedspenc"
eac3_decoder_select="ac3_decoder"
eac3_encoder_select="ac3_encoder"
eamad_decoder_select="aandcttables blockdsp bswapdsp"
@ -2900,6 +2913,7 @@ ipu_decoder_select="mpegvideodec"
jpegls_decoder_select="mjpeg_decoder"
jv_decoder_select="blockdsp"
lagarith_decoder_select="llviddsp"
lead_decoder_select="idctdsp jpegtables"
ljpeg_encoder_select="jpegtables"
lscr_decoder_select="inflate_wrapper"
magicyuv_decoder_select="llviddsp"
@ -3025,6 +3039,7 @@ vp6f_decoder_select="vp6_decoder"
vp7_decoder_select="h264pred videodsp vp8dsp"
vp8_decoder_select="h264pred videodsp vp8dsp"
vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf"
vvc_decoder_select="cabac cbs_h266 golomb videodsp"
wcmv_decoder_select="inflate_wrapper"
webp_decoder_select="vp8_decoder exif"
wmalossless_decoder_select="llauddsp"
@ -3050,10 +3065,10 @@ zmbv_decoder_select="inflate_wrapper"
zmbv_encoder_select="deflate_wrapper"
# hardware accelerators
crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
cuda_deps="ffnvcodec"
cuvid_deps="ffnvcodec"
d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
d3d12va_deps="dxva_h ID3D12Device ID3D12VideoDecoder"
dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
ffnvcodec_deps_any="libdl LoadLibrary"
mediacodec_deps="android"
@ -3061,12 +3076,15 @@ nvdec_deps="ffnvcodec"
vaapi_x11_deps="xlib_x11"
videotoolbox_hwaccel_deps="videotoolbox pthreads"
videotoolbox_hwaccel_extralibs="-framework QuartzCore"
vulkan_deps="threads"
vulkan_deps_any="libdl LoadLibrary"
av1_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_AV1"
av1_d3d11va_hwaccel_select="av1_decoder"
av1_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_AV1"
av1_d3d11va2_hwaccel_select="av1_decoder"
av1_d3d12va_hwaccel_deps="d3d12va DXVA_PicParams_AV1"
av1_d3d12va_hwaccel_select="av1_decoder"
av1_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_AV1"
av1_dxva2_hwaccel_select="av1_decoder"
av1_nvdec_hwaccel_deps="nvdec CUVIDAV1PICPARAMS"
@ -3085,6 +3103,8 @@ h264_d3d11va_hwaccel_deps="d3d11va"
h264_d3d11va_hwaccel_select="h264_decoder"
h264_d3d11va2_hwaccel_deps="d3d11va"
h264_d3d11va2_hwaccel_select="h264_decoder"
h264_d3d12va_hwaccel_deps="d3d12va"
h264_d3d12va_hwaccel_select="h264_decoder"
h264_dxva2_hwaccel_deps="dxva2"
h264_dxva2_hwaccel_select="h264_decoder"
h264_nvdec_hwaccel_deps="nvdec"
@ -3101,6 +3121,8 @@ hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
hevc_d3d11va_hwaccel_select="hevc_decoder"
hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
hevc_d3d11va2_hwaccel_select="hevc_decoder"
hevc_d3d12va_hwaccel_deps="d3d12va DXVA_PicParams_HEVC"
hevc_d3d12va_hwaccel_select="hevc_decoder"
hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
hevc_dxva2_hwaccel_select="hevc_decoder"
hevc_nvdec_hwaccel_deps="nvdec"
@ -3127,6 +3149,8 @@ mpeg2_d3d11va_hwaccel_deps="d3d11va"
mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
mpeg2_d3d11va2_hwaccel_deps="d3d11va"
mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder"
mpeg2_d3d12va_hwaccel_deps="d3d12va"
mpeg2_d3d12va_hwaccel_select="mpeg2video_decoder"
mpeg2_dxva2_hwaccel_deps="dxva2"
mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
mpeg2_nvdec_hwaccel_deps="nvdec"
@ -3151,6 +3175,8 @@ vc1_d3d11va_hwaccel_deps="d3d11va"
vc1_d3d11va_hwaccel_select="vc1_decoder"
vc1_d3d11va2_hwaccel_deps="d3d11va"
vc1_d3d11va2_hwaccel_select="vc1_decoder"
vc1_d3d12va_hwaccel_deps="d3d12va"
vc1_d3d12va_hwaccel_select="vc1_decoder"
vc1_dxva2_hwaccel_deps="dxva2"
vc1_dxva2_hwaccel_select="vc1_decoder"
vc1_nvdec_hwaccel_deps="nvdec"
@ -3167,6 +3193,8 @@ vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
vp9_d3d11va_hwaccel_select="vp9_decoder"
vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
vp9_d3d11va2_hwaccel_select="vp9_decoder"
vp9_d3d12va_hwaccel_deps="d3d12va DXVA_PicParams_VP9"
vp9_d3d12va_hwaccel_select="vp9_decoder"
vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
vp9_dxva2_hwaccel_select="vp9_decoder"
vp9_nvdec_hwaccel_deps="nvdec"
@ -3179,6 +3207,7 @@ vp9_videotoolbox_hwaccel_deps="videotoolbox"
vp9_videotoolbox_hwaccel_select="vp9_decoder"
wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
wmv3_d3d12va_hwaccel_select="vc1_d3d12va_hwaccel"
wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
wmv3_nvdec_hwaccel_select="vc1_nvdec_hwaccel"
wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
@ -3229,7 +3258,6 @@ av1_nvenc_encoder_select="atsc_a53"
h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
h264_amf_encoder_deps="amf"
h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
h264_cuvid_decoder_deps="cuvid"
h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
h264_mediacodec_decoder_deps="mediacodec"
@ -3277,7 +3305,6 @@ mjpeg_vaapi_encoder_select="cbs_jpeg jpegtables vaapi_encode"
mp3_mf_encoder_deps="mediafoundation"
mpeg1_cuvid_decoder_deps="cuvid"
mpeg1_v4l2m2m_decoder_deps="v4l2_m2m mpeg1_v4l2_m2m"
mpeg2_crystalhd_decoder_select="crystalhd"
mpeg2_cuvid_decoder_deps="cuvid"
mpeg2_mmal_decoder_deps="mmal"
mpeg2_mediacodec_decoder_deps="mediacodec"
@ -3285,7 +3312,6 @@ mpeg2_qsv_decoder_select="qsvdec"
mpeg2_qsv_encoder_select="qsvenc"
mpeg2_vaapi_encoder_select="cbs_mpeg2 vaapi_encode"
mpeg2_v4l2m2m_decoder_deps="v4l2_m2m mpeg2_v4l2_m2m"
mpeg4_crystalhd_decoder_select="crystalhd"
mpeg4_cuvid_decoder_deps="cuvid"
mpeg4_mediacodec_decoder_deps="mediacodec"
mpeg4_mediacodec_encoder_deps="mediacodec"
@ -3293,8 +3319,6 @@ mpeg4_mmal_decoder_deps="mmal"
mpeg4_omx_encoder_deps="omx"
mpeg4_v4l2m2m_decoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
mpeg4_v4l2m2m_encoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
msmpeg4_crystalhd_decoder_select="crystalhd"
vc1_crystalhd_decoder_select="crystalhd"
vc1_cuvid_decoder_deps="cuvid"
vc1_mmal_decoder_deps="mmal"
vc1_qsv_decoder_select="qsvdec"
@ -3318,7 +3342,6 @@ vp9_vaapi_encoder_select="vaapi_encode"
vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9"
vp9_qsv_encoder_select="qsvenc"
vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
wmv3_crystalhd_decoder_select="crystalhd"
av1_qsv_decoder_select="qsvdec"
av1_qsv_encoder_select="qsvenc"
av1_qsv_encoder_deps="libvpl"
@ -3352,7 +3375,7 @@ h264_redundant_pps_bsf_select="cbs_h264"
hevc_metadata_bsf_select="cbs_h265"
mjpeg2jpeg_bsf_select="jpegtables"
mpeg2_metadata_bsf_select="cbs_mpeg2"
trace_headers_bsf_select="cbs"
trace_headers_bsf_select="cbs cbs_vp8"
vp9_metadata_bsf_select="cbs_vp9"
vvc_metadata_bsf_select="cbs_h266"
@ -3468,6 +3491,8 @@ libx265_encoder_deps="libx265"
libx265_encoder_select="atsc_a53"
libxavs_encoder_deps="libxavs"
libxavs2_encoder_deps="libxavs2"
libxevd_decoder_deps="libxevd"
libxeve_encoder_deps="libxeve"
libxvid_encoder_deps="libxvid"
libzvbi_teletext_decoder_deps="libzvbi"
vapoursynth_demuxer_deps="vapoursynth"
@ -3493,11 +3518,14 @@ caf_demuxer_select="iso_media"
caf_muxer_select="iso_media"
dash_muxer_select="mp4_muxer"
dash_demuxer_deps="libxml2"
daud_muxer_select="pcm_rechunk_bsf"
dirac_demuxer_select="dirac_parser"
dts_demuxer_select="dca_parser"
dtshd_demuxer_select="dca_parser"
dv_demuxer_select="dvprofile"
dv_muxer_select="dvprofile"
dvdvideo_demuxer_select="mpegps_demuxer"
dvdvideo_demuxer_deps="libdvdnav libdvdread"
dxa_demuxer_select="riffdec"
eac3_demuxer_select="ac3_parser"
evc_demuxer_select="evc_frame_merge_bsf evc_parser"
@ -3509,6 +3537,8 @@ gxf_muxer_select="pcm_rechunk_bsf"
hds_muxer_select="flv_muxer"
hls_demuxer_select="adts_header ac3_parser mov_demuxer mpegts_demuxer"
hls_muxer_select="mov_muxer mpegts_muxer"
iamf_demuxer_select="iamfdec"
iamf_muxer_select="iamfenc"
image2_alias_pix_demuxer_select="image2_demuxer"
image2_brender_pix_demuxer_select="image2_demuxer"
imf_demuxer_deps="libxml2"
@ -3523,16 +3553,16 @@ matroska_demuxer_suggest="bzlib zlib"
matroska_muxer_select="mpeg4audio riffenc aac_adtstoasc_bsf pgs_frame_merge_bsf vp9_superframe_bsf"
mlp_demuxer_select="mlp_parser"
mmf_muxer_select="riffenc"
mov_demuxer_select="iso_media riffdec"
mov_demuxer_select="iso_media riffdec iamfdec"
mov_demuxer_suggest="zlib"
mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser"
mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser iamfenc"
mp3_demuxer_select="mpegaudio_parser"
mp3_muxer_select="mpegaudioheader"
mp4_muxer_select="mov_muxer"
mpegts_demuxer_select="iso_media"
mpegts_muxer_select="ac3_parser adts_muxer latm_muxer h264_mp4toannexb_bsf hevc_mp4toannexb_bsf"
mpegts_muxer_select="ac3_parser adts_muxer latm_muxer h264_mp4toannexb_bsf hevc_mp4toannexb_bsf vvc_mp4toannexb_bsf"
mpegtsraw_demuxer_select="mpegts_demuxer"
mxf_muxer_select="pcm_rechunk_bsf"
mxf_muxer_select="pcm_rechunk_bsf rangecoder"
mxf_d10_muxer_select="mxf_muxer"
mxf_opatom_muxer_select="mxf_muxer"
nut_muxer_select="riffenc"
@ -3747,6 +3777,7 @@ frei0r_deps_any="libdl LoadLibrary"
frei0r_filter_deps="frei0r"
frei0r_src_filter_deps="frei0r"
fspp_filter_deps="gpl"
fsync_filter_deps="avformat"
gblur_vulkan_filter_deps="vulkan spirv_compiler"
hflip_vulkan_filter_deps="vulkan spirv_compiler"
histeq_filter_deps="gpl"
@ -3773,6 +3804,9 @@ nnedi_filter_deps="gpl"
ocr_filter_deps="libtesseract"
ocv_filter_deps="libopencv"
openclsrc_filter_deps="opencl"
qrencode_filter_deps="libqrencode"
qrencodesrc_filter_deps="libqrencode"
quirc_filter_deps="libquirc"
overlay_opencl_filter_deps="opencl"
overlay_qsv_filter_deps="libmfx"
overlay_qsv_filter_select="qsvvpp"
@ -3838,7 +3872,7 @@ zmq_filter_deps="libzmq"
zoompan_filter_deps="swscale"
zscale_filter_deps="libzimg const_nan"
scale_vaapi_filter_deps="vaapi"
scale_vt_filter_deps="videotoolbox"
scale_vt_filter_deps="videotoolbox VTPixelTransferSessionCreate"
scale_vulkan_filter_deps="vulkan spirv_compiler"
vpp_qsv_filter_deps="libmfx"
vpp_qsv_filter_select="qsvvpp"
@ -3906,7 +3940,7 @@ swscale_suggest="libm stdatomic"
avcodec_extralibs="pthreads_extralibs iconv_extralibs dxva2_extralibs lcms2_extralibs"
avfilter_extralibs="pthreads_extralibs"
avutil_extralibs="d3d11va_extralibs mediacodec_extralibs nanosleep_extralibs pthreads_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vaapi_win32_extralibs vdpau_x11_extralibs"
avutil_extralibs="d3d11va_extralibs d3d12va_extralibs mediacodec_extralibs nanosleep_extralibs pthreads_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vaapi_win32_extralibs vdpau_x11_extralibs"
# programs
ffmpeg_deps="avcodec avfilter avformat threads"
@ -3916,7 +3950,7 @@ ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
ffmpeg_suggest="ole32 psapi shell32"
ffplay_deps="avcodec avformat avfilter swscale swresample sdl2"
ffplay_select="crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
ffplay_suggest="shell32"
ffplay_suggest="shell32 libplacebo vulkan"
ffprobe_deps="avcodec avformat"
ffprobe_suggest="shell32"
@ -3982,6 +4016,7 @@ enable $DOCUMENT_LIST
enable $EXAMPLE_LIST
enable $LIBRARY_LIST
enable stripping
enable version_tracking
enable asm
enable debug
@ -4095,9 +4130,9 @@ find_filters_extern(){
FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
OUTDEV_LIST=$(find_things_extern muxer FFOutputFormat libavdevice/alldevices.c outdev)
INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
INDEV_LIST=$(find_things_extern demuxer FFInputFormat libavdevice/alldevices.c indev)
MUXER_LIST=$(find_things_extern muxer FFOutputFormat libavformat/allformats.c)
DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
DEMUXER_LIST=$(find_things_extern demuxer FFInputFormat libavformat/allformats.c)
ENCODER_LIST=$(find_things_extern encoder FFCodec libavcodec/allcodecs.c)
DECODER_LIST=$(find_things_extern decoder FFCodec libavcodec/allcodecs.c)
CODEC_LIST="
@ -4675,7 +4710,7 @@ msvc_common_flags(){
# generic catch all at the bottom will print the original flag.
-Wall) ;;
-Wextra) ;;
-std=c*) ;;
-std=c*) echo /std:${flag#-std=};;
# Common flags
-fomit-frame-pointer) ;;
-g) echo -Z7 ;;
@ -4685,6 +4720,7 @@ msvc_common_flags(){
-fPIC) ;;
-mthumb) ;;
-march=*) ;;
-mfp16-format=*) ;;
-lz) echo zlib.lib ;;
-lx264) echo libx264.lib ;;
-lstdc++) ;;
@ -4719,7 +4755,7 @@ icl_flags(){
# Despite what Intel's documentation says -Wall, which is supported
# on Windows, does enable remarks so disable them here.
-Wall) echo $flag -Qdiag-disable:remark ;;
-std=c99) echo -Qstd=c99 ;;
-std=c11) echo -Qstd=c11 ;;
-flto*) echo -ipo ;;
esac
done
@ -4767,7 +4803,7 @@ suncc_flags(){
athlon*) echo -xarch=pentium_proa ;;
esac
;;
-std=c99) echo -xc99 ;;
-std=c11) echo -xc11 ;;
-fomit-frame-pointer) echo -xregs=frameptr ;;
-fPIC) echo -KPIC -xcode=pic32 ;;
-W*,*) echo $flag ;;
@ -4856,8 +4892,8 @@ probe_cc(){
_type=suncc
_ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
_DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
_DEPFLAGS='-xM1 -xc99'
_ldflags='-std=c99'
_DEPFLAGS='-xM1 -xc11'
_ldflags='-std=c11'
_cflags_speed='-O5'
_cflags_size='-O5 -xspace'
_flags_filter=suncc_flags
@ -5423,6 +5459,9 @@ elif enabled riscv; then
if test_cpp_condition stddef.h "__riscv_zbb"; then
enable fast_clz
fi
if test_cpp_condition stddef.h "__riscv_zfhmin"; then
enable fast_float16
fi
elif enabled sparc; then
@ -5483,21 +5522,20 @@ if test "$?" != 0; then
die "C compiler test failed."
fi
add_cppflags -D_ISOC99_SOURCE
add_cppflags -D_ISOC11_SOURCE
add_cxxflags -D__STDC_CONSTANT_MACROS
check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
# some compilers silently accept -std=c11, so we also need to check that the
# version macro is defined properly
test_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L" &&
add_cflags -std=c11 ||
check_cflags -std=c99
add_cflags -std=c11 || die "Compiler lacks C11 support"
check_cppflags -D_FILE_OFFSET_BITS=64
check_cppflags -D_LARGEFILE_SOURCE
add_host_cppflags -D_ISOC99_SOURCE
check_host_cflags -std=c99
add_host_cppflags -D_ISOC11_SOURCE
check_host_cflags -std=c11
check_host_cflags -Wall
check_host_cflags $host_cflags_speed
@ -5598,11 +5636,12 @@ case $target_os in
;;
netbsd)
disable symver
enable section_data_rel_ro
oss_indev_extralibs="-lossaudio"
oss_outdev_extralibs="-lossaudio"
enabled gcc || check_ldflags -Wl,-zmuldefs
;;
openbsd|bitrig)
openbsd)
disable symver
enable section_data_rel_ro
striptype=""
@ -5616,6 +5655,7 @@ case $target_os in
disable symver
;;
freebsd)
enable section_data_rel_ro
;;
bsd/os)
add_extralibs -lpoll -lgnugetopt
@ -5993,11 +6033,7 @@ extern_prefix=${sym%%ff_extern*}
! disabled inline_asm && check_inline_asm inline_asm '"" ::'
for restrict_keyword in restrict __restrict__ __restrict ""; do
test_code cc "" "char * $restrict_keyword p" && break
done
check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
check_cc pragma_deprecated "" '_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
# The global variable ensures the bits appear unchanged in the object file.
test_cc <<EOF || die "endian test failed"
@ -6058,7 +6094,26 @@ check_inline_asm inline_asm_nonlocal_labels '"Label:\n"'
if enabled aarch64; then
as_arch_level="armv8-a"
check_as as_arch_directive ".arch $as_arch_level"
enabled as_arch_directive && check_arch_level armv8.2-a
if enabled as_arch_directive; then
# Check for higher .arch levels. We only need armv8.2-a in order to
# enable the extensions we want below - we primarily want to control
# them via .arch_extension. However:
#
# Clang before version 17 (Xcode versions up to and including 15.0)
# didn't support controlling the dotprod/i8mm extensions via
# .arch_extension; thus try to enable them via the .arch level as well.
for level in armv8.2-a armv8.4-a armv8.6-a; do
check_arch_level $level
done
# Clang before version 17 (Xcode versions up to and including 15.0)
# also had a bug (https://github.com/llvm/llvm-project/issues/32220)
# causing a plain ".arch <level>" to not have any effect unless it
# had an extra "+<feature>" included - but it was activated on the next
# ".arch_extension" directive. Check if we can include "+crc" as dummy
# feature to make the .arch directive behave as expected and take
# effect right away.
check_arch_level "${as_arch_level}+crc"
fi
enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
# internal assembler in clang 3.3 does not support this instruction
@ -6225,6 +6280,7 @@ elif enabled ppc; then
elif enabled riscv; then
enabled rv && check_inline_asm rv '".option arch, +zbb\nrev8 t0, t1"'
enabled rvv && check_inline_asm rvv '".option arch, +v\nvsetivli zero, 0, e8, m1, ta, ma"'
elif enabled x86; then
@ -6370,16 +6426,26 @@ if enabled float16; then
fi
case "$custom_allocator" in
"")
;;
jemalloc)
# jemalloc by default does not use a prefix
require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
test -n "$malloc_prefix" ||
malloc_prefix=$($pkg_config --variable=jemalloc_prefix $pkg_config_flags jemalloc 2>/dev/null)
require_pkg_config custom_allocator jemalloc jemalloc/jemalloc.h ${malloc_prefix}malloc
;;
tcmalloc)
require_pkg_config libtcmalloc libtcmalloc gperftools/tcmalloc.h tc_malloc
require_pkg_config custom_allocator libtcmalloc gperftools/tcmalloc.h tc_malloc
malloc_prefix=tc_
;;
*)
require_pkg_config custom_allocator "$custom_allocator" stdlib.h malloc
;;
esac
if test -n "$custom_allocator"; then
add_extralibs "$custom_allocator_extralibs"
fi
check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
check_func ${malloc_prefix}memalign && enable memalign
check_func ${malloc_prefix}posix_memalign && enable posix_memalign
@ -6455,13 +6521,12 @@ check_headers io.h
enabled libdrm &&
check_headers linux/dma-buf.h
check_headers asm/hwcap.h
check_headers linux/perf_event.h
check_headers libcrystalhd/libcrystalhd_if.h
check_headers malloc.h
check_headers mftransform.h
check_headers net/udplite.h
check_headers poll.h
check_headers pthread_np.h
check_headers sys/param.h
check_headers sys/resource.h
check_headers sys/select.h
@ -6471,6 +6536,7 @@ check_headers termios.h
check_headers unistd.h
check_headers valgrind/valgrind.h
check_func_headers VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox
check_func_headers VideoToolbox/VideoToolbox.h VTPixelTransferSessionCreate -framework VideoToolbox
check_func_headers VideoToolbox/VideoToolbox.h VTPixelRotationSessionCreate -framework VideoToolbox
check_headers windows.h
check_headers asm/types.h
@ -6548,6 +6614,8 @@ check_type "windows.h dxgi1_2.h" "IDXGIOutput1"
check_type "windows.h dxgi1_5.h" "IDXGIOutput5"
check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
check_type "windows.h d3d11.h" "ID3D11VideoContext"
check_type "windows.h d3d12.h" "ID3D12Device"
check_type "windows.h d3d12video.h" "ID3D12VideoDecoder"
check_type "windows.h" "DPI_AWARENESS_CONTEXT" -D_WIN32_WINNT=0x0A00
check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat
@ -6627,6 +6695,12 @@ if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
if enabled pthreads; then
check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
check_func pthread_cancel $pthreads_extralibs
hdrs=pthread.h
if enabled pthread_np_h; then
hdrs="$hdrs pthread_np.h"
fi
check_lib pthread_set_name_np "$hdrs" pthread_set_name_np -lpthread
check_lib pthread_setname_np "$hdrs" pthread_setname_np -lpthread
fi
fi
@ -6681,7 +6755,7 @@ enabled libaom && require_pkg_config libaom "aom >= 1.0.0" aom/aom_co
enabled libaribb24 && { check_pkg_config libaribb24 "aribb24 > 1.0.3" "aribb24/aribb24.h" arib_instance_new ||
{ enabled gpl && require_pkg_config libaribb24 aribb24 "aribb24/aribb24.h" arib_instance_new; } ||
die "ERROR: libaribb24 requires version higher than 1.0.3 or --enable-gpl."; }
enabled libaribcaption && require_pkg_config libaribcaption "libaribcaption >= 0.1.0" "aribcaption/aribcaption.h" aribcc_context_alloc
enabled libaribcaption && require_pkg_config libaribcaption "libaribcaption >= 1.1.1" "aribcaption/aribcaption.h" aribcc_context_alloc
enabled lv2 && require_pkg_config lv2 lilv-0 "lilv/lilv.h" lilv_world_new
enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
enabled libass && require_pkg_config libass "libass >= 0.11.0" ass/ass.h ass_library_init
@ -6695,7 +6769,9 @@ enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create -lc
enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.5.0" "dav1d/dav1d.h" dav1d_version
enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open
enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
enabled libdrm && check_pkg_config libdrm libdrm xf86drm.h drmGetVersion
enabled libdvdnav && require_pkg_config libdvdnav "dvdnav >= 6.1.1" dvdnav/dvdnav.h dvdnav_open2
enabled libdvdread && require_pkg_config libdvdread "dvdread >= 6.1.2" dvdread/dvd_reader.h DVDOpen2
enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
{ require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
warn "using libfdk without pkg-config"; } }
@ -6707,11 +6783,11 @@ enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.
enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
enabled libharfbuzz && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create
enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
-lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
-lglslang -lMachineIndependent -lGenericCodeGen \
-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
-lglslang -lOSDependent -lHLSL -lOGLCompiler \
-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; }
-lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ; }
enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
@ -6721,8 +6797,8 @@ enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -li
enabled libjxl && require_pkg_config libjxl "libjxl >= 0.7.0" jxl/decode.h JxlDecoderVersion &&
require_pkg_config libjxl_threads "libjxl_threads >= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
enabled libklvanc && require libklvanc libklvanc/vanc.h klvanc_context_create -lklvanc
enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
enabled liblensfun && require_pkg_config liblensfun lensfun lensfun.h lf_db_new
enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 2.0.0" kvazaar.h kvz_api_get
enabled liblensfun && require_pkg_config liblensfun lensfun lensfun.h lf_db_create
if enabled libmfx && enabled libvpl; then
die "ERROR: can not use libmfx and libvpl together"
@ -6742,14 +6818,14 @@ elif enabled libmfx; then
{ require libmfx "mfxvideo.h mfxdefs.h" MFXInit "-llibmfx $advapi32_extralibs" &&
{ test_cpp_condition mfxdefs.h "MFX_VERSION >= 1028 && MFX_VERSION < 2000" || die "ERROR: libmfx version must be >= 1.28 and < 2.0"; } &&
warn "using libmfx without pkg-config"; } } &&
warn "build FFmpeg against libmfx 1.x, obsolete features of libmfx such as OPAQUE memory,\n"\
"multi-frame encode, user plugins and LA_EXT rate control mode are enabled"
warn "libmfx is deprecated. Please run configure with --enable-libvpl to use libvpl instead."
elif enabled libvpl; then
# Consider pkg-config only. The name of libmfx is still passed to check_pkg_config function for --enable-libvpl option
# because QSV has dependency on libmfx, we can use the same dependency if using libmfx in this check. The package name
# is extracted from "vpl >= 2.6"
check_pkg_config libmfx "vpl >= 2.6" "mfxvideo.h mfxdispatcher.h" MFXLoad || \
die "ERROR: libvpl >= 2.6 not found"
add_cflags -DMFX_DEPRECATED_OFF
fi
if enabled libmfx; then
@ -6769,7 +6845,7 @@ enabled libopencv && { check_headers opencv2/core/core_c.h &&
{ check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
enabled libopenh264 && require_pkg_config libopenh264 "openh264 >= 1.3.0" wels/codec_api.h WelsGetCodecVersion
enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
{ require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
@ -6786,10 +6862,12 @@ enabled libopus && {
}
enabled libplacebo && require_pkg_config libplacebo "libplacebo >= 4.192.0" libplacebo/vulkan.h pl_vulkan_create
enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
enabled libqrencode && require_pkg_config libqrencode libqrencode qrencode.h QRcode_encodeString
enabled libquirc && require libquirc quirc.h quirc_decode -lquirc
enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection
enabled librav1e && require_pkg_config librav1e "rav1e >= 0.5.0" rav1e.h rav1e_context_new
enabled librist && require_pkg_config librist "librist >= 0.2.7" librist/librist.h rist_receiver_create
enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_new_from_data
enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
enabled libshaderc && require_pkg_config spirv_compiler "shaderc >= 2019.1" shaderc/shaderc.h shaderc_compiler_initialize
@ -6852,6 +6930,8 @@ enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get
require_cpp_condition libx265 x265.h "X265_BUILD >= 89"
enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get
enabled libxevd && require_pkg_config libxevd "xevd >= 0.4.1" "xevd.h" xevd_decode
enabled libxeve && require_pkg_config libxeve "xeve >= 0.4.3" "xeve.h" xeve_encode
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
enabled libzimg && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version
enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h zmq_ctx_new
@ -7048,9 +7128,8 @@ fi
check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
# d3d11va requires linking directly to dxgi and d3d11 if not building for
# the desktop api partition
test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
# check if building for desktop or uwp
test_cpp <<EOF && enable uwp
#ifdef WINAPI_FAMILY
#include <winapifamily.h>
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
@ -7063,23 +7142,17 @@ test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
#endif
EOF
# vaapi_win32 requires linking directly to dxgi if not building for
# the desktop api partition
test_cpp <<EOF && enable uwp && vaapi_win32_extralibs="-ldxgi"
#ifdef WINAPI_FAMILY
#include <winapifamily.h>
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#error desktop, not uwp
#else
// WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP
#endif
#else
#error no family set
#endif
EOF
mediafoundation_extralibs="-lmfuuid -lole32 -lstrmiids"
# mediafoundation requires linking directly to mfplat if building for uwp target
enabled uwp && mediafoundation_extralibs="-lmfplat -lmfuuid -lole32 -lstrmiids" || mediafoundation_extralibs="-lmfuuid -lole32 -lstrmiids"
if enabled uwp; then
# In UWP mode, we can't use LoadLibrary+GetProcAddress to conditionally
# try to load these APIs at runtime, like we do in regular desktop mode -
# therefore, we need to link directly against these APIs.
d3d11va_extralibs="-ldxgi -ld3d11"
d3d12va_extralibs="-ldxgi -ld3d12"
vaapi_win32_extralibs="-ldxgi"
mediafoundation_extralibs="-lmfplat $mediafoundation_extralibs"
fi
enabled libdrm &&
check_pkg_config libdrm_getfb2 libdrm "xf86drmMode.h" drmModeGetFB2
@ -7142,21 +7215,26 @@ if enabled_all opencl d3d11va ; then
enable opencl_d3d11
fi
if enabled_all opencl videotoolbox ; then
check_func_headers OpenCL/cl_gl_ext.h clCreateImageFromIOSurfaceWithPropertiesAPPLE -framework VideoToolbox -framework OpenCL &&
enable opencl_videotoolbox
fi
enabled vdpau &&
check_cpp_condition vdpau vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP"
enabled vdpau &&
check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd && \
warn "CrystalHD support is deprecated and will be removed, please contact the developers if you are interested" \
"in maintaining it."
if enabled vulkan; then
check_pkg_config_header_only vulkan "vulkan >= 1.3.255" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||
check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 255)"
fi
if disabled vulkan; then
disable libglslang libshaderc spirv_compiler
fi
if enabled x86; then
case $target_os in
mingw32*|mingw64*|win32|win64|linux|cygwin*)
@ -7258,7 +7336,6 @@ void (^block)(void);
EOF
# add some linker flags
check_ldflags -Wl,--warn-common
check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
@ -7335,6 +7412,16 @@ if [ -n "$lto" ]; then
check_cflags $lto
check_ldflags $lto $cpuflags
disable inline_asm_direct_symbol_refs
if test "$cc_type" = "clang"; then
# Clang's LTO fails on Windows, when there are references outside
# of inline assembly to nonlocal labels defined within inline assembly,
# see https://github.com/llvm/llvm-project/issues/76046.
case $target_os in
mingw32|win32)
disable inline_asm_nonlocal_labels
;;
esac
fi
fi
enabled ftrapv && check_cflags -ftrapv
@ -7452,17 +7539,6 @@ elif enabled_any msvc icl; then
fi
# msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
check_cpp_condition log2 crtversion.h "_VC_CRT_MAJOR_VERSION >= 12"
# The CRT headers contain __declspec(restrict) in a few places, but if redefining
# restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict)
# (as it ends up if the restrict redefine is done before including stdlib.h), while
# MSVC 2013 and newer can handle it fine.
# If this declspec fails, force including stdlib.h before the restrict redefinition
# happens in config.h.
if [ $restrict_keyword != restrict ]; then
test_cc <<EOF || add_cflags -FIstdlib.h
__declspec($restrict_keyword) void *foo(int);
EOF
fi
# the new SSA optimzer in VS2015 U3 is mis-optimizing some parts of the code
# Issue has been fixed in MSVC v19.00.24218.
test_cpp_condition windows.h "_MSC_FULL_VER >= 190024218" ||
@ -7505,6 +7581,12 @@ check_deps $CONFIG_LIST \
enabled threads && ! enabled pthreads && ! enabled atomics_native && die "non pthread threading without atomics not supported, try adding --enable-pthreads or --cpu=i486 or higher if you are on x86"
enabled threads || warn \
"Threading support was disabled or is not available on the target platform." \
"This means that not only is this build not multi-threaded, but also" \
"that the libraries from this build MUST NOT be used in a multi-threaded"\
"environment."
case $target_os in
haiku)
disable memalign
@ -7605,10 +7687,13 @@ enabled cover_rect_filter && prepend avfilter_deps "avformat avcodec"
enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample"
enabled elbg_filter && prepend avfilter_deps "avcodec"
enabled find_rect_filter && prepend avfilter_deps "avformat avcodec"
enabled fsync_filter && prepend avfilter_deps "avformat"
enabled mcdeint_filter && prepend avfilter_deps "avcodec"
enabled movie_filter && prepend avfilter_deps "avformat avcodec"
enabled pan_filter && prepend avfilter_deps "swresample"
enabled pp_filter && prepend avfilter_deps "postproc"
enabled qrencode_filter && prepend_avfilter_deps "swscale"
enabled qrencodesrc_filter && prepend_avfilter_deps "swscale"
enabled removelogo_filter && prepend avfilter_deps "avformat avcodec swscale"
enabled sab_filter && prepend avfilter_deps "swscale"
enabled scale_filter && prepend avfilter_deps "swscale"
@ -7971,6 +8056,7 @@ SAMPLES:=${samples:-\$(FATE_SAMPLES)}
NOREDZONE_FLAGS=$noredzone_flags
LIBFUZZER_PATH=$libfuzzer_path
IGNORE_TESTS=$ignore_tests
VERSION_TRACKING=$version_tracking
EOF
map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> ffbuild/config.mak' $LIBRARY_LIST
@ -7985,17 +8071,15 @@ cat > $TMPH <<EOF
#define FFMPEG_CONFIG_H
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
#define FFMPEG_LICENSE "$(c_escape $license)"
#define CONFIG_THIS_YEAR 2023
#define CONFIG_THIS_YEAR 2024
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
#define OS_NAME $target_os
#define av_restrict $restrict_keyword
#define EXTERN_PREFIX "${extern_prefix}"
#define EXTERN_ASM ${extern_prefix}
#define BUILDSUF "$build_suffix"
#define SLIBSUF "$SLIBSUF"
#define HAVE_MMX2 HAVE_MMXEXT
#define SWS_MAX_FILTER_SIZE $sws_max_filter_size
EOF
@ -8104,9 +8188,9 @@ print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_
print_enabled_components libavcodec/codec_list.c FFCodec codec_list $CODEC_LIST
print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
print_enabled_components libavcodec/bsf_list.c FFBitStreamFilter bitstream_filters $BSF_LIST
print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $DEMUXER_LIST
print_enabled_components libavformat/demuxer_list.c FFInputFormat demuxer_list $DEMUXER_LIST
print_enabled_components libavformat/muxer_list.c FFOutputFormat muxer_list $MUXER_LIST
print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list $INDEV_LIST
print_enabled_components libavdevice/indev_list.c FFInputFormat indev_list $INDEV_LIST
print_enabled_components libavdevice/outdev_list.c FFOutputFormat outdev_list $OUTDEV_LIST
print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST

View File

@ -1,142 +1,273 @@
The last version increases of all libraries were on 2023-02-09
The last version increases of all libraries were on 2024-03-07
API changes, most recent first:
2023-09-28 - xxxxxxxxxx - lavu 58.27.100 - pixfmt.h
2024-03-xx - xxxxxxxxxx - lavu 59.2.100 - channel_layout.h
Add AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL.
2024-03-08 - xxxxxxxxxx - lavc 61.1.100 - avcodec.h
Add AVCodecContext.[nb_]side_data_prefer_packet.
2024-03-08 - xxxxxxxxxx - lavu 59.1.100 - opt.h
Add AV_OPT_TYPE_FLAG_ARRAY and AVOptionArrayDef.
2024-03-08 - xxxxxxxxxx - lavc 61.0.100 - vdpau.h
Deprecate av_vdpau_alloc_context(), av_alloc_vdpaucontext(),
av_vdpau_hwaccel_get_render2() and av_vdpau_hwaccel_set_render2().
The former are superseded by av_vdpau_bind_context(), the latter
are unneeded as the relevant field is public and can be accessed directly.
2024-03-06 - xxxxxxxxxx - lavf 60.25.100 - avformat.h
Deprecate av_fmt_ctx_get_duration_estimation_method().
The relevant field is public and needs no getter to access.
2024-03-05 - xxxxxxxxxx - lavf 60.24.100 - avformat.h
Add avformat_stream_group_name().
2024-02-28 - xxxxxxxxxx - swr 4.14.100 - swresample.h
swr_convert() now accepts arrays of const pointers (to input and output).
2024-02-28 - xxxxxxxxxx - lavu 58.40.100 - timestamp.h
av_ts_make_time_string() now accepts a pointer to const AVRational.
2024-02-28 - xxxxxxxxxx - lavf 60.23.100 - avio.h
avio_print_string_array() now accepts an array of const pointers.
2024-02-26 - xxxxxxxxxx - lavf 60.22.101 - avformat.h
AV_DISPOSITION_DEPENDENT may now also be used for video streams
intended to be merged with other video streams for presentation.
2024-02-26 - xxxxxxxxxx - lavf 60.22.100 - avformat.h
Add AVStreamGroupTileGrid
Add AV_STREAM_GROUP_PARAMS_TILE_GRID
Add AVStreamGroup.params.tile_grid
2024-02-21 - xxxxxxxxxx - lavc 60.40.100 - avcodec.h
Deprecate AV_INPUT_BUFFER_MIN_SIZE without replacement.
2024-02-16 - xxxxxxxxxx - lavu 58.39.100 - pixfmt.h
Add AV_VIDEO_MAX_PLANES
2024-02-13 - xxxxxxxxxx - lavf 60.21.100 - avformat.h
Add AVStreamGroup.disposition.
2024-02-xx - xxxxxxxxxx - lavu 58.38.100 - channel_layout.h
Add av_channel_layout_retype().
2024-02-xx - xxxxxxxxxx - lavu 58.37.100 - channel_layout.h
Add av_channel_layout_custom_init().
2024-02-04 - xxxxxxxxxx - lavc 60.39.100 - packet.h
Add AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT.
2023-11-xx - xxxxxxxxxx - lavfi 9.16.100 - buffersink.h buffersrc.h
Add av_buffersink_get_colorspace and av_buffersink_get_color_range.
Add AVBufferSrcParameters.color_space and AVBufferSrcParameters.color_range.
2023-11-xx - xxxxxxxxxx - lavfi 9.15.100 - avfilter.h
Add AVFilterLink.colorspace, AVFilterLink.color_range
2023-12-xx - xxxxxxxxxx - lavu 58.36.100 - pixfmt.h hwcontext.h hwcontext_d3d12va.h
Add AV_HWDEVICE_TYPE_D3D12VA and AV_PIX_FMT_D3D12.
Add AVD3D12VADeviceContext, AVD3D12VASyncContext, AVD3D12VAFrame and
AVD3D12VAFramesContext.
2023-12-18 - 74279227dd2 - lavc 60.36.100 - packet.h
Add AV_PKT_DATA_IAMF_MIX_GAIN_PARAM, AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM
and AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM.
2023-12-18 - xxxxxxxxxxx - lavc 60.19.100 - avformat.h
Add AVStreamGroup struct.
Add AVFormatContext.stream_groups and AVFormatContext.nb_stream_groups
Add avformat_stream_group_create(), avformat_stream_group_add_stream(),
and av_stream_group_get_class().
Add enum AVStreamGroupParamsType with values AV_STREAM_GROUP_PARAMS_NONE,
AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT and
AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION.
2023-12-18 - xxxxxxxxxxx - lavu 58.35.100 - iamf.h
Add a new API to support Immersive Audio Model and Formats.
2023-12-xx - xxxxxxxxxxx - lavu 58.33.100 - imgutils.h
Add av_image_fill_color().
2023-11-08 - b82957a66a7 - lavu 58.32.100 - channel_layout.h
Add AV_CH_LAYOUT_7POINT2POINT3 and AV_CHANNEL_LAYOUT_7POINT2POINT3.
Add AV_CH_LAYOUT_9POINT1POINT4_BACK and AV_CHANNEL_LAYOUT_9POINT1POINT4_BACK.
2023-10-31 - 57c16323f26 - lavu 58.31.100 - pixdesc.h
Add AV_PIX_FMT_FLAG_XYZ.
-------- 8< --------- FFmpeg 6.1 was cut here -------- 8< ---------
2023-10-27 - 52a97642604 - lavu 58.28.100 - channel_layout.h
Add AV_CH_LAYOUT_3POINT1POINT2 and AV_CHANNEL_LAYOUT_3POINT1POINT2.
Add AV_CH_LAYOUT_5POINT1POINT2_BACK and AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK.
Add AV_CH_LAYOUT_5POINT1POINT4_BACK and AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK.
Add AV_CH_LAYOUT_7POINT1POINT2 and AV_CHANNEL_LAYOUT_7POINT1POINT2.
Add AV_CH_LAYOUT_7POINT1POINT4_BACK and AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK.
2023-10-06 - 804be7f9e3c - lavc 60.30.101 - avcodec.h
AVCodecContext.coded_side_data may now be used during decoding, to be set
by user before calling avcodec_open2() for initialization.
2023-10-06 - 5432d2aacad - lavc 60.15.100 - avformat.h
Deprecate AVFormatContext.{nb_,}side_data, av_stream_add_side_data(),
av_stream_new_side_data(), and av_stream_get_side_data(). Side data fields
from AVFormatContext.codecpar should be used from now on.
2023-10-06 - 21d7cc6fa9a - lavc 60.30.100 - codec_par.h
Added {nb_,}coded_side_data to AVCodecParameters.
The AVCodecParameters helpers will copy it to and from its AVCodecContext
namesake.
2023-10-06 - 74279227dd2 - lavc 60.29.100 - packet.h
Added av_packet_side_data_new(), av_packet_side_data_add(),
av_packet_side_data_get(), av_packet_side_data_remove, and
av_packet_side_data_free().
2023-10-03 - ea14e8bc302 - lavc 60.28.100 - codec_par.h defs.h
Move the definition of enum AVFieldOrder from codec_par.h to defs.h.
2023-10-03 - dd48e49d547 - lavf 60.14.100 - avformat.h
Deprecate AVFMT_ALLOW_FLUSH without replacement. Users can always
flush any muxer by sending a NULL packet.
2023-09-28 - 8e1ef7c38f6 - lavu 58.27.100 - pixfmt.h
Add AV_PIX_FMT_GBRAP14BE, AV_PIX_FMT_GBRAP14LE pixel formats.
2023-09-28 - xxxxxxxxxx - lavu 58.26.100 - hwcontext_cuda.h
2023-09-28 - 05f8b2ca0f7 - lavu 58.26.100 - hwcontext_cuda.h
Add AV_CUDA_USE_CURRENT_CONTEXT.
2023-09-19 - xxxxxxxxxx - lavu 58.25.100 - avutil.h
2023-09-19 - ba9cd06c763 - lavu 58.25.100 - avutil.h
Make AV_TIME_BASE_Q compatible with C++.
2023-09-xx - xxxxxxxxxx - lavf 60 - avformat.h
2023-09-18 - 85e075587dc - lavf 60 - avformat.h
Deprecate AVFMT_FLAG_SHORTEST without replacement.
2023-09-07 - xxxxxxxxxx - lavu 58.24.100 - imgutils.h
2023-09-07 - 423b6a7e493 - lavu 58.24.100 - imgutils.h
Add av_image_copy2(), a wrapper around the av_image_copy()
to overcome limitations of automatic conversions.
2023-09-07 - xxxxxxxxxx - lavu 58.23.100 - fifo.h
2023-09-07 - 5094d1f429e - lavu 58.23.100 - fifo.h
Constify the AVFifo pointees in av_fifo_peek() and av_fifo_peek_to_cb().
2023-09-07 - xxxxxxxxxx - lavu 58.22.100 - audio_fifo.h
2023-09-07 - fa4bf5793a0 - lavu 58.22.100 - audio_fifo.h
Constify some pointees in av_audio_fifo_write(), av_audio_fifo_read(),
av_audio_fifo_peek() and av_audio_fifo_peek_at().
2023-09-07 - xxxxxxxxxx - lavu 58.21.100 - samplefmt.h
2023-09-07 - 9bf31f60960 - lavu 58.21.100 - samplefmt.h
Constify some pointees in av_samples_copy() and av_samples_set_silence().
2023-09-07 - xxxxxxxxxx - lavu 58.20.100 - imgutils.h
2023-09-07 - 41285890e03 - lavu 58.20.100 - imgutils.h
Constify some pointees in av_image_copy(), av_image_copy_uc_from() and
av_image_fill_black().
2023-09-07 - xxxxxxxxxx - lavf 60.12.100 - avio.h
2023-09-07 - 2a68d945cd7 - lavf 60.12.100 - avio.h
Constify the buffer pointees in the write_packet and write_data_type
callbacks of AVIOContext on the next major bump.
2023-09-07 - xxxxxxxxxx - lavc 60.26.100 - defs.h
2023-09-07 - 8238bc0b5e3 - lavc 60.26.100 - defs.h
Add AV_PROFILE_* and AV_LEVEL_* replacements in defs.h for the
defines from avcodec.h. The latter are deprecated.
2023-09-06 - xxxxxxxxxx - lavc 60.25.101 - avcodec.h
2023-09-06 - b6627a57f41 - lavc 60.25.101 - avcodec.h
AVCodecContext.rc_buffer_size may now be set by decoders.
2023-09-02 - xxxxxxxxxx - lavu 58.19.100 - executor.h
2023-09-02 - 25ecc94d58f - lavu 58.19.100 - executor.h
Add AVExecutor API
2023-09-xx - xxxxxxxxxx - lavc 60.25.100 - avfft.h
2023-09-01 - 139e54911c8 - lavc 60.25.100 - avfft.h
The entire header will be deprecated and removed in two major bumps.
For a replacement to av_dct, av_rdft, av_fft and av_mdct, use
the new API from libavutil/tx.h.
2023-07-xx - xxxxxxxxxx - lavu 58.18.100 - tx.h
2023-09-01 - 11e22730e1e - lavu 58.18.100 - tx.h
Add AV_TX_REAL_TO_REAL and AV_TX_REAL_TO_IMAGINARY
2023-08-18 - xxxxxxxxxx - lavu 58.17.100 - channel_layout.h
2023-08-18 - ff094f5ebbd - lavu 58.17.100 - channel_layout.h
All AV_CHANNEL_LAYOUT_* macros are now compatible with C++ 17 and older.
2023-08-08 - xxxxxxxxxx - lavu 58.15.100 - video_hint.h
2023-08-08 - 5012b4ab4ca - lavu 58.15.100 - video_hint.h
Add AVVideoHint API.
2023-07-xx - xxxxxxxxxx - lavc 60 - avcodec.h
2023-08-08 - 5012b4ab4ca - lavc 60 - avcodec.h
Deprecate AV_CODEC_FLAG_DROPCHANGED without replacement.
2023-07-05 - xxxxxxxxxx - lavu 58.14.100 - random_seed.h
2023-07-05 - d694c25b44c - lavu 58.14.100 - random_seed.h
Add av_random_bytes()
2023-05-29 - xxxxxxxxxx - lavc 60.16.100 - avcodec.h codec_id.h
2023-05-29 - 637afea88ed - lavc 60.16.100 - avcodec.h codec_id.h
Add AV_CODEC_ID_EVC, FF_PROFILE_EVC_BASELINE, and FF_PROFILE_EVC_MAIN.
2023-05-29 - xxxxxxxxxx - lavu 58.12.100 - mathematics.h
2023-05-29 - 75918016ab1 - lavu 58.12.100 - mathematics.h
Add av_bessel_i0()
2023-05-xx - xxxxxxxxxx - lavc 60.15.100 - avcodec.h
2023-05-29 - f3795e18574 - lavc 60.15.100 - avcodec.h
Add AVHWAccel.update_thread_context, AVHWAccel.free_frame_priv,
AVHWAccel.flush.
2023-05-xx - xxxxxxxxxx - lavu 58.11.100 - hwcontext_vulkan.h
2023-05-29 - db1d0227812 - lavu 58.11.100 - hwcontext_vulkan.h
Add AVVulkanDeviceContext.lock_queue, AVVulkanDeviceContext.unlock_queue,
AVVulkanFramesContext.format, AVVulkanFramesContext.lock_frame,
AVVulkanFramesContext.unlock_frame, AVVkFrame.queue_family.
Deprecate AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY (use multiplane images instead).
2023-05-xx - xxxxxxxxxx - lavu 58.10.100 - pixfmt.h
2023-05-29 - bef86ba86cc - lavu 58.10.100 - pixfmt.h
Add AV_PIX_FMT_P212BE, AV_PIX_FMT_P212LE, AV_PIX_FMT_P412BE,
AV_PIX_FMT_P412LE.
2023-05-xx - xxxxxxxxxx - lavu 58.8.100 - frame.h
2023-05-18 - 01d444c077e - lavu 58.8.100 - frame.h
Add av_frame_replace().
2023-05-xx - xxxxxxxxxx - lavu 58 - frame.h
2023-05-18 - 63767b79a57 - lavu 58 - frame.h
Deprecate AVFrame.palette_has_changed without replacement.
2023-05-xx - xxxxxxxxxx - lavc 60 - avcodec.h
2023-05-15 - 7d1d61cc5f5 - lavc 60 - avcodec.h
Depreate AVCodecContext.ticks_per_frame in favor of
AVCodecContext.framerate (encoding) and
AV_CODEC_PROP_FIELDS (decoding).
2023-05-xx - xxxxxxxxxx - lavc 60.12.100 - codec_desc.h
2023-05-15 - 70433abf7fb - lavc 60.12.100 - codec_desc.h
Add AV_CODEC_PROP_FIELDS.
2023-05-xx - xxxxxxxxxx - lavc 60 - codec.h
2023-05-15 - 8b20d0dcb5c - lavc 60 - codec.h
Depreate AV_CODEC_CAP_SUBFRAMES without replacement.
2023-05-xx - xxxxxxxxxx - lavc 60.11.100 - codec_par.h
2023-05-07 - c2ae8e30b7f - lavc 60.11.100 - codec_par.h
Add AVCodecParameters.framerate.
2023-05-04 - xxxxxxxxxx - lavu 58.7.100 - frame.h
2023-05-04 - 0fc9c1f6828 - lavu 58.7.100 - frame.h
Deprecate AVFrame.interlaced_frame, AVFrame.top_field_first, and
AVFrame.key_frame.
Add AV_FRAME_FLAG_INTERLACED, AV_FRAME_FLAG_TOP_FIELD_FIRST, and
AV_FRAME_FLAG_KEY flags as replacement.
2023-04-10 - xxxxxxxxxx - lavu 58.6.100 - frame.h
2023-04-10 - 4eaaa38d3df - lavu 58.6.100 - frame.h
av_frame_get_plane_buffer() now accepts const AVFrame*.
2023-04-04 - xxxxxxxxxx - lavu 58.6.100 - hdr_dynamic_metadata.h
2023-04-04 - 61b27b15fc9 - lavu 58.6.100 - hdr_dynamic_metadata.h
Add AV_HDR_PLUS_MAX_PAYLOAD_SIZE.
av_dynamic_hdr_plus_create_side_data() now accepts a user provided
buffer.
2023-03-xx - xxxxxxxxxx - lavfi 9.5.100 - avfilter.h
2023-03-24 - 632c3499319 - lavfi 9.5.100 - avfilter.h
Add AVFILTER_FLAG_HWDEVICE.
2023-03-21 - xxxxxxxxxx - lavu 58.5.100 - hdr_dynamic_metadata.h
2023-03-21 - 0a3ce5f7384 - lavu 58.5.100 - hdr_dynamic_metadata.h
Add av_dynamic_hdr_plus_from_t35() and av_dynamic_hdr_plus_to_t35()
functions to convert between raw T.35 payloads containing dynamic
HDR10+ metadata and their parsed representations as AVDynamicHDRPlus.
2023-03-17 - xxxxxxxxxx - lavu 58.4.100 - hdr_dynamic_vivid_metadata.h
2023-03-17 - 3be46ee7672 - lavu 58.4.100 - hdr_dynamic_vivid_metadata.h
Add two group of three spline params.
Deprecate previous define which only supports one group of params.
2023-03-02 - xxxxxxxxxx - lavc 60.6.100 - avcodec.h
2023-03-02 - 373ef1c4fae - lavc 60.6.100 - avcodec.h
Add FF_PROFILE_EAC3_DDP_ATMOS, FF_PROFILE_TRUEHD_ATMOS,
FF_PROFILE_DTS_HD_MA_X and FF_PROFILE_DTS_HD_MA_X_IMAX.
2023-02-25 - xxxxxxxxxx - lavc 60.5.100 - avcodec.h
2023-02-25 - f4593775436 - lavc 60.5.100 - avcodec.h
Add FF_PROFILE_HEVC_SCC.
-------- 8< --------- FFmpeg 6.0 was cut here -------- 8< ---------

View File

@ -199,6 +199,13 @@ Identical to @option{pass_types}, except the units in the given set
removed and all others passed through.
@end table
The types used by pass_types and remove_types correspond to NAL unit types
(nal_unit_type) in H.264, HEVC and H.266 (see Table 7-1 in the H.264
and HEVC specifications or Table 5 in the H.266 specification), to
marker values for JPEG (without 0xFF prefix) and to start codes without
start code prefix (i.e. the byte following the 0x000001) for MPEG-2.
For VP8 and VP9, every unit has type zero.
Extradata is unchanged by this transformation, but note that if the stream
contains inline parameter sets then the output may be unusable if they are
removed.
@ -213,6 +220,21 @@ To remove all AUDs, SEI and filler from an H.265 stream:
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=35|38-40' OUTPUT
@end example
To remove all user data from a MPEG-2 stream, including Closed Captions:
@example
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=178' OUTPUT
@end example
To remove all SEI from a H264 stream, including Closed Captions:
@example
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=6' OUTPUT
@end example
To remove all prefix and suffix SEI from a HEVC stream, including Closed Captions and dynamic HDR:
@example
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=39|40' OUTPUT
@end example
@section hapqa_extract
Extract Rgb or Alpha part of an HAPQA file, without recompression, in order to create an HAPQ or an HAPAlphaOnly file.
@ -528,10 +550,6 @@ metadata header from each subtitle packet.
See also the @ref{text2movsub} filter.
@section mp3decomp
Decompress non-standard compressed MP3 audio headers.
@section mpeg2_metadata
Modify metadata embedded in an MPEG-2 stream.
@ -882,6 +900,15 @@ The sample rate of stream packet belongs.
The AV_NOPTS_VALUE constant.
@end table
For example, to set PTS equal to DTS (not recommended if B-frames are involved):
@example
ffmpeg -i INPUT -c:a copy -bsf:a setts=pts=DTS out.mkv
@end example
@section showinfo
Log basic packet information. Mainly useful for testing, debugging,
and development.
@anchor{text2movsub}
@section text2movsub

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
@c man begin CODEC OPTIONS
libavcodec provides some generic global options, which can be set on
all the encoders and decoders. In addition each codec may support
all the encoders and decoders. In addition, each codec may support
so-called private options, which are specific for a given codec.
Sometimes, a global option may only affect a specific kind of codec,
@ -697,10 +697,13 @@ profiles are documented in the relevant encoder documentation.
@item level @var{integer} (@emph{encoding,audio,video})
Set the encoder level. This level depends on the specific codec, and
might correspond to the profile level. It is set by default to
@samp{unknown}.
Possible values:
@table @samp
@item unknown
@end table
@item lowres @var{integer} (@emph{decoding,audio,video})
@ -764,15 +767,9 @@ Set rate-distortion optimal quantization.
@item compression_level @var{integer} (@emph{encoding,audio,video})
@item bits_per_raw_sample @var{integer}
@item channel_layout @var{integer} (@emph{decoding/encoding,audio})
See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
for the required syntax.
Possible values:
@table @samp
@end table
@item request_channel_layout @var{integer} (@emph{decoding,audio})
Possible values:
@table @samp
@end table
@item rc_max_vbv_use @var{float} (@emph{encoding,video})
@item rc_min_vbv_use @var{float} (@emph{encoding,video})

View File

@ -26,7 +26,9 @@ The General Assembly is sovereign and legitimate for all its decisions regarding
The General Assembly is made up of active contributors.
Contributors are considered "active contributors" if they have pushed more than 20 patches in the last 36 months in the main FFmpeg repository, or if they have been voted in by the GA.
Contributors are considered "active contributors" if they have authored more than 20 patches in the last 36 months in the main FFmpeg repository, or if they have been voted in by the GA.
The list of active contributors is updated twice each year, on 1st January and 1st July, 0:00 UTC.
Additional members are added to the General Assembly through a vote after proposal by a member of the General Assembly. They are part of the GA for two years, after which they need a confirmation by the GA.

View File

@ -130,6 +130,30 @@ Set amount of frame threads to use during decoding. The default value is 0 (auto
@end table
@section libxevd
eXtra-fast Essential Video Decoder (XEVD) MPEG-5 EVC decoder wrapper.
This decoder requires the presence of the libxevd headers and library
during configuration. You need to explicitly configure the build with
@option{--enable-libxevd}.
The xevd project website is at @url{https://github.com/mpeg5/xevd}.
@subsection Options
The following options are supported by the libxevd wrapper.
The xevd-equivalent options or values are listed in parentheses for easy migration.
To get a more accurate and extensive documentation of the libxevd options,
invoke the command @code{xevd_app --help} or consult the libxevd documentation.
@table @option
@item threads (@emph{threads})
Force to use a specific number of threads
@end table
@section QSV Decoders
The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264, HEVC,
@ -391,7 +415,7 @@ Specifies the encoding scheme of input subtitle text.
@table @samp
@item auto
Automatically detect text encoding.
Automatically detect text encoding (default).
@item jis
8bit-char JIS encoding defined in ARIB STD B24.
This encoding used in Japan for ISDB captions.
@ -403,9 +427,6 @@ Latin character encoding defined in ABNT NBR 15606-1.
This encoding is used in South America for SBTVD / ISDB-Tb captions.
@end table
The default is @dfn{ass} as same as @dfn{libaribb24} decoder.
Some present players (e.g., @dfn{mpv}) expect ASS format for ARIB caption.
@item -font @var{font_name[,font_name2,...]}
Specify comma-separated list of font family names to be used for @dfn{bitmap}
or @dfn{ass} type subtitle rendering.
@ -427,12 +448,6 @@ If your player cannot handle AVSubtitles with multiple ASS rectangles properly,
set this option to @var{true} or define @env{ASS_SINGLE_RECT=1} to change
default behavior at compilation.
@item -replace_fullwidth_ascii @var{boolean}
Specify whether to replace MSZ (Middle Size, half width) fullwidth
alphanumerics with halfwidth alphanumerics.
The default is @var{true}.
@item -force_outline_text @var{boolean}
Specify whether always render outline text for all characters regardless of
the indication by charactor style.
@ -459,6 +474,28 @@ Specify whether to render replaced DRCS characters as Unicode characters.
The default is @var{true}.
@item -replace_msz_ascii @var{boolean}
Specify whether to replace MSZ (Middle Size; half width) fullwidth
alphanumerics with halfwidth alphanumerics.
The default is @var{true}.
@item -replace_msz_japanese @var{boolean}
Specify whether to replace some MSZ (Middle Size; half width) fullwidth
japanese special characters with halfwidth ones.
The default is @var{true}.
@item -replace_msz_glyph @var{boolean}
Specify whether to replace MSZ (Middle Size; half width) characters
with halfwidth glyphs if the fonts supports it.
This option works under FreeType or DirectWrite renderer
with Adobe-Japan1 compliant fonts.
e.g., IBM Plex Sans JP, Morisawa BIZ UDGothic, Morisawa BIZ UDMincho,
Yu Gothic, Yu Mincho, and Meiryo.
The default is @var{true}.
@item -canvas_size @var{image_size}
Specify the resolution of the canvas to render subtitles to; usually, this
should be frame size of input video.

View File

@ -285,6 +285,168 @@ This demuxer accepts the following option:
@end table
@section dvdvideo
DVD-Video demuxer, powered by libdvdnav and libdvdread.
Can directly ingest DVD titles, specifically sequential PGCs, into
a conversion pipeline. Menu assets, such as background video or audio,
can also be demuxed given the menu's coordinates (at best effort).
Seeking is not supported at this time.
Block devices (DVD drives), ISO files, and directory structures are accepted.
Activate with @code{-f dvdvideo} in front of one of these inputs.
This demuxer does NOT have decryption code of any kind. You are on your own
working with encrypted DVDs, and should not expect support on the matter.
Underlying playback is handled by libdvdnav, and structure parsing by libdvdread.
FFmpeg must be built with GPL library support available as well as the
configure switches @code{--enable-libdvdnav} and @code{--enable-libdvdread}.
You will need to provide either the desired "title number" or exact PGC/PG coordinates.
Many open-source DVD players and tools can aid in providing this information.
If not specified, the demuxer will default to title 1 which works for many discs.
However, due to the flexibility of the format, it is recommended to check manually.
There are many discs that are authored strangely or with invalid headers.
If the input is a real DVD drive, please note that there are some drives which may
silently fail on reading bad sectors from the disc, returning random bits instead
which is effectively corrupt data. This is especially prominent on aging or rotting discs.
A second pass and integrity checks would be needed to detect the corruption.
This is not an FFmpeg issue.
@subsection Background
DVD-Video is not a directly accessible, linear container format in the
traditional sense. Instead, it allows for complex and programmatic playback of
carefully muxed MPEG-PS streams that are stored in headerless VOB files.
To the end-user, these streams are known simply as "titles", but the actual
logical playback sequence is defined by one or more "PGCs", or Program Group Chains,
within the title. The PGC is in turn comprised of multiple "PGs", or Programs",
which are the actual video segments (and for a typical video feature, sequentially
ordered). The PGC structure, along with stream layout and metadata, are stored in
IFO files that need to be parsed. PGCs can be thought of as playlists in easier terms.
An actual DVD player relies on user GUI interaction via menus and an internal VM
to drive the direction of demuxing. Generally, the user would either navigate (via menus)
or automatically be redirected to the PGC of their choice. During this process and
the subsequent playback, the DVD player's internal VM also maintains a state and
executes instructions that can create jumps to different sectors during playback.
This is why libdvdnav is involved, as a linear read of the MPEG-PS blobs on the
disc (VOBs) is not enough to produce the right sequence in many cases.
There are many other DVD structures (a long subject) that will not be discussed here.
NAV packets, in particular, are handled by this demuxer to build accurate timing
but not emitted as a stream. For a good high-level understanding, refer to:
@url{https://code.videolan.org/videolan/libdvdnav/-/blob/master/doc/dvd_structures}
@subsection Options
This demuxer accepts the following options:
@table @option
@item title @var{int}
The title number to play. Must be set if @option{pgc} and @option{pg} are not set.
Not applicable to menus.
Default is 0 (auto), which currently only selects the first available title (title 1)
and notifies the user about the implications.
@item chapter_start @var{int}
The chapter, or PTT (part-of-title), number to start at. Not applicable to menus.
Default is 1.
@item chapter_end @var{int}
The chapter, or PTT (part-of-title), number to end at. Not applicable to menus.
Default is 0, which is a special value to signal end at the last possible chapter.
@item angle @var{int}
The video angle number, referring to what is essentially an additional
video stream that is composed from alternate frames interleaved in the VOBs.
Not applicable to menus.
Default is 1.
@item region @var{int}
The region code to use for playback. Some discs may use this to default playback
at a particular angle in different regions. This option will not affect the region code
of a real DVD drive, if used as an input. Not applicable to menus.
Default is 0, "world".
@item menu @var{bool}
Demux menu assets instead of navigating a title. Requires exact coordinates
of the menu (@option{menu_lu}, @option{menu_vts}, @option{pgc}, @option{pg}).
Default is false.
@item menu_lu @var{int}
The menu language to demux. In DVD, menus are grouped by language.
Default is 0, the first language unit.
@item menu_vts @var{int}
The VTS where the menu lives, or 0 if it is a VMG menu (root-level).
Default is 0, VMG menu.
@item pgc @var{int}
The entry PGC to start playback, in conjunction with @option{pg}.
Alternative to setting @option{title}.
Chapter markers are not supported at this time.
Must be explicitly set for menus.
Default is 0, automatically resolve from value of @option{title}.
@item pg @var{int}
The entry PG to start playback, in conjunction with @option{pgc}.
Alternative to setting @option{title}.
Chapter markers are not supported at this time.
Default is 0, automatically resolve from value of @option{title}, or
start from the beginning (PG 1) of the menu.
@item preindex @var{bool}
Enable this to have accurate chapter (PTT) markers and duration measurement,
which requires a slow second pass read in order to index the chapter marker
timestamps from NAV packets. This is non-ideal extra work for real optical drives.
It is recommended and faster to use this option with a backup of the DVD structure
stored on a hard drive. Not compatible with @option{pgc} and @option{pg}.
Not applicable to menus.
Default is 0, false.
@item trim @var{bool}
Skip padding cells (i.e. cells shorter than 1 second) from the beginning.
There exist many discs with filler segments at the beginning of the PGC,
often with junk data intended for controlling a real DVD player's
buffering speed and with no other material data value.
Not applicable to menus.
Default is 1, true.
@end table
@subsection Examples
@itemize
@item
Open title 3 from a given DVD structure:
@example
ffmpeg -f dvdvideo -title 3 -i <path to DVD> ...
@end example
@item
Open chapters 3-6 from title 1 from a given DVD structure:
@example
ffmpeg -f dvdvideo -chapter_start 3 -chapter_end 6 -title 1 -i <path to DVD> ...
@end example
@item
Open only chapter 5 from title 1 from a given DVD structure:
@example
ffmpeg -f dvdvideo -chapter_start 5 -chapter_end 5 -title 1 -i <path to DVD> ...
@end example
@item
Demux menu with language 1 from VTS 1, PGC 1, starting at PG 1:
@example
ffmpeg -f dvdvideo -menu 1 -menu_lu 1 -menu_vts 1 -pgc 1 -pg 1 -i <path to DVD> ...
@end example
@end itemize
@section ea
Electronic Arts Multimedia format demuxer.
@ -777,7 +939,7 @@ error or used to store a negative value for dts correction when treated as signe
the user set an upper limit, beyond which the delta is clamped to 1. Values greater than the limit if negative when
cast to int32 are used to adjust onward dts.
Unit is the track time scale. Range is 0 to UINT_MAX. Default is @code{UINT_MAX - 48000*10} which allows upto
Unit is the track time scale. Range is 0 to UINT_MAX. Default is @code{UINT_MAX - 48000*10} which allows up to
a 10 second dts correction for 48 kHz audio streams while accommodating 99.9% of @code{uint32} range.
@item interleaved_read
@ -943,4 +1105,27 @@ which in turn, acts as a ceiling for the size of scripts that can be read.
Default is 1 MiB.
@end table
@section w64
Sony Wave64 Audio demuxer.
This demuxer accepts the following options:
@table @option
@item max_size
See the same option for the @ref{wav} demuxer.
@end table
@anchor{wav}
@section wav
RIFF Wave Audio demuxer.
This demuxer accepts the following options:
@table @option
@item max_size
Specify the maximum packet size in bytes for the demuxed packets. By default
this is set to 0, which means that a sensible value is chosen based on the
input format.
@end table
@c man end DEMUXERS

View File

@ -24,6 +24,10 @@ generated from the headers
the examples under @file{doc/examples}
@end itemize
For more detailed legal information about the use of FFmpeg in
external programs read the @file{LICENSE} file in the source tree and
consult @url{https://ffmpeg.org/legal.html}.
If you modify FFmpeg code for your own use case, you are highly encouraged to
@emph{submit your changes back to us}, using this document as a guide. There are
both pragmatic and ideological reasons to do so:
@ -40,12 +44,6 @@ By supporting the project you find useful you ensure it continues to be
maintained and developed.
@end itemize
For more detailed legal information about the use of FFmpeg in
external programs read the @file{LICENSE} file in the source tree and
consult @url{https://ffmpeg.org/legal.html}.
@section Contributing code
All proposed code changes should be submitted for review to
@url{mailto:ffmpeg-devel@@ffmpeg.org, the development mailing list}, as
described in more detail in the @ref{Submitting patches} chapter. The code
@ -58,14 +56,8 @@ and should try to fix issues their commit causes.
@section Language
FFmpeg is mainly programmed in the ISO C99 language, extended with:
@itemize @bullet
@item
Atomic operations from C11 @file{stdatomic.h}. They are emulated on
architectures/compilers that do not support them, so all FFmpeg-internal code
may use atomics without any extra checks. However, @file{stdatomic.h} must not
be included in public headers, so they stay C99-compatible.
@end itemize
FFmpeg is mainly programmed in the ISO C11 language, except for the public
headers which must stay C99 compatible.
Compiler-specific extensions may be used with good reason, but must not be
depended on, i.e. the code must still compile and work with compilers lacking
@ -101,7 +93,7 @@ The specific syntax used for writing assembly is:
NASM on x86;
@item
GAS on ARM.
GAS on ARM and RISC-V.
@end itemize
A unit testing framework for assembly called @code{checkasm} lives under
@ -276,10 +268,6 @@ symbols. If in doubt, just avoid names starting with @code{_} altogether.
@section Miscellaneous conventions
@itemize @bullet
@item
fprintf and printf are forbidden in libavformat and libavcodec,
please use av_log() instead.
@item
Casts should be used only when necessary. Unneeded parentheses
should also be avoided if they don't make the code easier to understand.
@ -288,6 +276,42 @@ should also be avoided if they don't make the code easier to understand.
@anchor{Development Policy}
@chapter Development Policy
@section Code behaviour
@subheading Correctness
The code must be valid. It must not crash, abort, access invalid pointers, leak
memory, cause data races or signed integer overflow, or otherwise cause
undefined behaviour. Error codes should be checked and, when applicable,
forwarded to the caller.
@subheading Thread- and library-safety
Our libraries may be called by multiple independent callers in the same process.
These calls may happen from any number of threads and the different call sites
may not be aware of each other - e.g. a user program may be calling our
libraries directly, and use one or more libraries that also call our libraries.
The code must behave correctly under such conditions.
@subheading Robustness
The code must treat as untrusted any bytestream received from a caller or read
from a file, network, etc. It must not misbehave when arbitrary data is sent to
it - typically it should print an error message and return
@code{AVERROR_INVALIDDATA} on encountering invalid input data.
@subheading Memory allocation
The code must use the @code{av_malloc()} family of functions from
@file{libavutil/mem.h} to perform all memory allocation, except in special cases
(e.g. when interacting with an external library that requires a specific
allocator to be used).
All allocations should be checked and @code{AVERROR(ENOMEM)} returned on
failure. A common mistake is that error paths leak memory - make sure that does
not happen.
@subheading stdio
Our libraries must not access the stdio streams stdin/stdout/stderr directly
(e.g. via @code{printf()} family of functions), as that is not library-safe. For
logging, use @code{av_log()}.
@section Patches/Committing
@subheading Licenses for patches must be compatible with FFmpeg.
Contributions should be licensed under the
@ -310,13 +334,24 @@ missing samples or an implementation with a small subset of features.
Always check the mailing list for any reviewers with issues and test
FATE before you push.
@subheading Keep the main commit message short with an extended description below.
The commit message should have a short first line in the form of
a @samp{topic: short description} as a header, separated by a newline
from the body consisting of an explanation of why the change is necessary.
If the commit fixes a known bug on the bug tracker, the commit message
should include its bug ID. Referring to the issue on the bug tracker does
not exempt you from writing an excerpt of the bug in the commit message.
@subheading Commit messages
Commit messages are highly important tools for informing other developers on
what a given change does and why. Every commit must always have a properly
filled out commit message with the following format:
@example
area changed: short 1 line description
details describing what and why and giving references.
@end example
If the commit addresses a known bug on our bug tracker or other external issue
(e.g. CVE), the commit message should include the relevant bug ID(s) or other
external identifiers. Note that this should be done in addition to a proper
explanation and not instead of it. Comments such as "fixed!" or "Changed it."
are not acceptable.
When applying patches that have been discussed at length on the mailing list,
reference the thread in the commit message.
@subheading Testing must be adequate but not excessive.
If it works for you, others, and passes FATE then it should be OK to commit
@ -335,15 +370,6 @@ later on.
Also if you have doubts about splitting or not splitting, do not hesitate to
ask/discuss it on the developer mailing list.
@subheading Ask before you change the build system (configure, etc).
Do not commit changes to the build system (Makefiles, configure script)
which change behavior, defaults etc, without asking first. The same
applies to compiler warning fixes, trivial looking fixes and to code
maintained by other developers. We usually have a reason for doing things
the way we do. Send your changes as patches to the ffmpeg-devel mailing
list, and if the code maintainers say OK, you may commit. This does not
apply to files you wrote and/or maintain.
@subheading Cosmetic changes should be kept in separate patches.
We refuse source indentation and other cosmetic changes if they are mixed
with functional changes, such commits will be rejected and removed. Every
@ -358,28 +384,12 @@ NOTE: If you had to put if()@{ .. @} over a large (> 5 lines) chunk of code,
then either do NOT change the indentation of the inner part within (do not
move it to the right)! or do so in a separate commit
@subheading Commit messages should always be filled out properly.
Always fill out the commit log message. Describe in a few lines what you
changed and why. You can refer to mailing list postings if you fix a
particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
Recommended format:
@example
area changed: Short 1 line description
details describing what and why and giving references.
@end example
@subheading Credit the author of the patch.
Make sure the author of the commit is set correctly. (see git commit --author)
If you apply a patch, send an
answer to ffmpeg-devel (or wherever you got the patch from) saying that
you applied the patch.
@subheading Complex patches should refer to discussion surrounding them.
When applying patches that have been discussed (at length) on the mailing
list, reference the thread in the log message.
@subheading Always wait long enough before pushing changes
Do NOT commit to code actively maintained by others without permission.
Send a patch to ffmpeg-devel. If no one answers within a reasonable
@ -397,11 +407,6 @@ If it is a bug, the bug has to be fixed. If it is not, the code should
be changed to not generate a warning unless that causes a slowdown
or obfuscates the code.
@subheading Check untrusted input properly.
Never write to unallocated memory, never write over the end of arrays,
always check values read from some untrusted source before using them
as array index or other risky things.
@section Library public interfaces
Every library in FFmpeg provides a set of public APIs in its installed headers,
which are those listed in the variable @code{HEADERS} in that library's
@ -427,7 +432,7 @@ number remains unchanged.
@subsection Adding new interfaces
Any new public identifiers in installed headers are considered new API - this
includes new functions, structs, macros, enum values, typedefs, new fields in
existing functions, new installed headers, etc. Consider the following
existing structs, new installed headers, etc. Consider the following
guidelines when adding new APIs.
@subsubheading Motivation
@ -813,11 +818,6 @@ an explanation why to your patchset, its ok to not test if theres a reason.
@item
If you added YASM code please check that things still work with --disable-yasm.
@item
Make sure you check the return values of function and return appropriate
error codes. Especially memory allocation functions like @code{av_malloc()}
are notoriously left unchecked, which is a serious problem.
@item
Test your code with valgrind and or Address Sanitizer to ensure it's free
of leaks, out of array accesses, etc.

View File

@ -615,7 +615,7 @@ and slightly improves compression.
Opus encoder.
This is a native FFmpeg encoder for the Opus format. Currently its in development and
This is a native FFmpeg encoder for the Opus format. Currently, it's in development and
only implements the CELT part of the codec. Its quality is usually worse and at best
is equal to the libopus encoder.
@ -977,14 +977,17 @@ Favor improved speech intelligibility.
@item audio
Favor faithfulness to the input (the default).
@item lowdelay
Restrict to only the lowest delay modes.
Restrict to only the lowest delay modes by disabling voice-optimized
modes.
@end table
@item cutoff (N.A.)
Set cutoff bandwidth in Hz. The argument must be exactly one of the
following: 4000, 6000, 8000, 12000, or 20000, corresponding to
narrowband, mediumband, wideband, super wideband, and fullband
respectively. The default is 0 (cutoff disabled).
respectively. The default is 0 (cutoff disabled). Note that libopus
forces a wideband cutoff for bitrates < 15 kbps, unless CELT-only
(@option{application} set to @samp{lowdelay}) mode is used.
@item mapping_family (@emph{mapping_family})
Set channel mapping family to be used by the encoder. The default value of -1
@ -2234,6 +2237,12 @@ the two temporal layer 2 frames within the temporal period.
@end table
@end table
@item VP8-specific options
@table @option
@item screen-content-mode
Screen content mode, one of: 0 (off), 1 (screen), 2 (screen with more aggressive rate control).
@end table
@item VP9-specific options
@table @option
@item lossless
@ -2418,6 +2427,10 @@ To get a more accurate and extensive documentation of the libx264
options, invoke the command @command{x264 --fullhelp} or consult
the libx264 documentation.
In the list below, note that the @command{x264} option name is shown
in parentheses after the libavcodec corresponding name, in case there
is a direct mapping.
@table @option
@item b (@emph{bitrate})
Set bitrate in bits/s. Note that FFmpeg's @option{b} option is
@ -2425,17 +2438,19 @@ expressed in bits/s, while @command{x264}'s @option{bitrate} is in
kilobits/s.
@item bf (@emph{bframes})
Number of B-frames between I and P-frames
@item g (@emph{keyint})
Maximum GOP size
@item qmin (@emph{qpmin})
Minimum quantizer scale.
Minimum quantizer scale
@item qmax (@emph{qpmax})
Maximum quantizer scale.
Maximum quantizer scale
@item qdiff (@emph{qpstep})
Maximum difference between quantizer scales.
Maximum difference between quantizer scales
@item qblur (@emph{qblur})
Quantizer curve blur
@ -2444,7 +2459,21 @@ Quantizer curve blur
Quantizer curve compression factor
@item refs (@emph{ref})
Number of reference frames each P-frame can use. The range is from @var{0-16}.
Number of reference frames each P-frame can use. The range is @var{0-16}.
@item level (@emph{level})
Set the @code{x264_param_t.i_level_idc} value in case the value is
positive, it is ignored otherwise.
This value can be set using the @code{AVCodecContext} API (e.g. by
setting the @code{AVCodecContext} value directly), and is specified as
an integer mapped on a corresponding level (e.g. the value 31 maps
to H.264 level IDC "3.1", as defined in the @code{x264_levels}
table). It is ignored when set to a non positive value.
Alternatively it can be set as a private option, overriding the value
set in @code{AVCodecContext}, and in this case must be specified as
the level IDC identifier (e.g. "3.1"), as defined by H.264 Annex A.
@item sc_threshold (@emph{scenecut})
Sets the threshold for the scene change detection.
@ -2452,7 +2481,8 @@ Sets the threshold for the scene change detection.
@item trellis (@emph{trellis})
Performs Trellis quantization to increase efficiency. Enabled by default.
@item nr (@emph{nr})
@item nr (@emph{nr})
Noise reduction
@item me_range (@emph{merange})
Maximum range of the motion search in pixels.
@ -2533,6 +2563,7 @@ open GOP by setting it to @code{-cgop}. The result is similar to
the behavior of @command{x264}'s @option{--open-gop} option.
@item rc_init_occupancy (@emph{vbv-init})
Initial VBV buffer occupancy
@item preset (@emph{preset})
Set the encoding preset.
@ -2578,7 +2609,7 @@ Set AQ strength, reduce blocking and blurring in flat and textured areas.
Use psychovisual optimizations when set to 1. When set to 0, it has the
same effect as @command{x264}'s @option{--no-psy} option.
@item psy-rd (@emph{psy-rd})
@item psy-rd (@emph{psy-rd})
Set strength of psychovisual optimization, in
@var{psy-rd}:@var{psy-trellis} format.
@ -2610,7 +2641,7 @@ to 1.
@item avcintra-class (@emph{class})
Configure the encoder to generate AVC-Intra.
Valid values are 50,100 and 200
Valid values are 50, 100 and 200
@item bluray-compat (@emph{bluray-compat})
Configure the encoder to be compatible with the bluray standard.
@ -2661,8 +2692,8 @@ Set loop filter parameters, in @var{alpha}:@var{beta} form.
Set fluctuations reduction in QP (before curve compression).
@item partitions (@emph{partitions})
Set partitions to consider as a comma-separated list of. Possible
values in the list:
Set partitions to consider as a comma-separated list of values.
Possible values in the list:
@table @samp
@item p8x8
@ -2718,19 +2749,32 @@ Variable bit rate.
Constant bit rate (not allowed in MP4 container).
@end table
@item x264opts (N.A.)
Set any x264 option, see @command{x264 --fullhelp} for a list.
@item x264opts @var{opts}
@item x264-params @var{opts}
Override the x264 configuration using a :-separated list of key=value
options.
Argument is a list of @var{key}=@var{value} couples separated by
":". In @var{filter} and @var{psy-rd} options that use ":" as a separator
themselves, use "," instead. They accept it as well since long ago but this
is kept undocumented for some reason.
The argument for both options is a list of @var{key}=@var{value}
couples separated by ":". With @option{x264opts} the value can be
omitted, and the value @code{1} is assumed in that case.
For @var{filter} and @var{psy-rd} options values that use ":" as a
separator themselves, use "," instead. They accept it as well since
long ago but this is kept undocumented for some reason.
For example, the options might be provided as:
@example
level=30:bframes=0:weightp=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:no-fast-pskip=1:subq=6:8x8dct=0:trellis=0
@end example
For example to specify libx264 encoding options with @command{ffmpeg}:
@example
ffmpeg -i foo.mpg -c:v libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
@end example
To get the complete list of the libx264 options, invoke the command
@command{x264 --fullhelp} or consult the libx264 documentation.
@item a53cc @var{boolean}
Import closed captions (which must be ATSC compatible format) into output.
Only the mpeg2 and h264 decoders provide these. Default is 1 (on).
@ -2741,20 +2785,6 @@ Import user data unregistered SEI if available into output. Default is 0 (off).
@item mb_info @var{boolean}
Set mb_info data through AVFrameSideData, only useful when used from the
API. Default is 0 (off).
@item x264-params (N.A.)
Override the x264 configuration using a :-separated list of key=value
parameters.
This option is functionally the same as the @option{x264opts}, but is
duplicated for compatibility with the Libav fork.
For example to specify libx264 encoding options with @command{ffmpeg}:
@example
ffmpeg -i INPUT -c:v libx264 -x264-params level=30:bframes=0:weightp=0:\
cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:\
no-fast-pskip=1:subq=6:8x8dct=0:trellis=0 OUTPUT
@end example
@end table
Encoding ffpresets for common usages are provided so they can be used with the
@ -2894,6 +2924,75 @@ ffmpeg -i input -c:v libxavs2 -xavs2-params RdoqLevel=0 output.avs2
@end example
@end table
@section libxeve
eXtra-fast Essential Video Encoder (XEVE) MPEG-5 EVC encoder wrapper.
The xeve-equivalent options or values are listed in parentheses for easy migration.
This encoder requires the presence of the libxeve headers and library
during configuration. You need to explicitly configure the build with
@option{--enable-libxeve}.
@float NOTE
Many libxeve encoder options are mapped to FFmpeg global codec options,
while unique encoder options are provided through private options.
Additionally the xeve-params private options allows one to pass a list
of key=value tuples as accepted by the libxeve @code{parse_xeve_params} function.
@end float
The xeve project website is at @url{https://github.com/mpeg5/xeve}.
@subsection Options
The following options are supported by the libxeve wrapper.
The xeve-equivalent options or values are listed in parentheses for easy migration.
@float NOTE
To reduce the duplication of documentation, only the private options
and some others requiring special attention are documented here. For
the documentation of the undocumented generic options, see
@ref{codec-options,,the Codec Options chapter}.
@end float
@float NOTE
To get a more accurate and extensive documentation of the libxeve options,
invoke the command @code{xeve_app --help} or consult the libxeve documentation.
@end float
@table @option
@item b (@emph{bitrate})
Set target video bitrate in bits/s.
Note that FFmpeg's b option is expressed in bits/s, while xeve's bitrate is in kilobits/s.
@item bf (@emph{bframes})
Set the maximum number of B frames (1,3,7,15).
@item g (@emph{keyint})
Set the GOP size (I-picture period).
@item preset (@emph{preset})
Set the xeve preset.
Set the encoder preset value to determine encoding speed [fast, medium, slow, placebo]
@item tune (@emph{tune})
Set the encoder tune parameter [psnr, zerolatency]
@item profile (@emph{profile})
Set the encoder profile [0: baseline; 1: main]
@item crf (@emph{crf})
Set the quality for constant quality mode.
Constant rate factor <10..49> [default: 32]
@item qp (@emph{qp})
Set constant quantization rate control method parameter.
Quantization parameter qp <0..51> [default: 32]
@item threads (@emph{threads})
Force to use a specific number of threads
@end table
@section libxvid
Xvid MPEG-4 Part 2 encoder wrapper.
@ -2962,27 +3061,24 @@ Place global headers in extradata instead of every keyframe.
@item trellis
@item me_method
Set motion estimation method. Possible values in decreasing order of
@item me_quality
Set motion estimation quality level. Possible values in decreasing order of
speed and increasing order of quality:
@table @samp
@item zero
@item 0
Use no motion estimation (default).
@item phods
@item x1
@item log
@item 1, 2
Enable advanced diamond zonal search for 16x16 blocks and half-pixel
refinement for 16x16 blocks. @samp{x1} and @samp{log} are aliases for
@samp{phods}.
refinement for 16x16 blocks.
@item epzs
@item 3, 4
Enable all of the things described above, plus advanced diamond zonal
search for 8x8 blocks, half-pixel refinement for 8x8 blocks, and motion
estimation on chroma planes.
search for 8x8 blocks and half-pixel refinement for 8x8 blocks, also
enable motion estimation on chroma planes for P and B-frames.
@item full
@item 5, 6
Enable all of the things described above, plus extended 16x16 and 8x8
blocks search.
@end table
@ -3242,8 +3338,8 @@ quality range is 1 to 51, with 1 being the best quality.
@end itemize
@item
Otherwise, a bitrate-based mode is used. For all of those, you should specify at
least the desired average bitrate with the @option{b} option.
Otherwise when the desired average bitrate is specified with the @option{b}
option, a bitrate-based mode is used.
@itemize @minus
@item
@var{LA} - VBR with lookahead, when the @option{look_ahead} option is specified.
@ -3264,6 +3360,9 @@ than the average bitrate.
@option{avbr_accuracy} and @option{avbr_convergence} are set to non-zero. This
mode is available for H264 and HEVC on Windows.
@end itemize
@item
Otherwise the default ratecontrol method @var{CQP} is used.
@end itemize
Note that depending on your system, a different mode than the one you specified
@ -3990,6 +4089,10 @@ Quality-defined variable-bitrate.
Average variable bitrate.
@end table
@item blbrc
Enable block level rate control, which assigns different bitrate block by block.
Invalid for CQP mode.
@end table
Each encoder also has its own specific options:

View File

@ -28,8 +28,6 @@
* GPU video surfaces, write the decoded frames to an output file.
*/
#include "config.h"
#include <stdio.h>
#include "libavformat/avformat.h"

View File

@ -62,10 +62,10 @@ static int str_to_dict(char* optstr, AVDictionary **opt)
return 0;
key = strtok(optstr, " ");
if (key == NULL)
return AVERROR(ENAVAIL);
return AVERROR(EINVAL);
value = strtok(NULL, " ");
if (value == NULL)
return AVERROR(ENAVAIL);
return AVERROR(EINVAL);
av_dict_set(opt, key, value, 0);
do {
key = strtok(NULL, " ");
@ -73,7 +73,7 @@ static int str_to_dict(char* optstr, AVDictionary **opt)
return 0;
value = strtok(NULL, " ");
if (value == NULL)
return AVERROR(ENAVAIL);
return AVERROR(EINVAL);
av_dict_set(opt, key, value, 0);
} while(key != NULL);
return 0;
@ -181,7 +181,7 @@ static int open_input_file(char *filename)
break;
default:
fprintf(stderr, "Codec is not supportted by qsv\n");
return AVERROR(ENAVAIL);
return AVERROR(EINVAL);
}
if (!(decoder_ctx = avcodec_alloc_context3(decoder)))

View File

@ -196,7 +196,7 @@ static int open_output_file(const char *filename)
/* Third parameter can be used to pass settings to encoder */
ret = avcodec_open2(enc_ctx, encoder, NULL);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot open video encoder for stream #%u\n", i);
av_log(NULL, AV_LOG_ERROR, "Cannot open %s encoder for stream #%u\n", encoder->name, i);
return ret;
}
ret = avcodec_parameters_from_context(out_stream->codecpar, enc_ctx);

View File

@ -450,7 +450,7 @@ work with streams that were detected during the initial scan; streams that
are detected later are ignored.
The size of the initial scan is controlled by two options: @code{probesize}
(default ~5 Mo) and @code{analyzeduration} (default 5,000,000 µs = 5 s). For
(default ~5@tie{}Mo) and @code{analyzeduration} (default 5,000,000@tie{}µs = 5@tie{}s). For
the subtitle stream to be detected, both values must be large enough.
@section Why was the @command{ffmpeg} @option{-sameq} option removed? What to use instead?
@ -467,7 +467,7 @@ point acceptable for your tastes. The most common options to do that are
@option{-qscale} and @option{-qmax}, but you should peruse the documentation
of the encoder you chose.
@section I have a stretched video, why does scaling does not fix it?
@section I have a stretched video, why does scaling not fix it?
A lot of video codecs and formats can store the @emph{aspect ratio} of the
video: this is the ratio between the width and the height of either the full

View File

@ -79,6 +79,14 @@ Do not put a '~' character in the samples path to indicate a home
directory. Because of shell nuances, this will cause FATE to fail.
@end float
Beware that some assertions are disabled by default, so mind setting
@option{--assert-level=<level>} at configuration time, e.g. when seeking
the highest possible test coverage:
@example
./configure --assert-level=2
@end example
Note that raising the assert level could have a performance impact.
To get the complete list of tests, run the command:
@example
make fate-list

View File

@ -31,3 +31,25 @@ makeopts= # extra options passed to 'make'
# defaulting to makeopts above if this is not set
#tar= # command to create a tar archive from its arguments on stdout,
# defaults to 'tar c'
#fate_targets= # targets to make when running fate; defaults to "fate",
# can be set to run a subset of tests, e.g. "fate-checkasm".
#fate_environments= # a list of names of configurations to run tests for;
# each round is run with variables from ${${name}_env} set.
# One example of using fate_environments:
# target_exec="qemu-aarch64-static"
# fate_targets="fate-checkasm fate-cpu"
# fate_environments="sve128 sve256"
# sve128_env="QEMU_CPU=max,sve128=on"
# sve256_env="QEMU_CPU=max,sve256=on"
# The variables set by fate_environments can also be used explicitly
# by target_exec, e.g. like this:
# target_exec="qemu-aarch64-static -cpu \$(MY_CPU)"
# fate_targets="fate-checkasm fate-cpu"
# fate_environments="sve128 sve256"
# sve128_env="MY_CPU=max,sve128=on"
# sve256_env="MY_CPU=max,sve256=on"

View File

@ -118,7 +118,7 @@ Encoded packets are then passed to the decoder (unless streamcopy is selected
for the stream, see further for a description). The decoder produces
uncompressed frames (raw video/PCM audio/...) which can be processed further by
filtering (see next section). After filtering, the frames are passed to the
encoder, which encodes them and outputs encoded packets. Finally those are
encoder, which encodes them and outputs encoded packets. Finally, those are
passed to the muxer, which writes the encoded packets to the output file.
@section Filtering
@ -219,6 +219,40 @@ Since there is no decoding or encoding, it is very fast and there is no quality
loss. However, it might not work in some cases because of many factors. Applying
filters is obviously also impossible, since filters work on uncompressed data.
@section Loopback decoders
While decoders are normally associated with demuxer streams, it is also possible
to create "loopback" decoders that decode the output from some encoder and allow
it to be fed back to complex filtergraphs. This is done with the @code{-dec}
directive, which takes as a parameter the index of the output stream that should
be decoded. Every such directive creates a new loopback decoder, indexed with
successive integers starting at zero. These indices should then be used to refer
to loopback decoders in complex filtergraph link labels, as described in the
documentation for @option{-filter_complex}.
E.g. the following example:
@example
ffmpeg -i INPUT \
-map 0:v:0 -c:v libx264 -crf 45 -f null - \
-dec 0:0 -filter_complex '[0:v][dec:0]hstack[stack]' \
-map '[stack]' -c:v ffv1 OUTPUT
@end example
reads an input video and
@itemize
@item
(line 2) encodes it with @code{libx264} at low quality;
@item
(line 3) decodes this encoded stream and places it side by side with the
original input video;
@item
(line 4) combined video is then losslessly encoded and written into
@file{OUTPUT}.
@end itemize
@c man end DETAILED DESCRIPTION
@chapter Stream selection
@ -623,6 +657,206 @@ Not all muxers support embedded thumbnails, and those who do, only support a few
Creates a program with the specified @var{title}, @var{program_num} and adds the specified
@var{stream}(s) to it.
@item -stream_group type=@var{type}:st=@var{stream}[:st=@var{stream}][:stg=@var{stream_group}][:id=@var{stream_group_id}...] (@emph{output})
Creates a stream group of the specified @var{type}, @var{stream_group_id} and adds the specified
@var{stream}(s) and/or previously defined @var{stream_group}(s) to it.
@var{type} can be one of the following:
@table @option
@item iamf_audio_element
Groups @var{stream}s that belong to the same IAMF Audio Element
For this group @var{type}, the following options are available
@table @option
@item audio_element_type
The Audio Element type. The following values are supported:
@table @option
@item channel
Scalable channel audio representation
@item scene
Ambisonics representation
@end table
@item demixing
Demixing information used to reconstruct a scalable channel audio representation.
This option must be separated from the rest with a ',', and takes the following
key=value options
@table @option
@item parameter_id
An identifier parameters blocks in frames may refer to
@item dmixp_mode
A pre-defined combination of demixing parameters
@end table
@item recon_gain
Recon gain information used to reconstruct a scalable channel audio representation.
This option must be separated from the rest with a ',', and takes the following
key=value options
@table @option
@item parameter_id
An identifier parameters blocks in frames may refer to
@end table
@item layer
A layer defining a Channel Layout in the Audio Element.
This option must be separated from the rest with a ','. Several ',' separated entries
can be defined, and at least one must be set.
It takes the following ":"-separated key=value options
@table @option
@item ch_layout
The layer's channel layout
@item flags
The following flags are available:
@table @option
@item recon_gain
Wether to signal if recon_gain is present as metadata in parameter blocks within frames
@end table
@item output_gain
@item output_gain_flags
Which channels output_gain applies to. The following flags are available:
@table @option
@item FL
@item FR
@item BL
@item BR
@item TFL
@item TFR
@end table
@item ambisonics_mode
The ambisonics mode. This has no effect if audio_element_type is set to channel.
The following values are supported:
@table @option
@item mono
Each ambisonics channel is coded as an individual mono stream in the group
@end table
@end table
@item default_w
Default weight value
@end table
@item iamf_mix_presentation
Groups @var{stream}s that belong to all IAMF Audio Element the same
IAMF Mix Presentation references
For this group @var{type}, the following options are available
@table @option
@item submix
A sub-mix within the Mix Presentation.
This option must be separated from the rest with a ','. Several ',' separated entries
can be defined, and at least one must be set.
It takes the following ":"-separated key=value options
@table @option
@item parameter_id
An identifier parameters blocks in frames may refer to, for post-processing the mixed
audio signal to generate the audio signal for playback
@item parameter_rate
The sample rate duration fields in parameters blocks in frames that refer to this
@var{parameter_id} are expressed as
@item default_mix_gain
Default mix gain value to apply when there are no parameter blocks sharing the same
@var{parameter_id} for a given frame
@item element
References an Audio Element used in this Mix Presentation to generate the final output
audio signal for playback.
This option must be separated from the rest with a '|'. Several '|' separated entries
can be defined, and at least one must be set.
It takes the following ":"-separated key=value options:
@table @option
@item stg
The @var{stream_group_id} for an Audio Element which this sub-mix refers to
@item parameter_id
An identifier parameters blocks in frames may refer to, for applying any processing to
the referenced and rendered Audio Element before being summed with other processed Audio
Elements
@item parameter_rate
The sample rate duration fields in parameters blocks in frames that refer to this
@var{parameter_id} are expressed as
@item default_mix_gain
Default mix gain value to apply when there are no parameter blocks sharing the same
@var{parameter_id} for a given frame
@item annotations
A key=value string describing the sub-mix element where "key" is a string conforming to
BCP-47 that specifies the language for the "value" string. "key" must be the same as the
one in the mix's @var{annotations}
@item headphones_rendering_mode
Indicates whether the input channel-based Audio Element is rendered to stereo loudspeakers
or spatialized with a binaural renderer when played back on headphones.
This has no effect if the referenced Audio Element's @var{audio_element_type} is set to
channel.
The following values are supported:
@table @option
@item stereo
@item binaural
@end table
@end table
@item layout
Specifies the layouts for this sub-mix on which the loudness information was measured.
This option must be separated from the rest with a '|'. Several '|' separated entries
can be defined, and at least one must be set.
It takes the following ":"-separated key=value options:
@table @option
@item layout_type
@table @option
@item loudspeakers
The layout follows the loudspeaker sound system convention of ITU-2051-3.
@item binaural
The layout is binaural.
@end table
@item sound_system
Channel layout matching one of Sound Systems A to J of ITU-2051-3, plus 7.1.2 and 3.1.2
This has no effect if @var{layout_type} is set to binaural.
@item integrated_loudness
The program integrated loudness information, as defined in ITU-1770-4.
@item digital_peak
The digital (sampled) peak value of the audio signal, as defined in ITU-1770-4.
@item true_peak
The true peak of the audio signal, as defined in ITU-1770-4.
@item dialog_anchored_loudness
The Dialogue loudness information, as defined in ITU-1770-4.
@item album_anchored_loudness
The Album loudness information, as defined in ITU-1770-4.
@end table
@end table
@item annotations
A key=value string string describing the mix where "key" is a string conforming to BCP-47
that specifies the language for the "value" string. "key" must be the same as the ones in
all sub-mix element's @var{annotations}s
@end table
@end table
@item -target @var{type} (@emph{output})
Specify target file type (@code{vcd}, @code{svcd}, @code{dvd}, @code{dv},
@code{dv50}). @var{type} may be prefixed with @code{pal-}, @code{ntsc-} or
@ -777,12 +1011,6 @@ syntax.
See the @ref{filter_complex_option,,-filter_complex option} if you
want to create filtergraphs with multiple inputs and/or outputs.
@anchor{filter_script option}
@item -filter_script[:@var{stream_specifier}] @var{filename} (@emph{output,per-stream})
This option is similar to @option{-filter}, the only difference is that its
argument is the name of the file from which a filtergraph description is to be
read.
@item -reinit_filter[:@var{stream_specifier}] @var{integer} (@emph{input,per-stream})
This boolean option determines if the filtergraph(s) to which this stream is fed gets
reinitialized when input frame parameters change mid-stream. This option is enabled by
@ -830,7 +1058,7 @@ be achieved with @code{ffmpeg ... < /dev/null} but it requires a
shell.
@item -debug_ts (@emph{global})
Print timestamp information. It is off by default. This option is
Print timestamp/latency information. It is off by default. This option is
mostly useful for testing and debugging purposes, and the output
format may change from one version to another, so it should not be
employed by portable scripts.
@ -1036,10 +1264,6 @@ list separated with slashes. Two first values are the beginning and
end frame numbers, last one is quantizer to use if positive, or quality
factor if negative.
@item -psnr
Calculate PSNR of compressed frames. This option is deprecated, pass the
PSNR flag to the encoder instead, using @code{-flags +psnr}.
@item -vstats
Dump video coding statistics to @file{vstats_HHMMSS.log}. See the
@ref{vstats_file_format,,vstats file format} section for the format description.
@ -1054,13 +1278,10 @@ Specify which version of the vstats format to use. Default is @code{2}. See the
@item -vtag @var{fourcc/tag} (@emph{output})
Force video tag/fourcc. This is an alias for @code{-tag:v}.
@item -vbsf @var{bitstream_filter}
Deprecated see -bsf
@item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream})
@item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} (@emph{output,per-stream})
@item -force_key_frames[:@var{stream_specifier}] source (@emph{output,per-stream})
@item -force_key_frames[:@var{stream_specifier}] source_no_drop (@emph{output,per-stream})
@var{force_key_frames} can take arguments of the following form:
@ -1121,10 +1342,6 @@ starting from second 13:
@item source
If the argument is @code{source}, ffmpeg will force a key frame if
the current frame being encoded is marked as a key frame in its source.
@item source_no_drop
If the argument is @code{source_no_drop}, ffmpeg will force a key frame if
the current frame being encoded is marked as a key frame in its source.
In cases where this particular source frame has to be dropped,
enforce the next available frame to become a key frame instead.
@ -1170,6 +1387,21 @@ Choose the first device and use the primary device context.
@item d3d11va
@var{device} is the number of the Direct3D 11 display adapter.
If not specified, it will attempt to use the default Direct3D 11 display adapter
or the first Direct3D 11 display adapter whose hardware VendorId is specified
by @samp{vendor_id}.
Examples:
@table @emph
@item -init_hw_device d3d11va
Create a d3d11va device on the default Direct3D 11 display adapter.
@item -init_hw_device d3d11va:1
Create a d3d11va device on the Direct3D 11 display adapter specified by index 1.
@item -init_hw_device d3d11va:,vendor_id=0x8086
Create a d3d11va device on the first Direct3D 11 display adapter whose hardware VendorId is 0x8086.
@end table
@item vaapi
@var{device} is either an X11 display name, a DRM render node or a DirectX adapter index.
@ -1177,6 +1409,29 @@ If not specified, it will attempt to open the default X11 display (@emph{$DISPLA
and then the first DRM render node (@emph{/dev/dri/renderD128}), or the default
DirectX adapter on Windows.
The following options are recognized:
@table @option
@item kernel_driver
When @var{device} is not specified, use this option to specify the name of the kernel
driver associated with the desired device. This option is available only when
the hardware acceleration method @emph{drm} and @emph{vaapi} are enabled.
@end table
Examples:
@table @emph
@item -init_hw_device vaapi
Create a vaapi device on the default device.
@item -init_hw_device vaapi:/dev/dri/renderD129
Create a vaapi device on DRM render node @file{/dev/dri/renderD129}.
@item -init_hw_device vaapi:1
Create a vaapi device on DirectX adapter 1.
@item -init_hw_device vaapi:,kernel_driver=i915
Create a vaapi device on a device associated with kernel driver @samp{i915}.
@end table
@item vdpau
@var{device} is an X11 display name.
If not specified, it will attempt to open the default X11 display (@emph{$DISPLAY}).
@ -1198,16 +1453,38 @@ If not specified, @samp{auto_any} is used.
platform-appropriate subdevice (@samp{dxva2} or @samp{d3d11va} or @samp{vaapi}) and then deriving a
QSV device from that.)
Alternatively, @samp{child_device_type} helps to choose platform-appropriate subdevice type.
On Windows @samp{d3d11va} is used as default subdevice type.
The following options are recognized:
@table @option
@item child_device
Specify a DRM render node on Linux or DirectX adapter on Windows.
@item child_device_type
Choose platform-appropriate subdevice type. On Windows @samp{d3d11va} is used
as default subdevice type when @code{--enable-libvpl} is specified at configuration time,
@samp{dxva2} is used as default subdevice type when @code{--enable-libmfx} is specified at
configuration time. On Linux user can use @samp{vaapi} only as subdevice type.
@end table
Examples:
@table @emph
@item -init_hw_device qsv:hw,child_device=/dev/dri/renderD129
Create a QSV device with @samp{MFX_IMPL_HARDWARE} on DRM render node @file{/dev/dri/renderD129}.
@item -init_hw_device qsv:hw,child_device=1
Create a QSV device with @samp{MFX_IMPL_HARDWARE} on DirectX adapter 1.
@item -init_hw_device qsv:hw,child_device_type=d3d11va
Choose the GPU subdevice with type @samp{d3d11va} and create QSV device with @samp{MFX_IMPL_HARDWARE}.
@item -init_hw_device qsv:hw,child_device_type=dxva2
Choose the GPU subdevice with type @samp{dxva2} and create QSV device with @samp{MFX_IMPL_HARDWARE}.
@item -init_hw_device qsv:hw,child_device=1,child_device_type=d3d11va
Create a QSV device with @samp{MFX_IMPL_HARDWARE} on DirectX adapter 1 with subdevice type @samp{d3d11va}.
@item -init_hw_device vaapi=va:/dev/dri/renderD129 -init_hw_device qsv=hw1@@@var{va}
Create a VAAPI device called @samp{va} on @file{/dev/dri/renderD129}, then derive a QSV device called @samp{hw1}
from device @samp{va}.
@end table
@item opencl
@ -1414,8 +1691,6 @@ This is an alias for @code{-filter:a}, see the @ref{filter_option,,-filter optio
@table @option
@item -atag @var{fourcc/tag} (@emph{output})
Force audio tag/fourcc. This is an alias for @code{-tag:a}.
@item -absf @var{bitstream_filter}
Deprecated, see -bsf
@item -guess_layout_max @var{channels} (@emph{input,per-stream})
If some input channel layout is not known, try to guess only if it
corresponds to at most the specified number of channels. For example, 2
@ -1437,8 +1712,6 @@ option to disable streams individually.
As an output option, disables subtitle recording i.e. automatic selection or
mapping of any subtitle stream. For full manual control see the @code{-map}
option.
@item -sbsf @var{bitstream_filter}
Deprecated, see -bsf
@end table
@section Advanced Subtitle options
@ -1471,8 +1744,7 @@ Set the size of the canvas used to render subtitles.
Create one or more streams in the output file. This option has two forms for
specifying the data source(s): the first selects one or more streams from some
input file (specified with @code{-i}), the second takes an output from some
complex filtergraph (specified with @code{-filter_complex} or
@code{-filter_complex_script}).
complex filtergraph (specified with @code{-filter_complex}).
In the first form, an output stream is created for every stream from the input
file with the index @var{input_file_id}. If @var{stream_specifier} is given,
@ -1564,77 +1836,6 @@ such streams is attempted.
Allow input streams with unknown type to be copied instead of failing if copying
such streams is attempted.
@item -map_channel [@var{input_file_id}.@var{stream_specifier}.@var{channel_id}|-1][?][:@var{output_file_id}.@var{stream_specifier}]
This option is deprecated and will be removed. It can be replaced by the
@var{pan} filter. In some cases it may be easier to use some combination of the
@var{channelsplit}, @var{channelmap}, or @var{amerge} filters.
Map an audio channel from a given input to an output. If
@var{output_file_id}.@var{stream_specifier} is not set, the audio channel will
be mapped on all the audio streams.
Using "-1" instead of
@var{input_file_id}.@var{stream_specifier}.@var{channel_id} will map a muted
channel.
A trailing @code{?} will allow the map_channel to be
optional: if the map_channel matches no channel the map_channel will be ignored instead
of failing.
For example, assuming @var{INPUT} is a stereo audio file, you can switch the
two audio channels with the following command:
@example
ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT
@end example
If you want to mute the first channel and keep the second:
@example
ffmpeg -i INPUT -map_channel -1 -map_channel 0.0.1 OUTPUT
@end example
The order of the "-map_channel" option specifies the order of the channels in
the output stream. The output channel layout is guessed from the number of
channels mapped (mono if one "-map_channel", stereo if two, etc.). Using "-ac"
in combination of "-map_channel" makes the channel gain levels to be updated if
input and output channel layouts don't match (for instance two "-map_channel"
options and "-ac 6").
You can also extract each channel of an input to specific outputs; the following
command extracts two channels of the @var{INPUT} audio stream (file 0, stream 0)
to the respective @var{OUTPUT_CH0} and @var{OUTPUT_CH1} outputs:
@example
ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1
@end example
The following example splits the channels of a stereo input into two separate
streams, which are put into the same output file:
@example
ffmpeg -i stereo.wav -map 0:0 -map 0:0 -map_channel 0.0.0:0.0 -map_channel 0.0.1:0.1 -y out.ogg
@end example
Note that currently each output stream can only contain channels from a single
input stream; you can't for example use "-map_channel" to pick multiple input
audio channels contained in different streams (from the same or different files)
and merge them into a single output stream. It is therefore not currently
possible, for example, to turn two separate mono streams into a single stereo
stream. However splitting a stereo stream into two single channel mono streams
is possible.
If you need this feature, a possible workaround is to use the @emph{amerge}
filter. For example, if you need to merge a media (here @file{input.mkv}) with 2
mono audio streams into one single stereo channel audio stream (and keep the
video stream), you can use the following command:
@example
ffmpeg -i input.mkv -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le -c:v copy output.mkv
@end example
To map the first two audio channels from the first input, and using the
trailing @code{?}, ignore the audio channel mapping if the first input is
mono instead of stereo:
@example
ffmpeg -i INPUT -map_channel 0.0.0 -map_channel 0.0.1? OUTPUT
@end example
@item -map_metadata[:@var{metadata_spec_out}] @var{infile}[:@var{metadata_spec_in}] (@emph{output,per-metadata})
Set metadata information of the next output file from @var{infile}. Note that
those are file indices (zero-based), not filenames.
@ -1732,9 +1933,6 @@ constant frame rate.
@item vfr (2)
Frames are passed through with their timestamp or dropped so as to
prevent 2 frames from having the same timestamp.
@item drop
As passthrough but destroys all timestamps, making the muxer generate
fresh timestamps based on frame-rate.
@item auto (-1)
Chooses between cfr and vfr depending on muxer capabilities. This is the
default method.
@ -1850,8 +2048,8 @@ of seconds.
The timestamp discontinuity correction enabled by this option is only
applied to input formats accepting timestamp discontinuity (for which
the @code{AV_FMT_DISCONT} flag is enabled), e.g. MPEG-TS and HLS, and
is automatically disabled when employing the @code{-copy_ts} option
the @code{AVFMT_TS_DISCONT} flag is enabled), e.g. MPEG-TS and HLS, and
is automatically disabled when employing the @code{-copyts} option
(unless wrapping is detected).
If a timestamp discontinuity is detected whose absolute value is
@ -1867,7 +2065,7 @@ seconds.
The timestamp correction enabled by this option is only applied to
input formats not accepting timestamp discontinuity (for which the
@code{AV_FMT_DISCONT} flag is not enabled).
@code{AVFMT_TS_DISCONT} flag is not enabled).
If a timestamp discontinuity is detected whose absolute value is
greater than @var{threshold}, ffmpeg will drop the PTS/DTS timestamp
@ -1892,16 +2090,36 @@ an output mpegts file:
ffmpeg -i inurl -streamid 0:33 -streamid 1:36 out.ts
@end example
@item -bsf[:@var{stream_specifier}] @var{bitstream_filters} (@emph{output,per-stream})
Set bitstream filters for matching streams. @var{bitstream_filters} is
a comma-separated list of bitstream filters. Use the @code{-bsfs} option
to get the list of bitstream filters.
@item -bsf[:@var{stream_specifier}] @var{bitstream_filters} (@emph{input/output,per-stream})
Apply bitstream filters to matching streams. The filters are applied to each
packet as it is received from the demuxer (when used as an input option) or
before it is sent to the muxer (when used as an output option).
@var{bitstream_filters} is a comma-separated list of bitstream filter
specifications, each of the form
@example
ffmpeg -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264
@var{filter}[=@var{optname0}=@var{optval0}:@var{optname1}=@var{optval1}:...]
@end example
Any of the ',=:' characters that are to be a part of an option value need to be
escaped with a backslash.
Use the @code{-bsfs} option to get the list of bitstream filters.
E.g.
@example
ffmpeg -bsf:v h264_mp4toannexb -i h264.mp4 -c:v copy -an out.h264
@end example
applies the @code{h264_mp4toannexb} bitstream filter (which converts
MP4-encapsulated H.264 stream to Annex B) to the @emph{input} video stream.
On the other hand,
@example
ffmpeg -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt
@end example
applies the @code{mov2textsub} bitstream filter (which extracts text from MOV
subtitles) to the @emph{output} subtitle stream. Note, however, that since both
examples use @code{-c copy}, it matters little whether the filters are applied
on input or output - that would change if transcoding was happening.
@item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{input/output,per-stream})
Force a tag/fourcc for matching streams.
@ -1921,11 +2139,16 @@ type -- see the @option{-filter} options. @var{filtergraph} is a description of
the filtergraph, as described in the ``Filtergraph syntax'' section of the
ffmpeg-filters manual.
Input link labels must refer to input streams using the
@code{[file_index:stream_specifier]} syntax (i.e. the same as @option{-map}
uses). If @var{stream_specifier} matches multiple streams, the first one will be
used. An unlabeled input will be connected to the first unused input stream of
the matching type.
Input link labels must refer to either input streams or loopback decoders. For
input streams, use the @code{[file_index:stream_specifier]} syntax (i.e. the
same as @option{-map} uses). If @var{stream_specifier} matches multiple streams,
the first one will be used.
For decoders, the link label must be [dec:@var{dec_idx}], where @var{dec_idx} is
the index of the loopback decoder to be connected to given input.
An unlabeled input will be connected to the first unused input stream of the
matching type.
Output link labels are referred to with @option{-map}. Unlabeled outputs are
added to the first output file.
@ -1986,12 +2209,6 @@ The default is the number of available CPUs.
Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or
outputs. Equivalent to @option{-filter_complex}.
@anchor{filter_complex_script option}
@item -filter_complex_script @var{filename} (@emph{global})
This option is similar to @option{-filter_complex}, the only difference is that
its argument is the name of the file from which a complex filtergraph
description is to be read.
@item -accurate_seek (@emph{input})
This option enables or disables accurate seeking in input files with the
@option{-ss} option. It is enabled by default, so seeking is accurate when
@ -2185,11 +2402,14 @@ Number of audio samples in the frame.
Size of the encoded packet in bytes.
@item br (@emph{packet})
Current bitrate in bits per second. Post-encoding only.
Current bitrate in bits per second.
@item abr (@emph{packet})
Average bitrate for the whole stream so far, in bits per second, -1 if it cannot
be determined at this point. Post-encoding only.
be determined at this point.
@item key (@emph{packet})
Character 'K' if the packet contains a keyframe, character 'N' otherwise.
@end table
Directives tagged with @emph{packet} may only be used with

View File

@ -196,6 +196,18 @@ will produce a thread pool with this many threads available for parallel
processing. The default is 0 which means that the thread count will be
determined by the number of available CPUs.
@item -enable_vulkan
Use vulkan renderer rather than SDL builtin renderer. Depends on libplacebo.
@item -vulkan_params
Vulkan configuration using a list of @var{key}=@var{value} pairs separated by
":".
@item -hwaccel
Use HW accelerated decoding. Enable this option will enable vulkan renderer
automatically.
@end table
@section While playing

View File

@ -41,15 +41,15 @@ ffprobe will show it.
ffprobe output is designed to be easily parsable by a textual filter,
and consists of one or more sections of a form defined by the selected
writer, which is specified by the @option{print_format} option.
writer, which is specified by the @option{output_format} option.
Sections may contain other nested sections, and are identified by a
name (which may be shared by other sections), and an unique
name. See the output of @option{sections}.
Metadata tags stored in the container or in the streams are recognized
and printed in the corresponding "FORMAT", "STREAM" or "PROGRAM_STREAM"
section.
and printed in the corresponding "FORMAT", "STREAM", "STREAM_GROUP_STREAM"
or "PROGRAM_STREAM" section.
@c man end
@ -83,7 +83,7 @@ Use sexagesimal format HH:MM:SS.MICROSECONDS for time values.
Prettify the format of the displayed values, it corresponds to the
options "-unit -prefix -byte_binary_prefix -sexagesimal".
@item -of, -print_format @var{writer_name}[=@var{writer_options}]
@item -output_format, -of, -print_format @var{writer_name}[=@var{writer_options}]
Set the output printing format.
@var{writer_name} specifies the name of the writer, and
@ -91,7 +91,7 @@ Set the output printing format.
For example for printing the output in JSON format, specify:
@example
-print_format json
-output_format json
@end example
For more details on the available output printing formats, see the
@ -232,6 +232,13 @@ multimedia stream.
Each media stream information is printed within a dedicated section
with name "PROGRAM_STREAM".
@item -show_stream_groups
Show information about stream groups and their streams contained in the
input multimedia stream.
Each media stream information is printed within a dedicated section
with name "STREAM_GROUP_STREAM".
@item -show_chapters
Show information about chapters stored in the format.
@ -415,8 +422,9 @@ keyN=valN
[/SECTION]
@end example
Metadata tags are printed as a line in the corresponding FORMAT, STREAM or
PROGRAM_STREAM section, and are prefixed by the string "TAG:".
Metadata tags are printed as a line in the corresponding FORMAT, STREAM,
STREAM_GROUP_STREAM or PROGRAM_STREAM section, and are prefixed by the
string "TAG:".
A description of the accepted options follows.

View File

@ -1,393 +1,527 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ffmpeg.org/schema/ffprobe"
xmlns:ffprobe="http://www.ffmpeg.org/schema/ffprobe">
targetNamespace="http://www.ffmpeg.org/schema/ffprobe"
xmlns:ffprobe="http://www.ffmpeg.org/schema/ffprobe">
<xsd:element name="ffprobe" type="ffprobe:ffprobeType"/>
<xsd:element name="ffprobe" type="ffprobe:ffprobeType"/>
<xsd:complexType name="ffprobeType">
<xsd:sequence>
<xsd:element name="program_version" type="ffprobe:programVersionType" minOccurs="0" maxOccurs="1" />
<xsd:element name="library_versions" type="ffprobe:libraryVersionsType" minOccurs="0" maxOccurs="1" />
<xsd:element name="pixel_formats" type="ffprobe:pixelFormatsType" minOccurs="0" maxOccurs="1" />
<xsd:element name="packets" type="ffprobe:packetsType" minOccurs="0" maxOccurs="1" />
<xsd:element name="frames" type="ffprobe:framesType" minOccurs="0" maxOccurs="1" />
<xsd:element name="packets_and_frames" type="ffprobe:packetsAndFramesType" minOccurs="0" maxOccurs="1" />
<xsd:element name="programs" type="ffprobe:programsType" minOccurs="0" maxOccurs="1" />
<xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1" />
<xsd:element name="chapters" type="ffprobe:chaptersType" minOccurs="0" maxOccurs="1" />
<xsd:element name="format" type="ffprobe:formatType" minOccurs="0" maxOccurs="1" />
<xsd:element name="error" type="ffprobe:errorType" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ffprobeType">
<xsd:sequence>
<xsd:element name="program_version" type="ffprobe:programVersionType" minOccurs="0" maxOccurs="1" />
<xsd:element name="library_versions" type="ffprobe:libraryVersionsType" minOccurs="0" maxOccurs="1" />
<xsd:element name="pixel_formats" type="ffprobe:pixelFormatsType" minOccurs="0" maxOccurs="1" />
<xsd:element name="packets" type="ffprobe:packetsType" minOccurs="0" maxOccurs="1" />
<xsd:element name="frames" type="ffprobe:framesType" minOccurs="0" maxOccurs="1" />
<xsd:element name="packets_and_frames" type="ffprobe:packetsAndFramesType" minOccurs="0" maxOccurs="1" />
<xsd:element name="programs" type="ffprobe:programsType" minOccurs="0" maxOccurs="1" />
<xsd:element name="stream_groups" type="ffprobe:StreamGroupsType" minOccurs="0" maxOccurs="1" />
<xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1" />
<xsd:element name="chapters" type="ffprobe:chaptersType" minOccurs="0" maxOccurs="1" />
<xsd:element name="format" type="ffprobe:formatType" minOccurs="0" maxOccurs="1" />
<xsd:element name="error" type="ffprobe:errorType" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="packetsType">
<xsd:sequence>
<xsd:element name="packet" type="ffprobe:packetType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="packetsType">
<xsd:sequence>
<xsd:element name="packet" type="ffprobe:packetType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="framesType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="frame" type="ffprobe:frameType"/>
<xsd:element name="subtitle" type="ffprobe:subtitleType"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="framesType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="frame" type="ffprobe:frameType"/>
<xsd:element name="subtitle" type="ffprobe:subtitleType"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="packetsAndFramesType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="packet" type="ffprobe:packetType"/>
<xsd:element name="frame" type="ffprobe:frameType"/>
<xsd:element name="subtitle" type="ffprobe:subtitleType"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="packetsAndFramesType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="packet" type="ffprobe:packetType"/>
<xsd:element name="frame" type="ffprobe:frameType"/>
<xsd:element name="subtitle" type="ffprobe:subtitleType"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="packetType">
<xsd:sequence>
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="side_data_list" type="ffprobe:packetSideDataListType" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:complexType name="tagsType">
<xsd:sequence>
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:attribute name="codec_type" type="xsd:string" use="required" />
<xsd:attribute name="stream_index" type="xsd:int" use="required" />
<xsd:attribute name="pts" type="xsd:long" />
<xsd:attribute name="pts_time" type="xsd:float" />
<xsd:attribute name="dts" type="xsd:long" />
<xsd:attribute name="dts_time" type="xsd:float" />
<xsd:attribute name="duration" type="xsd:long" />
<xsd:attribute name="duration_time" type="xsd:float" />
<xsd:attribute name="size" type="xsd:long" use="required" />
<xsd:attribute name="pos" type="xsd:long" />
<xsd:attribute name="flags" type="xsd:string" use="required" />
<xsd:attribute name="data" type="xsd:string" />
<xsd:attribute name="data_hash" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="packetType">
<xsd:sequence>
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="side_data_list" type="ffprobe:packetSideDataListType" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:complexType name="packetSideDataListType">
<xsd:sequence>
<xsd:element name="side_data" type="ffprobe:packetSideDataType" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="packetSideDataType">
<xsd:attribute name="side_data_type" type="xsd:string"/>
<xsd:attribute name="side_data_size" type="xsd:int" />
</xsd:complexType>
<xsd:attribute name="codec_type" type="xsd:string" use="required" />
<xsd:attribute name="stream_index" type="xsd:int" use="required" />
<xsd:attribute name="pts" type="xsd:long" />
<xsd:attribute name="pts_time" type="xsd:float" />
<xsd:attribute name="dts" type="xsd:long" />
<xsd:attribute name="dts_time" type="xsd:float" />
<xsd:attribute name="duration" type="xsd:long" />
<xsd:attribute name="duration_time" type="xsd:float" />
<xsd:attribute name="size" type="xsd:long" use="required" />
<xsd:attribute name="pos" type="xsd:long" />
<xsd:attribute name="flags" type="xsd:string" use="required" />
<xsd:attribute name="data" type="xsd:string" />
<xsd:attribute name="data_hash" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="frameType">
<xsd:sequence>
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="logs" type="ffprobe:logsType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="side_data_list" type="ffprobe:frameSideDataListType" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:complexType name="packetSideDataListType">
<xsd:sequence>
<xsd:element name="side_data" type="ffprobe:packetSideDataType" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:attribute name="media_type" type="xsd:string" use="required"/>
<xsd:attribute name="stream_index" type="xsd:int" />
<xsd:attribute name="key_frame" type="xsd:int" use="required"/>
<xsd:attribute name="pts" type="xsd:long" />
<xsd:attribute name="pts_time" type="xsd:float"/>
<xsd:attribute name="pkt_dts" type="xsd:long" />
<xsd:attribute name="pkt_dts_time" type="xsd:float"/>
<xsd:attribute name="best_effort_timestamp" type="xsd:long" />
<xsd:attribute name="best_effort_timestamp_time" type="xsd:float" />
<xsd:attribute name="pkt_duration" type="xsd:long" />
<xsd:attribute name="pkt_duration_time" type="xsd:float"/>
<xsd:attribute name="duration" type="xsd:long" />
<xsd:attribute name="duration_time" type="xsd:float"/>
<xsd:attribute name="pkt_pos" type="xsd:long" />
<xsd:attribute name="pkt_size" type="xsd:int" />
<xsd:complexType name="packetSideDataType">
<xsd:sequence>
<xsd:element name="side_datum" type="ffprobe:packetSideDatumType" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<!-- audio attributes -->
<xsd:attribute name="sample_fmt" type="xsd:string"/>
<xsd:attribute name="nb_samples" type="xsd:long" />
<xsd:attribute name="channels" type="xsd:int" />
<xsd:attribute name="channel_layout" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:string"/>
</xsd:complexType>
<!-- video attributes -->
<xsd:attribute name="width" type="xsd:long" />
<xsd:attribute name="height" type="xsd:long" />
<xsd:attribute name="crop_top" type="xsd:long" />
<xsd:attribute name="crop_bottom" type="xsd:long" />
<xsd:attribute name="crop_left" type="xsd:long" />
<xsd:attribute name="crop_right" type="xsd:long" />
<xsd:attribute name="pix_fmt" type="xsd:string"/>
<xsd:attribute name="sample_aspect_ratio" type="xsd:string"/>
<xsd:attribute name="pict_type" type="xsd:string"/>
<xsd:attribute name="coded_picture_number" type="xsd:long" />
<xsd:attribute name="display_picture_number" type="xsd:long" />
<xsd:attribute name="interlaced_frame" type="xsd:int" />
<xsd:attribute name="top_field_first" type="xsd:int" />
<xsd:attribute name="repeat_pict" type="xsd:int" />
<xsd:attribute name="color_range" type="xsd:string"/>
<xsd:attribute name="color_space" type="xsd:string"/>
<xsd:attribute name="color_primaries" type="xsd:string"/>
<xsd:attribute name="color_transfer" type="xsd:string"/>
<xsd:attribute name="chroma_location" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="packetSideDatumType">
<xsd:attribute name="key" type="xsd:string"/>
<xsd:attribute name="value" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="logsType">
<xsd:sequence>
<xsd:element name="log" type="ffprobe:logType" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="logType">
<xsd:attribute name="context" type="xsd:string"/>
<xsd:attribute name="level" type="xsd:int" />
<xsd:attribute name="category" type="xsd:int" />
<xsd:attribute name="parent_context" type="xsd:string"/>
<xsd:attribute name="parent_category" type="xsd:int" />
<xsd:attribute name="message" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="frameType">
<xsd:sequence>
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="logs" type="ffprobe:logsType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="side_data_list" type="ffprobe:frameSideDataListType" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:complexType name="frameSideDataListType">
<xsd:sequence>
<xsd:element name="side_data" type="ffprobe:frameSideDataType" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="frameSideDataType">
<xsd:sequence>
<xsd:element name="timecodes" type="ffprobe:frameSideDataTimecodeList" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="media_type" type="xsd:string" use="required"/>
<xsd:attribute name="stream_index" type="xsd:int" />
<xsd:attribute name="key_frame" type="xsd:int" use="required"/>
<xsd:attribute name="pts" type="xsd:long" />
<xsd:attribute name="pts_time" type="xsd:float"/>
<xsd:attribute name="pkt_dts" type="xsd:long" />
<xsd:attribute name="pkt_dts_time" type="xsd:float"/>
<xsd:attribute name="best_effort_timestamp" type="xsd:long" />
<xsd:attribute name="best_effort_timestamp_time" type="xsd:float" />
<xsd:attribute name="duration" type="xsd:long" />
<xsd:attribute name="duration_time" type="xsd:float"/>
<xsd:attribute name="pkt_pos" type="xsd:long" />
<xsd:attribute name="pkt_size" type="xsd:int" />
<xsd:attribute name="side_data_type" type="xsd:string"/>
<xsd:attribute name="side_data_size" type="xsd:int" />
<xsd:attribute name="timecode" type="xsd:string"/>
</xsd:complexType>
<!-- audio attributes -->
<xsd:attribute name="sample_fmt" type="xsd:string"/>
<xsd:attribute name="nb_samples" type="xsd:long" />
<xsd:attribute name="channels" type="xsd:int" />
<xsd:attribute name="channel_layout" type="xsd:string"/>
<xsd:complexType name="frameSideDataTimecodeList">
<xsd:sequence>
<xsd:element name="timecode" type="ffprobe:frameSideDataTimecodeType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- video attributes -->
<xsd:attribute name="width" type="xsd:long" />
<xsd:attribute name="height" type="xsd:long" />
<xsd:attribute name="crop_top" type="xsd:long" />
<xsd:attribute name="crop_bottom" type="xsd:long" />
<xsd:attribute name="crop_left" type="xsd:long" />
<xsd:attribute name="crop_right" type="xsd:long" />
<xsd:attribute name="pix_fmt" type="xsd:string"/>
<xsd:attribute name="sample_aspect_ratio" type="xsd:string"/>
<xsd:attribute name="pict_type" type="xsd:string"/>
<xsd:attribute name="interlaced_frame" type="xsd:int" />
<xsd:attribute name="top_field_first" type="xsd:int" />
<xsd:attribute name="repeat_pict" type="xsd:int" />
<xsd:attribute name="color_range" type="xsd:string"/>
<xsd:attribute name="color_space" type="xsd:string"/>
<xsd:attribute name="color_primaries" type="xsd:string"/>
<xsd:attribute name="color_transfer" type="xsd:string"/>
<xsd:attribute name="chroma_location" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="frameSideDataTimecodeType">
<xsd:attribute name="value" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="logsType">
<xsd:sequence>
<xsd:element name="log" type="ffprobe:logType" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="logType">
<xsd:attribute name="context" type="xsd:string"/>
<xsd:attribute name="level" type="xsd:int" />
<xsd:attribute name="category" type="xsd:int" />
<xsd:attribute name="parent_context" type="xsd:string"/>
<xsd:attribute name="parent_category" type="xsd:int" />
<xsd:attribute name="message" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="subtitleType">
<xsd:attribute name="media_type" type="xsd:string" fixed="subtitle" use="required"/>
<xsd:attribute name="pts" type="xsd:long" />
<xsd:attribute name="pts_time" type="xsd:float"/>
<xsd:attribute name="format" type="xsd:int" />
<xsd:attribute name="start_display_time" type="xsd:int" />
<xsd:attribute name="end_display_time" type="xsd:int" />
<xsd:attribute name="num_rects" type="xsd:int" />
</xsd:complexType>
<xsd:complexType name="frameSideDataListType">
<xsd:sequence>
<xsd:element name="side_data" type="ffprobe:frameSideDataType" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="frameSideDataType">
<xsd:sequence>
<xsd:element name="timecodes" type="ffprobe:frameSideDataTimecodeList" minOccurs="0" maxOccurs="1"/>
<xsd:element name="components" type="ffprobe:frameSideDataComponentList" minOccurs="0" maxOccurs="1"/>
<xsd:element name="side_datum" type="ffprobe:frameSideDatumType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:complexType name="streamsType">
<xsd:sequence>
<xsd:element name="stream" type="ffprobe:streamType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:attribute name="side_data_type" type="xsd:string"/>
<xsd:attribute name="side_data_size" type="xsd:int" />
<xsd:attribute name="timecode" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="programsType">
<xsd:sequence>
<xsd:element name="program" type="ffprobe:programType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="frameSideDatumType">
<xsd:attribute name="key" type="xsd:string"/>
<xsd:attribute name="value" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="streamDispositionType">
<xsd:attribute name="default" type="xsd:int" use="required" />
<xsd:attribute name="dub" type="xsd:int" use="required" />
<xsd:attribute name="original" type="xsd:int" use="required" />
<xsd:attribute name="comment" type="xsd:int" use="required" />
<xsd:attribute name="lyrics" type="xsd:int" use="required" />
<xsd:attribute name="karaoke" type="xsd:int" use="required" />
<xsd:attribute name="forced" type="xsd:int" use="required" />
<xsd:attribute name="hearing_impaired" type="xsd:int" use="required" />
<xsd:attribute name="visual_impaired" type="xsd:int" use="required" />
<xsd:attribute name="clean_effects" type="xsd:int" use="required" />
<xsd:attribute name="attached_pic" type="xsd:int" use="required" />
<xsd:attribute name="timed_thumbnails" type="xsd:int" use="required" />
<xsd:attribute name="captions" type="xsd:int" use="required" />
<xsd:attribute name="descriptions" type="xsd:int" use="required" />
<xsd:attribute name="metadata" type="xsd:int" use="required" />
<xsd:attribute name="dependent" type="xsd:int" use="required" />
<xsd:attribute name="still_image" type="xsd:int" use="required" />
</xsd:complexType>
<xsd:complexType name="frameSideDataTimecodeList">
<xsd:sequence>
<xsd:element name="timecode" type="ffprobe:frameSideDataTimecodeType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="streamType">
<xsd:sequence>
<xsd:element name="disposition" type="ffprobe:streamDispositionType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="side_data_list" type="ffprobe:packetSideDataListType" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:complexType name="frameSideDataTimecodeType">
<xsd:attribute name="value" type="xsd:string"/>
</xsd:complexType>
<xsd:attribute name="index" type="xsd:int" use="required"/>
<xsd:attribute name="codec_name" type="xsd:string" />
<xsd:attribute name="codec_long_name" type="xsd:string" />
<xsd:attribute name="profile" type="xsd:string" />
<xsd:attribute name="codec_type" type="xsd:string" />
<xsd:attribute name="codec_tag" type="xsd:string" use="required"/>
<xsd:attribute name="codec_tag_string" type="xsd:string" use="required"/>
<xsd:attribute name="extradata" type="xsd:string" />
<xsd:attribute name="extradata_size" type="xsd:int" />
<xsd:attribute name="extradata_hash" type="xsd:string" />
<xsd:complexType name="frameSideDataComponentList">
<xsd:sequence>
<xsd:element name="component" type="ffprobe:frameSideDataComponentType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- video attributes -->
<xsd:attribute name="width" type="xsd:int"/>
<xsd:attribute name="height" type="xsd:int"/>
<xsd:attribute name="coded_width" type="xsd:int"/>
<xsd:attribute name="coded_height" type="xsd:int"/>
<xsd:attribute name="closed_captions" type="xsd:boolean"/>
<xsd:attribute name="film_grain" type="xsd:boolean"/>
<xsd:attribute name="has_b_frames" type="xsd:int"/>
<xsd:attribute name="sample_aspect_ratio" type="xsd:string"/>
<xsd:attribute name="display_aspect_ratio" type="xsd:string"/>
<xsd:attribute name="pix_fmt" type="xsd:string"/>
<xsd:attribute name="level" type="xsd:int"/>
<xsd:attribute name="color_range" type="xsd:string"/>
<xsd:attribute name="color_space" type="xsd:string"/>
<xsd:attribute name="color_transfer" type="xsd:string"/>
<xsd:attribute name="color_primaries" type="xsd:string"/>
<xsd:attribute name="chroma_location" type="xsd:string"/>
<xsd:attribute name="field_order" type="xsd:string"/>
<xsd:attribute name="refs" type="xsd:int"/>
<xsd:complexType name="frameSideDataComponentType">
<xsd:sequence>
<xsd:element name="pieces" type="ffprobe:frameSideDataPieceList" minOccurs="0" maxOccurs="1"/>
<xsd:element name="side_datum" type="ffprobe:frameSideDatumType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- audio attributes -->
<xsd:attribute name="sample_fmt" type="xsd:string"/>
<xsd:attribute name="sample_rate" type="xsd:int"/>
<xsd:attribute name="channels" type="xsd:int"/>
<xsd:attribute name="channel_layout" type="xsd:string"/>
<xsd:attribute name="bits_per_sample" type="xsd:int"/>
<xsd:attribute name="initial_padding" type="xsd:int"/>
<xsd:complexType name="frameSideDataPieceList">
<xsd:sequence>
<xsd:element name="piece" type="ffprobe:frameSideDataPieceType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="r_frame_rate" type="xsd:string" use="required"/>
<xsd:attribute name="avg_frame_rate" type="xsd:string" use="required"/>
<xsd:attribute name="time_base" type="xsd:string" use="required"/>
<xsd:attribute name="start_pts" type="xsd:long"/>
<xsd:attribute name="start_time" type="xsd:float"/>
<xsd:attribute name="duration_ts" type="xsd:long"/>
<xsd:attribute name="duration" type="xsd:float"/>
<xsd:attribute name="bit_rate" type="xsd:int"/>
<xsd:attribute name="max_bit_rate" type="xsd:int"/>
<xsd:attribute name="bits_per_raw_sample" type="xsd:int"/>
<xsd:attribute name="nb_frames" type="xsd:int"/>
<xsd:attribute name="nb_read_frames" type="xsd:int"/>
<xsd:attribute name="nb_read_packets" type="xsd:int"/>
</xsd:complexType>
<xsd:complexType name="frameSideDataPieceType">
<xsd:sequence>
<xsd:element name="side_datum" type="ffprobe:frameSideDatumType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="programType">
<xsd:sequence>
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:complexType name="subtitleType">
<xsd:attribute name="media_type" type="xsd:string" fixed="subtitle" use="required"/>
<xsd:attribute name="pts" type="xsd:long" />
<xsd:attribute name="pts_time" type="xsd:float"/>
<xsd:attribute name="format" type="xsd:int" />
<xsd:attribute name="start_display_time" type="xsd:int" />
<xsd:attribute name="end_display_time" type="xsd:int" />
<xsd:attribute name="num_rects" type="xsd:int" />
</xsd:complexType>
<xsd:attribute name="program_id" type="xsd:int" use="required"/>
<xsd:attribute name="program_num" type="xsd:int" use="required"/>
<xsd:attribute name="nb_streams" type="xsd:int" use="required"/>
<xsd:attribute name="pmt_pid" type="xsd:int" use="required"/>
<xsd:attribute name="pcr_pid" type="xsd:int" use="required"/>
</xsd:complexType>
<xsd:complexType name="streamsType">
<xsd:sequence>
<xsd:element name="stream" type="ffprobe:streamType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="formatType">
<xsd:sequence>
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:complexType name="programsType">
<xsd:sequence>
<xsd:element name="program" type="ffprobe:programType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:attribute name="filename" type="xsd:string" use="required"/>
<xsd:attribute name="nb_streams" type="xsd:int" use="required"/>
<xsd:attribute name="nb_programs" type="xsd:int" use="required"/>
<xsd:attribute name="format_name" type="xsd:string" use="required"/>
<xsd:attribute name="format_long_name" type="xsd:string"/>
<xsd:attribute name="start_time" type="xsd:float"/>
<xsd:attribute name="duration" type="xsd:float"/>
<xsd:attribute name="size" type="xsd:long"/>
<xsd:attribute name="bit_rate" type="xsd:long"/>
<xsd:attribute name="probe_score" type="xsd:int"/>
</xsd:complexType>
<xsd:complexType name="StreamGroupsType">
<xsd:sequence>
<xsd:element name="stream_group" type="ffprobe:streamGroupType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tagType">
<xsd:attribute name="key" type="xsd:string" use="required"/>
<xsd:attribute name="value" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="streamDispositionType">
<xsd:attribute name="default" type="xsd:int" use="required" />
<xsd:attribute name="dub" type="xsd:int" use="required" />
<xsd:attribute name="original" type="xsd:int" use="required" />
<xsd:attribute name="comment" type="xsd:int" use="required" />
<xsd:attribute name="lyrics" type="xsd:int" use="required" />
<xsd:attribute name="karaoke" type="xsd:int" use="required" />
<xsd:attribute name="forced" type="xsd:int" use="required" />
<xsd:attribute name="hearing_impaired" type="xsd:int" use="required" />
<xsd:attribute name="visual_impaired" type="xsd:int" use="required" />
<xsd:attribute name="clean_effects" type="xsd:int" use="required" />
<xsd:attribute name="attached_pic" type="xsd:int" use="required" />
<xsd:attribute name="timed_thumbnails" type="xsd:int" use="required" />
<xsd:attribute name="non_diegetic" type="xsd:int" use="required" />
<xsd:attribute name="captions" type="xsd:int" use="required" />
<xsd:attribute name="descriptions" type="xsd:int" use="required" />
<xsd:attribute name="metadata" type="xsd:int" use="required" />
<xsd:attribute name="dependent" type="xsd:int" use="required" />
<xsd:attribute name="still_image" type="xsd:int" use="required" />
</xsd:complexType>
<xsd:complexType name="errorType">
<xsd:attribute name="code" type="xsd:int" use="required"/>
<xsd:attribute name="string" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="streamType">
<xsd:sequence>
<xsd:element name="disposition" type="ffprobe:streamDispositionType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="side_data_list" type="ffprobe:packetSideDataListType" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:complexType name="programVersionType">
<xsd:attribute name="version" type="xsd:string" use="required"/>
<xsd:attribute name="copyright" type="xsd:string" use="required"/>
<xsd:attribute name="build_date" type="xsd:string"/>
<xsd:attribute name="build_time" type="xsd:string"/>
<xsd:attribute name="compiler_ident" type="xsd:string" use="required"/>
<xsd:attribute name="configuration" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:attribute name="index" type="xsd:int" use="required"/>
<xsd:attribute name="codec_name" type="xsd:string" />
<xsd:attribute name="codec_long_name" type="xsd:string" />
<xsd:attribute name="profile" type="xsd:string" />
<xsd:attribute name="codec_type" type="xsd:string" />
<xsd:attribute name="codec_tag" type="xsd:string" use="required"/>
<xsd:attribute name="codec_tag_string" type="xsd:string" use="required"/>
<xsd:attribute name="extradata" type="xsd:string" />
<xsd:attribute name="extradata_size" type="xsd:int" />
<xsd:attribute name="extradata_hash" type="xsd:string" />
<xsd:complexType name="chaptersType">
<xsd:sequence>
<xsd:element name="chapter" type="ffprobe:chapterType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- video attributes -->
<xsd:attribute name="width" type="xsd:int"/>
<xsd:attribute name="height" type="xsd:int"/>
<xsd:attribute name="coded_width" type="xsd:int"/>
<xsd:attribute name="coded_height" type="xsd:int"/>
<xsd:attribute name="closed_captions" type="xsd:boolean"/>
<xsd:attribute name="film_grain" type="xsd:boolean"/>
<xsd:attribute name="has_b_frames" type="xsd:int"/>
<xsd:attribute name="sample_aspect_ratio" type="xsd:string"/>
<xsd:attribute name="display_aspect_ratio" type="xsd:string"/>
<xsd:attribute name="pix_fmt" type="xsd:string"/>
<xsd:attribute name="level" type="xsd:int"/>
<xsd:attribute name="color_range" type="xsd:string"/>
<xsd:attribute name="color_space" type="xsd:string"/>
<xsd:attribute name="color_transfer" type="xsd:string"/>
<xsd:attribute name="color_primaries" type="xsd:string"/>
<xsd:attribute name="chroma_location" type="xsd:string"/>
<xsd:attribute name="field_order" type="xsd:string"/>
<xsd:attribute name="refs" type="xsd:int"/>
<xsd:complexType name="chapterType">
<xsd:sequence>
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<!-- audio attributes -->
<xsd:attribute name="sample_fmt" type="xsd:string"/>
<xsd:attribute name="sample_rate" type="xsd:int"/>
<xsd:attribute name="channels" type="xsd:int"/>
<xsd:attribute name="channel_layout" type="xsd:string"/>
<xsd:attribute name="bits_per_sample" type="xsd:int"/>
<xsd:attribute name="initial_padding" type="xsd:int"/>
<xsd:attribute name="id" type="xsd:int" use="required"/>
<xsd:attribute name="time_base" type="xsd:string" use="required"/>
<xsd:attribute name="start" type="xsd:int" use="required"/>
<xsd:attribute name="start_time" type="xsd:float"/>
<xsd:attribute name="end" type="xsd:int" use="required"/>
<xsd:attribute name="end_time" type="xsd:float" use="required"/>
</xsd:complexType>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="r_frame_rate" type="xsd:string" use="required"/>
<xsd:attribute name="avg_frame_rate" type="xsd:string" use="required"/>
<xsd:attribute name="time_base" type="xsd:string" use="required"/>
<xsd:attribute name="start_pts" type="xsd:long"/>
<xsd:attribute name="start_time" type="xsd:float"/>
<xsd:attribute name="duration_ts" type="xsd:long"/>
<xsd:attribute name="duration" type="xsd:float"/>
<xsd:attribute name="bit_rate" type="xsd:int"/>
<xsd:attribute name="max_bit_rate" type="xsd:int"/>
<xsd:attribute name="bits_per_raw_sample" type="xsd:int"/>
<xsd:attribute name="nb_frames" type="xsd:int"/>
<xsd:attribute name="nb_read_frames" type="xsd:int"/>
<xsd:attribute name="nb_read_packets" type="xsd:int"/>
</xsd:complexType>
<xsd:complexType name="libraryVersionType">
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="major" type="xsd:int" use="required"/>
<xsd:attribute name="minor" type="xsd:int" use="required"/>
<xsd:attribute name="micro" type="xsd:int" use="required"/>
<xsd:attribute name="version" type="xsd:int" use="required"/>
<xsd:attribute name="ident" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="programType">
<xsd:sequence>
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:complexType name="libraryVersionsType">
<xsd:sequence>
<xsd:element name="library_version" type="ffprobe:libraryVersionType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:attribute name="program_id" type="xsd:int" use="required"/>
<xsd:attribute name="program_num" type="xsd:int" use="required"/>
<xsd:attribute name="nb_streams" type="xsd:int" use="required"/>
<xsd:attribute name="pmt_pid" type="xsd:int" use="required"/>
<xsd:attribute name="pcr_pid" type="xsd:int" use="required"/>
</xsd:complexType>
<xsd:complexType name="pixelFormatFlagsType">
<xsd:attribute name="big_endian" type="xsd:int" use="required"/>
<xsd:attribute name="palette" type="xsd:int" use="required"/>
<xsd:attribute name="bitstream" type="xsd:int" use="required"/>
<xsd:attribute name="hwaccel" type="xsd:int" use="required"/>
<xsd:attribute name="planar" type="xsd:int" use="required"/>
<xsd:attribute name="rgb" type="xsd:int" use="required"/>
<xsd:attribute name="alpha" type="xsd:int" use="required"/>
</xsd:complexType>
<xsd:complexType name="streamGroupType">
<xsd:sequence>
<xsd:element name="disposition" type="ffprobe:streamDispositionType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="components" type="ffprobe:streamGroupComponentList" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:complexType name="pixelFormatComponentType">
<xsd:attribute name="index" type="xsd:int" use="required"/>
<xsd:attribute name="bit_depth" type="xsd:int" use="required"/>
</xsd:complexType>
<xsd:attribute name="index" type="xsd:int" use="required"/>
<xsd:attribute name="nb_streams" type="xsd:int" use="required"/>
<xsd:attribute name="type" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="pixelFormatComponentsType">
<xsd:sequence>
<xsd:element name="component" type="ffprobe:pixelFormatComponentType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="streamGroupComponentList">
<xsd:sequence>
<xsd:element name="component" type="ffprobe:streamGroupComponentType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="pixelFormatType">
<xsd:sequence>
<xsd:element name="flags" type="ffprobe:pixelFormatFlagsType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="components" type="ffprobe:pixelFormatComponentsType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:complexType name="streamGroupComponentType">
<xsd:sequence>
<xsd:element name="subcomponents" type="ffprobe:streamGroupSubComponentList" minOccurs="0" maxOccurs="1"/>
<xsd:element name="component_entry" type="ffprobe:streamGroupEntryType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="nb_components" type="xsd:int" use="required"/>
<xsd:attribute name="log2_chroma_w" type="xsd:int"/>
<xsd:attribute name="log2_chroma_h" type="xsd:int"/>
<xsd:attribute name="bits_per_pixel" type="xsd:int"/>
</xsd:complexType>
<xsd:complexType name="streamGroupSubComponentList">
<xsd:sequence>
<xsd:element name="subcomponent" type="ffprobe:streamGroupSubComponentType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="pixelFormatsType">
<xsd:sequence>
<xsd:element name="pixel_format" type="ffprobe:pixelFormatType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="streamGroupSubComponentType">
<xsd:sequence>
<xsd:element name="pieces" type="ffprobe:streamGroupPieceList" minOccurs="0" maxOccurs="1"/>
<xsd:element name="subcomponent_entry" type="ffprobe:streamGroupEntryType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="streamGroupPieceList">
<xsd:sequence>
<xsd:element name="piece" type="ffprobe:streamGroupPieceType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="streamGroupPieceType">
<xsd:sequence>
<xsd:element name="subpieces" type="ffprobe:streamGroupSubPieceList" minOccurs="0" maxOccurs="1"/>
<xsd:element name="piece_entry" type="ffprobe:streamGroupEntryType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="streamGroupSubPieceList">
<xsd:sequence>
<xsd:element name="subpiece" type="ffprobe:streamGroupSubPieceType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="streamGroupSubPieceType">
<xsd:sequence>
<xsd:element name="blocks" type="ffprobe:streamGroupBlockList" minOccurs="0" maxOccurs="1"/>
<xsd:element name="subpiece_entry" type="ffprobe:streamGroupEntryType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="streamGroupBlockList">
<xsd:sequence>
<xsd:element name="block" type="ffprobe:streamGroupBlockType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="streamGroupBlockType">
<xsd:sequence>
<xsd:element name="block_entry" type="ffprobe:streamGroupEntryType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="streamGroupEntryType">
<xsd:attribute name="key" type="xsd:string"/>
<xsd:attribute name="value" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="formatType">
<xsd:sequence>
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="filename" type="xsd:string" use="required"/>
<xsd:attribute name="nb_streams" type="xsd:int" use="required"/>
<xsd:attribute name="nb_programs" type="xsd:int" use="required"/>
<xsd:attribute name="nb_stream_groups" type="xsd:int" use="required"/>
<xsd:attribute name="format_name" type="xsd:string" use="required"/>
<xsd:attribute name="format_long_name" type="xsd:string"/>
<xsd:attribute name="start_time" type="xsd:float"/>
<xsd:attribute name="duration" type="xsd:float"/>
<xsd:attribute name="size" type="xsd:long"/>
<xsd:attribute name="bit_rate" type="xsd:long"/>
<xsd:attribute name="probe_score" type="xsd:int"/>
</xsd:complexType>
<xsd:complexType name="tagType">
<xsd:attribute name="key" type="xsd:string" use="required"/>
<xsd:attribute name="value" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="errorType">
<xsd:attribute name="code" type="xsd:int" use="required"/>
<xsd:attribute name="string" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="programVersionType">
<xsd:attribute name="version" type="xsd:string" use="required"/>
<xsd:attribute name="copyright" type="xsd:string" use="required"/>
<xsd:attribute name="build_date" type="xsd:string"/>
<xsd:attribute name="build_time" type="xsd:string"/>
<xsd:attribute name="compiler_ident" type="xsd:string" use="required"/>
<xsd:attribute name="configuration" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="chaptersType">
<xsd:sequence>
<xsd:element name="chapter" type="ffprobe:chapterType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="chapterType">
<xsd:sequence>
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:int" use="required"/>
<xsd:attribute name="time_base" type="xsd:string" use="required"/>
<xsd:attribute name="start" type="xsd:int" use="required"/>
<xsd:attribute name="start_time" type="xsd:float"/>
<xsd:attribute name="end" type="xsd:int" use="required"/>
<xsd:attribute name="end_time" type="xsd:float" use="required"/>
</xsd:complexType>
<xsd:complexType name="libraryVersionType">
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="major" type="xsd:int" use="required"/>
<xsd:attribute name="minor" type="xsd:int" use="required"/>
<xsd:attribute name="micro" type="xsd:int" use="required"/>
<xsd:attribute name="version" type="xsd:int" use="required"/>
<xsd:attribute name="ident" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="libraryVersionsType">
<xsd:sequence>
<xsd:element name="library_version" type="ffprobe:libraryVersionType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="pixelFormatFlagsType">
<xsd:attribute name="big_endian" type="xsd:int" use="required"/>
<xsd:attribute name="palette" type="xsd:int" use="required"/>
<xsd:attribute name="bitstream" type="xsd:int" use="required"/>
<xsd:attribute name="hwaccel" type="xsd:int" use="required"/>
<xsd:attribute name="planar" type="xsd:int" use="required"/>
<xsd:attribute name="rgb" type="xsd:int" use="required"/>
<xsd:attribute name="alpha" type="xsd:int" use="required"/>
</xsd:complexType>
<xsd:complexType name="pixelFormatComponentType">
<xsd:attribute name="index" type="xsd:int" use="required"/>
<xsd:attribute name="bit_depth" type="xsd:int" use="required"/>
</xsd:complexType>
<xsd:complexType name="pixelFormatComponentsType">
<xsd:sequence>
<xsd:element name="component" type="ffprobe:pixelFormatComponentType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="pixelFormatType">
<xsd:sequence>
<xsd:element name="flags" type="ffprobe:pixelFormatFlagsType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="components" type="ffprobe:pixelFormatComponentsType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="nb_components" type="xsd:int" use="required"/>
<xsd:attribute name="log2_chroma_w" type="xsd:int"/>
<xsd:attribute name="log2_chroma_h" type="xsd:int"/>
<xsd:attribute name="bits_per_pixel" type="xsd:int"/>
</xsd:complexType>
<xsd:complexType name="pixelFormatsType">
<xsd:sequence>
<xsd:element name="pixel_format" type="ffprobe:pixelFormatType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

View File

@ -13,6 +13,15 @@ corresponding value to true. They can be set to false by prefixing
the option name with "no". For example using "-nofoo"
will set the boolean option with name "foo" to false.
Options that take arguments support a special syntax where the argument given on
the command line is interpreted as a path to the file from which the actual
argument value is loaded. To use this feature, add a forward slash '/'
immediately before the option name (after the leading dash). E.g.
@example
ffmpeg -i INPUT -/filter:v filter.script OUTPUT
@end example
will load a filtergraph description from the file named @file{filter.script}.
@anchor{Stream specifiers}
@section Stream specifiers
Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers
@ -37,9 +46,9 @@ Matches the stream with this index. E.g. @code{-threads:1 4} would set the
thread count for the second stream to 4. If @var{stream_index} is used as an
additional stream specifier (see below), then it selects stream number
@var{stream_index} from the matching streams. Stream numbering is based on the
order of the streams as detected by libavformat except when a program ID is
also specified. In this case it is based on the ordering of the streams in the
program.
order of the streams as detected by libavformat except when a stream group
specifier or program ID is also specified. In this case it is based on the
ordering of the streams in the group or program.
@item @var{stream_type}[:@var{additional_stream_specifier}]
@var{stream_type} is one of following: 'v' or 'V' for video, 'a' for audio, 's'
for subtitle, 'd' for data, and 't' for attachments. 'v' matches all video
@ -48,6 +57,17 @@ thumbnails or cover arts. If @var{additional_stream_specifier} is used, then
it matches streams which both have this type and match the
@var{additional_stream_specifier}. Otherwise, it matches all streams of the
specified type.
@item g:@var{group_specifier}[:@var{additional_stream_specifier}]
Matches streams which are in the group with the specifier @var{group_specifier}.
if @var{additional_stream_specifier} is used, then it matches streams which both
are part of the group and match the @var{additional_stream_specifier}.
@var{group_specifier} may be one of the following:
@table @option
@item @var{group_index}
Match the stream with this group index.
@item #@var{group_id} or i:@var{group_id}
Match the stream with this group id.
@end table
@item p:@var{program_id}[:@var{additional_stream_specifier}]
Matches streams which are in the program with the id @var{program_id}. If
@var{additional_stream_specifier} is used, then it matches streams which both

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,8 @@ Enable fast, but inaccurate seeks for some formats.
@item genpts
Generate missing PTS if DTS is present.
@item igndts
Ignore DTS if PTS is set. Inert when nofillin is set.
Ignore DTS if PTS is also set. In case the PTS is set, the DTS value
is set to NOPTS. This is ignored when the @code{nofillin} flag is set.
@item ignidx
Ignore index.
@item nobuffer

View File

@ -343,6 +343,22 @@ libxavs2 is under the GNU Public License Version 2 or later
details), you must upgrade FFmpeg's license to GPL in order to use it.
@end float
@section eXtra-fast Essential Video Encoder (XEVE)
FFmpeg can make use of the XEVE library for EVC video encoding.
Go to @url{https://github.com/mpeg5/xeve} and follow the instructions for
installing the XEVE library. Then pass @code{--enable-libxeve} to configure to
enable it.
@section eXtra-fast Essential Video Decoder (XEVD)
FFmpeg can make use of the XEVD library for EVC video decoding.
Go to @url{https://github.com/mpeg5/xevd} and follow the instructions for
installing the XEVD library. Then pass @code{--enable-libxevd} to configure to
enable it.
@section ZVBI
ZVBI is a VBI decoding library which can be used by FFmpeg to decode DVB
@ -598,6 +614,7 @@ library:
@item raw DTS @tab X @tab X
@item raw DTS-HD @tab @tab X
@item raw E-AC-3 @tab X @tab X
@item raw EVC @tab X @tab X
@item raw FLAC @tab X @tab X
@item raw GSM @tab @tab X
@item raw H.261 @tab X @tab X
@ -653,7 +670,8 @@ library:
@item Redirector @tab @tab X
@item RedSpark @tab @tab X
@item Renderware TeXture Dictionary @tab @tab X
@item Resolume DXV @tab @tab X
@item Resolume DXV @tab X @tab X
@tab Encoding is only supported for the DXT1 (Normal Quality, No Alpha) texture format.
@item RF64 @tab @tab X
@item RL2 @tab @tab X
@tab Audio and video format used in some games by Entertainment Software Partners.
@ -944,6 +962,8 @@ following image formats are supported:
@item Electronic Arts TQI video @tab @tab X
@item Escape 124 @tab @tab X
@item Escape 130 @tab @tab X
@item EVC / MPEG-5 Part 1 @tab E @tab E
@tab encoding and decoding supported through external libraries libxeve and libxevd
@item FFmpeg video codec #1 @tab X @tab X
@tab lossless codec (fourcc: FFV1)
@item Flash Screen Video v1 @tab X @tab X
@ -997,6 +1017,7 @@ following image formats are supported:
@item Lagarith @tab @tab X
@item LCL (LossLess Codec Library) MSZH @tab @tab X
@item LCL (LossLess Codec Library) ZLIB @tab E @tab E
@item LEAD MCMP @tab @tab X
@item LOCO @tab @tab X
@item LucasArts SANM/Smush @tab @tab X
@tab Used in LucasArts games / SMUSH animations.

View File

@ -66,7 +66,7 @@ This will put the FFmpeg sources into the directory @var{<target>} and let
you push back your changes to the remote repository.
@example
git clone gil@@ffmpeg.org:ffmpeg-web <target>
git clone git@@ffmpeg.org:ffmpeg-web <target>
@end example
This will put the source of the FFmpeg website into the directory

View File

@ -222,7 +222,8 @@ $ ffmpeg -f avfoundation -capture_raw_data true -i "zr100:none" out.dv
@section bktr
BSD video input device.
BSD video input device. Deprecated and will be removed - please contact
the developers if you are interested in maintaining it.
@subsection Options
@ -722,7 +723,7 @@ Win32 GDI-based screen capture device.
This device allows you to capture a region of the display on Windows.
There are two options for the input filename:
Amongst options for the imput filenames are such elements as:
@example
desktop
@end example
@ -730,9 +731,13 @@ or
@example
title=@var{window_title}
@end example
or
@example
hwnd=@var{window_hwnd}
@end example
The first option will capture the entire desktop, or a fixed region of the
desktop. The second option will instead capture the contents of a single
desktop. The second and third options will instead capture the contents of a single
window, regardless of its position on the screen.
For example, to grab the entire desktop using @command{ffmpeg}:

94
doc/infra.txt Normal file
View File

@ -0,0 +1,94 @@
FFmpeg Infrastructure:
======================
Servers:
~~~~~~~~
Main Server:
------------
Our Main server is hosted at telepoint.bg
for more details see: https://www.ffmpeg.org/#thanks_sponsor_0001
Nothing runs on our main server directly, instead several VMs run on it.
ffmpeg.org VM:
--------------
Web, mail, and public facing git, also website git
fftrac VM:
----------
trac.ffmpeg.org Issue tracking
ffaux VM:
---------
patchwork.ffmpeg.org Patch tracking
vote.ffmpeg.org Condorcet voting
fate:
-----
fate.ffmpeg.org FFmpeg automated testing environment
coverage:
---------
coverage.ffmpeg.org Fate code coverage
The main and fate server as well as VMs currently run ubuntu
Cronjobs:
~~~~~~~~~
Part of the docs is in the main ffmpeg repository as texi files, this part is build by a cronjob. So is the
doxygen stuff as well as the FFmpeg git snapshot.
These 3 scripts are under the ffcron user
Git:
~~~~
Public facing git is provided by our infra, (https://git.ffmpeg.org/gitweb)
main developer ffmpeg git repository for historic reasons is provided by (git@source.ffmpeg.org:ffmpeg)
Other developer git repositories are provided via git@git.ffmpeg.org:<NAME_OF_REPOSITORY>
git mirrors are available on https://github.com/FFmpeg
(there are some exceptions where primary repositories are on github or elsewhere instead of the mirrors)
Github mirrors are redundantly synced by multiple people
You need a new git repository related to FFmpeg ? contact root at ffmpeg.org
Fate:
~~~~~
fatesamples are provided via rsync. Every FFmpeg developer who has a shell account in ffmpeg.org
should be in the samples group and be able to upload samples.
See https://www.ffmpeg.org/fate.html#Uploading-new-samples-to-the-fate-suite
Accounts:
~~~~~~~~~
You need an account for some FFmpeg work? Send mail to root at ffmpeg.org
VMs:
~~~~
You need a VM, docker container for FFmpeg? contact root at ffmpeg.org
(for docker, CC Andriy)
IRC:
~~~~
irc channels are at https://libera.chat/
irc channel archives are at https://libera.irclog.whitequark.org

View File

@ -1,3 +1,4 @@
@anchor{metadata}
@chapter Metadata
@c man begin METADATA

View File

@ -48,11 +48,6 @@ Files that have MIPS copyright notice in them:
float_dsp_mips.c
libm_mips.h
softfloat_tables.h
* libavcodec/
fft_fixed_32.c
fft_init_table.c
fft_table.h
mdct_fixed_32.c
* libavcodec/mips/
aacdec_fixed.c
aacsbr_fixed.c
@ -70,9 +65,6 @@ Files that have MIPS copyright notice in them:
compute_antialias_float.h
lsp_mips.h
dsputil_mips.c
fft_mips.c
fft_table.h
fft_init_table.c
fmtconvert_mips.c
iirfilter_mips.c
mpegaudiodsp_mips_fixed.c

View File

@ -55,8 +55,7 @@ speed gain at this point but it should work.
If there are inter-frame dependencies, so the codec calls
ff_thread_report/await_progress(), set FF_CODEC_CAP_ALLOCATE_PROGRESS in
AVCodec.caps_internal and use ff_thread_get_buffer() to allocate frames. The
frames must then be freed with ff_thread_release_buffer().
FFCodec.caps_internal and use ff_thread_get_buffer() to allocate frames.
Otherwise decode directly into the user-supplied frames.
Call ff_thread_report_progress() after some part of the current picture has decoded.

File diff suppressed because it is too large Load Diff

View File

@ -302,7 +302,7 @@ ffmpeg -re -i INPUT -c:v rawvideo -pix_fmt bgra -f fbdev /dev/fb0
See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
@section opengl
OpenGL output device.
OpenGL output device. Deprecated and will be removed.
To enable this output device you need to configure FFmpeg with @code{--enable-opengl}.
@ -408,7 +408,13 @@ ffmpeg -i INPUT -f pulse "stream name"
@section sdl
SDL (Simple DirectMedia Layer) output device.
SDL (Simple DirectMedia Layer) output device. Deprecated and will be removed.
For monitoring purposes in FFmpeg, pipes and a video player such as ffplay can be used:
@example
ffmpeg -i INPUT -f nut -c:v rawvideo - | ffplay -
@end example
"sdl2" can be used as alias for "sdl".

View File

@ -20,8 +20,45 @@
# License along with FFmpeg; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# Texinfo 7.0 changed the syntax of various functions.
# Provide a shim for older versions.
sub ff_set_from_init_file($$) {
my $key = shift;
my $value = shift;
if (exists &{'texinfo_set_from_init_file'}) {
texinfo_set_from_init_file($key, $value);
} else {
set_from_init_file($key, $value);
}
}
sub ff_get_conf($) {
my $key = shift;
if (exists &{'texinfo_get_conf'}) {
texinfo_get_conf($key);
} else {
get_conf($key);
}
}
sub get_formatting_function($$) {
my $obj = shift;
my $func = shift;
my $sub = $obj->can('formatting_function');
if ($sub) {
return $obj->formatting_function($func);
} else {
return $obj->{$func};
}
}
# determine texinfo version
my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
# no navigation elements
set_from_init_file('HEADERS', 0);
ff_set_from_init_file('HEADERS', 0);
sub ffmpeg_heading_command($$$$$)
{
@ -55,7 +92,7 @@ sub ffmpeg_heading_command($$$$$)
$element = $command->{'parent'};
}
if ($element) {
$result .= &{$self->{'format_element_header'}}($self, $cmdname,
$result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
$command, $element);
}
@ -112,7 +149,11 @@ sub ffmpeg_heading_command($$$$$)
$cmdname
= $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
}
$result .= &{$self->{'format_heading_text'}}(
# format_heading_text expects an array of headings for texinfo >= 7.0
if ($program_version_num >= 7.000000) {
$heading = [$heading];
}
$result .= &{get_formatting_function($self,'format_heading_text')}(
$self, $cmdname, $heading,
$heading_level +
$self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
@ -126,23 +167,19 @@ foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
}
# determine if texinfo is at least version 6.8
my $program_version_num = version->declare(get_conf('PACKAGE_VERSION'))->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
# print the TOC where @contents is used
if ($program_version_6_8) {
set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline');
ff_set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline');
} else {
set_from_init_file('INLINE_CONTENTS', 1);
ff_set_from_init_file('INLINE_CONTENTS', 1);
}
# make chapters <h2>
set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
ff_set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
# Do not add <hr>
set_from_init_file('DEFAULT_RULE', '');
set_from_init_file('BIG_RULE', '');
ff_set_from_init_file('DEFAULT_RULE', '');
ff_set_from_init_file('BIG_RULE', '');
# Customized file beginning
sub ffmpeg_begin_file($$$)
@ -159,7 +196,18 @@ sub ffmpeg_begin_file($$$)
my ($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_informations($command);
$program, $generator);
if ($program_version_num >= 7.000000) {
($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_information($command);
} else {
($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_informations($command);
}
my $links = $self->_get_links ($filename, $element);
@ -223,7 +271,7 @@ if ($program_version_6_8) {
sub ffmpeg_end_file($)
{
my $self = shift;
my $program_string = &{$self->{'format_program_string'}}($self);
my $program_string = &{get_formatting_function($self,'format_program_string')}($self);
my $program_text = <<EOT;
<p style="font-size: small;">
$program_string
@ -244,7 +292,7 @@ if ($program_version_6_8) {
# Dummy title command
# Ignore title. Title is handled through ffmpeg_begin_file().
set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
ff_set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
sub ffmpeg_title($$$$)
{
return '';
@ -262,8 +310,14 @@ sub ffmpeg_float($$$$$)
my $args = shift;
my $content = shift;
my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
$command);
my ($caption, $prepended);
if ($program_version_num >= 7.000000) {
($caption, $prepended) = Texinfo::Convert::Converter::float_name_caption($self,
$command);
} else {
($caption, $prepended) = Texinfo::Common::float_name_caption($self,
$command);
}
my $caption_text = '';
my $prepended_text;
my $prepended_save = '';
@ -335,8 +389,13 @@ sub ffmpeg_float($$$$$)
$caption->{'args'}->[0], 'float caption');
}
if ($prepended_text.$caption_text ne '') {
$prepended_text = $self->_attribute_class('div','float-caption'). '>'
. $prepended_text;
if ($program_version_num >= 7.000000) {
$prepended_text = $self->html_attribute_class('div',['float-caption']). '>'
. $prepended_text;
} else {
$prepended_text = $self->_attribute_class('div','float-caption'). '>'
. $prepended_text;
}
$caption_text .= '</div>';
}
my $html_class = '';
@ -349,8 +408,13 @@ sub ffmpeg_float($$$$$)
$prepended_text = '';
$caption_text = '';
}
return $self->_attribute_class('div', $html_class). '>' . "\n" .
$prepended_text . $caption_text . $content . '</div>';
if ($program_version_num >= 7.000000) {
return $self->html_attribute_class('div', [$html_class]). '>' . "\n" .
$prepended_text . $caption_text . $content . '</div>';
} else {
return $self->_attribute_class('div', $html_class). '>' . "\n" .
$prepended_text . $caption_text . $content . '</div>';
}
}
texinfo_register_command_formatting('float',

View File

@ -695,6 +695,8 @@ FL+FR+FC+LFE+SL+SR
FL+FR+FC+BC+SL+SR
@item 6.0(front)
FL+FR+FLC+FRC+SL+SR
@item 3.1.2
FL+FR+FC+LFE+TFL+TFR
@item hexagonal
FL+FR+FC+BL+BR+BC
@item 6.1
@ -713,12 +715,22 @@ FL+FR+FC+LFE+BL+BR+SL+SR
FL+FR+FC+LFE+BL+BR+FLC+FRC
@item 7.1(wide-side)
FL+FR+FC+LFE+FLC+FRC+SL+SR
@item 7.1(top)
@item 5.1.2
FL+FR+FC+LFE+BL+BR+TFL+TFR
@item octagonal
FL+FR+FC+BL+BR+BC+SL+SR
@item cube
FL+FR+BL+BR+TFL+TFR+TBL+TBR
@item 5.1.4
FL+FR+FC+LFE+BL+BR+TFL+TFR+TBL+TBR
@item 7.1.2
FL+FR+FC+LFE+BL+BR+SL+SR+TFL+TFR
@item 7.1.4
FL+FR+FC+LFE+BL+BR+SL+SR+TFL+TFR+TBL+TBR
@item 7.2.3
FL+FR+FC+LFE+BL+BR+SL+SR+TFL+TFR+TBC+LFE2
@item 9.1.4
FL+FR+FC+LFE+BL+BR+FLC+FRC+SL+SR+TFL+TFR+TBL+TBR
@item hexadecagonal
FL+FR+FC+BL+BR+BC+SL+SR+WL+WR+TBL+TBR+TBC+TFC+TFL+TFR
@item downmix
@ -803,7 +815,7 @@ Compute arcsine of @var{x}.
@item atan(x)
Compute arctangent of @var{x}.
@item atan2(x, y)
@item atan2(y, x)
Compute principal value of the arc tangent of @var{y}/@var{x}.
@item between(x, min, max)
@ -927,9 +939,15 @@ Returns the value of the expression printed.
Prints t with loglevel l
@item random(x)
Return a pseudo random value between 0.0 and 1.0. @var{x} is the index of the
internal variable which will be used to save the seed/state.
@item random(idx)
Return a pseudo random value between 0.0 and 1.0. @var{idx} is the
index of the internal variable which will be used to save the
seed/state.
@item randomi(idx, min, max)
Return a pseudo random value in the interval between @var{min} and
@var{max}. @var{idx} is the index of the internal variable which will
be used to save the seed/state.
@item root(expr, max)
Find an input value for which the function represented by @var{expr}

View File

@ -15,6 +15,7 @@ OBJS-$(HAVE_LASX) += $(LASX-OBJS) $(LASX-OBJS-yes)
OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes)
OBJS-$(HAVE_RV) += $(RV-OBJS) $(RV-OBJS-yes)
OBJS-$(HAVE_RVV) += $(RVV-OBJS) $(RVV-OBJS-yes)
OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)

View File

@ -130,7 +130,7 @@ $(BIN2CEXE): ffbuild/bin2c_host.o
ifdef CONFIG_PTX_COMPRESSION
%.ptx.gz: TAG = GZIP
%.ptx.gz: %.ptx
$(M)gzip -c9 $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) >$@
$(M)gzip -nc9 $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) >$@
%.ptx.c: %.ptx.gz $(BIN2CEXE)
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
@ -140,7 +140,7 @@ else
endif
clean::
$(RM) $(BIN2CEXE)
$(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%)
%.c %.h %.pc %.ver %.version: TAG = GEN

View File

@ -18,10 +18,13 @@ OBJS-ffmpeg += \
fftools/ffmpeg_mux.o \
fftools/ffmpeg_mux_init.o \
fftools/ffmpeg_opt.o \
fftools/ffmpeg_sched.o \
fftools/objpool.o \
fftools/sync_queue.o \
fftools/thread_queue.o \
OBJS-ffplay += fftools/ffplay_renderer.o
define DOFFTOOL
OBJS-$(1) += fftools/cmdutils.o fftools/opt_common.o fftools/$(1).o $(OBJS-$(1)-yes)
ifdef HAVE_GNU_WINDRES

View File

@ -37,6 +37,7 @@
#include "libswresample/swresample.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/channel_layout.h"
#include "libavutil/display.h"
#include "libavutil/getenv_utf8.h"
@ -83,7 +84,7 @@ void init_dynload(void)
#endif
}
int parse_number(const char *context, const char *numstr, int type,
int parse_number(const char *context, const char *numstr, enum OptionType type,
double min, double max, double *dst)
{
char *tail;
@ -93,9 +94,9 @@ int parse_number(const char *context, const char *numstr, int type,
error = "Expected number for %s but found: %s\n";
else if (d < min || d > max)
error = "The value for %s was %s which is not within %f - %f\n";
else if (type == OPT_INT64 && (int64_t)d != d)
else if (type == OPT_TYPE_INT64 && (int64_t)d != d)
error = "Expected int64 for %s but found %s\n";
else if (type == OPT_INT && (int)d != d)
else if (type == OPT_TYPE_INT && (int)d != d)
error = "Expected int for %s but found %s\n";
else {
*dst = d;
@ -107,7 +108,7 @@ int parse_number(const char *context, const char *numstr, int type,
}
void show_help_options(const OptionDef *options, const char *msg, int req_flags,
int rej_flags, int alt_flags)
int rej_flags)
{
const OptionDef *po;
int first;
@ -117,7 +118,6 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
char buf[128];
if (((po->flags & req_flags) != req_flags) ||
(alt_flags && !(po->flags & alt_flags)) ||
(po->flags & rej_flags))
continue;
@ -126,10 +126,15 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
first = 0;
}
av_strlcpy(buf, po->name, sizeof(buf));
if (po->argname) {
av_strlcat(buf, " ", sizeof(buf));
av_strlcat(buf, po->argname, sizeof(buf));
}
if (po->flags & OPT_FLAG_PERSTREAM)
av_strlcat(buf, "[:<stream_spec>]", sizeof(buf));
else if (po->flags & OPT_FLAG_SPEC)
av_strlcat(buf, "[:<spec>]", sizeof(buf));
if (po->argname)
av_strlcatf(buf, sizeof(buf), " <%s>", po->argname);
printf("-%-17s %s\n", buf, po->help);
}
printf("\n");
@ -150,6 +155,9 @@ void show_help_children(const AVClass *class, int flags)
static const OptionDef *find_option(const OptionDef *po, const char *name)
{
if (*name == '/')
name++;
while (po->name) {
const char *end;
if (av_strstart(name, po->name, &end) && (!*end || *end == ':'))
@ -223,85 +231,138 @@ static inline void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)
}
#endif /* HAVE_COMMANDLINETOARGVW */
static int opt_has_arg(const OptionDef *o)
{
if (o->type == OPT_TYPE_BOOL)
return 0;
if (o->type == OPT_TYPE_FUNC)
return !!(o->flags & OPT_FUNC_ARG);
return 1;
}
static int write_option(void *optctx, const OptionDef *po, const char *opt,
const char *arg)
const char *arg, const OptionDef *defs)
{
/* new-style options contain an offset into optctx, old-style address of
* a global var*/
void *dst = po->flags & (OPT_OFFSET | OPT_SPEC) ?
void *dst = po->flags & OPT_FLAG_OFFSET ?
(uint8_t *)optctx + po->u.off : po->u.dst_ptr;
int *dstcount;
double num;
int ret;
char *arg_allocated = NULL;
if (po->flags & OPT_SPEC) {
SpecifierOpt **so = dst;
SpecifierOptList *sol = NULL;
double num;
int ret = 0;
if (*opt == '/') {
opt++;
if (po->type == OPT_TYPE_BOOL) {
av_log(NULL, AV_LOG_FATAL,
"Requested to load an argument from file for a bool option '%s'\n",
po->name);
return AVERROR(EINVAL);
}
arg_allocated = file_read(arg);
if (!arg_allocated) {
av_log(NULL, AV_LOG_FATAL,
"Error reading the value for option '%s' from file: %s\n",
opt, arg);
return AVERROR(EINVAL);
}
arg = arg_allocated;
}
if (po->flags & OPT_FLAG_SPEC) {
char *p = strchr(opt, ':');
char *str;
dstcount = (int *)(so + 1);
ret = grow_array((void**)so, sizeof(**so), dstcount, *dstcount + 1);
sol = dst;
ret = GROW_ARRAY(sol->opt, sol->nb_opt);
if (ret < 0)
return ret;
goto finish;
str = av_strdup(p ? p + 1 : "");
if (!str)
return AVERROR(ENOMEM);
(*so)[*dstcount - 1].specifier = str;
dst = &(*so)[*dstcount - 1].u;
if (!str) {
ret = AVERROR(ENOMEM);
goto finish;
}
sol->opt[sol->nb_opt - 1].specifier = str;
dst = &sol->opt[sol->nb_opt - 1].u;
}
if (po->flags & OPT_STRING) {
if (po->type == OPT_TYPE_STRING) {
char *str;
str = av_strdup(arg);
if (arg_allocated) {
str = arg_allocated;
arg_allocated = NULL;
} else
str = av_strdup(arg);
av_freep(dst);
if (!str)
return AVERROR(ENOMEM);
if (!str) {
ret = AVERROR(ENOMEM);
goto finish;
}
*(char **)dst = str;
} else if (po->flags & OPT_BOOL || po->flags & OPT_INT) {
ret = parse_number(opt, arg, OPT_INT64, INT_MIN, INT_MAX, &num);
} else if (po->type == OPT_TYPE_BOOL || po->type == OPT_TYPE_INT) {
ret = parse_number(opt, arg, OPT_TYPE_INT64, INT_MIN, INT_MAX, &num);
if (ret < 0)
return ret;
goto finish;
*(int *)dst = num;
} else if (po->flags & OPT_INT64) {
ret = parse_number(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX, &num);
} else if (po->type == OPT_TYPE_INT64) {
ret = parse_number(opt, arg, OPT_TYPE_INT64, INT64_MIN, INT64_MAX, &num);
if (ret < 0)
return ret;
goto finish;
*(int64_t *)dst = num;
} else if (po->flags & OPT_TIME) {
} else if (po->type == OPT_TYPE_TIME) {
ret = av_parse_time(dst, arg, 1);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Invalid duration for option %s: %s\n",
opt, arg);
return ret;
goto finish;
}
} else if (po->flags & OPT_FLOAT) {
ret = parse_number(opt, arg, OPT_FLOAT, -INFINITY, INFINITY, &num);
} else if (po->type == OPT_TYPE_FLOAT) {
ret = parse_number(opt, arg, OPT_TYPE_FLOAT, -INFINITY, INFINITY, &num);
if (ret < 0)
return ret;
goto finish;
*(float *)dst = num;
} else if (po->flags & OPT_DOUBLE) {
ret = parse_number(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY, &num);
} else if (po->type == OPT_TYPE_DOUBLE) {
ret = parse_number(opt, arg, OPT_TYPE_DOUBLE, -INFINITY, INFINITY, &num);
if (ret < 0)
return ret;
goto finish;
*(double *)dst = num;
} else if (po->u.func_arg) {
int ret = po->u.func_arg(optctx, opt, arg);
} else {
av_assert0(po->type == OPT_TYPE_FUNC && po->u.func_arg);
ret = po->u.func_arg(optctx, opt, arg);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR,
"Failed to set value '%s' for option '%s': %s\n",
arg, opt, av_err2str(ret));
return ret;
goto finish;
}
}
if (po->flags & OPT_EXIT)
return AVERROR_EXIT;
if (po->flags & OPT_EXIT) {
ret = AVERROR_EXIT;
goto finish;
}
return 0;
if (sol) {
sol->type = po->type;
sol->opt_canon = (po->flags & OPT_HAS_CANON) ?
find_option(defs, po->u1.name_canon) : po;
}
finish:
av_freep(&arg_allocated);
return ret;
}
int parse_option(void *optctx, const char *opt, const char *arg,
@ -309,7 +370,8 @@ int parse_option(void *optctx, const char *opt, const char *arg,
{
static const OptionDef opt_avoptions = {
.name = "AVOption passthrough",
.flags = HAS_ARG,
.type = OPT_TYPE_FUNC,
.flags = OPT_FUNC_ARG,
.u.func_arg = opt_default,
};
@ -320,9 +382,9 @@ int parse_option(void *optctx, const char *opt, const char *arg,
if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
/* handle 'no' bool option */
po = find_option(options, opt + 2);
if ((po->name && (po->flags & OPT_BOOL)))
if ((po->name && po->type == OPT_TYPE_BOOL))
arg = "0";
} else if (po->flags & OPT_BOOL)
} else if (po->type == OPT_TYPE_BOOL)
arg = "1";
if (!po->name)
@ -331,16 +393,16 @@ int parse_option(void *optctx, const char *opt, const char *arg,
av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
return AVERROR(EINVAL);
}
if (po->flags & HAS_ARG && !arg) {
if (opt_has_arg(po) && !arg) {
av_log(NULL, AV_LOG_ERROR, "Missing argument for option '%s'\n", opt);
return AVERROR(EINVAL);
}
ret = write_option(optctx, po, opt, arg);
ret = write_option(optctx, po, opt, arg, options);
if (ret < 0)
return ret;
return !!(po->flags & HAS_ARG);
return opt_has_arg(po);
}
int parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
@ -379,7 +441,7 @@ int parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
return 0;
}
int parse_optgroup(void *optctx, OptionGroup *g)
int parse_optgroup(void *optctx, OptionGroup *g, const OptionDef *defs)
{
int i, ret;
@ -402,7 +464,7 @@ int parse_optgroup(void *optctx, OptionGroup *g)
av_log(NULL, AV_LOG_DEBUG, "Applying option %s (%s) with argument %s.\n",
o->key, o->opt->help, o->val);
ret = write_option(optctx, o->opt, o->key, o->val);
ret = write_option(optctx, o->opt, o->key, o->val, defs);
if (ret < 0)
return ret;
}
@ -432,7 +494,7 @@ int locate_option(int argc, char **argv, const OptionDef *options,
(po->name && !strcmp(optname, po->name)))
return i;
if (!po->name || po->flags & HAS_ARG)
if (!po->name || opt_has_arg(po))
i++;
}
return 0;
@ -466,7 +528,14 @@ static void check_options(const OptionDef *po)
{
while (po->name) {
if (po->flags & OPT_PERFILE)
av_assert0(po->flags & (OPT_INPUT | OPT_OUTPUT));
av_assert0(po->flags & (OPT_INPUT | OPT_OUTPUT | OPT_DECODER));
if (po->type == OPT_TYPE_FUNC)
av_assert0(!(po->flags & (OPT_FLAG_OFFSET | OPT_FLAG_SPEC)));
// OPT_FUNC_ARG can only be ser for OPT_TYPE_FUNC
av_assert0((po->type == OPT_TYPE_FUNC) || !(po->flags & OPT_FUNC_ARG));
po++;
}
}
@ -642,7 +711,7 @@ static int finish_group(OptionParseContext *octx, int group_idx,
static int add_opt(OptionParseContext *octx, const OptionDef *opt,
const char *key, const char *val)
{
int global = !(opt->flags & (OPT_PERFILE | OPT_SPEC | OPT_OFFSET));
int global = !(opt->flags & OPT_PERFILE);
OptionGroup *g = global ? &octx->global_opts : &octx->cur_group;
int ret;
@ -665,10 +734,10 @@ static int init_parse_context(OptionParseContext *octx,
memset(octx, 0, sizeof(*octx));
octx->nb_groups = nb_groups;
octx->groups = av_calloc(octx->nb_groups, sizeof(*octx->groups));
octx->groups = av_calloc(nb_groups, sizeof(*octx->groups));
if (!octx->groups)
return AVERROR(ENOMEM);
octx->nb_groups = nb_groups;
for (i = 0; i < octx->nb_groups; i++)
octx->groups[i].group_def = &groups[i];
@ -724,7 +793,7 @@ int split_commandline(OptionParseContext *octx, int argc, char *argv[],
while (optindex < argc) {
const char *opt = argv[optindex++], *arg;
const OptionDef *po;
int ret;
int ret, group_idx;
av_log(NULL, AV_LOG_DEBUG, "Reading option '%s' ...", opt);
@ -753,14 +822,15 @@ do { \
} while (0)
/* named group separators, e.g. -i */
if ((ret = match_group_separator(groups, nb_groups, opt)) >= 0) {
group_idx = match_group_separator(groups, nb_groups, opt);
if (group_idx >= 0) {
GET_ARG(arg);
ret = finish_group(octx, ret, arg);
ret = finish_group(octx, group_idx, arg);
if (ret < 0)
return ret;
av_log(NULL, AV_LOG_DEBUG, " matched as %s with argument '%s'.\n",
groups[ret].name, arg);
groups[group_idx].name, arg);
continue;
}
@ -770,7 +840,7 @@ do { \
if (po->flags & OPT_EXIT) {
/* optional argument, e.g. -h */
arg = argv[optindex++];
} else if (po->flags & HAS_ARG) {
} else if (opt_has_arg(po)) {
GET_ARG(arg);
} else {
arg = "1";
@ -803,7 +873,7 @@ do { \
/* boolean -nofoo options */
if (opt[0] == 'n' && opt[1] == 'o' &&
(po = find_option(options, opt + 2)) &&
po->name && po->flags & OPT_BOOL) {
po->name && po->type == OPT_TYPE_BOOL) {
ret = add_opt(octx, po, opt, "0");
if (ret < 0)
return ret;
@ -826,11 +896,6 @@ do { \
return 0;
}
void print_error(const char *filename, int err)
{
av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, av_err2str(err));
}
int read_yesno(void)
{
int c = getchar();
@ -1050,7 +1115,7 @@ double get_rotation(const int32_t *displaymatrix)
{
double theta = 0;
if (displaymatrix)
theta = -round(av_display_rotation_get((int32_t*) displaymatrix));
theta = -round(av_display_rotation_get(displaymatrix));
theta -= 360*floor(theta/360 + 0.9/360);
@ -1062,3 +1127,29 @@ double get_rotation(const int32_t *displaymatrix)
return theta;
}
/* read file contents into a string */
char *file_read(const char *filename)
{
AVIOContext *pb = NULL;
int ret = avio_open(&pb, filename, AVIO_FLAG_READ);
AVBPrint bprint;
char *str;
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error opening file %s.\n", filename);
return NULL;
}
av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
ret = avio_read_to_bprint(pb, &bprint, SIZE_MAX);
avio_closep(&pb);
if (ret < 0) {
av_bprint_finalize(&bprint, NULL);
return NULL;
}
ret = av_bprint_finalize(&bprint, &str);
if (ret < 0)
return NULL;
return str;
}

View File

@ -77,6 +77,17 @@ int opt_default(void *optctx, const char *opt, const char *arg);
*/
int opt_timelimit(void *optctx, const char *opt, const char *arg);
enum OptionType {
OPT_TYPE_FUNC,
OPT_TYPE_BOOL,
OPT_TYPE_STRING,
OPT_TYPE_INT,
OPT_TYPE_INT64,
OPT_TYPE_FLOAT,
OPT_TYPE_DOUBLE,
OPT_TYPE_TIME,
};
/**
* Parse a string and return its corresponding value as a double.
*
@ -88,7 +99,7 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg);
* @param min the minimum valid accepted value
* @param max the maximum valid accepted value
*/
int parse_number(const char *context, const char *numstr, int type,
int parse_number(const char *context, const char *numstr, enum OptionType type,
double min, double max, double *dst);
typedef struct SpecifierOpt {
@ -103,31 +114,70 @@ typedef struct SpecifierOpt {
} u;
} SpecifierOpt;
typedef struct SpecifierOptList {
SpecifierOpt *opt;
int nb_opt;
/* Canonical option definition that was parsed into this list. */
const struct OptionDef *opt_canon;
enum OptionType type;
} SpecifierOptList;
typedef struct OptionDef {
const char *name;
enum OptionType type;
int flags;
#define HAS_ARG 0x0001
#define OPT_BOOL 0x0002
#define OPT_EXPERT 0x0004
#define OPT_STRING 0x0008
#define OPT_VIDEO 0x0010
#define OPT_AUDIO 0x0020
#define OPT_INT 0x0080
#define OPT_FLOAT 0x0100
#define OPT_SUBTITLE 0x0200
#define OPT_INT64 0x0400
#define OPT_EXIT 0x0800
#define OPT_DATA 0x1000
#define OPT_PERFILE 0x2000 /* the option is per-file (currently ffmpeg-only).
implied by OPT_OFFSET or OPT_SPEC */
#define OPT_OFFSET 0x4000 /* option is specified as an offset in a passed optctx */
#define OPT_SPEC 0x8000 /* option is to be stored in an array of SpecifierOpt.
Implies OPT_OFFSET. Next element after the offset is
an int containing element count in the array. */
#define OPT_TIME 0x10000
#define OPT_DOUBLE 0x20000
#define OPT_INPUT 0x40000
#define OPT_OUTPUT 0x80000
/* The OPT_TYPE_FUNC option takes an argument.
* Must not be used with other option types, as for those it holds:
* - OPT_TYPE_BOOL do not take an argument
* - all other types do
*/
#define OPT_FUNC_ARG (1 << 0)
/* Program will immediately exit after processing this option */
#define OPT_EXIT (1 << 1)
/* Option is intended for advanced users. Only affects
* help output.
*/
#define OPT_EXPERT (1 << 2)
#define OPT_VIDEO (1 << 3)
#define OPT_AUDIO (1 << 4)
#define OPT_SUBTITLE (1 << 5)
#define OPT_DATA (1 << 6)
/* The option is per-file (currently ffmpeg-only). At least one of OPT_INPUT,
* OPT_OUTPUT, OPT_DECODER must be set when this flag is in use.
*/
#define OPT_PERFILE (1 << 7)
/* Option is specified as an offset in a passed optctx.
* Always use as OPT_OFFSET in option definitions. */
#define OPT_FLAG_OFFSET (1 << 8)
#define OPT_OFFSET (OPT_FLAG_OFFSET | OPT_PERFILE)
/* Option is to be stored in a SpecifierOptList.
Always use as OPT_SPEC in option definitions. */
#define OPT_FLAG_SPEC (1 << 9)
#define OPT_SPEC (OPT_FLAG_SPEC | OPT_OFFSET)
/* Option applies per-stream (implies OPT_SPEC). */
#define OPT_FLAG_PERSTREAM (1 << 10)
#define OPT_PERSTREAM (OPT_FLAG_PERSTREAM | OPT_SPEC)
/* ffmpeg-only - specifies whether an OPT_PERFILE option applies to input,
* output, or both. */
#define OPT_INPUT (1 << 11)
#define OPT_OUTPUT (1 << 12)
/* This option is a "canonical" form, to which one or more alternatives
* exist. These alternatives are listed in u1.names_alt. */
#define OPT_HAS_ALT (1 << 13)
/* This option is an alternative form of some other option, whose
* name is stored in u1.name_canon */
#define OPT_HAS_CANON (1 << 14)
/* ffmpeg-only - OPT_PERFILE may apply to standalone decoders */
#define OPT_DECODER (1 << 15)
union {
void *dst_ptr;
int (*func_arg)(void *, const char *, const char *);
@ -135,6 +185,15 @@ typedef struct OptionDef {
} u;
const char *help;
const char *argname;
union {
/* Name of the canonical form of this option.
* Is valid when OPT_HAS_CANON is set. */
const char *name_canon;
/* A NULL-terminated list of alternate forms of this option.
* Is valid when OPT_HAS_ALT is set. */
const char * const *names_alt;
} u1;
} OptionDef;
/**
@ -144,10 +203,9 @@ typedef struct OptionDef {
* @param msg title of this group. Only printed if at least one option matches.
* @param req_flags print only options which have all those flags set.
* @param rej_flags don't print options which have any of those flags set.
* @param alt_flags print only options that have at least one of those flags set
*/
void show_help_options(const OptionDef *options, const char *msg, int req_flags,
int rej_flags, int alt_flags);
int rej_flags);
/**
* Show help for all options with given flags in class and all its
@ -249,7 +307,7 @@ typedef struct OptionParseContext {
*
* @param optctx an app-specific options context. NULL for global options group
*/
int parse_optgroup(void *optctx, OptionGroup *g);
int parse_optgroup(void *optctx, OptionGroup *g, const OptionDef *defs);
/**
* Split the commandline into an intermediate form convenient for further
@ -340,7 +398,10 @@ int setup_find_stream_info_opts(AVFormatContext *s,
*
* @see av_strerror()
*/
void print_error(const char *filename, int err);
static inline void print_error(const char *filename, int err)
{
av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, av_err2str(err));
}
/**
* Print the program banner to stderr. The banner contents depend on the
@ -419,4 +480,7 @@ void *allocate_array_elem(void *array, size_t elem_size, int *nb_elems);
double get_rotation(const int32_t *displaymatrix);
/* read file contents into a string */
char *file_read(const char *filename);
#endif /* FFTOOLS_CMDUTILS_H */

View File

@ -99,6 +99,8 @@
#include "cmdutils.h"
#include "ffmpeg.h"
#include "ffmpeg_sched.h"
#include "ffmpeg_utils.h"
#include "sync_queue.h"
const char program_name[] = "ffmpeg";
@ -115,7 +117,7 @@ typedef struct BenchmarkTimeStamps {
static BenchmarkTimeStamps get_benchmark_time_stamps(void);
static int64_t getmaxrss(void);
unsigned nb_output_dumped = 0;
atomic_uint nb_output_dumped = 0;
static BenchmarkTimeStamps current_time;
AVIOContext *progress_avio = NULL;
@ -129,6 +131,9 @@ int nb_output_files = 0;
FilterGraph **filtergraphs;
int nb_filtergraphs;
Decoder **decoders;
int nb_decoders;
#if HAVE_TERMIOS_H
/* init terminal so that we can grab keys */
@ -136,30 +141,6 @@ static struct termios oldtty;
static int restore_tty;
#endif
/* sub2video hack:
Convert subtitles to video with alpha to insert them in filter graphs.
This is a temporary solution until libavfilter gets real subtitles support.
*/
static void sub2video_heartbeat(InputFile *infile, int64_t pts, AVRational tb)
{
/* When a frame is read from a file, examine all sub2video streams in
the same file and send the sub2video frame again. Otherwise, decoded
video frames could be accumulating in the filter graph while a filter
(possibly overlay) is desperately waiting for a subtitle frame. */
for (int i = 0; i < infile->nb_streams; i++) {
InputStream *ist = infile->streams[i];
if (ist->dec_ctx->codec_type != AVMEDIA_TYPE_SUBTITLE)
continue;
for (int j = 0; j < ist->nb_filters; j++)
ifilter_sub2video_heartbeat(ist->filters[j], pts, tb);
}
}
/* end of sub2video hack */
static void term_exit_sigsafe(void)
{
#if HAVE_TERMIOS_H
@ -308,7 +289,7 @@ static int read_key(void)
return n;
}
#elif HAVE_KBHIT
# if HAVE_PEEKNAMEDPIPE
# if HAVE_PEEKNAMEDPIPE && HAVE_GETSTDHANDLE
static int is_pipe;
static HANDLE input_handle;
DWORD dw, nchars;
@ -347,23 +328,25 @@ const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
static void ffmpeg_cleanup(int ret)
{
int i;
if (do_benchmark) {
int maxrss = getmaxrss() / 1024;
av_log(NULL, AV_LOG_INFO, "bench: maxrss=%ikB\n", maxrss);
av_log(NULL, AV_LOG_INFO, "bench: maxrss=%iKiB\n", maxrss);
}
for (i = 0; i < nb_filtergraphs; i++)
for (int i = 0; i < nb_filtergraphs; i++)
fg_free(&filtergraphs[i]);
av_freep(&filtergraphs);
for (i = 0; i < nb_output_files; i++)
for (int i = 0; i < nb_output_files; i++)
of_free(&output_files[i]);
for (i = 0; i < nb_input_files; i++)
for (int i = 0; i < nb_input_files; i++)
ifile_close(&input_files[i]);
for (int i = 0; i < nb_decoders; i++)
dec_free(&decoders[i]);
av_freep(&decoders);
if (vstats_file) {
if (fclose(vstats_file))
av_log(NULL, AV_LOG_ERROR,
@ -396,7 +379,7 @@ static void ffmpeg_cleanup(int ret)
OutputStream *ost_iter(OutputStream *prev)
{
int of_idx = prev ? prev->file_index : 0;
int of_idx = prev ? prev->file->index : 0;
int ost_idx = prev ? prev->index + 1 : 0;
for (; of_idx < nb_output_files; of_idx++) {
@ -412,7 +395,7 @@ OutputStream *ost_iter(OutputStream *prev)
InputStream *ist_iter(InputStream *prev)
{
int if_idx = prev ? prev->file_index : 0;
int if_idx = prev ? prev->file->index : 0;
int ist_idx = prev ? prev->index + 1 : 0;
for (; if_idx < nb_input_files; if_idx++) {
@ -426,21 +409,89 @@ InputStream *ist_iter(InputStream *prev)
return NULL;
}
FrameData *frame_data(AVFrame *frame)
static void frame_data_free(void *opaque, uint8_t *data)
{
if (!frame->opaque_ref) {
FrameData *fd = (FrameData *)data;
avcodec_parameters_free(&fd->par_enc);
av_free(data);
}
static int frame_data_ensure(AVBufferRef **dst, int writable)
{
AVBufferRef *src = *dst;
if (!src || (writable && !av_buffer_is_writable(src))) {
FrameData *fd;
frame->opaque_ref = av_buffer_allocz(sizeof(*fd));
if (!frame->opaque_ref)
return NULL;
fd = (FrameData*)frame->opaque_ref->data;
fd = av_mallocz(sizeof(*fd));
if (!fd)
return AVERROR(ENOMEM);
fd->dec.frame_num = UINT64_MAX;
fd->dec.pts = AV_NOPTS_VALUE;
*dst = av_buffer_create((uint8_t *)fd, sizeof(*fd),
frame_data_free, NULL, 0);
if (!*dst) {
av_buffer_unref(&src);
av_freep(&fd);
return AVERROR(ENOMEM);
}
if (src) {
const FrameData *fd_src = (const FrameData *)src->data;
memcpy(fd, fd_src, sizeof(*fd));
fd->par_enc = NULL;
if (fd_src->par_enc) {
int ret = 0;
fd->par_enc = avcodec_parameters_alloc();
ret = fd->par_enc ?
avcodec_parameters_copy(fd->par_enc, fd_src->par_enc) :
AVERROR(ENOMEM);
if (ret < 0) {
av_buffer_unref(dst);
av_buffer_unref(&src);
return ret;
}
}
av_buffer_unref(&src);
} else {
fd->dec.frame_num = UINT64_MAX;
fd->dec.pts = AV_NOPTS_VALUE;
for (unsigned i = 0; i < FF_ARRAY_ELEMS(fd->wallclock); i++)
fd->wallclock[i] = INT64_MIN;
}
}
return (FrameData*)frame->opaque_ref->data;
return 0;
}
FrameData *frame_data(AVFrame *frame)
{
int ret = frame_data_ensure(&frame->opaque_ref, 1);
return ret < 0 ? NULL : (FrameData*)frame->opaque_ref->data;
}
const FrameData *frame_data_c(AVFrame *frame)
{
int ret = frame_data_ensure(&frame->opaque_ref, 0);
return ret < 0 ? NULL : (const FrameData*)frame->opaque_ref->data;
}
FrameData *packet_data(AVPacket *pkt)
{
int ret = frame_data_ensure(&pkt->opaque_ref, 1);
return ret < 0 ? NULL : (FrameData*)pkt->opaque_ref->data;
}
const FrameData *packet_data_c(AVPacket *pkt)
{
int ret = frame_data_ensure(&pkt->opaque_ref, 0);
return ret < 0 ? NULL : (const FrameData*)pkt->opaque_ref->data;
}
void remove_avoptions(AVDictionary **a, AVDictionary *b)
@ -484,23 +535,13 @@ void update_benchmark(const char *fmt, ...)
}
}
void close_output_stream(OutputStream *ost)
{
OutputFile *of = output_files[ost->file_index];
ost->finished |= ENCODER_FINISHED;
if (ost->sq_idx_encode >= 0)
sq_send(of->sq_encode, ost->sq_idx_encode, SQFRAME(NULL));
}
static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time)
static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time, int64_t pts)
{
AVBPrint buf, buf_script;
int64_t total_size = of_filesize(output_files[0]);
int vid;
double bitrate;
double speed;
int64_t pts = AV_NOPTS_VALUE;
static int64_t last_time = -1;
static int first_report = 1;
uint64_t nb_frames_dup = 0, nb_frames_drop = 0;
@ -518,7 +559,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
last_time = cur_time;
}
if (((cur_time - last_time) < stats_period && !first_report) ||
(first_report && nb_output_dumped < nb_output_files))
(first_report && atomic_load(&nb_output_dumped) < nb_output_files))
return;
last_time = cur_time;
}
@ -529,14 +570,14 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC);
for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
const float q = ost->enc ? ost->quality / (float) FF_QP2LAMBDA : -1;
const float q = ost->enc ? atomic_load(&ost->quality) / (float) FF_QP2LAMBDA : -1;
if (vid && ost->type == AVMEDIA_TYPE_VIDEO) {
av_bprintf(&buf, "q=%2.1f ", q);
av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n",
ost->file_index, ost->index, q);
ost->file->index, ost->index, q);
}
if (!vid && ost->type == AVMEDIA_TYPE_VIDEO) {
if (!vid && ost->type == AVMEDIA_TYPE_VIDEO && ost->filter) {
float fps;
uint64_t frame_number = atomic_load(&ost->packets_written);
@ -546,29 +587,22 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
av_bprintf(&buf_script, "frame=%"PRId64"\n", frame_number);
av_bprintf(&buf_script, "fps=%.2f\n", fps);
av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n",
ost->file_index, ost->index, q);
ost->file->index, ost->index, q);
if (is_last_report)
av_bprintf(&buf, "L");
nb_frames_dup = ost->nb_frames_dup;
nb_frames_drop = ost->nb_frames_drop;
nb_frames_dup = atomic_load(&ost->filter->nb_frames_dup);
nb_frames_drop = atomic_load(&ost->filter->nb_frames_drop);
vid = 1;
}
/* compute min output value */
if (ost->last_mux_dts != AV_NOPTS_VALUE) {
if (pts == AV_NOPTS_VALUE || ost->last_mux_dts > pts)
pts = ost->last_mux_dts;
if (copy_ts) {
if (copy_ts_first_pts == AV_NOPTS_VALUE && pts > 1)
copy_ts_first_pts = pts;
if (copy_ts_first_pts != AV_NOPTS_VALUE)
pts -= copy_ts_first_pts;
}
}
}
if (is_last_report)
nb_frames_drop += ost->last_dropped;
if (copy_ts) {
if (copy_ts_first_pts == AV_NOPTS_VALUE && pts > 1)
copy_ts_first_pts = pts;
if (copy_ts_first_pts != AV_NOPTS_VALUE)
pts -= copy_ts_first_pts;
}
us = FFABS64U(pts) % AV_TIME_BASE;
@ -581,7 +615,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
speed = pts != AV_NOPTS_VALUE && t != 0.0 ? (double)pts / AV_TIME_BASE / t : -1;
if (total_size < 0) av_bprintf(&buf, "size=N/A time=");
else av_bprintf(&buf, "size=%8.0fkB time=", total_size / 1024.0);
else av_bprintf(&buf, "size=%8.0fKiB time=", total_size / 1024.0);
if (pts == AV_NOPTS_VALUE) {
av_bprintf(&buf, "N/A ");
} else {
@ -651,201 +685,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
first_report = 0;
}
int copy_av_subtitle(AVSubtitle *dst, const AVSubtitle *src)
{
int ret = AVERROR_BUG;
AVSubtitle tmp = {
.format = src->format,
.start_display_time = src->start_display_time,
.end_display_time = src->end_display_time,
.num_rects = 0,
.rects = NULL,
.pts = src->pts
};
if (!src->num_rects)
goto success;
if (!(tmp.rects = av_calloc(src->num_rects, sizeof(*tmp.rects))))
return AVERROR(ENOMEM);
for (int i = 0; i < src->num_rects; i++) {
AVSubtitleRect *src_rect = src->rects[i];
AVSubtitleRect *dst_rect;
if (!(dst_rect = tmp.rects[i] = av_mallocz(sizeof(*tmp.rects[0])))) {
ret = AVERROR(ENOMEM);
goto cleanup;
}
tmp.num_rects++;
dst_rect->type = src_rect->type;
dst_rect->flags = src_rect->flags;
dst_rect->x = src_rect->x;
dst_rect->y = src_rect->y;
dst_rect->w = src_rect->w;
dst_rect->h = src_rect->h;
dst_rect->nb_colors = src_rect->nb_colors;
if (src_rect->text)
if (!(dst_rect->text = av_strdup(src_rect->text))) {
ret = AVERROR(ENOMEM);
goto cleanup;
}
if (src_rect->ass)
if (!(dst_rect->ass = av_strdup(src_rect->ass))) {
ret = AVERROR(ENOMEM);
goto cleanup;
}
for (int j = 0; j < 4; j++) {
// SUBTITLE_BITMAP images are special in the sense that they
// are like PAL8 images. first pointer to data, second to
// palette. This makes the size calculation match this.
size_t buf_size = src_rect->type == SUBTITLE_BITMAP && j == 1 ?
AVPALETTE_SIZE :
src_rect->h * src_rect->linesize[j];
if (!src_rect->data[j])
continue;
if (!(dst_rect->data[j] = av_memdup(src_rect->data[j], buf_size))) {
ret = AVERROR(ENOMEM);
goto cleanup;
}
dst_rect->linesize[j] = src_rect->linesize[j];
}
}
success:
*dst = tmp;
return 0;
cleanup:
avsubtitle_free(&tmp);
return ret;
}
static void subtitle_free(void *opaque, uint8_t *data)
{
AVSubtitle *sub = (AVSubtitle*)data;
avsubtitle_free(sub);
av_free(sub);
}
int subtitle_wrap_frame(AVFrame *frame, AVSubtitle *subtitle, int copy)
{
AVBufferRef *buf;
AVSubtitle *sub;
int ret;
if (copy) {
sub = av_mallocz(sizeof(*sub));
ret = sub ? copy_av_subtitle(sub, subtitle) : AVERROR(ENOMEM);
if (ret < 0) {
av_freep(&sub);
return ret;
}
} else {
sub = av_memdup(subtitle, sizeof(*subtitle));
if (!sub)
return AVERROR(ENOMEM);
memset(subtitle, 0, sizeof(*subtitle));
}
buf = av_buffer_create((uint8_t*)sub, sizeof(*sub),
subtitle_free, NULL, 0);
if (!buf) {
avsubtitle_free(sub);
av_freep(&sub);
return AVERROR(ENOMEM);
}
frame->buf[0] = buf;
return 0;
}
int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket *pkt)
{
OutputFile *of = output_files[ost->file_index];
int64_t signal_pts = av_rescale_q(pkt->pts, pkt->time_base,
AV_TIME_BASE_Q);
if (!ost->fix_sub_duration_heartbeat || !(pkt->flags & AV_PKT_FLAG_KEY))
// we are only interested in heartbeats on streams configured, and
// only on random access points.
return 0;
for (int i = 0; i < of->nb_streams; i++) {
OutputStream *iter_ost = of->streams[i];
InputStream *ist = iter_ost->ist;
int ret = AVERROR_BUG;
if (iter_ost == ost || !ist || !ist->decoding_needed ||
ist->dec_ctx->codec_type != AVMEDIA_TYPE_SUBTITLE)
// We wish to skip the stream that causes the heartbeat,
// output streams without an input stream, streams not decoded
// (as fix_sub_duration is only done for decoded subtitles) as
// well as non-subtitle streams.
continue;
if ((ret = fix_sub_duration_heartbeat(ist, signal_pts)) < 0)
return ret;
}
return 0;
}
/* pkt = NULL means EOF (needed to flush decoder buffers) */
static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
{
InputFile *f = input_files[ist->file_index];
int64_t dts_est = AV_NOPTS_VALUE;
int ret = 0;
int eof_reached = 0;
if (ist->decoding_needed) {
ret = dec_packet(ist, pkt, no_eof);
if (ret < 0 && ret != AVERROR_EOF)
return ret;
}
if (ret == AVERROR_EOF || (!pkt && !ist->decoding_needed))
eof_reached = 1;
if (pkt && pkt->opaque_ref) {
DemuxPktData *pd = (DemuxPktData*)pkt->opaque_ref->data;
dts_est = pd->dts_est;
}
if (f->recording_time != INT64_MAX) {
int64_t start_time = 0;
if (copy_ts) {
start_time += f->start_time != AV_NOPTS_VALUE ? f->start_time : 0;
start_time += start_at_zero ? 0 : f->start_time_effective;
}
if (dts_est >= f->recording_time + start_time)
pkt = NULL;
}
for (int oidx = 0; oidx < ist->nb_outputs; oidx++) {
OutputStream *ost = ist->outputs[oidx];
if (ost->enc || (!pkt && no_eof))
continue;
ret = of_streamcopy(ost, pkt, dts_est);
if (ret < 0)
return ret;
}
return !eof_reached;
}
static void print_stream_maps(void)
{
av_log(NULL, AV_LOG_INFO, "Stream mapping:\n");
@ -853,7 +692,7 @@ static void print_stream_maps(void)
for (int j = 0; j < ist->nb_filters; j++) {
if (!filtergraph_is_simple(ist->filters[j]->graph)) {
av_log(NULL, AV_LOG_INFO, " Stream #%d:%d (%s) -> %s",
ist->file_index, ist->index, ist->dec ? ist->dec->name : "?",
ist->file->index, ist->index, ist->dec ? ist->dec->name : "?",
ist->filters[j]->name);
if (nb_filtergraphs > 1)
av_log(NULL, AV_LOG_INFO, " (graph %d)", ist->filters[j]->graph->index);
@ -866,7 +705,7 @@ static void print_stream_maps(void)
if (ost->attachment_filename) {
/* an attached file */
av_log(NULL, AV_LOG_INFO, " File %s -> Stream #%d:%d\n",
ost->attachment_filename, ost->file_index, ost->index);
ost->attachment_filename, ost->file->index, ost->index);
continue;
}
@ -876,15 +715,15 @@ static void print_stream_maps(void)
if (nb_filtergraphs > 1)
av_log(NULL, AV_LOG_INFO, " (graph %d)", ost->filter->graph->index);
av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\n", ost->file_index,
av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\n", ost->file->index,
ost->index, ost->enc_ctx->codec->name);
continue;
}
av_log(NULL, AV_LOG_INFO, " Stream #%d:%d -> #%d:%d",
ost->ist->file_index,
ost->ist->file->index,
ost->ist->index,
ost->file_index,
ost->file->index,
ost->index);
if (ost->enc_ctx) {
const AVCodec *in_codec = ost->ist->dec;
@ -922,43 +761,6 @@ static void print_stream_maps(void)
}
}
/**
* Select the output stream to process.
*
* @retval 0 an output stream was selected
* @retval AVERROR(EAGAIN) need to wait until more input is available
* @retval AVERROR_EOF no more streams need output
*/
static int choose_output(OutputStream **post)
{
int64_t opts_min = INT64_MAX;
OutputStream *ost_min = NULL;
for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
int64_t opts;
if (ost->filter && ost->filter->last_pts != AV_NOPTS_VALUE) {
opts = ost->filter->last_pts;
} else {
opts = ost->last_mux_dts == AV_NOPTS_VALUE ?
INT64_MIN : ost->last_mux_dts;
}
if (!ost->initialized && !ost->inputs_done && !ost->finished) {
ost_min = ost;
break;
}
if (!ost->finished && opts < opts_min) {
opts_min = opts;
ost_min = ost;
}
}
if (!ost_min)
return AVERROR_EOF;
*post = ost_min;
return ost_min->unavailable ? AVERROR(EAGAIN) : 0;
}
static void set_tty_echo(int on)
{
#if HAVE_TERMIOS_H
@ -1030,161 +832,29 @@ static int check_keyboard_interaction(int64_t cur_time)
return 0;
}
static void reset_eagain(void)
{
int i;
for (i = 0; i < nb_input_files; i++)
input_files[i]->eagain = 0;
for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost))
ost->unavailable = 0;
}
static void decode_flush(InputFile *ifile)
{
for (int i = 0; i < ifile->nb_streams; i++) {
InputStream *ist = ifile->streams[i];
if (ist->discard || !ist->decoding_needed)
continue;
dec_packet(ist, NULL, 1);
}
}
/*
* Return
* - 0 -- one packet was read and processed
* - AVERROR(EAGAIN) -- no packets were available for selected file,
* this function should be called again
* - AVERROR_EOF -- this function should not be called again
*/
static int process_input(int file_index)
{
InputFile *ifile = input_files[file_index];
InputStream *ist;
AVPacket *pkt;
int ret, i;
ret = ifile_get_packet(ifile, &pkt);
if (ret == AVERROR(EAGAIN)) {
ifile->eagain = 1;
return ret;
}
if (ret == 1) {
/* the input file is looped: flush the decoders */
decode_flush(ifile);
return AVERROR(EAGAIN);
}
if (ret < 0) {
if (ret != AVERROR_EOF) {
av_log(ifile, AV_LOG_ERROR,
"Error retrieving a packet from demuxer: %s\n", av_err2str(ret));
if (exit_on_error)
return ret;
}
for (i = 0; i < ifile->nb_streams; i++) {
ist = ifile->streams[i];
if (!ist->discard) {
ret = process_input_packet(ist, NULL, 0);
if (ret>0)
return 0;
else if (ret < 0)
return ret;
}
/* mark all outputs that don't go through lavfi as finished */
for (int oidx = 0; oidx < ist->nb_outputs; oidx++) {
OutputStream *ost = ist->outputs[oidx];
OutputFile *of = output_files[ost->file_index];
ret = of_output_packet(of, ost, NULL);
if (ret < 0)
return ret;
}
}
ifile->eof_reached = 1;
return AVERROR(EAGAIN);
}
reset_eagain();
ist = ifile->streams[pkt->stream_index];
sub2video_heartbeat(ifile, pkt->pts, pkt->time_base);
ret = process_input_packet(ist, pkt, 0);
av_packet_free(&pkt);
return ret < 0 ? ret : 0;
}
/**
* Run a single step of transcoding.
*
* @return 0 for success, <0 for error
*/
static int transcode_step(OutputStream *ost)
{
InputStream *ist = NULL;
int ret;
if (ost->filter) {
if ((ret = fg_transcode_step(ost->filter->graph, &ist)) < 0)
return ret;
if (!ist)
return 0;
} else {
ist = ost->ist;
av_assert0(ist);
}
ret = process_input(ist->file_index);
if (ret == AVERROR(EAGAIN)) {
if (input_files[ist->file_index]->eagain)
ost->unavailable = 1;
return 0;
}
if (ret < 0)
return ret == AVERROR_EOF ? 0 : ret;
// process_input() above might have caused output to become available
// in multiple filtergraphs, so we process all of them
for (int i = 0; i < nb_filtergraphs; i++) {
ret = reap_filters(filtergraphs[i], 0);
if (ret < 0)
return ret;
}
return 0;
}
/*
* The following code is the main loop of the file converter
*/
static int transcode(int *err_rate_exceeded)
static int transcode(Scheduler *sch)
{
int ret = 0, i;
InputStream *ist;
int64_t timer_start;
int ret = 0;
int64_t timer_start, transcode_ts = 0;
print_stream_maps();
*err_rate_exceeded = 0;
atomic_store(&transcode_init_done, 1);
ret = sch_start(sch);
if (ret < 0)
return ret;
if (stdin_interaction) {
av_log(NULL, AV_LOG_INFO, "Press [q] to stop, [?] for help\n");
}
timer_start = av_gettime_relative();
while (!received_sigterm) {
OutputStream *ost;
while (!sch_wait(sch, stats_period, &transcode_ts)) {
int64_t cur_time= av_gettime_relative();
/* if 'q' pressed, exits */
@ -1192,58 +862,22 @@ static int transcode(int *err_rate_exceeded)
if (check_keyboard_interaction(cur_time) < 0)
break;
ret = choose_output(&ost);
if (ret == AVERROR(EAGAIN)) {
reset_eagain();
av_usleep(10000);
ret = 0;
continue;
} else if (ret < 0) {
av_log(NULL, AV_LOG_VERBOSE, "No more output streams to write to, finishing.\n");
ret = 0;
break;
}
ret = transcode_step(ost);
if (ret < 0 && ret != AVERROR_EOF) {
av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", av_err2str(ret));
break;
}
/* dump report by using the output first video and audio streams */
print_report(0, timer_start, cur_time);
print_report(0, timer_start, cur_time, transcode_ts);
}
/* at the end of stream, we must flush the decoder buffers */
for (ist = ist_iter(NULL); ist; ist = ist_iter(ist)) {
float err_rate;
if (!input_files[ist->file_index]->eof_reached) {
int err = process_input_packet(ist, NULL, 0);
ret = err_merge(ret, err);
}
err_rate = (ist->frames_decoded || ist->decode_errors) ?
ist->decode_errors / (ist->frames_decoded + ist->decode_errors) : 0.f;
if (err_rate > max_error_rate) {
av_log(ist, AV_LOG_FATAL, "Decode error rate %g exceeds maximum %g\n",
err_rate, max_error_rate);
*err_rate_exceeded = 1;
} else if (err_rate)
av_log(ist, AV_LOG_VERBOSE, "Decode error rate %g\n", err_rate);
}
ret = err_merge(ret, enc_flush());
term_exit();
ret = sch_stop(sch, &transcode_ts);
/* write the trailer if needed */
for (i = 0; i < nb_output_files; i++) {
for (int i = 0; i < nb_output_files; i++) {
int err = of_write_trailer(output_files[i]);
ret = err_merge(ret, err);
}
term_exit();
/* dump report by using the first video and audio streams */
print_report(1, timer_start, av_gettime_relative());
print_report(1, timer_start, av_gettime_relative(), transcode_ts);
return ret;
}
@ -1294,7 +928,9 @@ static int64_t getmaxrss(void)
int main(int argc, char **argv)
{
int ret, err_rate_exceeded;
Scheduler *sch = NULL;
int ret;
BenchmarkTimeStamps ti;
init_dynload();
@ -1311,8 +947,14 @@ int main(int argc, char **argv)
show_banner(argc, argv, options);
sch = sch_alloc();
if (!sch) {
ret = AVERROR(ENOMEM);
goto finish;
}
/* parse options and open all input/output files */
ret = ffmpeg_parse_options(argc, argv);
ret = ffmpeg_parse_options(argc, argv, sch);
if (ret < 0)
goto finish;
@ -1330,7 +972,7 @@ int main(int argc, char **argv)
}
current_time = ti = get_benchmark_time_stamps();
ret = transcode(&err_rate_exceeded);
ret = transcode(sch);
if (ret >= 0 && do_benchmark) {
int64_t utime, stime, rtime;
current_time = get_benchmark_time_stamps();
@ -1342,13 +984,16 @@ int main(int argc, char **argv)
utime / 1000000.0, stime / 1000000.0, rtime / 1000000.0);
}
ret = received_nb_signals ? 255 :
err_rate_exceeded ? 69 : ret;
ret = received_nb_signals ? 255 :
(ret == FFMPEG_ERROR_RATE_EXCEEDED) ? 69 : ret;
finish:
if (ret == AVERROR_EXIT)
ret = 0;
ffmpeg_cleanup(ret);
sch_free(&sch);
return ret;
}

View File

@ -27,6 +27,7 @@
#include <signal.h>
#include "cmdutils.h"
#include "ffmpeg_sched.h"
#include "sync_queue.h"
#include "libavformat/avformat.h"
@ -50,14 +51,16 @@
#include "libswresample/swresample.h"
// deprecated features
#define FFMPEG_OPT_PSNR 1
#define FFMPEG_OPT_MAP_CHANNEL 1
#define FFMPEG_OPT_MAP_SYNC 1
#define FFMPEG_ROTATION_METADATA 1
#define FFMPEG_OPT_QPHIST 1
#define FFMPEG_OPT_ADRIFT_THRESHOLD 1
#define FFMPEG_OPT_ENC_TIME_BASE_NUM 1
#define FFMPEG_OPT_TOP 1
#define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP 1
#define FFMPEG_OPT_VSYNC_DROP 1
#define FFMPEG_OPT_VSYNC 1
#define FFMPEG_OPT_FILTER_SCRIPT 1
#define FFMPEG_ERROR_RATE_EXCEEDED FFERRTAG('E', 'R', 'E', 'D')
enum VideoSyncMethod {
VSYNC_AUTO = -1,
@ -65,7 +68,9 @@ enum VideoSyncMethod {
VSYNC_CFR,
VSYNC_VFR,
VSYNC_VSCFR,
#if FFMPEG_OPT_VSYNC_DROP
VSYNC_DROP,
#endif
};
enum EncTimeBase {
@ -79,6 +84,28 @@ enum HWAccelID {
HWACCEL_GENERIC,
};
enum FrameOpaque {
FRAME_OPAQUE_SUB_HEARTBEAT = 1,
FRAME_OPAQUE_EOF,
FRAME_OPAQUE_SEND_COMMAND,
};
enum PacketOpaque {
PKT_OPAQUE_SUB_HEARTBEAT = 1,
PKT_OPAQUE_FIX_SUB_DURATION,
};
enum LatencyProbe {
LATENCY_PROBE_DEMUX,
LATENCY_PROBE_DEC_PRE,
LATENCY_PROBE_DEC_POST,
LATENCY_PROBE_FILTER_PRE,
LATENCY_PROBE_FILTER_POST,
LATENCY_PROBE_ENC_PRE,
LATENCY_PROBE_ENC_POST,
LATENCY_PROBE_NB,
};
typedef struct HWDevice {
const char *name;
enum AVHWDeviceType type;
@ -93,19 +120,6 @@ typedef struct StreamMap {
char *linklabel; /* name of an output link, for mapping lavfi outputs */
} StreamMap;
#if FFMPEG_OPT_MAP_CHANNEL
typedef struct {
int file_idx, stream_idx, channel_idx; // input
int ofile_idx, ostream_idx; // output
} AudioChannelMap;
#endif
typedef struct DemuxPktData {
// estimated dts in AV_TIME_BASE_Q,
// to be used when real dts is missing
int64_t dts_est;
} DemuxPktData;
typedef struct OptionsContext {
OptionGroup *g;
@ -115,22 +129,14 @@ typedef struct OptionsContext {
int seek_timestamp;
const char *format;
SpecifierOpt *codec_names;
int nb_codec_names;
SpecifierOpt *audio_ch_layouts;
int nb_audio_ch_layouts;
SpecifierOpt *audio_channels;
int nb_audio_channels;
SpecifierOpt *audio_sample_rate;
int nb_audio_sample_rate;
SpecifierOpt *frame_rates;
int nb_frame_rates;
SpecifierOpt *max_frame_rates;
int nb_max_frame_rates;
SpecifierOpt *frame_sizes;
int nb_frame_sizes;
SpecifierOpt *frame_pix_fmts;
int nb_frame_pix_fmts;
SpecifierOptList codec_names;
SpecifierOptList audio_ch_layouts;
SpecifierOptList audio_channels;
SpecifierOptList audio_sample_rate;
SpecifierOptList frame_rates;
SpecifierOptList max_frame_rates;
SpecifierOptList frame_sizes;
SpecifierOptList frame_pix_fmts;
/* input options */
int64_t input_ts_offset;
@ -143,26 +149,16 @@ typedef struct OptionsContext {
int input_sync_ref;
int find_stream_info;
SpecifierOpt *ts_scale;
int nb_ts_scale;
SpecifierOpt *dump_attachment;
int nb_dump_attachment;
SpecifierOpt *hwaccels;
int nb_hwaccels;
SpecifierOpt *hwaccel_devices;
int nb_hwaccel_devices;
SpecifierOpt *hwaccel_output_formats;
int nb_hwaccel_output_formats;
SpecifierOpt *autorotate;
int nb_autorotate;
SpecifierOptList ts_scale;
SpecifierOptList dump_attachment;
SpecifierOptList hwaccels;
SpecifierOptList hwaccel_devices;
SpecifierOptList hwaccel_output_formats;
SpecifierOptList autorotate;
/* output options */
StreamMap *stream_maps;
int nb_stream_maps;
#if FFMPEG_OPT_MAP_CHANNEL
AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */
int nb_audio_channel_maps; /* number of (valid) -map_channel settings */
#endif
const char **attachments;
int nb_attachments;
@ -185,104 +181,88 @@ typedef struct OptionsContext {
// keys are stream indices
AVDictionary *streamid;
SpecifierOpt *metadata;
int nb_metadata;
SpecifierOpt *max_frames;
int nb_max_frames;
SpecifierOpt *bitstream_filters;
int nb_bitstream_filters;
SpecifierOpt *codec_tags;
int nb_codec_tags;
SpecifierOpt *sample_fmts;
int nb_sample_fmts;
SpecifierOpt *qscale;
int nb_qscale;
SpecifierOpt *forced_key_frames;
int nb_forced_key_frames;
SpecifierOpt *fps_mode;
int nb_fps_mode;
SpecifierOpt *force_fps;
int nb_force_fps;
SpecifierOpt *frame_aspect_ratios;
int nb_frame_aspect_ratios;
SpecifierOpt *display_rotations;
int nb_display_rotations;
SpecifierOpt *display_hflips;
int nb_display_hflips;
SpecifierOpt *display_vflips;
int nb_display_vflips;
SpecifierOpt *rc_overrides;
int nb_rc_overrides;
SpecifierOpt *intra_matrices;
int nb_intra_matrices;
SpecifierOpt *inter_matrices;
int nb_inter_matrices;
SpecifierOpt *chroma_intra_matrices;
int nb_chroma_intra_matrices;
SpecifierOptList metadata;
SpecifierOptList max_frames;
SpecifierOptList bitstream_filters;
SpecifierOptList codec_tags;
SpecifierOptList sample_fmts;
SpecifierOptList qscale;
SpecifierOptList forced_key_frames;
SpecifierOptList fps_mode;
SpecifierOptList force_fps;
SpecifierOptList frame_aspect_ratios;
SpecifierOptList display_rotations;
SpecifierOptList display_hflips;
SpecifierOptList display_vflips;
SpecifierOptList rc_overrides;
SpecifierOptList intra_matrices;
SpecifierOptList inter_matrices;
SpecifierOptList chroma_intra_matrices;
#if FFMPEG_OPT_TOP
SpecifierOpt *top_field_first;
int nb_top_field_first;
SpecifierOptList top_field_first;
#endif
SpecifierOpt *metadata_map;
int nb_metadata_map;
SpecifierOpt *presets;
int nb_presets;
SpecifierOpt *copy_initial_nonkeyframes;
int nb_copy_initial_nonkeyframes;
SpecifierOpt *copy_prior_start;
int nb_copy_prior_start;
SpecifierOpt *filters;
int nb_filters;
SpecifierOpt *filter_scripts;
int nb_filter_scripts;
SpecifierOpt *reinit_filters;
int nb_reinit_filters;
SpecifierOpt *fix_sub_duration;
int nb_fix_sub_duration;
SpecifierOpt *fix_sub_duration_heartbeat;
int nb_fix_sub_duration_heartbeat;
SpecifierOpt *canvas_sizes;
int nb_canvas_sizes;
SpecifierOpt *pass;
int nb_pass;
SpecifierOpt *passlogfiles;
int nb_passlogfiles;
SpecifierOpt *max_muxing_queue_size;
int nb_max_muxing_queue_size;
SpecifierOpt *muxing_queue_data_threshold;
int nb_muxing_queue_data_threshold;
SpecifierOpt *guess_layout_max;
int nb_guess_layout_max;
SpecifierOpt *apad;
int nb_apad;
SpecifierOpt *discard;
int nb_discard;
SpecifierOpt *disposition;
int nb_disposition;
SpecifierOpt *program;
int nb_program;
SpecifierOpt *time_bases;
int nb_time_bases;
SpecifierOpt *enc_time_bases;
int nb_enc_time_bases;
SpecifierOpt *autoscale;
int nb_autoscale;
SpecifierOpt *bits_per_raw_sample;
int nb_bits_per_raw_sample;
SpecifierOpt *enc_stats_pre;
int nb_enc_stats_pre;
SpecifierOpt *enc_stats_post;
int nb_enc_stats_post;
SpecifierOpt *mux_stats;
int nb_mux_stats;
SpecifierOpt *enc_stats_pre_fmt;
int nb_enc_stats_pre_fmt;
SpecifierOpt *enc_stats_post_fmt;
int nb_enc_stats_post_fmt;
SpecifierOpt *mux_stats_fmt;
int nb_mux_stats_fmt;
SpecifierOptList metadata_map;
SpecifierOptList presets;
SpecifierOptList copy_initial_nonkeyframes;
SpecifierOptList copy_prior_start;
SpecifierOptList filters;
#if FFMPEG_OPT_FILTER_SCRIPT
SpecifierOptList filter_scripts;
#endif
SpecifierOptList reinit_filters;
SpecifierOptList fix_sub_duration;
SpecifierOptList fix_sub_duration_heartbeat;
SpecifierOptList canvas_sizes;
SpecifierOptList pass;
SpecifierOptList passlogfiles;
SpecifierOptList max_muxing_queue_size;
SpecifierOptList muxing_queue_data_threshold;
SpecifierOptList guess_layout_max;
SpecifierOptList apad;
SpecifierOptList discard;
SpecifierOptList disposition;
SpecifierOptList program;
SpecifierOptList stream_groups;
SpecifierOptList time_bases;
SpecifierOptList enc_time_bases;
SpecifierOptList autoscale;
SpecifierOptList bits_per_raw_sample;
SpecifierOptList enc_stats_pre;
SpecifierOptList enc_stats_post;
SpecifierOptList mux_stats;
SpecifierOptList enc_stats_pre_fmt;
SpecifierOptList enc_stats_post_fmt;
SpecifierOptList mux_stats_fmt;
} OptionsContext;
enum IFilterFlags {
IFILTER_FLAG_AUTOROTATE = (1 << 0),
IFILTER_FLAG_REINIT = (1 << 1),
IFILTER_FLAG_CFR = (1 << 2),
};
typedef struct InputFilterOptions {
int64_t trim_start_us;
int64_t trim_end_us;
uint8_t *name;
/* When IFILTER_FLAG_CFR is set, the stream is guaranteed to be CFR with
* this framerate.
*
* Otherwise, this is an estimate that should not be relied upon to be
* accurate */
AVRational framerate;
int sub2video_width;
int sub2video_height;
// a combination of IFILTER_FLAG_*
unsigned flags;
AVFrame *fallback;
} InputFilterOptions;
typedef struct InputFilter {
struct FilterGraph *graph;
uint8_t *name;
@ -299,70 +279,103 @@ typedef struct OutputFilter {
enum AVMediaType type;
/* pts of the last frame received from this filter, in AV_TIME_BASE_Q */
int64_t last_pts;
atomic_uint_least64_t nb_frames_dup;
atomic_uint_least64_t nb_frames_drop;
} OutputFilter;
typedef struct FilterGraph {
const AVClass *class;
int index;
AVFilterGraph *graph;
InputFilter **inputs;
int nb_inputs;
OutputFilter **outputs;
int nb_outputs;
} FilterGraph;
typedef struct Decoder Decoder;
enum DecoderFlags {
DECODER_FLAG_FIX_SUB_DURATION = (1 << 0),
// input timestamps are unreliable (guessed by demuxer)
DECODER_FLAG_TS_UNRELIABLE = (1 << 1),
// decoder should override timestamps by fixed framerate
// from DecoderOpts.framerate
DECODER_FLAG_FRAMERATE_FORCED = (1 << 2),
#if FFMPEG_OPT_TOP
DECODER_FLAG_TOP_FIELD_FIRST = (1 << 3),
#endif
DECODER_FLAG_SEND_END_TS = (1 << 4),
};
typedef struct DecoderOpts {
int flags;
char *name;
void *log_parent;
const AVCodec *codec;
const AVCodecParameters *par;
/* hwaccel options */
enum HWAccelID hwaccel_id;
enum AVHWDeviceType hwaccel_device_type;
char *hwaccel_device;
enum AVPixelFormat hwaccel_output_format;
AVRational time_base;
// Either forced (when DECODER_FLAG_FRAMERATE_FORCED is set) or
// estimated (otherwise) video framerate.
AVRational framerate;
} DecoderOpts;
typedef struct Decoder {
const AVClass *class;
enum AVMediaType type;
const uint8_t *subtitle_header;
int subtitle_header_size;
// number of frames/samples retrieved from the decoder
uint64_t frames_decoded;
uint64_t samples_decoded;
uint64_t decode_errors;
} Decoder;
typedef struct InputStream {
const AVClass *class;
const AVClass *class;
int file_index;
int index;
/* parent source */
struct InputFile *file;
AVStream *st;
int discard; /* true if stream data should be discarded */
int user_set_discard;
int decoding_needed; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */
#define DECODING_FOR_OST 1
#define DECODING_FOR_FILTER 2
int index;
AVStream *st;
int user_set_discard;
/**
* Codec parameters - to be used by the decoding/streamcopy code.
* st->codecpar should not be accessed, because it may be modified
* concurrently by the demuxing thread.
*/
AVCodecParameters *par;
Decoder *decoder;
AVCodecContext *dec_ctx;
const AVCodec *dec;
const AVCodecDescriptor *codec_desc;
AVCodecParameters *par;
Decoder *decoder;
const AVCodec *dec;
AVRational framerate_guessed;
int64_t nb_samples; /* number of samples in the last decoded audio frame before looping */
AVDictionary *decoder_opts;
AVRational framerate; /* framerate forced with -r */
/* framerate forced with -r */
AVRational framerate;
#if FFMPEG_OPT_TOP
int top_field_first;
int top_field_first;
#endif
int autorotate;
int autorotate;
int fix_sub_duration;
struct sub2video {
int w, h;
} sub2video;
int fix_sub_duration;
/* decoded data from this stream goes into all those filters
* currently video and audio only */
InputFilter **filters;
int nb_filters;
InputFilter **filters;
int nb_filters;
/*
* Output targets that do not go through lavfi, i.e. subtitles or
@ -371,61 +384,29 @@ typedef struct InputStream {
*/
struct OutputStream **outputs;
int nb_outputs;
int reinit_filters;
/* hwaccel options */
enum HWAccelID hwaccel_id;
enum AVHWDeviceType hwaccel_device_type;
char *hwaccel_device;
enum AVPixelFormat hwaccel_output_format;
/* stats */
// number of frames/samples retrieved from the decoder
uint64_t frames_decoded;
uint64_t samples_decoded;
uint64_t decode_errors;
} InputStream;
typedef struct LastFrameDuration {
int stream_idx;
int64_t duration;
} LastFrameDuration;
typedef struct InputFile {
const AVClass *class;
const AVClass *class;
int index;
// input format has no timestamps
int format_nots;
int index;
AVFormatContext *ctx;
int eof_reached; /* true if eof reached */
int eagain; /* true if last read attempt returned EAGAIN */
int64_t input_ts_offset;
int input_sync_ref;
int64_t input_ts_offset;
int input_sync_ref;
/**
* Effective format start time based on enabled streams.
*/
int64_t start_time_effective;
int64_t ts_offset;
int64_t start_time; /* user-specified start time in AV_TIME_BASE or AV_NOPTS_VALUE */
int64_t recording_time;
int64_t start_time_effective;
int64_t ts_offset;
/* user-specified start time in AV_TIME_BASE or AV_NOPTS_VALUE */
int64_t start_time;
/* streams that ffmpeg is aware of;
* there may be extra streams in ctx that are not mapped to an InputStream
* if new streams appear dynamically during demuxing */
InputStream **streams;
int nb_streams;
float readrate;
int accurate_seek;
/* when looping the input file, this queue is used by decoders to report
* the last frame duration back to the demuxer thread */
AVThreadMessageQueue *audio_duration_queue;
int audio_duration_queue_size;
InputStream **streams;
int nb_streams;
} InputFile;
enum forced_keyframes_const {
@ -459,6 +440,7 @@ enum EncStatsType {
ENC_STATS_PKT_SIZE,
ENC_STATS_BITRATE,
ENC_STATS_AVG_BITRATE,
ENC_STATS_KEYFRAME,
};
typedef struct EncStatsComponent {
@ -473,6 +455,9 @@ typedef struct EncStats {
int nb_components;
AVIOContext *io;
pthread_mutex_t lock;
int lock_initialized;
} EncStats;
extern const char *const forced_keyframes_const_names[];
@ -484,7 +469,9 @@ typedef enum {
enum {
KF_FORCE_SOURCE = 1,
#if FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP
KF_FORCE_SOURCE_NO_DROP = 2,
#endif
};
typedef struct KeyframeForceCtx {
@ -510,7 +497,9 @@ typedef struct OutputStream {
enum AVMediaType type;
int file_index; /* file index */
/* parent muxer */
struct OutputFile *file;
int index; /* stream index in the output file */
/**
@ -525,18 +514,12 @@ typedef struct OutputStream {
InputStream *ist;
AVStream *st; /* stream in the output file */
/* dts of the last packet sent to the muxing queue, in AV_TIME_BASE_Q */
int64_t last_mux_dts;
AVRational enc_timebase;
Encoder *enc;
AVCodecContext *enc_ctx;
uint64_t nb_frames_dup;
uint64_t nb_frames_drop;
int64_t last_dropped;
/* video only */
AVRational frame_rate;
AVRational max_frame_rate;
@ -545,27 +528,15 @@ typedef struct OutputStream {
int force_fps;
#if FFMPEG_OPT_TOP
int top_field_first;
#endif
#if FFMPEG_ROTATION_METADATA
int rotate_overridden;
#endif
int autoscale;
int bitexact;
int bits_per_raw_sample;
#if FFMPEG_ROTATION_METADATA
double rotate_override_value;
#endif
AVRational frame_aspect_ratio;
KeyframeForceCtx kf;
/* audio only */
#if FFMPEG_OPT_MAP_CHANNEL
int *audio_channels_map; /* list of the channels id to pick from the source stream */
int audio_channels_mapped; /* number of channels in audio_channels_map */
#endif
char *logfile_prefix;
FILE *logfile;
@ -575,17 +546,8 @@ typedef struct OutputStream {
AVDictionary *sws_dict;
AVDictionary *swr_opts;
char *apad;
OSTFinished finished; /* no more packets should be written for this stream */
int unavailable; /* true if the steram is unavailable (possibly temporarily) */
// init_output_stream() has been called for this stream
// The encoder and the bitstream filters have been initialized and the stream
// parameters are set in the AVStream.
int initialized;
int inputs_done;
const char *attachment_filename;
char *attachment_filename;
int keep_pix_fmt;
@ -597,10 +559,7 @@ typedef struct OutputStream {
uint64_t samples_encoded;
/* packet quality factor */
int quality;
int sq_idx_encode;
int sq_idx_mux;
atomic_int quality;
EncStats enc_stats_pre;
EncStats enc_stats_post;
@ -623,8 +582,6 @@ typedef struct OutputFile {
OutputStream **streams;
int nb_streams;
SyncQueue *sq_encode;
int64_t recording_time; ///< desired length of the resulting file in microseconds == AV_TIME_BASE units
int64_t start_time; ///< start time in microseconds == AV_TIME_BASE units
@ -634,6 +591,10 @@ typedef struct OutputFile {
// optionally attached as opaque_ref to decoded AVFrames
typedef struct FrameData {
// demuxer-estimated dts in AV_TIME_BASE_Q,
// to be used when real dts is missing
int64_t dts_est;
// properties that come from the decoder
struct {
uint64_t frame_num;
@ -645,6 +606,10 @@ typedef struct FrameData {
AVRational frame_rate_filter;
int bits_per_raw_sample;
int64_t wallclock[LATENCY_PROBE_NB];
AVCodecParameters *par_enc;
} FrameData;
extern InputFile **input_files;
@ -656,8 +621,11 @@ extern int nb_output_files;
extern FilterGraph **filtergraphs;
extern int nb_filtergraphs;
// standalone decoders (not tied to demuxed streams)
extern Decoder **decoders;
extern int nb_decoders;
extern char *vstats_filename;
extern char *sdp_filename;
extern float dts_delta_threshold;
extern float dts_error_threshold;
@ -690,7 +658,7 @@ extern const AVIOInterruptCB int_cb;
extern const OptionDef options[];
extern HWDevice *filter_hw_device;
extern unsigned nb_output_dumped;
extern atomic_uint nb_output_dumped;
extern int ignore_unknown_streams;
extern int copy_unknown_streams;
@ -699,10 +667,6 @@ extern int recast_media;
extern FILE *vstats_file;
#if FFMPEG_OPT_PSNR
extern int do_psnr;
#endif
void term_init(void);
void term_exit(void);
@ -712,20 +676,16 @@ void remove_avoptions(AVDictionary **a, AVDictionary *b);
int check_avoptions(AVDictionary *m);
int assert_file_overwrite(const char *filename);
char *file_read(const char *filename);
AVDictionary *strip_specifiers(const AVDictionary *dict);
int find_codec(void *logctx, const char *name,
enum AVMediaType type, int encoder, const AVCodec **codec);
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global);
int check_filter_outputs(void);
int filtergraph_is_simple(const FilterGraph *fg);
int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
char *graph_desc);
int init_complex_filtergraph(FilterGraph *fg);
int copy_av_subtitle(AVSubtitle *dst, const AVSubtitle *src);
int subtitle_wrap_frame(AVFrame *frame, AVSubtitle *subtitle, int copy);
char *graph_desc,
Scheduler *sch, unsigned sch_idx_enc);
int fg_finalise_bindings(FilterGraph *fg);
/**
* Get our axiliary frame data attached to the frame, allocating it
@ -733,10 +693,10 @@ int subtitle_wrap_frame(AVFrame *frame, AVSubtitle *subtitle, int copy);
*/
FrameData *frame_data(AVFrame *frame);
int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference);
int ifilter_send_eof(InputFilter *ifilter, int64_t pts, AVRational tb);
int ifilter_sub2video(InputFilter *ifilter, const AVFrame *frame);
void ifilter_sub2video_heartbeat(InputFilter *ifilter, int64_t pts, AVRational tb);
const FrameData *frame_data_c(AVFrame *frame);
FrameData *packet_data (AVPacket *pkt);
const FrameData *packet_data_c(AVPacket *pkt);
/**
* Set up fallback filtering parameters from a decoder context. They will only
@ -745,7 +705,8 @@ void ifilter_sub2video_heartbeat(InputFilter *ifilter, int64_t pts, AVRational t
*/
int ifilter_parameters_from_dec(InputFilter *ifilter, const AVCodecContext *dec);
int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost);
int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
unsigned sched_idx_enc);
/**
* Create a new filtergraph in the global filtergraph list.
@ -753,31 +714,14 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost);
* @param graph_desc Graph description; an av_malloc()ed string, filtergraph
* takes ownership of it.
*/
int fg_create(FilterGraph **pfg, char *graph_desc);
int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch);
void fg_free(FilterGraph **pfg);
/**
* Perform a step of transcoding for the specified filter graph.
*
* @param[in] graph filter graph to consider
* @param[out] best_ist input stream where a frame would allow to continue
* @return 0 for success, <0 for error
*/
int fg_transcode_step(FilterGraph *graph, InputStream **best_ist);
void fg_send_command(FilterGraph *fg, double time, const char *target,
const char *command, const char *arg, int all_filters);
/**
* Get and encode new output from specified filtergraph, without causing
* activity.
*
* @return 0 for success, <0 for severe errors
*/
int reap_filters(FilterGraph *fg, int flush);
int ffmpeg_parse_options(int argc, char **argv);
int ffmpeg_parse_options(int argc, char **argv, Scheduler *sch);
void enc_stats_write(OutputStream *ost, EncStats *es,
const AVFrame *frame, const AVPacket *pkt,
@ -798,29 +742,39 @@ void hw_device_free_all(void);
*/
AVBufferRef *hw_device_for_filter(void);
int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input);
int dec_open(InputStream *ist);
void dec_free(Decoder **pdec);
/**
* Create a standalone decoder.
*/
int dec_create(const OptionsContext *o, const char *arg, Scheduler *sch);
/**
* Submit a packet for decoding
* @param dec_opts Dictionary filled with decoder options. Its ownership
* is transferred to the decoder.
* @param param_out If non-NULL, media properties after opening the decoder
* are written here.
*
* When pkt==NULL and no_eof=0, there will be no more input. Flush decoders and
* mark all downstreams as finished.
*
* When pkt==NULL and no_eof=1, the stream was reset (e.g. after a seek). Flush
* decoders and await further input.
* @retval ">=0" non-negative scheduler index on success
* @retval "<0" an error code on failure
*/
int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof);
int dec_init(Decoder **pdec, Scheduler *sch,
AVDictionary **dec_opts, const DecoderOpts *o,
AVFrame *param_out);
void dec_free(Decoder **pdec);
int enc_alloc(Encoder **penc, const AVCodec *codec);
/*
* Called by filters to connect decoder's output to given filtergraph input.
*
* @param opts filtergraph input options, to be filled by this function
*/
int dec_filter_add(Decoder *dec, InputFilter *ifilter, InputFilterOptions *opts);
int enc_alloc(Encoder **penc, const AVCodec *codec,
Scheduler *sch, unsigned sch_idx);
void enc_free(Encoder **penc);
int enc_open(OutputStream *ost, AVFrame *frame);
int enc_subtitle(OutputFile *of, OutputStream *ost, const AVSubtitle *sub);
int enc_frame(OutputStream *ost, AVFrame *frame);
int enc_flush(void);
int enc_open(void *opaque, const AVFrame *frame);
int enc_loopback(Encoder *enc);
/*
* Initialize muxing state for the given stream, should be called
@ -830,37 +784,19 @@ int enc_flush(void);
*/
int of_stream_init(OutputFile *of, OutputStream *ost);
int of_write_trailer(OutputFile *of);
int of_open(const OptionsContext *o, const char *filename);
int of_open(const OptionsContext *o, const char *filename, Scheduler *sch);
void of_free(OutputFile **pof);
void of_enc_stats_close(void);
int of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt);
/**
* @param dts predicted packet dts in AV_TIME_BASE_Q
*/
int of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts);
int64_t of_filesize(OutputFile *of);
int ifile_open(const OptionsContext *o, const char *filename);
int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch);
void ifile_close(InputFile **f);
/**
* Get next input packet from the demuxer.
*
* @param pkt the packet is written here when this function returns 0
* @return
* - 0 when a packet has been read successfully
* - 1 when stream end was reached, but the stream is looped;
* caller should flush decoders and read from this demuxer again
* - a negative error code on failure
*/
int ifile_get_packet(InputFile *f, AVPacket **pkt);
int ist_output_add(InputStream *ist, OutputStream *ost);
int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple);
int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple,
InputFilterOptions *opts);
/**
* Find an unused input stream of given type.
@ -875,22 +811,8 @@ InputStream *ist_iter(InputStream *prev);
* pass NULL to start iteration */
OutputStream *ost_iter(OutputStream *prev);
void close_output_stream(OutputStream *ost);
int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket *pkt);
int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts);
void update_benchmark(const char *fmt, ...);
/**
* Merge two return codes - return one of the error codes if at least one of
* them was negative, 0 otherwise.
* Currently just picks the first one, eventually we might want to do something
* more sophisticated, like sorting them by priority.
*/
static inline int err_merge(int err0, int err1)
{
return (err0 < 0) ? err0 : FFMIN(err1, 0);
}
#define SPECIFIER_OPT_FMT_str "%s"
#define SPECIFIER_OPT_FMT_i "%i"
#define SPECIFIER_OPT_FMT_i64 "%"PRId64
@ -898,58 +820,41 @@ static inline int err_merge(int err0, int err1)
#define SPECIFIER_OPT_FMT_f "%f"
#define SPECIFIER_OPT_FMT_dbl "%lf"
#define WARN_MULTIPLE_OPT_USAGE(name, type, so, st)\
#define WARN_MULTIPLE_OPT_USAGE(optname, type, idx, st)\
{\
char namestr[128] = "";\
const SpecifierOpt *so = &o->optname.opt[idx];\
const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";\
for (int _i = 0; opt_name_##name[_i]; _i++)\
av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[_i], opt_name_##name[_i+1] ? (opt_name_##name[_i+2] ? ", " : " or ") : "");\
snprintf(namestr, sizeof(namestr), "-%s", o->optname.opt_canon->name);\
if (o->optname.opt_canon->flags & OPT_HAS_ALT) {\
const char * const *names_alt = o->optname.opt_canon->u1.names_alt;\
for (int _i = 0; names_alt[_i]; _i++)\
av_strlcatf(namestr, sizeof(namestr), "/-%s", names_alt[_i]);\
}\
av_log(NULL, AV_LOG_WARNING, "Multiple %s options specified for stream %d, only the last option '-%s%s%s "SPECIFIER_OPT_FMT_##type"' will be used.\n",\
namestr, st->index, opt_name_##name[0], spec[0] ? ":" : "", spec, so->u.type);\
namestr, st->index, o->optname.opt_canon->name, spec[0] ? ":" : "", spec, so->u.type);\
}
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
{\
int _ret, _matches = 0;\
SpecifierOpt *so;\
for (int _i = 0; _i < o->nb_ ## name; _i++) {\
char *spec = o->name[_i].specifier;\
int _ret, _matches = 0, _match_idx;\
for (int _i = 0; _i < o->name.nb_opt; _i++) {\
char *spec = o->name.opt[_i].specifier;\
if ((_ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\
outvar = o->name[_i].u.type;\
so = &o->name[_i];\
outvar = o->name.opt[_i].u.type;\
_match_idx = _i;\
_matches++;\
} else if (_ret < 0)\
return _ret;\
}\
if (_matches > 1)\
WARN_MULTIPLE_OPT_USAGE(name, type, so, st);\
if (_matches > 1 && o->name.opt_canon)\
WARN_MULTIPLE_OPT_USAGE(name, type, _match_idx, st);\
}
#define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)\
{\
int i;\
for (i = 0; i < o->nb_ ## name; i++) {\
char *spec = o->name[i].specifier;\
if (!strcmp(spec, mediatype))\
outvar = o->name[i].u.type;\
}\
}
const char *opt_match_per_type_str(const SpecifierOptList *sol,
char mediatype);
extern const char * const opt_name_codec_names[];
extern const char * const opt_name_codec_tags[];
extern const char * const opt_name_frame_rates[];
#if FFMPEG_OPT_TOP
extern const char * const opt_name_top_field_first[];
#endif
static inline void pkt_move(void *dst, void *src)
{
av_packet_move_ref(dst, src);
}
static inline void frame_move(void *dst, void *src)
{
av_frame_move_ref(dst, src);
}
int muxer_thread(void *arg);
int encoder_thread(void *arg);
#endif /* FFTOOLS_FFMPEG_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -297,48 +297,6 @@ void hw_device_free_all(void)
nb_hw_devices = 0;
}
int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input)
{
InputStream *ist = avctx->opaque;
AVFrame *output = NULL;
enum AVPixelFormat output_format = ist->hwaccel_output_format;
int err;
if (input->format == output_format) {
// Nothing to do.
return 0;
}
output = av_frame_alloc();
if (!output)
return AVERROR(ENOMEM);
output->format = output_format;
err = av_hwframe_transfer_data(output, input, 0);
if (err < 0) {
av_log(avctx, AV_LOG_ERROR, "Failed to transfer data to "
"output frame: %d.\n", err);
goto fail;
}
err = av_frame_copy_props(output, input);
if (err < 0) {
av_frame_unref(output);
goto fail;
}
av_frame_unref(input);
av_frame_move_ref(input, output);
av_frame_free(&output);
return 0;
fail:
av_frame_free(&output);
return err;
}
AVBufferRef *hw_device_for_filter(void)
{
// Pick the last hardware device if the user doesn't pick the device for

View File

@ -22,23 +22,26 @@
#include "ffmpeg.h"
#include "ffmpeg_mux.h"
#include "objpool.h"
#include "ffmpeg_utils.h"
#include "sync_queue.h"
#include "thread_queue.h"
#include "libavutil/avstring.h"
#include "libavutil/fifo.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/time.h"
#include "libavutil/timestamp.h"
#include "libavutil/thread.h"
#include "libavcodec/packet.h"
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
int want_sdp = 1;
typedef struct MuxThreadContext {
AVPacket *pkt;
AVPacket *fix_sub_duration_pkt;
} MuxThreadContext;
static Muxer *mux_from_of(OutputFile *of)
{
@ -58,23 +61,88 @@ static int64_t filesize(AVIOContext *pb)
return ret;
}
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
static void mux_log_debug_ts(OutputStream *ost, const AVPacket *pkt)
{
MuxStream *ms = ms_from_ost(ost);
AVFormatContext *s = mux->fc;
int64_t fs;
uint64_t frame_num;
int ret;
static const char *desc[] = {
[LATENCY_PROBE_DEMUX] = "demux",
[LATENCY_PROBE_DEC_PRE] = "decode",
[LATENCY_PROBE_DEC_POST] = "decode",
[LATENCY_PROBE_FILTER_PRE] = "filter",
[LATENCY_PROBE_FILTER_POST] = "filter",
[LATENCY_PROBE_ENC_PRE] = "encode",
[LATENCY_PROBE_ENC_POST] = "encode",
[LATENCY_PROBE_NB] = "mux",
};
fs = filesize(s->pb);
atomic_store(&mux->last_filesize, fs);
if (fs >= mux->limit_filesize) {
ret = AVERROR_EOF;
goto fail;
char latency[512];
*latency = 0;
if (pkt->opaque_ref) {
const FrameData *fd = (FrameData*)pkt->opaque_ref->data;
int64_t now = av_gettime_relative();
int64_t total = INT64_MIN;
int next;
for (unsigned i = 0; i < FF_ARRAY_ELEMS(fd->wallclock); i = next) {
int64_t val = fd->wallclock[i];
next = i + 1;
if (val == INT64_MIN)
continue;
if (total == INT64_MIN) {
total = now - val;
snprintf(latency, sizeof(latency), "total:%gms", total / 1e3);
}
// find the next valid entry
for (; next <= FF_ARRAY_ELEMS(fd->wallclock); next++) {
int64_t val_next = (next == FF_ARRAY_ELEMS(fd->wallclock)) ?
now : fd->wallclock[next];
int64_t diff;
if (val_next == INT64_MIN)
continue;
diff = val_next - val;
// print those stages that take at least 5% of total
if (100. * diff > 5. * total) {
av_strlcat(latency, ", ", sizeof(latency));
if (!strcmp(desc[i], desc[next]))
av_strlcat(latency, desc[i], sizeof(latency));
else
av_strlcatf(latency, sizeof(latency), "%s-%s:",
desc[i], desc[next]);
av_strlcatf(latency, sizeof(latency), " %gms/%d%%",
diff / 1e3, (int)(100. * diff / total));
}
break;
}
}
}
av_log(ost, AV_LOG_INFO, "muxer <- pts:%s pts_time:%s dts:%s dts_time:%s "
"duration:%s duration_time:%s size:%d latency(%s)\n",
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ost->st->time_base),
av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ost->st->time_base),
av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &ost->st->time_base),
pkt->size, *latency ? latency : "N/A");
}
static int mux_fixup_ts(Muxer *mux, MuxStream *ms, AVPacket *pkt)
{
OutputStream *ost = &ms->ost;
#if FFMPEG_OPT_VSYNC_DROP
if (ost->type == AVMEDIA_TYPE_VIDEO && ost->vsync_method == VSYNC_DROP)
pkt->pts = pkt->dts = AV_NOPTS_VALUE;
#endif
// rescale timestamps to the stream timebase
if (ost->type == AVMEDIA_TYPE_AUDIO && !ost->enc) {
@ -95,13 +163,12 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
av_packet_rescale_ts(pkt, pkt->time_base, ost->st->time_base);
pkt->time_base = ost->st->time_base;
if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
if (!(mux->fc->oformat->flags & AVFMT_NOTIMESTAMPS)) {
if (pkt->dts != AV_NOPTS_VALUE &&
pkt->pts != AV_NOPTS_VALUE &&
pkt->dts > pkt->pts) {
av_log(s, AV_LOG_WARNING, "Invalid DTS: %"PRId64" PTS: %"PRId64" in output stream %d:%d, replacing by guess\n",
pkt->dts, pkt->pts,
ost->file_index, ost->st->index);
av_log(ost, AV_LOG_WARNING, "Invalid DTS: %"PRId64" PTS: %"PRId64", replacing by guess\n",
pkt->dts, pkt->pts);
pkt->pts =
pkt->dts = pkt->pts + pkt->dts + ms->last_mux_dts + 1
- FFMIN3(pkt->pts, pkt->dts, ms->last_mux_dts + 1)
@ -110,20 +177,19 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
if ((ost->type == AVMEDIA_TYPE_AUDIO || ost->type == AVMEDIA_TYPE_VIDEO || ost->type == AVMEDIA_TYPE_SUBTITLE) &&
pkt->dts != AV_NOPTS_VALUE &&
ms->last_mux_dts != AV_NOPTS_VALUE) {
int64_t max = ms->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT);
int64_t max = ms->last_mux_dts + !(mux->fc->oformat->flags & AVFMT_TS_NONSTRICT);
if (pkt->dts < max) {
int loglevel = max - pkt->dts > 2 || ost->type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG;
if (exit_on_error)
loglevel = AV_LOG_ERROR;
av_log(s, loglevel, "Non-monotonic DTS in output stream "
"%d:%d; previous: %"PRId64", current: %"PRId64"; ",
ost->file_index, ost->st->index, ms->last_mux_dts, pkt->dts);
av_log(ost, loglevel, "Non-monotonic DTS; "
"previous: %"PRId64", current: %"PRId64"; ",
ms->last_mux_dts, pkt->dts);
if (exit_on_error) {
ret = AVERROR(EINVAL);
goto fail;
return AVERROR(EINVAL);
}
av_log(s, loglevel, "changing to %"PRId64". This may result "
av_log(ost, loglevel, "changing to %"PRId64". This may result "
"in incorrect timestamps in the output file.\n",
max);
if (pkt->pts >= pkt->dts)
@ -134,22 +200,36 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
}
ms->last_mux_dts = pkt->dts;
if (debug_ts)
mux_log_debug_ts(ost, pkt);
return 0;
}
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
{
MuxStream *ms = ms_from_ost(ost);
AVFormatContext *s = mux->fc;
int64_t fs;
uint64_t frame_num;
int ret;
fs = filesize(s->pb);
atomic_store(&mux->last_filesize, fs);
if (fs >= mux->limit_filesize) {
ret = AVERROR_EOF;
goto fail;
}
ret = mux_fixup_ts(mux, ms, pkt);
if (ret < 0)
goto fail;
ms->data_size_mux += pkt->size;
frame_num = atomic_fetch_add(&ost->packets_written, 1);
pkt->stream_index = ost->index;
if (debug_ts) {
av_log(ost, AV_LOG_INFO, "muxer <- type:%s "
"pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s size:%d\n",
av_get_media_type_string(ost->type),
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ost->st->time_base),
av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ost->st->time_base),
av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &ost->st->time_base),
pkt->size
);
}
if (ms->stats.io)
enc_stats_write(ost, &ms->stats, NULL, pkt, frame_num);
@ -167,12 +247,12 @@ fail:
return ret;
}
static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt, int *stream_eof)
static int sync_queue_process(Muxer *mux, MuxStream *ms, AVPacket *pkt, int *stream_eof)
{
OutputFile *of = &mux->of;
if (ost->sq_idx_mux >= 0) {
int ret = sq_send(mux->sq_mux, ost->sq_idx_mux, SQPKT(pkt));
if (ms->sq_idx_mux >= 0) {
int ret = sq_send(mux->sq_mux, ms->sq_idx_mux, SQPKT(pkt));
if (ret < 0) {
if (ret == AVERROR_EOF)
*stream_eof = 1;
@ -197,166 +277,47 @@ static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt, int
return ret;
}
} else if (pkt)
return write_packet(mux, ost, pkt);
return write_packet(mux, &ms->ost, pkt);
return 0;
}
static void thread_set_name(OutputFile *of)
static int of_streamcopy(OutputFile *of, OutputStream *ost, AVPacket *pkt);
/* apply the output bitstream filters */
static int mux_packet_filter(Muxer *mux, MuxThreadContext *mt,
OutputStream *ost, AVPacket *pkt, int *stream_eof)
{
char name[16];
snprintf(name, sizeof(name), "mux%d:%s", of->index, of->format->name);
ff_thread_setname(name);
}
static void *muxer_thread(void *arg)
{
Muxer *mux = arg;
OutputFile *of = &mux->of;
AVPacket *pkt = NULL;
int ret = 0;
pkt = av_packet_alloc();
if (!pkt) {
ret = AVERROR(ENOMEM);
goto finish;
}
thread_set_name(of);
while (1) {
OutputStream *ost;
int stream_idx, stream_eof = 0;
ret = tq_receive(mux->tq, &stream_idx, pkt);
if (stream_idx < 0) {
av_log(mux, AV_LOG_VERBOSE, "All streams finished\n");
ret = 0;
break;
}
ost = of->streams[stream_idx];
ret = sync_queue_process(mux, ost, ret < 0 ? NULL : pkt, &stream_eof);
av_packet_unref(pkt);
if (ret == AVERROR_EOF) {
if (stream_eof) {
tq_receive_finish(mux->tq, stream_idx);
} else {
av_log(mux, AV_LOG_VERBOSE, "Muxer returned EOF\n");
ret = 0;
break;
}
} else if (ret < 0) {
av_log(mux, AV_LOG_ERROR, "Error muxing a packet\n");
break;
}
}
finish:
av_packet_free(&pkt);
for (unsigned int i = 0; i < mux->fc->nb_streams; i++)
tq_receive_finish(mux->tq, i);
av_log(mux, AV_LOG_VERBOSE, "Terminating muxer thread\n");
return (void*)(intptr_t)ret;
}
static int thread_submit_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
{
int ret = 0;
if (!pkt || ost->finished & MUXER_FINISHED)
goto finish;
ret = tq_send(mux->tq, ost->index, pkt);
if (ret < 0)
goto finish;
return 0;
finish:
if (pkt)
av_packet_unref(pkt);
ost->finished |= MUXER_FINISHED;
tq_send_finish(mux->tq, ost->index);
return ret == AVERROR_EOF ? 0 : ret;
}
static int queue_packet(OutputStream *ost, AVPacket *pkt)
{
MuxStream *ms = ms_from_ost(ost);
AVPacket *tmp_pkt = NULL;
int ret;
if (!av_fifo_can_write(ms->muxing_queue)) {
size_t cur_size = av_fifo_can_read(ms->muxing_queue);
size_t pkt_size = pkt ? pkt->size : 0;
unsigned int are_we_over_size =
(ms->muxing_queue_data_size + pkt_size) > ms->muxing_queue_data_threshold;
size_t limit = are_we_over_size ? ms->max_muxing_queue_size : SIZE_MAX;
size_t new_size = FFMIN(2 * cur_size, limit);
if (new_size <= cur_size) {
av_log(ost, AV_LOG_ERROR,
"Too many packets buffered for output stream %d:%d.\n",
ost->file_index, ost->st->index);
return AVERROR(ENOSPC);
}
ret = av_fifo_grow2(ms->muxing_queue, new_size - cur_size);
if (ret < 0)
return ret;
}
if (pkt) {
ret = av_packet_make_refcounted(pkt);
if (ret < 0)
return ret;
tmp_pkt = av_packet_alloc();
if (!tmp_pkt)
return AVERROR(ENOMEM);
av_packet_move_ref(tmp_pkt, pkt);
ms->muxing_queue_data_size += tmp_pkt->size;
}
av_fifo_write(ms->muxing_queue, &tmp_pkt, 1);
return 0;
}
static int submit_packet(Muxer *mux, AVPacket *pkt, OutputStream *ost)
{
int ret;
if (mux->tq) {
return thread_submit_packet(mux, ost, pkt);
} else {
/* the muxer is not initialized yet, buffer the packet */
ret = queue_packet(ost, pkt);
if (ret < 0) {
if (pkt)
av_packet_unref(pkt);
return ret;
}
}
return 0;
}
int of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
{
Muxer *mux = mux_from_of(of);
MuxStream *ms = ms_from_ost(ost);
const char *err_msg;
int ret = 0;
if (pkt && pkt->dts != AV_NOPTS_VALUE)
ost->last_mux_dts = av_rescale_q(pkt->dts, pkt->time_base, AV_TIME_BASE_Q);
if (pkt && !ost->enc) {
ret = of_streamcopy(&mux->of, ost, pkt);
if (ret == AVERROR(EAGAIN))
return 0;
else if (ret == AVERROR_EOF) {
av_packet_unref(pkt);
pkt = NULL;
ret = 0;
*stream_eof = 1;
} else if (ret < 0)
goto fail;
}
// emit heartbeat for -fix_sub_duration;
// we are only interested in heartbeats on on random access points.
if (pkt && (pkt->flags & AV_PKT_FLAG_KEY)) {
mt->fix_sub_duration_pkt->opaque = (void*)(intptr_t)PKT_OPAQUE_FIX_SUB_DURATION;
mt->fix_sub_duration_pkt->pts = pkt->pts;
mt->fix_sub_duration_pkt->time_base = pkt->time_base;
ret = sch_mux_sub_heartbeat(mux->sch, mux->sch_idx, ms->sch_idx,
mt->fix_sub_duration_pkt);
if (ret < 0)
goto fail;
}
/* apply the output bitstream filters */
if (ms->bsf_ctx) {
int bsf_eof = 0;
@ -376,178 +337,184 @@ int of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
else if (ret == AVERROR_EOF)
bsf_eof = 1;
else if (ret < 0) {
err_msg = "applying bitstream filters to a packet";
goto fail;
av_log(ost, AV_LOG_ERROR,
"Error applying bitstream filters to a packet: %s",
av_err2str(ret));
if (exit_on_error)
return ret;
continue;
}
if (!bsf_eof)
ms->bsf_pkt->time_base = ms->bsf_ctx->time_base_out;
ret = submit_packet(mux, bsf_eof ? NULL : ms->bsf_pkt, ost);
ret = sync_queue_process(mux, ms, bsf_eof ? NULL : ms->bsf_pkt, stream_eof);
if (ret < 0)
goto mux_fail;
}
*stream_eof = 1;
} else {
ret = submit_packet(mux, pkt, ost);
ret = sync_queue_process(mux, ms, pkt, stream_eof);
if (ret < 0)
goto mux_fail;
}
return 0;
return *stream_eof ? AVERROR_EOF : 0;
mux_fail:
err_msg = "submitting a packet to the muxer";
fail:
av_log(ost, AV_LOG_ERROR, "Error %s\n", err_msg);
return exit_on_error ? ret : 0;
if (ret != AVERROR_EOF)
av_log(ost, AV_LOG_ERROR, "Error %s: %s\n", err_msg, av_err2str(ret));
return ret;
}
int of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts)
static void thread_set_name(OutputFile *of)
{
char name[16];
snprintf(name, sizeof(name), "mux%d:%s", of->index, of->format->name);
ff_thread_setname(name);
}
static void mux_thread_uninit(MuxThreadContext *mt)
{
av_packet_free(&mt->pkt);
av_packet_free(&mt->fix_sub_duration_pkt);
memset(mt, 0, sizeof(*mt));
}
static int mux_thread_init(MuxThreadContext *mt)
{
memset(mt, 0, sizeof(*mt));
mt->pkt = av_packet_alloc();
if (!mt->pkt)
goto fail;
mt->fix_sub_duration_pkt = av_packet_alloc();
if (!mt->fix_sub_duration_pkt)
goto fail;
return 0;
fail:
mux_thread_uninit(mt);
return AVERROR(ENOMEM);
}
int muxer_thread(void *arg)
{
Muxer *mux = arg;
OutputFile *of = &mux->of;
MuxThreadContext mt;
int ret = 0;
ret = mux_thread_init(&mt);
if (ret < 0)
goto finish;
thread_set_name(of);
while (1) {
OutputStream *ost;
int stream_idx, stream_eof = 0;
ret = sch_mux_receive(mux->sch, of->index, mt.pkt);
stream_idx = mt.pkt->stream_index;
if (stream_idx < 0) {
av_log(mux, AV_LOG_VERBOSE, "All streams finished\n");
ret = 0;
break;
}
ost = of->streams[mux->sch_stream_idx[stream_idx]];
mt.pkt->stream_index = ost->index;
mt.pkt->flags &= ~AV_PKT_FLAG_TRUSTED;
ret = mux_packet_filter(mux, &mt, ost, ret < 0 ? NULL : mt.pkt, &stream_eof);
av_packet_unref(mt.pkt);
if (ret == AVERROR_EOF) {
if (stream_eof) {
sch_mux_receive_finish(mux->sch, of->index, stream_idx);
} else {
av_log(mux, AV_LOG_VERBOSE, "Muxer returned EOF\n");
ret = 0;
break;
}
} else if (ret < 0) {
av_log(mux, AV_LOG_ERROR, "Error muxing a packet\n");
break;
}
}
finish:
mux_thread_uninit(&mt);
return ret;
}
static int of_streamcopy(OutputFile *of, OutputStream *ost, AVPacket *pkt)
{
OutputFile *of = output_files[ost->file_index];
MuxStream *ms = ms_from_ost(ost);
FrameData *fd = pkt->opaque_ref ? (FrameData*)pkt->opaque_ref->data : NULL;
int64_t dts = fd ? fd->dts_est : AV_NOPTS_VALUE;
int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time;
int64_t ts_offset;
AVPacket *opkt = ms->pkt;
int ret;
av_packet_unref(opkt);
if (of->recording_time != INT64_MAX &&
dts >= of->recording_time + start_time)
pkt = NULL;
// EOF: flush output bitstream filters.
if (!pkt)
return of_output_packet(of, ost, NULL);
return AVERROR_EOF;
if (!ms->streamcopy_started && !(pkt->flags & AV_PKT_FLAG_KEY) &&
!ms->copy_initial_nonkeyframes)
return 0;
return AVERROR(EAGAIN);
if (!ms->streamcopy_started) {
if (!ms->copy_prior_start &&
(pkt->pts == AV_NOPTS_VALUE ?
dts < ms->ts_copy_start :
pkt->pts < av_rescale_q(ms->ts_copy_start, AV_TIME_BASE_Q, pkt->time_base)))
return 0;
return AVERROR(EAGAIN);
if (of->start_time != AV_NOPTS_VALUE && dts < of->start_time)
return 0;
return AVERROR(EAGAIN);
}
ret = av_packet_ref(opkt, pkt);
if (ret < 0)
return ret;
ts_offset = av_rescale_q(start_time, AV_TIME_BASE_Q, opkt->time_base);
ts_offset = av_rescale_q(start_time, AV_TIME_BASE_Q, pkt->time_base);
if (pkt->pts != AV_NOPTS_VALUE)
opkt->pts -= ts_offset;
pkt->pts -= ts_offset;
if (pkt->dts == AV_NOPTS_VALUE) {
opkt->dts = av_rescale_q(dts, AV_TIME_BASE_Q, opkt->time_base);
pkt->dts = av_rescale_q(dts, AV_TIME_BASE_Q, pkt->time_base);
} else if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
opkt->pts = opkt->dts - ts_offset;
}
opkt->dts -= ts_offset;
{
int ret = trigger_fix_sub_duration_heartbeat(ost, pkt);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR,
"Subtitle heartbeat logic failed in %s! (%s)\n",
__func__, av_err2str(ret));
return ret;
}
pkt->pts = pkt->dts - ts_offset;
}
ret = of_output_packet(of, ost, opkt);
if (ret < 0)
return ret;
pkt->dts -= ts_offset;
ms->streamcopy_started = 1;
return 0;
}
static int thread_stop(Muxer *mux)
{
void *ret;
int print_sdp(const char *filename);
if (!mux || !mux->tq)
return 0;
for (unsigned int i = 0; i < mux->fc->nb_streams; i++)
tq_send_finish(mux->tq, i);
pthread_join(mux->thread, &ret);
tq_free(&mux->tq);
return (int)(intptr_t)ret;
}
static int thread_start(Muxer *mux)
{
AVFormatContext *fc = mux->fc;
ObjPool *op;
int ret;
op = objpool_alloc_packets();
if (!op)
return AVERROR(ENOMEM);
mux->tq = tq_alloc(fc->nb_streams, mux->thread_queue_size, op, pkt_move);
if (!mux->tq) {
objpool_free(&op);
return AVERROR(ENOMEM);
}
ret = pthread_create(&mux->thread, NULL, muxer_thread, (void*)mux);
if (ret) {
tq_free(&mux->tq);
return AVERROR(ret);
}
/* flush the muxing queues */
for (int i = 0; i < fc->nb_streams; i++) {
OutputStream *ost = mux->of.streams[i];
MuxStream *ms = ms_from_ost(ost);
AVPacket *pkt;
while (av_fifo_read(ms->muxing_queue, &pkt, 1) >= 0) {
ret = thread_submit_packet(mux, ost, pkt);
if (pkt) {
ms->muxing_queue_data_size -= pkt->size;
av_packet_free(&pkt);
}
if (ret < 0)
return ret;
}
}
return 0;
}
static int print_sdp(void)
int print_sdp(const char *filename)
{
char sdp[16384];
int i;
int j, ret;
int j = 0, ret;
AVIOContext *sdp_pb;
AVFormatContext **avc;
for (i = 0; i < nb_output_files; i++) {
if (!mux_from_of(output_files[i])->header_written)
return 0;
}
avc = av_malloc_array(nb_output_files, sizeof(*avc));
if (!avc)
return AVERROR(ENOMEM);
for (i = 0, j = 0; i < nb_output_files; i++) {
for (int i = 0; i < nb_output_files; i++) {
if (!strcmp(output_files[i]->format->name, "rtp")) {
avc[j] = mux_from_of(output_files[i])->fc;
j++;
@ -564,40 +531,31 @@ static int print_sdp(void)
if (ret < 0)
goto fail;
if (!sdp_filename) {
if (!filename) {
printf("SDP:\n%s\n", sdp);
fflush(stdout);
} else {
ret = avio_open2(&sdp_pb, sdp_filename, AVIO_FLAG_WRITE, &int_cb, NULL);
ret = avio_open2(&sdp_pb, filename, AVIO_FLAG_WRITE, &int_cb, NULL);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Failed to open sdp file '%s'\n", sdp_filename);
av_log(NULL, AV_LOG_ERROR, "Failed to open sdp file '%s'\n", filename);
goto fail;
}
avio_print(sdp_pb, sdp);
avio_closep(&sdp_pb);
av_freep(&sdp_filename);
}
// SDP successfully written, allow muxer threads to start
ret = 1;
fail:
av_freep(&avc);
return ret;
}
int mux_check_init(Muxer *mux)
int mux_check_init(void *arg)
{
Muxer *mux = arg;
OutputFile *of = &mux->of;
AVFormatContext *fc = mux->fc;
int ret, i;
for (i = 0; i < fc->nb_streams; i++) {
OutputStream *ost = of->streams[i];
if (!ost->initialized)
return 0;
}
int ret;
ret = avformat_write_header(fc, &mux->opts);
if (ret < 0) {
@ -609,27 +567,7 @@ int mux_check_init(Muxer *mux)
mux->header_written = 1;
av_dump_format(fc, of->index, fc->url, 1);
nb_output_dumped++;
if (sdp_filename || want_sdp) {
ret = print_sdp();
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error writing the SDP.\n");
return ret;
} else if (ret == 1) {
/* SDP is written only after all the muxers are ready, so now we
* start ALL the threads */
for (i = 0; i < nb_output_files; i++) {
ret = thread_start(mux_from_of(output_files[i]));
if (ret < 0)
return ret;
}
}
} else {
ret = thread_start(mux_from_of(of));
if (ret < 0)
return ret;
}
atomic_fetch_add(&nb_output_dumped, 1);
return 0;
}
@ -686,9 +624,10 @@ int of_stream_init(OutputFile *of, OutputStream *ost)
ost->st->time_base);
}
ost->initialized = 1;
if (ms->sch_idx >= 0)
return sch_mux_stream_ready(mux->sch, of->index, ms->sch_idx);
return mux_check_init(mux);
return 0;
}
static int check_written(OutputFile *of)
@ -786,8 +725,8 @@ static void mux_final_stats(Muxer *mux)
}
av_log(of, AV_LOG_INFO,
"video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB "
"global headers:%1.0fkB muxing overhead: %s\n",
"video:%1.0fKiB audio:%1.0fKiB subtitle:%1.0fKiB other streams:%1.0fKiB "
"global headers:%1.0fKiB muxing overhead: %s\n",
video_size / 1024.0,
audio_size / 1024.0,
subtitle_size / 1024.0,
@ -802,15 +741,13 @@ int of_write_trailer(OutputFile *of)
AVFormatContext *fc = mux->fc;
int ret, mux_result = 0;
if (!mux->tq) {
if (!mux->header_written) {
av_log(mux, AV_LOG_ERROR,
"Nothing was written into output file, because "
"at least one of its streams received no packets.\n");
return AVERROR(EINVAL);
}
mux_result = thread_stop(mux);
ret = av_write_trailer(fc);
if (ret < 0) {
av_log(mux, AV_LOG_ERROR, "Error writing trailer: %s\n", av_err2str(ret));
@ -836,6 +773,17 @@ int of_write_trailer(OutputFile *of)
return mux_result;
}
static void enc_stats_uninit(EncStats *es)
{
for (int i = 0; i < es->nb_components; i++)
av_freep(&es->components[i].str);
av_freep(&es->components);
if (es->lock_initialized)
pthread_mutex_destroy(&es->lock);
es->lock_initialized = 0;
}
static void ost_free(OutputStream **post)
{
OutputStream *ost = *post;
@ -855,13 +803,6 @@ static void ost_free(OutputStream **post)
ost->logfile = NULL;
}
if (ms->muxing_queue) {
AVPacket *pkt;
while (av_fifo_read(ms->muxing_queue, &pkt, 1) >= 0)
av_packet_free(&pkt);
av_fifo_freep2(&ms->muxing_queue);
}
avcodec_parameters_free(&ost->par_in);
av_bsf_free(&ms->bsf_ctx);
@ -876,10 +817,7 @@ static void ost_free(OutputStream **post)
av_freep(&ost->logfile_prefix);
av_freep(&ost->apad);
#if FFMPEG_OPT_MAP_CHANNEL
av_freep(&ost->audio_channels_map);
ost->audio_channels_mapped = 0;
#endif
av_freep(&ost->attachment_filename);
av_dict_free(&ost->sws_dict);
av_dict_free(&ost->swr_opts);
@ -888,17 +826,9 @@ static void ost_free(OutputStream **post)
av_freep(&ost->enc_ctx->stats_in);
avcodec_free_context(&ost->enc_ctx);
for (int i = 0; i < ost->enc_stats_pre.nb_components; i++)
av_freep(&ost->enc_stats_pre.components[i].str);
av_freep(&ost->enc_stats_pre.components);
for (int i = 0; i < ost->enc_stats_post.nb_components; i++)
av_freep(&ost->enc_stats_post.components[i].str);
av_freep(&ost->enc_stats_post.components);
for (int i = 0; i < ms->stats.nb_components; i++)
av_freep(&ms->stats.components[i].str);
av_freep(&ms->stats.components);
enc_stats_uninit(&ost->enc_stats_pre);
enc_stats_uninit(&ost->enc_stats_post);
enc_stats_uninit(&ms->stats);
av_freep(post);
}
@ -926,15 +856,14 @@ void of_free(OutputFile **pof)
return;
mux = mux_from_of(of);
thread_stop(mux);
sq_free(&of->sq_encode);
sq_free(&mux->sq_mux);
for (int i = 0; i < of->nb_streams; i++)
ost_free(&of->streams[i]);
av_freep(&of->streams);
av_freep(&mux->sch_stream_idx);
av_dict_free(&mux->opts);
av_packet_free(&mux->sq_pkt);

View File

@ -24,7 +24,7 @@
#include <stdatomic.h>
#include <stdint.h>
#include "thread_queue.h"
#include "ffmpeg_sched.h"
#include "libavformat/avformat.h"
@ -32,88 +32,78 @@
#include "libavutil/dict.h"
#include "libavutil/fifo.h"
#include "libavutil/thread.h"
typedef struct MuxStream {
OutputStream ost;
OutputStream ost;
// name used for logging
char log_name[32];
char log_name[32];
/* the packets are buffered here until the muxer is ready to be initialized */
AVFifo *muxing_queue;
AVBSFContext *bsf_ctx;
AVPacket *bsf_pkt;
AVBSFContext *bsf_ctx;
AVPacket *bsf_pkt;
AVPacket *pkt;
AVPacket *pkt;
EncStats stats;
EncStats stats;
int sch_idx;
int sch_idx_enc;
int sch_idx_src;
int64_t max_frames;
int sq_idx_mux;
/*
* The size of the AVPackets' buffers in queue.
* Updated when a packet is either pushed or pulled from the queue.
*/
size_t muxing_queue_data_size;
int max_muxing_queue_size;
/* Threshold after which max_muxing_queue_size will be in effect */
size_t muxing_queue_data_threshold;
int64_t max_frames;
// timestamp from which the streamcopied streams should start,
// in AV_TIME_BASE_Q;
// everything before it should be discarded
int64_t ts_copy_start;
int64_t ts_copy_start;
/* dts of the last packet sent to the muxer, in the stream timebase
* used for making up missing dts values */
int64_t last_mux_dts;
int64_t last_mux_dts;
int64_t stream_duration;
AVRational stream_duration_tb;
int64_t stream_duration;
AVRational stream_duration_tb;
// state for av_rescale_delta() call for audio in write_packet()
int64_t ts_rescale_delta_last;
int64_t ts_rescale_delta_last;
// combined size of all the packets sent to the muxer
uint64_t data_size_mux;
uint64_t data_size_mux;
int copy_initial_nonkeyframes;
int copy_prior_start;
int streamcopy_started;
int copy_initial_nonkeyframes;
int copy_prior_start;
int streamcopy_started;
} MuxStream;
typedef struct Muxer {
OutputFile of;
OutputFile of;
// name used for logging
char log_name[32];
char log_name[32];
AVFormatContext *fc;
AVFormatContext *fc;
pthread_t thread;
ThreadQueue *tq;
Scheduler *sch;
unsigned sch_idx;
AVDictionary *opts;
// OutputStream indices indexed by scheduler stream indices
int *sch_stream_idx;
int nb_sch_stream_idx;
int thread_queue_size;
AVDictionary *opts;
/* filesize limit expressed in bytes */
int64_t limit_filesize;
atomic_int_least64_t last_filesize;
int header_written;
int64_t limit_filesize;
atomic_int_least64_t last_filesize;
int header_written;
SyncQueue *sq_mux;
AVPacket *sq_pkt;
SyncQueue *sq_mux;
AVPacket *sq_pkt;
} Muxer;
/* whether we want to print an SDP, set in of_open() */
extern int want_sdp;
int mux_check_init(Muxer *mux);
int mux_check_init(void *arg);
static MuxStream *ms_from_ost(OutputStream *ost)
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2506
fftools/ffmpeg_sched.c Normal file

File diff suppressed because it is too large Load Diff

477
fftools/ffmpeg_sched.h Normal file
View File

@ -0,0 +1,477 @@
/*
* Inter-thread scheduling/synchronization.
* Copyright (c) 2023 Anton Khirnov
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FFTOOLS_FFMPEG_SCHED_H
#define FFTOOLS_FFMPEG_SCHED_H
#include <stddef.h>
#include <stdint.h>
#include "ffmpeg_utils.h"
/*
* This file contains the API for the transcode scheduler.
*
* Overall architecture of the transcoding process involves instances of the
* following components:
* - demuxers, each containing any number of demuxed streams; demuxed packets
* belonging to some stream are sent to any number of decoders (transcoding)
* and/or muxers (streamcopy);
* - decoders, which receive encoded packets from some demuxed stream or
* encoder, decode them, and send decoded frames to any number of filtergraph
* inputs (audio/video) or encoders (subtitles);
* - filtergraphs, each containing zero or more inputs (0 in case the
* filtergraph contains a lavfi source filter), and one or more outputs; the
* inputs and outputs need not have matching media types;
* each filtergraph input receives decoded frames from some decoder;
* filtered frames from each output are sent to some encoder;
* - encoders, which receive decoded frames from some decoder (subtitles) or
* some filtergraph output (audio/video), encode them, and send encoded
* packets to any number of muxed streams or decoders;
* - muxers, each containing any number of muxed streams; each muxed stream
* receives encoded packets from some demuxed stream (streamcopy) or some
* encoder (transcoding); those packets are interleaved and written out by the
* muxer.
*
* There must be at least one muxer instance, otherwise the transcode produces
* no output and is meaningless. Otherwise, in a generic transcoding scenario
* there may be arbitrary number of instances of any of the above components,
* interconnected in various ways.
*
* The code tries to keep all the output streams across all the muxers in sync
* (i.e. at the same DTS), which is accomplished by varying the rates at which
* packets are read from different demuxers and lavfi sources. Note that the
* degree of control we have over synchronization is fundamentally limited - if
* some demuxed streams in the same input are interleaved at different rates
* than that at which they are to be muxed (e.g. because an input file is badly
* interleaved, or the user changed their speed by mismatching amounts), then
* there will be increasing amounts of buffering followed by eventual
* transcoding failure.
*
* N.B. 1: there are meaningful transcode scenarios with no demuxers, e.g.
* - encoding and muxing output from filtergraph(s) that have no inputs;
* - creating a file that contains nothing but attachments and/or metadata.
*
* N.B. 2: a filtergraph output could, in principle, feed multiple encoders, but
* this is unnecessary because the (a)split filter provides the same
* functionality.
*
* The scheduler, in the above model, is the master object that oversees and
* facilitates the transcoding process. The basic idea is that all instances
* of the abovementioned components communicate only with the scheduler and not
* with each other. The scheduler is then the single place containing the
* knowledge about the whole transcoding pipeline.
*/
struct AVFrame;
struct AVPacket;
typedef struct Scheduler Scheduler;
enum SchedulerNodeType {
SCH_NODE_TYPE_NONE = 0,
SCH_NODE_TYPE_DEMUX,
SCH_NODE_TYPE_MUX,
SCH_NODE_TYPE_DEC,
SCH_NODE_TYPE_ENC,
SCH_NODE_TYPE_FILTER_IN,
SCH_NODE_TYPE_FILTER_OUT,
};
typedef struct SchedulerNode {
enum SchedulerNodeType type;
unsigned idx;
unsigned idx_stream;
} SchedulerNode;
typedef int (*SchThreadFunc)(void *arg);
#define SCH_DSTREAM(file, stream) \
(SchedulerNode){ .type = SCH_NODE_TYPE_DEMUX, \
.idx = file, .idx_stream = stream }
#define SCH_MSTREAM(file, stream) \
(SchedulerNode){ .type = SCH_NODE_TYPE_MUX, \
.idx = file, .idx_stream = stream }
#define SCH_DEC(decoder) \
(SchedulerNode){ .type = SCH_NODE_TYPE_DEC, \
.idx = decoder }
#define SCH_ENC(encoder) \
(SchedulerNode){ .type = SCH_NODE_TYPE_ENC, \
.idx = encoder }
#define SCH_FILTER_IN(filter, input) \
(SchedulerNode){ .type = SCH_NODE_TYPE_FILTER_IN, \
.idx = filter, .idx_stream = input }
#define SCH_FILTER_OUT(filter, output) \
(SchedulerNode){ .type = SCH_NODE_TYPE_FILTER_OUT, \
.idx = filter, .idx_stream = output }
Scheduler *sch_alloc(void);
void sch_free(Scheduler **sch);
int sch_start(Scheduler *sch);
int sch_stop(Scheduler *sch, int64_t *finish_ts);
/**
* Wait until transcoding terminates or the specified timeout elapses.
*
* @param timeout_us Amount of time in microseconds after which this function
* will timeout.
* @param transcode_ts Current transcode timestamp in AV_TIME_BASE_Q, for
* informational purposes only.
*
* @retval 0 waiting timed out, transcoding is not finished
* @retval 1 transcoding is finished
*/
int sch_wait(Scheduler *sch, uint64_t timeout_us, int64_t *transcode_ts);
/**
* Add a demuxer to the scheduler.
*
* @param func Function executed as the demuxer task.
* @param ctx Demuxer state; will be passed to func and used for logging.
*
* @retval ">=0" Index of the newly-created demuxer.
* @retval "<0" Error code.
*/
int sch_add_demux(Scheduler *sch, SchThreadFunc func, void *ctx);
/**
* Add a demuxed stream for a previously added demuxer.
*
* @param demux_idx index previously returned by sch_add_demux()
*
* @retval ">=0" Index of the newly-created demuxed stream.
* @retval "<0" Error code.
*/
int sch_add_demux_stream(Scheduler *sch, unsigned demux_idx);
/**
* Add a decoder to the scheduler.
*
* @param func Function executed as the decoder task.
* @param ctx Decoder state; will be passed to func and used for logging.
* @param send_end_ts The decoder will return an end timestamp after flush packets
* are delivered to it. See documentation for
* sch_dec_receive() for more details.
*
* @retval ">=0" Index of the newly-created decoder.
* @retval "<0" Error code.
*/
int sch_add_dec(Scheduler *sch, SchThreadFunc func, void *ctx,
int send_end_ts);
/**
* Add a filtergraph to the scheduler.
*
* @param nb_inputs Number of filtergraph inputs.
* @param nb_outputs number of filtergraph outputs
* @param func Function executed as the filtering task.
* @param ctx Filter state; will be passed to func and used for logging.
*
* @retval ">=0" Index of the newly-created filtergraph.
* @retval "<0" Error code.
*/
int sch_add_filtergraph(Scheduler *sch, unsigned nb_inputs, unsigned nb_outputs,
SchThreadFunc func, void *ctx);
/**
* Add a muxer to the scheduler.
*
* Note that muxer thread startup is more complicated than for other components,
* because
* - muxer streams fed by audio/video encoders become initialized dynamically at
* runtime, after those encoders receive their first frame and initialize
* themselves, followed by calling sch_mux_stream_ready()
* - the header can be written after all the streams for a muxer are initialized
* - we may need to write an SDP, which must happen
* - AFTER all the headers are written
* - BEFORE any packets are written by any muxer
* - with all the muxers quiescent
* To avoid complicated muxer-thread synchronization dances, we postpone
* starting the muxer threads until after the SDP is written. The sequence of
* events is then as follows:
* - After sch_mux_stream_ready() is called for all the streams in a given muxer,
* the header for that muxer is written (care is taken that headers for
* different muxers are not written concurrently, since they write file
* information to stderr). If SDP is not wanted, the muxer thread then starts
* and muxing begins.
* - When SDP _is_ wanted, no muxer threads start until the header for the last
* muxer is written. After that, the SDP is written, after which all the muxer
* threads are started at once.
*
* In order for the above to work, the scheduler needs to be able to invoke
* just writing the header, which is the reason the init parameter exists.
*
* @param func Function executed as the muxing task.
* @param init Callback that is called to initialize the muxer and write the
* header. Called after sch_mux_stream_ready() is called for all the
* streams in the muxer.
* @param ctx Muxer state; will be passed to func/init and used for logging.
* @param sdp_auto Determines automatic SDP writing - see sch_sdp_filename().
* @param thread_queue_size number of packets that can be buffered before
* sending to the muxer blocks
*
* @retval ">=0" Index of the newly-created muxer.
* @retval "<0" Error code.
*/
int sch_add_mux(Scheduler *sch, SchThreadFunc func, int (*init)(void *),
void *ctx, int sdp_auto, unsigned thread_queue_size);
/**
* Add a muxed stream for a previously added muxer.
*
* @param mux_idx index previously returned by sch_add_mux()
*
* @retval ">=0" Index of the newly-created muxed stream.
* @retval "<0" Error code.
*/
int sch_add_mux_stream(Scheduler *sch, unsigned mux_idx);
/**
* Configure limits on packet buffering performed before the muxer task is
* started.
*
* @param mux_idx index previously returned by sch_add_mux()
* @param stream_idx_idx index previously returned by sch_add_mux_stream()
* @param data_threshold Total size of the buffered packets' data after which
* max_packets applies.
* @param max_packets maximum Maximum number of buffered packets after
* data_threshold is reached.
*/
void sch_mux_stream_buffering(Scheduler *sch, unsigned mux_idx, unsigned stream_idx,
size_t data_threshold, int max_packets);
/**
* Signal to the scheduler that the specified muxed stream is initialized and
* ready. Muxing is started once all the streams are ready.
*/
int sch_mux_stream_ready(Scheduler *sch, unsigned mux_idx, unsigned stream_idx);
/**
* Set the file path for the SDP.
*
* The SDP is written when either of the following is true:
* - this function is called at least once
* - sdp_auto=1 is passed to EVERY call of sch_add_mux()
*/
int sch_sdp_filename(Scheduler *sch, const char *sdp_filename);
/**
* Add an encoder to the scheduler.
*
* @param func Function executed as the encoding task.
* @param ctx Encoder state; will be passed to func and used for logging.
* @param open_cb This callback, if specified, will be called when the first
* frame is obtained for this encoder. For audio encoders with a
* fixed frame size (which use a sync queue in the scheduler to
* rechunk frames), it must return that frame size on success.
* Otherwise (non-audio, variable frame size) it should return 0.
*
* @retval ">=0" Index of the newly-created encoder.
* @retval "<0" Error code.
*/
int sch_add_enc(Scheduler *sch, SchThreadFunc func, void *ctx,
int (*open_cb)(void *func_arg, const struct AVFrame *frame));
/**
* Add an pre-encoding sync queue to the scheduler.
*
* @param buf_size_us Sync queue buffering size, passed to sq_alloc().
* @param logctx Logging context for the sync queue. passed to sq_alloc().
*
* @retval ">=0" Index of the newly-created sync queue.
* @retval "<0" Error code.
*/
int sch_add_sq_enc(Scheduler *sch, uint64_t buf_size_us, void *logctx);
int sch_sq_add_enc(Scheduler *sch, unsigned sq_idx, unsigned enc_idx,
int limiting, uint64_t max_frames);
int sch_connect(Scheduler *sch, SchedulerNode src, SchedulerNode dst);
enum DemuxSendFlags {
/**
* Treat the packet as an EOF for SCH_NODE_TYPE_MUX destinations
* send normally to other types.
*/
DEMUX_SEND_STREAMCOPY_EOF = (1 << 0),
};
/**
* Called by demuxer tasks to communicate with their downstreams. The following
* may be sent:
* - a demuxed packet for the stream identified by pkt->stream_index;
* - demuxer discontinuity/reset (e.g. after a seek) - this is signalled by an
* empty packet with stream_index=-1.
*
* @param demux_idx demuxer index
* @param pkt A demuxed packet to send.
* When flushing (i.e. pkt->stream_index=-1 on entry to this
* function), on successful return pkt->pts/pkt->time_base will be
* set to the maximum end timestamp of any decoded audio stream, or
* AV_NOPTS_VALUE if no decoded audio streams are present.
*
* @retval "non-negative value" success
* @retval AVERROR_EOF all consumers for the stream are done
* @retval AVERROR_EXIT all consumers are done, should terminate demuxing
* @retval "anoter negative error code" other failure
*/
int sch_demux_send(Scheduler *sch, unsigned demux_idx, struct AVPacket *pkt,
unsigned flags);
/**
* Called by decoder tasks to receive a packet for decoding.
*
* @param dec_idx decoder index
* @param pkt Input packet will be written here on success.
*
* An empty packet signals that the decoder should be flushed, but
* more packets will follow (e.g. after seeking). When a decoder
* created with send_end_ts=1 receives a flush packet, it must write
* the end timestamp of the stream after flushing to
* pkt->pts/time_base on the next call to this function (if any).
*
* @retval "non-negative value" success
* @retval AVERROR_EOF no more packets will arrive, should terminate decoding
* @retval "another negative error code" other failure
*/
int sch_dec_receive(Scheduler *sch, unsigned dec_idx, struct AVPacket *pkt);
/**
* Called by decoder tasks to send a decoded frame downstream.
*
* @param dec_idx Decoder index previously returned by sch_add_dec().
* @param frame Decoded frame; on success it is consumed and cleared by this
* function
*
* @retval ">=0" success
* @retval AVERROR_EOF all consumers are done, should terminate decoding
* @retval "another negative error code" other failure
*/
int sch_dec_send(Scheduler *sch, unsigned dec_idx, struct AVFrame *frame);
/**
* Called by filtergraph tasks to obtain frames for filtering. Will wait for a
* frame to become available and return it in frame.
*
* Filtergraphs that contain lavfi sources and do not currently require new
* input frames should call this function as a means of rate control - then
* in_idx should be set equal to nb_inputs on entry to this function.
*
* @param fg_idx Filtergraph index previously returned by sch_add_filtergraph().
* @param[in,out] in_idx On input contains the index of the input on which a frame
* is most desired. May be set to nb_inputs to signal that
* the filtergraph does not need more input currently.
*
* On success, will be replaced with the input index of
* the actually returned frame or EOF timestamp.
*
* @retval ">=0" Frame data or EOF timestamp was delivered into frame, in_idx
* contains the index of the input it belongs to.
* @retval AVERROR(EAGAIN) No frame was returned, the filtergraph should
* resume filtering. May only be returned when
* in_idx=nb_inputs on entry to this function.
* @retval AVERROR_EOF No more frames will arrive, should terminate filtering.
*/
int sch_filter_receive(Scheduler *sch, unsigned fg_idx,
unsigned *in_idx, struct AVFrame *frame);
/**
* Called by filter tasks to signal that a filter input will no longer accept input.
*
* @param fg_idx Filtergraph index previously returned from sch_add_filtergraph().
* @param in_idx Index of the input to finish.
*/
void sch_filter_receive_finish(Scheduler *sch, unsigned fg_idx, unsigned in_idx);
/**
* Called by filtergraph tasks to send a filtered frame or EOF to consumers.
*
* @param fg_idx Filtergraph index previously returned by sch_add_filtergraph().
* @param out_idx Index of the output which produced the frame.
* @param frame The frame to send to consumers. When NULL, signals that no more
* frames will be produced for the specified output. When non-NULL,
* the frame is consumed and cleared by this function on success.
*
* @retval "non-negative value" success
* @retval AVERROR_EOF all consumers are done
* @retval "anoter negative error code" other failure
*/
int sch_filter_send(Scheduler *sch, unsigned fg_idx, unsigned out_idx,
struct AVFrame *frame);
int sch_filter_command(Scheduler *sch, unsigned fg_idx, struct AVFrame *frame);
/**
* Called by encoder tasks to obtain frames for encoding. Will wait for a frame
* to become available and return it in frame.
*
* @param enc_idx Encoder index previously returned by sch_add_enc().
* @param frame Newly-received frame will be stored here on success. Must be
* clean on entrance to this function.
*
* @retval 0 A frame was successfully delivered into frame.
* @retval AVERROR_EOF No more frames will be delivered, the encoder should
* flush everything and terminate.
*
*/
int sch_enc_receive(Scheduler *sch, unsigned enc_idx, struct AVFrame *frame);
/**
* Called by encoder tasks to send encoded packets downstream.
*
* @param enc_idx Encoder index previously returned by sch_add_enc().
* @param pkt An encoded packet; it will be consumed and cleared by this
* function on success.
*
* @retval 0 success
* @retval "<0" Error code.
*/
int sch_enc_send (Scheduler *sch, unsigned enc_idx, struct AVPacket *pkt);
/**
* Called by muxer tasks to obtain packets for muxing. Will wait for a packet
* for any muxed stream to become available and return it in pkt.
*
* @param mux_idx Muxer index previously returned by sch_add_mux().
* @param pkt Newly-received packet will be stored here on success. Must be
* clean on entrance to this function.
*
* @retval 0 A packet was successfully delivered into pkt. Its stream_index
* corresponds to a stream index previously returned from
* sch_add_mux_stream().
* @retval AVERROR_EOF When pkt->stream_index is non-negative, this signals that
* no more packets will be delivered for this stream index.
* Otherwise this indicates that no more packets will be
* delivered for any stream and the muxer should therefore
* flush everything and terminate.
*/
int sch_mux_receive(Scheduler *sch, unsigned mux_idx, struct AVPacket *pkt);
/**
* Called by muxer tasks to signal that a stream will no longer accept input.
*
* @param stream_idx Stream index previously returned from sch_add_mux_stream().
*/
void sch_mux_receive_finish(Scheduler *sch, unsigned mux_idx, unsigned stream_idx);
int sch_mux_sub_heartbeat_add(Scheduler *sch, unsigned mux_idx, unsigned stream_idx,
unsigned dec_idx);
int sch_mux_sub_heartbeat(Scheduler *sch, unsigned mux_idx, unsigned stream_idx,
const AVPacket *pkt);
#endif /* FFTOOLS_FFMPEG_SCHED_H */

56
fftools/ffmpeg_utils.h Normal file
View File

@ -0,0 +1,56 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FFTOOLS_FFMPEG_UTILS_H
#define FFTOOLS_FFMPEG_UTILS_H
#include <stdint.h>
#include "libavutil/common.h"
#include "libavutil/frame.h"
#include "libavutil/rational.h"
#include "libavcodec/packet.h"
typedef struct Timestamp {
int64_t ts;
AVRational tb;
} Timestamp;
/**
* Merge two return codes - return one of the error codes if at least one of
* them was negative, 0 otherwise.
* Currently just picks the first one, eventually we might want to do something
* more sophisticated, like sorting them by priority.
*/
static inline int err_merge(int err0, int err1)
{
return (err0 < 0) ? err0 : FFMIN(err1, 0);
}
static inline void pkt_move(void *dst, void *src)
{
av_packet_move_ref(dst, src);
}
static inline void frame_move(void *dst, void *src)
{
av_frame_move_ref(dst, src);
}
#endif // FFTOOLS_FFMPEG_UTILS_H

View File

@ -58,6 +58,7 @@
#include <SDL_thread.h>
#include "cmdutils.h"
#include "ffplay_renderer.h"
#include "opt_common.h"
const char program_name[] = "ffplay";
@ -350,6 +351,9 @@ static char *afilters = NULL;
static int autorotate = 1;
static int find_stream_info = 1;
static int filter_nbthreads = 0;
static int enable_vulkan = 0;
static char *vulkan_params = NULL;
static const char *hwaccel = NULL;
/* current context */
static int is_full_screen;
@ -362,6 +366,8 @@ static SDL_Renderer *renderer;
static SDL_RendererInfo renderer_info = {0};
static SDL_AudioDeviceID audio_dev;
static VkRenderer *vk_renderer;
static const struct TextureFormatEntry {
enum AVPixelFormat format;
int texture_fmt;
@ -394,7 +400,10 @@ static int opt_add_vfilter(void *optctx, const char *opt, const char *arg)
if (ret < 0)
return ret;
vfilters_list[nb_vfilters - 1] = arg;
vfilters_list[nb_vfilters - 1] = av_strdup(arg);
if (!vfilters_list[nb_vfilters - 1])
return AVERROR(ENOMEM);
return 0;
}
@ -931,6 +940,13 @@ static int upload_texture(SDL_Texture **tex, AVFrame *frame)
return ret;
}
static enum AVColorSpace sdl_supported_color_spaces[] = {
AVCOL_SPC_BT709,
AVCOL_SPC_BT470BG,
AVCOL_SPC_SMPTE170M,
AVCOL_SPC_UNSPECIFIED,
};
static void set_sdl_yuv_conversion_mode(AVFrame *frame)
{
#if SDL_VERSION_ATLEAST(2,0,8)
@ -954,6 +970,11 @@ static void video_image_display(VideoState *is)
SDL_Rect rect;
vp = frame_queue_peek_last(&is->pictq);
if (vk_renderer) {
vk_renderer_display(vk_renderer, vp->frame);
return;
}
if (is->subtitle_st) {
if (frame_queue_nb_remaining(&is->subpq) > 0) {
sp = frame_queue_peek(&is->subpq);
@ -1289,10 +1310,18 @@ static void do_exit(VideoState *is)
}
if (renderer)
SDL_DestroyRenderer(renderer);
if (vk_renderer)
vk_renderer_destroy(vk_renderer);
if (window)
SDL_DestroyWindow(window);
uninit_opts();
for (int i = 0; i < nb_vfilters; i++)
av_freep(&vfilters_list[i]);
av_freep(&vfilters_list);
av_freep(&video_codec_name);
av_freep(&audio_codec_name);
av_freep(&subtitle_codec_name);
av_freep(&input_filename);
avformat_network_deinit();
if (show_status)
printf("\n");
@ -1702,16 +1731,14 @@ display:
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
av_bprintf(&buf,
"%7.2f %s:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64" \r",
"%7.2f %s:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB \r",
get_master_clock(is),
(is->audio_st && is->video_st) ? "A-V" : (is->video_st ? "M-V" : (is->audio_st ? "M-A" : " ")),
av_diff,
is->frame_drops_early + is->frame_drops_late,
aqsize / 1024,
vqsize / 1024,
sqsize,
is->video_st ? is->viddec.avctx->pts_correction_num_faulty_dts : 0,
is->video_st ? is->viddec.avctx->pts_correction_num_faulty_pts : 0);
sqsize);
if (show_status == 1 && AV_LOG_INFO > av_log_get_level())
fprintf(stderr, "%s", buf.str);
@ -1845,6 +1872,10 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
const AVDictionaryEntry *e = NULL;
int nb_pix_fmts = 0;
int i, j;
AVBufferSrcParameters *par = av_buffersrc_parameters_alloc();
if (!par)
return AVERROR(ENOMEM);
for (i = 0; i < renderer_info.num_texture_formats; i++) {
for (j = 0; j < FF_ARRAY_ELEMS(sdl_texture_format_map) - 1; j++) {
@ -1868,10 +1899,12 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
graph->scale_sws_opts = av_strdup(sws_flags_str);
snprintf(buffersrc_args, sizeof(buffersrc_args),
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d:"
"colorspace=%d:range=%d",
frame->width, frame->height, frame->format,
is->video_st->time_base.num, is->video_st->time_base.den,
codecpar->sample_aspect_ratio.num, FFMAX(codecpar->sample_aspect_ratio.den, 1));
codecpar->sample_aspect_ratio.num, FFMAX(codecpar->sample_aspect_ratio.den, 1),
frame->colorspace, frame->color_range);
if (fr.num && fr.den)
av_strlcatf(buffersrc_args, sizeof(buffersrc_args), ":frame_rate=%d/%d", fr.num, fr.den);
@ -1880,6 +1913,10 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
"ffplay_buffer", buffersrc_args, NULL,
graph)) < 0)
goto fail;
par->hw_frames_ctx = frame->hw_frames_ctx;
ret = av_buffersrc_parameters_set(filt_src, par);
if (ret < 0)
goto fail;
ret = avfilter_graph_create_filter(&filt_out,
avfilter_get_by_name("buffersink"),
@ -1889,6 +1926,9 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
if ((ret = av_opt_set_int_list(filt_out, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
goto fail;
if (!vk_renderer &&
(ret = av_opt_set_int_list(filt_out, "color_spaces", sdl_supported_color_spaces, AVCOL_SPC_UNSPECIFIED, AV_OPT_SEARCH_CHILDREN)) < 0)
goto fail;
last_filter = filt_out;
@ -1916,8 +1956,13 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX);
if (sd)
displaymatrix = (int32_t *)sd->data;
if (!displaymatrix)
displaymatrix = (int32_t *)av_stream_get_side_data(is->video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
if (!displaymatrix) {
const AVPacketSideData *psd = av_packet_side_data_get(is->video_st->codecpar->coded_side_data,
is->video_st->codecpar->nb_coded_side_data,
AV_PKT_DATA_DISPLAYMATRIX);
if (psd)
displaymatrix = (int32_t *)psd->data;
}
theta = get_rotation(displaymatrix);
if (fabs(theta - 90) < 1.0) {
@ -1941,6 +1986,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
is->out_video_filter = filt_out;
fail:
av_freep(&par);
return ret;
}
@ -2541,6 +2587,37 @@ static int audio_open(void *opaque, AVChannelLayout *wanted_channel_layout, int
return spec.size;
}
static int create_hwaccel(AVBufferRef **device_ctx)
{
enum AVHWDeviceType type;
int ret;
AVBufferRef *vk_dev;
*device_ctx = NULL;
if (!hwaccel)
return 0;
type = av_hwdevice_find_type_by_name(hwaccel);
if (type == AV_HWDEVICE_TYPE_NONE)
return AVERROR(ENOTSUP);
ret = vk_renderer_get_hw_dev(vk_renderer, &vk_dev);
if (ret < 0)
return ret;
ret = av_hwdevice_ctx_create_derived(device_ctx, type, vk_dev, 0);
if (!ret)
return 0;
if (ret != AVERROR(ENOSYS))
return ret;
av_log(NULL, AV_LOG_WARNING, "Derive %s from vulkan not supported.\n", hwaccel);
ret = av_hwdevice_ctx_create(device_ctx, type, NULL, NULL, 0);
return ret;
}
/* open a given stream. Return 0 if OK */
static int stream_component_open(VideoState *is, int stream_index)
{
@ -2608,6 +2685,12 @@ static int stream_component_open(VideoState *is, int stream_index)
av_dict_set(&opts, "flags", "+copy_opaque", AV_DICT_MULTIKEY);
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
ret = create_hwaccel(&avctx->hw_device_ctx);
if (ret < 0)
goto fail;
}
if ((ret = avcodec_open2(avctx, codec, &opts)) < 0) {
goto fail;
}
@ -2789,8 +2872,6 @@ static int read_thread(void *arg)
if (genpts)
ic->flags |= AVFMT_FLAG_GENPTS;
av_format_inject_global_side_data(ic);
if (find_stream_info) {
AVDictionary **opts;
int orig_nb_streams = ic->nb_streams;
@ -3444,6 +3525,8 @@ static void event_loop(VideoState *cur_stream)
SDL_DestroyTexture(cur_stream->vis_texture);
cur_stream->vis_texture = NULL;
}
if (vk_renderer)
vk_renderer_resize(vk_renderer, screen_width, screen_height);
case SDL_WINDOWEVENT_EXPOSED:
cur_stream->force_refresh = 1;
}
@ -3461,7 +3544,7 @@ static void event_loop(VideoState *cur_stream)
static int opt_width(void *optctx, const char *opt, const char *arg)
{
double num;
int ret = parse_number(opt, arg, OPT_INT64, 1, INT_MAX, &num);
int ret = parse_number(opt, arg, OPT_TYPE_INT64, 1, INT_MAX, &num);
if (ret < 0)
return ret;
@ -3472,7 +3555,7 @@ static int opt_width(void *optctx, const char *opt, const char *arg)
static int opt_height(void *optctx, const char *opt, const char *arg)
{
double num;
int ret = parse_number(opt, arg, OPT_INT64, 1, INT_MAX, &num);
int ret = parse_number(opt, arg, OPT_TYPE_INT64, 1, INT_MAX, &num);
if (ret < 0)
return ret;
@ -3513,7 +3596,7 @@ static int opt_show_mode(void *optctx, const char *opt, const char *arg)
if (show_mode == SHOW_MODE_NONE) {
double num;
int ret = parse_number(opt, arg, OPT_INT, 0, SHOW_MODE_NB-1, &num);
int ret = parse_number(opt, arg, OPT_TYPE_INT, 0, SHOW_MODE_NB-1, &num);
if (ret < 0)
return ret;
show_mode = num;
@ -3531,7 +3614,9 @@ static int opt_input_file(void *optctx, const char *filename)
}
if (!strcmp(filename, "-"))
filename = "fd:";
input_filename = filename;
input_filename = av_strdup(filename);
if (!input_filename)
return AVERROR(ENOMEM);
return 0;
}
@ -3539,6 +3624,7 @@ static int opt_input_file(void *optctx, const char *filename)
static int opt_codec(void *optctx, const char *opt, const char *arg)
{
const char *spec = strchr(opt, ':');
const char **name;
if (!spec) {
av_log(NULL, AV_LOG_ERROR,
"No media specifier was specified in '%s' in option '%s'\n",
@ -3546,68 +3632,75 @@ static int opt_codec(void *optctx, const char *opt, const char *arg)
return AVERROR(EINVAL);
}
spec++;
switch (spec[0]) {
case 'a' : audio_codec_name = arg; break;
case 's' : subtitle_codec_name = arg; break;
case 'v' : video_codec_name = arg; break;
case 'a' : name = &audio_codec_name; break;
case 's' : name = &subtitle_codec_name; break;
case 'v' : name = &video_codec_name; break;
default:
av_log(NULL, AV_LOG_ERROR,
"Invalid media specifier '%s' in option '%s'\n", spec, opt);
return AVERROR(EINVAL);
}
return 0;
av_freep(name);
*name = av_strdup(arg);
return *name ? 0 : AVERROR(ENOMEM);
}
static int dummy;
static const OptionDef options[] = {
CMDUTILS_COMMON_OPTIONS
{ "x", HAS_ARG, { .func_arg = opt_width }, "force displayed width", "width" },
{ "y", HAS_ARG, { .func_arg = opt_height }, "force displayed height", "height" },
{ "fs", OPT_BOOL, { &is_full_screen }, "force full screen" },
{ "an", OPT_BOOL, { &audio_disable }, "disable audio" },
{ "vn", OPT_BOOL, { &video_disable }, "disable video" },
{ "sn", OPT_BOOL, { &subtitle_disable }, "disable subtitling" },
{ "ast", OPT_STRING | HAS_ARG | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_AUDIO] }, "select desired audio stream", "stream_specifier" },
{ "vst", OPT_STRING | HAS_ARG | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_VIDEO] }, "select desired video stream", "stream_specifier" },
{ "sst", OPT_STRING | HAS_ARG | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_SUBTITLE] }, "select desired subtitle stream", "stream_specifier" },
{ "ss", HAS_ARG | OPT_TIME, { &start_time }, "seek to a given position in seconds", "pos" },
{ "t", HAS_ARG | OPT_TIME, { &duration }, "play \"duration\" seconds of audio/video", "duration" },
{ "bytes", OPT_INT | HAS_ARG, { &seek_by_bytes }, "seek by bytes 0=off 1=on -1=auto", "val" },
{ "seek_interval", OPT_FLOAT | HAS_ARG, { &seek_interval }, "set seek interval for left/right keys, in seconds", "seconds" },
{ "nodisp", OPT_BOOL, { &display_disable }, "disable graphical display" },
{ "noborder", OPT_BOOL, { &borderless }, "borderless window" },
{ "alwaysontop", OPT_BOOL, { &alwaysontop }, "window always on top" },
{ "volume", OPT_INT | HAS_ARG, { &startup_volume}, "set startup volume 0=min 100=max", "volume" },
{ "f", HAS_ARG, { .func_arg = opt_format }, "force format", "fmt" },
{ "stats", OPT_BOOL | OPT_EXPERT, { &show_status }, "show status", "" },
{ "fast", OPT_BOOL | OPT_EXPERT, { &fast }, "non spec compliant optimizations", "" },
{ "genpts", OPT_BOOL | OPT_EXPERT, { &genpts }, "generate pts", "" },
{ "drp", OPT_INT | HAS_ARG | OPT_EXPERT, { &decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""},
{ "lowres", OPT_INT | HAS_ARG | OPT_EXPERT, { &lowres }, "", "" },
{ "sync", HAS_ARG | OPT_EXPERT, { .func_arg = opt_sync }, "set audio-video sync. type (type=audio/video/ext)", "type" },
{ "autoexit", OPT_BOOL | OPT_EXPERT, { &autoexit }, "exit at the end", "" },
{ "exitonkeydown", OPT_BOOL | OPT_EXPERT, { &exit_on_keydown }, "exit on key down", "" },
{ "exitonmousedown", OPT_BOOL | OPT_EXPERT, { &exit_on_mousedown }, "exit on mouse down", "" },
{ "loop", OPT_INT | HAS_ARG | OPT_EXPERT, { &loop }, "set number of times the playback shall be looped", "loop count" },
{ "framedrop", OPT_BOOL | OPT_EXPERT, { &framedrop }, "drop frames when cpu is too slow", "" },
{ "infbuf", OPT_BOOL | OPT_EXPERT, { &infinite_buffer }, "don't limit the input buffer size (useful with realtime streams)", "" },
{ "window_title", OPT_STRING | HAS_ARG, { &window_title }, "set window title", "window title" },
{ "left", OPT_INT | HAS_ARG | OPT_EXPERT, { &screen_left }, "set the x position for the left of the window", "x pos" },
{ "top", OPT_INT | HAS_ARG | OPT_EXPERT, { &screen_top }, "set the y position for the top of the window", "y pos" },
{ "vf", OPT_EXPERT | HAS_ARG, { .func_arg = opt_add_vfilter }, "set video filters", "filter_graph" },
{ "af", OPT_STRING | HAS_ARG, { &afilters }, "set audio filters", "filter_graph" },
{ "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
{ "showmode", HAS_ARG, { .func_arg = opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
{ "i", OPT_BOOL, { &dummy}, "read specified file", "input_file"},
{ "codec", HAS_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
{ "acodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { &audio_codec_name }, "force audio decoder", "decoder_name" },
{ "scodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { &subtitle_codec_name }, "force subtitle decoder", "decoder_name" },
{ "vcodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { &video_codec_name }, "force video decoder", "decoder_name" },
{ "autorotate", OPT_BOOL, { &autorotate }, "automatically rotate video", "" },
{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
{ "x", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_width }, "force displayed width", "width" },
{ "y", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_height }, "force displayed height", "height" },
{ "fs", OPT_TYPE_BOOL, 0, { &is_full_screen }, "force full screen" },
{ "an", OPT_TYPE_BOOL, 0, { &audio_disable }, "disable audio" },
{ "vn", OPT_TYPE_BOOL, 0, { &video_disable }, "disable video" },
{ "sn", OPT_TYPE_BOOL, 0, { &subtitle_disable }, "disable subtitling" },
{ "ast", OPT_TYPE_STRING, OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_AUDIO] }, "select desired audio stream", "stream_specifier" },
{ "vst", OPT_TYPE_STRING, OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_VIDEO] }, "select desired video stream", "stream_specifier" },
{ "sst", OPT_TYPE_STRING, OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_SUBTITLE] }, "select desired subtitle stream", "stream_specifier" },
{ "ss", OPT_TYPE_TIME, 0, { &start_time }, "seek to a given position in seconds", "pos" },
{ "t", OPT_TYPE_TIME, 0, { &duration }, "play \"duration\" seconds of audio/video", "duration" },
{ "bytes", OPT_TYPE_INT, 0, { &seek_by_bytes }, "seek by bytes 0=off 1=on -1=auto", "val" },
{ "seek_interval", OPT_TYPE_FLOAT, 0, { &seek_interval }, "set seek interval for left/right keys, in seconds", "seconds" },
{ "nodisp", OPT_TYPE_BOOL, 0, { &display_disable }, "disable graphical display" },
{ "noborder", OPT_TYPE_BOOL, 0, { &borderless }, "borderless window" },
{ "alwaysontop", OPT_TYPE_BOOL, 0, { &alwaysontop }, "window always on top" },
{ "volume", OPT_TYPE_INT, 0, { &startup_volume}, "set startup volume 0=min 100=max", "volume" },
{ "f", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_format }, "force format", "fmt" },
{ "stats", OPT_TYPE_BOOL, OPT_EXPERT, { &show_status }, "show status", "" },
{ "fast", OPT_TYPE_BOOL, OPT_EXPERT, { &fast }, "non spec compliant optimizations", "" },
{ "genpts", OPT_TYPE_BOOL, OPT_EXPERT, { &genpts }, "generate pts", "" },
{ "drp", OPT_TYPE_INT, OPT_EXPERT, { &decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""},
{ "lowres", OPT_TYPE_INT, OPT_EXPERT, { &lowres }, "", "" },
{ "sync", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_sync }, "set audio-video sync. type (type=audio/video/ext)", "type" },
{ "autoexit", OPT_TYPE_BOOL, OPT_EXPERT, { &autoexit }, "exit at the end", "" },
{ "exitonkeydown", OPT_TYPE_BOOL, OPT_EXPERT, { &exit_on_keydown }, "exit on key down", "" },
{ "exitonmousedown", OPT_TYPE_BOOL, OPT_EXPERT, { &exit_on_mousedown }, "exit on mouse down", "" },
{ "loop", OPT_TYPE_INT, OPT_EXPERT, { &loop }, "set number of times the playback shall be looped", "loop count" },
{ "framedrop", OPT_TYPE_BOOL, OPT_EXPERT, { &framedrop }, "drop frames when cpu is too slow", "" },
{ "infbuf", OPT_TYPE_BOOL, OPT_EXPERT, { &infinite_buffer }, "don't limit the input buffer size (useful with realtime streams)", "" },
{ "window_title", OPT_TYPE_STRING, 0, { &window_title }, "set window title", "window title" },
{ "left", OPT_TYPE_INT, OPT_EXPERT, { &screen_left }, "set the x position for the left of the window", "x pos" },
{ "top", OPT_TYPE_INT, OPT_EXPERT, { &screen_top }, "set the y position for the top of the window", "y pos" },
{ "vf", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_add_vfilter }, "set video filters", "filter_graph" },
{ "af", OPT_TYPE_STRING, 0, { &afilters }, "set audio filters", "filter_graph" },
{ "rdftspeed", OPT_TYPE_INT, OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
{ "showmode", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
{ "i", OPT_TYPE_BOOL, 0, { &dummy}, "read specified file", "input_file"},
{ "codec", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
{ "acodec", OPT_TYPE_STRING, OPT_EXPERT, { &audio_codec_name }, "force audio decoder", "decoder_name" },
{ "scodec", OPT_TYPE_STRING, OPT_EXPERT, { &subtitle_codec_name }, "force subtitle decoder", "decoder_name" },
{ "vcodec", OPT_TYPE_STRING, OPT_EXPERT, { &video_codec_name }, "force video decoder", "decoder_name" },
{ "autorotate", OPT_TYPE_BOOL, 0, { &autorotate }, "automatically rotate video", "" },
{ "find_stream_info", OPT_TYPE_BOOL, OPT_INPUT | OPT_EXPERT, { &find_stream_info },
"read and decode the streams to fill missing information with heuristics" },
{ "filter_threads", HAS_ARG | OPT_INT | OPT_EXPERT, { &filter_nbthreads }, "number of filter threads per graph" },
{ "filter_threads", OPT_TYPE_INT, OPT_EXPERT, { &filter_nbthreads }, "number of filter threads per graph" },
{ "enable_vulkan", OPT_TYPE_BOOL, 0, { &enable_vulkan }, "enable vulkan renderer" },
{ "vulkan_params", OPT_TYPE_STRING, OPT_EXPERT, { &vulkan_params }, "vulkan configuration using a list of key=value pairs separated by ':'" },
{ "hwaccel", OPT_TYPE_STRING, OPT_EXPERT, { &hwaccel }, "use HW accelerated decoding" },
{ NULL, },
};
@ -3622,8 +3715,8 @@ void show_help_default(const char *opt, const char *arg)
{
av_log_set_callback(log_callback_help);
show_usage();
show_help_options(options, "Main options:", 0, OPT_EXPERT, 0);
show_help_options(options, "Advanced options:", OPT_EXPERT, 0, 0);
show_help_options(options, "Main options:", 0, OPT_EXPERT);
show_help_options(options, "Advanced options:", OPT_EXPERT, 0);
printf("\n");
show_help_children(avcodec_get_class(), AV_OPT_FLAG_DECODING_PARAM);
show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
@ -3722,9 +3815,40 @@ int main(int argc, char **argv)
#ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
#endif
if (hwaccel && !enable_vulkan) {
av_log(NULL, AV_LOG_INFO, "Enable vulkan renderer to support hwaccel %s\n", hwaccel);
enable_vulkan = 1;
}
if (enable_vulkan) {
vk_renderer = vk_get_renderer();
if (vk_renderer) {
#if SDL_VERSION_ATLEAST(2, 0, 6)
flags |= SDL_WINDOW_VULKAN;
#endif
} else {
av_log(NULL, AV_LOG_WARNING, "Doesn't support vulkan renderer, fallback to SDL renderer\n");
enable_vulkan = 0;
}
}
window = SDL_CreateWindow(program_name, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, default_width, default_height, flags);
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
if (window) {
if (!window) {
av_log(NULL, AV_LOG_FATAL, "Failed to create window: %s", SDL_GetError());
do_exit(NULL);
}
if (vk_renderer) {
AVDictionary *dict = NULL;
if (vulkan_params)
av_dict_parse_string(&dict, vulkan_params, "=", ":", 0);
ret = vk_renderer_create(vk_renderer, window, dict);
av_dict_free(&dict);
if (ret < 0) {
av_log(NULL, AV_LOG_FATAL, "Failed to create vulkan renderer, %s\n", av_err2str(ret));
do_exit(NULL);
}
} else {
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
if (!renderer) {
av_log(NULL, AV_LOG_WARNING, "Failed to initialize a hardware accelerated renderer: %s\n", SDL_GetError());
@ -3734,10 +3858,10 @@ int main(int argc, char **argv)
if (!SDL_GetRendererInfo(renderer, &renderer_info))
av_log(NULL, AV_LOG_VERBOSE, "Initialized %s renderer.\n", renderer_info.name);
}
}
if (!window || !renderer || !renderer_info.num_texture_formats) {
av_log(NULL, AV_LOG_FATAL, "Failed to create window or renderer: %s", SDL_GetError());
do_exit(NULL);
if (!renderer || !renderer_info.num_texture_formats) {
av_log(NULL, AV_LOG_FATAL, "Failed to create window or renderer: %s", SDL_GetError());
do_exit(NULL);
}
}
}

835
fftools/ffplay_renderer.c Normal file
View File

@ -0,0 +1,835 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define VK_NO_PROTOTYPES
#define VK_ENABLE_BETA_EXTENSIONS
#include "config.h"
#include "ffplay_renderer.h"
#if (SDL_VERSION_ATLEAST(2, 0, 6) && CONFIG_LIBPLACEBO)
/* Get PL_API_VER */
#include <libplacebo/config.h>
#define HAVE_VULKAN_RENDERER (PL_API_VER >= 278)
#else
#define HAVE_VULKAN_RENDERER 0
#endif
#if HAVE_VULKAN_RENDERER
#if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR)
#define VK_USE_PLATFORM_WIN32_KHR
#endif
#include <libplacebo/vulkan.h>
#include <libplacebo/utils/frame_queue.h>
#include <libplacebo/utils/libav.h>
#include <SDL_vulkan.h>
#include "libavutil/bprint.h"
#endif
struct VkRenderer {
const AVClass *class;
int (*create)(VkRenderer *renderer, SDL_Window *window, AVDictionary *dict);
int (*get_hw_dev)(VkRenderer *renderer, AVBufferRef **dev);
int (*display)(VkRenderer *renderer, AVFrame *frame);
int (*resize)(VkRenderer *renderer, int width, int height);
void (*destroy)(VkRenderer *renderer);
};
#if HAVE_VULKAN_RENDERER
typedef struct RendererContext {
VkRenderer api;
// Can be NULL when vulkan instance is created by avutil
pl_vk_inst placebo_instance;
pl_vulkan placebo_vulkan;
pl_swapchain swapchain;
VkSurfaceKHR vk_surface;
pl_renderer renderer;
pl_tex tex[4];
pl_log vk_log;
AVBufferRef *hw_device_ref;
AVBufferRef *hw_frame_ref;
enum AVPixelFormat *transfer_formats;
AVHWFramesConstraints *constraints;
PFN_vkGetInstanceProcAddr get_proc_addr;
// This field is a copy from pl_vk_inst->instance or hw_device_ref instance.
VkInstance inst;
AVFrame *vk_frame;
} RendererContext;
static void vk_log_cb(void *log_priv, enum pl_log_level level,
const char *msg)
{
static const int level_map[] = {
AV_LOG_QUIET,
AV_LOG_FATAL,
AV_LOG_ERROR,
AV_LOG_WARNING,
AV_LOG_INFO,
AV_LOG_DEBUG,
AV_LOG_TRACE,
};
if (level > 0 && level < FF_ARRAY_ELEMS(level_map))
av_log(log_priv, level_map[level], "%s\n", msg);
}
// Should keep sync with optional_device_exts inside hwcontext_vulkan.c
static const char *optional_device_exts[] = {
/* Misc or required by other extensions */
VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME,
VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME,
VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME,
VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME,
VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME,
VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME,
VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME,
/* Imports/exports */
VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME,
VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME,
VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME,
VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME,
VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME,
#ifdef _WIN32
VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME,
VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME,
#endif
/* Video encoding/decoding */
VK_KHR_VIDEO_QUEUE_EXTENSION_NAME,
VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME,
VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME,
VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME,
"VK_MESA_video_decode_av1",
};
static inline int enable_debug(const AVDictionary *opt)
{
AVDictionaryEntry *entry = av_dict_get(opt, "debug", NULL, 0);
int debug = entry && strtol(entry->value, NULL, 10);
return debug;
}
static void hwctx_lock_queue(void *priv, uint32_t qf, uint32_t qidx)
{
AVHWDeviceContext *avhwctx = priv;
const AVVulkanDeviceContext *hwctx = avhwctx->hwctx;
hwctx->lock_queue(avhwctx, qf, qidx);
}
static void hwctx_unlock_queue(void *priv, uint32_t qf, uint32_t qidx)
{
AVHWDeviceContext *avhwctx = priv;
const AVVulkanDeviceContext *hwctx = avhwctx->hwctx;
hwctx->unlock_queue(avhwctx, qf, qidx);
}
static int add_instance_extension(const char **ext, unsigned num_ext,
const AVDictionary *opt,
AVDictionary **dict)
{
const char *inst_ext_key = "instance_extensions";
AVDictionaryEntry *entry;
AVBPrint buf;
char *ext_list = NULL;
int ret;
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
for (int i = 0; i < num_ext; i++) {
if (i)
av_bprintf(&buf, "+%s", ext[i]);
else
av_bprintf(&buf, "%s", ext[i]);
}
entry = av_dict_get(opt, inst_ext_key, NULL, 0);
if (entry && entry->value && entry->value[0]) {
if (num_ext)
av_bprintf(&buf, "+");
av_bprintf(&buf, "%s", entry->value);
}
ret = av_bprint_finalize(&buf, &ext_list);
if (ret < 0)
return ret;
return av_dict_set(dict, inst_ext_key, ext_list, AV_DICT_DONT_STRDUP_VAL);
}
static int add_device_extension(const AVDictionary *opt,
AVDictionary **dict)
{
const char *dev_ext_key = "device_extensions";
AVDictionaryEntry *entry;
AVBPrint buf;
char *ext_list = NULL;
int ret;
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
av_bprintf(&buf, "%s", VK_KHR_SWAPCHAIN_EXTENSION_NAME);
for (int i = 0; i < pl_vulkan_num_recommended_extensions; i++)
av_bprintf(&buf, "+%s", pl_vulkan_recommended_extensions[i]);
entry = av_dict_get(opt, dev_ext_key, NULL, 0);
if (entry && entry->value && entry->value[0])
av_bprintf(&buf, "+%s", entry->value);
ret = av_bprint_finalize(&buf, &ext_list);
if (ret < 0)
return ret;
return av_dict_set(dict, dev_ext_key, ext_list, AV_DICT_DONT_STRDUP_VAL);
}
static const char *select_device(const AVDictionary *opt)
{
const AVDictionaryEntry *entry;
entry = av_dict_get(opt, "device", NULL, 0);
if (entry)
return entry->value;
return NULL;
}
static int create_vk_by_hwcontext(VkRenderer *renderer,
const char **ext, unsigned num_ext,
const AVDictionary *opt)
{
RendererContext *ctx = (RendererContext *) renderer;
AVHWDeviceContext *dev;
AVVulkanDeviceContext *hwctx;
AVDictionary *dict = NULL;
int ret;
ret = add_instance_extension(ext, num_ext, opt, &dict);
if (ret < 0)
return ret;
ret = add_device_extension(opt, &dict);
if (ret) {
av_dict_free(&dict);
return ret;
}
ret = av_hwdevice_ctx_create(&ctx->hw_device_ref, AV_HWDEVICE_TYPE_VULKAN,
select_device(opt), dict, 0);
av_dict_free(&dict);
if (ret < 0)
return ret;
dev = (AVHWDeviceContext *) ctx->hw_device_ref->data;
hwctx = dev->hwctx;
// There is no way to pass SDL GetInstanceProcAddr to hwdevice.
// Check the result and return error if they don't match.
if (hwctx->get_proc_addr != SDL_Vulkan_GetVkGetInstanceProcAddr()) {
av_log(renderer, AV_LOG_ERROR,
"hwdevice and SDL use different get_proc_addr. "
"Try -vulkan_params create_by_placebo=1\n");
return AVERROR_PATCHWELCOME;
}
ctx->get_proc_addr = hwctx->get_proc_addr;
ctx->inst = hwctx->inst;
ctx->placebo_vulkan = pl_vulkan_import(ctx->vk_log,
pl_vulkan_import_params(
.instance = hwctx->inst,
.get_proc_addr = hwctx->get_proc_addr,
.phys_device = hwctx->phys_dev,
.device = hwctx->act_dev,
.extensions = hwctx->enabled_dev_extensions,
.num_extensions = hwctx->nb_enabled_dev_extensions,
.features = &hwctx->device_features,
.lock_queue = hwctx_lock_queue,
.unlock_queue = hwctx_unlock_queue,
.queue_ctx = dev,
.queue_graphics = {
.index = hwctx->queue_family_index,
.count = hwctx->nb_graphics_queues,
},
.queue_compute = {
.index = hwctx->queue_family_comp_index,
.count = hwctx->nb_comp_queues,
},
.queue_transfer = {
.index = hwctx->queue_family_tx_index,
.count = hwctx->nb_tx_queues,
},
));
if (!ctx->placebo_vulkan)
return AVERROR_EXTERNAL;
return 0;
}
static void placebo_lock_queue(struct AVHWDeviceContext *dev_ctx,
uint32_t queue_family, uint32_t index)
{
RendererContext *ctx = dev_ctx->user_opaque;
pl_vulkan vk = ctx->placebo_vulkan;
vk->lock_queue(vk, queue_family, index);
}
static void placebo_unlock_queue(struct AVHWDeviceContext *dev_ctx,
uint32_t queue_family,
uint32_t index)
{
RendererContext *ctx = dev_ctx->user_opaque;
pl_vulkan vk = ctx->placebo_vulkan;
vk->unlock_queue(vk, queue_family, index);
}
static int get_decode_queue(VkRenderer *renderer, int *index, int *count)
{
RendererContext *ctx = (RendererContext *) renderer;
VkQueueFamilyProperties *queue_family_prop = NULL;
uint32_t num_queue_family_prop = 0;
PFN_vkGetPhysicalDeviceQueueFamilyProperties get_queue_family_prop;
PFN_vkGetInstanceProcAddr get_proc_addr = ctx->get_proc_addr;
*index = -1;
*count = 0;
get_queue_family_prop = (PFN_vkGetPhysicalDeviceQueueFamilyProperties)
get_proc_addr(ctx->placebo_instance->instance,
"vkGetPhysicalDeviceQueueFamilyProperties");
get_queue_family_prop(ctx->placebo_vulkan->phys_device,
&num_queue_family_prop, NULL);
if (!num_queue_family_prop)
return AVERROR_EXTERNAL;
queue_family_prop = av_calloc(num_queue_family_prop,
sizeof(*queue_family_prop));
if (!queue_family_prop)
return AVERROR(ENOMEM);
get_queue_family_prop(ctx->placebo_vulkan->phys_device,
&num_queue_family_prop,
queue_family_prop);
for (int i = 0; i < num_queue_family_prop; i++) {
if (queue_family_prop[i].queueFlags & VK_QUEUE_VIDEO_DECODE_BIT_KHR) {
*index = i;
*count = queue_family_prop[i].queueCount;
break;
}
}
av_free(queue_family_prop);
return 0;
}
static int create_vk_by_placebo(VkRenderer *renderer,
const char **ext, unsigned num_ext,
const AVDictionary *opt)
{
RendererContext *ctx = (RendererContext *) renderer;
AVHWDeviceContext *device_ctx;
AVVulkanDeviceContext *vk_dev_ctx;
int decode_index;
int decode_count;
int ret;
ctx->get_proc_addr = SDL_Vulkan_GetVkGetInstanceProcAddr();
ctx->placebo_instance = pl_vk_inst_create(ctx->vk_log, pl_vk_inst_params(
.get_proc_addr = ctx->get_proc_addr,
.debug = enable_debug(opt),
.extensions = ext,
.num_extensions = num_ext
));
if (!ctx->placebo_instance) {
return AVERROR_EXTERNAL;
}
ctx->inst = ctx->placebo_instance->instance;
ctx->placebo_vulkan = pl_vulkan_create(ctx->vk_log, pl_vulkan_params(
.instance = ctx->placebo_instance->instance,
.get_proc_addr = ctx->placebo_instance->get_proc_addr,
.surface = ctx->vk_surface,
.allow_software = false,
.opt_extensions = optional_device_exts,
.num_opt_extensions = FF_ARRAY_ELEMS(optional_device_exts),
.extra_queues = VK_QUEUE_VIDEO_DECODE_BIT_KHR,
.device_name = select_device(opt),
));
if (!ctx->placebo_vulkan)
return AVERROR_EXTERNAL;
ctx->hw_device_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VULKAN);
if (!ctx->hw_device_ref) {
return AVERROR(ENOMEM);
}
device_ctx = (AVHWDeviceContext *) ctx->hw_device_ref->data;
device_ctx->user_opaque = ctx;
vk_dev_ctx = device_ctx->hwctx;
vk_dev_ctx->lock_queue = placebo_lock_queue,
vk_dev_ctx->unlock_queue = placebo_unlock_queue;
vk_dev_ctx->get_proc_addr = ctx->placebo_instance->get_proc_addr;
vk_dev_ctx->inst = ctx->placebo_instance->instance;
vk_dev_ctx->phys_dev = ctx->placebo_vulkan->phys_device;
vk_dev_ctx->act_dev = ctx->placebo_vulkan->device;
vk_dev_ctx->device_features = *ctx->placebo_vulkan->features;
vk_dev_ctx->enabled_inst_extensions = ctx->placebo_instance->extensions;
vk_dev_ctx->nb_enabled_inst_extensions = ctx->placebo_instance->num_extensions;
vk_dev_ctx->enabled_dev_extensions = ctx->placebo_vulkan->extensions;
vk_dev_ctx->nb_enabled_dev_extensions = ctx->placebo_vulkan->num_extensions;
vk_dev_ctx->queue_family_index = ctx->placebo_vulkan->queue_graphics.index;
vk_dev_ctx->nb_graphics_queues = ctx->placebo_vulkan->queue_graphics.count;
vk_dev_ctx->queue_family_tx_index = ctx->placebo_vulkan->queue_transfer.index;
vk_dev_ctx->nb_tx_queues = ctx->placebo_vulkan->queue_transfer.count;
vk_dev_ctx->queue_family_comp_index = ctx->placebo_vulkan->queue_compute.index;
vk_dev_ctx->nb_comp_queues = ctx->placebo_vulkan->queue_compute.count;
ret = get_decode_queue(renderer, &decode_index, &decode_count);
if (ret < 0)
return ret;
vk_dev_ctx->queue_family_decode_index = decode_index;
vk_dev_ctx->nb_decode_queues = decode_count;
ret = av_hwdevice_ctx_init(ctx->hw_device_ref);
if (ret < 0)
return ret;
return 0;
}
static int create(VkRenderer *renderer, SDL_Window *window, AVDictionary *opt)
{
int ret = 0;
unsigned num_ext = 0;
const char **ext = NULL;
int w, h;
struct pl_log_params vk_log_params = {
.log_cb = vk_log_cb,
.log_level = PL_LOG_DEBUG,
.log_priv = renderer,
};
RendererContext *ctx = (RendererContext *) renderer;
AVDictionaryEntry *entry;
ctx->vk_log = pl_log_create(PL_API_VER, &vk_log_params);
if (!SDL_Vulkan_GetInstanceExtensions(window, &num_ext, NULL)) {
av_log(NULL, AV_LOG_FATAL, "Failed to get vulkan extensions: %s\n",
SDL_GetError());
return AVERROR_EXTERNAL;
}
ext = av_calloc(num_ext, sizeof(*ext));
if (!ext) {
ret = AVERROR(ENOMEM);
goto out;
}
SDL_Vulkan_GetInstanceExtensions(window, &num_ext, ext);
entry = av_dict_get(opt, "create_by_placebo", NULL, 0);
if (entry && strtol(entry->value, NULL, 10))
ret = create_vk_by_placebo(renderer, ext, num_ext, opt);
else
ret = create_vk_by_hwcontext(renderer, ext, num_ext, opt);
if (ret < 0)
goto out;
if (!SDL_Vulkan_CreateSurface(window, ctx->inst, &ctx->vk_surface)) {
ret = AVERROR_EXTERNAL;
goto out;
}
ctx->swapchain = pl_vulkan_create_swapchain(
ctx->placebo_vulkan,
pl_vulkan_swapchain_params(
.surface = ctx->vk_surface,
.present_mode = VK_PRESENT_MODE_FIFO_KHR));
if (!ctx->swapchain) {
ret = AVERROR_EXTERNAL;
goto out;
}
SDL_Vulkan_GetDrawableSize(window, &w, &h);
pl_swapchain_resize(ctx->swapchain, &w, &h);
ctx->renderer = pl_renderer_create(ctx->vk_log, ctx->placebo_vulkan->gpu);
if (!ctx->renderer) {
ret = AVERROR_EXTERNAL;
goto out;
}
ctx->vk_frame = av_frame_alloc();
if (!ctx->vk_frame) {
ret = AVERROR(ENOMEM);
goto out;
}
ret = 0;
out:
av_free(ext);
return ret;
}
static int get_hw_dev(VkRenderer *renderer, AVBufferRef **dev)
{
RendererContext *ctx = (RendererContext *) renderer;
*dev = ctx->hw_device_ref;
return 0;
}
static int create_hw_frame(VkRenderer *renderer, AVFrame *frame)
{
RendererContext *ctx = (RendererContext *) renderer;
AVHWFramesContext *src_hw_frame = (AVHWFramesContext *)
frame->hw_frames_ctx->data;
AVHWFramesContext *hw_frame;
AVVulkanFramesContext *vk_frame_ctx;
int ret;
if (ctx->hw_frame_ref) {
hw_frame = (AVHWFramesContext *) ctx->hw_frame_ref->data;
if (hw_frame->width == frame->width &&
hw_frame->height == frame->height &&
hw_frame->sw_format == src_hw_frame->sw_format)
return 0;
av_buffer_unref(&ctx->hw_frame_ref);
}
if (!ctx->constraints) {
ctx->constraints = av_hwdevice_get_hwframe_constraints(
ctx->hw_device_ref, NULL);
if (!ctx->constraints)
return AVERROR(ENOMEM);
}
// Check constraints and skip create hwframe. Don't take it as error since
// we can fallback to memory copy from GPU to CPU.
if ((ctx->constraints->max_width &&
ctx->constraints->max_width < frame->width) ||
(ctx->constraints->max_height &&
ctx->constraints->max_height < frame->height) ||
(ctx->constraints->min_width &&
ctx->constraints->min_width > frame->width) ||
(ctx->constraints->min_height &&
ctx->constraints->min_height > frame->height))
return 0;
if (ctx->constraints->valid_sw_formats) {
enum AVPixelFormat *sw_formats = ctx->constraints->valid_sw_formats;
while (*sw_formats != AV_PIX_FMT_NONE) {
if (*sw_formats == src_hw_frame->sw_format)
break;
sw_formats++;
}
if (*sw_formats == AV_PIX_FMT_NONE)
return 0;
}
ctx->hw_frame_ref = av_hwframe_ctx_alloc(ctx->hw_device_ref);
if (!ctx->hw_frame_ref)
return AVERROR(ENOMEM);
hw_frame = (AVHWFramesContext *) ctx->hw_frame_ref->data;
hw_frame->format = AV_PIX_FMT_VULKAN;
hw_frame->sw_format = src_hw_frame->sw_format;
hw_frame->width = frame->width;
hw_frame->height = frame->height;
if (frame->format == AV_PIX_FMT_CUDA) {
vk_frame_ctx = hw_frame->hwctx;
vk_frame_ctx->flags = AV_VK_FRAME_FLAG_DISABLE_MULTIPLANE;
}
ret = av_hwframe_ctx_init(ctx->hw_frame_ref);
if (ret < 0) {
av_log(renderer, AV_LOG_ERROR, "Create hwframe context failed, %s\n",
av_err2str(ret));
return ret;
}
av_hwframe_transfer_get_formats(ctx->hw_frame_ref,
AV_HWFRAME_TRANSFER_DIRECTION_TO,
&ctx->transfer_formats, 0);
return 0;
}
static inline int check_hw_transfer(RendererContext *ctx, AVFrame *frame)
{
if (!ctx->hw_frame_ref || !ctx->transfer_formats)
return 0;
for (int i = 0; ctx->transfer_formats[i] != AV_PIX_FMT_NONE; i++)
if (ctx->transfer_formats[i] == frame->format)
return 1;
return 0;
}
static inline int move_to_output_frame(RendererContext *ctx, AVFrame *frame)
{
int ret = av_frame_copy_props(ctx->vk_frame, frame);
if (ret < 0)
return ret;
av_frame_unref(frame);
av_frame_move_ref(frame, ctx->vk_frame);
return 0;
}
static int map_frame(VkRenderer *renderer, AVFrame *frame, int use_hw_frame)
{
RendererContext *ctx = (RendererContext *) renderer;
int ret;
if (use_hw_frame && !ctx->hw_frame_ref)
return AVERROR(ENOSYS);
// Try map data first
av_frame_unref(ctx->vk_frame);
if (use_hw_frame) {
ctx->vk_frame->hw_frames_ctx = av_buffer_ref(ctx->hw_frame_ref);
ctx->vk_frame->format = AV_PIX_FMT_VULKAN;
}
ret = av_hwframe_map(ctx->vk_frame, frame, 0);
if (!ret)
return move_to_output_frame(ctx, frame);
if (ret != AVERROR(ENOSYS))
av_log(NULL, AV_LOG_FATAL, "Map frame failed: %s\n", av_err2str(ret));
return ret;
}
static int transfer_frame(VkRenderer *renderer, AVFrame *frame, int use_hw_frame)
{
RendererContext *ctx = (RendererContext *) renderer;
int ret;
if (use_hw_frame && !check_hw_transfer(ctx, frame))
return AVERROR(ENOSYS);
av_frame_unref(ctx->vk_frame);
if (use_hw_frame)
av_hwframe_get_buffer(ctx->hw_frame_ref, ctx->vk_frame, 0);
ret = av_hwframe_transfer_data(ctx->vk_frame, frame, 1);
if (!ret)
return move_to_output_frame(ctx, frame);
if (ret != AVERROR(ENOSYS))
av_log(NULL, AV_LOG_FATAL, "Transfer frame failed: %s\n",
av_err2str(ret));
return ret;
}
static int convert_frame(VkRenderer *renderer, AVFrame *frame)
{
int ret;
if (!frame->hw_frames_ctx)
return 0;
if (frame->format == AV_PIX_FMT_VULKAN)
return 0;
ret = create_hw_frame(renderer, frame);
if (ret < 0)
return ret;
for (int use_hw = 1; use_hw >=0; use_hw--) {
ret = map_frame(renderer, frame, use_hw);
if (!ret)
return 0;
if (ret != AVERROR(ENOSYS))
return ret;
ret = transfer_frame(renderer, frame, use_hw);
if (!ret)
return 0;
if (ret != AVERROR(ENOSYS))
return ret;
}
return ret;
}
static int display(VkRenderer *renderer, AVFrame *frame)
{
struct pl_swapchain_frame swap_frame = {0};
struct pl_frame pl_frame = {0};
struct pl_frame target = {0};
RendererContext *ctx = (RendererContext *) renderer;
int ret = 0;
ret = convert_frame(renderer, frame);
if (ret < 0)
return ret;
if (!pl_map_avframe_ex(ctx->placebo_vulkan->gpu, &pl_frame, pl_avframe_params(
.frame = frame,
.tex = ctx->tex))) {
av_log(NULL, AV_LOG_ERROR, "pl_map_avframe_ex failed\n");
return AVERROR_EXTERNAL;
}
if (!pl_swapchain_start_frame(ctx->swapchain, &swap_frame)) {
av_log(NULL, AV_LOG_ERROR, "start frame failed\n");
ret = AVERROR_EXTERNAL;
goto out;
}
pl_frame_from_swapchain(&target, &swap_frame);
if (!pl_render_image(ctx->renderer, &pl_frame, &target,
&pl_render_default_params)) {
av_log(NULL, AV_LOG_ERROR, "pl_render_image failed\n");
ret = AVERROR_EXTERNAL;
goto out;
}
if (!pl_swapchain_submit_frame(ctx->swapchain)) {
av_log(NULL, AV_LOG_ERROR, "pl_swapchain_submit_frame failed\n");
ret = AVERROR_EXTERNAL;
goto out;
}
pl_swapchain_swap_buffers(ctx->swapchain);
out:
pl_unmap_avframe(ctx->placebo_vulkan->gpu, &pl_frame);
return ret;
}
static int resize(VkRenderer *renderer, int width, int height)
{
RendererContext *ctx = (RendererContext *) renderer;
if (!pl_swapchain_resize(ctx->swapchain, &width, &height))
return AVERROR_EXTERNAL;
return 0;
}
static void destroy(VkRenderer *renderer)
{
RendererContext *ctx = (RendererContext *) renderer;
PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR;
av_frame_free(&ctx->vk_frame);
av_freep(&ctx->transfer_formats);
av_hwframe_constraints_free(&ctx->constraints);
av_buffer_unref(&ctx->hw_frame_ref);
if (ctx->placebo_vulkan) {
for (int i = 0; i < FF_ARRAY_ELEMS(ctx->tex); i++)
pl_tex_destroy(ctx->placebo_vulkan->gpu, &ctx->tex[i]);
pl_renderer_destroy(&ctx->renderer);
pl_swapchain_destroy(&ctx->swapchain);
pl_vulkan_destroy(&ctx->placebo_vulkan);
}
if (ctx->vk_surface) {
vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR)
ctx->get_proc_addr(ctx->inst, "vkDestroySurfaceKHR");
vkDestroySurfaceKHR(ctx->inst, ctx->vk_surface, NULL);
ctx->vk_surface = NULL;
}
av_buffer_unref(&ctx->hw_device_ref);
pl_vk_inst_destroy(&ctx->placebo_instance);
pl_log_destroy(&ctx->vk_log);
}
static const AVClass vulkan_renderer_class = {
.class_name = "Vulkan Renderer",
.item_name = av_default_item_name,
.version = LIBAVUTIL_VERSION_INT,
};
VkRenderer *vk_get_renderer(void)
{
RendererContext *ctx = av_mallocz(sizeof(*ctx));
VkRenderer *renderer;
if (!ctx)
return NULL;
renderer = &ctx->api;
renderer->class = &vulkan_renderer_class;
renderer->get_hw_dev = get_hw_dev;
renderer->create = create;
renderer->display = display;
renderer->resize = resize;
renderer->destroy = destroy;
return renderer;
}
#else
VkRenderer *vk_get_renderer(void)
{
return NULL;
}
#endif
int vk_renderer_create(VkRenderer *renderer, SDL_Window *window,
AVDictionary *opt)
{
return renderer->create(renderer, window, opt);
}
int vk_renderer_get_hw_dev(VkRenderer *renderer, AVBufferRef **dev)
{
return renderer->get_hw_dev(renderer, dev);
}
int vk_renderer_display(VkRenderer *renderer, AVFrame *frame)
{
return renderer->display(renderer, frame);
}
int vk_renderer_resize(VkRenderer *renderer, int width, int height)
{
return renderer->resize(renderer, width, height);
}
void vk_renderer_destroy(VkRenderer *renderer)
{
renderer->destroy(renderer);
}

41
fftools/ffplay_renderer.h Normal file
View File

@ -0,0 +1,41 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FFTOOLS_FFPLAY_RENDERER_H
#define FFTOOLS_FFPLAY_RENDERER_H
#include <SDL.h>
#include "libavutil/frame.h"
typedef struct VkRenderer VkRenderer;
VkRenderer *vk_get_renderer(void);
int vk_renderer_create(VkRenderer *renderer, SDL_Window *window,
AVDictionary *opt);
int vk_renderer_get_hw_dev(VkRenderer *renderer, AVBufferRef **dev);
int vk_renderer_display(VkRenderer *renderer, AVFrame *frame);
int vk_renderer_resize(VkRenderer *renderer, int width, int height);
void vk_renderer_destroy(VkRenderer *renderer);
#endif /* FFTOOLS_FFPLAY_RENDERER_H */

File diff suppressed because it is too large Load Diff

View File

@ -852,15 +852,22 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
const AVOutputFormat *ofmt = NULL;
const char *last_name;
int is_dev;
const char *is_device_placeholder = device_only ? "" : ".";
printf("%s:\n"
" D.%s = Demuxing supported\n"
" .E%s = Muxing supported\n"
"%s"
" ---\n",
device_only ? "Devices" : "Formats",
is_device_placeholder, is_device_placeholder,
device_only ? "": " ..d = Is a device\n");
printf("%s\n"
" D. = Demuxing supported\n"
" .E = Muxing supported\n"
" --\n", device_only ? "Devices:" : "File formats:");
last_name = "000";
for (;;) {
int decode = 0;
int encode = 0;
int device = 0;
const char *name = NULL;
const char *long_name = NULL;
@ -875,6 +882,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
name = ofmt->name;
long_name = ofmt->long_name;
encode = 1;
device = is_dev;
}
}
}
@ -889,20 +897,24 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
name = ifmt->name;
long_name = ifmt->long_name;
encode = 0;
device = is_dev;
}
if (name && strcmp(ifmt->name, name) == 0)
if (name && strcmp(ifmt->name, name) == 0) {
decode = 1;
device = is_dev;
}
}
}
if (!name)
break;
last_name = name;
printf(" %c%c %-15s %s\n",
printf(" %c%c%s %-15s %s\n",
decode ? 'D' : ' ',
encode ? 'E' : ' ',
device_only ? "" : (device ? "d" : " "),
name,
long_name ? long_name:" ");
long_name ? long_name : " ");
}
return 0;
}

View File

@ -41,9 +41,9 @@ int show_sources(void *optctx, const char *opt, const char *arg);
#if CONFIG_AVDEVICE
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
{ "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \
{ "sources" , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = show_sources }, \
"list sources of the input device", "device" }, \
{ "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \
{ "sinks" , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = show_sinks }, \
"list sinks of the output device", "device" }, \
#else
@ -197,35 +197,35 @@ int opt_cpuflags(void *optctx, const char *opt, const char *arg);
int opt_cpucount(void *optctx, const char *opt, const char *arg);
#define CMDUTILS_COMMON_OPTIONS \
{ "L", OPT_EXIT, { .func_arg = show_license }, "show license" }, \
{ "h", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "?", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "-help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "version", OPT_EXIT, { .func_arg = show_version }, "show version" }, \
{ "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \
{ "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \
{ "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
{ "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
{ "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
{ "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \
{ "decoders", OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
{ "encoders", OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
{ "bsfs", OPT_EXIT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
{ "protocols", OPT_EXIT, { .func_arg = show_protocols }, "show available protocols" }, \
{ "filters", OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
{ "pix_fmts", OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
{ "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
{ "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
{ "dispositions", OPT_EXIT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
{ "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
{ "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "report", 0, { .func_arg = opt_report }, "generate a report" }, \
{ "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
{ "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
{ "cpucount", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
{ "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
{ "L", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_license }, "show license" }, \
{ "h", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "?", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_help }, "show help", "topic" }, \
{ "help", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_help }, "show help", "topic" }, \
{ "-help", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_help }, "show help", "topic" }, \
{ "version", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_version }, "show version" }, \
{ "buildconf", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_buildconf }, "show build configuration" }, \
{ "formats", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_formats }, "show available formats" }, \
{ "muxers", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
{ "demuxers", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
{ "devices", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
{ "codecs", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_codecs }, "show available codecs" }, \
{ "decoders", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
{ "encoders", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
{ "bsfs", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
{ "protocols", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_protocols }, "show available protocols" }, \
{ "filters", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
{ "pix_fmts", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
{ "layouts", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
{ "sample_fmts", OPT_TYPE_FUNC, OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
{ "dispositions", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
{ "colors", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = show_colors }, "show available color names" }, \
{ "loglevel", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "v", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "report", OPT_TYPE_FUNC, OPT_EXPERT, { .func_arg = opt_report }, "generate a report" }, \
{ "max_alloc", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
{ "cpuflags", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
{ "cpucount", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
{ "hide_banner", OPT_TYPE_BOOL, OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
CMDUTILS_COMMON_OPTIONS_AVDEVICE \
#endif /* FFTOOLS_OPT_COMMON_H */

View File

@ -319,7 +319,7 @@ static int overflow_heartbeat(SyncQueue *sq, int stream_idx)
/* signal a fake timestamp for all streams that prevent tail_ts from being output */
tail_ts++;
for (unsigned int i = 0; i < sq->nb_streams; i++) {
SyncQueueStream *st1 = &sq->streams[i];
const SyncQueueStream *st1 = &sq->streams[i];
int64_t ts;
if (st == st1 || st1->finished ||
@ -524,8 +524,8 @@ fail:
static int receive_for_stream(SyncQueue *sq, unsigned int stream_idx,
SyncQueueFrame frame)
{
SyncQueueStream *st_head = sq->head_stream >= 0 ?
&sq->streams[sq->head_stream] : NULL;
const SyncQueueStream *st_head = sq->head_stream >= 0 ?
&sq->streams[sq->head_stream] : NULL;
SyncQueueStream *st;
av_assert0(stream_idx < sq->nb_streams);

View File

@ -164,7 +164,12 @@ static int receive_locked(ThreadQueue *tq, int *stream_idx,
FifoElem elem;
unsigned int nb_finished = 0;
if (av_fifo_read(tq->fifo, &elem, 1) >= 0) {
while (av_fifo_read(tq->fifo, &elem, 1) >= 0) {
if (tq->finished[elem.stream_idx] & FINISHED_RECV) {
objpool_release(tq->obj_pool, &elem.obj);
continue;
}
tq->obj_move(data, elem.obj);
objpool_release(tq->obj_pool, &elem.obj);
*stream_idx = elem.stream_idx;
@ -172,7 +177,7 @@ static int receive_locked(ThreadQueue *tq, int *stream_idx,
}
for (unsigned int i = 0; i < tq->nb_streams; i++) {
if (!(tq->finished[i] & FINISHED_SEND))
if (!tq->finished[i])
continue;
/* return EOF to the consumer at most once for each stream */
@ -197,7 +202,14 @@ int tq_receive(ThreadQueue *tq, int *stream_idx, void *data)
pthread_mutex_lock(&tq->lock);
while (1) {
size_t can_read = av_fifo_can_read(tq->fifo);
ret = receive_locked(tq, stream_idx, data);
// signal other threads if the fifo state changed
if (can_read != av_fifo_can_read(tq->fifo))
pthread_cond_broadcast(&tq->cond);
if (ret == AVERROR(EAGAIN)) {
pthread_cond_wait(&tq->cond, &tq->lock);
continue;
@ -206,9 +218,6 @@ int tq_receive(ThreadQueue *tq, int *stream_idx, void *data)
break;
}
if (ret == 0)
pthread_cond_broadcast(&tq->cond);
pthread_mutex_unlock(&tq->lock);
return ret;

View File

@ -125,7 +125,7 @@ static const uint8_t dequant_table[64] = {
20, 35, 34, 32, 31, 22, 15, 8,
};
static VLC block_type_vlc[2][4];
static VLCElem block_type_vlc[2][4][32];
typedef struct CFrameBuffer {
@ -250,17 +250,15 @@ static void idct(int16_t block[64])
static av_cold void init_vlcs(void)
{
static VLCElem table[2][4][32];
int i, j;
for (i = 0; i < 2; i++) {
for (j = 0; j < 4; j++) {
block_type_vlc[i][j].table = table[i][j];
block_type_vlc[i][j].table_allocated = 32;
vlc_init(&block_type_vlc[i][j], BLOCK_TYPE_VLC_BITS, 7,
&block_type_tab[i][j][0][1], 2, 1,
&block_type_tab[i][j][0][0], 2, 1,
VLC_INIT_USE_STATIC);
ff_vlc_init_table_sparse(block_type_vlc[i][j], FF_ARRAY_ELEMS(block_type_vlc[i][j]),
BLOCK_TYPE_VLC_BITS, 7,
&block_type_tab[i][j][0][1], 2, 1,
&block_type_tab[i][j][0][0], 2, 1,
NULL, 0, 0, 0);
}
}
}
@ -357,7 +355,7 @@ static int decode_p_block(FourXContext *f, uint16_t *dst, const uint16_t *src,
if (get_bits_left(&f->gb) < 1)
return AVERROR_INVALIDDATA;
h = 1 << log2h;
code = get_vlc2(&f->gb, block_type_vlc[1 - (f->version > 1)][index].table,
code = get_vlc2(&f->gb, block_type_vlc[1 - (f->version > 1)][index],
BLOCK_TYPE_VLC_BITS, 1);
av_assert0(code >= 0 && code <= 6);
@ -887,6 +885,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
}
if (i >= CFRAME_BUFFER_COUNT) {
if (free_index < 0)
return AVERROR_INVALIDDATA;
i = free_index;
f->cfrm[i].id = id;
}

View File

@ -43,6 +43,8 @@ typedef struct EightBpsContext {
uint8_t planes;
uint8_t planemap[4];
uint32_t pal[256];
} EightBpsContext;
static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
@ -61,7 +63,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
unsigned int planes = c->planes;
int ret;
if (buf_size < planes * height * 2)
if (buf_size < planes * height * (2 + 2*((avctx->width+128)/129)))
return AVERROR_INVALIDDATA;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
@ -116,10 +118,12 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed =
#endif
ff_copy_palette(frame->data[1], avpkt, avctx);
ff_copy_palette(c->pal, avpkt, avctx);
#if FF_API_PALETTE_HAS_CHANGED
FF_ENABLE_DEPRECATION_WARNINGS
#endif
memcpy(frame->data[1], c->pal, AVPALETTE_SIZE);
}
*got_frame = 1;

View File

@ -25,13 +25,13 @@ HEADERS = ac3_parser.h \
version_major.h \
videotoolbox.h \
vorbis_parser.h \
xvmc.h \
OBJS = ac3_parser.o \
adts_parser.o \
allcodecs.o \
avcodec.o \
avdct.o \
avfft.o \
avpacket.o \
bitstream.o \
bitstream_filters.o \
@ -55,6 +55,7 @@ OBJS = ac3_parser.o \
profiles.o \
qsv_api.o \
raw.o \
refstruct.o \
utils.o \
version.o \
vlc.o \
@ -62,6 +63,8 @@ OBJS = ac3_parser.o \
xiph.o \
# subsystems
include $(SRC_PATH)/libavcodec/vvc/Makefile
-include $(SRC_PATH)/libavcodec/$(ARCH)/vvc/Makefile
OBJS-$(CONFIG_AANDCTTABLES) += aandcttab.o
OBJS-$(CONFIG_AC3DSP) += ac3dsp.o ac3.o ac3tab.o
OBJS-$(CONFIG_ADTS_HEADER) += adts_header.o mpeg4audio_sample_rates.o
@ -79,9 +82,8 @@ OBJS-$(CONFIG_CBS_H265) += cbs_h2645.o cbs_sei.o h2645_parse.o
OBJS-$(CONFIG_CBS_H266) += cbs_h2645.o cbs_sei.o h2645_parse.o
OBJS-$(CONFIG_CBS_JPEG) += cbs_jpeg.o
OBJS-$(CONFIG_CBS_MPEG2) += cbs_mpeg2.o
OBJS-$(CONFIG_CBS_VP8) += cbs_vp8.o vp8data.o
OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
OBJS-$(CONFIG_DEFLATE_WRAPPER) += zlib_wrapper.o
OBJS-$(CONFIG_DOVI_RPU) += dovi_rpu.o
OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
@ -90,9 +92,6 @@ OBJS-$(CONFIG_EXIF) += exif.o tiff_common.o
OBJS-$(CONFIG_FAANDCT) += faandct.o
OBJS-$(CONFIG_FAANIDCT) += faanidct.o
OBJS-$(CONFIG_FDCTDSP) += fdctdsp.o jfdctfst.o jfdctint.o
FFT-OBJS-$(CONFIG_HARDCODED_TABLES) += cos_tables.o
OBJS-$(CONFIG_FFT) += avfft.o fft_float.o fft_fixed_32.o \
fft_init_table.o $(FFT-OBJS-yes)
OBJS-$(CONFIG_FMTCONVERT) += fmtconvert.o
OBJS-$(CONFIG_GOLOMB) += golomb.o
OBJS-$(CONFIG_H263DSP) += h263dsp.o
@ -125,7 +124,6 @@ OBJS-$(CONFIG_LLVIDENCDSP) += lossless_videoencdsp.o
OBJS-$(CONFIG_LPC) += lpc.o
OBJS-$(CONFIG_LSP) += lsp.o
OBJS-$(CONFIG_LZF) += lzf.o
OBJS-$(CONFIG_MDCT) += mdct_float.o mdct_fixed_32.o
OBJS-$(CONFIG_ME_CMP) += me_cmp.o
OBJS-$(CONFIG_MEDIACODEC) += mediacodecdec_common.o mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
@ -134,7 +132,8 @@ OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodec_common.o \
OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \
mpegaudiodsp_data.o \
mpegaudiodsp_fixed.o \
mpegaudiodsp_float.o
mpegaudiodsp_float.o \
dct32_fixed.o dct32_float.o
OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiotabs.o
OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o mpeg4audio_sample_rates.o
OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o rl.o \
@ -156,7 +155,6 @@ OBJS-$(CONFIG_QSV) += qsv.o
OBJS-$(CONFIG_QSVDEC) += qsvdec.o
OBJS-$(CONFIG_QSVENC) += qsvenc.o
OBJS-$(CONFIG_RANGECODER) += rangecoder.o
OBJS-$(CONFIG_RDFT) += rdft.o
OBJS-$(CONFIG_RV34DSP) += rv34dsp.o
OBJS-$(CONFIG_SINEWIN) += sinewin.o
OBJS-$(CONFIG_SNAPPY) += snappy.o
@ -179,10 +177,12 @@ OBJS-$(CONFIG_WMV2DSP) += wmv2dsp.o
OBJS-$(CONFIG_ZERO12V_DECODER) += 012v.o
OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o
OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o
OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps_common.o aacps_float.o \
OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aacdec_common.o aactab.o \
aacsbr.o aacps_common.o aacps_float.o \
kbdwin.o \
sbrdsp.o aacpsdsp_float.o cbrt_data.o
OBJS-$(CONFIG_AAC_FIXED_DECODER) += aacdec_fixed.o aactab.o aacsbr_fixed.o aacps_common.o aacps_fixed.o \
OBJS-$(CONFIG_AAC_FIXED_DECODER) += aacdec_fixed.o aacdec_common.o aactab.o \
aacsbr_fixed.o aacps_common.o aacps_fixed.o \
kbdwin.o \
sbrdsp_fixed.o aacpsdsp_fixed.o cbrt_data_fixed.o
OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \
@ -252,7 +252,7 @@ OBJS-$(CONFIG_ATRAC3PAL_DECODER) += atrac3plusdec.o atrac3plus.o \
OBJS-$(CONFIG_ATRAC9_DECODER) += atrac9dec.o
OBJS-$(CONFIG_AURA_DECODER) += cyuv.o
OBJS-$(CONFIG_AURA2_DECODER) += aura.o
OBJS-$(CONFIG_AV1_DECODER) += av1dec.o
OBJS-$(CONFIG_AV1_DECODER) += av1dec.o av1_parse.o
OBJS-$(CONFIG_AV1_CUVID_DECODER) += cuviddec.o
OBJS-$(CONFIG_AV1_MEDIACODEC_DECODER) += mediacodecdec.o
OBJS-$(CONFIG_AV1_MEDIACODEC_ENCODER) += mediacodecenc.o
@ -340,6 +340,7 @@ OBJS-$(CONFIG_DVVIDEO_ENCODER) += dvenc.o dv.o dvdata.o
OBJS-$(CONFIG_DXA_DECODER) += dxa.o
OBJS-$(CONFIG_DXTORY_DECODER) += dxtory.o
OBJS-$(CONFIG_DXV_DECODER) += dxv.o
OBJS-$(CONFIG_DXV_ENCODER) += dxvenc.o
OBJS-$(CONFIG_EAC3_DECODER) += eac3_data.o
OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o eac3_data.o
OBJS-$(CONFIG_EACMV_DECODER) += eacmv.o
@ -448,8 +449,7 @@ OBJS-$(CONFIG_HEVC_V4L2M2M_DECODER) += v4l2_m2m_dec.o
OBJS-$(CONFIG_HEVC_V4L2M2M_ENCODER) += v4l2_m2m_enc.o
OBJS-$(CONFIG_HEVC_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
OBJS-$(CONFIG_HNM4_VIDEO_DECODER) += hnm4video.o
OBJS-$(CONFIG_HQ_HQA_DECODER) += hq_hqa.o hq_hqadata.o hq_hqadsp.o \
canopus.o
OBJS-$(CONFIG_HQ_HQA_DECODER) += hq_hqa.o hq_hqadsp.o canopus.o
OBJS-$(CONFIG_HQX_DECODER) += hqx.o hqxvlc.o hqxdsp.o canopus.o
OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o huffyuvdec.o
OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o huffyuvenc.o
@ -480,6 +480,7 @@ OBJS-$(CONFIG_JV_DECODER) += jvdec.o
OBJS-$(CONFIG_KGV1_DECODER) += kgv1dec.o
OBJS-$(CONFIG_KMVC_DECODER) += kmvc.o
OBJS-$(CONFIG_LAGARITH_DECODER) += lagarith.o lagarithrac.o
OBJS-$(CONFIG_LEAD_DECODER) += leaddec.o jpegquanttables.o
OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc_common.o
OBJS-$(CONFIG_LOCO_DECODER) += loco.o
OBJS-$(CONFIG_LSCR_DECODER) += lscrdec.o png.o pngdec.o pngdsp.o
@ -622,6 +623,7 @@ OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o \
OBJS-$(CONFIG_QDM2_DECODER) += qdm2.o
OBJS-$(CONFIG_QDMC_DECODER) += qdmc.o
OBJS-$(CONFIG_QDRAW_DECODER) += qdrw.o
OBJS-$(CONFIG_QOA_DECODER) += qoadec.o
OBJS-$(CONFIG_QOI_DECODER) += qoidec.o
OBJS-$(CONFIG_QOI_ENCODER) += qoienc.o
OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o
@ -984,6 +986,7 @@ OBJS-$(CONFIG_ADPCM_ZORK_DECODER) += adpcm.o adpcm_data.o
# hardware accelerators
OBJS-$(CONFIG_D3D11VA) += dxva2.o
OBJS-$(CONFIG_D3D12VA) += dxva2.o d3d12va_decode.o
OBJS-$(CONFIG_DXVA2) += dxva2.o
OBJS-$(CONFIG_NVDEC) += nvdec.o
OBJS-$(CONFIG_VAAPI) += vaapi_decode.o
@ -993,14 +996,16 @@ OBJS-$(CONFIG_VULKAN) += vulkan.o vulkan_video.o
OBJS-$(CONFIG_AV1_D3D11VA_HWACCEL) += dxva2_av1.o
OBJS-$(CONFIG_AV1_DXVA2_HWACCEL) += dxva2_av1.o
OBJS-$(CONFIG_AV1_D3D12VA_HWACCEL) += dxva2_av1.o d3d12va_av1.o
OBJS-$(CONFIG_AV1_NVDEC_HWACCEL) += nvdec_av1.o
OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o
OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o
OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_av1.o
OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_decode.o vulkan_av1.o
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o
OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o
OBJS-$(CONFIG_H264_D3D12VA_HWACCEL) += dxva2_h264.o d3d12va_h264.o
OBJS-$(CONFIG_H264_NVDEC_HWACCEL) += nvdec_h264.o
OBJS-$(CONFIG_H264_QSV_HWACCEL) += qsvdec.o
OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o
@ -1009,6 +1014,7 @@ OBJS-$(CONFIG_H264_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_H264_VULKAN_HWACCEL) += vulkan_decode.o vulkan_h264.o
OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o
OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o
OBJS-$(CONFIG_HEVC_D3D12VA_HWACCEL) += dxva2_hevc.o d3d12va_hevc.o
OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o
OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec.o
OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o h265_profile_level.o
@ -1021,6 +1027,7 @@ OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL) += vdpau_mpeg12.o
OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL) += dxva2_mpeg2.o
OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o
OBJS-$(CONFIG_MPEG2_D3D12VA_HWACCEL) += dxva2_mpeg2.o d3d12va_mpeg2.o
OBJS-$(CONFIG_MPEG2_NVDEC_HWACCEL) += nvdec_mpeg12.o
OBJS-$(CONFIG_MPEG2_QSV_HWACCEL) += qsvdec.o
OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o
@ -1032,6 +1039,7 @@ OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL) += vdpau_mpeg4.o
OBJS-$(CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_VC1_D3D11VA_HWACCEL) += dxva2_vc1.o
OBJS-$(CONFIG_VC1_DXVA2_HWACCEL) += dxva2_vc1.o
OBJS-$(CONFIG_VC1_D3D12VA_HWACCEL) += dxva2_vc1.o d3d12va_vc1.o
OBJS-$(CONFIG_VC1_NVDEC_HWACCEL) += nvdec_vc1.o
OBJS-$(CONFIG_VC1_QSV_HWACCEL) += qsvdec.o
OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o
@ -1040,6 +1048,7 @@ OBJS-$(CONFIG_VP8_NVDEC_HWACCEL) += nvdec_vp8.o
OBJS-$(CONFIG_VP8_VAAPI_HWACCEL) += vaapi_vp8.o
OBJS-$(CONFIG_VP9_D3D11VA_HWACCEL) += dxva2_vp9.o
OBJS-$(CONFIG_VP9_DXVA2_HWACCEL) += dxva2_vp9.o
OBJS-$(CONFIG_VP9_D3D12VA_HWACCEL) += dxva2_vp9.o d3d12va_vp9.o
OBJS-$(CONFIG_VP9_NVDEC_HWACCEL) += nvdec_vp9.o
OBJS-$(CONFIG_VP9_VAAPI_HWACCEL) += vaapi_vp9.o
OBJS-$(CONFIG_VP9_VDPAU_HWACCEL) += vdpau_vp9.o
@ -1148,6 +1157,8 @@ OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o
OBJS-$(CONFIG_LIBX265_ENCODER) += libx265.o
OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o
OBJS-$(CONFIG_LIBXAVS2_ENCODER) += libxavs2.o
OBJS-$(CONFIG_LIBXEVD_DECODER) += libxevd.o
OBJS-$(CONFIG_LIBXEVE_ENCODER) += libxeve.o
OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvid.o
OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o
@ -1220,54 +1231,14 @@ OBJS-$(CONFIG_XMA_PARSER) += xma_parser.o
OBJS-$(CONFIG_XWD_PARSER) += xwd_parser.o
# bitstream filters
OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o
OBJS-$(CONFIG_AV1_METADATA_BSF) += av1_metadata_bsf.o
OBJS-$(CONFIG_AV1_FRAME_MERGE_BSF) += av1_frame_merge_bsf.o
OBJS-$(CONFIG_AV1_FRAME_SPLIT_BSF) += av1_frame_split_bsf.o
OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o
OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
OBJS-$(CONFIG_DCA_CORE_BSF) += dca_core_bsf.o
OBJS-$(CONFIG_DTS2PTS_BSF) += dts2pts_bsf.o
OBJS-$(CONFIG_DV_ERROR_MARKER_BSF) += dv_error_marker_bsf.o
OBJS-$(CONFIG_EAC3_CORE_BSF) += eac3_core_bsf.o
OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF) += extract_extradata_bsf.o \
av1_parse.o h2645_parse.o
OBJS-$(CONFIG_FILTER_UNITS_BSF) += filter_units_bsf.o
OBJS-$(CONFIG_H264_METADATA_BSF) += h264_metadata_bsf.o h264_levels.o \
h2645data.o
OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o
OBJS-$(CONFIG_H264_REDUNDANT_PPS_BSF) += h264_redundant_pps_bsf.o
OBJS-$(CONFIG_HAPQA_EXTRACT_BSF) += hapqa_extract_bsf.o hap.o
OBJS-$(CONFIG_HEVC_METADATA_BSF) += h265_metadata_bsf.o h265_profile_level.o \
h2645data.o
OBJS-$(CONFIG_HEVC_MP4TOANNEXB_BSF) += hevc_mp4toannexb_bsf.o
OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o
OBJS-$(CONFIG_MEDIA100_TO_MJPEGB_BSF) += media100_to_mjpegb_bsf.o
OBJS-$(CONFIG_MJPEG2JPEG_BSF) += mjpeg2jpeg_bsf.o
OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o
OBJS-$(CONFIG_MPEG4_UNPACK_BFRAMES_BSF) += mpeg4_unpack_bframes_bsf.o
OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o
OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += mp3_header_decompress_bsf.o \
mpegaudiotabs.o
OBJS-$(CONFIG_MPEG2_METADATA_BSF) += mpeg2_metadata_bsf.o
OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o
OBJS-$(CONFIG_NULL_BSF) += null_bsf.o
OBJS-$(CONFIG_OPUS_METADATA_BSF) += opus_metadata_bsf.o
OBJS-$(CONFIG_PCM_RECHUNK_BSF) += pcm_rechunk_bsf.o
OBJS-$(CONFIG_PGS_FRAME_MERGE_BSF) += pgs_frame_merge_bsf.o
OBJS-$(CONFIG_PRORES_METADATA_BSF) += prores_metadata_bsf.o
OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o av1_parse.o
OBJS-$(CONFIG_SETTS_BSF) += setts_bsf.o
OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o
OBJS-$(CONFIG_TRACE_HEADERS_BSF) += trace_headers_bsf.o
OBJS-$(CONFIG_TRUEHD_CORE_BSF) += truehd_core_bsf.o mlp_parse.o mlp.o
OBJS-$(CONFIG_VP9_METADATA_BSF) += vp9_metadata_bsf.o
OBJS-$(CONFIG_VP9_RAW_REORDER_BSF) += vp9_raw_reorder_bsf.o
OBJS-$(CONFIG_VP9_SUPERFRAME_BSF) += vp9_superframe_bsf.o
OBJS-$(CONFIG_VP9_SUPERFRAME_SPLIT_BSF) += vp9_superframe_split_bsf.o
OBJS-$(CONFIG_VVC_METADATA_BSF) += h266_metadata_bsf.o
OBJS-$(CONFIG_VVC_MP4TOANNEXB_BSF) += vvc_mp4toannexb_bsf.o
OBJS-$(CONFIG_EVC_FRAME_MERGE_BSF) += evc_frame_merge_bsf.o
include $(SRC_PATH)/libavcodec/bsf/Makefile
OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF) += av1_parse.o h2645_parse.o
OBJS-$(CONFIG_H264_METADATA_BSF) += h264_levels.o h2645data.o
OBJS-$(CONFIG_HAPQA_EXTRACT_BSF) += hap.o
OBJS-$(CONFIG_HEVC_METADATA_BSF) += h265_profile_level.o h2645data.o
OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += av1_parse.o
OBJS-$(CONFIG_TRUEHD_CORE_BSF) += mlp_parse.o mlp.o
# thread libraries
OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o
@ -1287,11 +1258,12 @@ SKIPHEADERS += %_tablegen.h \
aacenc_quantization.h \
aacenc_quantization_misc.h \
bitstream_template.h \
vulkan_video_codec_av1std.h \
vulkan_video_codec_av1std_mesa.h \
$(ARCH)/vpx_arith.h \
SKIPHEADERS-$(CONFIG_AMF) += amfenc.h
SKIPHEADERS-$(CONFIG_D3D11VA) += d3d11va.h dxva2_internal.h
SKIPHEADERS-$(CONFIG_D3D12VA) += d3d12va_decode.h
SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
SKIPHEADERS-$(CONFIG_JNI) += ffjni.h
SKIPHEADERS-$(CONFIG_LCMS2) += fflcms2.h
@ -1305,11 +1277,10 @@ SKIPHEADERS-$(CONFIG_NVDEC) += nvdec.h
SKIPHEADERS-$(CONFIG_NVENC) += nvenc.h
SKIPHEADERS-$(CONFIG_QSV) += qsv.h qsv_internal.h
SKIPHEADERS-$(CONFIG_QSVENC) += qsvenc.h
SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_hevc.h vaapi_encode.h
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode.h
SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode_mesa.h
SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h
SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h
@ -1325,8 +1296,6 @@ TESTPROGS = avcodec \
TESTPROGS-$(CONFIG_AV1_VAAPI_ENCODER) += av1_levels
TESTPROGS-$(CONFIG_CABAC) += cabac
TESTPROGS-$(CONFIG_DCT) += avfft
TESTPROGS-$(CONFIG_FFT) += fft fft-fixed32
TESTPROGS-$(CONFIG_GOLOMB) += golomb
TESTPROGS-$(CONFIG_IDCTDSP) += dct
TESTPROGS-$(CONFIG_IIRFILTER) += iirfilter
@ -1346,7 +1315,6 @@ HOSTPROGS = aacps_tablegen \
aacps_fixed_tablegen \
cbrt_tablegen \
cbrt_fixed_tablegen \
cos_tablegen \
dv_tablegen \
motionpixels_tablegen \
mpegaudio_tablegen \
@ -1361,12 +1329,6 @@ CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
$(SUBDIR)tests/dct$(EXESUF): $(SUBDIR)dctref.o $(SUBDIR)aandcttab.o
$(SUBDIR)dv_tablegen$(HOSTEXESUF): $(SUBDIR)dvdata_host.o
TRIG_TABLES = cos cos_fixed sin
TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c)
$(TRIG_TABLES): $(SUBDIR)%_tables.c: $(SUBDIR)cos_tablegen$(HOSTEXESUF)
$(M)./$< $* > $@
ifdef CONFIG_SMALL
$(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1
else

View File

@ -32,16 +32,6 @@
#include "aac_defines.h"
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/fixed_dsp.h"
#include "libavutil/mem_internal.h"
#include "libavutil/tx.h"
#include "avcodec.h"
#include "mpeg4audio.h"
#include "sbr.h"
#include <stdint.h>
#define MAX_CHANNELS 64
#define MAX_ELEM_ID 16
@ -49,8 +39,6 @@
#define TNS_MAX_ORDER 20
#define MAX_LTP_LONG_SFB 40
#define CLIP_AVOIDANCE_FACTOR 0.95f
enum RawDataBlockType {
TYPE_SCE,
TYPE_CPE,
@ -88,8 +76,6 @@ enum BandType {
INTENSITY_BT = 15, ///< Scalefactor data are intensity stereo positions (in phase).
};
#define IS_CODEBOOK_UNSIGNED(x) (((x) - 1) & 10)
enum ChannelPosition {
AAC_CHANNEL_OFF = 0,
AAC_CHANNEL_FRONT = 1,
@ -99,34 +85,6 @@ enum ChannelPosition {
AAC_CHANNEL_CC = 5,
};
/**
* The point during decoding at which channel coupling is applied.
*/
enum CouplingPoint {
BEFORE_TNS,
BETWEEN_TNS_AND_IMDCT,
AFTER_IMDCT = 3,
};
/**
* Output configuration status
*/
enum OCStatus {
OC_NONE, ///< Output unconfigured
OC_TRIAL_PCE, ///< Output configuration under trial specified by an inband PCE
OC_TRIAL_FRAME, ///< Output configuration under trial specified by a frame header
OC_GLOBAL_HDR, ///< Output configuration set in a global header but not yet locked
OC_LOCKED, ///< Output configuration locked in place
};
typedef struct OutputConfiguration {
MPEG4AudioConfig m4ac;
uint8_t layout_map[MAX_ELEM_ID*4][3];
int layout_map_tags;
AVChannelLayout ch_layout;
enum OCStatus status;
} OutputConfiguration;
/**
* Predictor State
*/
@ -155,70 +113,6 @@ typedef struct PredictorState {
#define NOISE_PRE_BITS 9 ///< length of preamble
#define NOISE_OFFSET 90 ///< subtracted from global gain, used as offset for the preamble
/**
* Long Term Prediction
*/
typedef struct LongTermPrediction {
int8_t present;
int16_t lag;
int coef_idx;
INTFLOAT coef;
int8_t used[MAX_LTP_LONG_SFB];
} LongTermPrediction;
/**
* Individual Channel Stream
*/
typedef struct IndividualChannelStream {
uint8_t max_sfb; ///< number of scalefactor bands per group
enum WindowSequence window_sequence[2];
uint8_t use_kb_window[2]; ///< If set, use Kaiser-Bessel window, otherwise use a sine window.
int num_window_groups;
uint8_t group_len[8];
LongTermPrediction ltp;
const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window
const uint8_t *swb_sizes; ///< table of scalefactor band sizes for a particular window
int num_swb; ///< number of scalefactor window bands
int num_windows;
int tns_max_bands;
int predictor_present;
int predictor_initialized;
int predictor_reset_group;
int predictor_reset_count[31]; ///< used by encoder to count prediction resets
uint8_t prediction_used[41];
uint8_t window_clipping[8]; ///< set if a certain window is near clipping
float clip_avoidance_factor; ///< set if any window is near clipping to the necessary atennuation factor to avoid it
} IndividualChannelStream;
/**
* Temporal Noise Shaping
*/
typedef struct TemporalNoiseShaping {
int present;
int n_filt[8];
int length[8][4];
int direction[8][4];
int order[8][4];
int coef_idx[8][4][TNS_MAX_ORDER];
INTFLOAT coef[8][4][TNS_MAX_ORDER];
} TemporalNoiseShaping;
/**
* Dynamic Range Control - decoded from the bitstream but not processed further.
*/
typedef struct DynamicRangeControl {
int pce_instance_tag; ///< Indicates with which program the DRC info is associated.
int dyn_rng_sgn[17]; ///< DRC sign information; 0 - positive, 1 - negative
int dyn_rng_ctl[17]; ///< DRC magnitude information
int exclude_mask[MAX_CHANNELS]; ///< Channels to be excluded from DRC processing.
int band_incr; ///< Number of DRC bands greater than 1 having DRC info.
int interpolation_scheme; ///< Indicates the interpolation scheme used in the SBR QMF domain.
int band_top[17]; ///< Indicates the top of the i-th DRC band in units of 4 spectral lines.
int prog_ref_level; /**< A reference level for the long-term program audio level for all
* channels combined.
*/
} DynamicRangeControl;
typedef struct Pulse {
int num_pulse;
int start;
@ -226,166 +120,4 @@ typedef struct Pulse {
int amp[4];
} Pulse;
/**
* coupling parameters
*/
typedef struct ChannelCoupling {
enum CouplingPoint coupling_point; ///< The point during decoding at which coupling is applied.
int num_coupled; ///< number of target elements
enum RawDataBlockType type[8]; ///< Type of channel element to be coupled - SCE or CPE.
int id_select[8]; ///< element id
int ch_select[8]; /**< [0] shared list of gains; [1] list of gains for right channel;
* [2] list of gains for left channel; [3] lists of gains for both channels
*/
INTFLOAT gain[16][120];
} ChannelCoupling;
/**
* Single Channel Element - used for both SCE and LFE elements.
*/
typedef struct SingleChannelElement {
IndividualChannelStream ics;
TemporalNoiseShaping tns;
Pulse pulse;
enum BandType band_type[128]; ///< band types
enum BandType band_alt[128]; ///< alternative band type (used by encoder)
int band_type_run_end[120]; ///< band type run end points
INTFLOAT sf[120]; ///< scalefactors
int sf_idx[128]; ///< scalefactor indices (used by encoder)
uint8_t zeroes[128]; ///< band is not coded (used by encoder)
uint8_t can_pns[128]; ///< band is allowed to PNS (informative)
float is_ener[128]; ///< Intensity stereo pos (used by encoder)
float pns_ener[128]; ///< Noise energy values (used by encoder)
DECLARE_ALIGNED(32, INTFLOAT, pcoeffs)[1024]; ///< coefficients for IMDCT, pristine
DECLARE_ALIGNED(32, INTFLOAT, coeffs)[1024]; ///< coefficients for IMDCT, maybe processed
DECLARE_ALIGNED(32, INTFLOAT, saved)[1536]; ///< overlap
DECLARE_ALIGNED(32, INTFLOAT, ret_buf)[2048]; ///< PCM output buffer
DECLARE_ALIGNED(16, INTFLOAT, ltp_state)[3072]; ///< time signal for LTP
DECLARE_ALIGNED(32, AAC_FLOAT, lcoeffs)[1024]; ///< MDCT of LTP coefficients (used by encoder)
DECLARE_ALIGNED(32, AAC_FLOAT, prcoeffs)[1024]; ///< Main prediction coefs (used by encoder)
PredictorState predictor_state[MAX_PREDICTORS];
INTFLOAT *ret; ///< PCM output
} SingleChannelElement;
/**
* channel element - generic struct for SCE/CPE/CCE/LFE
*/
typedef struct ChannelElement {
int present;
// CPE specific
int common_window; ///< Set if channels share a common 'IndividualChannelStream' in bitstream.
int ms_mode; ///< Signals mid/side stereo flags coding mode (used by encoder)
uint8_t is_mode; ///< Set if any bands have been encoded using intensity stereo (used by encoder)
uint8_t ms_mask[128]; ///< Set if mid/side stereo is used for each scalefactor window band
uint8_t is_mask[128]; ///< Set if intensity stereo is used (used by encoder)
// shared
SingleChannelElement ch[2];
// CCE specific
ChannelCoupling coup;
SpectralBandReplication sbr;
} ChannelElement;
enum AACOutputChannelOrder {
CHANNEL_ORDER_DEFAULT,
CHANNEL_ORDER_CODED,
};
/**
* main AAC context
*/
struct AACContext {
AVClass *class;
AVCodecContext *avctx;
AVFrame *frame;
int is_saved; ///< Set if elements have stored overlap from previous frame.
DynamicRangeControl che_drc;
/**
* @name Channel element related data
* @{
*/
ChannelElement *che[4][MAX_ELEM_ID];
ChannelElement *tag_che_map[4][MAX_ELEM_ID];
int tags_mapped;
int warned_remapping_once;
/** @} */
/**
* @name temporary aligned temporary buffers
* (We do not want to have these on the stack.)
* @{
*/
DECLARE_ALIGNED(32, INTFLOAT, buf_mdct)[1024];
/** @} */
/**
* @name Computed / set up during initialization
* @{
*/
AVTXContext *mdct120;
AVTXContext *mdct128;
AVTXContext *mdct480;
AVTXContext *mdct512;
AVTXContext *mdct960;
AVTXContext *mdct1024;
AVTXContext *mdct_ltp;
av_tx_fn mdct120_fn;
av_tx_fn mdct128_fn;
av_tx_fn mdct480_fn;
av_tx_fn mdct512_fn;
av_tx_fn mdct960_fn;
av_tx_fn mdct1024_fn;
av_tx_fn mdct_ltp_fn;
#if USE_FIXED
AVFixedDSPContext *fdsp;
#else
AVFloatDSPContext *fdsp;
#endif /* USE_FIXED */
int random_state;
/** @} */
/**
* @name Members used for output
* @{
*/
SingleChannelElement *output_element[MAX_CHANNELS]; ///< Points to each SingleChannelElement
/** @} */
/**
* @name Japanese DTV specific extension
* @{
*/
int force_dmono_mode;///< 0->not dmono, 1->use first channel, 2->use second channel
int dmono_mode; ///< 0->not dmono, 1->use first channel, 2->use second channel
/** @} */
enum AACOutputChannelOrder output_channel_order;
DECLARE_ALIGNED(32, INTFLOAT, temp)[128];
OutputConfiguration oc[2];
int warned_num_aac_frames;
int warned_960_sbr;
unsigned warned_71_wide;
int warned_gain_control;
int warned_he_aac_mono;
/* aacdec functions pointers */
void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce);
void (*apply_ltp)(AACContext *ac, SingleChannelElement *sce);
void (*apply_tns)(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
IndividualChannelStream *ics, int decode);
void (*windowing_and_mdct_ltp)(AACContext *ac, INTFLOAT *out,
INTFLOAT *in, IndividualChannelStream *ics);
void (*update_ltp)(AACContext *ac, SingleChannelElement *sce);
void (*vector_pow43)(int *coefs, int len);
void (*subband_scale)(int *dst, int *src, int scale, int offset, int len, void *log_context);
};
void ff_aacdec_init_mips(AACContext *c);
#endif /* AVCODEC_AAC_H */

View File

@ -135,12 +135,6 @@ get_next:
avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
avctx->ch_layout.nb_channels = hdr.channels;
}
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
avctx->channels = avctx->ch_layout.nb_channels;
avctx->channel_layout = hdr.channel_layout;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
s1->duration = hdr.num_blocks * 256;
avctx->audio_service_type = hdr.bitstream_mode;

View File

@ -30,7 +30,6 @@
#include "libavutil/softfloat.h"
#define AAC_RENAME(x) x ## _fixed
#define AAC_RENAME_32(x) x ## _fixed_32
#define AAC_RENAME2(x) x ## _fixed
typedef int INTFLOAT;
typedef unsigned UINTFLOAT; ///< Equivalent to INTFLOAT, Used as temporal cast to avoid undefined sign overflow operations.
@ -72,12 +71,19 @@ typedef int AAC_SIGNE;
((int64_t)(y) * (z)) + \
0x40000000) >> 31)
#define AAC_HALF_SUM(x, y) (((x) >> 1) + ((y) >> 1))
#define AAC_SRA_R(x, y) (int)(((x) + (1 << ((y) - 1))) >> (y))
#ifdef LPC_USE_FIXED
#error aac_defines.h must be included before lpc_functions.h for fixed point decoder
#endif
#define LPC_USE_FIXED 1
#define LPC_MUL26(x, y) AAC_MUL26((x), (y))
#define LPC_FIXR(x) FIXR(x)
#define LPC_SRA_R(x, y) (int)(((x) + (1 << ((y) - 1))) >> (y))
#else
#define AAC_RENAME(x) x
#define AAC_RENAME_32(x) x
#define AAC_RENAME2(x) ff_ ## x
typedef float INTFLOAT;
typedef float UINTFLOAT;
@ -105,7 +111,6 @@ typedef unsigned AAC_SIGNE;
(c) * (d) - (e) * (f))
#define AAC_MSUB31_V3(x, y, z) ((x) - (y)) * (z)
#define AAC_HALF_SUM(x, y) ((x) + (y)) * 0.5f
#define AAC_SRA_R(x, y) (x)
#endif /* USE_FIXED */

View File

@ -108,10 +108,10 @@ static av_always_inline float quantize_and_encode_band_cost_template(
return cost * lambda;
}
if (!scaled) {
s->abs_pow34(s->scoefs, in, size);
s->aacdsp.abs_pow34(s->scoefs, in, size);
scaled = s->scoefs;
}
s->quant_bands(s->qcoefs, in, scaled, size, !BT_UNSIGNED, aac_cb_maxval[cb], Q34, ROUNDING);
s->aacdsp.quant_bands(s->qcoefs, in, scaled, size, !BT_UNSIGNED, aac_cb_maxval[cb], Q34, ROUNDING);
if (BT_UNSIGNED) {
off = 0;
} else {
@ -311,7 +311,7 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce
float next_minrd = INFINITY;
int next_mincb = 0;
s->abs_pow34(s->scoefs, sce->coeffs, 1024);
s->aacdsp.abs_pow34(s->scoefs, sce->coeffs, 1024);
start = win*128;
for (cb = 0; cb < CB_TOT_ALL; cb++) {
path[0][cb].cost = 0.0f;
@ -522,7 +522,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
}
}
idx = 1;
s->abs_pow34(s->scoefs, sce->coeffs, 1024);
s->aacdsp.abs_pow34(s->scoefs, sce->coeffs, 1024);
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
start = w*128;
for (g = 0; g < sce->ics.num_swb; g++) {
@ -668,7 +668,7 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
if (!allz)
return;
s->abs_pow34(s->scoefs, sce->coeffs, 1024);
s->aacdsp.abs_pow34(s->scoefs, sce->coeffs, 1024);
ff_quantize_band_cost_cache_init(s);
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
@ -874,8 +874,8 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
s->fdsp->vector_fmul_scalar(PNS, PNS, scale, sce->ics.swb_sizes[g]);
pns_senergy = s->fdsp->scalarproduct_float(PNS, PNS, sce->ics.swb_sizes[g]);
pns_energy += pns_senergy;
s->abs_pow34(NOR34, &sce->coeffs[start_c], sce->ics.swb_sizes[g]);
s->abs_pow34(PNS34, PNS, sce->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(NOR34, &sce->coeffs[start_c], sce->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(PNS34, PNS, sce->ics.swb_sizes[g]);
dist1 += quantize_band_cost(s, &sce->coeffs[start_c],
NOR34,
sce->ics.swb_sizes[g],
@ -1012,8 +1012,8 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
S[i] = M[i]
- sce1->coeffs[start+(w+w2)*128+i];
}
s->abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
s->abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
for (i = 0; i < sce0->ics.swb_sizes[g]; i++ ) {
Mmax = FFMAX(Mmax, M34[i]);
Smax = FFMAX(Smax, S34[i]);
@ -1056,10 +1056,10 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
- sce1->coeffs[start+(w+w2)*128+i];
}
s->abs_pow34(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
s->abs_pow34(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
s->abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
s->abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
dist1 += quantize_band_cost(s, &sce0->coeffs[start + (w+w2)*128],
L34,
sce0->ics.swb_sizes[g],

View File

@ -70,7 +70,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
float next_minbits = INFINITY;
int next_mincb = 0;
s->abs_pow34(s->scoefs, sce->coeffs, 1024);
s->aacdsp.abs_pow34(s->scoefs, sce->coeffs, 1024);
start = win*128;
for (cb = 0; cb < CB_TOT_ALL; cb++) {
path[0][cb].cost = run_bits+4;

View File

@ -291,7 +291,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
if (!allz)
return;
s->abs_pow34(s->scoefs, sce->coeffs, 1024);
s->aacdsp.abs_pow34(s->scoefs, sce->coeffs, 1024);
ff_quantize_band_cost_cache_init(s);
for (i = 0; i < sizeof(minsf) / sizeof(minsf[0]); ++i)

View File

@ -40,11 +40,11 @@
#include "avcodec.h"
#include "codec_internal.h"
#include "get_bits.h"
#include "lpc.h"
#include "kbdwin.h"
#include "sinewin.h"
#include "aac.h"
#include "aacdec.h"
#include "aactab.h"
#include "aacdectab.h"
#include "adts_header.h"
@ -209,7 +209,7 @@ static av_always_inline void predict(PredictorState *ps, float *coef,
*
* @param index index into coupling gain array
*/
static void apply_dependent_coupling(AACContext *ac,
static void apply_dependent_coupling(AACDecContext *ac,
SingleChannelElement *target,
ChannelElement *cce, int index)
{
@ -245,7 +245,7 @@ static void apply_dependent_coupling(AACContext *ac,
*
* @param index index into coupling gain array
*/
static void apply_independent_coupling(AACContext *ac,
static void apply_independent_coupling(AACDecContext *ac,
SingleChannelElement *target,
ChannelElement *cce, int index)
{
@ -262,7 +262,7 @@ static void apply_independent_coupling(AACContext *ac,
#define LOAS_SYNC_WORD 0x2b7 ///< 11 bits LOAS sync word
struct LATMContext {
AACContext aac_ctx; ///< containing AACContext
AACDecContext aac_ctx; ///< containing AACContext
int initialized; ///< initialized after a valid extradata was seen
// parser data
@ -281,7 +281,7 @@ static inline uint32_t latm_get_value(GetBitContext *b)
static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
GetBitContext *gb, int asclen)
{
AACContext *ac = &latmctx->aac_ctx;
AACDecContext *ac = &latmctx->aac_ctx;
AVCodecContext *avctx = ac->avctx;
MPEG4AudioConfig m4ac = { 0 };
GetBitContext gbc;
@ -555,7 +555,7 @@ const FFCodec ff_aac_decoder = {
CODEC_LONG_NAME("AAC (Advanced Audio Coding)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_AAC,
.priv_data_size = sizeof(AACContext),
.priv_data_size = sizeof(AACDecContext),
.init = aac_decode_init,
.close = aac_decode_close,
FF_CODEC_DECODE_CB(aac_decode_frame),
@ -564,8 +564,7 @@ const FFCodec ff_aac_decoder = {
},
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(aac_channel_layout)
.p.ch_layouts = aac_ch_layout,
.p.ch_layouts = ff_aac_ch_layout,
.flush = flush,
.p.priv_class = &aac_decoder_class,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
@ -590,8 +589,7 @@ const FFCodec ff_aac_latm_decoder = {
},
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(aac_channel_layout)
.p.ch_layouts = aac_ch_layout,
.p.ch_layouts = ff_aac_ch_layout,
.flush = flush,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
};

279
libavcodec/aacdec.h Normal file
View File

@ -0,0 +1,279 @@
/*
* AAC decoder definitions and structures
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* AAC decoder definitions and structures
* @author Oded Shimon ( ods15 ods15 dyndns org )
* @author Maxim Gavrilov ( maxim.gavrilov gmail com )
*/
#ifndef AVCODEC_AACDEC_H
#define AVCODEC_AACDEC_H
#include <stdint.h>
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/fixed_dsp.h"
#include "libavutil/mem_internal.h"
#include "libavutil/tx.h"
#include "aac.h"
#include "aac_defines.h"
#include "mpeg4audio.h"
#include "sbr.h"
/**
* Output configuration status
*/
enum OCStatus {
OC_NONE, ///< Output unconfigured
OC_TRIAL_PCE, ///< Output configuration under trial specified by an inband PCE
OC_TRIAL_FRAME, ///< Output configuration under trial specified by a frame header
OC_GLOBAL_HDR, ///< Output configuration set in a global header but not yet locked
OC_LOCKED, ///< Output configuration locked in place
};
enum AACOutputChannelOrder {
CHANNEL_ORDER_DEFAULT,
CHANNEL_ORDER_CODED,
};
/**
* The point during decoding at which channel coupling is applied.
*/
enum CouplingPoint {
BEFORE_TNS,
BETWEEN_TNS_AND_IMDCT,
AFTER_IMDCT = 3,
};
/**
* Long Term Prediction
*/
typedef struct LongTermPrediction {
int8_t present;
int16_t lag;
INTFLOAT coef;
int8_t used[MAX_LTP_LONG_SFB];
} LongTermPrediction;
/**
* Individual Channel Stream
*/
typedef struct IndividualChannelStream {
uint8_t max_sfb; ///< number of scalefactor bands per group
enum WindowSequence window_sequence[2];
uint8_t use_kb_window[2]; ///< If set, use Kaiser-Bessel window, otherwise use a sine window.
int num_window_groups;
uint8_t group_len[8];
LongTermPrediction ltp;
const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window
int num_swb; ///< number of scalefactor window bands
int num_windows;
int tns_max_bands;
int predictor_present;
int predictor_initialized;
int predictor_reset_group;
uint8_t prediction_used[41];
uint8_t window_clipping[8]; ///< set if a certain window is near clipping
} IndividualChannelStream;
/**
* Temporal Noise Shaping
*/
typedef struct TemporalNoiseShaping {
int present;
int n_filt[8];
int length[8][4];
int direction[8][4];
int order[8][4];
INTFLOAT coef[8][4][TNS_MAX_ORDER];
} TemporalNoiseShaping;
/**
* coupling parameters
*/
typedef struct ChannelCoupling {
enum CouplingPoint coupling_point; ///< The point during decoding at which coupling is applied.
int num_coupled; ///< number of target elements
enum RawDataBlockType type[8]; ///< Type of channel element to be coupled - SCE or CPE.
int id_select[8]; ///< element id
int ch_select[8]; /**< [0] shared list of gains; [1] list of gains for right channel;
* [2] list of gains for left channel; [3] lists of gains for both channels
*/
INTFLOAT gain[16][120];
} ChannelCoupling;
/**
* Single Channel Element - used for both SCE and LFE elements.
*/
typedef struct SingleChannelElement {
IndividualChannelStream ics;
TemporalNoiseShaping tns;
enum BandType band_type[128]; ///< band types
int band_type_run_end[120]; ///< band type run end points
INTFLOAT sf[120]; ///< scalefactors
DECLARE_ALIGNED(32, INTFLOAT, coeffs)[1024]; ///< coefficients for IMDCT, maybe processed
DECLARE_ALIGNED(32, INTFLOAT, saved)[1536]; ///< overlap
DECLARE_ALIGNED(32, INTFLOAT, ret_buf)[2048]; ///< PCM output buffer
DECLARE_ALIGNED(16, INTFLOAT, ltp_state)[3072]; ///< time signal for LTP
PredictorState predictor_state[MAX_PREDICTORS];
INTFLOAT *ret; ///< PCM output
} SingleChannelElement;
/**
* channel element - generic struct for SCE/CPE/CCE/LFE
*/
typedef struct ChannelElement {
int present;
// CPE specific
uint8_t ms_mask[128]; ///< Set if mid/side stereo is used for each scalefactor window band
// shared
SingleChannelElement ch[2];
// CCE specific
ChannelCoupling coup;
SpectralBandReplication sbr;
} ChannelElement;
typedef struct OutputConfiguration {
MPEG4AudioConfig m4ac;
uint8_t layout_map[MAX_ELEM_ID*4][3];
int layout_map_tags;
AVChannelLayout ch_layout;
enum OCStatus status;
} OutputConfiguration;
/**
* Dynamic Range Control - decoded from the bitstream but not processed further.
*/
typedef struct DynamicRangeControl {
int pce_instance_tag; ///< Indicates with which program the DRC info is associated.
int dyn_rng_sgn[17]; ///< DRC sign information; 0 - positive, 1 - negative
int dyn_rng_ctl[17]; ///< DRC magnitude information
int exclude_mask[MAX_CHANNELS]; ///< Channels to be excluded from DRC processing.
int band_incr; ///< Number of DRC bands greater than 1 having DRC info.
int interpolation_scheme; ///< Indicates the interpolation scheme used in the SBR QMF domain.
int band_top[17]; ///< Indicates the top of the i-th DRC band in units of 4 spectral lines.
int prog_ref_level; /**< A reference level for the long-term program audio level for all
* channels combined.
*/
} DynamicRangeControl;
/**
* main AAC decoding context
*/
typedef struct AACDecContext {
const struct AVClass *class;
struct AVCodecContext *avctx;
struct AVFrame *frame;
int is_saved; ///< Set if elements have stored overlap from previous frame.
DynamicRangeControl che_drc;
/**
* @name Channel element related data
* @{
*/
ChannelElement *che[4][MAX_ELEM_ID];
ChannelElement *tag_che_map[4][MAX_ELEM_ID];
int tags_mapped;
int warned_remapping_once;
/** @} */
/**
* @name temporary aligned temporary buffers
* (We do not want to have these on the stack.)
* @{
*/
DECLARE_ALIGNED(32, INTFLOAT, buf_mdct)[1024];
DECLARE_ALIGNED(32, INTFLOAT, temp)[128];
/** @} */
/**
* @name Computed / set up during initialization
* @{
*/
AVTXContext *mdct120;
AVTXContext *mdct128;
AVTXContext *mdct480;
AVTXContext *mdct512;
AVTXContext *mdct960;
AVTXContext *mdct1024;
AVTXContext *mdct_ltp;
av_tx_fn mdct120_fn;
av_tx_fn mdct128_fn;
av_tx_fn mdct480_fn;
av_tx_fn mdct512_fn;
av_tx_fn mdct960_fn;
av_tx_fn mdct1024_fn;
av_tx_fn mdct_ltp_fn;
#if USE_FIXED
AVFixedDSPContext *fdsp;
#else
AVFloatDSPContext *fdsp;
#endif /* USE_FIXED */
int random_state;
/** @} */
/**
* @name Members used for output
* @{
*/
SingleChannelElement *output_element[MAX_CHANNELS]; ///< Points to each SingleChannelElement
/** @} */
/**
* @name Japanese DTV specific extension
* @{
*/
int force_dmono_mode;///< 0->not dmono, 1->use first channel, 2->use second channel
int dmono_mode; ///< 0->not dmono, 1->use first channel, 2->use second channel
/** @} */
enum AACOutputChannelOrder output_channel_order;
OutputConfiguration oc[2];
int warned_num_aac_frames;
int warned_960_sbr;
unsigned warned_71_wide;
int warned_gain_control;
int warned_he_aac_mono;
/* aacdec functions pointers */
void (*imdct_and_windowing)(struct AACDecContext *ac, SingleChannelElement *sce);
void (*apply_ltp)(struct AACDecContext *ac, SingleChannelElement *sce);
void (*apply_tns)(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
IndividualChannelStream *ics, int decode);
void (*windowing_and_mdct_ltp)(struct AACDecContext *ac, INTFLOAT *out,
INTFLOAT *in, IndividualChannelStream *ics);
void (*update_ltp)(struct AACDecContext *ac, SingleChannelElement *sce);
void (*vector_pow43)(int *coefs, int len);
void (*subband_scale)(int *dst, int *src, int scale, int offset, int len, void *log_context);
} AACDecContext;
void ff_aacdec_init_mips(AACDecContext *c);
#endif /* AVCODEC_AACDEC_H */

307
libavcodec/aacdec_common.c Normal file
View File

@ -0,0 +1,307 @@
/*
* Common code and tables of the AAC fixed- and floating-point decoders
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* Common code and tables of the AAC fixed- and floating-point decoders
*/
#include "aac.h"
#include "aacdectab.h"
#include "aacps.h"
#include "aactab.h"
#include "vlc.h"
#include "libavutil/attributes.h"
#include "libavutil/thread.h"
const int8_t ff_tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 5, 5, 16, 5, 0 };
const uint8_t ff_aac_channel_layout_map[16][16][3] = {
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
{ { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{ { 0, } },
{ { 0, } },
{ { 0, } },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{
{ TYPE_SCE, 0, AAC_CHANNEL_FRONT }, // SCE1 = FC,
{ TYPE_CPE, 0, AAC_CHANNEL_FRONT }, // CPE1 = FLc and FRc,
{ TYPE_CPE, 1, AAC_CHANNEL_FRONT }, // CPE2 = FL and FR,
{ TYPE_CPE, 2, AAC_CHANNEL_BACK }, // CPE3 = SiL and SiR,
{ TYPE_CPE, 3, AAC_CHANNEL_BACK }, // CPE4 = BL and BR,
{ TYPE_SCE, 1, AAC_CHANNEL_BACK }, // SCE2 = BC,
{ TYPE_LFE, 0, AAC_CHANNEL_LFE }, // LFE1 = LFE1,
{ TYPE_LFE, 1, AAC_CHANNEL_LFE }, // LFE2 = LFE2,
{ TYPE_SCE, 2, AAC_CHANNEL_FRONT }, // SCE3 = TpFC,
{ TYPE_CPE, 4, AAC_CHANNEL_FRONT }, // CPE5 = TpFL and TpFR,
{ TYPE_CPE, 5, AAC_CHANNEL_SIDE }, // CPE6 = TpSiL and TpSiR,
{ TYPE_SCE, 3, AAC_CHANNEL_SIDE }, // SCE4 = TpC,
{ TYPE_CPE, 6, AAC_CHANNEL_BACK }, // CPE7 = TpBL and TpBR,
{ TYPE_SCE, 4, AAC_CHANNEL_BACK }, // SCE5 = TpBC,
{ TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC,
{ TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR
},
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, },
{ { 0, } },
};
const int16_t ff_aac_channel_map[3][4][6] = {
{
{ AV_CHAN_FRONT_CENTER, AV_CHAN_FRONT_LEFT_OF_CENTER, AV_CHAN_FRONT_RIGHT_OF_CENTER, AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_NONE },
{ AV_CHAN_UNUSED, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
{ AV_CHAN_UNUSED, AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT, AV_CHAN_BACK_CENTER },
{ AV_CHAN_LOW_FREQUENCY, AV_CHAN_LOW_FREQUENCY_2, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
},
{
{ AV_CHAN_TOP_FRONT_CENTER, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT, AV_CHAN_NONE },
{ AV_CHAN_UNUSED, AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_CENTER},
{ AV_CHAN_UNUSED, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_BACK_LEFT, AV_CHAN_TOP_BACK_RIGHT, AV_CHAN_TOP_BACK_CENTER},
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE},
},
{
{ AV_CHAN_BOTTOM_FRONT_CENTER, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_BOTTOM_FRONT_LEFT, AV_CHAN_BOTTOM_FRONT_RIGHT, AV_CHAN_NONE },
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
},
};
const AVChannelLayout ff_aac_ch_layout[] = {
AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
AV_CHANNEL_LAYOUT_SURROUND,
AV_CHANNEL_LAYOUT_4POINT0,
AV_CHANNEL_LAYOUT_5POINT0_BACK,
AV_CHANNEL_LAYOUT_5POINT1_BACK,
AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK,
AV_CHANNEL_LAYOUT_6POINT1_BACK,
AV_CHANNEL_LAYOUT_7POINT1,
AV_CHANNEL_LAYOUT_22POINT2,
AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK,
{ 0 },
};
VLCElem ff_vlc_scalefactors[352];
const VLCElem *ff_vlc_spectral[11];
/// Huffman tables for SBR
static const uint8_t sbr_huffman_tab[][2] = {
/* t_huffman_env_1_5dB - 121 entries */
{ 60, 2 }, { 59, 2 }, { 61, 3 }, { 58, 3 }, { 62, 4 },
{ 57, 4 }, { 63, 5 }, { 56, 5 }, { 64, 6 }, { 55, 6 },
{ 65, 7 }, { 54, 7 }, { 66, 8 }, { 53, 8 }, { 67, 9 },
{ 52, 9 }, { 51, 10 }, { 68, 10 }, { 50, 11 }, { 69, 12 },
{ 49, 12 }, { 70, 13 }, { 48, 13 }, { 47, 13 }, { 71, 14 },
{ 46, 14 }, { 72, 14 }, { 45, 14 }, { 44, 15 }, { 73, 15 },
{ 41, 16 }, { 42, 16 }, { 43, 16 }, { 74, 16 }, { 36, 16 },
{ 40, 16 }, { 76, 16 }, { 34, 17 }, { 39, 17 }, { 75, 17 },
{ 37, 17 }, { 35, 18 }, { 38, 18 }, { 0, 18 }, { 1, 18 },
{ 2, 18 }, { 3, 18 }, { 4, 18 }, { 5, 18 }, { 6, 19 },
{ 7, 19 }, { 8, 19 }, { 9, 19 }, { 10, 19 }, { 11, 19 },
{ 12, 19 }, { 13, 19 }, { 14, 19 }, { 15, 19 }, { 16, 19 },
{ 17, 19 }, { 18, 19 }, { 19, 19 }, { 20, 19 }, { 21, 19 },
{ 22, 19 }, { 23, 19 }, { 24, 19 }, { 25, 19 }, { 26, 19 },
{ 27, 19 }, { 28, 19 }, { 29, 19 }, { 30, 19 }, { 31, 19 },
{ 32, 19 }, { 33, 19 }, { 77, 19 }, { 78, 19 }, { 79, 19 },
{ 80, 19 }, { 81, 19 }, { 82, 19 }, { 83, 19 }, { 84, 19 },
{ 85, 19 }, { 86, 19 }, { 87, 19 }, { 88, 19 }, { 89, 19 },
{ 90, 19 }, { 91, 19 }, { 92, 19 }, { 93, 19 }, { 94, 19 },
{ 95, 19 }, { 96, 19 }, { 97, 19 }, { 98, 19 }, { 99, 19 },
{ 100, 19 }, { 101, 19 }, { 102, 19 }, { 103, 19 }, { 104, 19 },
{ 105, 19 }, { 106, 19 }, { 107, 19 }, { 108, 19 }, { 109, 19 },
{ 110, 19 }, { 111, 19 }, { 112, 19 }, { 113, 19 }, { 114, 19 },
{ 115, 19 }, { 116, 19 }, { 117, 19 }, { 118, 19 }, { 119, 19 },
{ 120, 19 },
/* f_huffman_env_1_5dB - 121 entries */
{ 60, 2 }, { 59, 2 }, { 61, 3 }, { 58, 3 }, { 57, 4 },
{ 62, 4 }, { 56, 5 }, { 63, 5 }, { 55, 6 }, { 64, 6 },
{ 54, 7 }, { 65, 8 }, { 53, 8 }, { 66, 8 }, { 52, 9 },
{ 67, 9 }, { 51, 9 }, { 68, 10 }, { 50, 10 }, { 69, 11 },
{ 49, 11 }, { 70, 11 }, { 71, 11 }, { 48, 12 }, { 72, 12 },
{ 47, 12 }, { 73, 12 }, { 74, 13 }, { 46, 13 }, { 45, 13 },
{ 75, 13 }, { 76, 14 }, { 77, 14 }, { 44, 14 }, { 43, 15 },
{ 42, 15 }, { 41, 16 }, { 78, 16 }, { 79, 16 }, { 40, 16 },
{ 39, 16 }, { 80, 17 }, { 81, 17 }, { 36, 17 }, { 37, 17 },
{ 38, 17 }, { 34, 17 }, { 32, 18 }, { 82, 18 }, { 83, 18 },
{ 85, 18 }, { 19, 18 }, { 35, 18 }, { 86, 18 }, { 87, 18 },
{ 30, 18 }, { 33, 18 }, { 84, 18 }, { 88, 18 }, { 104, 18 },
{ 9, 19 }, { 14, 19 }, { 16, 19 }, { 17, 19 }, { 23, 19 },
{ 27, 19 }, { 29, 19 }, { 31, 19 }, { 90, 19 }, { 97, 19 },
{ 102, 19 }, { 107, 19 }, { 108, 19 }, { 0, 19 }, { 1, 19 },
{ 2, 20 }, { 3, 20 }, { 4, 20 }, { 5, 20 }, { 6, 20 },
{ 7, 20 }, { 8, 20 }, { 10, 20 }, { 11, 20 }, { 12, 20 },
{ 13, 20 }, { 15, 20 }, { 18, 20 }, { 20, 20 }, { 21, 20 },
{ 22, 20 }, { 24, 20 }, { 25, 20 }, { 26, 20 }, { 28, 20 },
{ 89, 20 }, { 91, 20 }, { 92, 20 }, { 93, 20 }, { 94, 20 },
{ 95, 20 }, { 96, 20 }, { 98, 20 }, { 99, 20 }, { 100, 20 },
{ 101, 20 }, { 103, 20 }, { 105, 20 }, { 106, 20 }, { 109, 20 },
{ 110, 20 }, { 111, 20 }, { 112, 20 }, { 113, 20 }, { 114, 20 },
{ 115, 20 }, { 116, 20 }, { 117, 20 }, { 118, 20 }, { 119, 20 },
{ 120, 20 },
/* t_huffman_env_bal_1_5dB - 49 entries */
{ 24, 1 }, { 25, 2 }, { 23, 3 }, { 26, 4 }, { 22, 5 },
{ 27, 6 }, { 21, 7 }, { 28, 8 }, { 20, 9 }, { 19, 11 },
{ 29, 11 }, { 18, 12 }, { 30, 12 }, { 31, 15 }, { 17, 16 },
{ 32, 16 }, { 0, 16 }, { 1, 16 }, { 2, 16 }, { 3, 16 },
{ 4, 16 }, { 5, 16 }, { 6, 16 }, { 7, 16 }, { 8, 16 },
{ 9, 16 }, { 10, 16 }, { 11, 16 }, { 12, 16 }, { 13, 16 },
{ 14, 16 }, { 15, 16 }, { 16, 16 }, { 33, 16 }, { 34, 16 },
{ 35, 16 }, { 36, 16 }, { 37, 16 }, { 38, 16 }, { 39, 17 },
{ 40, 17 }, { 41, 17 }, { 42, 17 }, { 43, 17 }, { 44, 17 },
{ 45, 17 }, { 46, 17 }, { 47, 17 }, { 48, 17 },
/* f_huffman_env_bal_1_5dB - 49 entries */
{ 24, 1 }, { 23, 2 }, { 25, 3 }, { 22, 4 }, { 26, 5 },
{ 27, 6 }, { 21, 7 }, { 20, 8 }, { 28, 9 }, { 19, 11 },
{ 29, 11 }, { 18, 11 }, { 30, 12 }, { 17, 14 }, { 31, 15 },
{ 32, 16 }, { 15, 16 }, { 16, 17 }, { 0, 18 }, { 1, 18 },
{ 2, 18 }, { 3, 18 }, { 4, 18 }, { 5, 18 }, { 6, 18 },
{ 7, 18 }, { 8, 18 }, { 9, 18 }, { 10, 18 }, { 11, 18 },
{ 12, 18 }, { 13, 18 }, { 14, 18 }, { 33, 18 }, { 34, 18 },
{ 35, 18 }, { 36, 18 }, { 37, 18 }, { 38, 18 }, { 39, 18 },
{ 40, 18 }, { 41, 18 }, { 42, 18 }, { 43, 18 }, { 44, 18 },
{ 45, 18 }, { 46, 18 }, { 47, 19 }, { 48, 19 },
/* t_huffman_env_3_0dB - 63 entries */
{ 31, 1 }, { 30, 2 }, { 32, 3 }, { 29, 4 }, { 33, 5 },
{ 28, 6 }, { 34, 7 }, { 27, 8 }, { 35, 9 }, { 26, 11 },
{ 36, 11 }, { 25, 12 }, { 24, 13 }, { 37, 13 }, { 23, 14 },
{ 38, 14 }, { 22, 14 }, { 21, 14 }, { 39, 14 }, { 40, 15 },
{ 41, 16 }, { 18, 16 }, { 20, 16 }, { 19, 16 }, { 17, 17 },
{ 42, 17 }, { 43, 18 }, { 0, 18 }, { 1, 18 }, { 2, 19 },
{ 3, 19 }, { 4, 19 }, { 5, 19 }, { 6, 19 }, { 7, 19 },
{ 8, 19 }, { 9, 19 }, { 10, 19 }, { 11, 19 }, { 12, 19 },
{ 13, 19 }, { 14, 19 }, { 15, 19 }, { 16, 19 }, { 44, 19 },
{ 45, 19 }, { 46, 19 }, { 47, 19 }, { 48, 19 }, { 49, 19 },
{ 50, 19 }, { 51, 19 }, { 52, 19 }, { 53, 19 }, { 54, 19 },
{ 55, 19 }, { 56, 19 }, { 57, 19 }, { 58, 19 }, { 59, 19 },
{ 60, 19 }, { 61, 19 }, { 62, 19 },
/* f_huffman_env_3_0dB - 63 entries */
{ 31, 1 }, { 30, 2 }, { 32, 3 }, { 29, 4 }, { 33, 5 },
{ 28, 6 }, { 34, 8 }, { 27, 8 }, { 35, 9 }, { 26, 9 },
{ 36, 10 }, { 25, 10 }, { 37, 11 }, { 24, 11 }, { 38, 12 },
{ 23, 12 }, { 39, 13 }, { 40, 14 }, { 22, 14 }, { 21, 15 },
{ 41, 15 }, { 42, 15 }, { 20, 16 }, { 19, 16 }, { 43, 16 },
{ 44, 16 }, { 18, 17 }, { 16, 17 }, { 45, 17 }, { 46, 17 },
{ 17, 18 }, { 49, 18 }, { 13, 18 }, { 7, 18 }, { 12, 18 },
{ 47, 18 }, { 48, 18 }, { 9, 19 }, { 10, 19 }, { 15, 19 },
{ 51, 19 }, { 52, 19 }, { 53, 19 }, { 56, 19 }, { 8, 19 },
{ 11, 19 }, { 55, 19 }, { 0, 20 }, { 1, 20 }, { 2, 20 },
{ 3, 20 }, { 4, 20 }, { 5, 20 }, { 6, 20 }, { 14, 20 },
{ 50, 20 }, { 54, 20 }, { 57, 20 }, { 58, 20 }, { 59, 20 },
{ 60, 20 }, { 61, 20 }, { 62, 20 },
/* t_huffman_env_bal_3_0dB - 25 entries */
{ 12, 1 }, { 13, 2 }, { 11, 3 }, { 10, 4 }, { 14, 5 },
{ 15, 6 }, { 9, 7 }, { 8, 8 }, { 16, 9 }, { 7, 12 },
{ 0, 13 }, { 1, 13 }, { 2, 13 }, { 3, 13 }, { 4, 13 },
{ 5, 13 }, { 6, 13 }, { 17, 13 }, { 18, 13 }, { 19, 13 },
{ 20, 13 }, { 21, 13 }, { 22, 13 }, { 23, 14 }, { 24, 14 },
/* f_huffman_env_bal_3_0dB - 25 entries */
{ 12, 1 }, { 11, 2 }, { 13, 3 }, { 10, 4 }, { 14, 5 },
{ 15, 6 }, { 9, 7 }, { 8, 8 }, { 16, 9 }, { 7, 11 },
{ 17, 12 }, { 18, 13 }, { 0, 13 }, { 1, 13 }, { 2, 13 },
{ 3, 13 }, { 4, 13 }, { 5, 14 }, { 6, 14 }, { 19, 14 },
{ 20, 14 }, { 21, 14 }, { 22, 14 }, { 23, 14 }, { 24, 14 },
/* t_huffman_noise_3_0dB - 63 entries */
{ 31, 1 }, { 32, 2 }, { 30, 3 }, { 29, 4 }, { 33, 5 },
{ 28, 6 }, { 34, 8 }, { 27, 8 }, { 35, 10 }, { 26, 11 },
{ 36, 13 }, { 42, 13 }, { 0, 13 }, { 1, 13 }, { 2, 13 },
{ 3, 13 }, { 4, 13 }, { 5, 13 }, { 6, 13 }, { 7, 13 },
{ 8, 13 }, { 9, 13 }, { 10, 13 }, { 11, 13 }, { 12, 13 },
{ 13, 13 }, { 14, 13 }, { 15, 13 }, { 16, 13 }, { 17, 13 },
{ 18, 13 }, { 19, 13 }, { 20, 13 }, { 21, 13 }, { 22, 13 },
{ 23, 13 }, { 24, 13 }, { 25, 13 }, { 37, 13 }, { 38, 13 },
{ 39, 13 }, { 40, 13 }, { 41, 13 }, { 43, 13 }, { 44, 13 },
{ 45, 13 }, { 46, 13 }, { 47, 13 }, { 48, 13 }, { 49, 13 },
{ 50, 13 }, { 51, 13 }, { 52, 13 }, { 53, 13 }, { 54, 13 },
{ 55, 13 }, { 56, 13 }, { 57, 13 }, { 58, 13 }, { 59, 13 },
{ 60, 13 }, { 61, 14 }, { 62, 14 },
/* t_huffman_noise_bal_3_0dB - 25 entries */
{ 12, 1 }, { 11, 2 }, { 13, 3 }, { 10, 5 }, { 14, 6 },
{ 0, 8 }, { 1, 8 }, { 2, 8 }, { 3, 8 }, { 4, 8 },
{ 5, 8 }, { 6, 8 }, { 7, 8 }, { 8, 8 }, { 9, 8 },
{ 15, 8 }, { 16, 8 }, { 17, 8 }, { 18, 8 }, { 19, 8 },
{ 20, 8 }, { 21, 8 }, { 22, 8 }, { 23, 8 }, { 24, 8 },
};
static const uint8_t sbr_huffman_nb_codes[] = {
121, 121, 49, 49, 63, 63, 25, 25, 63, 25
};
static const int8_t sbr_vlc_offsets[10] = {
-60, -60, -24, -24, -31, -31, -12, -12, -31, -12
};
const VLCElem *ff_aac_sbr_vlc[10];
static av_cold void aacdec_common_init(void)
{
static VLCElem vlc_buf[(304 + 270 + 550 + 300 + 328 +
294 + 306 + 268 + 510 + 366 + 462) +
(1098 + 1092 + 768 + 1026 + 1058 +
1052 + 544 + 544 + 592 + 512)];
VLCInitState state = VLC_INIT_STATE(vlc_buf);
const uint8_t (*tab)[2] = sbr_huffman_tab;
for (unsigned i = 0; i < 11; i++) {
#define TAB_WRAP_SIZE(name) name[i], sizeof(name[i][0]), sizeof(name[i][0])
ff_vlc_spectral[i] =
ff_vlc_init_tables_sparse(&state, 8, ff_aac_spectral_sizes[i],
TAB_WRAP_SIZE(ff_aac_spectral_bits),
TAB_WRAP_SIZE(ff_aac_spectral_codes),
TAB_WRAP_SIZE(ff_aac_codebook_vector_idx),
0);
}
VLC_INIT_STATIC_TABLE(ff_vlc_scalefactors, 7,
FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
ff_aac_scalefactor_bits,
sizeof(ff_aac_scalefactor_bits[0]),
sizeof(ff_aac_scalefactor_bits[0]),
ff_aac_scalefactor_code,
sizeof(ff_aac_scalefactor_code[0]),
sizeof(ff_aac_scalefactor_code[0]), 0);
// SBR VLC table initialization
for (int i = 0; i < FF_ARRAY_ELEMS(ff_aac_sbr_vlc); i++) {
ff_aac_sbr_vlc[i] =
ff_vlc_init_tables_from_lengths(&state, 9, sbr_huffman_nb_codes[i],
&tab[0][1], 2,
&tab[0][0], 2, 1,
sbr_vlc_offsets[i], 0);
tab += sbr_huffman_nb_codes[i];
}
ff_ps_init_common();
}
av_cold void ff_aacdec_common_init_once(void)
{
static AVOnce init_static_once = AV_ONCE_INIT;
ff_thread_once(&init_static_once, aacdec_common_init);
}

View File

@ -66,11 +66,11 @@
#include "avcodec.h"
#include "codec_internal.h"
#include "get_bits.h"
#include "lpc.h"
#include "kbdwin.h"
#include "sinewin_fixed_tablegen.h"
#include "aac.h"
#include "aacdec.h"
#include "aactab.h"
#include "aacdectab.h"
#include "adts_header.h"
@ -89,6 +89,49 @@ DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_short_128))[128];
DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_long_960))[960];
DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_short_120))[120];
/* @name ltp_coef
* Table of the LTP coefficients
*/
static const int ltp_coef_fixed[8] = {
Q30(0.570829), Q30(0.696616), Q30(0.813004), Q30(0.911304),
Q30(0.984900), Q30(1.067894), Q30(1.194601), Q30(1.369533),
};
/* @name tns_tmp2_map
* Tables of the tmp2[] arrays of LPC coefficients used for TNS.
* The suffix _M_N[] indicate the values of coef_compress and coef_res
* respectively.
* @{
*/
static const int tns_tmp2_map_1_3[4] = {
Q31(0.00000000), Q31(-0.43388373), Q31(0.64278758), Q31(0.34202015),
};
static const int tns_tmp2_map_0_3[8] = {
Q31(0.00000000), Q31(-0.43388373), Q31(-0.78183150), Q31(-0.97492790),
Q31(0.98480773), Q31( 0.86602539), Q31( 0.64278758), Q31( 0.34202015),
};
static const int tns_tmp2_map_1_4[8] = {
Q31(0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524),
Q31(0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951),
};
static const int tns_tmp2_map_0_4[16] = {
Q31( 0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524),
Q31(-0.74314481), Q31(-0.86602539), Q31(-0.95105654), Q31(-0.99452192),
Q31( 0.99573416), Q31( 0.96182561), Q31( 0.89516330), Q31( 0.79801720),
Q31( 0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951),
};
static const int * const tns_tmp2_map_fixed[4] = {
tns_tmp2_map_0_3,
tns_tmp2_map_0_4,
tns_tmp2_map_1_3,
tns_tmp2_map_1_4
};
// @}
static av_always_inline void reset_predict_state(PredictorState *ps)
{
ps->r0.mant = 0;
@ -354,7 +397,7 @@ static const int cce_scale_fixed[8] = {
*
* @param index index into coupling gain array
*/
static void apply_dependent_coupling_fixed(AACContext *ac,
static void apply_dependent_coupling_fixed(AACDecContext *ac,
SingleChannelElement *target,
ChannelElement *cce, int index)
{
@ -418,7 +461,7 @@ static void apply_dependent_coupling_fixed(AACContext *ac,
*
* @param index index into coupling gain array
*/
static void apply_independent_coupling_fixed(AACContext *ac,
static void apply_independent_coupling_fixed(AACDecContext *ac,
SingleChannelElement *target,
ChannelElement *cce, int index)
{
@ -456,7 +499,7 @@ const FFCodec ff_aac_fixed_decoder = {
CODEC_LONG_NAME("AAC (Advanced Audio Coding)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_AAC,
.priv_data_size = sizeof(AACContext),
.priv_data_size = sizeof(AACDecContext),
.init = aac_decode_init,
.close = aac_decode_close,
FF_CODEC_DECODE_CB(aac_decode_frame),
@ -465,8 +508,7 @@ const FFCodec ff_aac_fixed_decoder = {
},
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(aac_channel_layout)
.p.ch_layouts = aac_ch_layout,
.p.ch_layouts = ff_aac_ch_layout,
.p.priv_class = &aac_decoder_class,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
.flush = flush,

View File

@ -93,11 +93,9 @@
#include "libavutil/thread.h"
#include "decode.h"
#include "internal.h"
#include "lpc_functions.h"
static VLC vlc_scalefactors;
static VLC vlc_spectral[11];
static int output_configure(AACContext *ac,
static int output_configure(AACDecContext *ac,
uint8_t layout_map[MAX_ELEM_ID*4][3], int tags,
enum OCStatus oc_type, int get_new_frame);
@ -127,7 +125,7 @@ static int count_channels(uint8_t (*layout)[3], int tags)
*
* @return Returns error status. 0 - OK, !0 - error
*/
static av_cold int che_configure(AACContext *ac,
static av_cold int che_configure(AACDecContext *ac,
enum ChannelPosition che_pos,
int type, int id, int *channels)
{
@ -163,7 +161,7 @@ static av_cold int che_configure(AACContext *ac,
static int frame_configure_elements(AVCodecContext *avctx)
{
AACContext *ac = avctx->priv_data;
AACDecContext *ac = avctx->priv_data;
int type, id, ch, ret;
/* set channel pointers to internal buffers by default */
@ -283,10 +281,10 @@ static int assign_channels(struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t
if (pos == AAC_CHANNEL_LFE) {
while (nb_channels) {
if (aac_channel_map[layer][pos - 1][j] == AV_CHAN_NONE)
if (ff_aac_channel_map[layer][pos - 1][j] == AV_CHAN_NONE)
return -1;
e2c_vec[i] = (struct elem_to_channel) {
.av_position = 1ULL << aac_channel_map[layer][pos - 1][j],
.av_position = 1ULL << ff_aac_channel_map[layer][pos - 1][j],
.syn_ele = layout_map[i][0],
.elem_id = layout_map[i][1],
.aac_position = pos
@ -302,12 +300,12 @@ static int assign_channels(struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t
}
while (nb_channels & 1) {
if (aac_channel_map[layer][pos - 1][0] == AV_CHAN_NONE)
if (ff_aac_channel_map[layer][pos - 1][0] == AV_CHAN_NONE)
return -1;
if (aac_channel_map[layer][pos - 1][0] == AV_CHAN_UNUSED)
if (ff_aac_channel_map[layer][pos - 1][0] == AV_CHAN_UNUSED)
break;
e2c_vec[i] = (struct elem_to_channel) {
.av_position = 1ULL << aac_channel_map[layer][pos - 1][0],
.av_position = 1ULL << ff_aac_channel_map[layer][pos - 1][0],
.syn_ele = layout_map[i][0],
.elem_id = layout_map[i][1],
.aac_position = pos
@ -319,21 +317,21 @@ static int assign_channels(struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t
j = (pos != AAC_CHANNEL_SIDE) && nb_channels <= 3 ? 3 : 1;
while (nb_channels >= 2) {
if (aac_channel_map[layer][pos - 1][j] == AV_CHAN_NONE ||
aac_channel_map[layer][pos - 1][j+1] == AV_CHAN_NONE)
if (ff_aac_channel_map[layer][pos - 1][j] == AV_CHAN_NONE ||
ff_aac_channel_map[layer][pos - 1][j+1] == AV_CHAN_NONE)
return -1;
i += assign_pair(e2c_vec, layout_map, i,
1ULL << aac_channel_map[layer][pos - 1][j],
1ULL << aac_channel_map[layer][pos - 1][j+1],
1ULL << ff_aac_channel_map[layer][pos - 1][j],
1ULL << ff_aac_channel_map[layer][pos - 1][j+1],
pos, layout);
j += 2;
nb_channels -= 2;
}
while (nb_channels & 1) {
if (aac_channel_map[layer][pos - 1][5] == AV_CHAN_NONE)
if (ff_aac_channel_map[layer][pos - 1][5] == AV_CHAN_NONE)
return -1;
e2c_vec[i] = (struct elem_to_channel) {
.av_position = 1ULL << aac_channel_map[layer][pos - 1][5],
.av_position = 1ULL << ff_aac_channel_map[layer][pos - 1][5],
.syn_ele = layout_map[i][0],
.elem_id = layout_map[i][1],
.aac_position = pos
@ -414,7 +412,8 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
/**
* Save current output configuration if and only if it has been locked.
*/
static int push_output_configuration(AACContext *ac) {
static int push_output_configuration(AACDecContext *ac)
{
int pushed = 0;
if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
@ -429,7 +428,8 @@ static int push_output_configuration(AACContext *ac) {
* Restore the previous output configuration if and only if the current
* configuration is unlocked.
*/
static void pop_output_configuration(AACContext *ac) {
static void pop_output_configuration(AACDecContext *ac)
{
if (ac->oc[1].status != OC_LOCKED && ac->oc[0].status != OC_NONE) {
ac->oc[1] = ac->oc[0];
ac->avctx->ch_layout = ac->oc[1].ch_layout;
@ -444,7 +444,7 @@ static void pop_output_configuration(AACContext *ac) {
*
* @return Returns error status. 0 - OK, !0 - error
*/
static int output_configure(AACContext *ac,
static int output_configure(AACDecContext *ac,
uint8_t layout_map[MAX_ELEM_ID * 4][3], int tags,
enum OCStatus oc_type, int get_new_frame)
{
@ -469,13 +469,6 @@ static int output_configure(AACContext *ac,
}
// Try to sniff a reasonable channel order, otherwise output the
// channels in the order the PCE declared them.
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->request_channel_layout == AV_CH_LAYOUT_NATIVE)
ac->output_channel_order = CHANNEL_ORDER_CODED;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (ac->output_channel_order == CHANNEL_ORDER_DEFAULT)
layout = sniff_channel_order(layout_map, tags);
for (i = 0; i < tags; i++) {
@ -519,7 +512,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
static void flush(AVCodecContext *avctx)
{
AACContext *ac= avctx->priv_data;
AACDecContext *ac= avctx->priv_data;
int type, i, j;
for (type = 3; type >= 0; type--) {
@ -540,7 +533,7 @@ static void flush(AVCodecContext *avctx)
*
* @return Returns error status. 0 - OK, !0 - error
*/
static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
static int set_default_channel_config(AACDecContext *ac, AVCodecContext *avctx,
uint8_t (*layout_map)[3],
int *tags,
int channel_config)
@ -552,8 +545,8 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
channel_config);
return AVERROR_INVALIDDATA;
}
*tags = tags_per_config[channel_config];
memcpy(layout_map, aac_channel_layout_map[channel_config - 1],
*tags = ff_tags_per_config[channel_config];
memcpy(layout_map, ff_aac_channel_layout_map[channel_config - 1],
*tags * sizeof(*layout_map));
/*
@ -580,7 +573,7 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
return 0;
}
static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
static ChannelElement *get_che(AACDecContext *ac, int type, int elem_id)
{
/* For PCE based channel configurations map the channels solely based
* on tags. */
@ -661,7 +654,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
* SCE[0] CPE[0] CPE[1] LFE[0].
* If we seem to have encountered such a stream, transfer
* the LFE[0] element to the SCE[1]'s mapping */
if (ac->tags_mapped == tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
if (ac->tags_mapped == ff_tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
if (!ac->warned_remapping_once && (type != TYPE_LFE || elem_id != 0)) {
av_log(ac->avctx, AV_LOG_WARNING,
"This stream seems to incorrectly report its last channel as %s[%d], mapping to LFE[0]\n",
@ -683,7 +676,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
* SCE[0] CPE[0] SCE[1].
* If we seem to have encountered such a stream, transfer
* the SCE[1] element to the LFE[0]'s mapping */
if (ac->tags_mapped == tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
if (ac->tags_mapped == ff_tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
if (!ac->warned_remapping_once && (type != TYPE_SCE || elem_id != 1)) {
av_log(ac->avctx, AV_LOG_WARNING,
"This stream seems to incorrectly report its last channel as %s[%d], mapping to SCE[1]\n",
@ -833,12 +826,12 @@ static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
/**
* Decode GA "General Audio" specific configuration; reference: table 4.1.
*
* @param ac pointer to AACContext, may be null
* @param ac pointer to AACDecContext, may be null
* @param avctx pointer to AVCCodecContext, used for logging
*
* @return Returns error status. 0 - OK, !0 - error
*/
static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
static int decode_ga_specific_config(AACDecContext *ac, AVCodecContext *avctx,
GetBitContext *gb,
int get_bit_alignment,
MPEG4AudioConfig *m4ac,
@ -919,7 +912,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
return 0;
}
static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
static int decode_eld_specific_config(AACDecContext *ac, AVCodecContext *avctx,
GetBitContext *gb,
MPEG4AudioConfig *m4ac,
int channel_config)
@ -979,7 +972,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
/**
* Decode audio specific configuration; reference: table 1.13.
*
* @param ac pointer to AACContext, may be null
* @param ac pointer to AACDecContext, may be null
* @param avctx pointer to AVCCodecContext, used for logging
* @param m4ac pointer to MPEG4AudioConfig, used for parsing
* @param gb buffer holding an audio specific config
@ -988,7 +981,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
*
* @return Returns error status or number of consumed bits. <0 - error
*/
static int decode_audio_specific_config_gb(AACContext *ac,
static int decode_audio_specific_config_gb(AACDecContext *ac,
AVCodecContext *avctx,
MPEG4AudioConfig *m4ac,
GetBitContext *gb,
@ -1055,7 +1048,7 @@ static int decode_audio_specific_config_gb(AACContext *ac,
return get_bits_count(gb);
}
static int decode_audio_specific_config(AACContext *ac,
static int decode_audio_specific_config(AACDecContext *ac,
AVCodecContext *avctx,
MPEG4AudioConfig *m4ac,
const uint8_t *data, int64_t bit_size,
@ -1124,43 +1117,17 @@ static void reset_predictor_group(PredictorState *ps, int group_num)
reset_predict_state(&ps[i]);
}
static void aacdec_init(AACContext *ac);
static void aacdec_init(AACDecContext *ac);
static av_cold void aac_static_table_init(void)
{
static VLCElem vlc_buf[304 + 270 + 550 + 300 + 328 +
294 + 306 + 268 + 510 + 366 + 462];
for (unsigned i = 0, offset = 0; i < 11; i++) {
vlc_spectral[i].table = &vlc_buf[offset];
vlc_spectral[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset;
ff_vlc_init_sparse(&vlc_spectral[i], 8, ff_aac_spectral_sizes[i],
ff_aac_spectral_bits[i], sizeof(ff_aac_spectral_bits[i][0]),
sizeof(ff_aac_spectral_bits[i][0]),
ff_aac_spectral_codes[i], sizeof(ff_aac_spectral_codes[i][0]),
sizeof(ff_aac_spectral_codes[i][0]),
ff_aac_codebook_vector_idx[i], sizeof(ff_aac_codebook_vector_idx[i][0]),
sizeof(ff_aac_codebook_vector_idx[i][0]),
VLC_INIT_STATIC_OVERLONG);
offset += vlc_spectral[i].table_size;
}
AAC_RENAME(ff_aac_sbr_init)();
ff_aac_tableinit();
VLC_INIT_STATIC(&vlc_scalefactors, 7,
FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
ff_aac_scalefactor_bits,
sizeof(ff_aac_scalefactor_bits[0]),
sizeof(ff_aac_scalefactor_bits[0]),
ff_aac_scalefactor_code,
sizeof(ff_aac_scalefactor_code[0]),
sizeof(ff_aac_scalefactor_code[0]),
352);
ff_aacdec_common_init_once();
// window initialization
AAC_RENAME(avpriv_kbd_window_init)(AAC_RENAME(aac_kbd_long_960), 4.0, 960);
AAC_RENAME(avpriv_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120);
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_long_960), 4.0, 960);
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120);
#if !USE_FIXED
AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_960), 960);
@ -1168,8 +1135,8 @@ static av_cold void aac_static_table_init(void)
AAC_RENAME(ff_init_ff_sine_windows)(9);
ff_aac_float_common_init();
#else
AAC_RENAME(avpriv_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
AAC_RENAME(avpriv_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
init_sine_windows_fixed();
#endif
@ -1181,7 +1148,7 @@ static AVOnce aac_table_init = AV_ONCE_INIT;
static av_cold int aac_decode_init(AVCodecContext *avctx)
{
float scale;
AACContext *ac = avctx->priv_data;
AACDecContext *ac = avctx->priv_data;
int ret;
if (avctx->sample_rate > 96000)
@ -1279,7 +1246,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
/**
* Skip data_stream_element; reference: table 4.10.
*/
static int skip_data_stream_element(AACContext *ac, GetBitContext *gb)
static int skip_data_stream_element(AACDecContext *ac, GetBitContext *gb)
{
int byte_align = get_bits1(gb);
int count = get_bits(gb, 8);
@ -1296,7 +1263,7 @@ static int skip_data_stream_element(AACContext *ac, GetBitContext *gb)
return 0;
}
static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
static int decode_prediction(AACDecContext *ac, IndividualChannelStream *ics,
GetBitContext *gb)
{
int sfb;
@ -1324,7 +1291,7 @@ static void decode_ltp(LongTermPrediction *ltp,
int sfb;
ltp->lag = get_bits(gb, 11);
ltp->coef = ltp_coef[get_bits(gb, 3)];
ltp->coef = AAC_RENAME2(ltp_coef)[get_bits(gb, 3)];
for (sfb = 0; sfb < FFMIN(max_sfb, MAX_LTP_LONG_SFB); sfb++)
ltp->used[sfb] = get_bits1(gb);
}
@ -1332,7 +1299,7 @@ static void decode_ltp(LongTermPrediction *ltp,
/**
* Decode Individual Channel Stream info; reference: table 4.6.
*/
static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
static int decode_ics_info(AACDecContext *ac, IndividualChannelStream *ics,
GetBitContext *gb)
{
const MPEG4AudioConfig *const m4ac = &ac->oc[1].m4ac;
@ -1458,7 +1425,7 @@ fail:
*
* @return Returns error status. 0 - OK, !0 - error
*/
static int decode_band_types(AACContext *ac, enum BandType band_type[120],
static int decode_band_types(AACDecContext *ac, enum BandType band_type[120],
int band_type_run_end[120], GetBitContext *gb,
IndividualChannelStream *ics)
{
@ -1507,7 +1474,7 @@ static int decode_band_types(AACContext *ac, enum BandType band_type[120],
*
* @return Returns error status. 0 - OK, !0 - error
*/
static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *gb,
static int decode_scalefactors(AACDecContext *ac, INTFLOAT sf[120], GetBitContext *gb,
unsigned int global_gain,
IndividualChannelStream *ics,
enum BandType band_type[120],
@ -1526,7 +1493,7 @@ static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *
} else if ((band_type[idx] == INTENSITY_BT) ||
(band_type[idx] == INTENSITY_BT2)) {
for (; i < run_end; i++, idx++) {
offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
offset[2] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
clipped_offset = av_clip(offset[2], -155, 100);
if (offset[2] != clipped_offset) {
avpriv_request_sample(ac->avctx,
@ -1545,7 +1512,7 @@ static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *
if (noise_flag-- > 0)
offset[1] += get_bits(gb, NOISE_PRE_BITS) - NOISE_PRE;
else
offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
offset[1] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
clipped_offset = av_clip(offset[1], -100, 155);
if (offset[1] != clipped_offset) {
avpriv_request_sample(ac->avctx,
@ -1561,7 +1528,7 @@ static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *
}
} else {
for (; i < run_end; i++, idx++) {
offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
offset[0] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
if (offset[0] > 255U) {
av_log(ac->avctx, AV_LOG_ERROR,
"Scalefactor (%d) out of range.\n", offset[0]);
@ -1609,7 +1576,7 @@ static int decode_pulses(Pulse *pulse, GetBitContext *gb,
*
* @return Returns error status. 0 - OK, !0 - error
*/
static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns,
static int decode_tns(AACDecContext *ac, TemporalNoiseShaping *tns,
GetBitContext *gb, const IndividualChannelStream *ics)
{
int w, filt, i, coef_len, coef_res, coef_compress;
@ -1637,7 +1604,7 @@ static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns,
tmp2_idx = 2 * coef_compress + coef_res;
for (i = 0; i < tns->order[w][filt]; i++)
tns->coef[w][filt][i] = tns_tmp2_map[tmp2_idx][get_bits(gb, coef_len)];
tns->coef[w][filt][i] = AAC_RENAME2(tns_tmp2_map)[tmp2_idx][get_bits(gb, coef_len)];
}
}
}
@ -1677,7 +1644,7 @@ static void decode_mid_side_stereo(ChannelElement *cpe, GetBitContext *gb,
*
* @return Returns error status. 0 - OK, !0 - error
*/
static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
static int decode_spectrum_and_dequant(AACDecContext *ac, INTFLOAT coef[1024],
GetBitContext *gb, const INTFLOAT sf[120],
int pulse_present, const Pulse *pulse,
const IndividualChannelStream *ics,
@ -1734,7 +1701,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
#if !USE_FIXED
const float *vq = ff_aac_codebook_vector_vals[cbt_m1];
#endif /* !USE_FIXED */
const VLCElem *vlc_tab = vlc_spectral[cbt_m1].table;
const VLCElem *vlc_tab = ff_vlc_spectral[cbt_m1];
OPEN_READER(re, gb);
switch (cbt_m1 >> 1) {
@ -1972,7 +1939,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
/**
* Apply AAC-Main style frequency domain prediction.
*/
static void apply_prediction(AACContext *ac, SingleChannelElement *sce)
static void apply_prediction(AACDecContext *ac, SingleChannelElement *sce)
{
int sfb, k;
@ -2035,7 +2002,7 @@ static void decode_gain_control(SingleChannelElement * sce, GetBitContext * gb)
*
* @return Returns error status. 0 - OK, !0 - error
*/
static int decode_ics(AACContext *ac, SingleChannelElement *sce,
static int decode_ics(AACDecContext *ac, SingleChannelElement *sce,
GetBitContext *gb, int common_window, int scale_flag)
{
Pulse pulse;
@ -2126,7 +2093,7 @@ fail:
/**
* Mid/Side stereo decoding; reference: 4.6.8.1.3.
*/
static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe)
static void apply_mid_side_stereo(AACDecContext *ac, ChannelElement *cpe)
{
const IndividualChannelStream *ics = &cpe->ch[0].ics;
INTFLOAT *ch0 = cpe->ch[0].coeffs;
@ -2164,7 +2131,7 @@ static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe)
* [1] mask is decoded from bitstream; [2] mask is all 1s;
* [3] reserved for scalable AAC
*/
static void apply_intensity_stereo(AACContext *ac,
static void apply_intensity_stereo(AACDecContext *ac,
ChannelElement *cpe, int ms_present)
{
const IndividualChannelStream *ics = &cpe->ch[1].ics;
@ -2214,7 +2181,7 @@ static void apply_intensity_stereo(AACContext *ac,
*
* @return Returns error status. 0 - OK, !0 - error
*/
static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
static int decode_cpe(AACDecContext *ac, GetBitContext *gb, ChannelElement *cpe)
{
int i, ret, common_window, ms_present = 0;
int eld_syntax = ac->oc[1].m4ac.object_type == AOT_ER_AAC_ELD;
@ -2267,7 +2234,7 @@ static const float cce_scale[] = {
*
* @return Returns error status. 0 - OK, !0 - error
*/
static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
static int decode_cce(AACDecContext *ac, GetBitContext *gb, ChannelElement *che)
{
int num_gain = 0;
int c, g, sfb, ret;
@ -2308,7 +2275,7 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
INTFLOAT gain_cache = FIXR10(1.);
if (c) {
cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);
gain = cge ? get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60: 0;
gain = cge ? get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - 60: 0;
gain_cache = GET_GAIN(scale, gain);
#if USE_FIXED
if ((abs(gain_cache)-1024) >> 3 > 30)
@ -2322,7 +2289,7 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
for (sfb = 0; sfb < sce->ics.max_sfb; sfb++, idx++) {
if (sce->band_type[idx] != ZERO_BT) {
if (!cge) {
int t = get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
int t = get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - 60;
if (t) {
int s = 1;
t = gain += t;
@ -2417,7 +2384,7 @@ static int decode_dynamic_range(DynamicRangeControl *che_drc,
return n;
}
static int decode_fill(AACContext *ac, GetBitContext *gb, int len) {
static int decode_fill(AACDecContext *ac, GetBitContext *gb, int len) {
uint8_t buf[256];
int i, major, minor;
@ -2450,7 +2417,7 @@ unknown:
*
* @return Returns number of bytes consumed
*/
static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
static int decode_extension_payload(AACDecContext *ac, GetBitContext *gb, int cnt,
ChannelElement *che, enum RawDataBlockType elem_type)
{
int crc_flag = 0;
@ -2543,7 +2510,7 @@ static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
continue;
// tns_decode_coef
AAC_RENAME(compute_lpc_coefs)(tns->coef[w][filt], order, lpc, 0, 0, 0);
compute_lpc_coefs(tns->coef[w][filt], order, lpc, 0, 0, 0);
start = ics->swb_offset[FFMIN(bottom, mmm)];
end = ics->swb_offset[FFMIN( top, mmm)];
@ -2580,7 +2547,7 @@ static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
* Apply windowing and MDCT to obtain the spectral
* coefficient from the predicted sample by LTP.
*/
static void windowing_and_mdct_ltp(AACContext *ac, INTFLOAT *out,
static void windowing_and_mdct_ltp(AACDecContext *ac, INTFLOAT *out,
INTFLOAT *in, IndividualChannelStream *ics)
{
const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
@ -2606,7 +2573,7 @@ static void windowing_and_mdct_ltp(AACContext *ac, INTFLOAT *out,
/**
* Apply the long term prediction
*/
static void apply_ltp(AACContext *ac, SingleChannelElement *sce)
static void apply_ltp(AACDecContext *ac, SingleChannelElement *sce)
{
const LongTermPrediction *ltp = &sce->ics.ltp;
const uint16_t *offsets = sce->ics.swb_offset;
@ -2638,7 +2605,7 @@ static void apply_ltp(AACContext *ac, SingleChannelElement *sce)
/**
* Update the LTP buffer for next frame
*/
static void update_ltp(AACContext *ac, SingleChannelElement *sce)
static void update_ltp(AACDecContext *ac, SingleChannelElement *sce)
{
IndividualChannelStream *ics = &sce->ics;
INTFLOAT *saved = sce->saved;
@ -2676,7 +2643,7 @@ static void update_ltp(AACContext *ac, SingleChannelElement *sce)
/**
* Conduct IMDCT and windowing.
*/
static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
static void imdct_and_windowing(AACDecContext *ac, SingleChannelElement *sce)
{
IndividualChannelStream *ics = &sce->ics;
INTFLOAT *in = sce->coeffs;
@ -2740,7 +2707,7 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
/**
* Conduct IMDCT and windowing.
*/
static void imdct_and_windowing_960(AACContext *ac, SingleChannelElement *sce)
static void imdct_and_windowing_960(AACDecContext *ac, SingleChannelElement *sce)
{
IndividualChannelStream *ics = &sce->ics;
INTFLOAT *in = sce->coeffs;
@ -2801,7 +2768,7 @@ static void imdct_and_windowing_960(AACContext *ac, SingleChannelElement *sce)
memcpy( saved, buf + 480, 480 * sizeof(*saved));
}
}
static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce)
static void imdct_and_windowing_ld(AACDecContext *ac, SingleChannelElement *sce)
{
IndividualChannelStream *ics = &sce->ics;
INTFLOAT *in = sce->coeffs;
@ -2826,7 +2793,7 @@ static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce)
memcpy(saved, buf + 256, 256 * sizeof(*saved));
}
static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
static void imdct_and_windowing_eld(AACDecContext *ac, SingleChannelElement *sce)
{
UINTFLOAT *in = sce->coeffs;
INTFLOAT *out = sce->ret;
@ -2856,8 +2823,8 @@ static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
ac->mdct512_fn(ac->mdct512, buf, in, sizeof(INTFLOAT));
for (i = 0; i < n; i+=2) {
buf[i + 0] = -(int)(USE_FIXED + 1U)*buf[i + 0];
buf[i + 1] = (int)(USE_FIXED + 1U)*buf[i + 1];
buf[i + 0] = -(UINTFLOAT)(USE_FIXED + 1)*buf[i + 0];
buf[i + 1] = (UINTFLOAT)(USE_FIXED + 1)*buf[i + 1];
}
// Like with the regular IMDCT at this point we still have the middle half
// of a transform but with even symmetry on the left and odd symmetry on
@ -2894,10 +2861,10 @@ static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
*
* @param apply_coupling_method pointer to (in)dependent coupling function
*/
static void apply_channel_coupling(AACContext *ac, ChannelElement *cc,
static void apply_channel_coupling(AACDecContext *ac, ChannelElement *cc,
enum RawDataBlockType type, int elem_id,
enum CouplingPoint coupling_point,
void (*apply_coupling_method)(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index))
void (*apply_coupling_method)(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index))
{
int i, c;
@ -2927,10 +2894,10 @@ static void apply_channel_coupling(AACContext *ac, ChannelElement *cc,
/**
* Convert spectral data to samples, applying all supported tools as appropriate.
*/
static void spectral_to_sample(AACContext *ac, int samples)
static void spectral_to_sample(AACDecContext *ac, int samples)
{
int i, type;
void (*imdct_and_window)(AACContext *ac, SingleChannelElement *sce);
void (*imdct_and_window)(AACDecContext *ac, SingleChannelElement *sce);
switch (ac->oc[1].m4ac.object_type) {
case AOT_ER_AAC_LD:
imdct_and_window = imdct_and_windowing_ld;
@ -2999,7 +2966,7 @@ static void spectral_to_sample(AACContext *ac, int samples)
}
}
static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
static int parse_adts_frame_header(AACDecContext *ac, GetBitContext *gb)
{
int size;
AACADTSHeaderInfo hdr_info;
@ -3061,10 +3028,10 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
return size;
}
static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
static int aac_decode_er_frame(AVCodecContext *avctx, AVFrame *frame,
int *got_frame_ptr, GetBitContext *gb)
{
AACContext *ac = avctx->priv_data;
AACDecContext *ac = avctx->priv_data;
const MPEG4AudioConfig *const m4ac = &ac->oc[1].m4ac;
ChannelElement *che;
int err, i;
@ -3075,7 +3042,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
if (aot == AOT_ER_AAC_LD || aot == AOT_ER_AAC_ELD)
samples >>= 1;
ac->frame = data;
ac->frame = frame;
if ((err = frame_configure_elements(avctx)) < 0)
return err;
@ -3091,9 +3058,9 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
chan_config);
return AVERROR_INVALIDDATA;
}
for (i = 0; i < tags_per_config[chan_config]; i++) {
const int elem_type = aac_channel_layout_map[chan_config-1][i][0];
const int elem_id = aac_channel_layout_map[chan_config-1][i][1];
for (i = 0; i < ff_tags_per_config[chan_config]; i++) {
const int elem_type = ff_aac_channel_layout_map[chan_config-1][i][0];
const int elem_id = ff_aac_channel_layout_map[chan_config-1][i][1];
if (!(che=get_che(ac, elem_type, elem_id))) {
av_log(ac->avctx, AV_LOG_ERROR,
"channel element %d.%d is not allocated\n",
@ -3137,7 +3104,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame,
int *got_frame_ptr, GetBitContext *gb,
const AVPacket *avpkt)
{
AACContext *ac = avctx->priv_data;
AACDecContext *ac = avctx->priv_data;
ChannelElement *che = NULL, *che_prev = NULL;
enum RawDataBlockType elem_type, che_prev_type = TYPE_END;
int err, elem_id;
@ -3346,7 +3313,7 @@ fail:
static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
int *got_frame_ptr, AVPacket *avpkt)
{
AACContext *ac = avctx->priv_data;
AACDecContext *ac = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
GetBitContext gb;
@ -3408,7 +3375,7 @@ static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
static av_cold int aac_decode_close(AVCodecContext *avctx)
{
AACContext *ac = avctx->priv_data;
AACDecContext *ac = avctx->priv_data;
int i, type;
for (i = 0; i < MAX_ELEM_ID; i++) {
@ -3431,7 +3398,7 @@ static av_cold int aac_decode_close(AVCodecContext *avctx)
return 0;
}
static void aacdec_init(AACContext *c)
static void aacdec_init(AACDecContext *c)
{
c->imdct_and_windowing = imdct_and_windowing;
c->apply_ltp = apply_ltp;
@ -3453,23 +3420,24 @@ static void aacdec_init(AACContext *c)
* AVOptions for Japanese DTV specific extensions (ADTS only)
*/
#define AACDEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
#define OFF(field) offsetof(AACDecContext, field)
static const AVOption options[] = {
{"dual_mono_mode", "Select the channel to decode for dual mono",
offsetof(AACContext, force_dmono_mode), AV_OPT_TYPE_INT, {.i64=-1}, -1, 2,
AACDEC_FLAGS, "dual_mono_mode"},
OFF(force_dmono_mode), AV_OPT_TYPE_INT, {.i64=-1}, -1, 2,
AACDEC_FLAGS, .unit = "dual_mono_mode"},
{"auto", "autoselection", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"},
{"main", "Select Main/Left channel", 0, AV_OPT_TYPE_CONST, {.i64= 1}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"},
{"sub" , "Select Sub/Right channel", 0, AV_OPT_TYPE_CONST, {.i64= 2}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"},
{"both", "Select both channels", 0, AV_OPT_TYPE_CONST, {.i64= 0}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"},
{"auto", "autoselection", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, AACDEC_FLAGS, .unit = "dual_mono_mode"},
{"main", "Select Main/Left channel", 0, AV_OPT_TYPE_CONST, {.i64= 1}, INT_MIN, INT_MAX, AACDEC_FLAGS, .unit = "dual_mono_mode"},
{"sub" , "Select Sub/Right channel", 0, AV_OPT_TYPE_CONST, {.i64= 2}, INT_MIN, INT_MAX, AACDEC_FLAGS, .unit = "dual_mono_mode"},
{"both", "Select both channels", 0, AV_OPT_TYPE_CONST, {.i64= 0}, INT_MIN, INT_MAX, AACDEC_FLAGS, .unit = "dual_mono_mode"},
{ "channel_order", "Order in which the channels are to be exported",
offsetof(AACContext, output_channel_order), AV_OPT_TYPE_INT,
{ .i64 = CHANNEL_ORDER_DEFAULT }, 0, 1, AACDEC_FLAGS, "channel_order" },
OFF(output_channel_order), AV_OPT_TYPE_INT,
{ .i64 = CHANNEL_ORDER_DEFAULT }, 0, 1, AACDEC_FLAGS, .unit = "channel_order" },
{ "default", "normal libavcodec channel order", 0, AV_OPT_TYPE_CONST,
{ .i64 = CHANNEL_ORDER_DEFAULT }, .flags = AACDEC_FLAGS, "channel_order" },
{ .i64 = CHANNEL_ORDER_DEFAULT }, .flags = AACDEC_FLAGS, .unit = "channel_order" },
{ "coded", "order in which the channels are coded in the bitstream",
0, AV_OPT_TYPE_CONST, { .i64 = CHANNEL_ORDER_CODED }, .flags = AACDEC_FLAGS, "channel_order" },
0, AV_OPT_TYPE_CONST, { .i64 = CHANNEL_ORDER_CODED }, .flags = AACDEC_FLAGS, .unit = "channel_order" },
{NULL},
};

View File

@ -1,7 +1,5 @@
/*
* AAC decoder data
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
*
* This file is part of FFmpeg.
*
@ -30,99 +28,28 @@
#ifndef AVCODEC_AACDECTAB_H
#define AVCODEC_AACDECTAB_H
#include "libavutil/channel_layout.h"
#include "aac.h"
#include <stdint.h>
static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 5, 5, 16, 5, 0 };
#include "vlc.h"
static const uint8_t aac_channel_layout_map[16][16][3] = {
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
{ { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{ { 0, } },
{ { 0, } },
{ { 0, } },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{
{ TYPE_SCE, 0, AAC_CHANNEL_FRONT }, // SCE1 = FC,
{ TYPE_CPE, 0, AAC_CHANNEL_FRONT }, // CPE1 = FLc and FRc,
{ TYPE_CPE, 1, AAC_CHANNEL_FRONT }, // CPE2 = FL and FR,
{ TYPE_CPE, 2, AAC_CHANNEL_BACK }, // CPE3 = SiL and SiR,
{ TYPE_CPE, 3, AAC_CHANNEL_BACK }, // CPE4 = BL and BR,
{ TYPE_SCE, 1, AAC_CHANNEL_BACK }, // SCE2 = BC,
{ TYPE_LFE, 0, AAC_CHANNEL_LFE }, // LFE1 = LFE1,
{ TYPE_LFE, 1, AAC_CHANNEL_LFE }, // LFE2 = LFE2,
{ TYPE_SCE, 2, AAC_CHANNEL_FRONT }, // SCE3 = TpFC,
{ TYPE_CPE, 4, AAC_CHANNEL_FRONT }, // CPE5 = TpFL and TpFR,
{ TYPE_CPE, 5, AAC_CHANNEL_SIDE }, // CPE6 = TpSiL and TpSiR,
{ TYPE_SCE, 3, AAC_CHANNEL_SIDE }, // SCE4 = TpC,
{ TYPE_CPE, 6, AAC_CHANNEL_BACK }, // CPE7 = TpBL and TpBR,
{ TYPE_SCE, 4, AAC_CHANNEL_BACK }, // SCE5 = TpBC,
{ TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC,
{ TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR
},
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, },
{ { 0, } },
};
#include "libavutil/attributes_internal.h"
#include "libavutil/channel_layout.h"
static const int16_t aac_channel_map[3][4][6] = {
{
{ AV_CHAN_FRONT_CENTER, AV_CHAN_FRONT_LEFT_OF_CENTER, AV_CHAN_FRONT_RIGHT_OF_CENTER, AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_NONE },
{ AV_CHAN_UNUSED, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
{ AV_CHAN_UNUSED, AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT, AV_CHAN_BACK_CENTER },
{ AV_CHAN_LOW_FREQUENCY, AV_CHAN_LOW_FREQUENCY_2, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
},
{
{ AV_CHAN_TOP_FRONT_CENTER, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT, AV_CHAN_NONE },
{ AV_CHAN_UNUSED, AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_CENTER},
{ AV_CHAN_UNUSED, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_BACK_LEFT, AV_CHAN_TOP_BACK_RIGHT, AV_CHAN_TOP_BACK_CENTER},
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE},
},
{
{ AV_CHAN_BOTTOM_FRONT_CENTER, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_BOTTOM_FRONT_LEFT, AV_CHAN_BOTTOM_FRONT_RIGHT, AV_CHAN_NONE },
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
},
};
FF_VISIBILITY_PUSH_HIDDEN
void ff_aacdec_common_init_once(void);
#if FF_API_OLD_CHANNEL_LAYOUT
static const uint64_t aac_channel_layout[] = {
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_5POINT0_BACK,
AV_CH_LAYOUT_5POINT1_BACK,
AV_CH_LAYOUT_7POINT1_WIDE_BACK,
AV_CH_LAYOUT_6POINT1_BACK,
AV_CH_LAYOUT_7POINT1,
AV_CH_LAYOUT_22POINT2,
AV_CH_LAYOUT_7POINT1_TOP_BACK,
0,
};
#endif
extern const VLCElem *ff_aac_sbr_vlc[10];
static const AVChannelLayout aac_ch_layout[] = {
AV_CHANNEL_LAYOUT_MONO,
AV_CHANNEL_LAYOUT_STEREO,
AV_CHANNEL_LAYOUT_SURROUND,
AV_CHANNEL_LAYOUT_4POINT0,
AV_CHANNEL_LAYOUT_5POINT0_BACK,
AV_CHANNEL_LAYOUT_5POINT1_BACK,
AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK,
AV_CHANNEL_LAYOUT_6POINT1_BACK,
AV_CHANNEL_LAYOUT_7POINT1,
AV_CHANNEL_LAYOUT_22POINT2,
AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK,
{ 0 },
};
extern VLCElem ff_vlc_scalefactors[];
extern const VLCElem *ff_vlc_spectral[11];
extern const int8_t ff_tags_per_config[16];
extern const uint8_t ff_aac_channel_layout_map[16][16][3];
extern const int16_t ff_aac_channel_map[3][4][6];
extern const AVChannelLayout ff_aac_ch_layout[];
FF_VISIBILITY_POP_HIDDEN
#endif /* AVCODEC_AACDECTAB_H */

View File

@ -1210,9 +1210,6 @@ static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s)
if (!s->fdsp)
return AVERROR(ENOMEM);
// window init
ff_aac_float_common_init();
if ((ret = av_tx_init(&s->mdct1024, &s->mdct1024_fn, AV_TX_FLOAT_MDCT, 0,
1024, &scale, 0)) < 0)
return ret;
@ -1359,6 +1356,9 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
if (s->channels > 3)
s->options.mid_side = 0;
// Initialize static tables
ff_aac_float_common_init();
if ((ret = dsp_init(avctx, s)) < 0)
return ret;
@ -1381,29 +1381,19 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
ff_lpc_init(&s->lpc, 2*avctx->frame_size, TNS_MAX_ORDER, FF_LPC_TYPE_LEVINSON);
s->random_state = 0x1f2e3d4c;
s->abs_pow34 = abs_pow34_v;
s->quant_bands = quantize_bands;
#if ARCH_X86
ff_aac_dsp_init_x86(s);
#endif
#if HAVE_MIPSDSP
ff_aac_coder_init_mips(s);
#endif
ff_aacenc_dsp_init(&s->aacdsp);
ff_af_queue_init(avctx, &s->afq);
ff_aac_tableinit();
return 0;
}
#define AACENC_FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
static const AVOption aacenc_options[] = {
{"aac_coder", "Coding algorithm", offsetof(AACEncContext, options.coder), AV_OPT_TYPE_INT, {.i64 = AAC_CODER_TWOLOOP}, 0, AAC_CODER_NB-1, AACENC_FLAGS, "coder"},
{"anmr", "ANMR method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_ANMR}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"},
{"twoloop", "Two loop searching method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_TWOLOOP}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"},
{"fast", "Default fast search", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_FAST}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"},
{"aac_coder", "Coding algorithm", offsetof(AACEncContext, options.coder), AV_OPT_TYPE_INT, {.i64 = AAC_CODER_TWOLOOP}, 0, AAC_CODER_NB-1, AACENC_FLAGS, .unit = "coder"},
{"anmr", "ANMR method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_ANMR}, INT_MIN, INT_MAX, AACENC_FLAGS, .unit = "coder"},
{"twoloop", "Two loop searching method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_TWOLOOP}, INT_MIN, INT_MAX, AACENC_FLAGS, .unit = "coder"},
{"fast", "Default fast search", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_FAST}, INT_MIN, INT_MAX, AACENC_FLAGS, .unit = "coder"},
{"aac_ms", "Force M/S stereo coding", offsetof(AACEncContext, options.mid_side), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, AACENC_FLAGS},
{"aac_is", "Intensity stereo coding", offsetof(AACEncContext, options.intensity_stereo), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, AACENC_FLAGS},
{"aac_pns", "Perceptual noise substitution", offsetof(AACEncContext, options.pns), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, AACENC_FLAGS},

View File

@ -22,19 +22,25 @@
#ifndef AVCODEC_AACENC_H
#define AVCODEC_AACENC_H
#include <stdint.h>
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/mem_internal.h"
#include "libavutil/tx.h"
#include "avcodec.h"
#include "put_bits.h"
#include "aac.h"
#include "aacencdsp.h"
#include "audio_frame_queue.h"
#include "psymodel.h"
#include "lpc.h"
#define CLIP_AVOIDANCE_FACTOR 0.95f
typedef enum AACCoder {
AAC_CODER_ANMR = 0,
AAC_CODER_TWOLOOP,
@ -54,6 +60,90 @@ typedef struct AACEncOptions {
int intensity_stereo;
} AACEncOptions;
/**
* Long Term Prediction
*/
typedef struct LongTermPrediction {
int8_t present;
int16_t lag;
int coef_idx;
float coef;
int8_t used[MAX_LTP_LONG_SFB];
} LongTermPrediction;
/**
* Individual Channel Stream
*/
typedef struct IndividualChannelStream {
uint8_t max_sfb; ///< number of scalefactor bands per group
enum WindowSequence window_sequence[2];
uint8_t use_kb_window[2]; ///< If set, use Kaiser-Bessel window, otherwise use a sine window.
uint8_t group_len[8];
LongTermPrediction ltp;
const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window
const uint8_t *swb_sizes; ///< table of scalefactor band sizes for a particular window
int num_swb; ///< number of scalefactor window bands
int num_windows;
int tns_max_bands;
int predictor_present;
int predictor_initialized;
int predictor_reset_group;
int predictor_reset_count[31]; ///< used to count prediction resets
uint8_t prediction_used[41];
uint8_t window_clipping[8]; ///< set if a certain window is near clipping
float clip_avoidance_factor; ///< set if any window is near clipping to the necessary atennuation factor to avoid it
} IndividualChannelStream;
/**
* Temporal Noise Shaping
*/
typedef struct TemporalNoiseShaping {
int present;
int n_filt[8];
int length[8][4];
int direction[8][4];
int order[8][4];
int coef_idx[8][4][TNS_MAX_ORDER];
float coef[8][4][TNS_MAX_ORDER];
} TemporalNoiseShaping;
/**
* Single Channel Element - used for both SCE and LFE elements.
*/
typedef struct SingleChannelElement {
IndividualChannelStream ics;
TemporalNoiseShaping tns;
Pulse pulse;
enum BandType band_type[128]; ///< band types
enum BandType band_alt[128]; ///< alternative band type
int sf_idx[128]; ///< scalefactor indices
uint8_t zeroes[128]; ///< band is not coded
uint8_t can_pns[128]; ///< band is allowed to PNS (informative)
float is_ener[128]; ///< Intensity stereo pos
float pns_ener[128]; ///< Noise energy values
DECLARE_ALIGNED(32, float, pcoeffs)[1024]; ///< coefficients for IMDCT, pristine
DECLARE_ALIGNED(32, float, coeffs)[1024]; ///< coefficients for IMDCT, maybe processed
DECLARE_ALIGNED(32, float, ret_buf)[2048]; ///< PCM output buffer
DECLARE_ALIGNED(16, float, ltp_state)[3072]; ///< time signal for LTP
DECLARE_ALIGNED(32, float, lcoeffs)[1024]; ///< MDCT of LTP coefficients
DECLARE_ALIGNED(32, float, prcoeffs)[1024]; ///< Main prediction coefs
PredictorState predictor_state[MAX_PREDICTORS];
} SingleChannelElement;
/**
* channel element - generic struct for SCE/CPE/CCE/LFE
*/
typedef struct ChannelElement {
// CPE specific
int common_window; ///< Set if channels share a common 'IndividualChannelStream' in bitstream.
int ms_mode; ///< Signals mid/side stereo flags coding mode
uint8_t is_mode; ///< Set if any bands have been encoded using intensity stereo
uint8_t ms_mask[128]; ///< Set if mid/side stereo is used for each scalefactor window band
uint8_t is_mask[128]; ///< Set if intensity stereo is used
// shared
SingleChannelElement ch[2];
} ChannelElement;
struct AACEncContext;
typedef struct AACCoefficientsEncoder {
@ -144,18 +234,13 @@ typedef struct AACEncContext {
uint16_t quantize_band_cost_cache_generation;
AACQuantizeBandCostCacheEntry quantize_band_cost_cache[256][128]; ///< memoization area for quantize_band_cost
void (*abs_pow34)(float *out, const float *in, const int size);
void (*quant_bands)(int *out, const float *in, const float *scaled,
int size, int is_signed, int maxval, const float Q34,
const float rounding);
AACEncDSPContext aacdsp;
struct {
float *samples;
} buffer;
} AACEncContext;
void ff_aac_dsp_init_x86(AACEncContext *s);
void ff_aac_coder_init_mips(AACEncContext *c);
void ff_quantize_band_cost_cache_init(struct AACEncContext *s);

View File

@ -59,9 +59,9 @@ struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe,
float minthr = FFMIN(band0->threshold, band1->threshold);
for (i = 0; i < sce0->ics.swb_sizes[g]; i++)
IS[i] = (L[start+(w+w2)*128+i] + phase*R[start+(w+w2)*128+i])*sqrt(ener0/ener01);
s->abs_pow34(L34, &L[start+(w+w2)*128], sce0->ics.swb_sizes[g]);
s->abs_pow34(R34, &R[start+(w+w2)*128], sce0->ics.swb_sizes[g]);
s->abs_pow34(I34, IS, sce0->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(L34, &L[start+(w+w2)*128], sce0->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(R34, &R[start+(w+w2)*128], sce0->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(I34, IS, sce0->ics.swb_sizes[g]);
maxval = find_max_val(1, sce0->ics.swb_sizes[g], I34);
is_band_type = find_min_book(maxval, is_sf_idx);
dist1 += quantize_band_cost(s, &L[start + (w+w2)*128], L34,

View File

@ -92,8 +92,8 @@ static void get_lag(float *buf, const float *new, LongTermPrediction *ltp)
}
}
ltp->lag = FFMAX(av_clip_uintp2(lag, 11), 0);
ltp->coef_idx = quant_array_idx(max_ratio, ltp_coef, 8);
ltp->coef = ltp_coef[ltp->coef_idx];
ltp->coef_idx = quant_array_idx(max_ratio, ff_ltp_coef, 8);
ltp->coef = ff_ltp_coef[ltp->coef_idx];
}
static void generate_samples(float *buf, LongTermPrediction *ltp)
@ -190,8 +190,8 @@ void ff_aac_search_for_ltp(AACEncContext *s, SingleChannelElement *sce,
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
for (i = 0; i < sce->ics.swb_sizes[g]; i++)
PCD[i] = sce->coeffs[start+(w+w2)*128+i] - sce->lcoeffs[start+(w+w2)*128+i];
s->abs_pow34(C34, &sce->coeffs[start+(w+w2)*128], sce->ics.swb_sizes[g]);
s->abs_pow34(PCD34, PCD, sce->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(C34, &sce->coeffs[start+(w+w2)*128], sce->ics.swb_sizes[g]);
s->aacdsp.abs_pow34(PCD34, PCD, sce->ics.swb_sizes[g]);
dist1 += quantize_band_cost(s, &sce->coeffs[start+(w+w2)*128], C34, sce->ics.swb_sizes[g],
sce->sf_idx[(w+w2)*16+g], sce->band_type[(w+w2)*16+g],
s->lambda/band->threshold, INFINITY, &bits_tmp1, NULL);

View File

@ -270,7 +270,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
continue;
/* Normal coefficients */
s->abs_pow34(O34, &sce->coeffs[start_coef], num_coeffs);
s->aacdsp.abs_pow34(O34, &sce->coeffs[start_coef], num_coeffs);
dist1 = ff_quantize_and_encode_band_cost(s, NULL, &sce->coeffs[start_coef], NULL,
O34, num_coeffs, sce->sf_idx[sfb],
cb_n, s->lambda / band->threshold, INFINITY, &cost1, NULL);
@ -279,7 +279,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
/* Encoded coefficients - needed for #bits, band type and quant. error */
for (i = 0; i < num_coeffs; i++)
SENT[i] = sce->coeffs[start_coef + i] - sce->prcoeffs[start_coef + i];
s->abs_pow34(S34, SENT, num_coeffs);
s->aacdsp.abs_pow34(S34, SENT, num_coeffs);
if (cb_n < RESERVED_BT)
cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, S34), sce->sf_idx[sfb]), cb_min, cb_max);
else
@ -291,7 +291,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
/* Reconstructed coefficients - needed for distortion measurements */
for (i = 0; i < num_coeffs; i++)
sce->prcoeffs[start_coef + i] += QERR[i] != 0.0f ? (sce->prcoeffs[start_coef + i] - QERR[i]) : 0.0f;
s->abs_pow34(P34, &sce->prcoeffs[start_coef], num_coeffs);
s->aacdsp.abs_pow34(P34, &sce->prcoeffs[start_coef], num_coeffs);
if (cb_n < RESERVED_BT)
cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, P34), sce->sf_idx[sfb]), cb_min, cb_max);
else

View File

@ -30,6 +30,7 @@
#include "aacenc_tns.h"
#include "aactab.h"
#include "aacenc_utils.h"
#include "lpc_functions.h"
/* Could be set to 3 to save an additional bit at the cost of little quality */
#define TNS_Q_BITS 4
@ -147,7 +148,7 @@ static inline void quantize_coefs(double *coef, int *idx, float *lpc, int order,
int c_bits)
{
int i;
const float *quant_arr = tns_tmp2_map[c_bits];
const float *quant_arr = ff_tns_tmp2_map[c_bits];
for (i = 0; i < order; i++) {
idx[i] = quant_array_idx(coef[i], quant_arr, c_bits ? 16 : 8);
lpc[i] = quant_arr[idx[i]];

View File

@ -29,7 +29,7 @@
#define AVCODEC_AACENC_UTILS_H
#include "libavutil/ffmath.h"
#include "aac.h"
#include "aacenc.h"
#include "aacenctab.h"
#include "aactab.h"
@ -37,15 +37,6 @@
#define ROUND_TO_ZERO 0.1054f
#define C_QUANT 0.4054f
static inline void abs_pow34_v(float *out, const float *in, const int size)
{
int i;
for (i = 0; i < size; i++) {
float a = fabsf(in[i]);
out[i] = sqrtf(a * sqrtf(a));
}
}
static inline float pos_pow34(float a)
{
return sqrtf(a * sqrtf(a));
@ -62,21 +53,6 @@ static inline int quant(float coef, const float Q, const float rounding)
return sqrtf(a * sqrtf(a)) + rounding;
}
static inline void quantize_bands(int *out, const float *in, const float *scaled,
int size, int is_signed, int maxval, const float Q34,
const float rounding)
{
int i;
for (i = 0; i < size; i++) {
float qc = scaled[i] * Q34;
int tmp = (int)FFMIN(qc + rounding, (float)maxval);
if (is_signed && in[i] < 0.0f) {
tmp = -tmp;
}
out[i] = tmp;
}
}
static inline float find_max_val(int group_len, int swb_size, const float *scaled)
{
float maxval = 0.0f;

72
libavcodec/aacencdsp.h Normal file
View File

@ -0,0 +1,72 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_AACENCDSP_H
#define AVCODEC_AACENCDSP_H
#include <math.h>
#include "config.h"
#include "libavutil/macros.h"
typedef struct AACEncDSPContext {
void (*abs_pow34)(float *out, const float *in, const int size);
void (*quant_bands)(int *out, const float *in, const float *scaled,
int size, int is_signed, int maxval, const float Q34,
const float rounding);
} AACEncDSPContext;
void ff_aacenc_dsp_init_riscv(AACEncDSPContext *s);
void ff_aacenc_dsp_init_x86(AACEncDSPContext *s);
static inline void abs_pow34_v(float *out, const float *in, const int size)
{
for (int i = 0; i < size; i++) {
float a = fabsf(in[i]);
out[i] = sqrtf(a * sqrtf(a));
}
}
static inline void quantize_bands(int *out, const float *in, const float *scaled,
int size, int is_signed, int maxval, const float Q34,
const float rounding)
{
for (int i = 0; i < size; i++) {
float qc = scaled[i] * Q34;
int tmp = (int)FFMIN(qc + rounding, (float)maxval);
if (is_signed && in[i] < 0.0f) {
tmp = -tmp;
}
out[i] = tmp;
}
}
static inline void ff_aacenc_dsp_init(AACEncDSPContext *s)
{
s->abs_pow34 = abs_pow34_v;
s->quant_bands = quantize_bands;
#if ARCH_RISCV
ff_aacenc_dsp_init_riscv(s);
#elif ARCH_X86
ff_aacenc_dsp_init_x86(s);
#endif
}
#endif

View File

@ -30,6 +30,7 @@
#include "libavutil/channel_layout.h"
#include "aac.h"
#include "defs.h"
/** Total number of usable codebooks **/
#define CB_TOT 12

View File

@ -26,7 +26,6 @@
#include "libavutil/common.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "aacps.h"
#if USE_FIXED
#include "aacps_fixed_tablegen.h"
@ -717,7 +716,7 @@ static void stereo_processing(PSContext *ps, INTFLOAT (*l)[32][2], INTFLOAT (*r)
}
}
int AAC_RENAME(ff_ps_apply)(AVCodecContext *avctx, PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top)
int AAC_RENAME(ff_ps_apply)(PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top)
{
INTFLOAT (*Lbuf)[32][2] = ps->Lbuf;
INTFLOAT (*Rbuf)[32][2] = ps->Rbuf;
@ -740,10 +739,4 @@ int AAC_RENAME(ff_ps_apply)(AVCodecContext *avctx, PSContext *ps, INTFLOAT L[2][
av_cold void AAC_RENAME(ff_ps_init)(void) {
ps_tableinit();
ff_ps_init_common();
}
av_cold void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps)
{
AAC_RENAME(ff_psdsp_init)(&ps->dsp);
}

View File

@ -27,7 +27,6 @@
#include "libavutil/mem_internal.h"
#include "aacpsdsp.h"
#include "avcodec.h"
#include "get_bits.h"
#define PS_MAX_NUM_ENV 5
@ -94,9 +93,14 @@ extern const int8_t ff_k_to_i_34[];
void ff_ps_init_common(void);
void AAC_RENAME(ff_ps_init)(void);
void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps);
int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb,
static inline void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps)
{
AAC_RENAME(ff_psdsp_init)(&ps->dsp);
}
int ff_ps_read_data(void *logctx, GetBitContext *gb,
PSCommonContext *ps, int bits_left);
int AAC_RENAME(ff_ps_apply)(AVCodecContext *avctx, PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top);
int AAC_RENAME(ff_ps_apply)(PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top);
#endif /* AVCODEC_AACPS_H */

View File

@ -21,7 +21,6 @@
#include <stdint.h>
#include "libavutil/common.h"
#include "libavutil/thread.h"
#include "aacps.h"
#include "get_bits.h"
#include "aacpsdata.c"
@ -59,31 +58,31 @@ static const int huff_iid[] = {
huff_iid_dt1,
};
static VLC vlc_ps[10];
static const VLCElem *vlc_ps[10];
#define READ_PAR_DATA(PAR, OFFSET, MASK, ERR_CONDITION, NB_BITS, MAX_DEPTH) \
#define READ_PAR_DATA(PAR, MASK, ERR_CONDITION, NB_BITS, MAX_DEPTH) \
/** \
* Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \
* Inter-channel Phase Difference/Overall Phase Difference parameters from the \
* bitstream. \
* \
* @param avctx contains the current codec context \
* @param logctx a context for logging \
* @param gb pointer to the input bitstream \
* @param ps pointer to the Parametric Stereo context \
* @param PAR pointer to the parameter to be read \
* @param e envelope to decode \
* @param dt 1: time delta-coded, 0: frequency delta-coded \
*/ \
static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSCommonContext *ps, \
static int read_ ## PAR ## _data(void *logctx, GetBitContext *gb, PSCommonContext *ps, \
int8_t (*PAR)[PS_MAX_NR_IIDICC], int table_idx, int e, int dt) \
{ \
int b, num = ps->nr_ ## PAR ## _par; \
const VLCElem *vlc_table = vlc_ps[table_idx].table; \
const VLCElem *vlc_table = vlc_ps[table_idx]; \
if (dt) { \
int e_prev = e ? e - 1 : ps->num_env_old - 1; \
e_prev = FFMAX(e_prev, 0); \
for (b = 0; b < num; b++) { \
int val = PAR[e_prev][b] + get_vlc2(gb, vlc_table, NB_BITS, MAX_DEPTH) - OFFSET; \
int val = PAR[e_prev][b] + get_vlc2(gb, vlc_table, NB_BITS, MAX_DEPTH); \
if (MASK) val &= MASK; \
PAR[e][b] = val; \
if (ERR_CONDITION) \
@ -92,7 +91,7 @@ static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSCom
} else { \
int val = 0; \
for (b = 0; b < num; b++) { \
val += get_vlc2(gb, vlc_table, NB_BITS, MAX_DEPTH) - OFFSET; \
val += get_vlc2(gb, vlc_table, NB_BITS, MAX_DEPTH); \
if (MASK) val &= MASK; \
PAR[e][b] = val; \
if (ERR_CONDITION) \
@ -101,13 +100,13 @@ static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSCom
} \
return 0; \
err: \
av_log(avctx, AV_LOG_ERROR, "illegal "#PAR"\n"); \
av_log(logctx, AV_LOG_ERROR, "illegal "#PAR"\n"); \
return AVERROR_INVALIDDATA; \
}
READ_PAR_DATA(iid, huff_offset[table_idx], 0, FFABS(ps->iid_par[e][b]) > 7 + 8 * ps->iid_quant, 9, 3)
READ_PAR_DATA(icc, huff_offset[table_idx], 0, ps->icc_par[e][b] > 7U, 9, 2)
READ_PAR_DATA(ipdopd, 0, 0x07, 0, 5, 1)
READ_PAR_DATA(iid, 0, FFABS(ps->iid_par[e][b]) > 7 + 8 * ps->iid_quant, 9, 3)
READ_PAR_DATA(icc, 0, ps->icc_par[e][b] > 7U, 9, 2)
READ_PAR_DATA(ipdopd, 0x07, 0, 5, 1)
static int ps_read_extension_data(GetBitContext *gb, PSCommonContext *ps,
int ps_extension_id)
@ -131,7 +130,7 @@ static int ps_read_extension_data(GetBitContext *gb, PSCommonContext *ps,
return get_bits_count(gb) - count;
}
int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host,
int ff_ps_read_data(void *logctx, GetBitContext *gb_host,
PSCommonContext *ps, int bits_left)
{
int e;
@ -146,7 +145,7 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host,
if (ps->enable_iid) {
int iid_mode = get_bits(gb, 3);
if (iid_mode > 5) {
av_log(avctx, AV_LOG_ERROR, "iid_mode %d is reserved.\n",
av_log(logctx, AV_LOG_ERROR, "iid_mode %d is reserved.\n",
iid_mode);
goto err;
}
@ -158,7 +157,7 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host,
if (ps->enable_icc) {
ps->icc_mode = get_bits(gb, 3);
if (ps->icc_mode > 5) {
av_log(avctx, AV_LOG_ERROR, "icc_mode %d is reserved.\n",
av_log(logctx, AV_LOG_ERROR, "icc_mode %d is reserved.\n",
ps->icc_mode);
goto err;
}
@ -176,7 +175,7 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host,
for (e = 1; e <= ps->num_env; e++) {
ps->border_position[e] = get_bits(gb, 5);
if (ps->border_position[e] < ps->border_position[e-1]) {
av_log(avctx, AV_LOG_ERROR, "border_position non monotone.\n");
av_log(logctx, AV_LOG_ERROR, "border_position non monotone.\n");
goto err;
}
}
@ -187,7 +186,7 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host,
if (ps->enable_iid) {
for (e = 0; e < ps->num_env; e++) {
int dt = get_bits1(gb);
if (read_iid_data(avctx, gb, ps, ps->iid_par, huff_iid[2*dt+ps->iid_quant], e, dt))
if (read_iid_data(logctx, gb, ps, ps->iid_par, huff_iid[2*dt+ps->iid_quant], e, dt))
goto err;
}
} else
@ -196,7 +195,7 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host,
if (ps->enable_icc)
for (e = 0; e < ps->num_env; e++) {
int dt = get_bits1(gb);
if (read_icc_data(avctx, gb, ps, ps->icc_par, dt ? huff_icc_dt : huff_icc_df, e, dt))
if (read_icc_data(logctx, gb, ps, ps->icc_par, dt ? huff_icc_dt : huff_icc_df, e, dt))
goto err;
}
else
@ -213,7 +212,7 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host,
cnt -= 2 + ps_read_extension_data(gb, ps, ps_extension_id);
}
if (cnt < 0) {
av_log(avctx, AV_LOG_ERROR, "ps extension overflow %d\n", cnt);
av_log(logctx, AV_LOG_ERROR, "ps extension overflow %d\n", cnt);
goto err;
}
skip_bits(gb, cnt);
@ -241,7 +240,7 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host,
if (ps->enable_iid){
for (b = 0; b < ps->nr_iid_par; b++) {
if (FFABS(ps->iid_par[ps->num_env][b]) > 7 + 8 * ps->iid_quant) {
av_log(avctx, AV_LOG_ERROR, "iid_par invalid\n");
av_log(logctx, AV_LOG_ERROR, "iid_par invalid\n");
goto err;
}
}
@ -249,7 +248,7 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host,
if (ps->enable_icc){
for (b = 0; b < ps->nr_iid_par; b++) {
if (ps->icc_par[ps->num_env][b] > 7U) {
av_log(avctx, AV_LOG_ERROR, "icc_par invalid\n");
av_log(logctx, AV_LOG_ERROR, "icc_par invalid\n");
goto err;
}
}
@ -278,7 +277,7 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host,
skip_bits_long(gb_host, bits_consumed);
return bits_consumed;
}
av_log(avctx, AV_LOG_ERROR, "Expected to read %d PS bits actually read %d.\n", bits_left, bits_consumed);
av_log(logctx, AV_LOG_ERROR, "Expected to read %d PS bits actually read %d.\n", bits_left, bits_consumed);
err:
ps->start = 0;
skip_bits_long(gb_host, bits_left);
@ -289,48 +288,19 @@ err:
return bits_left;
}
#define PS_INIT_VLC_STATIC(num, nb_bits, size) \
VLC_INIT_STATIC(&vlc_ps[num], nb_bits, ps_tmp[num].table_size / ps_tmp[num].elem_size, \
ps_tmp[num].ps_bits, 1, 1, \
ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, \
size);
#define PS_VLC_ROW(name) \
{ name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
static av_cold void ps_init_common(void)
{
// Syntax initialization
static const struct {
const void *ps_codes, *ps_bits;
const unsigned int table_size, elem_size;
} ps_tmp[] = {
PS_VLC_ROW(huff_iid_df1),
PS_VLC_ROW(huff_iid_dt1),
PS_VLC_ROW(huff_iid_df0),
PS_VLC_ROW(huff_iid_dt0),
PS_VLC_ROW(huff_icc_df),
PS_VLC_ROW(huff_icc_dt),
PS_VLC_ROW(huff_ipd_df),
PS_VLC_ROW(huff_ipd_dt),
PS_VLC_ROW(huff_opd_df),
PS_VLC_ROW(huff_opd_dt),
};
PS_INIT_VLC_STATIC(0, 9, 1544);
PS_INIT_VLC_STATIC(1, 9, 832);
PS_INIT_VLC_STATIC(2, 9, 1024);
PS_INIT_VLC_STATIC(3, 9, 1036);
PS_INIT_VLC_STATIC(4, 9, 544);
PS_INIT_VLC_STATIC(5, 9, 544);
PS_INIT_VLC_STATIC(6, 5, 32);
PS_INIT_VLC_STATIC(7, 5, 32);
PS_INIT_VLC_STATIC(8, 5, 32);
PS_INIT_VLC_STATIC(9, 5, 32);
}
av_cold void ff_ps_init_common(void)
{
static AVOnce init_static_once = AV_ONCE_INIT;
ff_thread_once(&init_static_once, ps_init_common);
static VLCElem vlc_buf[(1544 + 832 + 1024 + 1036) +
(544 + 544) + (32 + 32 + 32 + 32)];
VLCInitState state = VLC_INIT_STATE(vlc_buf);
const uint8_t (*tab)[2] = aacps_huff_tabs;
for (int i = 0; i < FF_ARRAY_ELEMS(vlc_ps); i++) {
vlc_ps[i] =
ff_vlc_init_tables_from_lengths(&state, i <= 5 ? 9 : 5, huff_sizes[i],
&tab[0][1], 2,
&tab[0][0], 2, 1,
huff_offset[i], 0);
tab += huff_sizes[i];
}
}

View File

@ -19,124 +19,79 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
static const uint8_t huff_iid_df1_bits[] = {
18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 18, 17, 17, 16, 16, 15, 14, 14,
13, 12, 12, 11, 10, 10, 8, 7, 6, 5, 4, 3, 1, 3, 4, 5, 6, 7,
8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 16, 17, 17, 18, 17, 18, 18,
18, 18, 18, 18, 18, 18, 18,
};
#include <stdint.h>
static const uint32_t huff_iid_df1_codes[] = {
0x01FEB4, 0x01FEB5, 0x01FD76, 0x01FD77, 0x01FD74, 0x01FD75, 0x01FE8A,
0x01FE8B, 0x01FE88, 0x00FE80, 0x01FEB6, 0x00FE82, 0x00FEB8, 0x007F42,
0x007FAE, 0x003FAF, 0x001FD1, 0x001FE9, 0x000FE9, 0x0007EA, 0x0007FB,
0x0003FB, 0x0001FB, 0x0001FF, 0x00007C, 0x00003C, 0x00001C, 0x00000C,
0x000000, 0x000001, 0x000001, 0x000002, 0x000001, 0x00000D, 0x00001D,
0x00003D, 0x00007D, 0x0000FC, 0x0001FC, 0x0003FC, 0x0003F4, 0x0007EB,
0x000FEA, 0x001FEA, 0x001FD6, 0x003FD0, 0x007FAF, 0x007F43, 0x00FEB9,
0x00FE83, 0x01FEB7, 0x00FE81, 0x01FE89, 0x01FE8E, 0x01FE8F, 0x01FE8C,
0x01FE8D, 0x01FEB2, 0x01FEB3, 0x01FEB0, 0x01FEB1,
};
static const uint8_t huff_sizes[] = { 61, 61, 29, 29, 15, 15, 8, 8, 8, 8 };
static const uint8_t huff_iid_dt1_bits[] = {
16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 14, 14, 13,
13, 13, 12, 12, 11, 10, 9, 9, 7, 6, 5, 3, 1, 2, 5, 6, 7, 8,
9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16,
};
static const uint16_t huff_iid_dt1_codes[] = {
0x004ED4, 0x004ED5, 0x004ECE, 0x004ECF, 0x004ECC, 0x004ED6, 0x004ED8,
0x004F46, 0x004F60, 0x002718, 0x002719, 0x002764, 0x002765, 0x00276D,
0x0027B1, 0x0013B7, 0x0013D6, 0x0009C7, 0x0009E9, 0x0009ED, 0x0004EE,
0x0004F7, 0x000278, 0x000139, 0x00009A, 0x00009F, 0x000020, 0x000011,
0x00000A, 0x000003, 0x000001, 0x000000, 0x00000B, 0x000012, 0x000021,
0x00004C, 0x00009B, 0x00013A, 0x000279, 0x000270, 0x0004EF, 0x0004E2,
0x0009EA, 0x0009D8, 0x0013D7, 0x0013D0, 0x0027B2, 0x0027A2, 0x00271A,
0x00271B, 0x004F66, 0x004F67, 0x004F61, 0x004F47, 0x004ED9, 0x004ED7,
0x004ECD, 0x004ED2, 0x004ED3, 0x004ED0, 0x004ED1,
};
static const uint8_t huff_iid_df0_bits[] = {
17, 17, 17, 17, 16, 15, 13, 10, 9, 7, 6, 5, 4, 3, 1, 3, 4, 5,
6, 6, 8, 11, 13, 14, 14, 15, 17, 18, 18,
};
static const uint32_t huff_iid_df0_codes[] = {
0x01FFFB, 0x01FFFC, 0x01FFFD, 0x01FFFA, 0x00FFFC, 0x007FFC, 0x001FFD,
0x0003FE, 0x0001FE, 0x00007E, 0x00003C, 0x00001D, 0x00000D, 0x000005,
0x000000, 0x000004, 0x00000C, 0x00001C, 0x00003D, 0x00003E, 0x0000FE,
0x0007FE, 0x001FFC, 0x003FFC, 0x003FFD, 0x007FFD, 0x01FFFE, 0x03FFFE,
0x03FFFF,
};
static const uint8_t huff_iid_dt0_bits[] = {
19, 19, 19, 20, 20, 20, 17, 15, 12, 10, 8, 6, 4, 2, 1, 3, 5, 7,
9, 11, 13, 14, 17, 19, 20, 20, 20, 20, 20,
};
static const uint32_t huff_iid_dt0_codes[] = {
0x07FFF9, 0x07FFFA, 0x07FFFB, 0x0FFFF8, 0x0FFFF9, 0x0FFFFA, 0x01FFFD,
0x007FFE, 0x000FFE, 0x0003FE, 0x0000FE, 0x00003E, 0x00000E, 0x000002,
0x000000, 0x000006, 0x00001E, 0x00007E, 0x0001FE, 0x0007FE, 0x001FFE,
0x003FFE, 0x01FFFC, 0x07FFF8, 0x0FFFFB, 0x0FFFFC, 0x0FFFFD, 0x0FFFFE,
0x0FFFFF,
};
static const uint8_t huff_icc_df_bits[] = {
14, 14, 12, 10, 7, 5, 3, 1, 2, 4, 6, 8, 9, 11, 13,
};
static const uint16_t huff_icc_df_codes[] = {
0x3FFF, 0x3FFE, 0x0FFE, 0x03FE, 0x007E, 0x001E, 0x0006, 0x0000,
0x0002, 0x000E, 0x003E, 0x00FE, 0x01FE, 0x07FE, 0x1FFE,
};
static const uint8_t huff_icc_dt_bits[] = {
14, 13, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 10, 12, 14,
};
static const uint16_t huff_icc_dt_codes[] = {
0x3FFE, 0x1FFE, 0x07FE, 0x01FE, 0x007E, 0x001E, 0x0006, 0x0000,
0x0002, 0x000E, 0x003E, 0x00FE, 0x03FE, 0x0FFE, 0x3FFF,
};
static const uint8_t huff_ipd_df_bits[] = {
1, 3, 4, 4, 4, 4, 4, 4,
};
static const uint8_t huff_ipd_df_codes[] = {
0x01, 0x00, 0x06, 0x04, 0x02, 0x03, 0x05, 0x07,
};
static const uint8_t huff_ipd_dt_bits[] = {
1, 3, 4, 5, 5, 4, 4, 3,
};
static const uint8_t huff_ipd_dt_codes[] = {
0x01, 0x02, 0x02, 0x03, 0x02, 0x00, 0x03, 0x03,
};
static const uint8_t huff_opd_df_bits[] = {
1, 3, 4, 4, 5, 5, 4, 3,
};
static const uint8_t huff_opd_df_codes[] = {
0x01, 0x01, 0x06, 0x04, 0x0F, 0x0E, 0x05, 0x00,
};
static const uint8_t huff_opd_dt_bits[] = {
1, 3, 4, 5, 5, 4, 4, 3,
};
static const uint8_t huff_opd_dt_codes[] = {
0x01, 0x02, 0x01, 0x07, 0x06, 0x00, 0x02, 0x03,
static const uint8_t aacps_huff_tabs[][2] = {
/* huff_iid_df1 - 61 entries */
{ 28, 4 }, { 32, 4 }, { 29, 3 }, { 31, 3 }, { 27, 5 },
{ 33, 5 }, { 26, 6 }, { 34, 6 }, { 25, 7 }, { 35, 7 },
{ 24, 8 }, { 36, 8 }, { 37, 9 }, { 40, 11 }, { 19, 12 },
{ 41, 12 }, { 22, 10 }, { 38, 10 }, { 9, 17 }, { 51, 17 },
{ 11, 17 }, { 49, 17 }, { 13, 16 }, { 47, 16 }, { 16, 14 },
{ 18, 13 }, { 42, 13 }, { 44, 14 }, { 12, 17 }, { 48, 17 },
{ 4, 18 }, { 5, 18 }, { 2, 18 }, { 3, 18 }, { 15, 15 },
{ 21, 11 }, { 39, 11 }, { 45, 15 }, { 8, 18 }, { 52, 18 },
{ 6, 18 }, { 7, 18 }, { 55, 18 }, { 56, 18 }, { 53, 18 },
{ 54, 18 }, { 17, 14 }, { 43, 14 }, { 59, 18 }, { 60, 18 },
{ 57, 18 }, { 58, 18 }, { 0, 18 }, { 1, 18 }, { 10, 18 },
{ 50, 18 }, { 14, 16 }, { 46, 16 }, { 20, 12 }, { 23, 10 },
{ 30, 1 },
/* huff_iid_dt1 - 61 entries */
{ 31, 2 }, { 26, 7 }, { 34, 7 }, { 27, 6 }, { 33, 6 },
{ 35, 8 }, { 24, 9 }, { 36, 9 }, { 39, 11 }, { 41, 12 },
{ 9, 15 }, { 10, 15 }, { 48, 15 }, { 49, 15 }, { 17, 13 },
{ 23, 10 }, { 37, 10 }, { 43, 13 }, { 11, 15 }, { 12, 15 },
{ 4, 16 }, { 56, 16 }, { 2, 16 }, { 3, 16 }, { 59, 16 },
{ 60, 16 }, { 57, 16 }, { 58, 16 }, { 0, 16 }, { 1, 16 },
{ 5, 16 }, { 55, 16 }, { 6, 16 }, { 54, 16 }, { 13, 15 },
{ 15, 14 }, { 20, 12 }, { 40, 12 }, { 22, 11 }, { 38, 11 },
{ 45, 14 }, { 47, 15 }, { 7, 16 }, { 53, 16 }, { 18, 13 },
{ 42, 13 }, { 16, 14 }, { 44, 14 }, { 8, 16 }, { 52, 16 },
{ 14, 15 }, { 46, 15 }, { 50, 16 }, { 51, 16 }, { 19, 13 },
{ 21, 12 }, { 25, 9 }, { 28, 5 }, { 32, 5 }, { 29, 3 },
{ 30, 1 },
/* huff_iid_df0 - 29 entries */
{ 14, 1 }, { 15, 3 }, { 13, 3 }, { 16, 4 }, { 12, 4 },
{ 17, 5 }, { 11, 5 }, { 10, 6 }, { 18, 6 }, { 19, 6 },
{ 9, 7 }, { 20, 8 }, { 8, 9 }, { 7, 10 }, { 21, 11 },
{ 22, 13 }, { 6, 13 }, { 23, 14 }, { 24, 14 }, { 5, 15 },
{ 25, 15 }, { 4, 16 }, { 3, 17 }, { 0, 17 }, { 1, 17 },
{ 2, 17 }, { 26, 17 }, { 27, 18 }, { 28, 18 },
/* huff_iid_dt0 - 29 entries */
{ 14, 1 }, { 13, 2 }, { 15, 3 }, { 12, 4 }, { 16, 5 },
{ 11, 6 }, { 17, 7 }, { 10, 8 }, { 18, 9 }, { 9, 10 },
{ 19, 11 }, { 8, 12 }, { 20, 13 }, { 21, 14 }, { 7, 15 },
{ 22, 17 }, { 6, 17 }, { 23, 19 }, { 0, 19 }, { 1, 19 },
{ 2, 19 }, { 3, 20 }, { 4, 20 }, { 5, 20 }, { 24, 20 },
{ 25, 20 }, { 26, 20 }, { 27, 20 }, { 28, 20 },
/* huff_icc_df - 15 entries */
{ 7, 1 }, { 8, 2 }, { 6, 3 }, { 9, 4 }, { 5, 5 },
{ 10, 6 }, { 4, 7 }, { 11, 8 }, { 12, 9 }, { 3, 10 },
{ 13, 11 }, { 2, 12 }, { 14, 13 }, { 1, 14 }, { 0, 14 },
/* huff_icc_dt - 15 entries */
{ 7, 1 }, { 8, 2 }, { 6, 3 }, { 9, 4 }, { 5, 5 },
{ 10, 6 }, { 4, 7 }, { 11, 8 }, { 3, 9 }, { 12, 10 },
{ 2, 11 }, { 13, 12 }, { 1, 13 }, { 0, 14 }, { 14, 14 },
/* huff_ipd_df - 8 entries */
{ 1, 3 }, { 4, 4 }, { 5, 4 }, { 3, 4 }, { 6, 4 },
{ 2, 4 }, { 7, 4 }, { 0, 1 },
/* huff_ipd_dt - 8 entries */
{ 5, 4 }, { 4, 5 }, { 3, 5 }, { 2, 4 }, { 6, 4 },
{ 1, 3 }, { 7, 3 }, { 0, 1 },
/* huff_opd_df - 8 entries */
{ 7, 3 }, { 1, 3 }, { 3, 4 }, { 6, 4 }, { 2, 4 },
{ 5, 5 }, { 4, 5 }, { 0, 1 },
/* huff_opd_dt - 8 entries */
{ 5, 4 }, { 2, 4 }, { 6, 4 }, { 4, 5 }, { 3, 5 },
{ 1, 3 }, { 7, 3 }, { 0, 1 },
};
static const int8_t huff_offset[] = {
30, 30,
14, 14,
7, 7,
-30, -30,
-14, -14,
-7, -7,
0, 0,
0, 0,
};

View File

@ -26,14 +26,14 @@
#include "libavutil/attributes.h"
#include "aacpsdsp.h"
static void ps_add_squares_c(INTFLOAT *av_restrict dst,
static void ps_add_squares_c(INTFLOAT *restrict dst,
const INTFLOAT (*src)[2], int n)
{
for (int i = 0; i < n; i++)
dst[i] += (UINTFLOAT)AAC_MADD28(src[i][0], src[i][0], src[i][1], src[i][1]);
}
static void ps_mul_pair_single_c(INTFLOAT (*av_restrict dst)[2],
static void ps_mul_pair_single_c(INTFLOAT (*restrict dst)[2],
INTFLOAT (*src0)[2], INTFLOAT *src1,
int n)
{
@ -43,7 +43,7 @@ static void ps_mul_pair_single_c(INTFLOAT (*av_restrict dst)[2],
}
}
static void ps_hybrid_analysis_c(INTFLOAT (*av_restrict out)[2],
static void ps_hybrid_analysis_c(INTFLOAT (*restrict out)[2],
INTFLOAT (*in)[2],
const INTFLOAT (*filter)[8][2],
ptrdiff_t stride, int n)
@ -77,7 +77,7 @@ static void ps_hybrid_analysis_c(INTFLOAT (*av_restrict out)[2],
}
}
static void ps_hybrid_analysis_ileave_c(INTFLOAT (*av_restrict out)[32][2],
static void ps_hybrid_analysis_ileave_c(INTFLOAT (*restrict out)[32][2],
INTFLOAT L[2][38][64],
int i, int len)
{
@ -90,7 +90,7 @@ static void ps_hybrid_analysis_ileave_c(INTFLOAT (*av_restrict out)[32][2],
}
static void ps_hybrid_synthesis_deint_c(INTFLOAT out[2][38][64],
INTFLOAT (*av_restrict in)[32][2],
INTFLOAT (*restrict in)[32][2],
int i, int len)
{
for (; i < 64; i++) {

View File

@ -28,7 +28,7 @@
#include "libavutil/ffmath.h"
#include "avcodec.h"
#include "aactab.h"
#include "aac.h"
#include "psymodel.h"
/***********************************

View File

@ -31,10 +31,10 @@
#include "sbr.h"
#include "aacsbr.h"
#include "aacsbrdata.h"
#include "internal.h"
#include "aacps.h"
#include "sbrdsp.h"
#include "libavutil/internal.h"
#include "libavutil/intfloat.h"
#include "libavutil/libm.h"
#include "libavutil/avassert.h"
#include "libavutil/mem_internal.h"
@ -47,7 +47,25 @@
#include "mips/aacsbr_mips.h"
#endif /* ARCH_MIPS */
static VLC vlc_sbr[10];
/**
* 2^(x) for integer x
* @return correctly rounded float
*/
static av_always_inline float exp2fi(int x) {
/* Normal range */
if (-126 <= x && x <= 128)
return av_int2float((x+127) << 23);
/* Too large */
else if (x > 128)
return INFINITY;
/* Subnormal numbers */
else if (x > -150)
return av_int2float(1 << (x+149));
/* Negligibly small */
else
return 0;
}
static void aacsbr_func_ptr_init(AACSBRContext *c);
static void make_bands(int16_t* bands, int start, int stop, int num_bands)
@ -80,13 +98,13 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) {
float temp1, temp2, fac;
if (sbr->data[0].bs_amp_res) {
temp1 = ff_exp2fi(sbr->data[0].env_facs_q[e][k] + 7);
temp2 = ff_exp2fi(pan_offset - sbr->data[1].env_facs_q[e][k]);
temp1 = exp2fi(sbr->data[0].env_facs_q[e][k] + 7);
temp2 = exp2fi(pan_offset - sbr->data[1].env_facs_q[e][k]);
}
else {
temp1 = ff_exp2fi((sbr->data[0].env_facs_q[e][k]>>1) + 7) *
temp1 = exp2fi((sbr->data[0].env_facs_q[e][k]>>1) + 7) *
exp2_tab[sbr->data[0].env_facs_q[e][k] & 1];
temp2 = ff_exp2fi((pan_offset - sbr->data[1].env_facs_q[e][k])>>1) *
temp2 = exp2fi((pan_offset - sbr->data[1].env_facs_q[e][k])>>1) *
exp2_tab[(pan_offset - sbr->data[1].env_facs_q[e][k]) & 1];
}
if (temp1 > 1E20) {
@ -100,8 +118,8 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
}
for (e = 1; e <= sbr->data[0].bs_num_noise; e++) {
for (k = 0; k < sbr->n_q; k++) {
float temp1 = ff_exp2fi(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs_q[e][k] + 1);
float temp2 = ff_exp2fi(12 - sbr->data[1].noise_facs_q[e][k]);
float temp1 = exp2fi(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs_q[e][k] + 1);
float temp2 = exp2fi(12 - sbr->data[1].noise_facs_q[e][k]);
float fac;
av_assert0(temp1 <= 1E20);
fac = temp1 / (1.0f + temp2);
@ -114,9 +132,9 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
for (e = 1; e <= sbr->data[ch].bs_num_env; e++)
for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){
if (sbr->data[ch].bs_amp_res)
sbr->data[ch].env_facs[e][k] = ff_exp2fi(sbr->data[ch].env_facs_q[e][k] + 6);
sbr->data[ch].env_facs[e][k] = exp2fi(sbr->data[ch].env_facs_q[e][k] + 6);
else
sbr->data[ch].env_facs[e][k] = ff_exp2fi((sbr->data[ch].env_facs_q[e][k]>>1) + 6)
sbr->data[ch].env_facs[e][k] = exp2fi((sbr->data[ch].env_facs_q[e][k]>>1) + 6)
* exp2_tab[sbr->data[ch].env_facs_q[e][k] & 1];
if (sbr->data[ch].env_facs[e][k] > 1E20) {
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
@ -127,7 +145,7 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
for (e = 1; e <= sbr->data[ch].bs_num_noise; e++)
for (k = 0; k < sbr->n_q; k++)
sbr->data[ch].noise_facs[e][k] =
ff_exp2fi(NOISE_FLOOR_OFFSET - sbr->data[ch].noise_facs_q[e][k]);
exp2fi(NOISE_FLOOR_OFFSET - sbr->data[ch].noise_facs_q[e][k]);
}
}
}
@ -215,7 +233,7 @@ static void sbr_chirp(SpectralBandReplication *sbr, SBRData *ch_data)
* Calculation of levels of additional HF signal components (14496-3 sp04 p219)
* and Calculation of gain (14496-3 sp04 p219)
*/
static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
static void sbr_gain_calc(SpectralBandReplication *sbr,
SBRData *ch_data, const int e_a[2])
{
int e, k, m;

View File

@ -30,12 +30,14 @@
#define AVCODEC_AACSBR_H
#include "get_bits.h"
#include "aac.h"
#include "aac_defines.h"
#include "sbr.h"
#define ENVELOPE_ADJUSTMENT_OFFSET 2
#define NOISE_FLOOR_OFFSET 6
struct AACDecContext;
/**
* SBR VLC tables
*/
@ -66,29 +68,17 @@ enum {
EXTENSION_ID_PS = 2,
};
static const int8_t vlc_sbr_lav[10] =
{ 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 };
#define SBR_INIT_VLC_STATIC(num, size) \
VLC_INIT_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \
sbr_tmp[num].sbr_bits , 1, 1, \
sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \
size)
#define SBR_VLC_ROW(name) \
{ name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
/** Initialize SBR. */
void AAC_RENAME(ff_aac_sbr_init)(void);
/** Initialize one SBR context. */
int AAC_RENAME(ff_aac_sbr_ctx_init)(AACContext *ac, SpectralBandReplication *sbr, int id_aac);
int AAC_RENAME(ff_aac_sbr_ctx_init)(struct AACDecContext *ac, SpectralBandReplication *sbr, int id_aac);
/** Close one SBR context. */
void AAC_RENAME(ff_aac_sbr_ctx_close)(SpectralBandReplication *sbr);
/** Decode one SBR element. */
int AAC_RENAME(ff_decode_sbr_extension)(AACContext *ac, SpectralBandReplication *sbr,
int AAC_RENAME(ff_decode_sbr_extension)(struct AACDecContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb, int crc, int cnt, int id_aac);
/** Apply one SBR element to one AAC element. */
void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
void AAC_RENAME(ff_sbr_apply)(struct AACDecContext *ac, SpectralBandReplication *sbr, int id_aac,
INTFLOAT* L, INTFLOAT *R);
void ff_aacsbr_func_ptr_init_mips(AACSBRContext *c);

View File

@ -70,7 +70,6 @@
#include <float.h>
#include <math.h>
static VLC vlc_sbr[10];
static void aacsbr_func_ptr_init(AACSBRContext *c);
static const int CONST_LN2 = Q31(0.6931471806/256); // ln(2)/256
static const int CONST_RECIP_LN2 = Q31(0.7213475204); // 0.5/ln(2)
@ -395,7 +394,7 @@ static void sbr_chirp(SpectralBandReplication *sbr, SBRData *ch_data)
* Calculation of levels of additional HF signal components (14496-3 sp04 p219)
* and Calculation of gain (14496-3 sp04 p219)
*/
static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
static void sbr_gain_calc(SpectralBandReplication *sbr,
SBRData *ch_data, const int e_a[2])
{
int e, k, m;

View File

@ -32,6 +32,9 @@
* @author Zoran Basaric ( zoran.basaric@imgtec.com )
*/
#include "aacdec.h"
#include "aacdectab.h"
#include "avcodec.h"
#include "libavutil/qsort.h"
static av_cold void aacsbr_tableinit(void)
@ -44,34 +47,6 @@ static av_cold void aacsbr_tableinit(void)
av_cold void AAC_RENAME(ff_aac_sbr_init)(void)
{
static const struct {
const void *sbr_codes, *sbr_bits;
const unsigned int table_size, elem_size;
} sbr_tmp[] = {
SBR_VLC_ROW(t_huffman_env_1_5dB),
SBR_VLC_ROW(f_huffman_env_1_5dB),
SBR_VLC_ROW(t_huffman_env_bal_1_5dB),
SBR_VLC_ROW(f_huffman_env_bal_1_5dB),
SBR_VLC_ROW(t_huffman_env_3_0dB),
SBR_VLC_ROW(f_huffman_env_3_0dB),
SBR_VLC_ROW(t_huffman_env_bal_3_0dB),
SBR_VLC_ROW(f_huffman_env_bal_3_0dB),
SBR_VLC_ROW(t_huffman_noise_3_0dB),
SBR_VLC_ROW(t_huffman_noise_bal_3_0dB),
};
// SBR VLC table initialization
SBR_INIT_VLC_STATIC(0, 1098);
SBR_INIT_VLC_STATIC(1, 1092);
SBR_INIT_VLC_STATIC(2, 768);
SBR_INIT_VLC_STATIC(3, 1026);
SBR_INIT_VLC_STATIC(4, 1058);
SBR_INIT_VLC_STATIC(5, 1052);
SBR_INIT_VLC_STATIC(6, 544);
SBR_INIT_VLC_STATIC(7, 544);
SBR_INIT_VLC_STATIC(8, 592);
SBR_INIT_VLC_STATIC(9, 512);
aacsbr_tableinit();
AAC_RENAME(ff_ps_init)();
@ -89,7 +64,7 @@ static void sbr_turnoff(SpectralBandReplication *sbr) {
memset(&sbr->spectrum_params, -1, sizeof(SpectrumParameters));
}
av_cold int AAC_RENAME(ff_aac_sbr_ctx_init)(AACContext *ac, SpectralBandReplication *sbr, int id_aac)
av_cold int AAC_RENAME(ff_aac_sbr_ctx_init)(AACDecContext *ac, SpectralBandReplication *sbr, int id_aac)
{
int ret;
float scale;
@ -279,7 +254,7 @@ static int check_n_master(AVCodecContext *avctx, int n_master, int bs_xover_band
}
/// Master Frequency Band Table (14496-3 sp04 p194)
static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
SpectrumParameters *spectrum)
{
unsigned int temp, max_qmf_subbands = 0;
@ -499,7 +474,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
}
/// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46)
static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
static int sbr_hf_calc_npatches(AACDecContext *ac, SpectralBandReplication *sbr)
{
int i, k, last_k = -1, last_msb = -1, sb = 0;
int msb = sbr->k[0];
@ -557,7 +532,7 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
}
/// Derived Frequency Band Tables (14496-3 sp04 p197)
static int sbr_make_f_derived(AACContext *ac, SpectralBandReplication *sbr)
static int sbr_make_f_derived(AACDecContext *ac, SpectralBandReplication *sbr)
{
int k, temp;
#if USE_FIXED
@ -642,7 +617,7 @@ static const int8_t ceil_log2[] = {
0, 1, 2, 2, 3, 3,
};
static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
static int read_sbr_grid(AACDecContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb, SBRData *ch_data)
{
int i;
@ -825,43 +800,34 @@ static void read_sbr_invf(SpectralBandReplication *sbr, GetBitContext *gb,
ch_data->bs_invf_mode[0][i] = get_bits(gb, 2);
}
static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
static int read_sbr_envelope(AACDecContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
SBRData *ch_data, int ch)
{
int bits;
int i, j, k;
const VLCElem *t_huff, *f_huff;
int t_lav, f_lav;
const int delta = (ch == 1 && sbr->bs_coupling == 1) + 1;
const int odd = sbr->n[1] & 1;
if (sbr->bs_coupling && ch) {
if (ch_data->bs_amp_res) {
bits = 5;
t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_3_0DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_3_0DB];
f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_BAL_3_0DB];
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_3_0DB];
} else {
bits = 6;
t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_1_5DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_1_5DB];
f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_1_5DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_1_5DB];
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_BAL_1_5DB];
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_1_5DB];
}
} else {
if (ch_data->bs_amp_res) {
bits = 6;
t_huff = vlc_sbr[T_HUFFMAN_ENV_3_0DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_3_0DB];
f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_3_0DB];
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_3_0DB];
} else {
bits = 7;
t_huff = vlc_sbr[T_HUFFMAN_ENV_1_5DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_1_5DB];
f_huff = vlc_sbr[F_HUFFMAN_ENV_1_5DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_1_5DB];
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_1_5DB];
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_1_5DB];
}
}
@ -870,7 +836,7 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
// bs_freq_res[0] == bs_freq_res[bs_num_env] from prev frame
if (ch_data->bs_freq_res[i + 1] == ch_data->bs_freq_res[i]) {
for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][j] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][j] + delta * get_vlc2(gb, t_huff, 9, 3);
if (ch_data->env_facs_q[i + 1][j] > 127U) {
av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
@ -879,7 +845,7 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
} else if (ch_data->bs_freq_res[i + 1]) {
for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
k = (j + odd) >> 1; // find k such that f_tablelow[k] <= f_tablehigh[j] < f_tablelow[k + 1]
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * get_vlc2(gb, t_huff, 9, 3);
if (ch_data->env_facs_q[i + 1][j] > 127U) {
av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
@ -888,7 +854,7 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
} else {
for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
k = j ? 2*j - odd : 0; // find k such that f_tablehigh[k] == f_tablelow[j]
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * get_vlc2(gb, t_huff, 9, 3);
if (ch_data->env_facs_q[i + 1][j] > 127U) {
av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
@ -898,7 +864,7 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
} else {
ch_data->env_facs_q[i + 1][0] = delta * get_bits(gb, bits); // bs_env_start_value_balance
for (j = 1; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav);
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i + 1][j - 1] + delta * get_vlc2(gb, f_huff, 9, 3);
if (ch_data->env_facs_q[i + 1][j] > 127U) {
av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
@ -914,30 +880,25 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
return 0;
}
static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
static int read_sbr_noise(AACDecContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
SBRData *ch_data, int ch)
{
int i, j;
const VLCElem *t_huff, *f_huff;
int t_lav, f_lav;
int delta = (ch == 1 && sbr->bs_coupling == 1) + 1;
if (sbr->bs_coupling && ch) {
t_huff = vlc_sbr[T_HUFFMAN_NOISE_BAL_3_0DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_NOISE_BAL_3_0DB];
f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_NOISE_BAL_3_0DB];
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_3_0DB];
} else {
t_huff = vlc_sbr[T_HUFFMAN_NOISE_3_0DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_NOISE_3_0DB];
f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_NOISE_3_0DB];
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_3_0DB];
}
for (i = 0; i < ch_data->bs_num_noise; i++) {
if (ch_data->bs_df_noise[i]) {
for (j = 0; j < sbr->n_q; j++) {
ch_data->noise_facs_q[i + 1][j] = ch_data->noise_facs_q[i][j] + delta * (get_vlc2(gb, t_huff, 9, 2) - t_lav);
ch_data->noise_facs_q[i + 1][j] = ch_data->noise_facs_q[i][j] + delta * get_vlc2(gb, t_huff, 9, 2);
if (ch_data->noise_facs_q[i + 1][j] > 30U) {
av_log(ac->avctx, AV_LOG_ERROR, "noise_facs_q %d is invalid\n", ch_data->noise_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
@ -946,7 +907,7 @@ static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitCo
} else {
ch_data->noise_facs_q[i + 1][0] = delta * get_bits(gb, 5); // bs_noise_start_value_balance or bs_noise_start_value_level
for (j = 1; j < sbr->n_q; j++) {
ch_data->noise_facs_q[i + 1][j] = ch_data->noise_facs_q[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav);
ch_data->noise_facs_q[i + 1][j] = ch_data->noise_facs_q[i + 1][j - 1] + delta * get_vlc2(gb, f_huff, 9, 3);
if (ch_data->noise_facs_q[i + 1][j] > 30U) {
av_log(ac->avctx, AV_LOG_ERROR, "noise_facs_q %d is invalid\n", ch_data->noise_facs_q[i + 1][j]);
return AVERROR_INVALIDDATA;
@ -961,7 +922,7 @@ static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitCo
return 0;
}
static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
static void read_sbr_extension(AACDecContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb,
int bs_extension_id, int *num_bits_left)
{
@ -988,7 +949,7 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
}
}
static int read_sbr_single_channel_element(AACContext *ac,
static int read_sbr_single_channel_element(AACDecContext *ac,
SpectralBandReplication *sbr,
GetBitContext *gb)
{
@ -1012,7 +973,7 @@ static int read_sbr_single_channel_element(AACContext *ac,
return 0;
}
static int read_sbr_channel_pair_element(AACContext *ac,
static int read_sbr_channel_pair_element(AACDecContext *ac,
SpectralBandReplication *sbr,
GetBitContext *gb)
{
@ -1064,7 +1025,7 @@ static int read_sbr_channel_pair_element(AACContext *ac,
return 0;
}
static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
static unsigned int read_sbr_data(AACDecContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb, int id_aac)
{
unsigned int cnt = get_bits_count(gb);
@ -1108,7 +1069,7 @@ static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
return get_bits_count(gb) - cnt;
}
static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr)
static void sbr_reset(AACDecContext *ac, SpectralBandReplication *sbr)
{
int err;
err = sbr_make_f_master(ac, sbr, &sbr->spectrum_params);
@ -1129,7 +1090,7 @@ static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr)
*
* @return Returns number of bytes consumed from the TYPE_FIL element.
*/
int AAC_RENAME(ff_decode_sbr_extension)(AACContext *ac, SpectralBandReplication *sbr,
int AAC_RENAME(ff_decode_sbr_extension)(AACDecContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb_host, int crc, int cnt, int id_aac)
{
unsigned int num_sbr_bits = 0, num_align_bits;
@ -1282,7 +1243,7 @@ static void sbr_qmf_synthesis(AVTXContext *mdct, av_tx_fn mdct_fn,
#endif
/// Generate the subband filtered lowband
static int sbr_lf_gen(AACContext *ac, SpectralBandReplication *sbr,
static int sbr_lf_gen(SpectralBandReplication *sbr,
INTFLOAT X_low[32][40][2], const INTFLOAT W[2][32][32][2],
int buf_idx)
{
@ -1307,7 +1268,7 @@ static int sbr_lf_gen(AACContext *ac, SpectralBandReplication *sbr,
}
/// High Frequency Generator (14496-3 sp04 p215)
static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
static int sbr_hf_gen(AACDecContext *ac, SpectralBandReplication *sbr,
INTFLOAT X_high[64][40][2], const INTFLOAT X_low[32][40][2],
const INTFLOAT (*alpha0)[2], const INTFLOAT (*alpha1)[2],
const INTFLOAT bw_array[5], const uint8_t *t_env,
@ -1381,7 +1342,7 @@ static int sbr_x_gen(SpectralBandReplication *sbr, INTFLOAT X[2][38][64],
/** High Frequency Adjustment (14496-3 sp04 p217) and Mapping
* (14496-3 sp04 p217)
*/
static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
static int sbr_mapping(AACDecContext *ac, SpectralBandReplication *sbr,
SBRData *ch_data, int e_a[2])
{
int e, i, m;
@ -1495,7 +1456,7 @@ static void sbr_env_estimate(AAC_FLOAT (*e_curr)[48], INTFLOAT X_high[64][40][2]
}
}
void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
void AAC_RENAME(ff_sbr_apply)(AACDecContext *ac, SpectralBandReplication *sbr, int id_aac,
INTFLOAT* L, INTFLOAT* R)
{
int downsampled = ac->oc[1].m4ac.ext_sample_rate < sbr->sample_rate;
@ -1532,7 +1493,7 @@ void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int
ch ? R : L, sbr->data[ch].analysis_filterbank_samples,
(INTFLOAT*)sbr->qmf_filter_scratch,
sbr->data[ch].W, sbr->data[ch].Ypos);
sbr->c.sbr_lf_gen(ac, sbr, sbr->X_low,
sbr->c.sbr_lf_gen(sbr, sbr->X_low,
(const INTFLOAT (*)[32][32][2]) sbr->data[ch].W,
sbr->data[ch].Ypos);
sbr->data[ch].Ypos ^= 1;
@ -1552,7 +1513,7 @@ void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int
err = sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
if (!err) {
sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]);
sbr_gain_calc(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
sbr_gain_calc(sbr, &sbr->data[ch], sbr->data[ch].e_a);
sbr->c.sbr_hf_assemble(sbr->data[ch].Y[sbr->data[ch].Ypos],
(const INTFLOAT (*)[40][2]) sbr->X_high,
sbr, &sbr->data[ch],
@ -1569,7 +1530,7 @@ void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int
if (ac->oc[1].m4ac.ps == 1) {
if (sbr->ps.common.start) {
AAC_RENAME(ff_ps_apply)(ac->avctx, &sbr->ps, sbr->X[0], sbr->X[1], sbr->kx[1] + sbr->m[1]);
AAC_RENAME(ff_ps_apply)(&sbr->ps, sbr->X[0], sbr->X[1], sbr->kx[1] + sbr->m[1]);
} else {
memcpy(sbr->X[1], sbr->X[0], sizeof(sbr->X[0]));
}

Some files were not shown because too many files have changed in this diff Show More