pub struct TransformKernel { /* private fields */ }Expand description
Transform kernel for frequency domain and geometric operations
Implementations§
Source§impl TransformKernel
impl TransformKernel
Sourcepub fn new(transform_type: TransformType) -> Self
pub fn new(transform_type: TransformType) -> Self
Create a new transform kernel
Sourcepub fn execute(
&self,
device: &GpuDevice,
input: &[f32],
output: &mut [f32],
width: u32,
height: u32,
) -> Result<()>
pub fn execute( &self, device: &GpuDevice, input: &[f32], output: &mut [f32], width: u32, height: u32, ) -> Result<()>
Execute the transform operation (frequency-domain, f32 data).
Handles DCT and IDCT which operate on f32 frequency-domain data.
For pixel-level geometric transforms (rotate, flip, transpose) use
TransformKernel::execute_u8 instead.
§Arguments
device- GPU deviceinput- Input data bufferoutput- Output data bufferwidth- Data widthheight- Data height
§Errors
Returns an error if the operation fails or is not supported for f32 data.
Sourcepub fn execute_u8(
&self,
_device: &GpuDevice,
input: &[u8],
width: u32,
height: u32,
channels: u32,
) -> Result<Vec<u8>>
pub fn execute_u8( &self, _device: &GpuDevice, input: &[u8], width: u32, height: u32, channels: u32, ) -> Result<Vec<u8>>
Execute a geometric pixel transform on an interleaved u8 image buffer.
Handles Rotate90, Rotate180, Rotate270, FlipHorizontal,
FlipVertical, and Transpose. FFT, IFFT, Affine, and
Perspective are deliberately left as NotSupported.
The _device parameter is accepted for API symmetry but is not used
by the CPU-side implementations (the geometric ops are fully pure-Rust).
§Arguments
_device- GPU device (unused; present for API consistency)input- Input pixel buffer (width * height * channelsbytes)width- Image width in pixelsheight- Image height in pixelschannels- Bytes per pixel (e.g. 3 for RGB, 4 for RGBA)
§Errors
Returns crate::GpuError::NotSupported for frequency-domain,
Affine, and Perspective transform types.
Sourcepub fn transform_type(&self) -> TransformType
pub fn transform_type(&self) -> TransformType
Get the transform type
Sourcepub fn is_frequency_domain(&self) -> bool
pub fn is_frequency_domain(&self) -> bool
Check if this is a frequency domain transform
Sourcepub fn is_geometric(&self) -> bool
pub fn is_geometric(&self) -> bool
Check if this is a geometric transform
Sourcepub fn estimate_flops(
width: u32,
height: u32,
transform_type: TransformType,
) -> u64
pub fn estimate_flops( width: u32, height: u32, transform_type: TransformType, ) -> u64
Estimate FLOPS for the transform operation
Auto Trait Implementations§
impl Freeze for TransformKernel
impl RefUnwindSafe for TransformKernel
impl Send for TransformKernel
impl Sync for TransformKernel
impl Unpin for TransformKernel
impl UnsafeUnpin for TransformKernel
impl UnwindSafe for TransformKernel
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