The open source OpenXR runtime

u/aeg: Add optional prefix for having multiple aeg UIs

+38 -14
+35 -10
src/xrt/auxiliary/util/u_autoexpgain.c
··· 18 18 #include <assert.h> 19 19 #include <math.h> 20 20 #include <stdint.h> 21 + #include <stdio.h> 21 22 22 23 DEBUG_GET_ONCE_LOG_OPTION(aeg_log, "AEG_LOG", U_LOGGING_WARN) 23 24 ··· 453 454 } 454 455 455 456 void 456 - u_autoexpgain_add_vars(struct u_autoexpgain *aeg, void *root) 457 + u_autoexpgain_add_vars(struct u_autoexpgain *aeg, void *root, char *prefix) 457 458 { 458 - u_var_add_bool(root, &aeg->enable, "Update brightness automatically"); 459 - u_var_add_i32(root, &aeg->frame_delay, "Frame update delay"); 460 - u_var_add_combo(root, &aeg->strategy_combo, "Strategy"); 461 - u_var_add_draggable_f32(root, &aeg->brightness, "Brightness"); 462 - u_var_add_f32(root, &aeg->threshold, "Score threshold"); 463 - u_var_add_f32(root, &aeg->max_brightness_step, "Max brightness step"); 464 - u_var_add_ro_f32(root, &aeg->current_score, "Image score"); 465 - u_var_add_histogram_f32(root, &aeg->histogram_ui, "Intensity histogram"); 466 - u_var_add_log_level(root, &aeg->log_level, "AEG log level"); 459 + char tmp[256]; 460 + 461 + (void)snprintf(tmp, sizeof(tmp), "%sAuto exposure and gain control", prefix); 462 + u_var_add_gui_header_begin(root, NULL, tmp); 463 + 464 + (void)snprintf(tmp, sizeof(tmp), "%sUpdate brightness automatically", prefix); 465 + u_var_add_bool(root, &aeg->enable, tmp); 466 + 467 + (void)snprintf(tmp, sizeof(tmp), "%sFrame update delay", prefix); 468 + u_var_add_i32(root, &aeg->frame_delay, tmp); 469 + 470 + (void)snprintf(tmp, sizeof(tmp), "%sStrategy", prefix); 471 + u_var_add_combo(root, &aeg->strategy_combo, tmp); 472 + 473 + (void)snprintf(tmp, sizeof(tmp), "%sBrightness", prefix); 474 + u_var_add_draggable_f32(root, &aeg->brightness, tmp); 475 + 476 + (void)snprintf(tmp, sizeof(tmp), "%sScore threshold", prefix); 477 + u_var_add_f32(root, &aeg->threshold, tmp); 478 + 479 + (void)snprintf(tmp, sizeof(tmp), "%sMax brightness step", prefix); 480 + u_var_add_f32(root, &aeg->max_brightness_step, tmp); 481 + 482 + (void)snprintf(tmp, sizeof(tmp), "%sImage score", prefix); 483 + u_var_add_ro_f32(root, &aeg->current_score, tmp); 484 + 485 + (void)snprintf(tmp, sizeof(tmp), "%sIntensity histogram", prefix); 486 + u_var_add_histogram_f32(root, &aeg->histogram_ui, tmp); 487 + 488 + (void)snprintf(tmp, sizeof(tmp), "%sAEG log level", prefix); 489 + u_var_add_log_level(root, &aeg->log_level, tmp); 490 + 491 + u_var_add_gui_header_end(root, NULL, tmp); 467 492 } 468 493 469 494 void
+1 -1
src/xrt/auxiliary/util/u_autoexpgain.h
··· 39 39 40 40 //! Setup UI for the AEG algorithm 41 41 void 42 - u_autoexpgain_add_vars(struct u_autoexpgain *aeg, void *root); 42 + u_autoexpgain_add_vars(struct u_autoexpgain *aeg, void *root, char *prefix); 43 43 44 44 //! Update the AEG with a frame 45 45 void
+1 -1
src/xrt/drivers/rift_s/rift_s_camera.c
··· 248 248 u_var_add_draggable_u16(cam, &cam->exposure_ui, "Exposure"); 249 249 u_var_add_u8(cam, &cam->target_gain, "Gain"); 250 250 u_var_add_gui_header(cam, NULL, "Auto exposure and gain control"); 251 - u_autoexpgain_add_vars(cam->aeg, cam); 251 + u_autoexpgain_add_vars(cam->aeg, cam, ""); 252 252 253 253 u_var_add_gui_header(cam, NULL, "Camera Streams"); 254 254 u_var_add_sink_debug(cam, &cam->debug_sinks[0], "Tracking Streams");
+1 -2
src/xrt/drivers/wmr/wmr_camera.c
··· 464 464 u_var_add_bool(cam, &cam->manual_control, "Manual exposure and gain control"); 465 465 u_var_add_draggable_u16(cam, &cam->exposure_ui, "Exposure (usec)"); 466 466 u_var_add_u8(cam, &cam->gain, "Gain"); 467 - u_var_add_gui_header(cam, NULL, "Auto exposure and gain control"); 468 - u_autoexpgain_add_vars(cam->aeg, cam); 467 + u_autoexpgain_add_vars(cam->aeg, cam, ""); 469 468 u_var_add_gui_header(cam, NULL, "Camera Streams"); 470 469 u_var_add_sink_debug(cam, &cam->debug_sinks[0], "Tracking Streams"); 471 470 u_var_add_sink_debug(cam, &cam->debug_sinks[1], "Controller Streams");