pub struct JlsContext {
pub a: i32,
pub b: i32,
pub c: i8,
pub n: i16,
}Expand description
Context for regular (non-run) mode.
Each context stores running statistics used to compute the Golomb parameter and prediction correction (bias C).
Fields§
§a: i32Accumulated |error| (magnitude).
b: i32Accumulated error (signed, used for bias).
c: i8Prediction correction (bias).
n: i16Count (number of samples coded in this context).
Implementations§
Source§impl JlsContext
impl JlsContext
Sourcepub fn new(a_init: i32) -> Self
pub fn new(a_init: i32) -> Self
Create a new context with initial values per the JPEG-LS standard.
Sourcepub fn get_golomb(&self) -> i32
pub fn get_golomb(&self) -> i32
Compute the Golomb coding parameter k for this context.
Sourcepub fn get_error_correction(&self, k: i32) -> i32
pub fn get_error_correction(&self, k: i32) -> i32
Get the error correction value for Golomb parameter k.
Sourcepub fn update_variables(&mut self, err_val: i32, near: i32, reset_value: i32)
pub fn update_variables(&mut self, err_val: i32, near: i32, reset_value: i32)
Update context statistics after coding an error value.
err_val is the mapped (quantized, mod-ranged) error value.
Trait Implementations§
Source§impl Clone for JlsContext
impl Clone for JlsContext
Source§fn clone(&self) -> JlsContext
fn clone(&self) -> JlsContext
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 moreAuto Trait Implementations§
impl Freeze for JlsContext
impl RefUnwindSafe for JlsContext
impl Send for JlsContext
impl Sync for JlsContext
impl Unpin for JlsContext
impl UnsafeUnpin for JlsContext
impl UnwindSafe for JlsContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more