FFmpeg git repo
Go to file
Soft Works a428949775 avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions
The test /libavutil/tests/hwdevice checks that when deriving a device
from a source device and then deriving back to the type of the source
device, the result is matching the original source device, i.e. the
derivation mechanism doesn't create a new device in this case.

Previously, this test was usually passed, but only due to two different
kind of flaws:

1. The test covers only a single level of derivation (and back)

It derives device Y from device X and then Y back to the type of X and
checks whether the result matches X.

What it doesn't check for, are longer chains of derivation like:

CUDA1 > OpenCL2 > CUDA3 and then back to OpenCL4

In that case, the second derivation returns the first device (CUDA3 ==
CUDA1), but when deriving OpenCL4, hwcontext.c was creating a new
OpenCL4 context instead of returning OpenCL2, because there was no link
from CUDA1 to OpenCL2 (only backwards from OpenCL2 to CUDA1)

If the test would check for two levels of derivation, it would have
failed.

This patch fixes those (yet untested) cases by introducing forward
references (derived_device) in addition to the existing back references
(source_device).

2. hwcontext_qsv didn't properly set the source_device

In case of QSV, hwcontext_qsv creates a source context internally
(vaapi, dxva2 or d3d11va) without calling av_hwdevice_ctx_create_derived
and without setting source_device.

This way, the hwcontext test ran successful, but what practically
happened, was that - for example - deriving vaapi from qsv didn't return
the original underlying vaapi device and a new one was created instead:
Exactly what the test is intended to detect and prevent. It just
couldn't do so, because the original device was hidden (= not set as the
source_device of the QSV device).

This patch properly makes these setting and fixes all derivation
scenarios.

(at a later stage, /libavutil/tests/hwdevice should be extended to check
longer derivation chains as well)

Reviewed-by: Lynne <dev@lynne.ee>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Tested-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-05 11:05:06 +08:00
compat Replace all occurences of av_mallocz_array() by av_calloc() 2021-09-20 01:03:52 +02:00
doc doc/APIchanges: Fill in the commit hash for DOVI metadata addition 2022-01-04 12:40:07 +01:00
ffbuild Makefile: Redo duplicating object files in shared builds 2022-01-04 05:01:04 +01:00
fftools ffprobe: Support AV_FRAME_DATA_DOVI_METADATA 2022-01-04 11:59:41 +01:00
libavcodec avcodec/videotoolbox: Fix undefined symbol with minimal configuration 2022-01-05 09:26:52 +08:00
libavdevice lib*/version.h: Bump Versions after release/5.0 branch 2022-01-04 14:29:06 +01:00
libavfilter lavfi/libplacebo: support dovi metadata application 2022-01-05 03:13:12 +01:00
libavformat avformat: remove unused v210.c 2022-01-05 09:38:20 +08:00
libavutil avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions 2022-01-05 11:05:06 +08:00
libpostproc lib*/version.h: Bump Versions after release/5.0 branch 2022-01-04 14:29:06 +01:00
libswresample lib*/version.h: Bump Versions after release/5.0 branch 2022-01-04 14:29:06 +01:00
libswscale swscale/output: use isSwappedChroma 2022-01-04 19:39:22 -06:00
presets
tests lavfi/drawutils: re-enable P010 and P016 support 2022-01-04 19:39:22 -06:00
tools tools/target_dec_fuzzer: Adjust threshold for prores 2021-12-16 21:06:47 +01:00
.gitattributes
.gitignore build: detect Metal.framework and build .metal files 2021-12-18 11:55:47 -08:00
.mailmap
.travis.yml
CONTRIBUTING.md
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
COPYING.LGPLv3
CREDITS
Changelog avfilter: add anlmf filter 2021-12-25 11:32:41 +01:00
INSTALL.md
LICENSE.md
MAINTAINERS MAINTAINERS: add my gpg fingerprint 2021-12-23 09:25:16 +08:00
Makefile Makefile: Redo duplicating object files in shared builds 2022-01-04 05:01:04 +01:00
README.md README: fix typo and description of libavfilter 2021-10-08 09:44:34 +05:30
RELEASE Bump Versions before release/4.4 branch 2021-03-20 01:01:12 +01:00
configure lavfi/libplacebo: support dovi metadata application 2022-01-05 03:13:12 +01:00

README.md

FFmpeg README

FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Libraries

  • libavcodec provides implementation of a wider range of codecs.
  • libavformat implements streaming protocols, container formats and basic I/O access.
  • libavutil includes hashers, decompressors and miscellaneous utility functions.
  • libavfilter provides means to alter decoded audio and video through a directed graph of connected filters.
  • libavdevice provides an abstraction to access capture and playback devices.
  • libswresample implements audio mixing and resampling routines.
  • libswscale implements color conversion and scaling routines.

Tools

  • ffmpeg is a command line toolbox to manipulate, convert and stream multimedia content.
  • ffplay is a minimalistic multimedia player.
  • ffprobe is a simple analysis tool to inspect multimedia content.
  • Additional small tools such as aviocat, ismindex and qt-faststart.

Documentation

The offline documentation is available in the doc/ directory.

The online documentation is available in the main website and in the wiki.

Examples

Coding examples are available in the doc/examples directory.

License

FFmpeg codebase is mainly LGPL-licensed with optional components licensed under GPL. Please refer to the LICENSE file for detailed information.

Contributing

Patches should be submitted to the ffmpeg-devel mailing list using git format-patch or git send-email. Github pull requests should be avoided because they are not part of our review process and will be ignored.