]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agoavformat/mpegts: only clear programs which no longer exist or have a new PMT
Marton Balint [Sun, 27 Dec 2020 22:05:16 +0000 (23:05 +0100)]
avformat/mpegts: only clear programs which no longer exist or have a new PMT

Otherwise there can be a small period when the programs only contain the PMT
pid.

Also make sure skip_clear only affects AVProgram clear, and that pmt_pid is
always kept as the first entry of the PID list of the programs. Also reject
PMTs for programs on the wrong PID.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/mpegts: rework clearing and adding pid to program
Marton Balint [Sun, 27 Dec 2020 18:38:50 +0000 (19:38 +0100)]
avformat/mpegts: rework clearing and adding pid to program

And use better function names.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/mpegts: never discard PAT pid
Marton Balint [Sun, 27 Dec 2020 16:35:36 +0000 (17:35 +0100)]
avformat/mpegts: never discard PAT pid

PID 0 was removed from the pid list when then PMT was parsed, it is better
to explictly avoid it from being discarded instead of keeing it in the list of
every program.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/utils: do not overwrite already existing program with defaults in av_new_program
Marton Balint [Sun, 27 Dec 2020 19:32:54 +0000 (20:32 +0100)]
avformat/utils: do not overwrite already existing program with defaults in av_new_program

av_new_program returns the existing program if that already exists, in that
case it makes no sense to overwrite existing attributes.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agolavu/tx: clip when converting table values to fixed-point
Lynne [Sat, 9 Jan 2021 19:41:25 +0000 (20:41 +0100)]
lavu/tx: clip when converting table values to fixed-point

INT32_MAX (2147483647) isn't exactly representable by a floating point
value, with the closest being 2147483648.0. So when rescaling a value
of 1.0, this could overflow when casting the 64-bit value returned from
lrintf() into 32 bits.
Unfortunately the properties of integer overflows don't match up well
with how a Fourier Transform operates. So clip the value before
casting to a 32-bit int.

Should be noted we don't have overflows with the table values we're
currently using. However, converting a Kaiser-Bessel window function
with a length of 256 and a parameter of 5.0 to fixed point did create
overflows. So this is more of insurance to save debugging time
in case something changes in the future.
The macro is only used during init, so it being a little slower is
not a problem.

3 years agosbc: do not set sample format in parser
Arnaud Vrac [Tue, 5 Jan 2021 12:47:43 +0000 (13:47 +0100)]
sbc: do not set sample format in parser

Commit bdd31feec934 changed the SBC decoder to only set the output
sample format on init, instead of setting it explicitly on each frame,
which is correct. But the SBC parser overrides the sample format to S16,
which triggers a crash when combining the parser and the decoder.

Fix the issue by not setting the sample format anymore in the parser,
which is wrong.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavdevice/decklink_dec: mark get_frame_timecode and get_bmd_timecode static
Christopher Degawa [Wed, 6 Jan 2021 18:09:36 +0000 (18:09 +0000)]
avdevice/decklink_dec: mark get_frame_timecode and get_bmd_timecode static

The function is not used anywhere else and is causing mingw-w64 clang
builds to fail with

ffmpeg-git/libavdevice/decklink_dec.cpp:792:5: error: no previous prototype for function 'get_bmd_timecode' [-Werror,-Wmissing-prototypes]
int get_bmd_timecode(AVFormatContext *avctx, AVTimecode *tc, AVRational frame_rate, BMDTimecodeFormat tc_format, IDeckLinkVideoInputFrame *videoFrame)

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/mov: adjust skip_samples according to seek timestamp
Matthieu Bouron [Fri, 30 Oct 2020 14:38:51 +0000 (15:38 +0100)]
avformat/mov: adjust skip_samples according to seek timestamp

Currently skip_samples is set to start_pad if sample_time is lesser or
equal to 0. This can cause issues if the stream starts with packets that
have negative pts. Calling avformat_seek_file() with ts set to 0 on such
streams makes the mov demuxer return the right corresponding packets
(near the 0 timestamp) but set skip_samples to start_pad which is
incorrect as the audio decoder will discard the returned samples
according to skip_samples from the first packet it receives (which has
its timestamp near 0).

For example, considering the following audio stream with start_pad=1344:

 [PKT pts=-1344] [PKT pts=-320] [PKT pts=704] [PKT pts=1728] [...]

Calling avformat_seek_file() with ts=0 makes the next call to
av_read_frame() return the packet with pts=-320 and a skip samples
side data set to 1344 (start_pad). This makes the audio decoder
incorrectly discard (1344 - 320) samples.

This commit makes the move demuxer adjust skip_samples according to the
stream start_pad, seek timestamp and first sample timestamp.

The above example will now result in av_read_frame() still returning the
packet with pts=-320 but with a skip samples side data set to 320
(src_pad - (seek_timestamp - first_timestamp)). This makes the audio
decoder only discard 320 samples (from pts=-320 to pts=0).

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agodoc/protocols: explain tcp listen option description
Lingjiang Fang [Sat, 2 Jan 2021 11:37:34 +0000 (19:37 +0800)]
doc/protocols: explain tcp listen option description

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavcodec/nvenc: fix timestamp offset ticks logic
Timo Rothenpieler [Sat, 9 Jan 2021 15:34:59 +0000 (16:34 +0100)]
avcodec/nvenc: fix timestamp offset ticks logic

3 years agoavcodec/ac3dec: Make decoders init-threadsafe
Andreas Rheinhardt [Thu, 3 Dec 2020 15:56:36 +0000 (16:56 +0100)]
avcodec/ac3dec: Make decoders init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/ac3dec: Check operations that can fail
Andreas Rheinhardt [Thu, 3 Dec 2020 15:04:13 +0000 (16:04 +0100)]
avcodec/ac3dec: Check operations that can fail

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/ac3enc: Factor common end of float/fixed encode_frame out
Andreas Rheinhardt [Thu, 3 Dec 2020 14:28:35 +0000 (15:28 +0100)]
avcodec/ac3enc: Factor common end of float/fixed encode_frame out

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/ac3enc_template: Perform compile-time checks at compile-time
Andreas Rheinhardt [Thu, 3 Dec 2020 03:44:21 +0000 (04:44 +0100)]
avcodec/ac3enc_template: Perform compile-time checks at compile-time

Runtime checks for whether the encoder is fixed-point or not are
unnecessary here as this is a template; furthermore, there is no
fixed-point EAC-3 encoder, so some checks for whether one is in EAC-3
mode can be omitted when doing fixed-point encoding.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/[e]ac3enc: Don't invade CONFIG_ namespace
Andreas Rheinhardt [Thu, 3 Dec 2020 03:13:28 +0000 (04:13 +0100)]
avcodec/[e]ac3enc: Don't invade CONFIG_ namespace

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/ac3enc: Set function pointers earlier
Andreas Rheinhardt [Thu, 3 Dec 2020 02:36:32 +0000 (03:36 +0100)]
avcodec/ac3enc: Set function pointers earlier

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/[e]ac3enc: Make encoders init-threadsafe, fix race
Andreas Rheinhardt [Thu, 3 Dec 2020 01:57:18 +0000 (02:57 +0100)]
avcodec/[e]ac3enc: Make encoders init-threadsafe, fix race

ff_eac3_exponent_init() set values twice when initializing a static
table; ergo the initialization code must not run concurrently with
a running EAC-3 encoder. Yet this code is executed every time an EAC-3
encoder is initialized. So use ff_thread_once() for this and also for a
similar initialization performed for all AC-3 encoders to make them all
init-threadsafe.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/wmaprodec: Check packet size
Michael Niedermayer [Thu, 3 Dec 2020 23:52:47 +0000 (00:52 +0100)]
avcodec/wmaprodec: Check packet size

Fixes: left shift of negative value -25824
Fixes: 27754/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5760255962906624
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/dhav: Check position for overflow
Michael Niedermayer [Thu, 3 Dec 2020 23:30:12 +0000 (00:30 +0100)]
avformat/dhav: Check position for overflow

Fixes: signed integer overflow: 9223372036854775807 + 32768 cannot be represented in type 'long'
Fixes: 27744/clusterfuzz-testcase-minimized-ffmpeg_dem_DHAV_fuzzer-5179319491756032
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/rasc: Check frame before clearing
Michael Niedermayer [Thu, 3 Dec 2020 22:41:10 +0000 (23:41 +0100)]
avcodec/rasc: Check frame before clearing

Fixes: null pointer dereference
Fixes: 27737/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-5769028685266944
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/utils: Change compute_chapters_end() from O(n²) to O(n log n)
Michael Niedermayer [Sat, 21 Nov 2020 13:51:25 +0000 (14:51 +0100)]
avformat/utils: Change compute_chapters_end() from O(n²) to O(n log n)

Fixes: Timeout (49sec -> 9sec)
Fixes: 27427/clusterfuzz-testcase-minimized-ffmpeg_dem_FFMETADATA_fuzzer-5140589838073856
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/fft_template: Only check for FF_FFT_PERM_AVX on ARCH_X86
Andreas Rheinhardt [Wed, 6 Jan 2021 20:09:14 +0000 (21:09 +0100)]
avcodec/fft_template: Only check for FF_FFT_PERM_AVX on ARCH_X86

Also do it for FFT_FLOAT only, as this is the only combination for which
it can be set.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vsrc_testsrc: Deduplicate options
Andreas Rheinhardt [Sun, 3 Jan 2021 17:54:14 +0000 (18:54 +0100)]
avfilter/vsrc_testsrc: Deduplicate options

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/af_biquads: Don't redundantly set AVClass
Andreas Rheinhardt [Sun, 3 Jan 2021 17:13:25 +0000 (18:13 +0100)]
avfilter/af_biquads: Don't redundantly set AVClass

It is already set generically in ff_filter_alloc().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/af_biquads: Deduplicate options
Andreas Rheinhardt [Sun, 3 Jan 2021 17:01:13 +0000 (18:01 +0100)]
avfilter/af_biquads: Deduplicate options

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_blend: Deduplicate options
Andreas Rheinhardt [Sun, 3 Jan 2021 16:06:14 +0000 (17:06 +0100)]
avfilter/vf_blend: Deduplicate options

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/af_asupercut: Deduplicate options
Andreas Rheinhardt [Sun, 3 Jan 2021 15:49:36 +0000 (16:49 +0100)]
avfilter/af_asupercut: Deduplicate options

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_neighbor: Deduplicate options
Andreas Rheinhardt [Sun, 3 Jan 2021 15:41:39 +0000 (16:41 +0100)]
avfilter/vf_neighbor: Deduplicate options

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_convolution: Deduplicate filter options
Andreas Rheinhardt [Sun, 3 Jan 2021 15:10:19 +0000 (16:10 +0100)]
avfilter/vf_convolution: Deduplicate filter options

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/hashenc: Deduplicate (stream)hash options
Andreas Rheinhardt [Sun, 3 Jan 2021 15:00:16 +0000 (16:00 +0100)]
avformat/hashenc: Deduplicate (stream)hash options

Also saves relocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/wavpack: Deduplicate exp and log tables
Andreas Rheinhardt [Sun, 3 Jan 2021 14:50:43 +0000 (15:50 +0100)]
avcodec/wavpack: Deduplicate exp and log tables

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/mxf: Deduplicate random_index_pack_key
Andreas Rheinhardt [Sun, 3 Jan 2021 01:21:51 +0000 (02:21 +0100)]
avformat/mxf: Deduplicate random_index_pack_key

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_qp: Deduplicate variable names arrays
Andreas Rheinhardt [Sun, 3 Jan 2021 01:02:28 +0000 (02:02 +0100)]
avfilter/vf_qp: Deduplicate variable names arrays

This also avoids relocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/vp3data: Deduplicate coeff_tables
Andreas Rheinhardt [Sun, 3 Jan 2021 00:42:13 +0000 (01:42 +0100)]
avcodec/vp3data: Deduplicate coeff_tables

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/twinvq, metasound_data: Deduplicate lsp tables
Andreas Rheinhardt [Sun, 3 Jan 2021 20:07:47 +0000 (21:07 +0100)]
avcodec/twinvq, metasound_data: Deduplicate lsp tables

Saves about 24KB.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/metasound: Deduplicate data
Andreas Rheinhardt [Sat, 2 Jan 2021 22:08:00 +0000 (23:08 +0100)]
avcodec/metasound: Deduplicate data

Saves about 13KB; also reduces the amount of relocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/g723_1: Move tables to their only user
Andreas Rheinhardt [Sat, 2 Jan 2021 19:34:32 +0000 (20:34 +0100)]
avcodec/g723_1: Move tables to their only user

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/g723_1: Deduplicate arrays
Andreas Rheinhardt [Sat, 2 Jan 2021 19:18:22 +0000 (20:18 +0100)]
avcodec/g723_1: Deduplicate arrays

Saves about 17KB.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/libopusenc: Fix for header pre-skip value
Arthur Taylor [Thu, 7 Jan 2021 20:55:59 +0000 (12:55 -0800)]
avcodec/libopusenc: Fix for header pre-skip value

The Opus header initial padding preskip amount is always to be expressed
relative to 48kHz. However, the encoder delay returned from querying
libopus is relative to the encoding samplerate. Multiply by the
samplerate conversion factor to correct.

Signed-off-by: Arthur Taylor <art@ified.ca>
3 years agoavformat/vividas: Check number of audio channels
Michael Niedermayer [Sat, 26 Dec 2020 10:50:28 +0000 (11:50 +0100)]
avformat/vividas: Check number of audio channels

Fixes: division by 0
Fixes: 28597/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5752201490333696
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/alsdec: Fix integer overflow with quant_cof
Michael Niedermayer [Sat, 26 Dec 2020 17:55:08 +0000 (18:55 +0100)]
avcodec/alsdec: Fix integer overflow with quant_cof

Fixes: signed integer overflow: -210824 * 16384 cannot be represented in type 'int'
Fixes: 28670/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5682310846480384
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agotools/target_dem_fuzzer.c: Decrease maxblocks
Michael Niedermayer [Sat, 26 Dec 2020 15:53:27 +0000 (16:53 +0100)]
tools/target_dem_fuzzer.c: Decrease maxblocks

Fixes: Timeout
Fixes: 28606/clusterfuzz-testcase-minimized-ffmpeg_dem_FRM_fuzzer-5123311424110592
Fixes: 28796/clusterfuzz-testcase-minimized-ffmpeg_dem_R3D_fuzzer-5945803411685376
Fixes: 28821/clusterfuzz-testcase-minimized-ffmpeg_dem_BRSTM_fuzzer-6044239834251264
Fixes: 28841/clusterfuzz-testcase-minimized-ffmpeg_dem_SIFF_fuzzer-5485368388485120
Fixes: 28862/clusterfuzz-testcase-minimized-ffmpeg_dem_AST_fuzzer-5081306790756352
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/av1dec: add an option to select an operating point
James Almer [Sun, 15 Nov 2020 21:55:41 +0000 (18:55 -0300)]
avcodec/av1dec: add an option to select an operating point

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/cbs_av1: add an option to select an operating point
James Almer [Sun, 15 Nov 2020 21:55:40 +0000 (18:55 -0300)]
avcodec/cbs_av1: add an option to select an operating point

This implements the function drop_obu() as defined in Setion 6.2.1 from the
spec.
In a reading only scenario, units that belong to an operating point the
caller doesn't want should not be parsed.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/cbs: allow cbs_read_fragment_content() to skip decomposition of units
James Almer [Sun, 15 Nov 2020 21:55:39 +0000 (18:55 -0300)]
avcodec/cbs: allow cbs_read_fragment_content() to skip decomposition of units

The caller may not need all units in a fragment in reading only scenarios.
They could in fact alter global state stored in the private CodedBitstreamType
fields in an undesirable way.
With this change, unit decomposition can be skipped based on parsed values
within the unit.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/cbs: add an AVClass to CodedBitstreamType for option handling
James Almer [Sun, 15 Nov 2020 21:55:38 +0000 (18:55 -0300)]
avcodec/cbs: add an AVClass to CodedBitstreamType for option handling

So unit parsing may be configured with caller set options.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/libkvazaar: Set default ratecontrol algorithm for libkvazaar
Joose Sainio [Fri, 1 Jan 2021 14:31:17 +0000 (22:31 +0800)]
avcodec/libkvazaar: Set default ratecontrol algorithm for libkvazaar

The standalone version of Kvazaar sets a default ratecontrol algorithm when
bitrate is set. Mirror this behaviour.

Signed-off-by: Joose Sainio <joose.sainio@tuni.fi>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
3 years agoavcodec/hevcdec: fix stat_coeff save/load for persistent_rice_adaptation_enabled_flag
Xu Guangxin [Sun, 15 Nov 2020 02:36:22 +0000 (10:36 +0800)]
avcodec/hevcdec: fix stat_coeff save/load for persistent_rice_adaptation_enabled_flag

It's required by the 9.3.1 TableStatCoeff* section.

Following clips have this feature:
WPP_HIGH_TP_444_8BIT_RExt_Apple_2.bit
Bitdepth_A_RExt_Sony_1.bin
Bitdepth_B_RExt_Sony_1.bin
EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1.bit
EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1.bit
EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1.bit
EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1.bit
EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1.bit
EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1.bit
WPP_AND_TILE_10Bit422Test_HIGH_TP_444_10BIT_RExt_Apple_2.bit
WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_0_HIGH_TP_444_14BIT_RExt_Apple_2.bit
WPP_AND_TILE_AND_CABAC_BYPASS_ALIGN_1_HIGH_TP_444_14BIT_RExt_Apple_2.bit
WPP_AND_TILE_HIGH_TP_444_8BIT_RExt_Apple_2.bit

you can download them from:
https://www.itu.int/wftp3/av-arch/jctvc-site/bitstream_exchange/draft_conformance/RExt/

Signed-off-by: Xu Guangxin <oddstone@gmail.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
3 years agoavfilter/af_astats: clip input value to prevent overflow
Paul B Mahol [Mon, 4 Jan 2021 10:11:26 +0000 (11:11 +0100)]
avfilter/af_astats: clip input value to prevent overflow

3 years agoavformat/rtpdec: export Opus extradata in ff_rtp_parse_open()
Jonathan Baudanza [Tue, 29 Dec 2020 18:07:11 +0000 (10:07 -0800)]
avformat/rtpdec: export Opus extradata in ff_rtp_parse_open()

3 years agoavfilter/vf_w3fdif: not interlaced frames are filtered like tff
Paul B Mahol [Sun, 3 Jan 2021 21:48:40 +0000 (22:48 +0100)]
avfilter/vf_w3fdif: not interlaced frames are filtered like tff

3 years agoavfilter/vf_w3fdif: add two more useful options
Paul B Mahol [Sun, 3 Jan 2021 21:20:55 +0000 (22:20 +0100)]
avfilter/vf_w3fdif: add two more useful options

3 years agoavformat/http: support retry on connection error
erankor [Thu, 3 Dec 2020 08:42:52 +0000 (10:42 +0200)]
avformat/http: support retry on connection error

Add 2 new options:
- reconnect_on_http_error - a list of http status codes that should be
    retried. the list can contain explicit status codes / the strings
    4xx/5xx.
- reconnect_on_network_error - reconnects on arbitrary errors during
    connect, e.g. ECONNRESET/ETIMEDOUT

the retry employs the same exponential backoff logic as the existing
reconnect/reconnect_at_eof flags.

related tickets:
https://trac.ffmpeg.org/ticket/6066
https://trac.ffmpeg.org/ticket/7768

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/wavdec: Avoid zeroing written to array
Michael Niedermayer [Mon, 9 Nov 2020 19:53:27 +0000 (20:53 +0100)]
avformat/wavdec: Avoid zeroing written to array

Fixes: OOM
Fixes: 26934/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5996784213819392
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/notchlc: Check uncompressed size against input for LZ4
Michael Niedermayer [Wed, 14 Oct 2020 15:53:07 +0000 (17:53 +0200)]
avcodec/notchlc: Check uncompressed size against input for LZ4

Fixes: OOM
Fixes: 26168/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-6019839015256064
Fixes: 28397/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-5649039941042176
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/videotoolbox: make FFmpeg-to-VT mapping error more informative
Jan Ekström [Sat, 2 Jan 2021 12:30:36 +0000 (14:30 +0200)]
avcodec/videotoolbox: make FFmpeg-to-VT mapping error more informative

Now logs the actual failed-to-map pixel format as well as range.

3 years agoMark some pointers as const
Andreas Rheinhardt [Sun, 27 Dec 2020 16:36:59 +0000 (17:36 +0100)]
Mark some pointers as const

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolavc/mjpegdec: cosmetics, org->orig
Anton Khirnov [Sat, 12 Dec 2020 13:53:30 +0000 (14:53 +0100)]
lavc/mjpegdec: cosmetics, org->orig

3 years agofate: add tests for AVID
Anton Khirnov [Sat, 12 Dec 2020 12:40:47 +0000 (13:40 +0100)]
fate: add tests for AVID

Samples cut from tickets 971 and 4741

3 years agoapi-seek-test: use non-obsolete decoding API
Anton Khirnov [Thu, 10 Dec 2020 19:55:43 +0000 (20:55 +0100)]
api-seek-test: use non-obsolete decoding API

3 years agoapi-band-test: use non-obsolete decoding API
Anton Khirnov [Thu, 10 Dec 2020 19:55:43 +0000 (20:55 +0100)]
api-band-test: use non-obsolete decoding API

3 years agoapi-h264-test: use non-obsolete decoding API
Anton Khirnov [Thu, 10 Dec 2020 19:55:43 +0000 (20:55 +0100)]
api-h264-test: use non-obsolete decoding API

3 years agolavfi/vf_uspp: convert to the video_enc_params API
Anton Khirnov [Fri, 17 Apr 2020 08:32:12 +0000 (10:32 +0200)]
lavfi/vf_uspp: convert to the video_enc_params API

3 years agolavfi/vf_codecview: convert to the video_enc_params API
Anton Khirnov [Fri, 17 Apr 2020 08:32:12 +0000 (10:32 +0200)]
lavfi/vf_codecview: convert to the video_enc_params API

3 years agolavfi/vf_fspp: convert to the video_enc_params API
Anton Khirnov [Fri, 17 Apr 2020 08:32:12 +0000 (10:32 +0200)]
lavfi/vf_fspp: convert to the video_enc_params API

3 years agolavfi/vf_pp7: convert to the video_enc_params API
Anton Khirnov [Fri, 17 Apr 2020 08:32:12 +0000 (10:32 +0200)]
lavfi/vf_pp7: convert to the video_enc_params API

Re-enable fate-filter-pp7

3 years agolavfi/vf_spp: convert to the video_enc_params API
Anton Khirnov [Fri, 17 Apr 2020 08:32:12 +0000 (10:32 +0200)]
lavfi/vf_spp: convert to the video_enc_params API

Re-enable fate-filter-spp

3 years agolavfi/vf_pp: convert to the video_enc_params API
Anton Khirnov [Fri, 17 Apr 2020 08:32:12 +0000 (10:32 +0200)]
lavfi/vf_pp: convert to the video_enc_params API

Re-enable fate-filter-qp and fate-filter-pp.

3 years agolavfi: add common code to handle QP tables
Anton Khirnov [Mon, 14 Dec 2020 13:36:05 +0000 (14:36 +0100)]
lavfi: add common code to handle QP tables

It will be used for converting the *pp filters to the new
AVVideoEncParams API.

3 years agolavfi/vf_qp: convert to the video_enc_params API
Anton Khirnov [Fri, 17 Apr 2020 08:32:12 +0000 (10:32 +0200)]
lavfi/vf_qp: convert to the video_enc_params API

Temporarily disable fate-filter-qp until vf_pp is converted.

3 years agompegvideo: use the AVVideoEncParams API for exporting QP tables
Anton Khirnov [Tue, 10 Mar 2020 10:45:55 +0000 (11:45 +0100)]
mpegvideo: use the AVVideoEncParams API for exporting QP tables

Do it only when requested with the AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS
flag.

Drop previous code using the long-deprecated AV_FRAME_DATA_QP_TABLE*
API. Temporarily disable fate-filter-pp, fate-filter-pp7,
fate-filter-spp. They will be reenabled once these filters are converted
in following commits.

3 years agolavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bump
Anton Khirnov [Wed, 27 May 2020 12:54:38 +0000 (14:54 +0200)]
lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bump

They are not properly namespaced and not intended for public use.

3 years agolavu: move LOCAL_ALIGNED from internal.h to mem_internal.h
Anton Khirnov [Wed, 10 Jun 2020 13:38:08 +0000 (15:38 +0200)]
lavu: move LOCAL_ALIGNED from internal.h to mem_internal.h

That is a more appropriate place for it.

3 years agoavfilter: add temporal midway equalizer filter
Paul B Mahol [Sat, 26 Dec 2020 12:52:24 +0000 (13:52 +0100)]
avfilter: add temporal midway equalizer filter

3 years agoconfigure: update copyright year
Lynne [Thu, 31 Dec 2020 23:00:00 +0000 (00:00 +0100)]
configure: update copyright year

3 years agoavcodec/svq1dec: Increase nb_bits of VLC to read it in one go
Andreas Rheinhardt [Tue, 29 Dec 2020 19:34:01 +0000 (20:34 +0100)]
avcodec/svq1dec: Increase nb_bits of VLC to read it in one go

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/dirac_arith: Make table only used here static
Andreas Rheinhardt [Tue, 29 Dec 2020 14:33:03 +0000 (15:33 +0100)]
avcodec/dirac_arith: Make table only used here static

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/qdmc: Mark decoder as init-threadsafe
Andreas Rheinhardt [Mon, 28 Dec 2020 19:01:47 +0000 (20:01 +0100)]
avcodec/qdmc: Mark decoder as init-threadsafe

It already uses ff_thread_once() to initialize its static data.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/opusdec: Mark decoder as init-threadsafe
Andreas Rheinhardt [Mon, 28 Dec 2020 17:00:28 +0000 (18:00 +0100)]
avcodec/opusdec: Mark decoder as init-threadsafe

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/opusdec: Cleanup generically on init failure
Andreas Rheinhardt [Mon, 28 Dec 2020 16:58:43 +0000 (17:58 +0100)]
avcodec/opusdec: Cleanup generically on init failure

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/opusdec: Move per-stream fields to OpusStreamContext
Andreas Rheinhardt [Mon, 28 Dec 2020 16:46:44 +0000 (17:46 +0100)]
avcodec/opusdec: Move per-stream fields to OpusStreamContext

Besides being more natural it also avoids allocations for separate
arrays of decoded samples/output buffers/....

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/opusdec: Return error upon error
Andreas Rheinhardt [Mon, 28 Dec 2020 16:52:12 +0000 (17:52 +0100)]
avcodec/opusdec: Return error upon error

The Opus decoder forgot to return an error when allocating an
SwrContext fails.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/aacps_common: Use minimal VLC nb_bits/max_depth
Andreas Rheinhardt [Mon, 28 Dec 2020 02:31:05 +0000 (03:31 +0100)]
avcodec/aacps_common: Use minimal VLC nb_bits/max_depth

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/aacps: Factor out code shared by float and fixed point decoder
Andreas Rheinhardt [Mon, 28 Dec 2020 01:41:38 +0000 (02:41 +0100)]
avcodec/aacps: Factor out code shared by float and fixed point decoder

Saves about 7KiB.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegvideo: Don't zero-initialize unnecessarily
Andreas Rheinhardt [Sun, 27 Dec 2020 20:16:08 +0000 (21:16 +0100)]
avcodec/mpegvideo: Don't zero-initialize unnecessarily

mbintra_table will be memset to 1 a few lines after its allocation.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/aacsbr_template: Remove pointless runtime initialization
Andreas Rheinhardt [Sun, 27 Dec 2020 19:46:06 +0000 (20:46 +0100)]
avcodec/aacsbr_template: Remove pointless runtime initialization

The sbr_qmf_window_us array is basically symmetric around its middle
element and therefore the latter half is currently initialized from the
first half at runtime. Yet because the first half is initialized, the
array can't be placed in .bss at all, so that one gains nothing from not
already initializing the whole array statically. Therefore this commit
does exactly this.

(There are two exceptions to the symmetry: Elements 384 and 512 are the
negations of their mirror element; for the fixed-point decoder, Q31(-x)
does not equal -Q31(x). In order to keep the array exactly the same, the
latter form has been used for these two elements.)

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/aacsbr: Remove remnants of tablegen
Andreas Rheinhardt [Sun, 27 Dec 2020 18:57:27 +0000 (19:57 +0100)]
avcodec/aacsbr: Remove remnants of tablegen

These tables are always initialized at runtime since commit
cb93df0dcbd34107c64ec053504fa294b728a9c9.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/atrac3plus_data: Mark array as const
Andreas Rheinhardt [Sun, 27 Dec 2020 18:42:35 +0000 (19:42 +0100)]
avcodec/atrac3plus_data: Mark array as const

Forgotten in a7dbeb77c3c30ac4904928978938b209ff6e1ab1.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mlpenc: Simplify finding best codebook
Andreas Rheinhardt [Sat, 26 Dec 2020 17:16:21 +0000 (18:16 +0100)]
avcodec/mlpenc: Simplify finding best codebook

Finding the best codebook involves comparing different paths, where each
path is a sequence of several decisions (namely which codebook to use).
Up until now, these sequence was encoded in a NUL-terminated string and
the actual decisions were encoded as ’\0'..'\3' (which encoded 0..3).
This commit modifies this to actually encode it via 0..3 by switching
away from a C-string to a simple array with an explicit length field.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/opusdec: Remove always-true check
Andreas Rheinhardt [Sat, 26 Dec 2020 12:09:49 +0000 (13:09 +0100)]
avcodec/opusdec: Remove always-true check

The celt_delay AVAudioFifo is always allocated during init, so checking
for its existence in .flush is unnecessary.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_addroi: Use chars instead of strings for one-char strings
Andreas Rheinhardt [Sat, 26 Dec 2020 09:33:12 +0000 (10:33 +0100)]
avfilter/vf_addroi: Use chars instead of strings for one-char strings

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/opustab: Make array static
Andreas Rheinhardt [Fri, 25 Dec 2020 17:41:26 +0000 (18:41 +0100)]
avcodec/opustab: Make array static

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/motion_est, mpegvideo: Make pointers to static storage const
Andreas Rheinhardt [Wed, 9 Dec 2020 03:16:48 +0000 (04:16 +0100)]
avcodec/motion_est, mpegvideo: Make pointers to static storage const

Modifying static storage must not happen because of multithreading
(except initialization of course), so add const to the pointed-to type
for pointers that point to static storage.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoconfigure, libavcodec/speedhq: Fix compiling SpeedHQ encoder
Andreas Rheinhardt [Thu, 10 Dec 2020 08:41:07 +0000 (09:41 +0100)]
configure, libavcodec/speedhq: Fix compiling SpeedHQ encoder

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegvideo: Merge ff_mpv_decode_defaults into ff_mpv_decode_init
Andreas Rheinhardt [Wed, 9 Dec 2020 02:23:32 +0000 (03:23 +0100)]
avcodec/mpegvideo: Merge ff_mpv_decode_defaults into ff_mpv_decode_init

These two are always called directly after each other (with the
exception of the calls in mpeg_decode_init() where some irrelevant
modifications of the avctx (which could just as well be done before
ff_mpv_decode_defaults(), because it doesn't have a pointer to the
AVCodecContext at all and therefore can't see these modifications at
all) are performed in between), so merge ff_mpv_decode_defaults() in
ff_mpv_decode_init().

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/h261dec: Don't use too big max_depth in get_vlc2()
Andreas Rheinhardt [Wed, 9 Dec 2020 02:04:59 +0000 (03:04 +0100)]
avcodec/h261dec: Don't use too big max_depth in get_vlc2()

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/speedhq: Remove cast
Andreas Rheinhardt [Tue, 8 Dec 2020 20:59:09 +0000 (21:59 +0100)]
avcodec/speedhq: Remove cast

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpeg12: Reindentation
Andreas Rheinhardt [Mon, 23 Nov 2020 02:12:23 +0000 (03:12 +0100)]
avcodec/mpeg12: Reindentation

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpeg12: Make initializing VLCs thread-safe
Andreas Rheinhardt [Mon, 23 Nov 2020 02:10:36 +0000 (03:10 +0100)]
avcodec/mpeg12: Make initializing VLCs thread-safe

This automatically makes the eamad, eatqi, ipu and mdec decoders
init-threadsafe; in addition to the actual mpeg[12]video decoders,
of course.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpeg12: Don't initialize encoder-only parts of RLTable
Andreas Rheinhardt [Tue, 8 Dec 2020 19:25:23 +0000 (20:25 +0100)]
avcodec/mpeg12: Don't initialize encoder-only parts of RLTable

ff_mpeg12_init_vlcs() currently initializes index_run, max_level and
max_run of ff_rl_mpeg1/2; yet the only user of these fields is the
MPEG-1/2 encoder which already initializes these tables on its own.
So remove the initializations in ff_mpeg12_init_vlcs(); this also
simplifies making ff_mpeg12_init_vlcs() thread-safe.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>