1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

103229 Commits

Author SHA1 Message Date
Anselm Busse
55d9d67679 Fix for bug #9231: B-frames parameter is ignored in videotoolboxenc
This commit fixes the bug as report in
https://trac.ffmpeg.org/ticket/9231 by removing the line that
overwrites the user settings for max_b_frames.

Signed-off-by: Anselm Busse <anselm.busse@outlook.com>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2021-08-13 08:57:27 -04:00
Haihao Xiang
115f5e8035 lavc/qsvenc: allows the SDK runtime to choose LowPower/non-LowPower modes
The SDK supports LowPower and non-LowPower modes, but some features are
available only under one of the two modes. Currently non-LowPower mode
is always chosen in FFmpeg if the mode is not set to LowPower
explicitly. User will experience some SDK errors if a LowPower related
feature is specified but the mode is not set to LowPower. With this
patch, the mode is set to unknown by default in FFmpeg, the SDK is able
to choose a workable mode for the specified features.

Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-12 22:25:11 -03:00
Andreas Rheinhardt
21c7df0d22 avutil/mem: Correct av_calloc() documentation
Incorrect since 4959f18a8e.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-12 15:25:58 +02:00
Andreas Rheinhardt
f9126b62b6 avutil/mem: Reinline av_size_mult() internally
Since 580e168a94, av_size_mult() is no
longer inlined; on systems where interposing is a thing, this also
inhibits the compiler from inlining said function into the internal
callers of said function, although inlining such a small function is
typically beneficial: With GCC 10.3 on Ubuntu x64 and -O3 this decreases
the size of av_realloc_array from 91B to 23B, from 129B to 81B for
av_realloc_f and from 77B to 23B for each of av_malloc_array,
av_mallocz_array and av_calloc.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-12 15:25:58 +02:00
Andreas Rheinhardt
26aa844a21 avformat/oggdec: Use av_realloc_array()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-12 15:25:58 +02:00
Andreas Rheinhardt
3dc6e4d602 avfilter/vf_scale: Avoid unnecessary indirection
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-12 15:25:43 +02:00
Michael Witten
f040c1ec4e libavformat/file.c: 'file_delete()' and 'file_move()' require 'CONFIG_FILE_PROTOCOL'
This quashes 2 warnings when the 'file' protocol is not enabled.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-12 04:43:31 +02:00
Haihao Xiang
c3ef9e0277 doc/examples/qsvdec: simplify this example via hw_device_ctx interface
Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-11 13:47:47 -03:00
Haihao Xiang
ecee3b07cd qsvdec: add support for HW_DEVICE_CTX method
This allows user set hw_device_ctx instead of hw_frames_ctx for QSV
decoders, hence we may remove the ad-hoc libmfx setup code from FFmpeg.

"-hwaccel_output_format format" is applied to QSV decoders after
removing the ad-hoc libmfx code. In order to keep compatibility with old
commandlines, the default format is set to AV_PIX_FMT_QSV, but this
behavior will be removed in the future. Please set "-hwaccel_output_format qsv"
explicitly if AV_PIX_FMT_QSV is expected.

The normal device stuff works for QSV decoders now, user may use
"-init_hw_device args" to initialise device and "-hwaccel_device
devicename" to select a device for QSV decoders.

"-qsv_device device" which was added for workarounding device selection
in the ad-hoc libmfx code still works

For example:

$> ffmpeg -init_hw_device qsv=qsv:hw_any,child_device=/dev/dri/card0
-hwaccel qsv -c:v h264_qsv -i input.h264  -f null -

/dev/dri/renderD128 is actually open for h264_qsv decoder in the above
command without this patch. After applying this patch, /dev/dri/card0
is used.

$> ffmpeg -init_hw_device vaapi=va:/dev/dri/card0 -init_hw_device
qsv=hw@va -hwaccel_device hw -hwaccel qsv -c:v h264_qsv -i input.h264
-f null -

device hw of type qsv is not usable in the above command without this
patch. After applying this patch, this command works as expected.

Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-11 13:45:36 -03:00
Andreas Rheinhardt
35b1f46d79 avfilter/avfilter: Use av_memdup where appropriate
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-11 16:49:20 +02:00
Andreas Rheinhardt
c66bb56d9a fftools/cmdutils: Use av_strstart() instead of strncmp()
This also avoids hardcoding lengths.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-11 16:24:36 +02:00
Soft Works
4b3906bd7e libavcodec/qsvence: Use QSV encoder defaults as ffmpeg defaults
Signed-off-by: softworkz <softworkz@hotmail.com>
2021-08-11 09:54:20 -03:00
Paul B Mahol
c245963a21 avfilter/af_join: fix eof timestamps and blocking in many scenarios 2021-08-10 21:00:45 +02:00
James Almer
90bf83d6f1 avcodec/h264_slice: use ff_h264_replace_picture when syncing thread contexts
Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-10 15:11:46 -03:00
James Almer
a2a5a579bc avcodec/h264_picture: add ff_h264_replace_picture()
Will remove unnecessary allocations when both src and dst picture contain
references to the same buffers.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-10 15:11:42 -03:00
James Almer
ab448a7f9b avcodec/h264_picture: split copying H264Picture some fields into a separate function
Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-10 15:11:42 -03:00
James Almer
ce4a31cd1f avcodec/h264_slice: clear old slice POC values on parsing failure
If a slice header fails to parse, and the next one uses different Sequence and
Picture parameter sets, certain values may not be read if they are not coded,
resulting in the previous slice values being used.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-10 15:11:41 -03:00
Michael Niedermayer
f803635c4f avcodec/faxcompr: Check for end of input in cmode == 1 in decode_group3_2d_line()
Fixes: Infinite loop
Fixes: 35591/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4503764022198272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-10 18:05:13 +02:00
Michael Niedermayer
643b2d49bf avcodec/vc1dec: Disable error concealment for *IMAGE
The existing error concealment makes no sense for the image formats, they
use transformed source images which is different from keyframe + MC+difference
for which the error concealment is designed.
Of course feel free to re-enable this if you have a case where it works and
improves vissual results

Fixes: Timeout
Fixes: 36234/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-6300306743885824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-10 18:05:13 +02:00
Michael Niedermayer
8f2856a1da avcodec/sbrdsp_fixed: Fix negation overflow in sbr_neg_odd_64_c()
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 35593/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5182217725804544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-10 18:05:13 +02:00
Michael Niedermayer
c2f5e9ff3c avcodec/argo: Check for even dimensions
Fixes: reading over the end
Fixes: 36346/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARGO_fuzzer-5366943107383296

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-10 18:05:13 +02:00
Shubhanshu Saxena
2063745a93 lavfi/dnn: DNNAsyncExecModule Execution Failure Handling
This commit adds the case handling if the asynchronous execution
of a request fails by checking the exit status of the thread when
joining before starting another execution. On failure, it does the
cleanup as well.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-10 22:27:27 +08:00
Shubhanshu Saxena
371e5672f3 lavfi/dnn_backend_tf: Error Handling for tf_create_inference_request
This commit includes the check for the case when the newly created
TFInferRequest is NULL.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-10 22:27:27 +08:00
Shubhanshu Saxena
009b2e5b5e lavfi/dnn: Extract Common Parts from get_output functions
The frame allocation and filling the TaskItem with execution
parameters is common in the three backends. This commit shifts
this logic to dnn_backend_common.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-10 22:27:27 +08:00
Shubhanshu Saxena
4d627acefa lavfi/dnn_backend_tf: Add TF_Status to TFRequestItem
Since requests are running in parallel, there is inconsistency in
the status of the execution. To resolve it, we avoid using mutex
as it would result in single TF_Session running at a time. So add
TF_Status to the TFRequestItem

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-10 22:27:27 +08:00
Shubhanshu Saxena
a3db9b5405 lavfi/dnn_backend_tf: Error Handling for execute_model_tf
This patch adds error handling for cases where the execute_model_tf
fails, clears the used memory in the TFRequestItem and finally pushes
it back to the request queue.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-10 22:27:27 +08:00
Shubhanshu Saxena
0985e9283c lavfi/dnn: Async Support for TensorFlow Backend
This commit enables async execution in the TensorFlow backend
and adds function to flush extra frames.

The async execution mechanism executes the TFInferRequests on
a separate thread which is joined before the next execution of
same TFRequestItem/while freeing the model.

The following is the comparison of this mechanism with the existing
sync mechanism on TensorFlow C API 2.5 CPU variant.

Async Mode: 4m32.846s
Sync Mode: 5m17.582s

The above was performed on super resolution filter using SRCNN model.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-10 22:27:27 +08:00
Shubhanshu Saxena
e6ae8fc18e lavfi/dnn_backend_tf: TFInferRequest Execution and Documentation
This commit adds a function for execution of TFInferRequest and documentation
for functions related to TFInferRequest.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-10 22:27:27 +08:00
Shubhanshu Saxena
c716578588 lavfi/dnn: Common Function to Get Async Result in DNN Backends
This commits refactors the get async result function for common
use in all three backends.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-10 22:27:27 +08:00
Shubhanshu Saxena
86f0a4f9de lavfi/dnn: Add Async Execution Mechanism and Documentation
This commit adds an async execution mechanism for common use
in the TensorFlow and Native backends.
This commit also adds the documentation of typedefs and functions in
the async module for common use in DNN backends.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-10 22:27:27 +08:00
Jin Bo
903c5d58f0 configure: [loongson] adjust MMI check in configure
After standardizing the use of 'pxor' in commit 'ebedd26', FFmpeg
build failed with upstream compiler, for 'pxor' is not supported
in time. This patch helps to workaround the build failure by
checking whether 'pxor' is supported during configuration, if not,
MMI will be disabled.

Reviewed-by: yinshiyou-hf@loongson.cn
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-10 16:16:06 +02:00
Martin Storsjö
bff7d662d7 movenc: Don't try to fix the fragment end duration if none will be written
If autoflushing on a new packet (e.g. due to the frag_every_frame
flag being set), there's no samples to be written in the new fragment,
so we can't overwrite the track duration in order to make it line
up with the next packet to be written.

Signed-off-by: Martin Storsjö <martin@martin.st>
2021-08-10 10:24:47 +03:00
Haihao Xiang
43aeeab764 lavfi/qsvvpp: do not mix up FFmpeg and SDK error code
The function ff_qsvvpp_filter_frame should return a FFmpeg error code if
there is an error. However it might return a SDK error code without this
patch.

Reviewed-by: Soft Works <softworkz@hotmail.com>
2021-08-09 22:57:05 -03:00
Gregory Montoir
3f92496d9e avformat/paf: read frame rate from header @0x88
Signed-off-by: Gregory Montoir <cyx@users.sourceforge.net>
2021-08-10 01:14:04 +02:00
Timo Rothenpieler
00b579890d avcodec/nvenc: always set qp cr/cb offsets 2021-08-09 15:16:58 +02:00
Martin Storsjö
c60b76d0c8 aarch64: h264dsp: Fix indentation of some functions to match the rest
Signed-off-by: Martin Storsjö <martin@martin.st>
2021-08-08 23:18:43 +03:00
Martin Storsjö
e86ec831b0 aarch64: h264dsp: Remove unnecessary sign extensions
These became unnecessary when the stride arguments were changed from
int to ptrdiff_t in bc26fe8927
(0576ef466d) and
d5d699ab6e
(aa844dc46f).

Signed-off-by: Martin Storsjö <martin@martin.st>
2021-08-08 23:18:43 +03:00
Marton Balint
a2690dccca avcodec/mpeg12dec: report error when picture type is unknown and err_detect is EXPLODE
Also split error message to error and warning.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-08-08 21:22:51 +02:00
Marton Balint
188e17ac85 avformat/mxfdec: make MXFMetadataSet part of all metadata sets
The code expects every kind of metadata set to start with the generic metadata
set attributes.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-08-08 21:22:51 +02:00
Anton Khirnov
5fdb5ed613 FATE: add a test for sliced scaling 2021-08-08 19:26:05 +02:00
Anton Khirnov
94170e0411 tools/venc_data_dump: factor out demux/decode code
It can be shared with other simple demux/decode tools.
2021-08-08 19:21:39 +02:00
Andreas Rheinhardt
7f660035fe fftools/cmdutils: Remove unused cpu_count
Added in cf12a478b2, but not used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-08 18:40:46 +02:00
Andreas Rheinhardt
c0d7d5f595 avcodec/qsv: Remove unused ff_qsv_level_to_mfx()
Unused since 00d0a4aa9e.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-08 18:40:46 +02:00
Andreas Rheinhardt
7fbf1f21ab avfilter/asrc_flite: Don't define an object by accident
The flite filter apparently only wanted to declare a struct,
but mistakenly also defined an unused and zero-initialized element
with external linkage.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-08 18:40:45 +02:00
Andreas Rheinhardt
afc95a10ac avcodec/h264dsp, h264idct: Fix lengths of array parameters
Fixes many -Warray-parameter warnings from GCC 11.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-08 17:44:57 +02:00
Andreas Rheinhardt
ab97d163b6 avcodec/aacps: Fix length of array in function definition
hybrid2_re() has a parameter declared as "const INTFLOAT filter[8]",
although the actual argument for said parameter only has seven elements;
the code itself only uses seven elements, so change the parameter.

Fixes a -Wstringop-overread warning with GCC 11.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-08 17:44:57 +02:00
Andreas Rheinhardt
465ddcb600 avfilter/vf_vif: Make ff_compute_vif2 static
Only used here; the vif.h header can then be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-08 17:44:57 +02:00
Andreas Rheinhardt
71eb8f8fa9 avfilter/vf_vif: Fix mismatch in number of array elements
The function definition used float *data_buf[14], although there are
only 13 elements (and only 13 are used); the declaration used 13.
Given that the type will be converted to float **data_buf anyway,
this is not in violation of the C specs, but nevertheless a bug.

GCC 11 has a new warning for this -Warray-parameter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-08 17:44:57 +02:00
Paul B Mahol
7dfdc15a27 avfilter/avf_showspectrum: fix another case of frames queuing up 2021-08-08 16:56:17 +02:00
Timo Rothenpieler
ac0408522a avcodec/nvenc: make aware of SDK 11.1 driver requirements 2021-08-08 02:00:38 +02:00