Expand description
Handles conversions, e.g., between RGB and YUV.
In particular when encoding frames your source data might be a YUV buffer, or one of multiple RGB formats. The structs and traits in here can help you with that format conversion.
§Examples
Load a vanilla 3x8 bit-per-pixel RGB slice into a YUVBuffer:
use openh264::formats::{RgbSliceU8, YUVBuffer};
// Assume this is a 2x2 pixel RGB buffer you got from somewhere.
let raw_rgb = &[ 10, 10, 10, 20, 20, 20, 30, 30, 30, 40, 40, 40 ];
let rgb_source = RgbSliceU8::new(raw_rgb, (2, 2));
// Now you have a YUV which you can feed into the encoder.
let yuv = YUVBuffer::from_rgb_source(rgb_source);Structs§
- Abgr
Slice U8 - Container for a slice of contiguous
[A B G R A B G R ...]data. - Abgr
Slice U32 - Container for a slice of contiguous
[ABGR ABGR ...]data. - Argb
Slice U8 - Container for a slice of contiguous
[A R G B A R G B ...]data. - Argb
Slice U32 - Container for a slice of contiguous
[ARGB ARGB ...]data. - BgrSlice
U8 - Container for a slice of contiguous
[B G R B G R ...]data. - Bgra
Slice U8 - Container for a slice of contiguous
[B G R A B G R A ...]data. - Bgra
Slice U32 - Container for a slice of contiguous
[BGRA BGRA ...]data. - RgbSlice
U8 - Container for a slice of contiguous
[R G B R G B ...]data.⭐ - Rgba
Slice U8 - Container for a slice of contiguous
[R G B A R G B A ...]data. - Rgba
Slice U32 - Container for a slice of contiguous
[RGBA RGBA ...]data. - YUVBuffer
- Converts RGB to YUV data.
- YUVSlices
- Convenience wrapper if you already have YUV-sliced data from some other place.
Traits§
- RGB8
Source - Source of RGB8 data for fast pixel access.
- RGBSource
- Source of arbitrarily formatted RGB data.
- YUVSource
- Allows the Encoder to be generic over a YUV source.