The open source OpenXR runtime
0
fork

Configure Feed

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

a/math: Replace RH_DEBUG for relation history with better use of logging macros

authored by

Ryan Pavlik and committed by
Jakob Bornecrantz
01e3d987 27550ffa

+7 -13
+7 -13
src/xrt/auxiliary/math/m_relation_history.cpp
··· 37 37 38 38 #define leng 4096 39 39 #define power2 12 40 - #undef RH_DEBUG 41 40 42 41 struct m_relation_history 43 42 { ··· 101 100 int64_t diff_prediction_ns = 0; 102 101 diff_prediction_ns = at_timestamp_ns - newest_in_buffer; 103 102 double delta_s = time_ns_to_s(diff_prediction_ns); 104 - #ifdef RH_DEBUG 105 - U_LOG_E("Extrapolating %f s after the head of the buffer!", delta_s); 106 - #endif 103 + 104 + U_LOG_T("Extrapolating %f s after the head of the buffer!", delta_s); 105 + 107 106 m_predict_relation(&rh->impl[0]->relation, delta_s, out_relation); 108 107 goto end; 109 108 ··· 113 112 int64_t diff_prediction_ns = 0; 114 113 diff_prediction_ns = at_timestamp_ns - oldest_in_buffer; 115 114 double delta_s = time_ns_to_s(diff_prediction_ns); 116 - #ifdef RH_DEBUG 117 - U_LOG_E("Extrapolating %f s before the tail of the buffer!", delta_s); 118 - #endif 115 + U_LOG_T("Extrapolating %f s before the tail of the buffer!", delta_s); 119 116 m_predict_relation(&rh->impl[rh->impl.length() - 1]->relation, delta_s, out_relation); 120 117 goto end; 121 118 } 122 - #ifdef RH_DEBUG 123 - U_LOG_E("Interpolating within buffer!"); 124 - #endif 119 + U_LOG_T("Interpolating within buffer!"); 125 120 #if 0 126 121 // Very slow - O(n) - but easier to read 127 122 int idx = 0; ··· 133 128 break; 134 129 } 135 130 } 136 - U_LOG_E("Correct answer is %i", idx); 131 + U_LOG_T("Correct answer is %i", idx); 137 132 #else 138 133 139 134 // Fast - O(log(n)) - but hard to read ··· 148 143 // different place for each power). Bit-shift it and it either doubles or halves. In our case it 149 144 // halves. step should always be equivalent to pow(2,i). If it's not that's very very bad. 150 145 step = step >> 1; 151 - #ifdef RH_DEBUG 152 146 assert(step == (int)pow(2, i)); 153 - #endif 147 + 154 148 155 149 if (idx >= rh->impl.length()) { 156 150 // We'd be looking at an uninitialized value. Go back closer to the head of the buffer.