pub mod blur;
pub mod context;
pub mod crop;
pub mod flip;
pub mod jitter;
pub mod noise;
pub mod resize;
pub mod rotation;
pub use context::GpuContext;
pub use blur::GpuGaussianBlur;
pub use crop::GpuRandomCrop;
pub use flip::GpuRandomHorizontalFlip;
pub use jitter::GpuColorJitter;
pub use noise::GpuGaussianNoise;
pub use resize::GpuResize;
pub use rotation::GpuRotation;
#[cfg(feature = "gpu")]
use bytemuck::{Pod, Zeroable};
#[cfg(feature = "gpu")]
#[repr(C)]
#[derive(Clone, Copy, Pod, Zeroable)]
pub struct ColorJitterUniforms {
pub width: u32,
pub height: u32,
pub channels: u32,
pub padding: u32,
pub brightness: f32,
pub contrast: f32,
pub saturation: f32,
pub hue: f32,
}
#[cfg(feature = "gpu")]
#[repr(C)]
#[derive(Clone, Copy, Pod, Zeroable)]
pub struct GaussianBlurUniforms {
pub width: u32,
pub height: u32,
pub channels: u32,
pub kernel_size: u32,
pub sigma: f32,
pub padding: f32,
pub padding2: f32,
pub padding3: f32,
}
#[cfg(feature = "gpu")]
#[repr(C)]
#[derive(Clone, Copy, Pod, Zeroable)]
pub struct GaussianNoiseUniforms {
pub width: u32,
pub height: u32,
pub channels: u32,
pub padding: u32,
pub mean: f32,
pub std_dev: f32,
pub seed: u32,
pub padding2: u32,
}
#[cfg(feature = "gpu")]
#[repr(C)]
#[derive(Clone, Copy, Pod, Zeroable)]
pub struct RandomCropUniforms {
pub input_width: u32,
pub input_height: u32,
pub output_width: u32,
pub output_height: u32,
pub offset_x: u32,
pub offset_y: u32,
pub channels: u32,
pub padding: u32,
}
#[cfg(feature = "gpu")]
#[repr(C)]
#[derive(Clone, Copy, Pod, Zeroable)]
pub struct RotationUniforms {
pub width: u32,
pub height: u32,
pub channels: u32,
pub padding: u32,
pub cos_theta: f32,
pub sin_theta: f32,
pub center_x: f32,
pub center_y: f32,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_module_organization() {
#[cfg(feature = "gpu")]
{
assert_eq!(std::mem::size_of::<ColorJitterUniforms>(), 32);
assert_eq!(std::mem::size_of::<GaussianBlurUniforms>(), 32);
assert_eq!(std::mem::size_of::<GaussianNoiseUniforms>(), 32);
assert_eq!(std::mem::size_of::<RandomCropUniforms>(), 32);
assert_eq!(std::mem::size_of::<RotationUniforms>(), 32);
}
}
#[test]
fn test_gpu_context_integration() {
println!("GPU context integration test - GPU may not be available in test environment");
}
#[test]
fn test_backward_compatibility_types() {
#[cfg(feature = "gpu")]
{
let _context_type = std::marker::PhantomData::<GpuContext>;
let _resize_type = std::marker::PhantomData::<GpuResize>;
let _flip_type = std::marker::PhantomData::<GpuRandomHorizontalFlip>;
let _jitter_type = std::marker::PhantomData::<GpuColorJitter>;
let _blur_type = std::marker::PhantomData::<GpuGaussianBlur>;
let _noise_type = std::marker::PhantomData::<GpuGaussianNoise>;
let _crop_type = std::marker::PhantomData::<GpuRandomCrop>;
let _rotation_type = std::marker::PhantomData::<GpuRotation>;
}
}
}