Commit Graph

16 Commits

Author SHA1 Message Date
Anton Khirnov
70611d7f3b lavc/amfenc: switch to new FIFO API 2022-02-07 00:31:23 +01:00
James Almer
b615e8a782 avcodec/amfenc: use AVCodecContext.get_encode_buffer()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 13:42:54 -03:00
OvchinnikovDmitrii
2fb764e1f3 lavc/amfenc: Add hardware config metadata
Without this metadata section the ffmpeg utility thinks that the AMF encoder
does not support input from D3D11 and DXVA2 hardware surfaces, causing
hardware pipelines to fail.

Fixes #8953.
2020-11-08 19:05:17 +00:00
James Almer
827d6fe73d avcodec/encode: restructure the core encoding code
This commit follows the same logic as 061a0c14bb, but for the encode API: The
new public encoding API will no longer be a wrapper around the old deprecated
one, and the internal API used by the encoders now consists of a single
receive_packet() callback that pulls frames as required.

amf encoders adapted by James Almer
librav1e encoder adapted by James Almer
nvidia encoders adapted by James Almer
MediaFoundation encoders adapted by James Almer
vaapi encoders adapted by Linjie Fu
v4l2_m2m encoders adapted by Andriy Gelman

Signed-off-by: James Almer <jamrial@gmail.com>
2020-06-18 17:11:37 -03:00
James Almer
fdf46b4a6b avcodec/amfnec: allocate packets using av_new_packet()
This ensures they will be reference counted, as required by the AVCodec.receive_packet()
API.

Should fix ticket #8386.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-11-19 19:42:48 -03:00
OvchinnikovDmitrii
f8ad2ddd7a libavcodec/amfenc: Vulkan initialization support for encoder.
Added linux support for amf encoder through vulkan.

To use h.264(AMD VCE) encoder on linux amdgru-pro version 19.20+ and
amf-amdgpu-pro package(amdgru-pro contains, but does not install
automatically) are required.

This driver can be installed using amdgpu-pro-install script in
official amd driver archive.

Initialization of amf encoder occurs in this order:
1) trying to initialize through dx11(only windows)
2) trying to initialize through dx9(only windows)
3) trying to initialize through vulkan

Only Vulkan initialization available on linux.
2019-08-27 18:28:31 -07:00
Mark Thompson
edecd723f3 amfenc: Remove spurious initialisations
Also minor cosmetics.
2018-04-15 16:46:17 +01:00
Alexander Kravchenko
2c6ca2b549 amfenc: Add DXVA2 hardware frame input support
Adds support for AMF initialisation from a DXVA2 (Direct3D9) device, and
then allows passing DXVA2 surfaces into an AMF encoder.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2018-04-15 16:46:17 +01:00
Alexander Kravchenko
ab7eed13a7 amfenc: Ensure that the software format of hardware frames is valid
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2018-04-15 16:46:17 +01:00
Mark Thompson
73ed6fa9d7 amfenc: Do not automatically download/upload unknown hardware input frames
Supplying a hardware input frame which is not in the input hardware frames
context is not allowed by the API, so additional code to handle it is not
necessary.  Further, handling it automatically results in very low
performance - it is more appropriate to fail immediately so that the user
can fix their incorrect setup.
2018-04-15 16:46:12 +01:00
Mark Thompson
ff1be6c9a6 amfenc: Fail to open if the user-supplied device is not usable
If the user supplies a device or frames context then it is an error
not to use it; this is consistent with other hardware components.

Also factorise out the D3D11 initialisation and improve error
messages.
2018-04-15 16:42:35 +01:00
Alexander Kravchenko
05f1a3face lavc/amfenc: Retain a reference to D3D frames used as input during the encoding process
Fixes ticket #6990.

Tested-by: James Almer <jamrial@gmail.com>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
2018-04-10 23:59:21 +01:00
Mark Thompson
3895fce26e Merge commit '34c113335b53d83ed343de49741f0823aa1f8cc6'
* commit '34c113335b53d83ed343de49741f0823aa1f8cc6':
  Add support for H.264 and HEVC hardware encoding for AMD GPUs based on AMF SDK

Most of this was already present from 9ea6607d29,
this just applies some minor fixups and adds the general documentation.

Merged-by: Mark Thompson <sw@jkqxz.net>
2018-01-16 23:25:27 +00:00
Michael Wootton
34c113335b Add support for H.264 and HEVC hardware encoding for AMD GPUs based on AMF SDK
Requires AMF headers for at least version 1.4.4.1.

Signed-off-by: Mikhail Mironov <mikhail.mironov@amd.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2018-01-04 18:15:56 +01:00
James Almer
a198c1386a avcodec/amfenc: move config.h include where it's needed
Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-29 14:24:08 -03:00
Mikhail Mironov
9ea6607d29 Add HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK
Requires AMF headers for at least version 1.4.4.1.

Signed-off-by: Mikhail Mironov <mikhail.mironov@amd.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2017-11-28 22:14:42 +00:00