Enum rerun::datatypes::PixelFormat
source · #[repr(u8)]pub enum PixelFormat {
Y_U_V12_LimitedRange = 20,
NV12 = 26,
YUY2 = 27,
Y8_FullRange = 30,
Y_U_V24_LimitedRange = 39,
Y_U_V24_FullRange = 40,
Y8_LimitedRange = 41,
Y_U_V12_FullRange = 44,
Y_U_V16_LimitedRange = 49,
Y_U_V16_FullRange = 50,
}
Expand description
Datatype: Specifieds a particular format of an archetypes::Image
.
Most images can be described by a datatypes::ColorModel
and a datatypes::ChannelDatatype
,
e.g. RGB
and U8
respectively.
However, some image formats has chroma downsampling and/or
use differing number of bits per channel, and that is what this datatypes::PixelFormat
is for.
All these formats support random access.
For more compressed image formats, see archetypes::EncodedImage
.
Variants§
Y_U_V12_LimitedRange = 20
Y_U_V12
is a YUV 4:2:0 fully planar YUV format without chroma downsampling, also known as I420
.
This uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].
First comes entire image in Y in one plane, followed by the U and V planes, which each only have half the resolution of the Y plane.
NV12 = 26
NV12
(aka Y_UV12
) is a YUV 4:2:0 chroma downsampled form at with 12 bits per pixel and 8 bits per channel.
This uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].
First comes entire image in Y in one plane, followed by a plane with interleaved lines ordered as U0, V0, U1, V1, etc.
YUY2 = 27
YUY2
(aka YUYV
, YUYV16
or NV21
), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel.
This uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].
The order of the channels is Y0, U0, Y1, V0, all in the same plane.
Y8_FullRange = 30
Monochrome Y plane only, essentially a YUV 4:0:0 planar format.
Also known as just “gray”. This is virtually identical to a 8bit luminance/grayscale (see datatypes::ColorModel
).
This uses entire range YUV, i.e. Y is expected to be within [0, 255]. (as opposed to “limited range” YUV as used e.g. in NV12).
Y_U_V24_LimitedRange = 39
Y_U_V24
is a YUV 4:4:4 fully planar YUV format without chroma downsampling, also known as I444
.
This uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].
First comes entire image in Y in one plane, followed by the U and V planes.
Y_U_V24_FullRange = 40
Y_U_V24
is a YUV 4:4:4 fully planar YUV format without chroma downsampling, also known as I444
.
This uses full range YUV with all components ranging from 0 to 255 (as opposed to “limited range” YUV as used e.g. in NV12).
First comes entire image in Y in one plane, followed by the U and V planes.
Y8_LimitedRange = 41
Monochrome Y plane only, essentially a YUV 4:0:0 planar format.
Also known as just “gray”.
This uses limited range YUV, i.e. Y is expected to be within [16, 235].
If not for this range limitation/remapping, this is almost identical to 8bit luminace/grayscale (see datatypes::ColorModel
).
Y_U_V12_FullRange = 44
Y_U_V12
is a YUV 4:2:0 fully planar YUV format without chroma downsampling, also known as I420
.
This uses full range YUV with all components ranging from 0 to 255 (as opposed to “limited range” YUV as used e.g. in NV12).
First comes entire image in Y in one plane, followed by the U and V planes, which each only have half the resolution of the Y plane.
Y_U_V16_LimitedRange = 49
Y_U_V16
is a YUV 4:2:2 fully planar YUV format without chroma downsampling, also known as I422
.
This uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].
First comes entire image in Y in one plane, followed by the U and V planes, which each only have half the horizontal resolution of the Y plane.
Y_U_V16_FullRange = 50
Y_U_V16
is a YUV 4:2:2 fully planar YUV format without chroma downsampling, also known as I422
.
This uses full range YUV with all components ranging from 0 to 255 (as opposed to “limited range” YUV as used e.g. in NV12).
First comes entire image in Y in one plane, followed by the U and V planes, which each only have half the horizontal resolution of the Y plane.
Implementations§
source§impl PixelFormat
impl PixelFormat
sourcepub fn num_bytes(&self, _: [u32; 2]) -> usize
pub fn num_bytes(&self, _: [u32; 2]) -> usize
Number of bytes needed to represent an image of the given size.
sourcepub fn color_model(&self) -> ColorModel
pub fn color_model(&self) -> ColorModel
The color model derived from this pixel format.
sourcepub fn datatype(&self) -> ChannelDatatype
pub fn datatype(&self) -> ChannelDatatype
The datatype that this decodes into.
sourcepub fn decode_yuv_at(
&self,
buf: &[u8],
_: [u32; 2],
_: [u32; 2]
) -> Option<[u8; 3]>
pub fn decode_yuv_at( &self, buf: &[u8], _: [u32; 2], _: [u32; 2] ) -> Option<[u8; 3]>
Random-access decoding of a specific pixel of an image.
Return None
if out-of-range.
sourcepub fn is_limited_yuv_range(&self) -> bool
pub fn is_limited_yuv_range(&self) -> bool
Returns true if the format is a YUV format using limited range YUV.
I.e. for 8bit data, Y is valid in [16, 235] and U/V [16, 240], rather than 0-255.
sourcepub fn yuv_matrix_coefficients(&self) -> YuvMatrixCoefficients
pub fn yuv_matrix_coefficients(&self) -> YuvMatrixCoefficients
Yuv matrix coefficients used by this format.
Trait Implementations§
source§impl Clone for PixelFormat
impl Clone for PixelFormat
source§fn clone(&self) -> PixelFormat
fn clone(&self) -> PixelFormat
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PixelFormat
impl Debug for PixelFormat
source§impl Default for PixelFormat
impl Default for PixelFormat
source§fn default() -> PixelFormat
fn default() -> PixelFormat
source§impl Display for PixelFormat
impl Display for PixelFormat
source§impl Enum for PixelFormat
impl Enum for PixelFormat
source§fn variants() -> &'static [PixelFormat]
fn variants() -> &'static [PixelFormat]
source§fn docstring_md(self) -> &'static str
fn docstring_md(self) -> &'static str
source§impl Hash for PixelFormat
impl Hash for PixelFormat
source§impl Loggable for PixelFormat
impl Loggable for PixelFormat
type Name = DatatypeName
source§fn name() -> <PixelFormat as Loggable>::Name
fn name() -> <PixelFormat as Loggable>::Name
rerun.datatypes.Vec2D
.source§fn arrow_datatype() -> DataType
fn arrow_datatype() -> DataType
arrow2::datatypes::DataType
, excluding datatype extensions.source§fn to_arrow_opt<'a>(
data: impl IntoIterator<Item = Option<impl Into<Cow<'a, PixelFormat>>>>
) -> Result<Box<dyn Array>, SerializationError>where
PixelFormat: Clone + 'a,
fn to_arrow_opt<'a>(
data: impl IntoIterator<Item = Option<impl Into<Cow<'a, PixelFormat>>>>
) -> Result<Box<dyn Array>, SerializationError>where
PixelFormat: Clone + 'a,
source§fn from_arrow_opt(
arrow_data: &(dyn Array + 'static)
) -> Result<Vec<Option<PixelFormat>>, DeserializationError>where
PixelFormat: Sized,
fn from_arrow_opt(
arrow_data: &(dyn Array + 'static)
) -> Result<Vec<Option<PixelFormat>>, DeserializationError>where
PixelFormat: Sized,
Loggable
s.source§fn to_arrow<'a>(
data: impl IntoIterator<Item = impl Into<Cow<'a, Self>>>
) -> Result<Box<dyn Array>, SerializationError>where
Self: 'a,
fn to_arrow<'a>(
data: impl IntoIterator<Item = impl Into<Cow<'a, Self>>>
) -> Result<Box<dyn Array>, SerializationError>where
Self: 'a,
source§fn from_arrow(
data: &(dyn Array + 'static)
) -> Result<Vec<Self>, DeserializationError>
fn from_arrow( data: &(dyn Array + 'static) ) -> Result<Vec<Self>, DeserializationError>
Loggable
s.source§impl PartialEq for PixelFormat
impl PartialEq for PixelFormat
source§fn eq(&self, other: &PixelFormat) -> bool
fn eq(&self, other: &PixelFormat) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl SizeBytes for PixelFormat
impl SizeBytes for PixelFormat
source§fn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
self
on the heap, in bytes.source§fn total_size_bytes(&self) -> u64
fn total_size_bytes(&self) -> u64
self
in bytes, accounting for both stack and heap space.source§fn stack_size_bytes(&self) -> u64
fn stack_size_bytes(&self) -> u64
self
on the stack, in bytes. Read moreimpl Copy for PixelFormat
impl Eq for PixelFormat
impl StructuralPartialEq for PixelFormat
Auto Trait Implementations§
impl Freeze for PixelFormat
impl RefUnwindSafe for PixelFormat
impl Send for PixelFormat
impl Sync for PixelFormat
impl Unpin for PixelFormat
impl UnwindSafe for PixelFormat
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> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request