[FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK

Timo Rothenpieler timo at rothenpieler.org
Thu Nov 23 00:32:23 EET 2017


Am 17.11.2017 um 06:07 schrieb mmironov:
>  From 454aad17fea28e8e4c5abb904341181271971bfc Mon Sep 17 00:00:00 2001
> From: mmironov <mikhail.mironov at amd.com>
> Date: Tue, 14 Nov 2017 17:54:24 -0500
> Subject: [PATCH] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF
>   SDK
> 
> Signed-off-by: mmironov <mikhail.mironov at amd.com>
> ---
>   Changelog                |    1 +
>   compat/amd/amfsdkenc.h   | 1755 ++++++++++++++++++++++++++++++++++++++++++++++
>   configure                |   25 +
>   libavcodec/Makefile      |    4 +
>   libavcodec/allcodecs.c   |    2 +
>   libavcodec/amfenc.c      |  596 ++++++++++++++++
>   libavcodec/amfenc.h      |  143 ++++
>   libavcodec/amfenc_h264.c |  397 +++++++++++
>   libavcodec/amfenc_hevc.c |  327 +++++++++
>   9 files changed, 3250 insertions(+)
>   create mode 100644 compat/amd/amfsdkenc.h
>   create mode 100644 libavcodec/amfenc.c
>   create mode 100644 libavcodec/amfenc.h
>   create mode 100644 libavcodec/amfenc_h264.c
>   create mode 100644 libavcodec/amfenc_hevc.c
> 
...
> diff --git a/configure b/configure
> index 3788f26..cbec01f 100755
> --- a/configure
> +++ b/configure
> @@ -303,6 +303,7 @@ External library support:
>     --disable-zlib           disable zlib [autodetect]
>   
>     The following libraries provide various hardware acceleration features:
> +  --disable-amf            disable AMF video encoding code [autodetect]
>     --disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]
>     --disable-cuda           disable dynamically linked Nvidia CUDA code [autodetect]
>     --enable-cuda-sdk        enable CUDA features that require the CUDA SDK [no]
> @@ -1639,6 +1640,7 @@ EXTERNAL_LIBRARY_LIST="
>   "
>   
>   HWACCEL_AUTODETECT_LIBRARY_LIST="
> +    amf
>       audiotoolbox
>       crystalhd
>       cuda
> @@ -2781,12 +2783,15 @@ scale_npp_filter_deps="cuda libnpp"
>   scale_cuda_filter_deps="cuda_sdk"
>   thumbnail_cuda_filter_deps="cuda_sdk"
>   
> +amf_deps_any="dlopen LoadLibrary"
> +
>   nvenc_deps="cuda"
>   nvenc_deps_any="libdl LoadLibrary"
>   nvenc_encoder_deps="nvenc"
>   
>   h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
>   h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
> +h264_amf_encoder_deps="amf"
>   h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
>   h264_cuvid_decoder_deps="cuvid"
>   h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
> @@ -2803,6 +2808,7 @@ h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
>   h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
>   h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
>   h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
> +hevc_amf_encoder_deps="amf"
>   hevc_cuvid_decoder_deps="cuvid"
>   hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
>   hevc_mediacodec_decoder_deps="mediacodec"
> @@ -6171,6 +6177,18 @@ else
>       disable cuda cuvid nvdec nvenc
>   fi
>   
> +if enabled x86; then
> +    case $target_os in
> +        mingw32*|mingw64*|win32|win64|cygwin*)
> +            ;;
> +        *)
> +            disable amf
> +            ;;
> +    esac
> +else
> +    disable amf
> +fi
> +

Can't this be integrated into the nvenc case, that, except for also 
having linux, does pretty much the same?
Like, moving linux to its own case that only disables amf, and adding 
amf to the other two nvenc/cuvid/nvdec disable-lines.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3994 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171122/a18dc488/attachment.bin>


More information about the ffmpeg-devel mailing list