Enum turbojpeg::Subsamp[][src]

#[repr(u32)]
pub enum Subsamp {
    None,
    Sub2x1,
    Sub2x2,
    Gray,
    Sub1x2,
    Sub4x1,
}

Chrominance subsampling options.

When pixels are converted from RGB to YCbCr or from CMYK to YCCK as part of the JPEG compression process, some of the Cb and Cr (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity (the human eye is more sensitive to small changes in brightness than to small changes in color). This is called “chrominance subsampling”.

Variants

None

No chrominance subsampling (4:4:4);

The JPEG or YUV image will contain one chrominance component for every pixel in the source image.

Sub2x1

2x1 chrominance subsampling (4:2:2).

The JPEG or YUV image will contain one chrominance component for every 2x1 block of pixels in the source image.

Sub2x2

2x2 chrominance subsampling (4:2:0).

The JPEG or YUV image will contain one chrominance component for every 2x2 block of pixels in the source image.

Gray

Grayscale.

The JPEG or YUV image will contain no chrominance components.

Sub1x2

1x2 chrominance subsampling (4:4:0).

The JPEG or YUV image will contain one chrominance component for every 1x2 block of pixels in the source image.

Note

4:4:0 subsampling is not fully accelerated in libjpeg-turbo.

Sub4x1

4x1 chrominance subsampling (4:1:1).

The JPEG or YUV image will contain one chrominance component for every 4x1 block of pixels in the source image. JPEG images compressed with 4:1:1 subsampling will be almost exactly the same size as those compressed with 4:2:0 subsampling, and in the aggregate, both subsampling methods produce approximately the same perceptual quality. However, 4:1:1 is better able to reproduce sharp horizontal features.

Note

4:1:1 subsampling is not fully accelerated in libjpeg-turbo.

Implementations

impl Subsamp[src]

pub fn from_u32(subsamp: u32) -> Result<Subsamp>[src]

Trait Implementations

impl Clone for Subsamp[src]

impl Copy for Subsamp[src]

impl Debug for Subsamp[src]

impl Eq for Subsamp[src]

impl Hash for Subsamp[src]

impl Ord for Subsamp[src]

impl PartialEq<Subsamp> for Subsamp[src]

impl PartialOrd<Subsamp> for Subsamp[src]

impl StructuralEq for Subsamp[src]

impl StructuralPartialEq for Subsamp[src]

Auto Trait Implementations

impl RefUnwindSafe for Subsamp

impl Send for Subsamp

impl Sync for Subsamp

impl Unpin for Subsamp

impl UnwindSafe for Subsamp

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.