mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
fix(amf): attempt to use level 5.1/5.2 for hevc (#3888)
Some checks failed
CodeQL / CodeQL (push) Has been cancelled
CI / GitHub Env Debug (push) Has been cancelled
CI / Release Setup (push) Has been cancelled
localize / Update Localization (push) Has been cancelled
Build GH-Pages / prep (push) Has been cancelled
CI / Docker (push) Has been cancelled
CI / Homebrew (push) Has been cancelled
CI / Linux (push) Has been cancelled
CI / Linux Copr (push) Has been cancelled
CI / Linux Flatpak (push) Has been cancelled
CI / Windows (push) Has been cancelled
CI / Coverage-Homebrew-macos-13 (push) Has been cancelled
CI / Coverage-Homebrew-macos-14 (push) Has been cancelled
CI / Coverage-Homebrew-macos-15 (push) Has been cancelled
CI / Coverage-Homebrew-ubuntu-latest (push) Has been cancelled
CI / Coverage-Linux-AppImage (push) Has been cancelled
CI / Coverage-Windows-AMD64 (push) Has been cancelled
CI / Release (push) Has been cancelled
Build GH-Pages / call-jekyll-build (push) Has been cancelled
Some checks failed
CodeQL / CodeQL (push) Has been cancelled
CI / GitHub Env Debug (push) Has been cancelled
CI / Release Setup (push) Has been cancelled
localize / Update Localization (push) Has been cancelled
Build GH-Pages / prep (push) Has been cancelled
CI / Docker (push) Has been cancelled
CI / Homebrew (push) Has been cancelled
CI / Linux (push) Has been cancelled
CI / Linux Copr (push) Has been cancelled
CI / Linux Flatpak (push) Has been cancelled
CI / Windows (push) Has been cancelled
CI / Coverage-Homebrew-macos-13 (push) Has been cancelled
CI / Coverage-Homebrew-macos-14 (push) Has been cancelled
CI / Coverage-Homebrew-macos-15 (push) Has been cancelled
CI / Coverage-Homebrew-ubuntu-latest (push) Has been cancelled
CI / Coverage-Linux-AppImage (push) Has been cancelled
CI / Coverage-Windows-AMD64 (push) Has been cancelled
CI / Release (push) Has been cancelled
Build GH-Pages / call-jekyll-build (push) Has been cancelled
This commit is contained in:
@@ -765,6 +765,18 @@ namespace video {
|
||||
{"usage"s, &config::video.amd.amd_usage_hevc},
|
||||
{"vbaq"s, &config::video.amd.amd_vbaq},
|
||||
{"enforce_hrd"s, &config::video.amd.amd_enforce_hrd},
|
||||
{"level"s, [](const config_t &cfg) {
|
||||
auto size = cfg.width * cfg.height;
|
||||
// For 4K and below, try to use level 5.1 or 5.2 if possible
|
||||
if (size <= 8912896) {
|
||||
if (size * cfg.framerate <= 534773760) {
|
||||
return "5.1"s;
|
||||
} else if (size * cfg.framerate <= 1069547520) {
|
||||
return "5.2"s;
|
||||
}
|
||||
}
|
||||
return "auto"s;
|
||||
}},
|
||||
},
|
||||
{}, // SDR-specific options
|
||||
{}, // HDR-specific options
|
||||
@@ -1639,7 +1651,7 @@ namespace video {
|
||||
ctx->thread_count = ctx->slices;
|
||||
|
||||
AVDictionary *options {nullptr};
|
||||
auto handle_option = [&options](const encoder_t::option_t &option) {
|
||||
auto handle_option = [&options, &config](const encoder_t::option_t &option) {
|
||||
std::visit(
|
||||
util::overloaded {
|
||||
[&](int v) {
|
||||
@@ -1653,7 +1665,7 @@ namespace video {
|
||||
av_dict_set_int(&options, option.name.c_str(), **v, 0);
|
||||
}
|
||||
},
|
||||
[&](std::function<int()> v) {
|
||||
[&](const std::function<int()> &v) {
|
||||
av_dict_set_int(&options, option.name.c_str(), v(), 0);
|
||||
},
|
||||
[&](const std::string &v) {
|
||||
@@ -1663,6 +1675,9 @@ namespace video {
|
||||
if (!v->empty()) {
|
||||
av_dict_set(&options, option.name.c_str(), v->c_str(), 0);
|
||||
}
|
||||
},
|
||||
[&](const std::function<const std::string(const config_t &cfg)> &v) {
|
||||
av_dict_set(&options, option.name.c_str(), v(config).c_str(), 0);
|
||||
}
|
||||
},
|
||||
option.value
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace video {
|
||||
option_t(const option_t &) = default;
|
||||
|
||||
std::string name;
|
||||
std::variant<int, int *, std::optional<int> *, std::function<int()>, std::string, std::string *> value;
|
||||
std::variant<int, int *, std::optional<int> *, std::function<int()>, std::string, std::string *, std::function<const std::string(const config_t &)>> value;
|
||||
|
||||
option_t(std::string &&name, decltype(value) &&value):
|
||||
name {std::move(name)},
|
||||
|
||||
Reference in New Issue
Block a user