Skip to main content

clahe_gpu

Function clahe_gpu 

Source
pub fn clahe_gpu(
    runtime: &WgpuRuntime,
    source: &GpuImage,
    clip_limit: f64,
    tiles_x: u32,
    tiles_y: u32,
) -> SpatialResult<GpuImage>
Expand description

Applies CPU-compatible CLAHE to a resident one-channel u8 image.

Tile histograms use Reflect101 padding, exact clipping/redistribution and CPU binary64 lookup rounding. Bilinear interpolation reproduces the CPU operation order using integer-word binary64 arithmetic, without shader float64 support. Metadata is preserved. Three passes use one submission, with no payload readback or implicit host wait. Clip limit zero disables histogram clipping; CLAHE can change constant-image bytes, just as the CPU implementation does. Each tile has at most u32::MAX padded pixels; lookup and axis geometry buffers must fit device binding limits. Empty images and non-grayscale input reject.