]> git.sesse.net Git - ffmpeg/log
ffmpeg
4 years agoavcodec/wmavoice: Fix rounding and integer anomalies in calc_input_response()
Michael Niedermayer [Sat, 14 Dec 2019 14:27:44 +0000 (15:27 +0100)]
avcodec/wmavoice: Fix rounding and integer anomalies in calc_input_response()

Fixes: out of array access
Fixes: inf is outside the range of representable values of type 'int'
Fixes: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long'
Fixes: 19316/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-5677369365102592
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/wmavoice: sanity check block_align
Michael Niedermayer [Sat, 21 Dec 2019 21:27:37 +0000 (22:27 +0100)]
avcodec/wmavoice: sanity check block_align

This limit is roughly based on the bitreader limit, its likely a much tighter limit
could be used

Fixes: left shift of 1965039647 by 1 places cannot be represented in type 'int'
Fixes: 19545/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-5695391899320320
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/pcm: Fix invalid shift in pcm_decode_frame for LXF
Michael Niedermayer [Tue, 17 Dec 2019 23:07:50 +0000 (00:07 +0100)]
avcodec/pcm: Fix invalid shift in pcm_decode_frame for LXF

Fixes: left shift of 32 by 28 places cannot be represented in type 'int'
Fixes: 19472/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PCM_LXF_fuzzer-5704364320096256
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/snappy: Sanity check bytestream2_get_levarint()
Michael Niedermayer [Sun, 19 Jan 2020 20:51:11 +0000 (21:51 +0100)]
avcodec/snappy: Sanity check bytestream2_get_levarint()

Fixes: left shift of 79 by 28 places cannot be represented in type 'int'
Fixes: 20202/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5719004081815552
Fixes: 20219/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5641738677125120
Fixes: 20389/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5680721517871104
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/udp: cancel pending IO on win32 manually
Marton Balint [Sun, 26 Jan 2020 21:13:50 +0000 (22:13 +0100)]
avformat/udp: cancel pending IO on win32 manually

recvfrom() is not a cancellation point in pthreads-win32, see
https://sourceware.org/pthreads-win32/manual/pthread_cancel.html

In order to be able to cancel the reader thread on Win32 properly we first
shutdown the socket then call CancelIoEx to abort pending IO. Subsequent
recvfrom() calls will fail with WSAESHUTDOWN causing the thread to exit.

Fixes ticket #5717.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/udp: remove setting cancel state from the TX thread
Marton Balint [Sun, 26 Jan 2020 20:11:53 +0000 (21:11 +0100)]
avformat/udp: remove setting cancel state from the TX thread

Write mode does not use cancellation.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/mlpdsp: Fix a invalid shift in ff_mlp_rematrix_channel()
Michael Niedermayer [Sat, 1 Feb 2020 22:25:42 +0000 (23:25 +0100)]
avcodec/mlpdsp: Fix a invalid shift in ff_mlp_rematrix_channel()

Fixes: left shift of negative value -2
Fixes: 20305/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-5677196618498048
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/adpcm_argo: simplify and move duplicated logic into a function
Zane van Iperen [Sat, 1 Feb 2020 06:59:59 +0000 (06:59 +0000)]
avcodec/adpcm_argo: simplify and move duplicated logic into a function

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter: add xfade opencl filter
Paul B Mahol [Thu, 23 Jan 2020 15:29:34 +0000 (16:29 +0100)]
avfilter: add xfade opencl filter

4 years agodoc/filters: fix tonemap_vaapi filter name in documentation
Paul B Mahol [Sun, 2 Feb 2020 09:06:19 +0000 (10:06 +0100)]
doc/filters: fix tonemap_vaapi filter name in documentation

4 years agodoc/filters: make filters order more consistent
Paul B Mahol [Sun, 2 Feb 2020 09:04:35 +0000 (10:04 +0100)]
doc/filters: make filters order more consistent

4 years agoavcodec/v4l2_m2m: Cosmetics
Andriy Gelman [Mon, 13 Jan 2020 04:11:30 +0000 (23:11 -0500)]
avcodec/v4l2_m2m: Cosmetics

Change pointer symbol position.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavcodec/v4l2_m2m: Use consistent logging context
Andriy Gelman [Mon, 13 Jan 2020 04:11:29 +0000 (23:11 -0500)]
avcodec/v4l2_m2m: Use consistent logging context

Before this commit v4l2_m2m used two different logging contexts (from
V4L2m2mPriv and AVCodecContext). For consistency always use AVCodecContext.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavcodec/v4l2_m2m: Simplify capture buffer init check
Andriy Gelman [Mon, 13 Jan 2020 04:11:27 +0000 (23:11 -0500)]
avcodec/v4l2_m2m: Simplify capture buffer init check

Before this commit s->avctx == NULL was used to infer that an encoder is
being initialzed. Code readability has been improved by directly using
!av_codec_is_decoder() instead.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavcodec:v4l2_context: Remove NULL initialization
Andriy Gelman [Mon, 13 Jan 2020 04:11:26 +0000 (23:11 -0500)]
avcodec:v4l2_context: Remove NULL initialization

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavfilter/vf_xfade: remove unused header
Paul B Mahol [Sat, 1 Feb 2020 21:06:11 +0000 (22:06 +0100)]
avfilter/vf_xfade: remove unused header

4 years agoavfilter/vf_psnr: fix logic failure when comparing time bases
Paul B Mahol [Sat, 1 Feb 2020 20:10:25 +0000 (21:10 +0100)]
avfilter/vf_psnr: fix logic failure when comparing time bases

4 years agoavfilter/vf_ssim: fix logic failure when comparing time bases
Paul B Mahol [Sat, 1 Feb 2020 20:09:32 +0000 (21:09 +0100)]
avfilter/vf_ssim: fix logic failure when comparing time bases

4 years agoavcodec/utils: remove extra brackets
leozhang [Sat, 1 Feb 2020 09:12:13 +0000 (17:12 +0800)]
avcodec/utils: remove extra brackets

Signed-off-by: leozhang <leozhang@qiyi.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolibavcodec/amfenc_hevc.c: Fix constant QP settings for I, P
OvchinnikovDmitrii [Tue, 28 Jan 2020 16:23:43 +0000 (19:23 +0300)]
libavcodec/amfenc_hevc.c: Fix constant QP settings for I, P

4 years agolavc/h265_profile_level: Fix the default profile in ff_h265_guess_level
Linjie Fu [Wed, 15 Jan 2020 06:54:43 +0000 (14:54 +0800)]
lavc/h265_profile_level: Fix the default profile in ff_h265_guess_level

Default to using multiplication factors for Main profile.

Introduced since cd3578a8e4e11e0ba021e621367a7974d6de5da0.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
4 years agoavformat/hlsenc: fix hls_ts_options with mpegts
Marton Balint [Mon, 23 Dec 2019 00:27:38 +0000 (01:27 +0100)]
avformat/hlsenc: fix hls_ts_options with mpegts

Was broken since cdbf8847ea97a985dfd55432e1384bb7fe5d2d3b.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavfilter/vf_geq: use per-thread AVExpr for expression evaluation
Marton Balint [Sat, 28 Dec 2019 13:50:12 +0000 (14:50 +0100)]
avfilter/vf_geq: use per-thread AVExpr for expression evaluation

There was no consensus about separating AVExprState from AVExpr so here is a
minimal patch using the existing AVExpr to fix ticket #7528.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/avdct: Clear IDCTDSPContext context
Michael Niedermayer [Mon, 27 Jan 2020 20:54:22 +0000 (21:54 +0100)]
avcodec/avdct: Clear IDCTDSPContext context

Fixes use of uninitialized variable and segfault

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoMAINTAINERS: Add patchwork maintainer
Michael Niedermayer [Mon, 27 Jan 2020 20:54:21 +0000 (21:54 +0100)]
MAINTAINERS: Add patchwork maintainer

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agodashenc: check pts to prevent division by zero error
Alfred E. Heggestad [Thu, 30 Jan 2020 09:58:01 +0000 (10:58 +0100)]
dashenc: check pts to prevent division by zero error

this usecase will cause a division by zero trap:

1. dashenc has received one frame
2. os->max_pts and os->start_pts have same value
3. delta between max_pts and start_pts is 0
4. av_rescale_q(0, x, y) returns 0
5. this value is used as denominator in division
6. Bang! -> segfault

this fix checks that max_pts > start_pts.
the fix has been tested and works.

Signed-off-by: Alfred E. Heggestad <alfred.heggestad@gmail.com>
Reviewed-by: Jeyapal, Karthick <kjeyapal@akamai.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavfilter/vf_xfade: add smooth transitions
Paul B Mahol [Fri, 31 Jan 2020 12:14:13 +0000 (13:14 +0100)]
avfilter/vf_xfade: add smooth transitions

4 years agodoc/filters: improve xfade description and add one example
Paul B Mahol [Fri, 31 Jan 2020 09:17:05 +0000 (10:17 +0100)]
doc/filters: improve xfade description and add one example

4 years agoavfilter/vf_drawtext: do not overread text if the last UTF8 sequence is invalid
Marton Balint [Wed, 29 Jan 2020 22:55:25 +0000 (23:55 +0100)]
avfilter/vf_drawtext: do not overread text if the last UTF8 sequence is invalid

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavfilter/vf_drawtext: use replacement chars for invalid UTF8 sequences
Marton Balint [Wed, 29 Jan 2020 22:29:04 +0000 (23:29 +0100)]
avfilter/vf_drawtext: use replacement chars for invalid UTF8 sequences

continue is explicitly disallowed for GET_UTF8, so let's fix that as well.
Fixes crash with invalid UTF8 sequences.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavutil/common: warn about possible move of the data pointer after the last 0 byte...
Marton Balint [Wed, 29 Jan 2020 22:56:07 +0000 (23:56 +0100)]
avutil/common: warn about possible move of the data pointer after the last 0 byte in GET_UTF8

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavutil/common: put ERROR statements into separate code blocks in GET_UTF8/16
Marton Balint [Wed, 29 Jan 2020 22:42:21 +0000 (23:42 +0100)]
avutil/common: put ERROR statements into separate code blocks in GET_UTF8/16

To be able to safely use more than one statement in ERROR.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavutil/common: add parenthesis around GET_16BIT in GET_UTF16
Marton Balint [Wed, 29 Jan 2020 21:41:50 +0000 (22:41 +0100)]
avutil/common: add parenthesis around GET_16BIT in GET_UTF16

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavutil/common: use unsigned int in GET_UTF8
Marton Balint [Wed, 29 Jan 2020 21:40:42 +0000 (22:40 +0100)]
avutil/common: use unsigned int in GET_UTF8

Right shift of signed value is implementation defined.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/x86/diracdsp: Fix high bits on Windows x86_64
Michael Niedermayer [Thu, 30 Jan 2020 21:04:06 +0000 (22:04 +0100)]
avcodec/x86/diracdsp: Fix high bits on Windows x86_64

Found-by: james
4 years agotests/fate/lavf-video.mak: fix fate-lavf-gif dependencies
Michael Niedermayer [Mon, 6 Jan 2020 12:43:10 +0000 (13:43 +0100)]
tests/fate/lavf-video.mak: fix fate-lavf-gif dependencies

The gif test should depend on gif not fits
Regression since: ac4b5d86222006fa71ffe5922e1a34f1422507d8

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/ralf: Fix overflows of biased values
Michael Niedermayer [Thu, 26 Dec 2019 23:11:59 +0000 (00:11 +0100)]
avcodec/ralf: Fix overflows of biased values

Fixes: signed integer overflow: 2003010644 * 2 cannot be represented in type 'int'
Fixes: 19593/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5660628006207488
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agotools/target_dec_fuzzer: limit per frame samples for APE
Michael Niedermayer [Fri, 10 Jan 2020 21:39:47 +0000 (22:39 +0100)]
tools/target_dec_fuzzer: limit per frame samples for APE

APE in its highest compression mode is really slow so even one frame
of millions of samples takes a long time

Fixes: Timeout (too long -> 3sec)
Fixes: 19937/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5751668818051072
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mov: Check STCO location
Michael Niedermayer [Sat, 11 Jan 2020 11:09:08 +0000 (12:09 +0100)]
avformat/mov: Check STCO location

Fixes: bypassing of checks and assertion failure
Fixes: asan_1003879.mp4
Found-by: Clusterfuzz + asan
Reported-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/wmalosslessdec: Fix multiple integer overflows
Michael Niedermayer [Thu, 9 Jan 2020 01:06:36 +0000 (02:06 +0100)]
avcodec/wmalosslessdec: Fix multiple integer overflows

Fixes: left shift of 3329 by 20 places cannot be represented in type 'int'
Fixes: signed integer overflow: -199378355 + -1948950833 cannot be represented in type 'int'
Fixes: 19837/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5752565837070336
Fixes: 19839/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5767483265122304
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/apedec: Fix undefined integer overflow in decode_array_0000()
Michael Niedermayer [Sat, 7 Dec 2019 19:55:16 +0000 (20:55 +0100)]
avcodec/apedec: Fix undefined integer overflow in decode_array_0000()

Fixes: signed integer overflow: -2143289344 - 6246400 cannot be represented in type 'int'
Fixes: 19239/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5173755680915456
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoremove tests/ref/lavf/fits
Michael Niedermayer [Mon, 6 Jan 2020 12:38:33 +0000 (13:38 +0100)]
remove tests/ref/lavf/fits

This appears to be forgotten in ac4b5d86222006fa71ffe5922e1a34f1422507d8

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/smacker: Check space before decoding type
Michael Niedermayer [Wed, 1 Jan 2020 19:43:05 +0000 (20:43 +0100)]
avcodec/smacker: Check space before decoding type

Fixes: Timeout (232sec -> 280ms)
Fixes: 19682/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5654129649385472
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/rawdec: Use linesize in b64a
Michael Niedermayer [Wed, 1 Jan 2020 21:32:04 +0000 (22:32 +0100)]
avcodec/rawdec: Use linesize in b64a

Fixes: out of array access
Fixes: 19750/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RAWVIDEO_fuzzer-5074834119983104
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/iff: Over-allocate ham_palbuf for HAM6 IFF-PBM
Michael Niedermayer [Fri, 3 Jan 2020 22:24:15 +0000 (23:24 +0100)]
avcodec/iff: Over-allocate ham_palbuf for HAM6 IFF-PBM

IFF-PBM-HAM6 can read out of array without this overallocation
Fixes: Out of array read
Fixes: 19752/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5675331403120640
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agodoc/filters: Document geq *sum functions
Michael Niedermayer [Sat, 28 Dec 2019 10:26:10 +0000 (11:26 +0100)]
doc/filters: Document geq *sum functions

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agotools/target_dec_fuzzer: Add threshold for ALS
Michael Niedermayer [Sat, 25 Jan 2020 18:53:49 +0000 (19:53 +0100)]
tools/target_dec_fuzzer: Add threshold for ALS

Fixes: Timeout (253sec -> 16sec)
Fixes: 18668/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-6227155369590784
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/x86/diracdsp: Fix incorrect src addressing in dequant_subband_32()
Michael Niedermayer [Wed, 29 Jan 2020 21:11:45 +0000 (22:11 +0100)]
avcodec/x86/diracdsp: Fix incorrect src addressing in dequant_subband_32()

Fixes: Segfault (not reproducable with asm, which made this hard to debug)
Fixes: decoding errors
Fixes: 19854/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5729372837511168
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/screenpresso: Optimize sum_delta_flipped()
Michael Niedermayer [Wed, 29 Jan 2020 18:20:29 +0000 (19:20 +0100)]
avcodec/screenpresso: Optimize sum_delta_flipped()

553 -> 332 sec

Testcase: 20280/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCREENPRESSO_fuzzer-6238663432470528

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/aviobuf: Remove AVIOInternal and one level of indirection
Andreas Rheinhardt [Mon, 6 Jan 2020 14:51:48 +0000 (15:51 +0100)]
avformat/aviobuf: Remove AVIOInternal and one level of indirection

In the Libav commit cae448cf, the opaque of every AVIOContext opened
by ffio_fdopen() (which is used internally by avio_open() and avio_open2())
changed: It was a simple pointer to an URLContext before, but now it was
a structure (namely AVIOInternal) containing a pointer to an URLContext
as its only member. The next commits (namely 8c0ceafb and ec4c4839) added
members to AVIOInternal to allow white-/blacklisting of protocols.

But these two commits were never merged into FFmpeg (they were only
merged as no-ops in 510046c2 and 063b26d3), because FFmpeg chose
a different way to implement this (in 93629735); and so our AVIOInternal
still has exactly one member.

This of course means that it is unnecessary to use AVIOInternal as
opaque as it is just adding a level of indirection (not only pointer
dereference, but also wrapper functions). Therefore this commit
removes AVIOInternal entirely and essentially reverts cae448cf.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/vf_xfade: add radial transition
Paul B Mahol [Thu, 30 Jan 2020 16:20:31 +0000 (17:20 +0100)]
avfilter/vf_xfade: add radial transition

4 years agocmdutils: fix crash if no name for "ffmpeg -h protocol"
Jun Zhao [Thu, 30 Jan 2020 14:03:17 +0000 (22:03 +0800)]
cmdutils: fix crash if no name for "ffmpeg -h protocol"

fix crash when used the command like:
- ffmpeg -h protocol
- ffmpeg -h protocol=

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavfilter: add xfade filter
Paul B Mahol [Wed, 23 Oct 2019 18:43:26 +0000 (20:43 +0200)]
avfilter: add xfade filter

4 years agocmdutils: add show_help_protocol for get protocol options
Steven Liu [Wed, 27 Nov 2019 05:57:02 +0000 (13:57 +0800)]
cmdutils: add show_help_protocol for get protocol options

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
4 years agoavformat/avio: add avio_protocol_get_class
Steven Liu [Thu, 30 Jan 2020 09:03:48 +0000 (17:03 +0800)]
avformat/avio: add avio_protocol_get_class

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Suggested-by: Hendrik Leppkes <h.leppkes@gmail.com>
Suggested-by: Nicolas George <george@nsup.org>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
4 years agoavformat/tty: add probe function
Paul B Mahol [Mon, 27 Jan 2020 20:53:08 +0000 (21:53 +0100)]
avformat/tty: add probe function

4 years agoavfilter/vf_geq: fix multiple assignments of ptr in slice_geq_filter
Marton Balint [Sat, 28 Dec 2019 14:05:43 +0000 (15:05 +0100)]
avfilter/vf_geq: fix multiple assignments of ptr in slice_geq_filter

Fixes Coverity CID 1427183.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agotools/target_dec_fuzzer: Add threshold for IFF_ILBM
Michael Niedermayer [Wed, 22 Jan 2020 22:51:09 +0000 (23:51 +0100)]
tools/target_dec_fuzzer: Add threshold for IFF_ILBM

Fixes: Timeout (32 -> 1sec)
Fixes: 20138/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5634665251864576
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agotools/target_dec_fuzzer: Sort threshold list alphabetically
Michael Niedermayer [Sat, 25 Jan 2020 23:56:25 +0000 (00:56 +0100)]
tools/target_dec_fuzzer: Sort threshold list alphabetically

This also removes the comments as they are hard to maintain
together with sorted lists

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/dnxhddec: properly set colorspace
Paul B Mahol [Fri, 24 Jan 2020 12:30:24 +0000 (13:30 +0100)]
avcodec/dnxhddec: properly set colorspace

4 years agoRevert "fate/filter-video: add two tests for dnn_processing with frame format rgb24...
Guo, Yejun [Wed, 29 Jan 2020 00:15:28 +0000 (01:15 +0100)]
Revert "fate/filter-video: add two tests for dnn_processing with frame format rgb24 and grayf32"

The tests broke fate without SAMPLES and fate on some platforms.
This reverts commit 95ade711eb4afb8b76a765ef6571e7934ad7f8cc.

4 years agoavformat/mov: Don't leak MOVFragmentStreamInfo on error
Andreas Rheinhardt [Mon, 27 Jan 2020 08:28:19 +0000 (09:28 +0100)]
avformat/mov: Don't leak MOVFragmentStreamInfo on error

Fixes Coverity issue #1441933.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mov: Free encryption data on error
Andreas Rheinhardt [Mon, 27 Jan 2020 08:28:18 +0000 (09:28 +0100)]
avformat/mov: Free encryption data on error

Fixes memleak and Coverity issue #1439587.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/asrc_sinc: Don't allocate arrays separately
Andreas Rheinhardt [Mon, 27 Jan 2020 06:00:48 +0000 (07:00 +0100)]
avfilter/asrc_sinc: Don't allocate arrays separately

Besides the obvious advantages this also fixes a potential memleak:
If only one of the arrays had been successfully allocated, the other
would leak. This also fixes Coverity issues #1440386 and #1440387.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mov: update extensions
Gyan Doshi [Mon, 27 Jan 2020 08:46:50 +0000 (14:16 +0530)]
avformat/mov: update extensions

Added all extensions used by the mov muxer family, except m4v which
is also used for raw MPEG-4 Part 2 bitstreams

4 years agotest/fate: Add missing exe suffix to h265_levels test.
Carl Eugen Hoyos [Mon, 27 Jan 2020 23:02:01 +0000 (00:02 +0100)]
test/fate: Add missing exe suffix to h265_levels test.

Fixes fate on WSL using mingw.

4 years agoffmpeg: Do not print "SDP:" on top of sdp files.
Carl Eugen Hoyos [Sun, 26 Jan 2020 20:47:26 +0000 (21:47 +0100)]
ffmpeg: Do not print "SDP:" on top of sdp files.

Fixes ticket #7068.

4 years agoavformat/matroskaenc: Remove useless AVIOContext
Andreas Rheinhardt [Wed, 1 Jan 2020 00:58:20 +0000 (01:58 +0100)]
avformat/matroskaenc: Remove useless AVIOContext

Write a few numbers directly via AV_WB32 instead of using an AVIOContext
(that is initialized only for this very purpose) to write these numbers
at known offsets into a fixed buffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/matroskaenc: Improve writing Projection
Andreas Rheinhardt [Wed, 1 Jan 2020 00:58:19 +0000 (01:58 +0100)]
avformat/matroskaenc: Improve writing Projection

The Matroska Projection master element has such a small maximum length
that it can always be written with a length field of length one.
So it is unnecessary to first write the element into a dynamic buffer to
get the accurate length in order not to waste bytes on the length field.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/mux: Don't use av_ prefix for static functions
Andreas Rheinhardt [Tue, 13 Aug 2019 02:47:22 +0000 (04:47 +0200)]
avformat/mux: Don't use av_ prefix for static functions

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavfilter/vf_colorconstancy: fix memory leak on error
Paul B Mahol [Mon, 27 Jan 2020 15:52:11 +0000 (16:52 +0100)]
avfilter/vf_colorconstancy: fix memory leak on error

Also remove unneeded log message while here.

4 years agoavfilter/vf_find_rect: Remove assert
Michael Niedermayer [Sun, 26 Jan 2020 19:45:07 +0000 (20:45 +0100)]
avfilter/vf_find_rect: Remove assert

A score of 0 is possible
Fixes: Ticket8500
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/vf_find_rect: Increase worst case score
Michael Niedermayer [Sun, 26 Jan 2020 19:45:06 +0000 (20:45 +0100)]
avfilter/vf_find_rect: Increase worst case score

score could be 1.0 which lead to uninitialized values

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/av1_parser: export color information
James Almer [Sun, 26 Jan 2020 17:59:07 +0000 (14:59 -0300)]
avcodec/av1_parser: export color information

Should fix fate-lavf-fate-av1.mkv failures on builds without an AV1 decoder.

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/mux: Don't unnecessarily zero-initialize AVPacketList
Andreas Rheinhardt [Tue, 13 Aug 2019 02:47:15 +0000 (04:47 +0200)]
avformat/mux: Don't unnecessarily zero-initialize AVPacketList

If no error occurs and this AVPacketList is used at all, its packet
substructure will be overwritten and its next pointer explicitly set, so
every field will still be initialized even when using av_malloc.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mux: Move packet references
Andreas Rheinhardt [Tue, 13 Aug 2019 02:47:14 +0000 (04:47 +0200)]
avformat/mux: Move packet references

In the common case that the input packet was already refcounted,
ff_interleave_add_packet would allocate a new AVPacketList, use
av_packet_ref to create a new reference to the buffer for the
AVPacketList's packet, interleave the packet and finally unreference
the original input packet.
This commit changes this: It uses av_packet_move_ref to transfer
the packet to its destination. In case the input packet is refcounted,
this saves an allocation and a free (of an AVBufferRef); if not, the
packet is made refcounted before moving it. When the input packet has
side data, one saves even more than one allocation+free.

Furthermore, when the packet is in reality an uncoded frame, a hacky
ad-hoc variant of av_packet_move_ref has been employed. Not any more.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/gxfenc: Add deinit function
Andreas Rheinhardt [Sun, 26 Jan 2020 10:27:39 +0000 (11:27 +0100)]
avformat/gxfenc: Add deinit function

Fixes memleaks when the trailer is never written (e.g. if the call to
gxf_write_map_packet() at the end of gxf_write_header() fails).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mxfenc: Add deinit function
Andreas Rheinhardt [Sun, 26 Jan 2020 10:27:38 +0000 (11:27 +0100)]
avformat/mxfenc: Add deinit function

Fixes memleaks when allocating the private data of the timecode_track
fails or when the trailer is never written.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mxfenc: Don't free priv_data of AVStream
Andreas Rheinhardt [Sun, 26 Jan 2020 10:27:37 +0000 (11:27 +0100)]
avformat/mxfenc: Don't free priv_data of AVStream

It will be freed when the AVStream is freed later anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/audiointerleave: Check before dereferencing
Andreas Rheinhardt [Sun, 26 Jan 2020 10:27:36 +0000 (11:27 +0100)]
avformat/audiointerleave: Check before dereferencing

In order to use ff_audio_rechunk_interleave() (a special interleavement
function for situations where the ordinary "interleave by dts" is not
appropriate), the AVStreams must have private data and this private data
must begin with an AudioInterleaveContext which contains a fifo that may
need to be freed and when ff_audio_interleave_close() was called, it just
assumed that everything has been properly set up, i.e. that every streams
priv_data exists. This implies that this function can not be called from
the deinit function of a muxer, because such functions might be called
if the private data has not been successfully allocated. In order to
change this, add a check for whether the private data exists before
trying to free the fifo in it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/dvenc: Don't zero unnecessarily
Andreas Rheinhardt [Sun, 26 Jan 2020 07:13:11 +0000 (08:13 +0100)]
avformat/dvenc: Don't zero unnecessarily

The muxing context has already been zeroed when it was allocated, hence
it is unnecessary to do it again.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/dvenc: Replace write_trailer by deinit function
Andreas Rheinhardt [Sun, 26 Jan 2020 06:40:50 +0000 (07:40 +0100)]
avformat/dvenc: Replace write_trailer by deinit function

The old write_trailer only freed memory, so it is better to make a
dedicated deinit function out of it. Given that this function will also
be called when writing the header fails, one can also remove code that
frees already allocated fifos when allocating another one fails.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/yuv4mpegdec: increase header limit
Gyan Doshi [Sun, 26 Jan 2020 15:22:48 +0000 (20:52 +0530)]
avformat/yuv4mpegdec: increase header limit

Allows demuxing UHD 30000/1001 fps yuvj420p files

4 years agoavformat/yuv4mpegdec: better error logging
Gyan Doshi [Sun, 26 Jan 2020 15:20:30 +0000 (20:50 +0530)]
avformat/yuv4mpegdec: better error logging

4 years agofate/lavf-container: add an AV1 in Matroska muxing test
James Almer [Sun, 26 Jan 2020 15:40:34 +0000 (12:40 -0300)]
fate/lavf-container: add an AV1 in Matroska muxing test

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/av1: Avoid allocation + copying when filtering OBUs
Andreas Rheinhardt [Fri, 24 Jan 2020 22:48:33 +0000 (23:48 +0100)]
avformat/av1: Avoid allocation + copying when filtering OBUs

Certain types of OBUs are stripped away before muxing into Matroska and
ISOBMFF; there are two functions to do this: One that outputs by
directly writing in an AVIOContext and one that returns a freshly
allocated buffer with the units not stripped away copied into it.

The latter option is bad for performance, especially when the input
does already not contain any of the units intended to be stripped away
(this covers typical remuxing scenarios). Therefore this commit changes
this by avoiding allocating and copying when possible; it is possible if
the OBUs to be retained are consecutively in the input buffer (without
an OBU to be discarded between them). In this case, the caller receives
the offset as well as the length of the part of the buffer that contains
the units to be kept. This also avoids copying when e.g. the only unit
to be discarded is a temporal delimiter at the front.

For a 22.7mb/s file with average framesize 113 kB this improved the time
for the calls to ff_av1_filter_obus_buf() when writing Matroska from
313319 decicycles to 2368 decicycles; for another file with 1.5mb/s
(average framesize 7.3 kB) it improved from 34539 decicycles to 1922
decicyles. For these files the only units that needed to be stripped
away were temporal unit delimiters at the front.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/av1: Fix nits in the documentation of ff_av1_filter_obus_buf()
Andreas Rheinhardt [Fri, 24 Jan 2020 22:48:31 +0000 (23:48 +0100)]
avformat/av1: Fix nits in the documentation of ff_av1_filter_obus_buf()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/av1, avc, hevc: Remove av_freep()
Andreas Rheinhardt [Fri, 24 Jan 2020 22:48:28 +0000 (23:48 +0100)]
avformat/av1, avc, hevc: Remove av_freep()

ff_av1_filter_obus_buf() and ff_avc_parse_nal_units_buf() both have a
pointer-to-pointer parameter which they use to pass a newly allocated
buffer to the caller. And both functions freed what this pointer points to
before overwriting it. But no caller of these functions used this feature,
but some had to initialize the pointer just because of this. So remove
it and update the documentation of ff_av1_filter_obus_buf() wrt this fact.

ff_hevc_annexb2mp4_buf in contrast did not free the pointer. This has been
documented, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/av1: Improve filtering AV1 OBUs
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:32 +0000 (17:08 +0100)]
avformat/av1: Improve filtering AV1 OBUs

Both ISOBMFF as well as Matroska require certain OBUs to be stripped
before muxing them. There are two functions for this purpose; one writes
directly into an AVIOContext, the other returns a freshly allocated
buffer with the undesired units stripped away.

The latter one actually relies on the former by means of a dynamic
buffer. This has several drawbacks: The underlying buffer might have to
be reallocated multiple times; the buffer will eventually be
overallocated; the data will not be directly copied into the final
buffer, but rather first in the write buffer (in chunks of 1024 byte)
and then written in these chunks. Moreover, the API for dynamic buffers
is defective wrt error checking and as a consequence, the earlier code
would indicate a length of -AV_INPUT_BUFFER_PADDING_SIZE on allocation
failure, but it would not return an error; there would also be no error
in case the arbitrary limit of INT_MAX/2 that is currently imposed on
dynamic buffers is hit.

This commit changes this: The buffer is now parsed twice, once to get
the precise length which will then be allocated; and once to actually
write the data.

For a 22.7mb/s file with average framesize 113 kB this improved the time
for the calls to ff_av1_filter_obus_buf() when writing Matroska from
753662 decicycles to 313319 decicycles (based upon 50 runs a 2048 frames
each); for another 1.5mb/s file (with average framesize of 7.3 kB) it
improved from 79270 decicycles to 34539 decicycles (based upon 50 runs a
4096 frames).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/movenc: Check for reformatting errors when writing hint tracks
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:31 +0000 (17:08 +0100)]
avformat/movenc: Check for reformatting errors when writing hint tracks

If this is not done, the avio_write() calls will cause segfaults
immediately afterwards on error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/av1, hevc: Make *_buf-functions return 0 on success
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:30 +0000 (17:08 +0100)]
avformat/av1, hevc: Make *_buf-functions return 0 on success

The output size is already returned via a pointer argument, so there is
no need to return it via the ordinary return value as well. The
rationale behind this is to not poison the return value on success.
It also unifies the behaviour of the *_buf-functions for AVC, AV1 and
HEVC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/hevc: Fix potential leak in case of ff_hevc_annexb2mp4_buf failure
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:29 +0000 (17:08 +0100)]
avformat/hevc: Fix potential leak in case of ff_hevc_annexb2mp4_buf failure

ff_hevc_annexb2mp4_buf() could indicate an error, yet leave cleaning
after itself to the caller, so that a caller could not simply return the
error, but had to free the buffer first.

(Given that all current callers have set filter_ps = 0, this error can
currently not be triggered.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/matroskaenc: Cosmetics
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:28 +0000 (17:08 +0100)]
avformat/matroskaenc: Cosmetics

Add {, } in situations like
if ()
    ...
else if ()
    /* Comment */
    ...
else ...

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/matroskaenc: Check for reformatting errors
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:27 +0000 (17:08 +0100)]
avformat/matroskaenc: Check for reformatting errors

This is needed especially for AV1: If a reformatting error happens (e.g.
if the length field of an OBU contained in the current packet indicates
that said OBU extends beyond the current packet), the data pointer is
still NULL, yet the size is unchanged, so that writing the data leads
to a segmentation fault.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavfilter/scale: don't fail for circular expressions
Gyan Doshi [Sun, 26 Jan 2020 15:36:53 +0000 (21:06 +0530)]
avfilter/scale: don't fail for circular expressions

Due to conditional expressions, it is possible for them to be resolved
successfully. A warning is still printed.

4 years agoavfilter/vf_tonemap_opencl: fix long filter description
Paul B Mahol [Sun, 26 Jan 2020 13:50:24 +0000 (14:50 +0100)]
avfilter/vf_tonemap_opencl: fix long filter description

4 years agodoc/outdevs: Mention "sdl2" alias for "sdl".
Carl Eugen Hoyos [Sun, 26 Jan 2020 12:15:07 +0000 (13:15 +0100)]
doc/outdevs: Mention "sdl2" alias for "sdl".

Fixes ticket #8498.

4 years agoavformat: add demuxer for argonaut games' ASF format
Zane van Iperen [Sun, 26 Jan 2020 03:36:54 +0000 (03:36 +0000)]
avformat: add demuxer for argonaut games' ASF format

Adds support for the custom ASF container used by some Argonaut Games'
games, such as 'Croc! Legend of the Gobbos', and 'Croc 2'.

Can also handle the sample files in:
https://samples.ffmpeg.org/game-formats/brender/part2.zip

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
4 years agoavcodec: add decoder for argonaut games' adpcm codec
Zane van Iperen [Sun, 26 Jan 2020 03:36:50 +0000 (03:36 +0000)]
avcodec: add decoder for argonaut games' adpcm codec

Adds support for the ADPCM variant used by some Argonaut Games' games,
such as 'Croc! Legend of the Gobbos', and 'Croc 2'.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
4 years agoavformat/udp: increase the default buffer size of a receiving socket to 384K
Marton Balint [Tue, 14 Jan 2020 18:18:01 +0000 (19:18 +0100)]
avformat/udp: increase the default buffer size of a receiving socket to 384K

It is a common mistake that people only increase fifo_size when they experience
drops, unfortunately this does not help for higher bitrate (> 100 Mbps) streams
when the reader thread simply might not receive the packets in time (especially
under high CPU load) if the default 64 KB of kernel buffer size is used.

New default is determined so that common linux systems can set this buffer size
without tuning kernel parameters.

Signed-off-by: Marton Balint <cus@passwd.hu>