Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/nvhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,10 +1175,10 @@ namespace nvhttp {
codec_mode_flags |= SCM_HEVC_REXT8_444;
}
}
if (video::active_hevc_mode == 3 || video::active_hevc_mode == 5) {
if ((video::active_hevc_mode == 3 || video::active_hevc_mode == 5) && video::last_encoder_probe_supported_dynamic_range_for_codec[1]) {
codec_mode_flags |= SCM_HEVC_MAIN10;
}
if ((video::active_hevc_mode == 4 || video::active_hevc_mode == 5) && video::last_encoder_probe_supported_yuv444_for_codec[1]) {
if ((video::active_hevc_mode == 4 || video::active_hevc_mode == 5) && video::last_encoder_probe_supported_dynamic_range_yuv444_for_codec[1]) {
codec_mode_flags |= SCM_HEVC_REXT10_444;
}

Expand All @@ -1188,10 +1188,10 @@ namespace nvhttp {
codec_mode_flags |= SCM_AV1_HIGH8_444;
}
}
if (video::active_av1_mode == 3 || video::active_av1_mode == 5) {
if ((video::active_av1_mode == 3 || video::active_av1_mode == 5) && video::last_encoder_probe_supported_dynamic_range_for_codec[2]) {
codec_mode_flags |= SCM_AV1_MAIN10;
}
if ((video::active_av1_mode == 4 || video::active_av1_mode == 5) && video::last_encoder_probe_supported_yuv444_for_codec[2]) {
if ((video::active_av1_mode == 4 || video::active_av1_mode == 5) && video::last_encoder_probe_supported_dynamic_range_yuv444_for_codec[2]) {
codec_mode_flags |= SCM_AV1_HIGH10_444;
}
return codec_mode_flags;
Expand Down
16 changes: 16 additions & 0 deletions src/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,8 @@
int active_av1_mode; ///< AV1 mode selected by the most recent encoder probe.
bool last_encoder_probe_supported_ref_frames_invalidation = false; ///< Whether the last probe found reference-frame invalidation support.
std::array<bool, 3> last_encoder_probe_supported_yuv444_for_codec = {}; ///< YUV444 support discovered for each probed codec.
std::array<bool, 3> last_encoder_probe_supported_dynamic_range_for_codec = {}; ///< 10-bit 4:2:0 support discovered for each probed codec.

Check failure on line 1448 in src/video.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Global variables should be const.

See more on https://sonarcloud.io/project/issues?id=LizardByte_Sunshine&issues=AaCSRXhhSQ3tuMegYdZl&open=AaCSRXhhSQ3tuMegYdZl&pullRequest=5690
std::array<bool, 3> last_encoder_probe_supported_dynamic_range_yuv444_for_codec = {}; ///< 10-bit YUV444 support discovered for each probed codec.

Check failure on line 1449 in src/video.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Global variables should be const.

See more on https://sonarcloud.io/project/issues?id=LizardByte_Sunshine&issues=AaCSRXhhSQ3tuMegYdZm&open=AaCSRXhhSQ3tuMegYdZm&pullRequest=5690

/**
* @brief Recreate a display capture object after a capture failure.
Expand Down Expand Up @@ -3253,6 +3255,8 @@
active_hevc_mode = config::video.hevc_mode;
active_av1_mode = config::video.av1_mode;
last_encoder_probe_supported_ref_frames_invalidation = false;
last_encoder_probe_supported_dynamic_range_for_codec = {};
last_encoder_probe_supported_dynamic_range_yuv444_for_codec = {};

auto adjust_encoder_constraints_hevc = [&](encoder_t *encoder) {
// If we can't satisfy both the encoder and codec requirement, prefer the encoder over codec support
Expand Down Expand Up @@ -3409,6 +3413,18 @@
encoder.hevc[encoder_t::YUV444];
last_encoder_probe_supported_yuv444_for_codec[2] = encoder.av1[encoder_t::PASSED] &&
encoder.av1[encoder_t::YUV444];
last_encoder_probe_supported_dynamic_range_for_codec[0] = encoder.h264[encoder_t::PASSED] &&
encoder.h264[encoder_t::DYNAMIC_RANGE];
last_encoder_probe_supported_dynamic_range_for_codec[1] = encoder.hevc[encoder_t::PASSED] &&
encoder.hevc[encoder_t::DYNAMIC_RANGE];
last_encoder_probe_supported_dynamic_range_for_codec[2] = encoder.av1[encoder_t::PASSED] &&
encoder.av1[encoder_t::DYNAMIC_RANGE];
last_encoder_probe_supported_dynamic_range_yuv444_for_codec[0] = encoder.h264[encoder_t::PASSED] &&
encoder.h264[encoder_t::DYNAMIC_RANGE_YUV444];
last_encoder_probe_supported_dynamic_range_yuv444_for_codec[1] = encoder.hevc[encoder_t::PASSED] &&
encoder.hevc[encoder_t::DYNAMIC_RANGE_YUV444];
last_encoder_probe_supported_dynamic_range_yuv444_for_codec[2] = encoder.av1[encoder_t::PASSED] &&
encoder.av1[encoder_t::DYNAMIC_RANGE_YUV444];

BOOST_LOG(debug) << "------ h264 ------"sv;
for (int x = 0; x < encoder_t::MAX_FLAGS; ++x) {
Expand Down
2 changes: 2 additions & 0 deletions src/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,8 @@
extern int active_av1_mode;
extern bool last_encoder_probe_supported_ref_frames_invalidation;
extern std::array<bool, 3> last_encoder_probe_supported_yuv444_for_codec; // 0 - H.264, 1 - HEVC, 2 - AV1
extern std::array<bool, 3> last_encoder_probe_supported_dynamic_range_for_codec; // 0 - H.264, 1 - HEVC, 2 - AV1

Check failure on line 685 in src/video.h

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Global variables should be const.

See more on https://sonarcloud.io/project/issues?id=LizardByte_Sunshine&issues=AaCSRXmsSQ3tuMegYdZn&open=AaCSRXmsSQ3tuMegYdZn&pullRequest=5690
extern std::array<bool, 3> last_encoder_probe_supported_dynamic_range_yuv444_for_codec; // 0 - H.264, 1 - HEVC, 2 - AV1

Check failure on line 686 in src/video.h

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Global variables should be const.

See more on https://sonarcloud.io/project/issues?id=LizardByte_Sunshine&issues=AaCSRXmsSQ3tuMegYdZo&open=AaCSRXmsSQ3tuMegYdZo&pullRequest=5690

/**
* @brief Resolve a client-requested dynamic range against probed encoder capabilities.
Expand Down