pub struct DeltaEncoder {
keyframe_interval: u32,
threshold: f32,
}Expand description
Encodes vectors into keyframe + delta sequences.
Configuration:
keyframe_interval: store a full vector every K updatesthreshold: minimum absolute change per dimension to include in delta (ε)
Fields§
§keyframe_interval: u32§threshold: f32Implementations§
Source§impl DeltaEncoder
impl DeltaEncoder
Sourcepub fn new(keyframe_interval: u32, threshold: f32) -> Self
pub fn new(keyframe_interval: u32, threshold: f32) -> Self
Create a new delta encoder.
keyframe_interval(K): store a full keyframe every K updates. K=10 means every 10th vector is stored in full.threshold(ε): minimum per-dimension change to include in delta. ε=0.001 means changes smaller than 0.001 are discarded.
Sourcepub fn encode(
&self,
sequence_index: u32,
timestamp: i64,
vector: &[f32],
previous: Option<&[f32]>,
) -> DeltaEntry
pub fn encode( &self, sequence_index: u32, timestamp: i64, vector: &[f32], previous: Option<&[f32]>, ) -> DeltaEntry
Encode a vector, producing either a keyframe or a delta entry.
sequence_index: the index of this vector in the entity’s sequence (0, 1, 2, …)timestamp: the timestamp for this vectorvector: the full vectorprevious: the previous full vector (None for the first vector)
Returns a DeltaEntry. If it’s a keyframe, the full vector should be
stored separately; if it’s a delta, only the sparse changes are stored.
Sourcepub fn keyframe_interval(&self) -> u32
pub fn keyframe_interval(&self) -> u32
The configured keyframe interval.
Auto Trait Implementations§
impl Freeze for DeltaEncoder
impl RefUnwindSafe for DeltaEncoder
impl Send for DeltaEncoder
impl Sync for DeltaEncoder
impl Unpin for DeltaEncoder
impl UnwindSafe for DeltaEncoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more