Monado OpenXR Runtime
|
Helpers to estimate offsets between clocks. More...
Go to the source code of this file.
Functions | |
static timepoint_ns | m_clock_offset_a2b (float freq, timepoint_ns a, timepoint_ns b, time_duration_ns *inout_a2b) |
Helper to estimate the offset between two clocks using exponential smoothing. More... | |
struct m_clock_windowed_skew_tracker * | m_clock_windowed_skew_tracker_alloc (const size_t window_samples) |
Allocate a struct m_clock_windowed_skew_tracker with a window of. More... | |
void | m_clock_windowed_skew_tracker_reset (struct m_clock_windowed_skew_tracker *t) |
void | m_clock_windowed_skew_tracker_destroy (struct m_clock_windowed_skew_tracker *t) |
void | m_clock_windowed_skew_tracker_push (struct m_clock_windowed_skew_tracker *t, const timepoint_ns local_ts, const timepoint_ns remote_ts) |
bool | m_clock_windowed_skew_tracker_to_local (struct m_clock_windowed_skew_tracker *t, const timepoint_ns remote_ts, timepoint_ns *local_ts) |
bool | m_clock_windowed_skew_tracker_to_remote (struct m_clock_windowed_skew_tracker *t, const timepoint_ns local_ts, timepoint_ns *remote_ts) |
Helpers to estimate offsets between clocks.
|
inlinestatic |
Helper to estimate the offset between two clocks using exponential smoothing.
Given a sample from two timestamp domains A and B that should have been sampled as close as possible, together with an estimate of the offset between A clock and B clock (or zero), it applies a smoothing average on the estimated offset and returns a
in B clock.
This estimator can be used when clock observations are arriving with a low delay and small jitter, or when accuracy is less important (on the order of the jitter that is present). It is very computationally cheap.
freq | About how many times per second this function is called. Helps setting a good decay value. | |
a | Timestamp in clock A of the event | |
b | Timestamp in clock B of the event | |
[in,out] | inout_a2b | Pointer to the current offset estimate from A to B, or 0 if unknown. Value pointed-to will be updated. |
a
in B clock Referenced by receive_imu_sample().
struct m_clock_windowed_skew_tracker * m_clock_windowed_skew_tracker_alloc | ( | const size_t | window_samples | ) |
Allocate a struct m_clock_windowed_skew_tracker with a window of.
window_samples | samples. |
References U_TYPED_ARRAY_CALLOC, and U_TYPED_CALLOC.