pub struct ScaleKernel;Expand description
GPU-style image scaling kernel (CPU simulation via Rayon).
Works with packed RGBA (4 bytes / pixel) and planar single-channel data.
Implementations§
Source§impl ScaleKernel
impl ScaleKernel
Sourcepub fn scale_plane(
src: &[u8],
src_w: u32,
src_h: u32,
dst: &mut [u8],
dst_w: u32,
dst_h: u32,
filter: ScaleFilter,
) -> Result<ScaleStats, ScaleError>
pub fn scale_plane( src: &[u8], src_w: u32, src_h: u32, dst: &mut [u8], dst_w: u32, dst_h: u32, filter: ScaleFilter, ) -> Result<ScaleStats, ScaleError>
Scale a single-channel (planar) image using the specified filter.
§Errors
Returns ScaleError if any buffer or dimension is invalid.
Sourcepub fn scale_rgba(
src: &[u8],
src_w: u32,
src_h: u32,
dst: &mut [u8],
dst_w: u32,
dst_h: u32,
filter: ScaleFilter,
) -> Result<ScaleStats, ScaleError>
pub fn scale_rgba( src: &[u8], src_w: u32, src_h: u32, dst: &mut [u8], dst_w: u32, dst_h: u32, filter: ScaleFilter, ) -> Result<ScaleStats, ScaleError>
Sourcepub fn scale_yuv420(
y_src: &[u8],
cb_src: &[u8],
cr_src: &[u8],
src_w: u32,
src_h: u32,
dst_w: u32,
dst_h: u32,
filter: ScaleFilter,
) -> Result<(Vec<u8>, Vec<u8>, Vec<u8>), ScaleError>
pub fn scale_yuv420( y_src: &[u8], cb_src: &[u8], cr_src: &[u8], src_w: u32, src_h: u32, dst_w: u32, dst_h: u32, filter: ScaleFilter, ) -> Result<(Vec<u8>, Vec<u8>, Vec<u8>), ScaleError>
Scale a planar YUV 4:2:0 image.
Cb/Cr planes are at half resolution in each dimension.
Returns scaled (Y, Cb, Cr) planes.
§Errors
Returns ScaleError on dimension or buffer validation failure.
Sourcepub fn scale_yuv422(
y_src: &[u8],
cb_src: &[u8],
cr_src: &[u8],
src_w: u32,
src_h: u32,
dst_w: u32,
dst_h: u32,
filter: ScaleFilter,
) -> Result<(Vec<u8>, Vec<u8>, Vec<u8>), ScaleError>
pub fn scale_yuv422( y_src: &[u8], cb_src: &[u8], cr_src: &[u8], src_w: u32, src_h: u32, dst_w: u32, dst_h: u32, filter: ScaleFilter, ) -> Result<(Vec<u8>, Vec<u8>, Vec<u8>), ScaleError>
Scale a planar YUV 4:2:2 image.
Cb/Cr planes are at half width, full height.
Returns scaled (Y, Cb, Cr) planes.
§Errors
Returns ScaleError on validation failure.
Trait Implementations§
Source§impl Clone for ScaleKernel
impl Clone for ScaleKernel
Source§fn clone(&self) -> ScaleKernel
fn clone(&self) -> ScaleKernel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScaleKernel
impl Debug for ScaleKernel
Source§impl Default for ScaleKernel
impl Default for ScaleKernel
Source§fn default() -> ScaleKernel
fn default() -> ScaleKernel
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ScaleKernel
impl RefUnwindSafe for ScaleKernel
impl Send for ScaleKernel
impl Sync for ScaleKernel
impl Unpin for ScaleKernel
impl UnsafeUnpin for ScaleKernel
impl UnwindSafe for ScaleKernel
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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 more