Skip to content

Commit

Permalink
Ongoing reworking
Browse files Browse the repository at this point in the history
  • Loading branch information
awxkee committed Nov 4, 2024
1 parent 059cfc3 commit b34af9d
Show file tree
Hide file tree
Showing 8 changed files with 428 additions and 1,712 deletions.
47 changes: 47 additions & 0 deletions src/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,50 @@ where
}
}
}

#[derive(Debug)]
/// Non-mutable representation of Bi-Planar YUV image
pub struct YuvPlanarImageWithAlpha<'a, T>
where
T: Copy + Debug,
{
pub y_plane: &'a [T],
/// Stride here always means Elements per row.
pub y_stride: u32,
pub u_plane: &'a [T],
/// Stride here always means Elements per row.
pub u_stride: u32,
pub v_plane: &'a [T],
/// Stride here always means Elements per row.
pub v_stride: u32,
pub a_plane: &'a [T],
/// Stride here always means Elements per row.
pub a_stride: u32,
pub width: u32,
pub height: u32,
}

impl<T> YuvPlanarImageWithAlpha<'_, T>
where
T: Copy + Debug,
{
pub fn check_constraints(&self, subsampling: YuvChromaSample) -> Result<(), YuvError> {
check_y8_channel(self.y_plane, self.y_stride, self.width, self.height)?;
check_y8_channel(self.a_plane, self.a_stride, self.width, self.height)?;
check_chroma_channel(
self.u_plane,
self.u_stride,
self.width,
self.height,
subsampling,
)?;
check_chroma_channel(
self.v_plane,
self.v_stride,
self.width,
self.height,
subsampling,
)?;
Ok(())
}
}
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ pub use sharpyuv::SharpYuvGammaTransfer;

pub use images::{
BufferStoreMut, YuvBiPlanarImage, YuvBiPlanarImageMut, YuvGrayAlphaImage, YuvGrayImage,
YuvGrayImageMut, YuvPlanarImage, YuvPlanarImageMut,
YuvGrayImageMut, YuvPlanarImage, YuvPlanarImageMut, YuvPlanarImageWithAlpha,
};
pub use y_p16_to_rgb16::*;
pub use y_p16_with_alpha_to_rgb16::*;
Expand Down
Loading

0 comments on commit b34af9d

Please sign in to comment.