pub struct ANSEncodingHistogram {
pub counts: Vec<i32>,
pub alphabet_size: usize,
pub cost: f32,
pub method: u32,
pub omit_pos: usize,
/* private fields */
}Expand description
Normalized ANS histogram for encoding.
Contains frequency counts normalized to sum to ANS_TAB_SIZE (4096).
Fields§
§counts: Vec<i32>Normalized frequency counts.
alphabet_size: usizeAlphabet size (highest non-zero symbol + 1).
cost: f32Cost estimate (header + data bits).
method: u32Encoding method:
- 0: flat distribution
- 1: small code (1-2 symbols)
- 2-13: shift value + 1
omit_pos: usizePosition of the balancing bin (absorbs rounding error).
Implementations§
Source§impl ANSEncodingHistogram
impl ANSEncodingHistogram
Sourcepub fn from_histogram(
histo: &Histogram,
strategy: ANSHistogramStrategy,
) -> Result<Self>
pub fn from_histogram( histo: &Histogram, strategy: ANSHistogramStrategy, ) -> Result<Self>
Create from a Histogram with the best normalization.
Tries different shift values and picks the one with lowest cost.
Trait Implementations§
Source§impl Clone for ANSEncodingHistogram
impl Clone for ANSEncodingHistogram
Source§fn clone(&self) -> ANSEncodingHistogram
fn clone(&self) -> ANSEncodingHistogram
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ANSEncodingHistogram
impl Debug for ANSEncodingHistogram
Auto Trait Implementations§
impl Freeze for ANSEncodingHistogram
impl RefUnwindSafe for ANSEncodingHistogram
impl Send for ANSEncodingHistogram
impl Sync for ANSEncodingHistogram
impl Unpin for ANSEncodingHistogram
impl UnwindSafe for ANSEncodingHistogram
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