diff --git a/src/nvhttp.cpp b/src/nvhttp.cpp index c2e081ab628..7cceb3569a9 100644 --- a/src/nvhttp.cpp +++ b/src/nvhttp.cpp @@ -1182,10 +1182,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; } @@ -1195,10 +1195,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; diff --git a/src/video.cpp b/src/video.cpp index 843a19a0a58..bcae65e134e 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -1472,6 +1472,8 @@ namespace video { 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 last_encoder_probe_supported_yuv444_for_codec = {}; ///< YUV444 support discovered for each probed codec. + std::array last_encoder_probe_supported_dynamic_range_for_codec = {}; ///< 10-bit 4:2:0 support discovered for each probed codec. + std::array last_encoder_probe_supported_dynamic_range_yuv444_for_codec = {}; ///< 10-bit YUV444 support discovered for each probed codec. /** * @brief Recreate a display capture object after a capture failure. @@ -3282,6 +3284,8 @@ namespace video { 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 @@ -3438,6 +3442,18 @@ namespace video { 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) { diff --git a/src/video.h b/src/video.h index 63f3cf55cbf..e138a5001fd 100644 --- a/src/video.h +++ b/src/video.h @@ -682,6 +682,8 @@ namespace video { extern int active_av1_mode; extern bool last_encoder_probe_supported_ref_frames_invalidation; extern std::array last_encoder_probe_supported_yuv444_for_codec; // 0 - H.264, 1 - HEVC, 2 - AV1 + extern std::array last_encoder_probe_supported_dynamic_range_for_codec; // 0 - H.264, 1 - HEVC, 2 - AV1 + extern std::array last_encoder_probe_supported_dynamic_range_yuv444_for_codec; // 0 - H.264, 1 - HEVC, 2 - AV1 /** * @brief Resolve a client-requested dynamic range against probed encoder capabilities.