The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/util: make u_compute_distortion_* functions return void

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2367>

authored by

Simon Zeni and committed by
Korcan Hussein
e1eda30a d867a4c2

+23 -28
+5 -13
src/xrt/auxiliary/util/u_distortion_mesh.c
··· 124 124 } 125 125 } 126 126 127 - bool 127 + void 128 128 u_compute_distortion_vive(struct u_vive_values *values, float u, float v, struct xrt_uv_triplet *result) 129 129 { 130 130 // Reading the whole struct like this gives the compiler more opportunity to optimize. ··· 181 181 result->r = tc[0]; 182 182 result->g = tc[1]; 183 183 result->b = tc[2]; 184 - 185 - return true; 186 184 } 187 185 188 186 ··· 195 193 #define len m_vec2_len 196 194 #define len_sqrd m_vec2_len_sqrd 197 195 198 - bool 196 + void 199 197 u_compute_distortion_panotools(struct u_panotools_values *values, float u, float v, struct xrt_uv_triplet *result) 200 198 { 201 199 const struct u_panotools_values val = *values; ··· 230 228 result->r = r_uv; 231 229 result->g = g_uv; 232 230 result->b = b_uv; 233 - return true; 234 231 } 235 232 236 - bool 233 + void 237 234 u_compute_distortion_cardboard(struct u_cardboard_distortion_values *values, 238 235 float u, 239 236 float v, ··· 266 263 result->g.y = uv.y; 267 264 result->b.x = uv.x; 268 265 result->b.y = uv.y; 269 - return true; 270 266 } 271 267 272 268 /* ··· 290 286 } 291 287 292 288 293 - bool 289 + void 294 290 u_compute_distortion_ns_p2d(struct u_ns_p2d_values *values, int view, float u, float v, struct xrt_uv_triplet *result) 295 291 { 296 292 // I think that OpenCV and Monado have different definitions of v coordinates, but not sure. if not, ··· 318 314 result->g.y = v_eye; 319 315 result->b.x = u_eye; 320 316 result->b.y = v_eye; 321 - 322 - return true; 323 317 } 324 318 325 319 ··· 330 324 * 331 325 */ 332 326 333 - bool 327 + void 334 328 u_compute_distortion_ns_meshgrid( 335 329 struct u_ns_meshgrid_values *values, int view, float u, float v, struct xrt_uv_triplet *result) 336 330 { ··· 401 395 result->g.y = v_eye; 402 396 result->b.x = u_eye; 403 397 result->b.y = v_eye; 404 - 405 - return true; 406 398 } 407 399 408 400
+5 -5
src/xrt/auxiliary/util/u_distortion_mesh.h
··· 51 51 * 52 52 * @ingroup aux_distortion 53 53 */ 54 - bool 54 + void 55 55 u_compute_distortion_panotools(struct u_panotools_values *values, float u, float v, struct xrt_uv_triplet *result); 56 56 57 57 ··· 86 86 * 87 87 * @ingroup aux_distortion 88 88 */ 89 - bool 89 + void 90 90 u_compute_distortion_vive(struct u_vive_values *values, float u, float v, struct xrt_uv_triplet *result); 91 91 92 92 ··· 101 101 * 102 102 * @ingroup aux_distortion 103 103 */ 104 - bool 104 + void 105 105 u_compute_distortion_cardboard(struct u_cardboard_distortion_values *values, 106 106 float u, 107 107 float v, ··· 129 129 * 130 130 * @ingroup aux_distortion 131 131 */ 132 - bool 132 + void 133 133 u_compute_distortion_ns_p2d(struct u_ns_p2d_values *values, int view, float u, float v, struct xrt_uv_triplet *result); 134 134 135 135 /* ··· 153 153 * 154 154 * @ingroup aux_distortion 155 155 */ 156 - bool 156 + void 157 157 u_compute_distortion_ns_meshgrid( 158 158 struct u_ns_meshgrid_values *values, int view, float u, float v, struct xrt_uv_triplet *result); 159 159
+5 -4
src/xrt/drivers/ohmd/oh_device.c
··· 683 683 #define len m_vec2_len 684 684 685 685 // slightly different to u_compute_distortion_panotools in u_distortion_mesh 686 - static bool 686 + static void 687 687 u_compute_distortion_openhmd(struct openhmd_values *values, float u, float v, struct xrt_uv_triplet *result) 688 688 { 689 689 struct openhmd_values val = *values; ··· 717 717 result->r = r_uv; 718 718 result->g = g_uv; 719 719 result->b = b_uv; 720 - return true; 721 720 } 722 721 723 722 static bool 724 723 compute_distortion_openhmd(struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *result) 725 724 { 726 725 struct oh_device *ohd = oh_device(xdev); 727 - return u_compute_distortion_openhmd(&ohd->distortion.openhmd[view], u, v, result); 726 + u_compute_distortion_openhmd(&ohd->distortion.openhmd[view], u, v, result); 727 + return true; 728 728 } 729 729 730 730 static bool 731 731 compute_distortion_vive(struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *result) 732 732 { 733 733 struct oh_device *ohd = oh_device(xdev); 734 - return u_compute_distortion_vive(&ohd->distortion.vive[view], u, v, result); 734 + u_compute_distortion_vive(&ohd->distortion.vive[view], u, v, result); 735 + return true; 735 736 } 736 737 737 738 static inline void
+2 -1
src/xrt/drivers/psvr/psvr_device.c
··· 1011 1011 { 1012 1012 struct psvr_device *psvr = psvr_device(xdev); 1013 1013 1014 - return u_compute_distortion_panotools(&psvr->vals, u, v, result); 1014 + u_compute_distortion_panotools(&psvr->vals, u, v, result); 1015 + return true; 1015 1016 } 1016 1017 1017 1018
+2 -1
src/xrt/drivers/rift_s/rift_s_hmd.c
··· 155 155 rift_s_compute_distortion(struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *result) 156 156 { 157 157 struct rift_s_hmd *hmd = (struct rift_s_hmd *)(xdev); 158 - return u_compute_distortion_panotools(&hmd->distortion_vals[view], u, v, result); 158 + u_compute_distortion_panotools(&hmd->distortion_vals[view], u, v, result); 159 + return true; 159 160 } 160 161 161 162 #if 0
+2 -2
src/xrt/drivers/survive/survive_driver.c
··· 905 905 compute_distortion(struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *result) 906 906 { 907 907 struct survive_device *d = (struct survive_device *)xdev; 908 - bool status = u_compute_distortion_vive(&d->hmd.config.distortion.values[view], u, v, result); 908 + u_compute_distortion_vive(&d->hmd.config.distortion.values[view], u, v, result); 909 909 910 910 if (d->hmd.config.variant == VIVE_VARIANT_PRO2) { 911 911 // Flip Y coordinates ··· 913 913 result->g.y = 1.0f - result->g.y; 914 914 result->b.y = 1.0f - result->b.y; 915 915 } 916 - return status; 916 + return true; 917 917 } 918 918 919 919 static bool
+2 -2
src/xrt/drivers/vive/vive_device.c
··· 980 980 XRT_TRACE_MARKER(); 981 981 982 982 struct vive_device *d = vive_device(xdev); 983 - bool status = u_compute_distortion_vive(&d->config.distortion.values[view], u, v, result); 983 + u_compute_distortion_vive(&d->config.distortion.values[view], u, v, result); 984 984 985 985 if (d->config.variant == VIVE_VARIANT_PRO2) { 986 986 // Flip Y coordinates ··· 988 988 result->g.y = 1.0f - result->g.y; 989 989 result->b.y = 1.0f - result->b.y; 990 990 } 991 - return status; 991 + return true; 992 992 } 993 993 994 994 void