Commit Graph

101158 Commits

Author SHA1 Message Date
Guo, Yejun 2da3a5c10f dnn: add color conversion for analytic case
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-02-18 09:59:37 +08:00
Guo, Yejun 0884063f88 dnn_interface.h: add enum DNNColorOrder
the data type and order together decide the color format, we could
not use AVPixelFormat directly because not all the possible formats
are covered by it.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-02-18 09:59:37 +08:00
Guo, Yejun 76fc6879e2 dnn: add function type for model
So the backend knows the usage of model is for frame processing,
detect, classify, etc. Each function type has different behavior
in backend when handling the input/output data of the model.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-02-18 09:59:37 +08:00
Guo, Yejun bdce636100 dnn: extract common functions used by different filters
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-02-18 09:59:37 +08:00
Guo, Yejun 995c33a046 dnn_backend_openvino.c: fix multi-thread issue for async execution
once we mark done for the task in function infer_completion_callback,
the task is possible to be release in function ff_dnn_get_async_result_ov
in another thread just after it, so we need to record request queue
first, instead of using task->ov_model->request_queue later.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-02-18 09:59:37 +08:00
Guo, Yejun 51c105a62d dnn_backend_openvino.c: fix mismatch between ffmpeg(NHWC) and openvino(NCHW)
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-02-18 09:59:37 +08:00
James Almer c2bf1dcace swscale/x86/swscale: fix compilation with old yasm
Where AVX2 may not be supported.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-17 21:09:36 -03:00
James Almer 1371647fc3 checkasm/sw_scale: use av_free() instead of free()
Fixes crashes on Win64

Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-17 20:57:33 -03:00
Mark Thompson 5a9aebac91 avfilter/vf_pseudocolor: Add missing braces
The array inside a structure needs two levels of braces.
2021-02-17 23:09:40 +00:00
Alan Kelly 554c2bc708 swscale: move yuv2yuvX_sse3 to yasm, unrolls main loop
And other small optimizations for ~20% speedup.
2021-02-17 21:21:03 +01:00
James Almer 1628409b18 x86/vf_gblur: fix reg name in UNIX64 prologue
Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-17 15:51:28 -03:00
James Almer 3c77584be8 avfilter/vf_gblur: add missing arch check
Removed by mistake in 2b4da1cb8c where it
should have been replaced instead.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-17 15:45:40 -03:00
James Almer bea7c51307 checkasm/vf_gblur: add a test for postscale_slice
Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-17 13:39:31 -03:00
James Almer 2df3c2ed9b checkasm/vf_gblur: split off the horiz_slice test into its own function
Will come in handy for the following commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-17 13:39:11 -03:00
James Almer 2b4da1cb8c x86/vf_gblur: fix postscale_slice prologue
x86_32 ABI does not pass float arguments directly on xmm regs, and the Win64
ABI uses only the first four regs for this purpose.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-17 13:33:20 -03:00
Nicolas George 670051b524 lavfi/drawtext: ignore final LF of textfile.
A standard text file ends with a final LF.
Without this change, it is interpreted as an empty final line,
and visible with the box option.
The current behavior can be achieved by actually having
an empty line at the end of the file.

Fix trac ticket #7948.
2021-02-17 11:53:51 +01:00
Paul B Mahol 8331eb058d avformat/ircamdec: use lrintf() for rounding 2021-02-16 23:45:01 +01:00
KM fbe9b0c8f3 lavc/aacdec_template: Fix 7.1 decoding with default strictness.
Broken in 4d9b9c5e
Fixes ticket #9057.
2021-02-16 23:37:31 +01:00
Andreas Rheinhardt c38ab8f30f avformat/mxfenc: Discard audio until valid video has been received
Normally, video packets are muxed before audio packets for mxf (there is
a dedicated interleave function for this); furthermore the first (video)
packet triggers writing the actual header. Yet when the first video packet
fails the checks performed on it, it will be an audio packet that leads
to writing the header and codec_ul (a value set based upon
properties of the bitstream which necessitates actually inspecting
packets) may be wrong. Therefore this commit discards audio packets until
a valid video packet has been received.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:51:11 +01:00
Andreas Rheinhardt 8de5d196d1 tests/fate-run.sh: Don't overlook errors from md5 tests
The md5 test up until now ignored errors from ffmpeg (the cli) and just
md5'ed whatever ffmpeg has output; while testing scenarios in which
ffmpeg fails has its merits, errors should not be overlooked by default;
doing so also reduces the effectiveness of sanitizers as errors from
them are ignored. This has happened with a memleak in the AV1 decoder.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:50:36 +01:00
Andreas Rheinhardt a47f5e55e2 fate/mxf: Fix d10-user-comments test
The mxf_d10 muxer is very picky regarding the input it accepts:
The only video accepted is MPEG-2 with absolutely constant bitrate,
i.e. all packets need to have exactly the same size; and only a few
bitrates are accepted.

The sample file used did not abide by this: Writing the first packet
(a video packet) errors out and afterwards an audio packet from the
muxing queue has been written. That's all besides metadata (which this
test is about). The FFmpeg cli returned an error, but said error has
been ignored by the md5 test.

This commit changes the test to actually send a compliant stream to the
muxer, so that it does not error out; furthermore, the test is changed
to explicitly check the metadata instead of it only being implicitly
included in the md5 checksum. The compliant stream is created by our
encoder at runtime.

Finally, the test now also covers writing user-specified
product/company/version identification.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:50:08 +01:00
Andreas Rheinhardt 815515445a avformat/mxfenc: Fix typo
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:49:13 +01:00
Andreas Rheinhardt 58020bbed1 avformat/mxfenc: Use user-specified version even when bitexact
Doing so is still bitexact.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:49:02 +01:00
Andreas Rheinhardt 5400e4a50c avformat/mxfenc: Never set codec_ul UID to NULL
mxf distinguishes codec profiles by different UIDs and therefore needs
to check that the input is actually compatible with mxf (i.e. if there
is a defined UID for it). If not, then sometimes the UID would be set to
NULL and writing the (video) packet would fail. Yet the following audio
packet would trigger writing the header (which has been postponed because
the UID is not known at the start) and if the UID is NULL, this can lead
to segfaults. This commit therefore stops setting the UID to NULL if the
input is incompatible with mxf (it has initially been set to a generic
value in mxf_write_header()).

Fixes #7993.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:48:45 +01:00
Andreas Rheinhardt a34333f43b avfilter/vif: Include avfilter.h
Fixes checkheaders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:26:56 +01:00
Andreas Rheinhardt 15cb5d00d9 avcodec/frame_thread_encoder: Use more natural types
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:11:53 +01:00
Andreas Rheinhardt 739175bfe5 avcodec/frame_thread_encoder: Reduce amount of code guarded by mutex
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:11:53 +01:00
Andreas Rheinhardt 74b0af998a avcodec/frame_thread_encoder: Avoid FIFO
It can be replaced by a simple counter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:11:53 +01:00
Andreas Rheinhardt de1b20a82b avcodec/frame_thread_encoder: Avoid allocations of AVFrames
Up until now, when using frame threaded encoding, an AVFrame would be
allocated for every frame to be encoded. These AVFrames would reach the
worker threads via a FIFO of tasks, a structure which contained the
AVFrame as well as an index into an array which gives the place where
the worker thread shall put the returned packet; in addition to that,
said structure also contained several unused fields.

This commit changes this: The AVFrames are now allocated during init in
the array that is up until now only used to return the packets. The
contents to be encoded are put into the AVFrame in the same array
element that is also used to return the packets.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:11:53 +01:00
Andreas Rheinhardt 76d428e090 avcodec/frame_thread_encoder: Avoid creating reference to frame
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:11:53 +01:00
Andreas Rheinhardt fbf242a51d avcodec/frame_thread_encoder: Avoid allocations of AVPackets, fix deadlock
Up until now, when doing frame thread encoding, each worker thread
tried to allocate an AVPacket for every AVFrame to be encoded; said
packets would then be handed back to the main thread, where the content
of said packet is copied into the packet actually destined for output;
the temporary AVPacket is then freed.

Besides being wasteful this also has another problem: There is a risk of
deadlock, namely if no AVPacket can be allocated at all. The user
doesn't get an error at all in this case and the worker threads will
simply try to allocate a packet again and again. If the user has
supplied enough frames, the user's thread will block until a task has
been completed, which just doesn't happen if no packet can ever be
allocated.

This patch instead modifies the code to allocate the packets during
init; they are then reused again and again.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:11:53 +01:00
Andreas Rheinhardt 2ccbc40eef avcodec/frame_thread_encoder: Fix segfault on allocation error
Fixes a segfault from av_fifo_size(NULL) that happens in
ff_frame_thread_encoder_free if the fifo couldn't be allocted;
furthermore the mutexes and conditions that are destroyed in
ff_frame_thread_encoder_free are not even initialized at this point,
so don't call said function.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:11:53 +01:00
Andreas Rheinhardt e0f5086fab avcodec/frame_thread_encoder: Improve type safety
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-16 22:11:53 +01:00
Paul B Mahol 44cf3a2b16 avfilter/x86/vf_gblur: add postscale SIMD 2021-02-16 21:12:11 +01:00
Paul B Mahol 058db59e16 avfilter/vf_gblur: factor out postscale function 2021-02-16 21:12:11 +01:00
Michael Niedermayer d0b6b1f941 tools/target_dec_fuzzer: Adjust threshold for wavpack
Fixes: Timeout (long -> 4sec)
Fixes: 29064/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5104450901508096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-02-16 19:02:24 +01:00
Michael Niedermayer 1fc21b1bc5 tools/target_dec_fuzzer: Adjust threshold for MSA1
Fixes: Timeout (too long to wait -> 1ms)
Fixes: 29048/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSA1_fuzzer-5733703473037312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-02-16 19:02:24 +01:00
Michael Niedermayer fa7b7fdfa2 tools/target_dec_fuzzer: adjust threshold for cook
Fixes: Timeout (long -> 3ms)
Fixes: 29134/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_COOK_fuzzer-5192822695264256

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-02-16 19:02:24 +01:00
Michael Niedermayer e6d8ec977e tools/target_dec_fuzzer: Adjust threshold for theora
Fixes: Timeout
Fixes: 29226/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-6195092572471296

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-02-16 19:02:24 +01:00
Michael Niedermayer be0c72b7c2 tools/target_dec_fuzzer: Update maxpixels_per_frame for low thresholds
Fixes: Timeout
Fixes: 29990/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSS2_fuzzer-5469155073589248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-02-16 19:02:24 +01:00
Michael Niedermayer 887bd6b02f tools/target_dec_fuzzer: count all video decoding failures in the new API
The next commit depends on this

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-02-16 19:02:24 +01:00
Michael Niedermayer d558c9f237 avformat/rmdec: Check codec_length without overflow
Fixes: signed integer overflow: 2147483647 + 64 cannot be represented in type 'int'
Fixes: 30333/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-5175286983426048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-02-16 19:02:24 +01:00
Michael Niedermayer 1d277b92fa avformat/mov: Check element count in mov_metadata_hmmt()
Fixes: Timeout
Fixes: 30325/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6048395703746560

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-02-16 19:02:24 +01:00
Michael Niedermayer 6a797ceafe avcodec/vp8: Move end check into MB loop in vp78_decode_mv_mb_modes()
Fixes: Timeout (long -> 5sec)
Fixes: 30269/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP7_fuzzer-5430325004075008

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-02-16 19:02:24 +01:00
James Almer 04dfdde09b avfilter/buffersrc: simplify av_buffersrc_add_frame_flags()
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-02-16 12:36:37 -03:00
Ashish Singh 38aea9b041 avfilter: add vif filter
This is Visual Information Fidelity (VIF) filter and one of the component
filters of VMAF. It outputs the average VIF score over all frames.

Signed-off-by: Ashish Singh <ashk43712@gmail.com>
2021-02-16 15:00:50 +01:00
Paul B Mahol 8d209eb33c avcodec/exr: export any unknown header string variable to metadata
And properly skip preview type in header.
2021-02-16 14:39:43 +01:00
Paul B Mahol f5dde8089d avcodec/exr: refactor GetByteContext usage 2021-02-16 13:58:48 +01:00
Paul B Mahol 3ea660c78a avcodec/exr: correctly calculate display window 2021-02-16 13:58:48 +01:00
Paul B Mahol b1eb15c1cf avcodec/exr: add multipart support 2021-02-16 03:51:07 +01:00