Skip to content

Commit e6f13af

Browse files
committed
obs-nvenc-test: Add SDK 13.0 features and Blackwell
1 parent d504b77 commit e6f13af

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

plugins/obs-nvenc/obs-nvenc-test/obs-nvenc-test.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define NOMINMAX
2+
13
#include <string_view>
24
#include <unordered_map>
35
#include <vector>
@@ -65,6 +67,7 @@ const unordered_map<uint32_t, const string_view> arch_to_name = {
6567
{7, "Ampere"},
6668
{8, "Ada"},
6769
{9, "Hopper"},
70+
{10, "Blackwell"},
6871
};
6972

7073
/* List of capabilities to be queried per codec */
@@ -84,6 +87,11 @@ static const vector<pair<NV_ENC_CAPS, string>> capabilities = {
8487
/* SDK 12.2+ features */
8588
{NV_ENC_CAPS_SUPPORT_TEMPORAL_FILTER, "temporal_filter"},
8689
{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"},
8795
#endif
8896
};
8997

@@ -367,6 +375,20 @@ static bool get_adapter_caps(int adapter_idx, codec_caps_map &caps, device_info
367375
if (v > caps[codec_name][name])
368376
caps[codec_name][name] = v;
369377
}
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
370392
}
371393

372394
return true;
@@ -449,6 +471,18 @@ bool nvenc_checks(codec_caps_map &caps, vector<device_info> &device_infos)
449471
return false;
450472
}
451473

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+
452486
return true;
453487
}
454488

0 commit comments

Comments
 (0)