Skip to main content

MonochromeDataField

Struct MonochromeDataField 

Source
pub struct MonochromeDataField<'a> {
    pub first_segment: bool,
    pub last_segment: bool,
    pub field_parity: bool,
    pub line_offset: u8,
    pub first_pixel_position: u16,
    pub samples: &'a [u8],
}
Expand description

Monochrome 4:2:2 luminance-sample data field — ETSI EN 301 775 §4.9.1, Table 12 (data_unit_id 0xC6).

Unlike the other units this packs its first byte as [7] first_segment_flag, [6] last_segment_flag, [5] field_parity, [4:0] line_offset (no 2-bit reserved prefix), then a 16-bit first_pixel_position, an 8-bit n_pixels, and n_pixels luminance Y_value bytes.

Fields§

§first_segment: bool

first_segment_flag (1 for the first segment of a line).

§last_segment: bool

last_segment_flag (1 for the last segment of a line).

§field_parity: bool

field_parity (1 first field, 0 second field).

§line_offset: u8

line_offset (5 bits, 7..=23 valid; coded per Table 13).

§first_pixel_position: u16

first_pixel_position (16 bits, 0..=719): position of the first coded luminance sample of this segment.

§samples: &'a [u8]

Y_value luminance samples; n_pixels is samples.len() (1..=251).

Implementations§

Source§

impl<'a> MonochromeDataField<'a>

Source

pub fn serialized_len(&self) -> usize

Bytes this data field occupies (the data_unit_length).

Source

pub fn parse(data: &'a [u8]) -> Result<Self>

Parse exactly one monochrome data field from data (data is the data-unit body of data_unit_length bytes). n_pixels is taken from the wire and the sample slice is borrowed from data.

Source

pub fn serialize_into(&self, out: &mut [u8]) -> Result<usize>

Serialize into out, returning the number of bytes written. n_pixels is derived from samples.len().

Trait Implementations§

Source§

impl<'a> Clone for MonochromeDataField<'a>

Source§

fn clone(&self) -> MonochromeDataField<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for MonochromeDataField<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Eq for MonochromeDataField<'a>

Source§

impl<'a> PartialEq for MonochromeDataField<'a>

Source§

fn eq(&self, other: &MonochromeDataField<'a>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> Serialize for MonochromeDataField<'a>

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> StructuralPartialEq for MonochromeDataField<'a>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.