]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agoavformat/sierravmd: Make struct smaller by reordering
Andreas Rheinhardt [Wed, 24 Mar 2021 01:17:35 +0000 (02:17 +0100)]
avformat/sierravmd: Make struct smaller by reordering

Also remove keyframe from vmd_frame, it is unused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/sierravmd: Remove outdated check
Andreas Rheinhardt [Wed, 24 Mar 2021 00:39:50 +0000 (01:39 +0100)]
avformat/sierravmd: Remove outdated check

The check has been added at a time when the code performed the
multiplication itself instead of deferring it to av_malloc_array()
and when our allocation functions used unsigned instead of size_t.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/segafilm: Remove outdated check
Andreas Rheinhardt [Wed, 24 Mar 2021 00:21:41 +0000 (01:21 +0100)]
avformat/segafilm: Remove outdated check

The check has been added at a time when the code performed the
multiplication itself instead of deferring it to av_malloc_array()
and when our allocation functions used unsigned instead of size_t.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/utils: Remove redundant check
Andreas Rheinhardt [Wed, 24 Mar 2021 00:14:24 +0000 (01:14 +0100)]
avformat/utils: Remove redundant check

This check is outdated because the caller doesn't need to check that
the multiplication overflows when using av_realloc_array() (the code
in question used av_realloc() before that); furthermore, the check
is also a remnant of the time in which our allocation functions
didn't use size_t parameters.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_paletteuse: Fix left shift outside of range of int
Andreas Rheinhardt [Wed, 22 Jan 2020 00:47:21 +0000 (01:47 +0100)]
avfilter/vf_paletteuse: Fix left shift outside of range of int

by keeping the variable uint32_t which in this situation is the natural
type anyway. This affected the FATE-test filter-paletteuse-sierra2_4a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/asrc_sine: Fix invalid left shift of negative number
Andreas Rheinhardt [Wed, 22 Jan 2020 01:05:10 +0000 (02:05 +0100)]
avfilter/asrc_sine: Fix invalid left shift of negative number

by using a multiplication instead. The multiplication can never overflow
an int because the sin-factor is only an int16_t.

Affected the FATE-tests filter-concat and filter-concat-vfr.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/webmdashenc: Don't pass NULL to memcmp
Andreas Rheinhardt [Mon, 23 Sep 2019 21:23:10 +0000 (23:23 +0200)]
avformat/webmdashenc: Don't pass NULL to memcmp

Affects the FATE-tests webm-dash-manifest-unaligned-video-streams,
webm-dash-manifest and webm-dash-manifest-representations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/vividas: Use equals check with n in read_sb_block()
Michael Niedermayer [Mon, 15 Feb 2021 20:29:11 +0000 (21:29 +0100)]
avformat/vividas: Use equals check with n in read_sb_block()

Fixes: OOM
Fixes: 27780/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5097985075314688
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/sonic: Use unsigned temporary in predictor_calc_error()
Michael Niedermayer [Wed, 10 Feb 2021 22:05:17 +0000 (23:05 +0100)]
avcodec/sonic: Use unsigned temporary in predictor_calc_error()

Fixes: signed integer overflow: -2147471366 - 18638 cannot be represented in type 'int'
Fixes: 30157/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5171199746506752
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/jacosubdec: Use 64bit intermediate for start/end timestamp shift
Michael Niedermayer [Thu, 11 Feb 2021 21:44:36 +0000 (22:44 +0100)]
avformat/jacosubdec: Use 64bit intermediate for start/end timestamp shift

Fixes: signed integer overflow: -1957694447 + -1620425806 cannot be represented in type 'int'
Fixes: 30207/clusterfuzz-testcase-minimized-ffmpeg_dem_JACOSUB_fuzzer-5050791771635712
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/flvdec: Check array entry number
Michael Niedermayer [Thu, 11 Feb 2021 21:58:53 +0000 (22:58 +0100)]
avformat/flvdec: Check array entry number

Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 30209/clusterfuzz-testcase-minimized-ffmpeg_dem_FLV_fuzzer-5724831658147840
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/rtpenc_mpegts: stop leaks
Gyan Doshi [Sun, 28 Mar 2021 09:35:37 +0000 (15:05 +0530)]
avformat/rtpenc_mpegts: stop leaks

Fixes CID 1474460 & 1474461

3 years agodoc/filters: note default for elbg pal8 option
Gyan Doshi [Sun, 28 Mar 2021 09:56:56 +0000 (15:26 +0530)]
doc/filters: note default for elbg pal8 option

3 years agoavcodec/libxvid: remove unnecessary output packet data check
James Almer [Fri, 19 Mar 2021 01:45:12 +0000 (22:45 -0300)]
avcodec/libxvid: remove unnecessary output packet data check

The user buffers passed to avcodec_encode_video2() haven't been propagated to
AVCodec.encode2 implementations since 93016f5d1d280f9cb7856883af287fa66affc04c.
Also, the generic encode code already unrefs the packet if nothing was encoded.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/mov: Properly forward error codes from av_seek
Derek Buitenhuis [Thu, 25 Mar 2021 16:29:16 +0000 (16:29 +0000)]
avformat/mov: Properly forward error codes from av_seek

This is important, for example, for connection timed out events,
when used over a network, returning AVERROR(ETIMEDOUT).

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agotools/target_dec_fuzzer: Adjust threshold for flac
Michael Niedermayer [Mon, 22 Mar 2021 19:51:43 +0000 (20:51 +0100)]
tools/target_dec_fuzzer: Adjust threshold for flac

Fixes: Timeout
Fixes: 31464/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-4843965653319680
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/h264_slice: Check sps in h264_slice_header_init()
Michael Niedermayer [Sat, 20 Mar 2021 16:02:36 +0000 (17:02 +0100)]
avcodec/h264_slice: Check sps in h264_slice_header_init()

Fixes: null pointer dereference
Fixes: h264_slice_header_init.mp4
Found-by: Rafael Dutra <rafael.dutra@cispa.de>
Tested-by: Rafael Dutra <rafael.dutra@cispa.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/aacpsy: Check model_priv_data before dereferencing in psy_3gpp_end()
Michael Niedermayer [Thu, 18 Mar 2021 21:20:03 +0000 (22:20 +0100)]
avcodec/aacpsy: Check model_priv_data before dereferencing in psy_3gpp_end()

Fixes: null pointer dereference
Fixes: av_freep.mp4
Found-by: Rafael Dutra <rafael.dutra@cispa.de>
Tested-by: Rafael Dutra <rafael.dutra@cispa.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/movenc: Avoid loosing cluster array on failure
Michael Niedermayer [Thu, 18 Mar 2021 17:01:52 +0000 (18:01 +0100)]
avformat/movenc: Avoid loosing cluster array on failure

Fixes: crash
Fixes: check_pkt.mp4
Found-by: Rafael Dutra <rafael.dutra@cispa.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agotools/target_dec_fuzzer: Adjust VP4 threshold
Michael Niedermayer [Thu, 18 Mar 2021 10:03:19 +0000 (11:03 +0100)]
tools/target_dec_fuzzer: Adjust VP4 threshold

Fixes: Timeout (>10sec -> <100ms)
Fixes: 31515/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP4_fuzzer-5247114134290432
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/avidec: Check for dv streams before using priv_data in parse ##dc/##wb
Michael Niedermayer [Thu, 18 Mar 2021 09:59:19 +0000 (10:59 +0100)]
avformat/avidec: Check for dv streams before using priv_data in parse ##dc/##wb

Fixes: null pointer dereference
Fixes: 31588/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6165716135968768
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: Check sample size for overflow in mov_parse_stsd_audio()
Michael Niedermayer [Wed, 17 Mar 2021 22:39:04 +0000 (23:39 +0100)]
avformat/mov: Check sample size for overflow in mov_parse_stsd_audio()

Fixes: signed integer overflow: 2 * 1914708000 cannot be represented in type 'int'
Fixes: 31639/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6303428239294464
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/sga: Check for array end in lzss_decompress()
Michael Niedermayer [Wed, 17 Mar 2021 21:19:33 +0000 (22:19 +0100)]
avcodec/sga: Check for array end in lzss_decompress()

Fixes: out of array access
Fixes: 31640/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SGA_fuzzer-5630883286614016
Fixes: 31619/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SGA_fuzzer-5176667708456960
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/sbgdec: Check for overflow in last loop in expand_timestamps()
Michael Niedermayer [Fri, 5 Mar 2021 23:10:05 +0000 (00:10 +0100)]
avformat/sbgdec: Check for overflow in last loop in expand_timestamps()

Fixes: signed integer overflow: 9223372036854775807 + 86400000000 cannot be represented in type 'long'
Fixes: 31003/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6256298771480576
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>
3 years agoavcodec/ffwavesynth: Avoid signed integer overflow in phi_at()
Michael Niedermayer [Fri, 5 Mar 2021 19:27:50 +0000 (20:27 +0100)]
avcodec/ffwavesynth: Avoid signed integer overflow in phi_at()

Fixes: signed integer overflow: 2314885530818453536 - -9070214327174160352 cannot be represented in type 'long'
Fixes: 31000/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-6558389742206976
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>
3 years agoavformat/rtpenc_mpegts: convey options for rtp muxer
Gyan Doshi [Tue, 23 Mar 2021 05:26:10 +0000 (10:56 +0530)]
avformat/rtpenc_mpegts: convey options for rtp muxer

3 years agoavformat/rtpenc_mpegts: relay streamid to mpegts muxer streams.
Gyan Doshi [Thu, 18 Mar 2021 13:22:15 +0000 (18:52 +0530)]
avformat/rtpenc_mpegts: relay streamid to mpegts muxer streams.

3 years agoavformat/rtpenc_mpegts: convey options for mpeg-ts muxer
Gyan Doshi [Thu, 18 Mar 2021 11:04:22 +0000 (16:34 +0530)]
avformat/rtpenc_mpegts: convey options for mpeg-ts muxer

Fixes #5239

3 years agoavcodec/pthread_frame: Reindentation
Andreas Rheinhardt [Sun, 21 Mar 2021 04:39:49 +0000 (05:39 +0100)]
avcodec/pthread_frame: Reindentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/pthread_frame: Check initializing mutexes/condition variables
Andreas Rheinhardt [Tue, 23 Mar 2021 05:34:11 +0000 (06:34 +0100)]
avcodec/pthread_frame: Check initializing mutexes/condition variables

Up until now, initializing the mutexes/condition variables wasn't
checked by ff_frame_thread_init(). This commit changes this.

Given that it is not documented to be save to destroy a zeroed but
otherwise uninitialized mutex/condition variable, one has to choose
between two approaches: Either one duplicates the code to free them
in ff_frame_thread_init() in case of errors or one records which have
been successfully initialized. This commit takes the latter approach:
For each of the two structures with mutexes/condition variables
an array containing the offsets of the members to initialize is added.
Said array is used both for initializing and freeing and the only thing
that needs to be recorded is how many of these have been successfully
initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/pthread_frame: Fix cleanup during init
Andreas Rheinhardt [Thu, 11 Feb 2021 12:45:31 +0000 (13:45 +0100)]
avcodec/pthread_frame: Fix cleanup during init

In case an error happened when setting up the child threads,
ff_frame_thread_init() would up until now call ff_frame_thread_free()
to clean up all threads set up so far, including the current, not
properly initialized one.
But a half-allocated context needs special handling which
ff_frame_thread_frame_free() doesn't provide.
Notably, if allocating the AVCodecInternal, the codec's private data
or setting the options fails, the codec's close function will be
called (if there is one); it will also be called if the codec's init
function fails, regardless of whether the FF_CODEC_CAP_INIT_CLEANUP
is set. This is not supported by all codecs; in ticket #9099 it led
to a crash.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/pthread_frame: Factor initializing single thread out
Andreas Rheinhardt [Sun, 21 Mar 2021 04:00:09 +0000 (05:00 +0100)]
avcodec/pthread_frame: Factor initializing single thread out

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/libmodplug: Fix memleaks on error
Andreas Rheinhardt [Wed, 24 Mar 2021 05:31:16 +0000 (06:31 +0100)]
avformat/libmodplug: Fix memleaks on error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/libgme: Remove redundant setting of packet size
Andreas Rheinhardt [Wed, 24 Mar 2021 04:26:37 +0000 (05:26 +0100)]
avformat/libgme: Remove redundant setting of packet size

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/libgme: Actually set the duration
Andreas Rheinhardt [Wed, 24 Mar 2021 04:24:03 +0000 (05:24 +0100)]
avformat/libgme: Actually set the duration

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/libgme: Fix memleaks on errors
Andreas Rheinhardt [Wed, 24 Mar 2021 03:41:58 +0000 (04:41 +0100)]
avformat/libgme: Fix memleaks on errors

Also free the gme_info_t structure immediately after its use.
This simplifies cleanup, because it might be unsafe to call
gme_free_info(NULL) (or even worse, gme_track_info() might even
on error set the pointer to the gme_info_t structure to something
else than NULL).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/aadec: Fix leak on error
Andreas Rheinhardt [Wed, 24 Mar 2021 02:23:37 +0000 (03:23 +0100)]
avformat/aadec: Fix leak on error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/jacosubdec: Fix leak on error
Andreas Rheinhardt [Wed, 24 Mar 2021 02:15:33 +0000 (03:15 +0100)]
avformat/jacosubdec: Fix leak on error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolavfi/dnn_backend_tensorflow.c: fix mem leak in execute_model_tf
Ting Fu [Wed, 24 Mar 2021 07:39:28 +0000 (15:39 +0800)]
lavfi/dnn_backend_tensorflow.c: fix mem leak in execute_model_tf

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agolavfi/dnn_backend_tensorflow.c: fix mem leak in load_native_model
Ting Fu [Wed, 24 Mar 2021 07:39:27 +0000 (15:39 +0800)]
lavfi/dnn_backend_tensorflow.c: fix mem leak in load_native_model

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agolavfi/dnn_backend_tensorflow.c: fix mem leak in load_tf_model
Ting Fu [Wed, 24 Mar 2021 07:39:26 +0000 (15:39 +0800)]
lavfi/dnn_backend_tensorflow.c: fix mem leak in load_tf_model

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agoavfilter/overlay_cuda: fix framesync with embedded PGS subtitle
nyanmisaka [Tue, 2 Feb 2021 17:10:11 +0000 (01:10 +0800)]
avfilter/overlay_cuda: fix framesync with embedded PGS subtitle

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
3 years agoavfilter/hwupload_cuda: add YUVA420P format support
nyanmisaka [Tue, 2 Feb 2021 17:09:52 +0000 (01:09 +0800)]
avfilter/hwupload_cuda: add YUVA420P format support

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
3 years agoMAINTAINERS: add myself as adpcm maintainer
Zane van Iperen [Tue, 23 Mar 2021 11:20:22 +0000 (21:20 +1000)]
MAINTAINERS: add myself as adpcm maintainer

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavformat/pp_bnk: allow seeking to start
Zane van Iperen [Tue, 23 Mar 2021 11:51:57 +0000 (21:51 +1000)]
avformat/pp_bnk: allow seeking to start

Allows "ffplay -loop" to work.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavformat/alp: allow seeking to start
Zane van Iperen [Mon, 22 Mar 2021 13:12:34 +0000 (23:12 +1000)]
avformat/alp: allow seeking to start

Allows "ffplay -loop" to work.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavformat/kvag: allow seeking to start
Zane van Iperen [Mon, 22 Mar 2021 12:44:56 +0000 (22:44 +1000)]
avformat/kvag: allow seeking to start

Allows "ffplay -loop" to work.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_ima_cunning: reset state on flush
Zane van Iperen [Tue, 23 Mar 2021 11:42:46 +0000 (21:42 +1000)]
avcodec/adpcm_ima_cunning: reset state on flush

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_ima_alp: reset state on flush
Zane van Iperen [Tue, 23 Mar 2021 11:05:42 +0000 (21:05 +1000)]
avcodec/adpcm_ima_alp: reset state on flush

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_ima_ssi: reset state on flush
Zane van Iperen [Tue, 23 Mar 2021 11:05:16 +0000 (21:05 +1000)]
avcodec/adpcm_ima_ssi: reset state on flush

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_argo: reset state on flush
Zane van Iperen [Tue, 23 Mar 2021 10:58:33 +0000 (20:58 +1000)]
avcodec/adpcm_argo: reset state on flush

Commit 003b5c800fef909fa84dd2fae43d66bd434d3f7e introduced seeking in argo_asf,
but this was missed, leading to non-deterministic output.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_aica: reset state in flush callback
Zane van Iperen [Tue, 23 Mar 2021 10:55:17 +0000 (20:55 +1000)]
avcodec/adpcm_aica: reset state in flush callback

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_zork: reset state in flush callback
Zane van Iperen [Tue, 23 Mar 2021 10:52:16 +0000 (20:52 +1000)]
avcodec/adpcm_zork: reset state in flush callback

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm: add comment to has_status field
Zane van Iperen [Tue, 23 Mar 2021 11:01:16 +0000 (21:01 +1000)]
avcodec/adpcm: add comment to has_status field

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/kmvc: Avoid branch when swapping pointers
Andreas Rheinhardt [Mon, 22 Mar 2021 01:40:20 +0000 (02:40 +0100)]
avcodec/kmvc: Avoid branch when swapping pointers

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/kmvc: Move commonly used variables to the front of the context
Andreas Rheinhardt [Mon, 22 Mar 2021 01:28:11 +0000 (02:28 +0100)]
avcodec/kmvc: Move commonly used variables to the front of the context

Reduces codesize because the offset in pointer+offset addressing
requires less bytes to encode. Reduces the size of .text from 8871B
to 8146B (GCC 10, -O3, x64).

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/kmvc: Prefer in-band palette
Andreas Rheinhardt [Mon, 22 Mar 2021 01:14:35 +0000 (02:14 +0100)]
avcodec/kmvc: Prefer in-band palette

Fixes decoding of https://samples.ffmpeg.org/V-codecs/KMVC/LOGO2.AVI

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/vc1dec: Postpone allocating sprite frame to avoid segfault
Andreas Rheinhardt [Tue, 22 Dec 2020 16:21:48 +0000 (17:21 +0100)]
avcodec/vc1dec: Postpone allocating sprite frame to avoid segfault

Up until now, the VC-1 decoders allocated an AVFrame for usage with
sprites during vc1_decode_init(); yet said AVFrame can be freed if
(re)initializing the context (which happens ordinarily during decoding)
fails. The AVFrame does not get allocated again lateron in this case,
leading to segfaults.

Fix this by moving the allocation of said frame immediately before it is
used (this also means that said frame won't be allocated at all any more
in case of a regular (i.e. non-image) stream).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodoc/filters: fix option name for mix filter
Gyan Doshi [Wed, 24 Mar 2021 11:22:02 +0000 (16:52 +0530)]
doc/filters: fix option name for mix filter

Corrected from nb_inputs to inputs

3 years agoavutil/frame: Deprecate av_get_colorspace_name()
Andreas Rheinhardt [Sun, 21 Mar 2021 09:15:44 +0000 (10:15 +0100)]
avutil/frame: Deprecate av_get_colorspace_name()

Contrary to av_color_space_name() it doesn't even support newer
colorspaces.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Use AVBPrint in avcodec_string()
Andreas Rheinhardt [Sun, 21 Mar 2021 07:05:14 +0000 (08:05 +0100)]
avcodec/avcodec: Use AVBPrint in avcodec_string()

It automatically records the current length of the string,
whereas the current code contains lots of instances of
snprintf(buf + strlen(buf), buf_size - strlen(buf), ...).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Update check for identical colorspace/primaries/trc names
Andreas Rheinhardt [Sun, 21 Mar 2021 06:26:17 +0000 (07:26 +0100)]
avcodec/avcodec: Update check for identical colorspace/primaries/trc names

If the numerical constants for colorspace, transfer characteristics
and color primaries coincide, the current code presumes the
corresponding names to be identical and prints only one of them obtained
via av_get_colorspace_name(). There are two issues with this: The first
is that the underlying assumption is wrong: The names only coincide in
the 0-7 range, they differ for more recent additions. The second is that
av_get_colorspace_name() is outdated itself; it has not been updated
with the names of the newly defined colorspaces.

Fix both of this by using the names from
av_color_(space|primaries|transfer)_name() and comparing them via
strcmp; don't use av_get_colorspace_name() at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Don't use NULL for %s printf specifier
Andreas Rheinhardt [Sun, 21 Mar 2021 05:29:13 +0000 (06:29 +0100)]
avcodec/avcodec: Don't use NULL for %s printf specifier

Our "get name" functions can return NULL for invalid/unknown
arguments. So check for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Use dedicated pointer to access AVCodecInternal
Andreas Rheinhardt [Sun, 21 Mar 2021 05:06:12 +0000 (06:06 +0100)]
avcodec/avcodec: Use dedicated pointer to access AVCodecInternal

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agotests/dnn/dnn-layer-mathunary-test: add unit test for exp
Wenlong Ding [Mon, 22 Mar 2021 08:20:12 +0000 (16:20 +0800)]
tests/dnn/dnn-layer-mathunary-test: add unit test for exp

Signed-off-by: Wenlong Ding <wenlong.ding@intel.com>
3 years agolavfi/dnn/dnn_backend_native_layer_mathunary: add exp support
Wenlong Ding [Mon, 22 Mar 2021 08:20:11 +0000 (16:20 +0800)]
lavfi/dnn/dnn_backend_native_layer_mathunary: add exp support

Signed-off-by: Wenlong Ding <wenlong.ding@intel.com>
3 years agoavformat/amvenc: Remove unnecessary av_packet_free()
Andreas Rheinhardt [Thu, 18 Mar 2021 05:29:35 +0000 (06:29 +0100)]
avformat/amvenc: Remove unnecessary av_packet_free()

The muxer's deinit function takes care of cleaning up when init fails.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/webpenc: Fix memleak when trailer is never written
Andreas Rheinhardt [Thu, 18 Mar 2021 22:27:57 +0000 (23:27 +0100)]
avformat/webpenc: Fix memleak when trailer is never written

When the trailer is never written (or when a stream switches from
non-animation mode to animation mode mid-stream), a cached packet
(if existing) would leak. Fix this by adding a deinit function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/webpenc: Reindentation
Andreas Rheinhardt [Thu, 18 Mar 2021 22:16:30 +0000 (23:16 +0100)]
avformat/webpenc: Reindentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/webpenc: Fix memleak when using invalid packets
Andreas Rheinhardt [Thu, 18 Mar 2021 22:04:37 +0000 (23:04 +0100)]
avformat/webpenc: Fix memleak when using invalid packets

The WebP muxer sometimes caches a packet it receives to write it later;
yet if a cached packet is too small (so small as to be invalid),
it is cached, but not written and not unreferenced. Such a packet leaks,
either by being overwritten by the next packet or because it is never
unreferenced at all.

Fix this by not caching unusable packets at all; and error out on
invalid packets.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/webpenc: Use init instead of write_header function
Andreas Rheinhardt [Thu, 18 Mar 2021 21:15:36 +0000 (22:15 +0100)]
avformat/webpenc: Use init instead of write_header function

webp_write_header() didn't write anything.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Avoid stack packet
Andreas Rheinhardt [Thu, 18 Mar 2021 20:35:58 +0000 (21:35 +0100)]
avformat/ipmovie: Avoid stack packet

Replace it in ipmovie_read_header() by AVFormatInternal.parse_pkt
which is unused when reading the header.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Remove redundant initializations
Andreas Rheinhardt [Thu, 18 Mar 2021 20:42:26 +0000 (21:42 +0100)]
avformat/ipmovie: Remove redundant initializations

The demuxer's context has already been zeroed generically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Fix indentation
Andreas Rheinhardt [Thu, 18 Mar 2021 20:11:43 +0000 (21:11 +0100)]
avformat/ipmovie: Fix indentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Deduplicate parsing video data opcodes
Andreas Rheinhardt [Thu, 18 Mar 2021 20:03:15 +0000 (21:03 +0100)]
avformat/ipmovie: Deduplicate parsing video data opcodes

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Avoid reading packets during read_header
Andreas Rheinhardt [Thu, 18 Mar 2021 19:29:42 +0000 (20:29 +0100)]
avformat/ipmovie: Avoid reading packets during read_header

They will be discarded anyway because this can only happen
for invalid data. This already implies that the pkt won't be used
at all when parsing the very first chunk when reading the header,
so one can use NULL as argument and remove the av_packet_unref()
on error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Remove redundant av_packet_unref()
Andreas Rheinhardt [Thu, 18 Mar 2021 18:55:55 +0000 (19:55 +0100)]
avformat/ipmovie: Remove redundant av_packet_unref()

When one of these errors happens during ipmovie_read_packet(),
an error is returned and the packet is cleaned up generically.
And since 712d3ac539f30239b764d8621829dc9dc913da61 the same happens
in ipmovie_read_header().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/asfdec_f: Avoid stack packet
Andreas Rheinhardt [Thu, 18 Mar 2021 18:11:40 +0000 (19:11 +0100)]
avformat/asfdec_f: Avoid stack packet

Replace it by using AVFormatInternal.parse_pkt which is otherwise unused
when reading a header.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/moflex: Simplify freeing packets
Andreas Rheinhardt [Thu, 18 Mar 2021 14:43:54 +0000 (15:43 +0100)]
avformat/moflex: Simplify freeing packets

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/matroskadec: Reuse AVFormatInternal.parse_pkt
Andreas Rheinhardt [Thu, 18 Mar 2021 05:04:17 +0000 (06:04 +0100)]
avformat/matroskadec: Reuse AVFormatInternal.parse_pkt

Before 8d78e90a6ba96646f7f25aff6ca3e12e71cec164 the Matroska demuxer
used stack packets to hold temporary packets; now it uses a temporary
packet allocated by the Matroska demuxer. Yet because it used stack
packets the code has always properly reset the packet on error, while
on success these temporary packets were put into a packet list via
avpriv_packet_list_put(), which already resets the source packet.
This means that this code is compatible with just reusing
AVFormatInternal.parse_pkt (which is unused while one is in the
demuxer's read_packet() function). Compared to before 8d78e90a6
this no longer wastes one initialization per AVPacket read
(the resetting of the stack packet performed by av_packet_move_ref()
in avpriv_packet_list_put() was for naught).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/rtpdec: attach producer reference time if available
Alok Priyadarshi [Tue, 23 Mar 2021 21:29:48 +0000 (14:29 -0700)]
avformat/rtpdec: attach producer reference time if available

This produces true wallclock time at rtp source instead of the
local wallclock time at rtp client.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolavc/mjpegdec: Decode format 211121 as YUV 4:4:4
Carl Eugen Hoyos [Sun, 21 Mar 2021 00:36:32 +0000 (01:36 +0100)]
lavc/mjpegdec: Decode format 211121 as YUV 4:4:4

Fixes ticket #8930.

3 years agoavformat/utils: Don't allocate separate packet for extract_extradata
Andreas Rheinhardt [Thu, 18 Mar 2021 04:23:54 +0000 (05:23 +0100)]
avformat/utils: Don't allocate separate packet for extract_extradata

One can simply reuse AVFormatInternal.parse_pkt instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolibavformat/utils: Fix indentation
Andreas Rheinhardt [Fri, 19 Mar 2021 03:32:41 +0000 (04:32 +0100)]
libavformat/utils: Fix indentation

Originally added in 12f996edfab67b65af0ff1ee829f9eeabb025b0f
behind #if 0; aebb56e1844d61965c97e95534c3ae0da69df028 then
removed the #if and replaced it by using av_dlog. Then commit
1a3eb042c704dea190c644def5b32c9cee8832b8 replaced this with av_log
at trace level. Yet the code block always stayed within { }
at an increased level of indentation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/svq3: Don't copy watermarked frame data twice
Andreas Rheinhardt [Sat, 20 Mar 2021 17:58:23 +0000 (18:58 +0100)]
avcodec/svq3: Don't copy watermarked frame data twice

The SVQ3 decoder modifies the input bitstream at two places.
One of them is only reached when the file is watermarked.
Therefore commit 2264c1108135380c49fdf0aef97520bf77a6ed37
made a copy of all the frame data in this case.

But there is a second possibility for modifying the frame and
therefore Libav commit 1098f5c0495c61a98d4ff6b8e24c17974d4bace5
made the decoder always copy the data. This of course makes
the additional copy for watermarked frames redundant, but it hasn't
been removed. This commit does so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/svq3: Use av_fast_padded_malloc() instead of av_fast_malloc()
Andreas Rheinhardt [Sat, 20 Mar 2021 17:39:38 +0000 (18:39 +0100)]
avcodec/svq3: Use av_fast_padded_malloc() instead of av_fast_malloc()

It takes care of zeroing padding (which has been forgotten here).
Also rename the size variable to indicate that this is not the size
of the current slice.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/s337m: Use av_get_packet() to read packet
Andreas Rheinhardt [Sat, 20 Mar 2021 03:39:27 +0000 (04:39 +0100)]
avformat/s337m: Use av_get_packet() to read packet

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/s337m: Use and test Dolby-E-parser
Andreas Rheinhardt [Fri, 19 Mar 2021 16:04:23 +0000 (17:04 +0100)]
avformat/s337m: Use and test Dolby-E-parser

This makes av_read_frame() return packets with proper timestamps.
As a result, seeking now works in combination with streamcopy.
A FATE-test for this has been added.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/utils: Fix confusing return value for ff_read_packet()
Andreas Rheinhardt [Fri, 12 Mar 2021 10:00:32 +0000 (11:00 +0100)]
avformat/utils: Fix confusing return value for ff_read_packet()

Currently, ff_read_packet() sometimes forwards the return value of
AVInputFormat.read_packet() (which should be zero on success, but isn't
for all demuxers) and sometimes it overwrites this with zero.
Furthermore, it uses two variables, one for the read_packet return value
and one for other errors, which is a bit confusing; it is also
unnecessary given that the documentation explicitly states that
ff_read_packet() never returns positive values. Returning a positive
value would lead to leaks with some callers (namely asfrtp_parse_packet
and estimate_timings_from_pts). So always return zero in case of
success.

(This behaviour stems from a time before av_read_packet sanitized
the return value of read_packet at all: It was added in commit
626004690c23c981f67228ea325dde3f35193988 and was unnecessary since
88b00723906f68b7563214c30333e48888dddf78.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec: Factor updating palette out
Andreas Rheinhardt [Wed, 17 Mar 2021 21:43:32 +0000 (22:43 +0100)]
avcodec: Factor updating palette out

Because the properties of frames returned from ff_get/reget_buffer
are not reset at all, lots of returned frames had palette_has_changed
wrongly set to 1. This has been changed, too.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/apetag: Avoid stack packet when reading attached picture
Andreas Rheinhardt [Thu, 18 Mar 2021 16:02:39 +0000 (17:02 +0100)]
avformat/apetag: Avoid stack packet when reading attached picture

Read it directly into AVStream.attached_pic.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat: remove FF_API_INIT_PACKET from AVStream.attached_pic
James Almer [Sun, 21 Mar 2021 21:47:27 +0000 (18:47 -0300)]
avformat: remove FF_API_INIT_PACKET from AVStream.attached_pic

This field needs to be replaced altogether, not just its type changed.
This will be done in a separate change.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoFATE: Add test for probing MOV/MP4 files with extended box sizes
Derek Buitenhuis [Thu, 18 Mar 2021 16:12:08 +0000 (16:12 +0000)]
FATE: Add test for probing MOV/MP4 files with extended box sizes

The test sample has to have no file extension, otherwise probing
happens to work, based off file extension alone, and we want to
test the actual probing function.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavformat/mov: Fix extended atom size buffer length check
Derek Buitenhuis [Thu, 18 Mar 2021 15:26:54 +0000 (15:26 +0000)]
avformat/mov: Fix extended atom size buffer length check

When extended atom size support was added to probing in
fec4a2d232d7ebf6d1084fb568d4d84844f25abc, the buffer
size check was backwards, but probing continued to work
because there was no minimum size check yet, so despite
size being 1 on these atoms, and failing to read the 64-bit
size, the tag was still correctly read.

When 0b78016b2d7c36b32d07669c0c86bc4b4225ec98 introduced a
minimum size check, this exposed the bug, and broke probing
any files with extended atom sizes, such as entirely valid
large files that start whith mdat atoms.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavformat/rtp_mpegts: typedef MuxChain struct
Gyan Doshi [Thu, 18 Mar 2021 12:33:28 +0000 (18:03 +0530)]
avformat/rtp_mpegts: typedef MuxChain struct

3 years agoconfigure: select child muxers for rtp_mpegts
Gyan Doshi [Thu, 18 Mar 2021 12:02:46 +0000 (17:32 +0530)]
configure: select child muxers for rtp_mpegts

3 years agolavc/aomenc: Force default qmax of 0 if crf was set to 0.
Carl Eugen Hoyos [Sat, 20 Mar 2021 18:27:48 +0000 (19:27 +0100)]
lavc/aomenc: Force default qmax of 0 if crf was set to 0.

Fixes lossless encoding without setting qmax to 0.

3 years agolavf/swfdec: Allow decoding Nellymoser in swf.
Carl Eugen Hoyos [Tue, 16 Mar 2021 20:11:45 +0000 (21:11 +0100)]
lavf/swfdec: Allow decoding Nellymoser in swf.

Such files exist in the wild, see ticket #9153.

3 years agoavformat/pp_bnk: Fix memleaks when reading non-stereo tracks
Andreas Rheinhardt [Sat, 20 Mar 2021 06:43:09 +0000 (07:43 +0100)]
avformat/pp_bnk: Fix memleaks when reading non-stereo tracks

Commit 6973df112275c8ea4af0bf3cb1338baecc1d06b3 added support
for music tracks by outputting its two containing tracks
together in one packet. But the actual data is not contiguous
in the file and therefore one can't simply use av_get_packet()
(which has been used before) for it. Therefore the packet was
now allocated via av_new_packet() and read via avio_read();
and this is also for non-music files.

This causes problems because one can now longer rely on things
done automatically by av_get_packet(): It automatically freed
the packet in case of errors; this lead to memleaks in several
FATE-tests covering this demuxer. Furthermore, in case the data
read is less than the data desired, the returned packet was not
zero-allocated (the packet's padding was uninitialized);
for music files the actual data could even be uninitialized.

The former problems are fixed by using av_get_packet() for
non-music files; the latter problem is handled by erroring out
unless both tracks could be fully read.

Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/utils: Always leave parse_pkt in blank state, avoid resetting
Andreas Rheinhardt [Thu, 18 Mar 2021 03:59:54 +0000 (04:59 +0100)]
avformat/utils: Always leave parse_pkt in blank state, avoid resetting

Always leaving said packet in a blank state after having used it
allows to avoid having to reset it before one uses it; and it also
allows to use it in more places than just in parse_packet() here.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>