History

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.

OvchinnikovDmitrii committed 7 years ago

Commit f8ad2dd1 parent b319feb4 files · +30 −6Browse files

Unified · Split

4 files
  1. Changelog +1 −0
  2. doc/general.texi +13 −3
  3. libavcodec/amfenc.c +15 −2
  4. libavcodec/version.h +1 −1
Changelog+1−0
@@ -6,6 +6,7 @@ version <next>: · 5 unmodified lines
6- Intel QSV-accelerated MJPEG decoding6- Intel QSV-accelerated MJPEG decoding
7- Intel QSV-accelerated VP9 decoding7- Intel QSV-accelerated VP9 decoding
8- support for TrueHD in mp48- support for TrueHD in mp4
9- Supoort AMD AMF encoder on Linux (via Vulkan)
9 10
10 11
11version 4.2:12version 4.2:
doc/general.texi+13−3
@@ -27,16 +27,26 @@ enable it. · 26 unmodified lines
27 27
28@section AMD AMF/VCE28@section AMD AMF/VCE
29 29
30FFmpeg can use the AMD Advanced Media Framework library under Windows30FFmpeg can use the AMD Advanced Media Framework library
31for accelerated H.264 and HEVC encoding on hardware with Video Coding Engine (VCE).31for accelerated H.264 and HEVC(only windows) encoding on hardware with Video Coding Engine (VCE).
32 32
33To enable support you must obtain the AMF framework header files from33To enable support you must obtain the AMF framework header files(version 1.4.9+) from
34@url{https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git}.34@url{https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git}.
35 35
36Create an @code{AMF/} directory in the system include path.36Create an @code{AMF/} directory in the system include path.
37Copy the contents of @code{AMF/amf/public/include/} into that directory.37Copy the contents of @code{AMF/amf/public/include/} into that directory.
38Then configure FFmpeg with @code{--enable-amf}.38Then configure FFmpeg with @code{--enable-amf}.
39 39
40Initialization of amf encoder occurs in this order:
411) trying to initialize through dx11(only windows)
422) trying to initialize through dx9(only windows)
433) trying to initialize through vulkan
44
45To use h.264(AMD VCE) encoder on linux amdgru-pro version 19.20+ and amf-amdgpu-pro
46package(amdgru-pro contains, but does not install automatically) are required.
47
48This driver can be installed using amdgpu-pro-install script in official amd driver archive.
49
40@section AviSynth50@section AviSynth
41 51
42FFmpeg can read AviSynth scripts as input. To enable support, pass52FFmpeg can read AviSynth scripts as input. To enable support, pass
libavcodec/amfenc.c+15−2
@@ -213,6 +213,7 @@ static int amf_init_from_dxva2_device(AVCodecContext *avctx, AVDXVA2DeviceContex · 212 unmodified lines
213static int amf_init_context(AVCodecContext *avctx)213static int amf_init_context(AVCodecContext *avctx)
214{214{
215 AmfContext *ctx = avctx->priv_data;215 AmfContext *ctx = avctx->priv_data;
216 AMFContext1 *context1 = NULL;
216 AMF_RESULT res;217 AMF_RESULT res;
217 av_unused int ret;218 av_unused int ret;
218 219
@@ -311,8 +312,20 @@ static int amf_init_context(AVCodecContext *avctx) · 92 unmodified lines
311 if (res == AMF_OK) {312 if (res == AMF_OK) {
312 av_log(avctx, AV_LOG_VERBOSE, "AMF initialisation succeeded via D3D9.\n");313 av_log(avctx, AV_LOG_VERBOSE, "AMF initialisation succeeded via D3D9.\n");
313 } else {314 } else {
314 av_log(avctx, AV_LOG_ERROR, "AMF initialisation failed via D3D9: error %d.\n", res);315 AMFGuid guid = IID_AMFContext1();
315 return AVERROR(ENOSYS);316 res = ctx->context->pVtbl->QueryInterface(ctx->context, &guid, (void**)&context1);
317 AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_UNKNOWN, "CreateContext1() failed with error %d\n", res);
318
319 res = context1->pVtbl->InitVulkan(context1, NULL);
320 context1->pVtbl->Release(context1);
321 if (res != AMF_OK) {
322 if (res == AMF_NOT_SUPPORTED)
323 av_log(avctx, AV_LOG_ERROR, "AMF via Vulkan is not supported on the given device.\n");
324 else
325 av_log(avctx, AV_LOG_ERROR, "AMF failed to initialise on the given Vulkan device: %d.\n", res);
326 return AVERROR(ENOSYS);
327 }
328 av_log(avctx, AV_LOG_VERBOSE, "AMF initialisation succeeded via Vulkan.\n");
316 }329 }
317 }330 }
318 }331 }
libavcodec/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
29 29
30#define LIBAVCODEC_VERSION_MAJOR 5830#define LIBAVCODEC_VERSION_MAJOR 58
31#define LIBAVCODEC_VERSION_MINOR 5531#define LIBAVCODEC_VERSION_MINOR 55
32#define LIBAVCODEC_VERSION_MICRO 10132#define LIBAVCODEC_VERSION_MICRO 102
33 33
34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
35 LIBAVCODEC_VERSION_MINOR, \35 LIBAVCODEC_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t