pub struct TransformOperation;Expand description
Transform operations for frequency domain processing
Implementations§
Source§impl TransformOperation
impl TransformOperation
Sourcepub fn dct_2d(
device: &GpuDevice,
input: &[f32],
output: &mut [f32],
width: u32,
height: u32,
) -> Result<()>
pub fn dct_2d( device: &GpuDevice, input: &[f32], output: &mut [f32], width: u32, height: u32, ) -> Result<()>
Compute 2D DCT (Discrete Cosine Transform)
Computes the forward DCT on 8x8 blocks. Input dimensions must be multiples of 8.
§Arguments
device- GPU deviceinput- Input data (f32 values)output- Output DCT coefficientswidth- Data width (must be multiple of 8)height- Data height (must be multiple of 8)
§Errors
Returns an error if dimensions are invalid or if the GPU operation fails.
Sourcepub fn idct_2d(
device: &GpuDevice,
input: &[f32],
output: &mut [f32],
width: u32,
height: u32,
) -> Result<()>
pub fn idct_2d( device: &GpuDevice, input: &[f32], output: &mut [f32], width: u32, height: u32, ) -> Result<()>
Compute 2D IDCT (Inverse Discrete Cosine Transform)
Computes the inverse DCT on 8x8 blocks. Input dimensions must be multiples of 8.
§Arguments
device- GPU deviceinput- Input DCT coefficientsoutput- Output reconstructed datawidth- Data width (must be multiple of 8)height- Data height (must be multiple of 8)
§Errors
Returns an error if dimensions are invalid or if the GPU operation fails.
Sourcepub fn dct_2d_general(
device: &GpuDevice,
input: &[f32],
output: &mut [f32],
width: u32,
height: u32,
) -> Result<()>
pub fn dct_2d_general( device: &GpuDevice, input: &[f32], output: &mut [f32], width: u32, height: u32, ) -> Result<()>
Compute general 2D DCT using row-column decomposition
This method works for any dimensions, not just multiples of 8.
§Arguments
device- GPU deviceinput- Input data (f32 values)output- Output DCT coefficientswidth- Data widthheight- Data height
§Errors
Returns an error if dimensions are invalid or if the GPU operation fails.
Source§impl TransformOperation
impl TransformOperation
Sourcepub fn rotate90(data: &[u8], width: u32, height: u32, channels: u32) -> Vec<u8> ⓘ
pub fn rotate90(data: &[u8], width: u32, height: u32, channels: u32) -> Vec<u8> ⓘ
Rotate an interleaved pixel image 90° clockwise.
Output dimensions are swapped: out_width = height, out_height = width.
Pixel mapping: output(x, y) = input(y, width_out - 1 - x) where
width_out = height.
§Arguments
data– packed pixel buffer (interleaved,channelsbytes per pixel)width– source image width in pixelsheight– source image height in pixelschannels– bytes per pixel (e.g. 3 for RGB, 4 for RGBA)
§Panics
Panics in debug mode if data.len() != width * height * channels.
Sourcepub fn rotate180(data: &[u8], width: u32, height: u32, channels: u32) -> Vec<u8> ⓘ
pub fn rotate180(data: &[u8], width: u32, height: u32, channels: u32) -> Vec<u8> ⓘ
Rotate an interleaved pixel image 180°.
Output dimensions are the same as input.
Pixel mapping: output(x, y) = input(width-1-x, height-1-y).
Sourcepub fn rotate270(data: &[u8], width: u32, height: u32, channels: u32) -> Vec<u8> ⓘ
pub fn rotate270(data: &[u8], width: u32, height: u32, channels: u32) -> Vec<u8> ⓘ
Rotate an interleaved pixel image 270° clockwise (= 90° counter-clockwise).
Output dimensions are swapped: out_width = height, out_height = width.
Pixel mapping: output(x, y) = input(height-1-y, x).
Sourcepub fn flip_horizontal(
data: &[u8],
width: u32,
height: u32,
channels: u32,
) -> Vec<u8> ⓘ
pub fn flip_horizontal( data: &[u8], width: u32, height: u32, channels: u32, ) -> Vec<u8> ⓘ
Flip an interleaved pixel image horizontally (mirror left-right).
Output dimensions are the same as input.
Pixel mapping: output(x, y) = input(width-1-x, y).
Auto Trait Implementations§
impl Freeze for TransformOperation
impl RefUnwindSafe for TransformOperation
impl Send for TransformOperation
impl Sync for TransformOperation
impl Unpin for TransformOperation
impl UnsafeUnpin for TransformOperation
impl UnwindSafe for TransformOperation
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> 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>
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 more