mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-19 02:41:10 +03:00
feat(codec): use SVT-AV1 for AV1 encoding on 64-bit targets
Encode AV1 with SVT-AV1 v4.2.0 (rtc + low delay + CBR) instead of libaom on all 64-bit targets; 32-bit targets keep aom. Decoding is unchanged and the wire format is still AV1, so old peers are unaffected. - vcpkg overlay port pinned to v4.2.0: static build, LTO off (mixed toolchain safety), MSVC >= 1950 inline workaround, no forced llvm binutils - low delay contract: one packet out per picture in, blocking get_packet - bitrate and frame rate change on the fly via RATE_CHANGE_EVENT / FRAME_RATE_CHANGE_EVENT; VideoQoS pushes its pacing rate through the new EncoderApi::set_fps, applied only after a successful send - fall back to aom for i444 (svt-av1 is 4:2:0 only), for unsupported resolutions and on encoder init failure - test_av1 now gates auto AV1 on the encoder actually used, the cached verdict is re-keyed (SVT-Y/SVT-N) so upgrades re-measure - unit tests: per-frame packet contract, aom cross-decode of the bitstream, on-the-fly event acceptance Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Wf7v1KJM6mbhiYxWSz4PH
This commit is contained in:
13
res/vcpkg/svt-av1/no-force-llvm.diff
Normal file
13
res/vcpkg/svt-av1/no-force-llvm.diff
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c0c9767..93ec320 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -192,7 +192,7 @@ set(PC_LIBS_PRIVATE)
|
||||
set(PC_REQUIRES_PRIVATE)
|
||||
|
||||
#Clang support, required to build static with LTO
|
||||
-if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND UNIX AND NOT APPLE)
|
||||
+if(FALSE)
|
||||
find_program(LLVM_LD_EXE llvm-ld)
|
||||
find_program(LLVM_AR_EXE llvm-ar)
|
||||
find_program(LLVM_RANLIB_EXE llvm-ranlib)
|
||||
19
res/vcpkg/svt-av1/no-inline-yy_unpacklo_epi128.diff
Normal file
19
res/vcpkg/svt-av1/no-inline-yy_unpacklo_epi128.diff
Normal file
@@ -0,0 +1,19 @@
|
||||
diff --git a/Source/Lib/ASM_AVX2/synonyms_avx2.h b/Source/Lib/ASM_AVX2/synonyms_avx2.h
|
||||
index f615e2569..9a7667724 100644
|
||||
--- a/Source/Lib/ASM_AVX2/synonyms_avx2.h
|
||||
+++ b/Source/Lib/ASM_AVX2/synonyms_avx2.h
|
||||
@@ -75,7 +75,13 @@ static INLINE __m256i yy_loadu2_128(const void *hi, const void *lo) {
|
||||
return yy_set_m128i(mhi, mlo);
|
||||
}
|
||||
|
||||
-static INLINE __m256i yy_unpacklo_epi128(const __m256i in0, const __m256i in1) {
|
||||
+#if defined(_MSC_VER) && _MSC_VER >= 1950
|
||||
+#define MAYBE_INLINE NOINLINE
|
||||
+#else
|
||||
+#define MAYBE_INLINE INLINE
|
||||
+#endif
|
||||
+
|
||||
+static MAYBE_INLINE __m256i yy_unpacklo_epi128(const __m256i in0, const __m256i in1) {
|
||||
return _mm256_inserti128_si256(in0, _mm256_castsi256_si128(in1), 1);
|
||||
}
|
||||
|
||||
45
res/vcpkg/svt-av1/portfile.cmake
Normal file
45
res/vcpkg/svt-av1/portfile.cmake
Normal file
@@ -0,0 +1,45 @@
|
||||
vcpkg_from_gitlab(
|
||||
GITLAB_URL https://gitlab.com
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO AOMediaCodec/SVT-AV1
|
||||
REF v${VERSION}
|
||||
SHA512 37df96559af179d28acae10cdff98c94ee2c4ee086b2446ab362b57be9adf566d6f2adc28faa30648798d9bc7d18eaeb2d0665e7292982652496b605342e1c4b
|
||||
PATCHES
|
||||
# upstream forces llvm-ld/llvm-ar/llvm-ranlib for clang static builds on
|
||||
# non-Apple unix, which breaks toolchains without the llvm binutils
|
||||
no-force-llvm.diff
|
||||
# MSVC >= 1950 miscompiles the inlined yy_unpacklo_epi128
|
||||
no-inline-yy_unpacklo_epi128.diff
|
||||
)
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE MATCHES "^(x86|x64)$")
|
||||
# NASM is required to build the x86/x64 assembly
|
||||
vcpkg_find_acquire_program(NASM)
|
||||
set(SIMD_OPTIONS -DCOMPILE_C_ONLY=OFF "-DCMAKE_ASM_NASM_COMPILER=${NASM}")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "^(arm64|arm64ec)$" AND NOT VCPKG_TARGET_IS_WINDOWS)
|
||||
set(SIMD_OPTIONS -DCOMPILE_C_ONLY=OFF)
|
||||
else()
|
||||
set(SIMD_OPTIONS -DCOMPILE_C_ONLY=ON)
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
${SIMD_OPTIONS}
|
||||
-DBUILD_APPS=OFF
|
||||
-DBUILD_TESTING=OFF
|
||||
-DREPRODUCIBLE_BUILDS=ON
|
||||
# SVT-AV1 defaults LTO to ON for gcc>=9/clang>=12, which puts LTO
|
||||
# bitcode into the static archive and breaks linking with a different
|
||||
# compiler version
|
||||
-DSVT_AV1_LTO=OFF
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME SVT-AV1 CONFIG_PATH lib/cmake/SVT-AV1)
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md" "${SOURCE_PATH}/PATENTS.md")
|
||||
19
res/vcpkg/svt-av1/vcpkg.json
Normal file
19
res/vcpkg/svt-av1/vcpkg.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "svt-av1",
|
||||
"version-semver": "4.2.0",
|
||||
"port-version": 0,
|
||||
"description": "Scalable Video Technology AV1 software video encoder library",
|
||||
"homepage": "https://gitlab.com/AOMediaCodec/SVT-AV1",
|
||||
"license": "BSD-3-Clause-Clear",
|
||||
"supports": "!x86 & !arm32 & !uwp",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user