build(windows): add arm64 support (#3905)

Signed-off-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
Signed-off-by: Coia Prant <coiaprant@gmail.com>
Co-authored-by: Ricky8955555 <rkmiao@duck.com>
Co-authored-by: Mike Fara <mjfara@gmail.com>
Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
This commit is contained in:
Coia Prant
2026-02-08 10:03:05 +08:00
committed by GitHub
parent cdc444314f
commit d591643706
20 changed files with 242 additions and 56 deletions
+70 -5
View File
@@ -300,6 +300,7 @@ namespace video {
ALWAYS_REPROBE = 1 << 9, ///< This is an encoder of last resort and we want to aggressively probe for a better one
YUV444_SUPPORT = 1 << 10, ///< Encoder may support 4:4:4 chroma sampling depending on hardware
ASYNC_TEARDOWN = 1 << 11, ///< Encoder supports async teardown on a different thread
FIXED_GOP_SIZE = 1 << 12, ///< Use fixed small GOP size (encoder doesn't support on-demand IDR frames)
};
class avcodec_encode_session_t: public encode_session_t {
@@ -825,6 +826,63 @@ namespace video {
},
PARALLEL_ENCODING
};
encoder_t mediafoundation {
"mediafoundation"sv,
std::make_unique<encoder_platform_formats_avcodec>(
AV_HWDEVICE_TYPE_D3D11VA,
AV_HWDEVICE_TYPE_NONE,
AV_PIX_FMT_D3D11,
AV_PIX_FMT_NV12, // SDR 4:2:0 8-bit (only format Qualcomm supports)
AV_PIX_FMT_NONE, // No HDR - Qualcomm MF only supports 8-bit
AV_PIX_FMT_NONE, // No YUV444 SDR
AV_PIX_FMT_NONE, // No YUV444 HDR
dxgi_init_avcodec_hardware_input_buffer
),
{
// Common options for AV1 - Qualcomm MF encoder
{
{"hw_encoding"s, 1},
{"rate_control"s, "cbr"s},
{"scenario"s, "display_remoting"s},
},
{}, // SDR-specific options
{}, // HDR-specific options
{}, // YUV444 SDR-specific options
{}, // YUV444 HDR-specific options
{}, // Fallback options
"av1_mf"s,
},
{
// Common options for HEVC - Qualcomm MF encoder
{
{"hw_encoding"s, 1},
{"rate_control"s, "cbr"s},
{"scenario"s, "display_remoting"s},
},
{}, // SDR-specific options
{}, // HDR-specific options
{}, // YUV444 SDR-specific options
{}, // YUV444 HDR-specific options
{}, // Fallback options
"hevc_mf"s,
},
{
// Common options for H.264 - Qualcomm MF encoder
{
{"hw_encoding"s, 1},
{"rate_control"s, "cbr"s},
{"scenario"s, "display_remoting"s},
},
{}, // SDR-specific options
{}, // HDR-specific options
{}, // YUV444 SDR-specific options
{}, // YUV444 HDR-specific options
{}, // Fallback options
"h264_mf"s,
},
PARALLEL_ENCODING | FIXED_GOP_SIZE // MF encoder doesn't support on-demand IDR frames
};
#endif
encoder_t software {
@@ -1031,6 +1089,7 @@ namespace video {
#ifdef _WIN32
&quicksync,
&amdvce,
&mediafoundation,
#endif
#if defined(__linux__) || defined(linux) || defined(__linux) || defined(__FreeBSD__)
&vaapi,
@@ -1566,11 +1625,17 @@ namespace video {
ctx->max_b_frames = 0;
// Use an infinite GOP length since I-frames are generated on demand
ctx->gop_size = encoder.flags & LIMITED_GOP_SIZE ?
std::numeric_limits<std::int16_t>::max() :
std::numeric_limits<int>::max();
ctx->keyint_min = std::numeric_limits<int>::max();
// Exception: encoders with FIXED_GOP_SIZE flag don't support on-demand IDR
if (encoder.flags & FIXED_GOP_SIZE) {
// Fixed GOP for encoders that don't support on-demand IDR (e.g. Media Foundation)
ctx->gop_size = 120; // ~2 seconds at 60 FPS - larger to reduce oversized IDR frame frequency
ctx->keyint_min = 120;
} else {
ctx->gop_size = encoder.flags & LIMITED_GOP_SIZE ?
std::numeric_limits<std::int16_t>::max() :
std::numeric_limits<int>::max();
ctx->keyint_min = std::numeric_limits<int>::max();
}
// Some client decoders have limits on the number of reference frames
if (config.numRefFrames) {