pub enum Quantize {
Lossless,
Step(f64),
NoiseLevel(f64),
}Expand description
How a floating point image’s values are turned into the integers a compressor can work on.
Quantising is what makes a floating point image compress at all well, and it is lossy: what comes back is within one step of what went in. The step is the choice being made here.
Variants§
Lossless
Do not quantise. The values are compressed as they stand, which only
Compression::Gzip, Compression::ShuffledGzip and
Compression::None can do, and nothing is lost.
Step(f64)
Quantise in steps of this many units of the image’s own values.
NoiseLevel(f64)
Quantise in steps of the tile’s own estimated noise divided by this.
Four is the usual choice: it keeps the quantisation step well below the noise already in the data, so nothing measurable is lost, while throwing away the low bits that are noise anyway and would otherwise compress terribly.
The noise is estimated from the median absolute third-order difference between neighbouring pixels, which is what the convention’s own reference implementation does. That implementation takes the smallest of three such estimates rather than this one alone, so it may settle on a slightly different step for the same tile; either is a fair reading of “the noise in this tile”.
Trait Implementations§
impl Copy for Quantize
impl StructuralPartialEq for Quantize
Auto Trait Implementations§
impl Freeze for Quantize
impl RefUnwindSafe for Quantize
impl Send for Quantize
impl Sync for Quantize
impl Unpin for Quantize
impl UnsafeUnpin for Quantize
impl UnwindSafe for Quantize
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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