a/math: Add m_ff_vec3_f32_get_timestamp
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2651>
58 unmodified lines596061626364656667686939 unmodified lines109110111112113114115116117118119120121122123124125126127128129130131117132133134135136151 unmodified linesExpand all28828929029127729229329429529643 unmodified lines58 unmodified lines ff->num = 0; ff->latest = 0;}
#define COMPUTE_INDEX(ff, num) (((ff)->latest + (num)) % (ff)->num)
/* * * 'Exported' functions. *39 unmodified lines ff->timestamps_ns[i] = timestamp_ns;}
boolm_ff_vec3_f32_get_timestamp(struct m_ff_vec3_f32 *ff, size_t num, uint64_t *out_timestamp_ns){ if (num >= ff->num) { return false; }
size_t pos = COMPUTE_INDEX(ff, num); *out_timestamp_ns = ff->timestamps_ns[pos];
return true;}
boolm_ff_vec3_f32_get(struct m_ff_vec3_f32 *ff, size_t num, struct xrt_vec3 *out_sample, uint64_t *out_timestamp_ns){ if (num >= ff->num) { return false; }
size_t pos = (ff->latest + num) % ff->num; size_t pos = COMPUTE_INDEX(ff, num); *out_sample = ff->samples[pos]; *out_timestamp_ns = ff->timestamps_ns[pos];
return true;151 unmodified linesExpand all if (num >= ff->num) { return false; }
size_t pos = (ff->latest + num) % ff->num; size_t pos = COMPUTE_INDEX(ff, num); *out_sample = ff->samples[pos]; *out_timestamp_ns = ff->timestamps_ns[pos];
return true;43 unmodified lines51 unmodified lines525354555657585960616263646566126 unmodified linesExpand all51 unmodified linesboolm_ff_vec3_f32_get(struct m_ff_vec3_f32 *ff, size_t num, struct xrt_vec3 *out_sample, uint64_t *out_timestamp_ns);
/*! * Return the timestamp of the sample at the index, zero means the last sample push, one second * last and so on. */boolm_ff_vec3_f32_get_timestamp(struct m_ff_vec3_f32 *ff, size_t num, uint64_t *out_timestamp_ns);
/*! * Averages all samples in the fifo between the two timepoints, returns number * of samples sampled, if no samples was found between the timpoints returns 0 * and sets @p out_average to all zeros. *126 unmodified linesExpand all