[FFmpeg-devel] [PATCH v3 4/8] lavfi: add common Vulkan filtering code
James Almer
jamrial at gmail.com
Tue May 22 06:49:56 EEST 2018
On 5/21/2018 11:46 PM, Rostislav Pehlivanov wrote:
> This commit adds a common code for use in Vulkan filters. It attempts
> to ease the burden of writing Vulkan image filtering to a minimum,
> which is pretty much a requirement considering how verbose the API is.
>
> It supports both compute and graphic pipelines and manages to abstract
> the API to such a level there's no need to call any Vulkan functions
> inside the init path of the code. Handling shader descriptors is probably
> the bulk of the code, and despite the abstraction, it loses none of the
> features for describing shader IO.
>
> In order to produce linkable shaders, it depends on the libshaderc
> library (and depends on the latest stable version of it). This allows
> for greater performance and flexibility than static built-in shaders
> and also eliminates the cumbersome process of interfacing with glslang
> to compile GLSL to SPIR-V.
>
> It's based off of the common opencl and provides similar interfaces for
> filter pad init and config, with the addition that it also supports
> in-place filtering.
>
> Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>
> ---
> configure | 10 +-
> libavfilter/vulkan.c | 1186 ++++++++++++++++++++++++++++++++++++++++++
> libavfilter/vulkan.h | 223 ++++++++
> 3 files changed, 1418 insertions(+), 1 deletion(-)
> create mode 100644 libavfilter/vulkan.c
> create mode 100644 libavfilter/vulkan.h
>
> diff --git a/configure b/configure
> index 5f4407b753..52c1e7a6e8 100755
> --- a/configure
> +++ b/configure
> @@ -252,6 +252,7 @@ External library support:
> --enable-librsvg enable SVG rasterization via librsvg [no]
> --enable-librubberband enable rubberband needed for rubberband filter [no]
> --enable-librtmp enable RTMP[E] support via librtmp [no]
> + --enable-libshaderc enable GLSL->SPIRV compilation via libshaderc [no]
> --enable-libshine enable fixed-point MP3 encoding via libshine [no]
> --enable-libsmbclient enable Samba protocol via libsmbclient [no]
> --enable-libsnappy enable Snappy compression, needed for hap encoding [no]
> @@ -1707,6 +1708,7 @@ EXTERNAL_LIBRARY_LIST="
> libpulse
> librsvg
> librtmp
> + libshaderc
> libshine
> libsmbclient
> libsnappy
> @@ -2225,6 +2227,7 @@ HAVE_LIST="
> opencl_dxva2
> opencl_vaapi_beignet
> opencl_vaapi_intel_media
> + shaderc_opt_perf
> vulkan_drm_mod
> perl
> pod2man
> @@ -3461,7 +3464,7 @@ avformat_deps="avcodec avutil"
> avformat_suggest="libm network zlib"
> avresample_deps="avutil"
> avresample_suggest="libm"
> -avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi videotoolbox corefoundation corevideo coremedia bcrypt"
> +avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl vulkan libshaderc user32 vaapi videotoolbox corefoundation corevideo coremedia bcrypt"
libshaderc is not being used by avutil. You should add it to avfilter
instead.
> postproc_deps="avutil gpl"
> postproc_suggest="libm"
> swresample_deps="avutil"
> @@ -6050,6 +6053,7 @@ enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaud
> enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
> enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
> enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
> +enabled libshaderc && require libshaderc shaderc/shaderc.h shaderc_compiler_initialize -lshaderc_shared
> enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
> enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
> require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
> @@ -6355,6 +6359,10 @@ enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.
> enabled vulkan &&
> require_pkg_config vulkan "vulkan >= 1.1.73" "vulkan/vulkan.h" vkCreateInstance
>
> +if enabled_all vulkan libshaderc ; then
> + check_cc shaderc_opt_perf shaderc/shaderc.h "int t = shaderc_optimization_level_performance"
You don't seem to be using shaderc_opt_perf anywhere, be it this patch
or the following ones.
> +fi
> +
> if enabled_all vulkan libdrm ; then
> check_cpp_condition vulkan_drm_mod vulkan/vulkan.h "defined VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME"
> fi
More information about the ffmpeg-devel
mailing list