Skip to main content

wavefront

Function wavefront 

Source
pub fn wavefront<T, F>(
    data: &mut [T],
    top: &[T],
    geo: Wavefront,
    parallel: bool,
    f: F,
)
where T: Copy + Default + Send + Sync, F: Fn(usize, &mut [T], &[T], usize, usize, usize) + Sync,
Expand description

Process a buffer whose sample (r, x) depends only on samples left of it in row r and on columns <= x of the halo rows above it. Rows are cut into bands (one per thread) and columns into blocks; block j of a band runs once block j - 1 of the same band and block j of the band above are done, so the bands advance as a wavefront without waiting for each other row by row.

f(first_row, band, above, lo, a, b) must process columns a..b of every row of band (whole rows, first_row being the index of its first row in data) in row order. above holds the rows directly above the band (up to halo, oldest first), restricted to columns lo..b (lo = a - margin, clamped at 0); for the first band they come from top (which may hold fewer than halo rows, or none).