Struct dcv_color_primitives::ImageFormat
source · [−]#[repr(C)]pub struct ImageFormat {
pub pixel_format: PixelFormat,
pub color_space: ColorSpace,
pub num_planes: u32,
}
Expand description
Describes how the image data is laid out in memory and its color space.
Note
Not all combinations of pixel format, color space and number of planes describe a valid image format.
Each pixel format has one or more compatible color spaces:
pixel format | color space |
---|---|
PixelFormat::Argb | ColorSpace::Lrgb |
PixelFormat::Bgra | ColorSpace::Lrgb |
PixelFormat::Bgr | ColorSpace::Lrgb |
PixelFormat::Rgba | ColorSpace::Lrgb |
PixelFormat::Rgb | ColorSpace::Lrgb |
PixelFormat::I444 | ColorSpace::Bt601(FR) , ColorSpace::Bt709(FR) |
PixelFormat::I422 | ColorSpace::Bt601(FR) , ColorSpace::Bt709(FR) |
PixelFormat::I420 | ColorSpace::Bt601(FR) , ColorSpace::Bt709(FR) |
PixelFormat::Nv12 | ColorSpace::Bt601(FR) , ColorSpace::Bt709(FR) |
Some pixel formats might impose additional restrictions on the accepted number of planes and the image size:
pixel format | subsampling | w | h | #planes | #1 | #2 | #3 |
---|---|---|---|---|---|---|---|
PixelFormat::Argb | 4:4:4 | 1 | argb:4 | ||||
PixelFormat::Bgra | 4:4:4 | 1 | bgra:4 | ||||
PixelFormat::Bgr | 4:4:4 | 1 | bgr:3 | ||||
PixelFormat::Rgba | 4:4:4 | 1 | rgba:4 | ||||
PixelFormat::Rgb | 4:4:4 | 1 | rgb:3 | ||||
PixelFormat::I444 | 4:4:4 | 3 | y:1 | u:1 | v:1 | ||
PixelFormat::I422 | 4:2:2 | 2 | 1, 3 | y:1 | u:1/2 | v:1/2 | |
PixelFormat::I420 | 4:2:0 | 2 | 2 | 3 | y:1 | u:1/4 | v:1/4 |
PixelFormat::Nv12 | 4:2:0 | 2 | 2 | 1, 2 | y:1 | uv:1/2 |
The values reported in columns w
and h
, when specified, indicate that the described
image should have width and height that are multiples of the specified values
Fields
pixel_format: PixelFormat
Pixel format
color_space: ColorSpace
Color space
num_planes: u32
Number of planes
Auto Trait Implementations
impl RefUnwindSafe for ImageFormat
impl Send for ImageFormat
impl Sync for ImageFormat
impl Unpin for ImageFormat
impl UnwindSafe for ImageFormat
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more