feat(encode): native QSV backend — libvpl-sys + qsv.rs (Phases 0-3 of design/native-qsv-encoder.md)

Vendored MIT VPL dispatcher (static, trimmed tree, pin 674d015b/v2.17.0) built
via cmake+bindgen behind new feature 'qsv' (pf-encode + punktfunk-host forward).
qsv.rs: dispatcher session on the capture adapter (LUID-matched), SetHandle
D3D11, AsyncDepth=1/GopRefDist=1/VDEnc/CBR + HRD-off low-latency config,
GetSurfaceForEncode + GPU CopySubresourceRegion input (zero-copy, no readback
path), bounded sync-point poll, in-place reset with teardown escalation, no-IDR
bitrate retarget (Reset + StartNewSequence=OFF), 10-bit P010 HEVC-Main10/AV1,
HDR mastering/CLL SEI-OBU at IDR + BT.2020/PQ VSI, LTR-RFI via mfxExtRefListCtrl
(AMF slot policy port, Query-gated per codec, wire-index FrameOrder pinning).
Dispatch: native-first with ffmpeg fallback + PUNKTFUNK_QSV_FFMPEG hatch;
probes (can_encode_10bit / windows_codec_support / windows_backend_is_probed)
now answer natively for QSV.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 19:34:18 +02:00
parent bbe4380b41
commit 55e7f3fca9
88 changed files with 29515 additions and 16 deletions
@@ -0,0 +1,111 @@
# ##############################################################################
# Copyright (C) Intel Corporation
#
# SPDX-License-Identifier: MIT
# ##############################################################################
#
# Set compilation options
#
if(MSVC)
add_compile_options("$<$<CONFIG:Debug>:/D_DEBUG>")
else()
add_compile_options("$<$<CONFIG:Debug>:-D_DEBUG -O0 -g>")
endif()
if(ENABLE_WARNING_AS_ERROR)
message(STATUS "Warnings as errors enabled")
set(MFX_DEPRECATED_OFF 1)
endif()
if(DEFINED ENV{MFX_DEPRECATED_OFF})
set(MFX_DEPRECATED_OFF 1)
endif()
if(MFX_DEPRECATED_OFF)
message(STATUS "Deprecation warnings disabled")
add_definitions(-DMFX_DEPRECATED_OFF)
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(MSVC)
add_link_options("/guard:cf")
add_link_options("/DYNAMICBASE")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
add_link_options("/HIGHENTROPYVA")
endif()
add_link_options("/LARGEADDRESSAWARE")
add_link_options("/NXCOMPAT")
if(ENABLE_WARNING_AS_ERROR)
add_compile_options("/WX")
endif()
add_compile_options("/GS")
add_compile_options("/guard:cf")
else()
if(UNIX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
endif()
add_compile_options("-Wformat")
add_compile_options("-Wformat-security")
add_compile_options("-Werror=format-security")
if(NOT MINGW)
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
if(NOT CMAKE_BUILD_TYPE MATCHES debug)
add_definitions("-D_FORTIFY_SOURCE=2")
endif()
endif()
if(NOT MINGW)
add_compile_options("-fstack-protector-strong")
endif()
if(NOT MINGW)
add_link_options("-Wl,-z,relro,-z,now,-z,noexecstack")
endif()
add_compile_options("-Wall")
if(ENABLE_WARNING_AS_ERROR)
add_compile_options("-Werror")
endif()
endif()
# Define RelWithDebRT Build Mode
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
set(CMAKE_RELWITHDEBRT_POSTFIX "d")
set(CMAKE_CXX_FLAGS_RELWITHDEBRT
"${CMAKE_CXX_FLAGS_RELEASE}"
CACHE STRING "Flags used by the C++ compiler during RelWithDebRT builds."
FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBRT
"${CMAKE_C_FLAGS_RELEASE}"
CACHE STRING "Flags used by the C compiler during RelWithDebRT builds."
FORCE)
foreach(build_flag CMAKE_CXX_FLAGS_RELWITHDEBRT CMAKE_C_FLAGS_RELWITHDEBRT)
string(REPLACE "/MDd" "" ${build_flag} "${${build_flag}}")
string(REPLACE "/MTd" "" ${build_flag} "${${build_flag}}")
string(REPLACE "/MD" "" ${build_flag} "${${build_flag}}")
string(REPLACE "/MT" "" ${build_flag} "${${build_flag}}")
set(${build_flag} "${${build_flag}} /MDd /DEBUG:NONE")
endforeach()
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBRT
"${CMAKE_EXE_LINKER_FLAGS_RELEASE}"
CACHE STRING
"Flags used for linking binaries during RelWithDebRT builds." FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBRT
"${CMAKE_SHARED_LINKER_FLAGS_RELEASE}"
CACHE
STRING
"Flags used by the shared libraries linker during RelWithDebRT builds."
FORCE)
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBRT
"${CMAKE_MODULE_LINKER_FLAGS_RELEASE}"
CACHE STRING "Flags used by the linker during RelWithDebRT builds." FORCE)
mark_as_advanced(
CMAKE_CXX_FLAGS_RELWITHDEBRT CMAKE_C_FLAGS_RELWITHDEBRT
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBRT CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBRT)
# Add RelWithDebRT to avalible config types
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES};RelWithDebRT")
endif()
+101
View File
@@ -0,0 +1,101 @@
# ##############################################################################
# Copyright (C) Intel Corporation
#
# SPDX-License-Identifier: MIT
# ##############################################################################
#
# Set installation directories
#
if(WIN32
AND NOT CMAKE_CROSSCOMPILING
AND CMAKE_SIZEOF_VOID_P EQUAL 4)
if(NOT CMAKE_INSTALL_BINDIR)
set(BINARCH x86)
endif()
if(NOT CMAKE_INSTALL_LIBDIR)
set(LIBARCH x86)
endif()
endif()
# See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html for
# variables GNUInstallDirs exposes. This project commonly uses:
# CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_DOCDIR CMAKE_INSTALL_BINDIR
# CMAKE_INSTALL_LIBDIR
include(GNUInstallDirs)
set(CMAKE_INSTALL_DOCDIR ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME})
gnuinstalldirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_DOCDIR
CMAKE_INSTALL_DOCDIR DOCDIR)
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_INSTALL_BINDIR
${CMAKE_INSTALL_BINDIR}/${BINARCH}
CACHE PATH "user executables" FORCE)
set(CMAKE_INSTALL_LIBDIR
${CMAKE_INSTALL_LIBDIR}/${LIBARCH}
CACHE PATH "Object code libraries" FORCE)
foreach(dir LIBDIR BINDIR)
gnuinstalldirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir}
CMAKE_INSTALL_${dir} ${dir})
endforeach()
endif()
if(NOT VPL_INSTALL_PKGCONFIGDIR)
set(VPL_INSTALL_PKGCONFIGDIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
set(VPL_INSTALL_FULL_PKGCONFIGDIR ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig)
else()
gnuinstalldirs_get_absolute_install_dir(
VPL_INSTALL_FULL_PKGCONFIGDIR VPL_INSTALL_PKGCONFIGDIR
VPL_INSTALL_PKGCONFIGDIR)
endif()
if(NOT VPL_INSTALL_CMAKEDIR)
set(VPL_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake)
set(VPL_INSTALL_FULL_CMAKEDIR ${CMAKE_INSTALL_FULL_LIBDIR}/cmake)
else()
gnuinstalldirs_get_absolute_install_dir(
VPL_INSTALL_FULL_CMAKEDIR VPL_INSTALL_CMAKEDIR VPL_INSTALL_CMAKEDIR)
endif()
if(NOT VPL_INSTALL_ENVDIR)
set(VPL_INSTALL_ENVDIR ${CMAKE_INSTALL_SYSCONFDIR}/${PROJECT_NAME})
set(VPL_INSTALL_FULL_ENVDIR ${CMAKE_INSTALL_FULL_SYSCONFDIR}/${PROJECT_NAME})
else()
gnuinstalldirs_get_absolute_install_dir(VPL_INSTALL_FULL_ENVDIR
VPL_INSTALL_ENVDIR VPL_INSTALL_ENVDIR)
endif()
if(NOT VPL_INSTALL_MODFILEDIR)
set(VPL_INSTALL_MODFILEDIR ${CMAKE_INSTALL_SYSCONFDIR}/modulefiles)
set(VPL_INSTALL_FULL_MODFILEDIR ${CMAKE_INSTALL_FULL_SYSCONFDIR}/modulefiles)
else()
gnuinstalldirs_get_absolute_install_dir(
VPL_INSTALL_FULL_MODFILEDIR VPL_INSTALL_MODFILEDIR VPL_INSTALL_MODFILEDIR)
endif()
if(NOT VPL_INSTALL_EXAMPLEDIR)
set(VPL_INSTALL_EXAMPLEDIR
${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/examples)
set(VPL_INSTALL_FULL_EXAMPLEDIR
${CMAKE_INSTALL_FULL_DATAROOTDIR}/${PROJECT_NAME}/examples)
else()
gnuinstalldirs_get_absolute_install_dir(
VPL_INSTALL_FULL_EXAMPLEDIR VPL_INSTALL_EXAMPLEDIR VPL_INSTALL_EXAMPLEDIR)
endif()
if(NOT VPL_INSTALL_LICENSEDIR)
set(VPL_INSTALL_LICENSEDIR
${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/licensing)
set(VPL_INSTALL_FULL_LICENSEDIR
${CMAKE_INSTALL_FULL_DATAROOTDIR}/${PROJECT_NAME}/licensing)
else()
gnuinstalldirs_get_absolute_install_dir(
VPL_INSTALL_FULL_LICENSEDIR VPL_INSTALL_LICENSEDIR VPL_INSTALL_LICENSEDIR)
endif()
if(WIN32)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ${CMAKE_INSTALL_BINDIR})
else()
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
@@ -0,0 +1,30 @@
# ##############################################################################
# Copyright (C) Intel Corporation
#
# SPDX-License-Identifier: MIT
# ##############################################################################
#
# Packaging
#
set(CPACK_GENERATOR "ZIP")
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR})
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(VPL_COMPONENT_DEV dev)
set(VPL_COMPONENT_LIB lib)
set(VPL_COMPONENT_TOOLS tools)
set(CPACK_COMPONENTS_ALL all ${VPL_COMPONENT_DEV} ${VPL_COMPONENT_LIB}
${VPL_COMPONENT_TOOLS})
set(CPACK_COMPONENTS_GROUPING IGNORE)
include(CPack)
cpack_add_component(${VPL_COMPONENT_LIB})
cpack_add_component(${VPL_COMPONENT_DEV} DEPENDS ${VPL_COMPONENT_LIB})
cpack_add_component(${VPL_COMPONENT_TOOLS} DEPENDS ${VPL_COMPONENT_LIB})