[][src]Macro ffimage::create_macropixel

macro_rules! create_macropixel {
    ($name:ident, $channels:expr, $subpixels:expr, #[$doc:meta]) => { ... };
}

Create a new macropixel type

The term 'macropixel' does not seem to be defined as well as the 'pixel' term. We use it to describe storage pixels used to store image buffers. To view or render such an image, one must first convert from the macropixel representation to an image pixel (regular 'pixel') one.

A famous application example is YUV chroma subsampling: the YUYV format samples 4:2:2, meaning for each macropixel, there is a full chroma and two luma samples at half the bit width. YUYV buffers are converted into YUV buffers (each YUYV macropixel ends up as two full YUV pixels) for rendering.

Example

use std::array;
use std::convert::{From, TryFrom};
use std::ops::{Index, IndexMut};

use ffimage::{create_macropixel, create_pixel, define_pixel, impl_Pixel};
use ffimage::core::traits::{Pixel, StorageType};

create_macropixel!(Yuyv, 2, 2, #[doc = "YUYV macropixel"]);