]> git.sesse.net Git - ffmpeg/log
ffmpeg
4 years agoswscale: aarch64: Add a NEON implementation of interleaveBytes
Martin Storsjö [Fri, 15 May 2020 07:54:10 +0000 (10:54 +0300)]
swscale: aarch64: Add a NEON implementation of interleaveBytes

This allows speeding up format conversions from yuv420 to nv12.

                             Cortex A53      A72      A73
interleave_bytes_c:             86077.5  51433.0  66972.0
interleave_bytes_neon:          19701.7  23019.2  15859.2
interleave_bytes_aligned_c:     86603.0  52017.2  67484.2
interleave_bytes_aligned_neon:   9061.0   7623.0   6309.0

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agocheckasm: sw_rgb: Add a test for interleaveBytes
Martin Storsjö [Fri, 15 May 2020 08:24:17 +0000 (11:24 +0300)]
checkasm: sw_rgb: Add a test for interleaveBytes

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agolibavcodec: aarch64: Add a NEON implementation of pixblockdsp
Martin Storsjö [Wed, 13 May 2020 11:08:58 +0000 (14:08 +0300)]
libavcodec: aarch64: Add a NEON implementation of pixblockdsp

                        Cortex A53    A72    A73
get_pixels_c:                140.7   87.7   72.5
get_pixels_neon:              46.0   20.0   19.5
get_pixels_unaligned_c:      140.7   87.7   73.0
get_pixels_unaligned_neon:    49.2   20.2   26.2
diff_pixels_c:               209.7  133.7  138.7
diff_pixels_neon:             54.2   31.7   23.5
diff_pixels_unaligned_c:     209.7  134.2  139.0
diff_pixels_unaligned_neon:   68.0   27.7   41.7

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agolibavcodec: arm: Add a NEON implementation of pixblockdsp
Martin Storsjö [Wed, 13 May 2020 10:57:59 +0000 (13:57 +0300)]
libavcodec: arm: Add a NEON implementation of pixblockdsp

                         Cortex A7     A8     A9    A53   A72
get_pixels_c:                144.7  146.0  143.0  137.7   69.0
get_pixels_armv6:            112.0  106.7   90.2   95.0   72.5
get_pixels_neon:              69.0   29.7   68.7   40.2   19.0
get_pixels_unaligned_c:      144.7  146.2  143.0  137.7   69.0
get_pixels_unaligned_neon:    77.0   36.5   72.5   48.5   19.0
diff_pixels_c:               376.7  319.7  265.5  307.7  148.0
diff_pixels_armv6:           179.0  159.5  205.5  139.0  142.0
diff_pixels_neon:             69.0   40.2   77.5   53.2   26.0
diff_pixels_unaligned_c:     376.7  319.7  265.5  307.7  148.0
diff_pixels_unaligned_neon:   85.0   54.5   93.5   66.7   26.0

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agocheckasm: pixblockdsp: Add tests for get_pixels_unaligned and diff_pixels_unaligned
Martin Storsjö [Wed, 13 May 2020 10:15:27 +0000 (13:15 +0300)]
checkasm: pixblockdsp: Add tests for get_pixels_unaligned and diff_pixels_unaligned

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoswscale: arm: fix NEON hscale init
Josh de Kock [Thu, 7 May 2020 11:01:16 +0000 (12:01 +0100)]
swscale: arm: 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).

This applies the same fix from 718c8f9aa59751bb490e2688acf2b5cb68fd5ad1
on the 32 bit arm version of the function, fixing fate-checkasm-sw_scale
there.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoavformat/mov: Read the QT Metadata Keys only once
Thierry Foucu [Mon, 11 May 2020 16:35:00 +0000 (09:35 -0700)]
avformat/mov: Read the QT Metadata Keys only once

If you have a file with multiple Metadata Keys, the second time you parse
the keys, you will re-alloc c->meta_keys without freeing the old one.
This change will avoid parsing all the consecutive Metadata keys.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavutil/common: Add saturated add/sub operations for int64_t.
Dale Curtis [Thu, 30 Apr 2020 22:16:31 +0000 (15:16 -0700)]
avutil/common: Add saturated add/sub operations for int64_t.

Many places are using their own custom code for handling overflow
around timestamps or other int64_t values. There are enough of these
now that having some common saturated math functions seems sound.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mov: Don't allow negative sample sizes.
Dale Curtis [Thu, 14 May 2020 22:31:55 +0000 (15:31 -0700)]
avformat/mov: Don't allow negative sample sizes.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agocheckasm: aarch64: Check for stack overflows
Martin Storsjö [Wed, 13 May 2020 11:11:39 +0000 (14:11 +0300)]
checkasm: aarch64: Check for stack overflows

Also fill x8-x17 with garbage before calling the function.

Figure out the number of stack parameters and make sure that the
value on the stack after those is untouched.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agocheckasm: arm: Check for stack overflows
Martin Storsjö [Wed, 13 May 2020 18:09:08 +0000 (21:09 +0300)]
checkasm: arm: Check for stack overflows

Figure out the number of stack parameters and make sure that the
value on the stack after those is untouched.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agocheckasm: arm: Don't use blx to call checkasm_fail_func
Martin Storsjö [Tue, 12 May 2020 12:50:10 +0000 (15:50 +0300)]
checkasm: arm: Don't use blx to call checkasm_fail_func

We should just use a normal bl here, and the linker will add the 'x'
bit if necessary.

This fixes calling the checkasm_fail_func on windows, where the
code is built in thumb mode (and the linker doesn't clear the 'x'
bit in the blx instruction).

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agocheckasm: arm: Make the indentation consistent with other files
Martin Storsjö [Tue, 12 May 2020 10:44:05 +0000 (13:44 +0300)]
checkasm: arm: Make the indentation consistent with other files

This makes it easier to share code with e.g. the dav1d implementation
of checkasm.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoaarch64: Explicitly forbid using the x18 register
Martin Storsjö [Tue, 12 May 2020 10:28:44 +0000 (13:28 +0300)]
aarch64: Explicitly forbid using the x18 register

On windows and darwin (and modern android), the x18 register is reserved
and shouldn't be modified by user code, while it is freely available on
linux. Strictly avoid it, to keep the assembly code portable.

This would have helped catch the issue fixed in 872790b1f9be6
immediately.

Signed-off-by: Martin Storsjö <martin@martin.st>
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>