Default stream resolution based on eye tracking
This commit is contained in:
@@ -194,10 +194,10 @@ configuration::configuration(xr::system & system)
|
||||
preferred_refresh_rate.reset();
|
||||
minimum_refresh_rate.reset();
|
||||
resolution_scale = 1.0;
|
||||
stream_scale = 0.5;
|
||||
bitrate_bps = 50'000'000;
|
||||
openxr_post_processing = {};
|
||||
passthrough_enabled = system.passthrough_supported() == xr::passthrough_type::color;
|
||||
stream_scale.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +258,8 @@ void configuration::save()
|
||||
if (minimum_refresh_rate)
|
||||
json << ",\"minimum_refresh_rate\":" << *minimum_refresh_rate;
|
||||
json << ",\"resolution_scale\":" << resolution_scale;
|
||||
json << ",\"stream_scale\":" << stream_scale;
|
||||
if (stream_scale)
|
||||
json << ",\"stream_scale\":" << *stream_scale;
|
||||
json << ",\"bitrate_bps\":" << bitrate_bps;
|
||||
json << ",\"openxr_post_processing\":";
|
||||
write_openxr_post_processing(json, openxr_post_processing);
|
||||
@@ -279,3 +280,17 @@ void configuration::save()
|
||||
json << ",\"high_power_mode\":" << std::boolalpha << high_power_mode;
|
||||
json << "}";
|
||||
}
|
||||
|
||||
void configuration::set_stream_scale(float val)
|
||||
{
|
||||
stream_scale = val;
|
||||
}
|
||||
|
||||
float configuration::get_stream_scale() const
|
||||
{
|
||||
if (stream_scale)
|
||||
return *stream_scale;
|
||||
if (check_feature(feature::eye_gaze))
|
||||
return 0.3;
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ public:
|
||||
std::optional<float> preferred_refresh_rate;
|
||||
std::optional<float> minimum_refresh_rate;
|
||||
float resolution_scale = 1.0;
|
||||
float stream_scale = 0.5;
|
||||
uint32_t bitrate_bps = 50'000'000;
|
||||
bool passthrough_enabled = false;
|
||||
bool mic_unprocessed_audio = false;
|
||||
@@ -88,6 +87,7 @@ public:
|
||||
private:
|
||||
mutable std::mutex mutex;
|
||||
std::map<feature, bool> features;
|
||||
std::optional<float> stream_scale;
|
||||
|
||||
void parse_openxr_post_processing_options(simdjson::simdjson_result<simdjson::dom::object> root);
|
||||
|
||||
@@ -96,4 +96,7 @@ public:
|
||||
configuration() = default;
|
||||
|
||||
void save();
|
||||
|
||||
void set_stream_scale(float);
|
||||
float get_stream_scale() const;
|
||||
};
|
||||
|
||||
@@ -673,7 +673,7 @@ void scenes::lobby::gui_settings()
|
||||
// Stream resolution
|
||||
{
|
||||
const int step = 10;
|
||||
const auto current = config.stream_scale;
|
||||
const auto current = config.get_stream_scale();
|
||||
auto intval = int(current * 100 / step);
|
||||
const auto slider = ImGui::SliderInt(
|
||||
_("Stream resolution").append("##stream_scale").c_str(),
|
||||
@@ -685,7 +685,7 @@ void scenes::lobby::gui_settings()
|
||||
{
|
||||
// clamp out of the slider to have the 50% value centered
|
||||
intval = std::clamp(intval, 20 / step, 100 / step);
|
||||
config.stream_scale = intval * step * 0.01;
|
||||
config.set_stream_scale(intval * step * 0.01);
|
||||
config.save();
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
|
||||
@@ -222,8 +222,11 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
info.render_eye_height = view.recommendedImageRectHeight * config.resolution_scale;
|
||||
}
|
||||
|
||||
info.stream_eye_width = info.render_eye_width * config.stream_scale;
|
||||
info.stream_eye_height = info.render_eye_height * config.stream_scale;
|
||||
{
|
||||
auto scale = config.get_stream_scale();
|
||||
info.stream_eye_width = info.render_eye_width * scale;
|
||||
info.stream_eye_height = info.render_eye_height * scale;
|
||||
}
|
||||
|
||||
if (self->instance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user