Commit 3895fce2 authored by Mark Thompson's avatar Mark Thompson

Merge commit '34c11333'

* commit '34c11333':
  Add support for H.264 and HEVC hardware encoding for AMD GPUs based on AMF SDK

Most of this was already present from 9ea6607d,
this just applies some minor fixups and adds the general documentation.
Merged-by: 's avatarMark Thompson <sw@jkqxz.net>
parents 68de778c 34c11333
...@@ -225,6 +225,18 @@ The dispatcher is open source and can be downloaded from ...@@ -225,6 +225,18 @@ The dispatcher is open source and can be downloaded from
with the @code{--enable-libmfx} option and @code{pkg-config} needs to be able to with the @code{--enable-libmfx} option and @code{pkg-config} needs to be able to
locate the dispatcher's @code{.pc} files. locate the dispatcher's @code{.pc} files.
@section AMD VCE
FFmpeg can use the AMD Advanced Media Framework library for accelerated H.264
and HEVC encoding on VCE enabled hardware under Windows.
To enable support you must obtain the AMF framework header files from
@url{https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git}.
Create an @code{AMF/} directory in the system include path.
Copy the contents of @code{AMF/amf/public/include/} into that directory.
Then configure FFmpeg with @code{--enable-amf}.
@chapter Supported File Formats, Codecs or Features @chapter Supported File Formats, Codecs or Features
......
...@@ -157,7 +157,7 @@ static int amf_init_context(AVCodecContext *avctx) ...@@ -157,7 +157,7 @@ static int amf_init_context(AVCodecContext *avctx)
AmfContext *ctx = avctx->priv_data; AmfContext *ctx = avctx->priv_data;
AMF_RESULT res = AMF_OK; AMF_RESULT res = AMF_OK;
// confugure AMF logger // configure AMF logger
// the return of these functions indicates old state and do not affect behaviour // the return of these functions indicates old state and do not affect behaviour
ctx->trace->pVtbl->EnableWriter(ctx->trace, AMF_TRACE_WRITER_DEBUG_OUTPUT, ctx->log_to_dbg != 0 ); ctx->trace->pVtbl->EnableWriter(ctx->trace, AMF_TRACE_WRITER_DEBUG_OUTPUT, ctx->log_to_dbg != 0 );
if (ctx->log_to_dbg) if (ctx->log_to_dbg)
...@@ -414,7 +414,7 @@ static int amf_copy_buffer(AVCodecContext *avctx, AVPacket *pkt, AMFBuffer *buff ...@@ -414,7 +414,7 @@ static int amf_copy_buffer(AVCodecContext *avctx, AVPacket *pkt, AMFBuffer *buff
return 0; return 0;
} }
// amfenc API implmentation // amfenc API implementation
int ff_amf_encode_init(AVCodecContext *avctx) int ff_amf_encode_init(AVCodecContext *avctx)
{ {
AmfContext *ctx = avctx->priv_data; AmfContext *ctx = avctx->priv_data;
......
...@@ -361,7 +361,6 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx) ...@@ -361,7 +361,6 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
static const AVCodecDefault defaults[] = { static const AVCodecDefault defaults[] = {
{ "refs", "-1" }, { "refs", "-1" },
{ "aspect", "0" }, { "aspect", "0" },
{ "sar", "0" },
{ "qmin", "-1" }, { "qmin", "-1" },
{ "qmax", "-1" }, { "qmax", "-1" },
{ "b", "2M" }, { "b", "2M" },
...@@ -376,7 +375,7 @@ static const AVClass h264_amf_class = { ...@@ -376,7 +375,7 @@ static const AVClass h264_amf_class = {
.option = options, .option = options,
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
}; };
//TODO declare as HW encoder when available
AVCodec ff_h264_amf_encoder = { AVCodec ff_h264_amf_encoder = {
.name = "h264_amf", .name = "h264_amf",
.long_name = NULL_IF_CONFIG_SMALL("AMD AMF H.264 Encoder"), .long_name = NULL_IF_CONFIG_SMALL("AMD AMF H.264 Encoder"),
...@@ -389,7 +388,8 @@ AVCodec ff_h264_amf_encoder = { ...@@ -389,7 +388,8 @@ AVCodec ff_h264_amf_encoder = {
.priv_data_size = sizeof(AmfContext), .priv_data_size = sizeof(AmfContext),
.priv_class = &h264_amf_class, .priv_class = &h264_amf_class,
.defaults = defaults, .defaults = defaults,
.capabilities = AV_CODEC_CAP_DELAY, .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.pix_fmts = ff_amf_pix_fmts, .pix_fmts = ff_amf_pix_fmts,
.wrapper_name = "amf",
}; };
...@@ -295,7 +295,6 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx) ...@@ -295,7 +295,6 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
static const AVCodecDefault defaults[] = { static const AVCodecDefault defaults[] = {
{ "refs", "-1" }, { "refs", "-1" },
{ "aspect", "0" }, { "aspect", "0" },
{ "sar", "0" },
{ "b", "2M" }, { "b", "2M" },
{ "g", "250" }, { "g", "250" },
{ "slices", "1" }, { "slices", "1" },
...@@ -307,7 +306,7 @@ static const AVClass hevc_amf_class = { ...@@ -307,7 +306,7 @@ static const AVClass hevc_amf_class = {
.option = options, .option = options,
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
}; };
//TODO declare as HW encoder when available
AVCodec ff_hevc_amf_encoder = { AVCodec ff_hevc_amf_encoder = {
.name = "hevc_amf", .name = "hevc_amf",
.long_name = NULL_IF_CONFIG_SMALL("AMD AMF HEVC encoder"), .long_name = NULL_IF_CONFIG_SMALL("AMD AMF HEVC encoder"),
...@@ -320,7 +319,8 @@ AVCodec ff_hevc_amf_encoder = { ...@@ -320,7 +319,8 @@ AVCodec ff_hevc_amf_encoder = {
.priv_data_size = sizeof(AmfContext), .priv_data_size = sizeof(AmfContext),
.priv_class = &hevc_amf_class, .priv_class = &hevc_amf_class,
.defaults = defaults, .defaults = defaults,
.capabilities = AV_CODEC_CAP_DELAY, .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.pix_fmts = ff_amf_pix_fmts, .pix_fmts = ff_amf_pix_fmts,
.wrapper_name = "amf",
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment