Commit Graph

97808 Commits

Author SHA1 Message Date
Derek Buitenhuis
5d9ce445ef avformat/dump: Use int64_t for intermediate time values
Prevents wrap-around to negative values while calculating the duration string.

Before:

    Duration: -411422:-59:-42.17, start: 0.000000, bitrate: 0 kb/s

After:

    Duration: 781623:28:34.17, start: 0.000000, bitrate: 0 kb/s

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2020-05-17 13:03:30 +01:00
Michael Niedermayer
f603d10b1e avcodec/binkaudio: Fix 2Ghz sample_rate
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 19950/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINKAUDIO_DCT_fuzzer-5765514337189888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Suggested-by: Paul
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-17 00:43:45 +02:00
Michael Niedermayer
ea29f07b2f avcodec/jpeg2000dec: Free packed_headers
Fixes: memleak
Fixes: 21784/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-565256551058636

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-17 00:36:20 +02:00
Paul B Mahol
1ead7ed5bf avfilter/vsrc_sierpinski: unbreak configuring rate value 2020-05-16 11:13:46 +02:00
Paul B Mahol
d99ed7367b avfilter/vsrc_mandelbrot: unbreak configuring rate value 2020-05-16 11:10:32 +02:00
Martin Storsjö
9c326af1d0 checkasm: swscale: Fix running the hscale test on 32 bit x86
This function doesn't call emms.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-16 08:16:12 +03:00
Andreas Rheinhardt
718f05f5e5 avformat/mux: Call check_packet() more directly
Call it directly from write_packets_common() instead of indirectly
through prepare_input_packet().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-16 02:55:59 +02:00
Andreas Rheinhardt
39195896f3 avformat/mux: Check pkt->stream_index before using it
This commit stops using pkt->stream_index as index in an AVFormatContext's
streams array before actually comparing the value with the count of
streams in said array. 96e5e6abb9 used
pkt->stream_index in prepare_input_packet() before checking and
6406351222 did likewise in
write_packets_common().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-16 02:40:23 +02:00
Martin Storsjö
e0604d508e 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>
2020-05-15 23:38:17 +03:00
Martin Storsjö
eba1ebd9bf checkasm: sw_rgb: Add a test for interleaveBytes
Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-15 23:38:01 +03:00
Martin Storsjö
7168adedbc 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>
2020-05-15 23:37:55 +03:00
Martin Storsjö
b252178321 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>
2020-05-15 23:37:43 +03:00
Martin Storsjö
5bdffced0a checkasm: pixblockdsp: Add tests for get_pixels_unaligned and diff_pixels_unaligned
Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-15 23:37:27 +03:00
Josh de Kock
70b14cc8d6 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 718c8f9aa5
on the 32 bit arm version of the function, fixing fate-checkasm-sw_scale
there.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-15 23:33:46 +03:00
Thierry Foucu
1187cbf0ff 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>
2020-05-15 22:03:36 +02:00
Dale Curtis
a7e1af3cb1 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>
2020-05-15 22:03:36 +02:00
Dale Curtis
2d8d554f15 avformat/mov: Don't allow negative sample sizes.
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-15 22:03:36 +02:00
Martin Storsjö
ed7d73355e 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>
2020-05-15 21:22:36 +03:00
Martin Storsjö
6cb2d4d94b 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>
2020-05-15 21:22:34 +03:00
Martin Storsjö
3f266cf49e 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>
2020-05-15 21:22:32 +03:00
Martin Storsjö
89cf9e1fb6 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>
2020-05-15 21:22:27 +03:00
Martin Storsjö
07948f3d38 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 872790b1f9
immediately.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-15 21:22:22 +03:00
Marton Balint
b4bcae4e0e Revert "avfilter/vf_framerate: if metadata lavfi.scd.mafd exists, we'll use it first"
This reverts commit 339593ca90.

Fixes null pointer dereference.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-15 18:35:51 +02:00
Marton Balint
7f3a946216 Revert "avfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it first"
This reverts commit d88e1c9838.

Fixes null pointer dereference.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-15 18:35:51 +02:00
Josh de Kock
5913cd4e6c 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>
2020-05-15 10:29:30 +01:00
Martin Storsjö
3ce1b2bf8d checkasm: add function to check and diff memory
This was ported from dav1d (c950e7101bdf5f7117bfca816984a21e550509f0).

Signed-off-by: Josh de Kock <josh@itanimul.li>
2020-05-15 10:29:30 +01:00
Josh de Kock
718c8f9aa5 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>
2020-05-15 10:29:30 +01:00
Zachariah Brown
b18fd2b95b 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>
2020-05-15 00:44:31 +02:00
James Almer
b7d89963f0 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>
2020-05-14 18:43:29 -03:00
Lynne
858f786eb9 hwcontext_vulkan: fix incorrect print argument 2020-05-14 21:06:24 +01:00
Limin Wang
3b5a36c56d 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>
2020-05-14 23:03:07 +08:00
Limin Wang
815a3b393c 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>
2020-05-14 23:03:07 +08:00
Limin Wang
61cc009d53 avfilter/vf_minterpolate: correct the mafd calculation
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-14 23:03:07 +08:00
Limin Wang
dd24fdc672 fate: add scdet metadata test
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-14 23:03:07 +08:00
Limin Wang
d88e1c9838 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>
2020-05-14 23:03:07 +08:00
Limin Wang
339593ca90 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>
2020-05-14 23:03:06 +08:00
Limin Wang
d62d4e05e8 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>
2020-05-14 23:03:06 +08:00
Andriy Gelman
0776cb7083 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>
2020-05-14 09:53:59 -04:00
Andriy Gelman
1dd0def976 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>
2020-05-14 09:53:55 -04:00
Limin Wang
e9668929b8 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>
2020-05-14 09:19:26 +08:00
lance.lmwang@gmail.com
5ed20a74b7 avfilter/vf_colorbalance:: Fix for framecrc bitexact for 32bit and 64bit system
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-14 09:15:46 +08:00
Limin Wang
b1cc6b9496 avcodec/mv30: fix warning: suggest braces around initialization of subobject [-Wmissing-braces]
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-14 09:15:25 +08:00
Jan Ekström
6f8826e4aa 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.
2020-05-13 17:05:23 +03:00
Jan Ekström
39977fff20 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.
2020-05-13 17:05:23 +03:00
Martin Storsjö
353aecbb28 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>
2020-05-13 13:20:08 +03:00
Michael Niedermayer
b12b05374f 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>
2020-05-13 09:03:45 +02:00
Linjie Fu
e4d37abcc1 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>
2020-05-13 09:55:54 +08:00
Linjie Fu
e3e2702d40 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>
2020-05-13 09:55:47 +08:00
Linjie Fu
d3a7bdd4ac 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>
2020-05-13 09:55:29 +08:00
Lynne
4b7e13931f
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.
2020-05-12 21:32:34 +01:00