1
+ #define NOMINMAX
2
+
1
3
#include < string_view>
2
4
#include < unordered_map>
3
5
#include < vector>
@@ -65,6 +67,7 @@ const unordered_map<uint32_t, const string_view> arch_to_name = {
65
67
{7 , " Ampere" },
66
68
{8 , " Ada" },
67
69
{9 , " Hopper" },
70
+ {10 , " Blackwell" },
68
71
};
69
72
70
73
/* List of capabilities to be queried per codec */
@@ -84,6 +87,11 @@ static const vector<pair<NV_ENC_CAPS, string>> capabilities = {
84
87
/* SDK 12.2+ features */
85
88
{NV_ENC_CAPS_SUPPORT_TEMPORAL_FILTER, " temporal_filter" },
86
89
{NV_ENC_CAPS_SUPPORT_LOOKAHEAD_LEVEL, " lookahead_level" },
90
+ {NV_ENC_CAPS_SUPPORT_UNIDIRECTIONAL_B, " unidirectional_b" },
91
+ #endif
92
+ #if NVENCAPI_MAJOR_VERSION >= 13
93
+ /* SDK 13.0+ features */
94
+ {NV_ENC_CAPS_SUPPORT_YUV422_ENCODE, " yuv_422" },
87
95
#endif
88
96
};
89
97
@@ -367,6 +375,20 @@ static bool get_adapter_caps(int adapter_idx, codec_caps_map &caps, device_info
367
375
if (v > caps[codec_name][name])
368
376
caps[codec_name][name] = v;
369
377
}
378
+
379
+ #if NVENCAPI_MAJOR_VERSION > 12 || NVENCAPI_MINOR_VERSION >= 2
380
+ /* Explicitly check if UHQ tuning is supported since temporal filtering query is true for all codecs. */
381
+ NV_ENC_PRESET_CONFIG preset_config = {};
382
+ preset_config.version = NV_ENC_PRESET_CONFIG_VER;
383
+ preset_config.presetCfg .version = NV_ENC_CONFIG_VER;
384
+
385
+ NVENCSTATUS res = nv.nvEncGetEncodePresetConfigEx (nvSession.ptr , *guid, NV_ENC_PRESET_P7_GUID,
386
+ NV_ENC_TUNING_INFO_ULTRA_HIGH_QUALITY,
387
+ &preset_config);
388
+
389
+ device_info.caps [codec_name][" uhq" ] = res == NV_ENC_SUCCESS ? 1 : 0 ;
390
+ caps[codec_name][" uhq" ] = std::max (device_info.caps [codec_name][" uhq" ], caps[codec_name][" uhq" ]);
391
+ #endif
370
392
}
371
393
372
394
return true ;
@@ -449,6 +471,18 @@ bool nvenc_checks(codec_caps_map &caps, vector<device_info> &device_infos)
449
471
return false ;
450
472
}
451
473
474
+ uint32_t latest_archictecture = 0 ;
475
+ string_view architecture = " Unknown" ;
476
+
477
+ for (auto &info : device_infos)
478
+ latest_archictecture = std::max (info.architecture , latest_archictecture);
479
+ if (arch_to_name.count (latest_archictecture))
480
+ architecture = arch_to_name.at (latest_archictecture);
481
+
482
+ printf (" latest_architecture=%u\n "
483
+ " latest_architecture_name=%s\n " ,
484
+ latest_archictecture, architecture.data ());
485
+
452
486
return true ;
453
487
}
454
488
0 commit comments