]> git.sesse.net Git - ffmpeg/log
ffmpeg
4 years agoRevert "avfilter/vf_framerate: if metadata lavfi.scd.mafd exists, we'll use it first"
Marton Balint [Thu, 14 May 2020 20:49:01 +0000 (22:49 +0200)]
Revert "avfilter/vf_framerate: if metadata lavfi.scd.mafd exists, we'll use it first"

This reverts commit 339593ca90cb3e05d659ec99a1479904ec742294.

Fixes null pointer dereference.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoRevert "avfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it...
Marton Balint [Thu, 14 May 2020 20:53:14 +0000 (22:53 +0200)]
Revert "avfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it first"

This reverts commit d88e1c9838dbcfe29d7835f2705ffc9ee6a36bf3.

Fixes null pointer dereference.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agocheckasm: add hscale test
Josh de Kock [Wed, 13 May 2020 15:02:53 +0000 (16:02 +0100)]
checkasm: add hscale test

This tests the hscale 8bpp to 14/18bpp functions with different filter
sizes.

Signed-off-by: Josh de Kock <josh@itanimul.li>
4 years agocheckasm: add function to check and diff memory
Martin Storsjö [Thu, 20 Jun 2019 20:38:06 +0000 (23:38 +0300)]
checkasm: add function to check and diff memory

This was ported from dav1d (c950e7101bdf5f7117bfca816984a21e550509f0).

Signed-off-by: Josh de Kock <josh@itanimul.li>
4 years agoswscale: fix NEON hscale init
Josh de Kock [Thu, 7 May 2020 11:01:16 +0000 (12:01 +0100)]
swscale: fix NEON hscale init

The NEON hscale function only supports X8 filter sizes and should only
be selected when these are being used. At the moment filterAlign is
set to 8 but in the future when extra NEON assembly for specific sizes is
added they will need to have checks here too.

The immediate usecase for this change is making the hscale checkasm
test easier and without NEON specific edge-cases (x86 already has these
guards).

Signed-off-by: Josh de Kock <josh@itanimul.li>
4 years agoavcodec/nvenc: use framerate if available
Zachariah Brown [Thu, 14 May 2020 18:15:33 +0000 (14:15 -0400)]
avcodec/nvenc: use framerate if available

The h264_nvenc and hevc_nvenc encoders aren't respecting the framerate in the codec context.
Instead it was using the timebase which in our use-case was 1/1000 so the encoder was behaving
as if we wanted 1000fps. This resulted in poor encoding results due to an extremely low bitrate.

Both the amf and qsv encoders already contain similar logic to first check the framerate before
falling back to the timebase.

Signed-off-by: Zachariah Brown <zachariah@renewedvision.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
4 years agoavcodec/option_table: mark venc_params as a video decoder flag opt type
James Almer [Tue, 12 May 2020 14:08:25 +0000 (11:08 -0300)]
avcodec/option_table: mark venc_params as a video decoder flag opt type

It's not meant for audio or subtitles, or for encoders of any kind.

Reviewed-by: mypopy@gmail.com <mypopy@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agohwcontext_vulkan: fix incorrect print argument
Lynne [Thu, 14 May 2020 17:22:55 +0000 (18:22 +0100)]
hwcontext_vulkan: fix incorrect print argument

4 years agoFATE: add fate test for minterpolate filter
Limin Wang [Fri, 20 Sep 2019 03:08:36 +0000 (11:08 +0800)]
FATE: add fate test for minterpolate filter

have tested on linux x86_32/64, mingw32/64 arm & mips qemu

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_minterpolate: change the default threshold to get better scene change...
Limin Wang [Fri, 20 Sep 2019 03:08:35 +0000 (11:08 +0800)]
avfilter/vf_minterpolate: change the default threshold to get better scene change detect result

 ./ffmpeg -loglevel debug -i ../fate-suite/svq3/Vertical400kbit.sorenson3.mov -vf
 minterpolate=fps=60:mi_mode=blend -an -f null -
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 1600
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 4120
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 5780
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 6700
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 8140
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 9740
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 14060
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 15680
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 18480
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 20020
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 21740

 The results are consistent with tests/ref/fate/filter-metadata-scenedetect

 For the master, it'll detect more than 20 scene change for the same source.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_minterpolate: correct the mafd calculation
Limin Wang [Fri, 20 Sep 2019 12:08:35 +0000 (20:08 +0800)]
avfilter/vf_minterpolate: correct the mafd calculation

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agofate: add scdet metadata test
Limin Wang [Tue, 8 Oct 2019 15:28:39 +0000 (23:28 +0800)]
fate: add scdet metadata test

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it first
Limin Wang [Tue, 8 Oct 2019 15:28:38 +0000 (23:28 +0800)]
avfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it first

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_framerate: if metadata lavfi.scd.mafd exists, we'll use it first
Limin Wang [Tue, 8 Oct 2019 15:28:37 +0000 (23:28 +0800)]
avfilter/vf_framerate: if metadata lavfi.scd.mafd exists, we'll use it first

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_scdet: add filter to detect scene change
Limin Wang [Tue, 8 Oct 2019 15:28:36 +0000 (23:28 +0800)]
avfilter/vf_scdet: add filter to detect scene change

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/mpegtsenc: Remove two duplicated fields
Andriy Gelman [Thu, 30 Apr 2020 19:43:40 +0000 (15:43 -0400)]
avformat/mpegtsenc: Remove two duplicated fields

ts->{tsid,onid} stores the values of ts->{transport_stream_id,original_network_id}

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavformat/mpegtsenc: Don't use heap allocated array to store pids
Andriy Gelman [Thu, 30 Apr 2020 18:50:00 +0000 (14:50 -0400)]
avformat/mpegtsenc: Don't use heap allocated array to store pids

A temporary heap array currently stores pids from all streams.  It is
used to make sure there are no duplicated pids. However, this array is
not needed because the pids from past streams are stored in the
MpegTSWriteStream structs.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoFATE: add a test for colorbalance
Limin Wang [Fri, 15 Nov 2019 15:12:49 +0000 (23:12 +0800)]
FATE: add a test for colorbalance

Tested on x86-32/64, mingw32/64, arm & mips qemu

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_colorbalance:: Fix for framecrc bitexact for 32bit and 64bit system
lance.lmwang@gmail.com [Fri, 15 Nov 2019 15:12:48 +0000 (23:12 +0800)]
avfilter/vf_colorbalance:: Fix for framecrc bitexact for 32bit and 64bit system

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/mv30: fix warning: suggest braces around initialization of subobject [-Wmissi...
Limin Wang [Tue, 12 May 2020 15:07:05 +0000 (23:07 +0800)]
avcodec/mv30: fix warning: suggest braces around initialization of subobject [-Wmissing-braces]

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/tls_schannel: immediately return decrypted data if available
Jan Ekström [Tue, 12 May 2020 21:31:03 +0000 (00:31 +0300)]
avformat/tls_schannel: immediately return decrypted data if available

Until now, we would have only attempted to utilize already decrypted
data if it was enough to fill the size of buffer requested, that could
very well be up to 32 kilobytes.

With keep-alive connections this would just lead to recv blocking
until rw_timeout had been reached, as the connection would not be
officially closed after each transfer. This would also lead to a
loop, as such timed out I/O request would just be attempted again.

By just returning the available decrypted data, keep-alive based
connectivity such as HLS playback is fixed with schannel.

4 years agoavformat/tls_schannel: always decrypt all received data
Jan Ekström [Tue, 12 May 2020 21:27:58 +0000 (00:27 +0300)]
avformat/tls_schannel: always decrypt all received data

The dec_buf seems to be properly managed between read calls,
and we have no logic to decrypt before attempting socket I/O.
Thus - until now - such data would not be decrypted in case of
connections such as HTTP keep-alive, as the recv call would
always get executed first, block until rw_timeout, and then get
retried by retry_transfer_wrapper.

Thus - if data is received - decrypt all of it right away. This way
it is available for the following requests in case they can be
satisfied with it.

4 years agopixblockdsp, avdct: Add get_pixels_unaligned
Martin Storsjö [Tue, 12 May 2020 08:22:45 +0000 (11:22 +0300)]
pixblockdsp, avdct: Add get_pixels_unaligned

Use this in vf_spp.c, where the get_pixels operation is done on
unaligned source addresses.

Hook up the x86 (mmx and sse) versions of get_pixels to this
function pointer, as those implementations seem to support unaligned
use.

This fixes fate-filter-spp on armv7.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoavcodec/adpcm: Fix integer overflow in ADPCM THP
Michael Niedermayer [Wed, 12 Feb 2020 20:30:08 +0000 (21:30 +0100)]
avcodec/adpcm: Fix integer overflow in ADPCM THP

The reference (thp.txt) uses floats so wrap around would seem incorrect.

Fixes: signed integer overflow: 1073741824 + 1073741824 cannot be represented in type 'int'
Fixes: 20658/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_THP_fuzzer-5646302555930624
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 agolavc/libopenh264enc: Add coder option to replace cabac
Linjie Fu [Wed, 6 May 2020 13:47:52 +0000 (21:47 +0800)]
lavc/libopenh264enc: Add coder option to replace cabac

Set DEPRECATED flag to option cabac, replace with coder. The
priority logic is:
1. s->coder; then
2. avctx->coder_type; then
3. s->cabac.

Change the default option to -1 and allow the default cabac to be
determined by profile.

Add FF_API_OPENH264_CABAC macro for cabac to remove this option after
LIBAVCODEC_VERSION_MAJOR = 59.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
4 years agolavc/libopenh264enc: Allow specifying the profile through AVCodecContext
Linjie Fu [Wed, 6 May 2020 13:47:51 +0000 (21:47 +0800)]
lavc/libopenh264enc: Allow specifying the profile through AVCodecContext

And determine the profile with following priority:
1. s->profile; then
2. avctx->profile; then
3. s->cabac; then
4. a default profile.

This seems more natural in case user somehow sets both avctx->profile and
s->profile.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
4 years agolavc/libopenh264enc: Rewrite profile handling
Linjie Fu [Wed, 6 May 2020 13:47:50 +0000 (21:47 +0800)]
lavc/libopenh264enc: Rewrite profile handling

Support the profiles "constrained_baseline" and "high" for libopenh264
version >= 1.8, support "constrained_baseline" and "main" for earlier
version.

If option not supported with current version, convert to constrained
baseline with a warning for users.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
4 years agohwcontext_vulkan: don't add the optional VK_KHR_surface extension by default
Lynne [Tue, 12 May 2020 19:40:29 +0000 (20:40 +0100)]
hwcontext_vulkan: don't add the optional VK_KHR_surface extension by default

Both API and CLI users can enable any extension they'd like using the options.

4 years agohwcontext_vulkan: don't error on unavailable user-specified extensions
Lynne [Tue, 12 May 2020 19:08:46 +0000 (20:08 +0100)]
hwcontext_vulkan: don't error on unavailable user-specified extensions

Only warn instead. API users can find out which extensions were unavailable
by using the enabled_inst_extensions and enabled_dev_extensions fields.
This eliminates having to trial-and-error to find which extensions were missing.

4 years agohwcontext_vulkan: use the maximum amount of queues for each family
Lynne [Tue, 12 May 2020 19:01:25 +0000 (20:01 +0100)]
hwcontext_vulkan: use the maximum amount of queues for each family

Due to our AVHWDevice infrastructure, where API users are offered a way
to derive contexts rather than always create new one, our filterchains,
being supported by a single hardware device context, can grow to considerable
size.
Hence, in such situations, using the maximum amount of queues the device offers
can be benefitial to eliminating bottlenecks where queue submissions on the
same family have to wait for the previous one to finish.

4 years agohwcontext_vulkan: update prepare_frame() for multiple semaphores when exporting
Lynne [Tue, 12 May 2020 18:08:54 +0000 (19:08 +0100)]
hwcontext_vulkan: update prepare_frame() for multiple semaphores when exporting

4 years agoavcodec/ralf: Check num_blocks before use
Michael Niedermayer [Mon, 11 May 2020 20:17:43 +0000 (22:17 +0200)]
avcodec/ralf: Check num_blocks before use

Fixes: out of array access
Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5739471895265280
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: Test video_size being non zero
Michael Niedermayer [Mon, 11 May 2020 19:18:58 +0000 (21:18 +0200)]
avcodec/iff: Test video_size being non zero

Fixes: Out of array access
Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5658548592967680
Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5723561177382912
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/cdtoons: Check sprite_offset is within the packet
Michael Niedermayer [Mon, 11 May 2020 19:08:17 +0000 (21:08 +0200)]
avcodec/cdtoons: Check sprite_offset is within the packet

Fixes: out of array read
Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDTOONS_fuzzer-5754518731227136
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 agolibavcodec/decode: Mark decode_simple_internal() as inline
Michael Niedermayer [Mon, 11 May 2020 21:58:28 +0000 (23:58 +0200)]
libavcodec/decode: Mark decode_simple_internal() as inline

This was suggested in
https://github.com/google/oss-fuzz/issues/3787
to reduce the grouping errors by oss-fuzz

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/hlsenc: free options fix memleak in hls_write_trailer
Steven Liu [Tue, 12 May 2020 10:04:20 +0000 (18:04 +0800)]
avformat/hlsenc: free options fix memleak in hls_write_trailer

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
4 years agoavformat/hlsenc: fix filename memleak in hls_write_packet
Steven Liu [Tue, 12 May 2020 10:02:26 +0000 (18:02 +0800)]
avformat/hlsenc: fix filename memleak in hls_write_packet

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
4 years agoavformat/hlsenc: move number out of hls_start
Steven Liu [Tue, 12 May 2020 09:59:23 +0000 (17:59 +0800)]
avformat/hlsenc: move number out of hls_start

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
4 years agovp9dec: support exporting QP tables through the AVVideoEncParams API
Anton Khirnov [Mon, 23 Mar 2020 15:09:48 +0000 (16:09 +0100)]
vp9dec: support exporting QP tables through the AVVideoEncParams API

4 years agovp9dec: factorise freeing per-tile allocated data
Anton Khirnov [Mon, 30 Mar 2020 08:26:17 +0000 (10:26 +0200)]
vp9dec: factorise freeing per-tile allocated data

4 years agolavc: add a flag for exporting AVVideoEncParams from decoders
Anton Khirnov [Tue, 10 Mar 2020 10:12:13 +0000 (11:12 +0100)]
lavc: add a flag for exporting AVVideoEncParams from decoders

4 years agovf_showinfo: support AV_FRAME_DATA_VIDEO_ENC_PARAMS
Anton Khirnov [Mon, 23 Mar 2020 11:21:09 +0000 (12:21 +0100)]
vf_showinfo: support AV_FRAME_DATA_VIDEO_ENC_PARAMS

4 years agolibavutil: add API for exporting video frame quantizers
Juan De León [Sat, 29 Feb 2020 12:21:56 +0000 (13:21 +0100)]
libavutil: add API for exporting video frame quantizers

This is intended to replace the deprecated the AV_FRAME_DATA_QP_TABLE*
API and extend it to a wider range of codecs.

In the future, it may also be extended to support other encoding
parameters such as motion vectors.

Additional changes by Anton Khirnov <anton@khirnov.net> with suggestions
by Lynne <dev@lynne.ee>.

Signed-off-by: Juan De León <juandl@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 years agodoc/examples/muxing: convert to new encoding API
Anton Khirnov [Sat, 11 Apr 2020 14:02:28 +0000 (16:02 +0200)]
doc/examples/muxing: convert to new encoding API

4 years agodoc/examples/demuxing_decoding: convert to new decoding API
Anton Khirnov [Sat, 11 Apr 2020 14:02:28 +0000 (16:02 +0200)]
doc/examples/demuxing_decoding: convert to new decoding API

4 years agodoc/examples/demuxing_decoding: drop -refcount
Anton Khirnov [Sat, 11 Apr 2020 14:02:28 +0000 (16:02 +0200)]
doc/examples/demuxing_decoding: drop -refcount

Non-refcounted frames are deprecated and there is no good reason to use
them.

4 years agoavcodec/utvideodec: Fix integer overflow in decode_plane()
Michael Niedermayer [Sun, 10 May 2020 19:16:59 +0000 (21:16 +0200)]
avcodec/utvideodec: Fix integer overflow in decode_plane()

Fixes: signed integer overflow: 2147483594 + 142 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_UTVIDEO_fuzzer-5658568101724160
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/ttadsp: Fix several integer overflows in tta_filter_process_c()
Michael Niedermayer [Sun, 10 May 2020 19:12:22 +0000 (21:12 +0200)]
avcodec/ttadsp: Fix several integer overflows in tta_filter_process_c()

Fixes: signed integer overflow: 1931744255 + 252497024 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TTA_fuzzer-5763348114440192
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/ralf: Fix integer overflow in decode_block()
Michael Niedermayer [Sun, 10 May 2020 18:15:11 +0000 (20:15 +0200)]
avcodec/ralf: Fix integer overflow in decode_block()

Fixes: signed integer overflow: 289082077 - -2003141111 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5196077752123392
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/nuv: widen buf_size type
Michael Niedermayer [Sun, 10 May 2020 17:09:47 +0000 (19:09 +0200)]
avcodec/nuv: widen buf_size type

Fixes: signed integer overflow: 65312 * 65312 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5740176118906880
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 agolibswscale: fix for floating point formats, require full chroma
Mark Reid [Sun, 10 May 2020 23:17:48 +0000 (16:17 -0700)]
libswscale: fix for floating point formats, require full chroma

upon more floating point testing, looks like I missed adding this bit.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agotest: Add codecview test
Michael Niedermayer [Sat, 18 Apr 2020 20:40:49 +0000 (22:40 +0200)]
test: Add codecview test

4 years agotests: Add pp7, spp tests based on pp test
Michael Niedermayer [Sat, 18 Apr 2020 19:28:12 +0000 (21:28 +0200)]
tests: Add pp7, spp tests based on pp test

4 years agoavfilter/vf_spp: Fix endian-dependance in add_block()
Michael Niedermayer [Sat, 18 Apr 2020 22:17:39 +0000 (00:17 +0200)]
avfilter/vf_spp: Fix endian-dependance in add_block()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/vf_spp: Remove unused AVCodecContext
Michael Niedermayer [Sat, 18 Apr 2020 22:09:14 +0000 (00:09 +0200)]
avfilter/vf_spp: Remove unused AVCodecContext

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoRevert "hwcontext_vulkan: only use one semaphore per image"
Lynne [Mon, 11 May 2020 22:27:01 +0000 (23:27 +0100)]
Revert "hwcontext_vulkan: only use one semaphore per image"

This reverts commit 97b526c192add6f252b327245fd9223546867352.
It broke the API, and assumed no other APIs used multiple semaphores.
This also disallowed certain optimizations to happen.

Dealing with APIs that give or expect single semaphores is easier when
we use per-image semaphores.

4 years agoavformat/ivfenc: move bsf insertion to the init function
James Almer [Sun, 10 May 2020 13:50:47 +0000 (10:50 -0300)]
avformat/ivfenc: move bsf insertion to the init function

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/ivfenc: add an AVOutputFormat.init() function
James Almer [Sun, 10 May 2020 13:49:15 +0000 (10:49 -0300)]
avformat/ivfenc: add an AVOutputFormat.init() function

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/iff: Fix several integer overflows
Michael Niedermayer [Sun, 10 May 2020 10:04:05 +0000 (12:04 +0200)]
avcodec/iff: Fix several integer overflows

Fixes: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself
Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int32_t' (aka 'int')
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5764066459254784
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/g729postfilter: Clip gain before scaling with AGC_FAC1
Michael Niedermayer [Sun, 10 May 2020 09:34:53 +0000 (11:34 +0200)]
avcodec/g729postfilter: Clip gain before scaling with AGC_FAC1

The fixed point integer reference specifies the multiplication used
to have 16bit input and clips so we need to clip the input
The floating point implementation does not seem to do that.

Fixes: signed integer overflow: 6317568 * 410 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G729_fuzzer-5700189272932352
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/alac: Fix integer overflow with 24/20bps samples
Michael Niedermayer [Sun, 10 May 2020 09:08:28 +0000 (11:08 +0200)]
avcodec/alac: Fix integer overflow with 24/20bps samples

Fixes: signed integer overflow: 1020048 * 4096 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5753877751660544
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/adpcm: Clip predictor for IMA_APM
Michael Niedermayer [Sun, 10 May 2020 09:03:39 +0000 (11:03 +0200)]
avcodec/adpcm: Clip predictor for IMA_APM

Fixes: signed integer overflow: -2147483647 - 61436 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_APM_fuzzer-5092176004644864
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 agohwcontext_vulkan: convert to general layout and transfer queue when exporting
Lynne [Sun, 10 May 2020 21:00:38 +0000 (22:00 +0100)]
hwcontext_vulkan: convert to general layout and transfer queue when exporting

The specs note that images should be in the GENERAL layout when exporting
for maximum compatibility.
CUDA exported images are handled differently, and the queue is the same,
so we don't need to do that there.

4 years agohwcontext_vulkan: create all images with concurrent sharing mode
Lynne [Sun, 10 May 2020 20:53:39 +0000 (21:53 +0100)]
hwcontext_vulkan: create all images with concurrent sharing mode

As it turns out, we were already assuming and treating all images as if they had
concurrent access mode. This just changes the flag to CONCURRENT, which has less
restrictions than EXCLUSIVE, and fixed validation messages on machines with
multiple queues.
The validation layer didn't pick this up because the machine I was testing on
had only a single queue.

4 years agohwcontext_vulkan: fix inverted condition when exporting images to drm_prime
Lynne [Sun, 10 May 2020 20:30:15 +0000 (21:30 +0100)]
hwcontext_vulkan: fix inverted condition when exporting images to drm_prime

Calling vkGetImageSubresourceLayout is only legal for linear and drm images.

4 years agohwcontext_vulkan: update debugging layer name
Lynne [Sun, 10 May 2020 20:13:55 +0000 (21:13 +0100)]
hwcontext_vulkan: update debugging layer name

4 years agohwcontext_vulkan: remove unused internal REQUIRED extension flag
Lynne [Sun, 10 May 2020 14:17:27 +0000 (15:17 +0100)]
hwcontext_vulkan: remove unused internal REQUIRED extension flag

This is a leftover from an old version which used the 1.0 Vulkan API
with the maintenance extensions being required.

4 years agohwcontext_vulkan: expose enabled device and instance extensions
Lynne [Sun, 10 May 2020 10:47:50 +0000 (11:47 +0100)]
hwcontext_vulkan: expose enabled device and instance extensions

This solves a huge oversight - it lets users reliably use their own
AVVulkanDeviceContext. Otherwise, the extensions supplied and enabled
are not discoverable by anything outside of hwcontext_vulkan.
Also clarifies that any user-supplied VkInstance must be at least 1.1.

4 years agohwcontext_vulkan: let users enable device and instance extensions using options
Lynne [Sun, 10 May 2020 10:26:40 +0000 (11:26 +0100)]
hwcontext_vulkan: let users enable device and instance extensions using options

Also documents all options supported by the hwdevice.
This lets users enable all extensions they need without writing their own
instance initialization code.

4 years agoavformat/hlsenc: Simplify setting base_output_dirname
Andreas Rheinhardt [Fri, 8 May 2020 19:40:29 +0000 (21:40 +0200)]
avformat/hlsenc: Simplify setting base_output_dirname

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Simplify setting basename with av_asprintf()
Andreas Rheinhardt [Wed, 8 Apr 2020 21:41:17 +0000 (23:41 +0200)]
avformat/hlsenc: Simplify setting basename with av_asprintf()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Simplify setting subtitle basename with av_asprintf
Andreas Rheinhardt [Wed, 8 Apr 2020 20:57:50 +0000 (22:57 +0200)]
avformat/hlsenc: Simplify setting subtitle basename with av_asprintf

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Don't cast const away
Andreas Rheinhardt [Sat, 9 May 2020 04:54:56 +0000 (06:54 +0200)]
avformat/hlsenc: Don't cast const away

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Remove redundant initializations
Andreas Rheinhardt [Sat, 9 May 2020 13:59:43 +0000 (15:59 +0200)]
avformat/hlsenc: Remove redundant initializations

For every variantstream vs, vs->packets_written is set to one, only to be
set to zero a few lines below. Given that the relevant structure has
been zeroed during the allocation, this commit removes both assignments.
A redundant initialization for vs->init_range_length has been removed as
well a few lines below. Given that the relevant structure has been
zeroed during the allocation, this commit removes both assignments. A
redundant initialization for vs->init_range_length has been removed as
well.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Don't reset AVIOContext pointer manually a second time
Andreas Rheinhardt [Sat, 9 May 2020 13:34:09 +0000 (15:34 +0200)]
avformat/hlsenc: Don't reset AVIOContext pointer manually a second time

ff_format_io_close() already does it for us.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/vf_signalstats: reindent after last commit
Limin Wang [Mon, 30 Dec 2019 11:09:58 +0000 (19:09 +0800)]
avfilter/vf_signalstats: reindent after last commit

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_signalstats: make the alloc array used for any bit depth
Limin Wang [Mon, 30 Dec 2019 11:09:57 +0000 (19:09 +0800)]
avfilter/vf_signalstats: make the alloc array used for any bit depth

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_signalstats: add SignalstatsContext.maxsize variable
Limin Wang [Mon, 30 Dec 2019 11:09:56 +0000 (19:09 +0800)]
avfilter/vf_signalstats: add SignalstatsContext.maxsize variable

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_signalstats: rename config_props -> config_output
Limin Wang [Mon, 30 Dec 2019 11:09:55 +0000 (19:09 +0800)]
avfilter/vf_signalstats: rename config_props -> config_output

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agofate: add signalstats 8bit and 10bit test
Limin Wang [Mon, 30 Dec 2019 11:09:54 +0000 (19:09 +0800)]
fate: add signalstats 8bit and 10bit test

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/http: Fix for invalid use of av_strtok
Limin Wang [Sat, 18 Apr 2020 04:19:31 +0000 (12:19 +0800)]
avformat/http: Fix for invalid use of av_strtok

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/ftp: Fix for invalid use of av_strtok
Limin Wang [Sat, 18 Apr 2020 04:19:30 +0000 (12:19 +0800)]
avformat/ftp: Fix for invalid use of av_strtok

By the av_strtok() description:
 * On the first call to av_strtok(), s should point to the string to
 * parse, and the value of saveptr is ignored. In subsequent calls, s
 * should be NULL, and saveptr should be unchanged since the previous
 * call.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/wavenc: simplify, use av_rescale_q() instead
Limin Wang [Tue, 28 Apr 2020 03:49:17 +0000 (11:49 +0800)]
avformat/wavenc: simplify, use av_rescale_q() instead

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/vividas: simplify, use av_rescale_q() instead
Limin Wang [Tue, 28 Apr 2020 03:49:16 +0000 (11:49 +0800)]
avformat/vividas: simplify, use av_rescale_q() instead

note it'll cause a small difference in accuracy for the pts, please see the testing result below:
 $ wget http://samples.ffmpeg.org/archive/all/unknown+unknown+unknown+unknown+5029_paramount_en_1250.viv
 $ ./ffmpeg -t 0.04 -i ./unknown+unknown+unknown+unknown+5029_paramount_en_1250.viv -f null -
 old:
 pts: 522
 pts: 1044
 pts: 1567
 pts: 3918
 pts: 8097
 pts: 12277
 pts: 16457
 ...

 new:
 pts: 522
 pts: 1045
 pts: 1567
 pts: 3918
 pts: 8098
 pts: 12278
 pts: 16457
 ...

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agohwcontext_vulkan: optionally enable the VK_KHR_surface extension if available
Lynne [Sun, 10 May 2020 10:21:52 +0000 (11:21 +0100)]
hwcontext_vulkan: optionally enable the VK_KHR_surface extension if available

This allows any phys_device derived to be used as a display rendering device.

4 years agoavcodec/dstdec: Check sample rate
Michael Niedermayer [Thu, 13 Feb 2020 19:56:56 +0000 (20:56 +0100)]
avcodec/dstdec: Check sample rate

Fixes: out of array access
Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5735812071424000
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/decode: remove unused AVCodecInternal compat_decode field
James Almer [Mon, 9 Mar 2020 02:18:16 +0000 (23:18 -0300)]
avcodec/decode: remove unused AVCodecInternal compat_decode field

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/v4l2_context: Finish draining if V4L2_BUF_FLAG_LAST is set
Andriy Gelman [Sat, 9 May 2020 23:34:06 +0000 (19:34 -0400)]
avcodec/v4l2_context: Finish draining if V4L2_BUF_FLAG_LAST is set

V4L2 api can indicate that flushing of the capture buffers is completed
by setting the V4L2_BUF_FLAG_LAST flag.
Use guards because the flag was only defined in Linux v4.2.

Reference:
linux/Documentation/media/uapi/v4l/dev-decoder.rst

    "The client must continue to handle both queues independently,
     similarly to normal decode operation. This includes:
     ...
     - queuing and dequeuing CAPTURE buffers, until a buffer marked with
       the V4L2_BUF_FLAG_LAST flag is dequeued"

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavcodec/v4l2_context: Drop empty packet while draining
Andriy Gelman [Sat, 9 May 2020 23:34:41 +0000 (19:34 -0400)]
avcodec/v4l2_context: Drop empty packet while draining

v4l2_m2m devices may send an empty packet/frame while draining
to indicate that all capture buffers have been flushed.

Currently, the empty packet/frame is not handled correctly:
When encoding, the empty packet is forwarded to the muxer, usually
creating warnings.
When decoding, a reference to the memory is created anyway. Since in
the past this memory contained a decoded frame, it results in an extra
frame being decoded.

This commit discards the empty packet/frame.

References:
linux/Documentation/media/uapi/v4l/dev-decoder.rst:

    "The last buffer may be empty (with :c:type:`v4l2_buffer` bytesused = 0)
     and in that case it must be ignored by the client, as it does not
     contain a decoded frame."

linux/Documentation/media/uapi/media/v4l/vidioc-encoder-cmd.rst:

    "...This buffer may be empty, indicated by the
     driver setting the ``bytesused`` field to 0."

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavcodec/aacdec_template: Pass AVCodecContext seperatly to set_default_channel_config()
Michael Niedermayer [Wed, 15 Apr 2020 18:47:07 +0000 (20:47 +0200)]
avcodec/aacdec_template: Pass AVCodecContext seperatly to set_default_channel_config()

Regression since 4d9b9c5e4637ac15205467f16fcac92a28e18f18
Fixes: Null pointer dereference
Fixes: 21642/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5670101358739456
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/thp: Require a video stream
Michael Niedermayer [Wed, 15 Apr 2020 18:27:27 +0000 (20:27 +0200)]
avformat/thp: Require a video stream

The demuxer code assumes the existence of a video stream

Fixes: assertion failure
Fixes: 21512/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5699660783288320
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/mpeg: Decrease score by 1 for files with very little valid data
Michael Niedermayer [Mon, 13 Apr 2020 22:03:30 +0000 (00:03 +0200)]
avformat/mpeg: Decrease score by 1 for files with very little valid data

Fixes: 8233/PPY6574574605_cut.mp3
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/pngdec: Check length in fdAT
Michael Niedermayer [Tue, 7 Apr 2020 17:29:44 +0000 (19:29 +0200)]
avcodec/pngdec: Check length in fdAT

Fixes: 21089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5135981419429888
Fixes: out of array read
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: Adjust threshold for PNG and APNG
Michael Niedermayer [Tue, 7 Apr 2020 17:42:55 +0000 (19:42 +0200)]
tools/target_dec_fuzzer: Adjust threshold for PNG and APNG

Fixes: Timeout (84sec -> 2sec)
Fixes: 21127/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5098412367413248
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/g2meet: Check tile_width in epic_jb_decode_tile()
Michael Niedermayer [Sun, 5 Apr 2020 20:58:29 +0000 (22:58 +0200)]
avcodec/g2meet: Check tile_width in epic_jb_decode_tile()

Fixes: out of array access
Fixes: 21469/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5199357982015488
Alternatively the arrays can be made bigger or the index can be clipped.
In case a real file with such huge tiles exist we ask the user to upload it.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/hapdec: Check tex_size more strictly and before using it
Michael Niedermayer [Sat, 28 Mar 2020 19:36:00 +0000 (20:36 +0100)]
avcodec/hapdec: Check tex_size more strictly and before using it

Fixes: OOM
Fixes: 20774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5678608951803904
Fixes: 20956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5713643025203200
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 agoconfigure: add missing bsf dependencies to muxers
James Almer [Sat, 9 May 2020 21:52:46 +0000 (18:52 -0300)]
configure: add missing bsf dependencies to muxers

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoconfigure: fix pcm_rechunk_bsf dependency for MXF and GXF muxers
James Almer [Sat, 9 May 2020 21:44:24 +0000 (18:44 -0300)]
configure: fix pcm_rechunk_bsf dependency for MXF and GXF muxers

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavdevice/v4l2enc: Allow writing non-rawvideos to v4l2.
David Manouchehri [Sat, 4 Nov 2017 20:32:41 +0000 (16:32 -0400)]
avdevice/v4l2enc: Allow writing non-rawvideos to v4l2.

Signed-off-by: David Manouchehri <david.manouchehri@riseup.net>
4 years agoavformat/oggenc: Avoid allocating and copying when writing page data
Andreas Rheinhardt [Sat, 2 May 2020 23:06:37 +0000 (01:06 +0200)]
avformat/oggenc: Avoid allocating and copying when writing page data

When the Ogg muxer writes a page, it has to do three things: It needs to
write a page header, then it has to actually copy the page data and then
it has to calculate and write a CRC checksum of both header as well as
data at a certain position in the page header.

To do this, the muxer used a dynamic buffer for both writing as well as
calculating the checksum via an AVIOContext's feature to automatically
calculate checksums on the data it writes. This entails an allocation of
an AVIOContext, of the opaque specific to dynamic buffers and of the
buffer itself (which may be reallocated multiple times) as well as
memcopying the data (first into the AVIOContext's small write buffer,
then into the dynamic buffer's big buffer).

This commit changes this: The page header is no longer written into a
dynamic buffer any more; instead the (small) page header is written into
a small buffer on the stack. The CRC is then calculated directly via
av_crc() on both the page header as well as the page data. Then both the
page header and the page data are written.

Finally, ogg_write_page() can now no longer fail, so it has been
modified to return nothing; this also fixed a bug in the only caller of
this function: It didn't check the return value.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>