slice-algorithms.dhover×407all
#!/usr/bin/env dub
/+ dub.sdl:
    name "images_mir_slice_algorithms"
    dependency "sparkles:math" path="../../../../.."
    dependency "mir-algorithm" version="==3.22.4"
    dflags "-preview=in" "-preview=dip1000"
    buildType "checked" {
        buildOptions "optimize" "inline" "debugInfo"
    }
+/
/**
 * Two image algorithms over mir `Slice` views: a per-pixel map (straight to
 * premultiplied alpha) and a 3x3 box blur over overlapping `windows`, each
 * written once against a pixel struct and once against `sparkles.math`'s
 * `Vector` as the pixel type, plus a hand-written loop blur over one 8-bit
 * plane for the generated-code comparison.
 *
 * Every kernel is a non-template `@safe pure nothrow @nogc` function, so the
 * compiler checks those attributes rather than inferring them.
 *
 * Backs ./slice-experiment.md (sections "Per-pixel map", "Box blur over
 * windows", "sparkles.math Vector as the pixel" and "Generated code").
 *
 * Run with: `dub run --single slice-algorithms.d`
 */
module 
(module) images_mir_slice_algorithms

Two image algorithms over mir Slice views: a per-pixel map (straight to premultiplied alpha) and a 3x3 box blur over overlapping windows, each written once against a pixel struct and once against sparkles.math's Vector as the pixel type, plus a hand-written loop blur over one 8-bit plane for the generated-code comparison.

Every kernel is a non-template @safe pure nothrow @nogc function, so the compiler checks those attributes rather than inferring them.

Backs ./slice-experiment.md (sections "Per-pixel map", "Box blur over windows", "sparkles.math Vector as the pixel" and "Generated code").

Run with: dub run --single slice-algorithms.d

images_mir_slice_algorithms
;
import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) images_mir_slice_algorithms.writefln = std.stdio.writefln(alias fmt, A...)(A args) if (isSomeString!(typeof(fmt)))

Equivalent to writef(fmt, args, '\n').

writefln
;
import
(package) mir
mir
.
(package) mir.ndslice
ndslice
.
(module) mir.ndslice.slice

This is a submodule of mir.ndslice.

Safety note

User-defined iterators should care about their safety except bounds checks. Bounds are checked in ndslice code.

@licenseApache-2.0@copyright2020 Ilia Ki, Kaleidic Associates Advisory Limited, Symmetry Investments@authors

Ilia Ki

Name Description
Slice N-dimensional slice.
SliceKind SliceKind of Slice enumeration.
Universal Alias for .SliceKind.universal.
Canonical Alias for .SliceKind.canonical.
Contiguous Alias for .SliceKind.contiguous.
sliced Creates a slice on top of an iterator, a pointer, or an array's pointer.
slicedField Creates a slice on top of a field, a random access range, or an array.
slicedNdField Creates a slice on top of an ndField.
kindOf Extracts SliceKind.
isSlice Checks if the type is Slice instance.
Structure A tuple of lengths and strides.
slice
: Slice,
(alias template) images_mir_slice_algorithms.sliced = mir.ndslice.slice.sliced(ulong N, Iterator)(return scope Iterator iterator, size_t[N] lengths...) if (!__traits(isStaticArray, Iterator) && N && !is(Iterator : Slice!(_Iterator, _N, kind), _Iterator, size_t _N, SliceKind kind))

Creates an n-dimensional slice-shell over an iterator.

@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
;
import
(package) mir
mir
.
(package) mir.ndslice
ndslice
.
(module) mir.ndslice.topology

This is a submodule of mir.ndslice.

Selectors create new views and iteration patterns over the same data, without copying.

Function Name Description

| cycle | Cycle repeates 1-dimensional field/range/array/slice in a fixed length 1-dimensional slice | | iota | Contiguous Slice with initial flattened (contiguous) index. | | linspace | Evenly spaced numbers over a specified interval. | | magic | Magic square. | | ndiota | Contiguous Slice with initial multidimensional index. | | repeat | Slice with identical values |

Function Name Description

| blocks | n-dimensional slice composed of n-dimensional non-overlapping blocks. If the slice has two dimensions, it is a block matrix. | | diagonal | 1-dimensional slice composed of diagonal elements | | dropBorders | Drops borders for all dimensions. | | reshape | New slice view with changed dimensions | | squeeze | New slice view of an n-dimensional slice with dimension removed | | unsqueeze | New slice view of an n-dimensional slice with a dimension added | | windows | n-dimensional slice of n-dimensional overlapping windows. If the slice has two dimensions, it is a sliding window. |

Function Name Description

| alongDim | Returns a slice that can be iterated along dimension. | | byDim | Returns a slice that can be iterated by dimension. | | pack | Returns slice of slices. | | ipack | Returns slice of slices. | | unpack | Merges two hight dimension packs. See also fuse . | | evertPack | Reverses dimension packs. |

Function Name Description

| asKindOf | Converts a slice to a user provied kind SliceKind . | | universal | Converts a slice to universal SliceKind . | | canonical | Converts a slice to canonical SliceKind . | | assumeCanonical | Converts a slice to canonical SliceKind . Does only assert checks. | | assumeContiguous | Converts a slice to contiguous SliceKind . Does only assert checks. | | assumeHypercube | Helps the compiler to use optimisations related to the shape form. Does only assert checks. | | assumeSameShape | Helps the compiler to use optimisations related to the shape form. Does only assert checks. |

Function Name Description

| cartesian | Cartesian product. | | kronecker | Kronecker product. |

Function Name Description

| as | Convenience function that creates a lazy view, where each element of the original slice is converted to a type T. | | bitpack | Bitpack slice over an unsigned integral slice. | | bitwise | Bitwise slice over an unsigned integral slice. | | bytegroup | Groups existing slice into fixed length chunks and uses them as data store for destination type. | | cached | Random access cache. It is usefull in combiation with map and vmap. | | cachedGC | Random access cache auto-allocated in GC heap. It is usefull in combiation with map and vmap. | | diff | Differences between vector elements. | | flattened | Contiguous 1-dimensional slice of all elements of a slice. | | map | Multidimensional functional map. | | member | Field (element's member) projection. | | orthogonalReduceField | Functional deep-element wise reduce of a slice composed of fields or iterators. | | pairwise | Pairwise map for vectors. | | pairwiseMapSubSlices | Maps pairwise index pairs to subslices. | | retro | Reverses order of iteration for all dimensions. | | slide | Lazy convolution for tensors. | | slideAlong | Lazy convolution for tensors. | | stairs | Two functions to pack, unpack, and iterate triangular and symmetric matrix storage. | | stride | Strides 1-dimensional slice. | | subSlices | Maps index pairs to subslices. | | triplets | Constructs a lazy view of triplets with left, center, and right members. The topology is usefull for Math and Physics. | | unzip | Selects a slice from a zipped slice. | | withNeighboursSum | Zip view of elements packed with sum of their neighbours. | | zip | Zips slices into a slice of refTuples. |

Subspace selectors serve to generalize and combine other selectors easily. For a slice of Slice!(Iterator, N, kind) type slice.pack!K creates a slice of slices of Slice!(kind, [N - K, K], Iterator) type by packing the last K dimensions of the top dimension pack, and the type of element of flattened is Slice!(Iterator, K). Another way to use pack is transposition of dimension packs using evertPack. Examples of use of subspace selectors are available for selectors, Slice.shape , and Slice.elementCount .

Sponsors

Part of this work has been sponsored by Symmetry Investments and Kaleidic Associates.

@licenseApache-2.0@copyright2020 Ilia Ki, Kaleidic Associates Advisory Limited, Symmetry Investments@authorsIlia Ki, John Michael Hall, Shigeki Karita (original numir code)
topology
:
(alias template) images_mir_slice_algorithms.flattened = mir.ndslice.topology.flattened(Iterator, ulong N, mir_slice_kind kind)(Slice!(Iterator, N, kind) slice) if (N != 1 && (kind != Contiguous))

A contiguous 1-dimensional slice of all elements of a slice. flattened iterates existing data. The order of elements is preserved.

flattened can be generalized with other selectors.

@paramslice slice to be iterated@returnscontiguous 1-dimensional slice of elements of the slice
flattened
,
(alias template) images_mir_slice_algorithms.map = mir.ndslice.topology.map(fun...) if (fun.length)

Implements the homonym function (also known as transform) present in many languages of functional flavor. The call ``map!(fun)(slice) returns a slice of which elements are obtained by applying fun for all elements in slice. The original slices are not changed. Evaluation is done lazily.

Note

dynamic, transposed and topology, pack can be used to specify dimensions.

@paramfun One or more functions.@seecached, vmap, rcmap, indexed, pairwise, subSlices, slide, zip, Map (higher-order function)
map
,
(alias template) images_mir_slice_algorithms.windows = mir.ndslice.topology.windows(Iterator, ulong N, mir_slice_kind kind)(Slice!(Iterator, N, kind) slice, size_t[N] rlengths...)

Returns an n-dimensional slice of n-dimensional overlapping windows. windows can be generalized with other selectors. For example, windows in combination with diagonal can be used to get a multi-diagonal slice.

@paramN dimension count@paramslice slice to be iterated@paramrlengths dimensions of windows@returnspacked N-dimensional slice composed of N-dimensional slices
windows
;
import
(package) sparkles
sparkles
.
(module) sparkles.math
math
:
(alias struct) images_mir_slice_algorithms.Vector = sparkles.math.vector.Vector(T, ulong N, Layout layout = Layout.packed, string[] names = defaultNames!N) if (isNumeric!T && (N > 0))

A vector of N components of type T, laid out as layout, with the components named names.

Vector
;
struct
(struct) images_mir_slice_algorithms.Rgba8
Rgba8
{ ubyte
(field) ubyte images_mir_slice_algorithms.Rgba8.r
r
,
(field) ubyte images_mir_slice_algorithms.Rgba8.g
g
,
(field) ubyte images_mir_slice_algorithms.Rgba8.b
b
,
(field) ubyte images_mir_slice_algorithms.Rgba8.a
a
;
} /// `sparkles.math`'s vector as the pixel: four packed `ubyte`s, the same /// 4 bytes as `Rgba8`, with `rgba` swizzles from the default `xyzw` names. alias
(alias) images_mir_slice_algorithms.Px = sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])

sparkles.math's vector as the pixel: four packed ubytes, the same 4 bytes as Rgba8, with rgba swizzles from the default xyzw names.

Px
=
(struct) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])

A vector of N components of type T, laid out as layout, with the components named names.

Vector
!(ubyte, 4);
static assert(
(struct) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])
Px
.sizeof == 4);
/// The accumulator a blur needs: the same vector, widened. alias
(alias) images_mir_slice_algorithms.Px32 = sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])

The accumulator a blur needs: the same vector, widened.

Px32
=
(struct) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])

A vector of N components of type T, laid out as layout, with the components named names.

Vector
!(uint, 4);
enum
(alias) object.size_t = ulong
size_t
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
= 8;
enum
(alias) object.size_t = ulong
size_t
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
= 6;
ubyte
ubyte images_mir_slice_algorithms.sample(ulong y, ulong x, ulong c) pure nothrow @nogc @safe
sample
(
(alias) object.size_t = ulong
size_t
(parameter) ulong y
y
,
(alias) object.size_t = ulong
size_t
(parameter) ulong x
x
,
(alias) object.size_t = ulong
size_t
(parameter) ulong c
c
) @safe pure nothrow @nogc
=> cast(ubyte) ((
(parameter) ulong x
x
* 37 +
(parameter) ulong y
y
* 101 +
(parameter) ulong c
c
* 59 +
(parameter) ulong x
x
*
(parameter) ulong y
y
* 13) & 0xFF);
/// `(v * a + 127) / 255`, the rounded 8-bit premultiply. ubyte
ubyte images_mir_slice_algorithms.mul8(uint v, uint a) pure nothrow @nogc @safe

(v * a + 127) / 255, the rounded 8-bit premultiply.

mul8
(uint
(parameter) uint v
v
, uint
(parameter) uint a
a
) @safe pure nothrow @nogc => cast(ubyte) ((
(parameter) uint v
v
*
(parameter) uint a
a
+ 127) / 255);
// ---------------------------------------------------------------- per-pixel map
(struct) images_mir_slice_algorithms.Rgba8
Rgba8
images_mir_slice_algorithms.Rgba8 images_mir_slice_algorithms.premultiply(images_mir_slice_algorithms.Rgba8 p) pure nothrow @nogc @safe
premultiply
(
(struct) images_mir_slice_algorithms.Rgba8
Rgba8
(parameter) images_mir_slice_algorithms.Rgba8 p
p
) @safe pure nothrow @nogc
=>
(struct) images_mir_slice_algorithms.Rgba8
Rgba8
(
ubyte images_mir_slice_algorithms.mul8(uint v, uint a) pure nothrow @nogc @safe

(v * a + 127) / 255, the rounded 8-bit premultiply.

mul8
(
(parameter) images_mir_slice_algorithms.Rgba8 p
p
.
(field) ubyte images_mir_slice_algorithms.Rgba8.r
r
,
(parameter) images_mir_slice_algorithms.Rgba8 p
p
.
(field) ubyte images_mir_slice_algorithms.Rgba8.a
a
),
ubyte images_mir_slice_algorithms.mul8(uint v, uint a) pure nothrow @nogc @safe

(v * a + 127) / 255, the rounded 8-bit premultiply.

mul8
(
(parameter) images_mir_slice_algorithms.Rgba8 p
p
.
(field) ubyte images_mir_slice_algorithms.Rgba8.g
g
,
(parameter) images_mir_slice_algorithms.Rgba8 p
p
.
(field) ubyte images_mir_slice_algorithms.Rgba8.a
a
),
ubyte images_mir_slice_algorithms.mul8(uint v, uint a) pure nothrow @nogc @safe

(v * a + 127) / 255, the rounded 8-bit premultiply.

mul8
(
(parameter) images_mir_slice_algorithms.Rgba8 p
p
.
(field) ubyte images_mir_slice_algorithms.Rgba8.b
b
,
(parameter) images_mir_slice_algorithms.Rgba8 p
p
.
(field) ubyte images_mir_slice_algorithms.Rgba8.a
a
),
(parameter) images_mir_slice_algorithms.Rgba8 p
p
.
(field) ubyte images_mir_slice_algorithms.Rgba8.a
a
);
/// The map is lazy (`src.map!premultiply` is a view); assigning it to `dst[]` /// runs it. No allocation, no copy of `src`. void
void images_mir_slice_algorithms.premultiplyInto(mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe

The map is lazy (src`.map!premultiply` is a view); assigning it to dst[] runs it. No allocation, no copy of src.

premultiplyInto
(Slice!(const(Rgba8)*, 2)
(parameter) mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.contiguous) src
src
, Slice!(Rgba8*, 2)
(parameter) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) dst
dst
) @safe pure nothrow @nogc
{
(parameter) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) dst
dst
[] =
void mir.ndslice.slice.Slice!(images_mir_slice_algorithms.Rgba8*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(mir.ndslice.iterator.MapIterator!(const(Rgba8)*, premultiply), 2LU, mir_slice_kind.contiguous)(mir.ndslice.slice.Slice!(MapIterator!(const(Rgba8)*, premultiply), 2LU, mir_slice_kind.contiguous) value) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

src
.
void mir.ndslice.slice.Slice!(images_mir_slice_algorithms.Rgba8*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(mir.ndslice.iterator.MapIterator!(const(Rgba8)*, premultiply), 2LU, mir_slice_kind.contiguous)(mir.ndslice.slice.Slice!(MapIterator!(const(Rgba8)*, premultiply), 2LU, mir_slice_kind.contiguous) value) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

map
!
void mir.ndslice.slice.Slice!(images_mir_slice_algorithms.Rgba8*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(mir.ndslice.iterator.MapIterator!(const(Rgba8)*, premultiply), 2LU, mir_slice_kind.contiguous)(mir.ndslice.slice.Slice!(MapIterator!(const(Rgba8)*, premultiply), 2LU, mir_slice_kind.contiguous) value) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

premultiply
;
} /// The same with `Vector` arithmetic: widen to `uint` lanes, multiply the /// `rgb` swizzle by `a`, narrow back. `Vector` has no converting constructor, /// so both conversions are spelled per component.
(alias) images_mir_slice_algorithms.Px = sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])

sparkles.math's vector as the pixel: four packed ubytes, the same 4 bytes as Rgba8, with rgba swizzles from the default xyzw names.

Px
sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]) images_mir_slice_algorithms.premultiplyVec(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]) p) pure nothrow @nogc @safe

The same with Vector arithmetic: widen to uint lanes, multiply the rgb swizzle by a, narrow back. Vector has no converting constructor, so both conversions are spelled per component.

premultiplyVec
(
(alias) images_mir_slice_algorithms.Px = sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])

sparkles.math's vector as the pixel: four packed ubytes, the same 4 bytes as Rgba8, with rgba swizzles from the default xyzw names.

Px
(parameter) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]) p
p
) @safe pure nothrow @nogc
{ const
(local variable) const(sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])) w
w
=
(struct) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])
Px32
(
sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]).this(uint x, uint y, uint z, uint w) pure nothrow @nogc ref @safe
p
.
sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]).this(uint x, uint y, uint z, uint w) pure nothrow @nogc ref @safe
x
,
(parameter) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]) p
p
.
inout(ubyte) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]).y() inout pure nothrow @nogc @property return ref @safe
y
,
(parameter) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]) p
p
.
inout(ubyte) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
,
(parameter) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]) p
p
.
inout(ubyte) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
);
const
(local variable) const(sparkles.math.vector.Vector!(uint, 3LU, Layout.packed, ["x", "y", "z"])) rgb
rgb
= (
(local variable) const(sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])) w
w
.
sparkles.math.vector.Vector!(uint, 3LU, Layout.packed, ["x", "y", "z"]) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]).opDispatch!"rgb"() const pure nothrow @nogc @safe

A swizzle: the components named by the letters of s, in order and repeating as they like (v.yx, v.xxz; v.rgb where the names are the default ones), as a vector. A name that is not a swizzle is not a member.

rgb
*
sparkles.math.vector.Vector!(uint, 3LU, Layout.packed, ["x", "y", "z"]) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]).opDispatch!"rgb"() const pure nothrow @nogc @safe

A swizzle: the components named by the letters of s, in order and repeating as they like (v.yx, v.xxz; v.rgb where the names are the default ones), as a vector. A name that is not a swizzle is not a member.

w
.
sparkles.math.vector.Vector!(uint, 3LU, Layout.packed, ["x", "y", "z"]) sparkles.math.vector.Vector!(uint, 3LU, Layout.packed, ["x", "y", "z"]).opBinary!("*", uint)(const(uint) rhs) const pure nothrow @nogc @safe

Component-wise arithmetic against one value, on either side.

a
+ 127u) / 255u;
return
(struct) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])
Px
(cast(ubyte)
(local variable) const(sparkles.math.vector.Vector!(uint, 3LU, Layout.packed, ["x", "y", "z"])) rgb
rgb
.
inout(uint) sparkles.math.vector.Vector!(uint, 3LU, Layout.packed, ["x", "y", "z"]).x() inout pure nothrow @nogc @property return ref @safe
x
, cast(ubyte)
(local variable) const(sparkles.math.vector.Vector!(uint, 3LU, Layout.packed, ["x", "y", "z"])) rgb
rgb
.
inout(uint) sparkles.math.vector.Vector!(uint, 3LU, Layout.packed, ["x", "y", "z"]).y() inout pure nothrow @nogc @property return ref @safe
y
, cast(ubyte)
(local variable) const(sparkles.math.vector.Vector!(uint, 3LU, Layout.packed, ["x", "y", "z"])) rgb
rgb
.
inout(uint) sparkles.math.vector.Vector!(uint, 3LU, Layout.packed, ["x", "y", "z"]).z() inout pure nothrow @nogc @property return ref @safe
z
,
(parameter) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]) p
p
.
inout(ubyte) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
);
} void
void images_mir_slice_algorithms.premultiplyVecInto(mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe
premultiplyVecInto
(Slice!(const(Px)*, 2)
(parameter) mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.contiguous) src
src
, Slice!(Px*, 2)
(parameter) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) dst
dst
) @safe pure nothrow @nogc
{
(parameter) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) dst
dst
[] =
void mir.ndslice.slice.Slice!(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(mir.ndslice.iterator.MapIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, premultiplyVec), 2LU, mir_slice_kind.contiguous)(mir.ndslice.slice.Slice!(MapIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, premultiplyVec), 2LU, mir_slice_kind.contiguous) value) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

src
.
void mir.ndslice.slice.Slice!(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(mir.ndslice.iterator.MapIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, premultiplyVec), 2LU, mir_slice_kind.contiguous)(mir.ndslice.slice.Slice!(MapIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, premultiplyVec), 2LU, mir_slice_kind.contiguous) value) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

map
!
void mir.ndslice.slice.Slice!(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(mir.ndslice.iterator.MapIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, premultiplyVec), 2LU, mir_slice_kind.contiguous)(mir.ndslice.slice.Slice!(MapIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, premultiplyVec), 2LU, mir_slice_kind.contiguous) value) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

premultiplyVec
;
} // ---------------------------------------------------------------- 3x3 box blur /// Mean of one 3x3 window of `Rgba8`, channel by channel, rounded.
(struct) images_mir_slice_algorithms.Rgba8
Rgba8
images_mir_slice_algorithms.Rgba8 images_mir_slice_algorithms.boxMean!(mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.canonical))(mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.canonical) w) pure nothrow @nogc @safe

Mean of one 3x3 window of Rgba8, channel by channel, rounded.

boxMean
(W)(
(alias) W = mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.canonical)
W
(parameter) mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.canonical) w
w
)
{ uint
(local variable) uint r
r
,
(local variable) uint g
g
,
(local variable) uint b
b
,
(local variable) uint a
a
;
foreach (
(local variable) const(images_mir_slice_algorithms.Rgba8) p
p
;
(parameter) mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.canonical) w
w
.
mir.ndslice.slice.Slice!(FlattenedIterator!(const(Rgba8)*, 2LU, mir_slice_kind.canonical), 1LU, mir_slice_kind.contiguous) mir.ndslice.topology.flattened!(const(images_mir_slice_algorithms.Rgba8)*, 2LU, mir_slice_kind.canonical)(mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.canonical) slice) pure nothrow @nogc @safe

A contiguous 1-dimensional slice of all elements of a slice. flattened iterates existing data. The order of elements is preserved.

flattened can be generalized with other selectors.

@paramslice slice to be iterated@returnscontiguous 1-dimensional slice of elements of the slice
flattened
)
{
(local variable) uint r
r
+=
(local variable) const(images_mir_slice_algorithms.Rgba8) p
p
.
(field) ubyte images_mir_slice_algorithms.Rgba8.r
r
;
(local variable) uint g
g
+=
(local variable) const(images_mir_slice_algorithms.Rgba8) p
p
.
(field) ubyte images_mir_slice_algorithms.Rgba8.g
g
;
(local variable) uint b
b
+=
(local variable) const(images_mir_slice_algorithms.Rgba8) p
p
.
(field) ubyte images_mir_slice_algorithms.Rgba8.b
b
;
(local variable) uint a
a
+=
(local variable) const(images_mir_slice_algorithms.Rgba8) p
p
.
(field) ubyte images_mir_slice_algorithms.Rgba8.a
a
;
} return
(struct) images_mir_slice_algorithms.Rgba8
Rgba8
(cast(ubyte) ((
(local variable) uint r
r
+ 4) / 9), cast(ubyte) ((
(local variable) uint g
g
+ 4) / 9), cast(ubyte) ((
(local variable) uint b
b
+ 4) / 9),
cast(ubyte) ((
(local variable) uint a
a
+ 4) / 9));
} /// The blur writes the interior: `windows(3, 3)` has `(h - 2) x (w - 2)` /// windows, one per interior pixel, each a 3x3 view of `src`. void
void images_mir_slice_algorithms.boxBlurInto(mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe

The blur writes the interior: windows(3, 3) has (h - 2) x (w - 2) windows, one per interior pixel, each a 3x3 view of src.

boxBlurInto
(Slice!(const(Rgba8)*, 2)
(parameter) mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.contiguous) src
src
, Slice!(Rgba8*, 2)
(parameter) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) dst
dst
) @safe pure nothrow @nogc
{
(parameter) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) dst
dst
[1 .. $ - 1, 1 .. $ - 1] =
void mir.ndslice.slice.Slice!(images_mir_slice_algorithms.Rgba8*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(images_mir_slice_algorithms.boxBlurInto.MapIterator!(SliceIterator!(const(Rgba8)*, 2LU, mir_slice_kind.canonical), __lambda_L105_C58), 2LU, mir_slice_kind.universal, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous), mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous))(mir.ndslice.slice.Slice!(MapIterator!(SliceIterator!(const(Rgba8)*, 2LU, mir_slice_kind.canonical), __lambda_L105_C58), 2LU, mir_slice_kind.universal) value, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_1, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_2) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

src
.
void mir.ndslice.slice.Slice!(images_mir_slice_algorithms.Rgba8*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(images_mir_slice_algorithms.boxBlurInto.MapIterator!(SliceIterator!(const(Rgba8)*, 2LU, mir_slice_kind.canonical), __lambda_L105_C58), 2LU, mir_slice_kind.universal, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous), mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous))(mir.ndslice.slice.Slice!(MapIterator!(SliceIterator!(const(Rgba8)*, 2LU, mir_slice_kind.canonical), __lambda_L105_C58), 2LU, mir_slice_kind.universal) value, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_1, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_2) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

windows
(3, 3).
mir.ndslice.slice.Slice!(MapIterator!(SliceIterator!(const(Rgba8)*, 2LU, mir_slice_kind.canonical), __lambda_L105_C58), 2LU, mir_slice_kind.universal) images_mir_slice_algorithms.boxBlurInto.map!(mir.ndslice.iterator.SliceIterator!(const(Rgba8)*, 2LU, mir_slice_kind.canonical), 2LU, mir_slice_kind.universal)(mir.ndslice.slice.Slice!(SliceIterator!(const(Rgba8)*, 2LU, mir_slice_kind.canonical), 2LU, mir_slice_kind.universal) slice) pure nothrow @nogc @safe

Implements the homonym function (also known as transform) present in many languages of functional flavor. The call map`!(fun)(`slice`)` returns a `slice` of which elements are obtained by applying `fun` for all elements in slice``. The original slices are not changed. Evaluation is done lazily.

Note

dynamic, transposed and topology, pack can be used to specify dimensions.

@paramfun One or more functions.@seecached, vmap, rcmap, indexed, pairwise, subSlices, slide, zip, Map (higher-order function)@paramslice An ndslice, array, or an input range.@returnsndslice or an input range with each fun applied to all the elements. If there is more than one fun, the element type will be Tuple containing one element for each fun.
map
!(w => boxMean(w));
} /// The same with `Vector` accumulation: one `+=` per pixel instead of four.
(alias) images_mir_slice_algorithms.Px = sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])

sparkles.math's vector as the pixel: four packed ubytes, the same 4 bytes as Rgba8, with rgba swizzles from the default xyzw names.

Px
sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]) images_mir_slice_algorithms.boxMeanVec!(mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical))(mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical) w) pure nothrow @nogc @safe

The same with Vector accumulation: one += per pixel instead of four.

boxMeanVec
(W)(
(alias) W = mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical)
W
(parameter) mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical) w
w
)
{
(alias) images_mir_slice_algorithms.Px32 = sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])

The accumulator a blur needs: the same vector, widened.

Px32
(local variable) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]) acc
acc
;
foreach (
(local variable) const(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])) p
p
;
(parameter) mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical) w
w
.
mir.ndslice.slice.Slice!(FlattenedIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical), 1LU, mir_slice_kind.contiguous) mir.ndslice.topology.flattened!(const(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical)(mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical) slice) pure nothrow @nogc @safe

A contiguous 1-dimensional slice of all elements of a slice. flattened iterates existing data. The order of elements is preserved.

flattened can be generalized with other selectors.

@paramslice slice to be iterated@returnscontiguous 1-dimensional slice of elements of the slice
flattened
)
(local variable) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]) acc
acc
+=
sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]).opOpAssign!("+", sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]))(const(sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])) rhs) pure nothrow @nogc return ref @safe

In-place component-wise arithmetic, against a vector or a value.

Px32
(
sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]).opOpAssign!("+", sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]))(const(sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])) rhs) pure nothrow @nogc return ref @safe

In-place component-wise arithmetic, against a vector or a value.

p
.
inout(ubyte) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]).x() inout pure nothrow @nogc @property return ref @safe
x
,
(local variable) const(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])) p
p
.
inout(ubyte) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]).y() inout pure nothrow @nogc @property return ref @safe
y
,
(local variable) const(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])) p
p
.
inout(ubyte) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
,
(local variable) const(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])) p
p
.
inout(ubyte) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
);
const
(local variable) const(sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])) m
m
= (
(local variable) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]) acc
acc
+ 4u) / 9u;
return
(struct) sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])
Px
(cast(ubyte)
(local variable) const(sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])) m
m
.
inout(uint) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]).x() inout pure nothrow @nogc @property return ref @safe
x
, cast(ubyte)
(local variable) const(sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])) m
m
.
inout(uint) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]).y() inout pure nothrow @nogc @property return ref @safe
y
, cast(ubyte)
(local variable) const(sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])) m
m
.
inout(uint) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
, cast(ubyte)
(local variable) const(sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"])) m
m
.
inout(uint) sparkles.math.vector.Vector!(uint, 4LU, Layout.packed, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
);
} void
void images_mir_slice_algorithms.boxBlurVecInto(mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe
boxBlurVecInto
(Slice!(const(Px)*, 2)
(parameter) mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.contiguous) src
src
, Slice!(Px*, 2)
(parameter) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) dst
dst
) @safe pure nothrow @nogc
{
(parameter) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) dst
dst
[1 .. $ - 1, 1 .. $ - 1] =
void mir.ndslice.slice.Slice!(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(images_mir_slice_algorithms.boxBlurVecInto.MapIterator!(SliceIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical), __lambda_L120_C58), 2LU, mir_slice_kind.universal, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous), mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous))(mir.ndslice.slice.Slice!(MapIterator!(SliceIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical), __lambda_L120_C58), 2LU, mir_slice_kind.universal) value, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_1, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_2) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

src
.
void mir.ndslice.slice.Slice!(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(images_mir_slice_algorithms.boxBlurVecInto.MapIterator!(SliceIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical), __lambda_L120_C58), 2LU, mir_slice_kind.universal, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous), mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous))(mir.ndslice.slice.Slice!(MapIterator!(SliceIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical), __lambda_L120_C58), 2LU, mir_slice_kind.universal) value, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_1, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_2) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

windows
(3, 3).
mir.ndslice.slice.Slice!(MapIterator!(SliceIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical), __lambda_L120_C58), 2LU, mir_slice_kind.universal) images_mir_slice_algorithms.boxBlurVecInto.map!(mir.ndslice.iterator.SliceIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical), 2LU, mir_slice_kind.universal)(mir.ndslice.slice.Slice!(SliceIterator!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.canonical), 2LU, mir_slice_kind.universal) slice) pure nothrow @nogc @safe

Implements the homonym function (also known as transform) present in many languages of functional flavor. The call map`!(fun)(`slice`)` returns a `slice` of which elements are obtained by applying `fun` for all elements in slice``. The original slices are not changed. Evaluation is done lazily.

Note

dynamic, transposed and topology, pack can be used to specify dimensions.

@paramfun One or more functions.@seecached, vmap, rcmap, indexed, pairwise, subSlices, slide, zip, Map (higher-order function)@paramslice An ndslice, array, or an input range.@returnsndslice or an input range with each fun applied to all the elements. If there is more than one fun, the element type will be Tuple containing one element for each fun.
map
!(w => boxMeanVec(w));
} /// One 8-bit plane, `windows` form: the kernel the generated-code section reads. void
void images_mir_slice_algorithms.blurPlaneMir(mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe

One 8-bit plane, windows form: the kernel the generated-code section reads.

blurPlaneMir
(Slice!(const(ubyte)*, 2)
(parameter) mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous) src
src
, Slice!(ubyte*, 2)
(parameter) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) dst
dst
) @safe pure nothrow @nogc
{
(parameter) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) dst
dst
[1 .. $ - 1, 1 .. $ - 1] =
void mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(images_mir_slice_algorithms.blurPlaneMir.MapIterator!(SliceIterator!(const(ubyte)*, 2LU, mir_slice_kind.canonical), __lambda_L126_C58), 2LU, mir_slice_kind.universal, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous), mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous))(mir.ndslice.slice.Slice!(MapIterator!(SliceIterator!(const(ubyte)*, 2LU, mir_slice_kind.canonical), __lambda_L126_C58), 2LU, mir_slice_kind.universal) value, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_1, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_2) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

src
.
void mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(images_mir_slice_algorithms.blurPlaneMir.MapIterator!(SliceIterator!(const(ubyte)*, 2LU, mir_slice_kind.canonical), __lambda_L126_C58), 2LU, mir_slice_kind.universal, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous), mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous))(mir.ndslice.slice.Slice!(MapIterator!(SliceIterator!(const(ubyte)*, 2LU, mir_slice_kind.canonical), __lambda_L126_C58), 2LU, mir_slice_kind.universal) value, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_1, mir.ndslice.slice.Slice!(IotaIterator!ulong, 1LU, mir_slice_kind.contiguous) __param_2) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

windows
(3, 3).
mir.ndslice.slice.Slice!(MapIterator!(SliceIterator!(const(ubyte)*, 2LU, mir_slice_kind.canonical), __lambda_L126_C58), 2LU, mir_slice_kind.universal) images_mir_slice_algorithms.blurPlaneMir.map!(mir.ndslice.iterator.SliceIterator!(const(ubyte)*, 2LU, mir_slice_kind.canonical), 2LU, mir_slice_kind.universal)(mir.ndslice.slice.Slice!(SliceIterator!(const(ubyte)*, 2LU, mir_slice_kind.canonical), 2LU, mir_slice_kind.universal) slice) pure nothrow @nogc @safe

Implements the homonym function (also known as transform) present in many languages of functional flavor. The call map`!(fun)(`slice`)` returns a `slice` of which elements are obtained by applying `fun` for all elements in slice``. The original slices are not changed. Evaluation is done lazily.

Note

dynamic, transposed and topology, pack can be used to specify dimensions.

@paramfun One or more functions.@seecached, vmap, rcmap, indexed, pairwise, subSlices, slide, zip, Map (higher-order function)@paramslice An ndslice, array, or an input range.@returnsndslice or an input range with each fun applied to all the elements. If there is more than one fun, the element type will be Tuple containing one element for each fun.
map
!((w) {
uint s = 0; foreach (v; w.flattened) s += v; return cast(ubyte) ((s + 4) / 9); }); } /// One 8-bit plane, hand-written loops over the same `Slice` (rows indexed /// through the slice, columns through a plain array row). void
void images_mir_slice_algorithms.blurPlaneLoop(mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe

One 8-bit plane, hand-written loops over the same Slice (rows indexed through the slice, columns through a plain array row).

blurPlaneLoop
(Slice!(const(ubyte)*, 2)
(parameter) mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous) src
src
, Slice!(ubyte*, 2)
(parameter) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) dst
dst
) @safe pure nothrow @nogc
{ foreach (
(local variable) ulong y
y
; 1 ..
(parameter) mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous) src
src
.
ulong mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous).mir_slice.length!0LU() const pure nothrow @nogc @property scope @safe

Multidimensional length property.

@returnslength of the corresponding dimension@see.Slice.shape, .Slice.structure
length
!0 - 1)
{ const(ubyte)[]
(local variable) const(ubyte)[] r0
r0
=
(parameter) mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous) src
src
[
(local variable) ulong y
y
- 1].
const(ubyte)[] mir.ndslice.slice.Slice!(const(ubyte)*, 1LU, mir_slice_kind.contiguous).mir_slice.field!()() pure nothrow @nogc @property return scope @trusted

Field (array) data.

Constraints

Field is defined only for contiguous slices.

@returnsRaw data slice.
field
,
(local variable) const(ubyte)[] r1
r1
=
(parameter) mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous) src
src
[
(local variable) ulong y
y
].
const(ubyte)[] mir.ndslice.slice.Slice!(const(ubyte)*, 1LU, mir_slice_kind.contiguous).mir_slice.field!()() pure nothrow @nogc @property return scope @trusted

Field (array) data.

Constraints

Field is defined only for contiguous slices.

@returnsRaw data slice.
field
,
(local variable) const(ubyte)[] r2
r2
=
(parameter) mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous) src
src
[
(local variable) ulong y
y
+ 1].
const(ubyte)[] mir.ndslice.slice.Slice!(const(ubyte)*, 1LU, mir_slice_kind.contiguous).mir_slice.field!()() pure nothrow @nogc @property return scope @trusted

Field (array) data.

Constraints

Field is defined only for contiguous slices.

@returnsRaw data slice.
field
;
ubyte[]
(local variable) ubyte[] o
o
=
(parameter) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) dst
dst
[
(local variable) ulong y
y
].
ubyte[] mir.ndslice.slice.mir_slice!(ubyte*, 1LU, mir_slice_kind.contiguous).field!()() pure nothrow @nogc @property return scope @trusted

Field (array) data.

Constraints

Field is defined only for contiguous slices.

@returnsRaw data slice.
field
;
foreach (
(local variable) ulong x
x
; 1 ..
(parameter) mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous) src
src
.
ulong mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous).mir_slice.length!1LU() const pure nothrow @nogc @property scope @safe

Multidimensional length property.

@returnslength of the corresponding dimension@see.Slice.shape, .Slice.structure
length
!1 - 1)
{ const uint
(local variable) const(uint) s
s
=
(local variable) const(ubyte)[] r0
r0
[
(local variable) ulong x
x
- 1] +
(local variable) const(ubyte)[] r0
r0
[
(local variable) ulong x
x
] +
(local variable) const(ubyte)[] r0
r0
[
(local variable) ulong x
x
+ 1] +
(local variable) const(ubyte)[] r1
r1
[
(local variable) ulong x
x
- 1] +
(local variable) const(ubyte)[] r1
r1
[
(local variable) ulong x
x
] +
(local variable) const(ubyte)[] r1
r1
[
(local variable) ulong x
x
+ 1] +
(local variable) const(ubyte)[] r2
r2
[
(local variable) ulong x
x
- 1] +
(local variable) const(ubyte)[] r2
r2
[
(local variable) ulong x
x
]
+
(local variable) const(ubyte)[] r2
r2
[
(local variable) ulong x
x
+ 1];
(local variable) ubyte[] o
o
[
(local variable) ulong x
x
] = cast(ubyte) ((
(local variable) const(uint) s
s
+ 4) / 9);
} } } uint
uint images_mir_slice_algorithms.fnv1a!(mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous))(mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) s) pure nothrow @nogc @safe
fnv1a
(S)(
(alias) S = mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous)
S
(parameter) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) s
s
)
{ uint
(local variable) uint h
h
= 2_166_136_261;
foreach (
(local variable) ubyte b
b
;
(parameter) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) s
s
.
mir.ndslice.slice.mir_slice!(ubyte*, 1LU, mir_slice_kind.contiguous) mir.ndslice.topology.flattened!(ubyte*, 3LU)(mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) slice) pure nothrow @nogc @safe

A contiguous 1-dimensional slice of all elements of a slice. flattened iterates existing data. The order of elements is preserved.

flattened can be generalized with other selectors.

@paramslice slice to be iterated@returnscontiguous 1-dimensional slice of elements of the slice
flattened
)
{
(local variable) uint h
h
^=
(local variable) ubyte b
b
;
(local variable) uint h
h
*= 16_777_619;
} return
(local variable) uint h
h
;
} void
void D main() @safe
main
() @safe
{ // Interleaved storage, filled once; three views over it. auto
(local variable) ubyte[] bytes
bytes
= new ubyte[](
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
*
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
* 4);
foreach (
(local variable) ulong y
y
; 0 ..
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
)
foreach (
(local variable) ulong x
x
; 0 ..
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
)
foreach (
(local variable) int c
c
; 0 .. 4)
(local variable) ubyte[] bytes
bytes
[(
(local variable) ulong y
y
*
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
+
(local variable) ulong x
x
) * 4 +
(local variable) int c
c
] =
ubyte images_mir_slice_algorithms.sample(ulong y, ulong x, ulong c) pure nothrow @nogc @safe
sample
(
(local variable) ulong y
y
,
(local variable) ulong x
x
,
(local variable) int c
c
);
auto
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) img
img
= (cast(
(struct) images_mir_slice_algorithms.Rgba8
Rgba8
[])
(local variable) ubyte[] bytes
bytes
).
mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(2LU, images_mir_slice_algorithms.Rgba8[])(return scope images_mir_slice_algorithms.Rgba8[] iterator, ulong[2] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
);
auto
(local variable) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) imgV
imgV
= (cast(
(alias) images_mir_slice_algorithms.Px = sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])

sparkles.math's vector as the pixel: four packed ubytes, the same 4 bytes as Rgba8, with rgba swizzles from the default xyzw names.

Px
[])
(local variable) ubyte[] bytes
bytes
).
mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(2LU, sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])[])(return scope sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])[] iterator, ulong[2] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
);
auto
(local variable) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) img3
img3
=
(local variable) ubyte[] bytes
bytes
.
mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(3LU, ubyte[])(return scope ubyte[] iterator, ulong[3] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
, 4);
void std.stdio.writefln!(char, uint, images_mir_slice_algorithms.Rgba8, ubyte[4])(in char[] fmt, uint __param_1, images_mir_slice_algorithms.Rgba8 __param_2, ubyte[4] __param_3) @safe

Equivalent to writef(fmt, args, '\n').

writefln
("source fnv1a %08x img[1, 2] %s imgV[1, 2] %s",
uint images_mir_slice_algorithms.fnv1a!(mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous))(mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) s) pure nothrow @nogc @safe
fnv1a
(
(local variable) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) img3
img3
),
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) img
img
[1, 2],
(local variable) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) imgV
imgV
[1, 2].
ubyte[4] sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]).array() const pure nothrow @nogc @safe

The components, as a static array.

array
);
// Per-pixel map. auto
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) pm
pm
= new
(struct) images_mir_slice_algorithms.Rgba8
Rgba8
[](
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
*
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
).
mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(2LU, images_mir_slice_algorithms.Rgba8[])(return scope images_mir_slice_algorithms.Rgba8[] iterator, ulong[2] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
);
auto
(local variable) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) pmV
pmV
= new
(alias) images_mir_slice_algorithms.Px = sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])

sparkles.math's vector as the pixel: four packed ubytes, the same 4 bytes as Rgba8, with rgba swizzles from the default xyzw names.

Px
[](
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
*
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
).
mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(2LU, sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])[])(return scope sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])[] iterator, ulong[2] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
);
void images_mir_slice_algorithms.premultiplyInto(mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe

The map is lazy (src`.map!premultiply` is a view); assigning it to dst[] runs it. No allocation, no copy of src.

premultiplyInto
(
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) img
img
,
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) pm
pm
);
void images_mir_slice_algorithms.premultiplyVecInto(mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe
premultiplyVecInto
(
(local variable) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) imgV
imgV
,
(local variable) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) pmV
pmV
);
auto
(local variable) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) pmBytes
pmBytes
= (cast(ubyte[])
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) pm
pm
.
images_mir_slice_algorithms.Rgba8[] mir.ndslice.slice.Slice!(images_mir_slice_algorithms.Rgba8*, 2LU, mir_slice_kind.contiguous).mir_slice.field!()() pure nothrow @nogc @property return scope @trusted

Field (array) data.

Constraints

Field is defined only for contiguous slices.

@returnsRaw data slice.
field
).
mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(3LU, ubyte[])(return scope ubyte[] iterator, ulong[3] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
, 4);
auto
(local variable) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) pmVBytes
pmVBytes
= (cast(ubyte[])
(local variable) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) pmV
pmV
.
sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])[] mir.ndslice.slice.Slice!(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous).mir_slice.field!()() pure nothrow @nogc @property return scope @trusted

Field (array) data.

Constraints

Field is defined only for contiguous slices.

@returnsRaw data slice.
field
).
mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(3LU, ubyte[])(return scope ubyte[] iterator, ulong[3] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
, 4);
void std.stdio.writefln!(char, uint, bool, images_mir_slice_algorithms.Rgba8)(in char[] fmt, uint __param_1, bool __param_2, images_mir_slice_algorithms.Rgba8 __param_3) @safe

Equivalent to writef(fmt, args, '\n').

writefln
("premultiplied fnv1a %08x struct == Vector: %s pm[1, 2] %s",
uint images_mir_slice_algorithms.fnv1a!(mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous))(mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) s) pure nothrow @nogc @safe
fnv1a
(
(local variable) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) pmBytes
pmBytes
),
(local variable) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) pmBytes
pmBytes
==
bool mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous).mir_slice.opEquals!(ubyte*, mir_slice_kind.contiguous)(ref const(mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous)) rslice) const pure nothrow @nogc scope @trusted
pmVBytes
,
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) pm
pm
[1, 2]);
// 3x3 box blur, border copied from the source. auto
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) bl
bl
= new
(struct) images_mir_slice_algorithms.Rgba8
Rgba8
[](
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
*
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
).
mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(2LU, images_mir_slice_algorithms.Rgba8[])(return scope images_mir_slice_algorithms.Rgba8[] iterator, ulong[2] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
);
auto
(local variable) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) blV
blV
= new
(alias) images_mir_slice_algorithms.Px = sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])

sparkles.math's vector as the pixel: four packed ubytes, the same 4 bytes as Rgba8, with rgba swizzles from the default xyzw names.

Px
[](
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
*
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
).
mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(2LU, sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])[])(return scope sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])[] iterator, ulong[2] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
);
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) bl
bl
[] =
void mir.ndslice.slice.Slice!(images_mir_slice_algorithms.Rgba8*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(images_mir_slice_algorithms.Rgba8*, 2LU, mir_slice_kind.contiguous)(mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) value) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

img
;
(local variable) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) blV
blV
[] =
void mir.ndslice.slice.Slice!(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous)(mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) value) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

imgV
;
void images_mir_slice_algorithms.boxBlurInto(mir.ndslice.slice.Slice!(const(Rgba8)*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe

The blur writes the interior: windows(3, 3) has (h - 2) x (w - 2) windows, one per interior pixel, each a 3x3 view of src.

boxBlurInto
(
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) img
img
,
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) bl
bl
);
void images_mir_slice_algorithms.boxBlurVecInto(mir.ndslice.slice.Slice!(const(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"]))*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe
boxBlurVecInto
(
(local variable) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) imgV
imgV
,
(local variable) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) blV
blV
);
auto
(local variable) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) blBytes
blBytes
= (cast(ubyte[])
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) bl
bl
.
images_mir_slice_algorithms.Rgba8[] mir.ndslice.slice.Slice!(images_mir_slice_algorithms.Rgba8*, 2LU, mir_slice_kind.contiguous).mir_slice.field!()() pure nothrow @nogc @property return scope @trusted

Field (array) data.

Constraints

Field is defined only for contiguous slices.

@returnsRaw data slice.
field
).
mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(3LU, ubyte[])(return scope ubyte[] iterator, ulong[3] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
, 4);
auto
(local variable) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) blVBytes
blVBytes
= (cast(ubyte[])
(local variable) mir.ndslice.slice.Slice!(Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous) blV
blV
.
sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])[] mir.ndslice.slice.Slice!(sparkles.math.vector.Vector!(ubyte, 4LU, Layout.packed, ["x", "y", "z", "w"])*, 2LU, mir_slice_kind.contiguous).mir_slice.field!()() pure nothrow @nogc @property return scope @trusted

Field (array) data.

Constraints

Field is defined only for contiguous slices.

@returnsRaw data slice.
field
).
mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(3LU, ubyte[])(return scope ubyte[] iterator, ulong[3] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
, 4);
void std.stdio.writefln!(char, uint, bool, images_mir_slice_algorithms.Rgba8)(in char[] fmt, uint __param_1, bool __param_2, images_mir_slice_algorithms.Rgba8 __param_3) @safe

Equivalent to writef(fmt, args, '\n').

writefln
("box blur fnv1a %08x struct == Vector: %s bl[2, 3] %s",
uint images_mir_slice_algorithms.fnv1a!(mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous))(mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) s) pure nothrow @nogc @safe
fnv1a
(
(local variable) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) blBytes
blBytes
),
(local variable) mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous) blBytes
blBytes
==
bool mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous).mir_slice.opEquals!(ubyte*, mir_slice_kind.contiguous)(ref const(mir.ndslice.slice.Slice!(ubyte*, 3LU, mir_slice_kind.contiguous)) rslice) const pure nothrow @nogc scope @trusted
blVBytes
,
(local variable) mir.ndslice.slice.Slice!(Rgba8*, 2LU, mir_slice_kind.contiguous) bl
bl
[2, 3]);
// One plane (the red channel, copied out contiguous), both blur forms. auto
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) red
red
= new ubyte[](
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
*
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
).
mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(2LU, ubyte[])(return scope ubyte[] iterator, ulong[2] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
);
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) red
red
[] =
void mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(ubyte*, 2LU, mir_slice_kind.universal)(mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.universal) value) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

img3
[0 .. $, 0 .. $, 0];
auto
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) a
a
= new ubyte[](
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
*
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
).
mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(2LU, ubyte[])(return scope ubyte[] iterator, ulong[2] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
);
auto
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) b
b
= new ubyte[](
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
*
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
).
mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) mir.ndslice.slice.sliced!(2LU, ubyte[])(return scope ubyte[] iterator, ulong[2] lengths...) pure nothrow @nogc @safe

Creates an n-dimensional slice-shell over an iterator.

Examples

Random access range primitives for slices over user defined types

struct MyIota
{
    //`[index]` operator overloading
    auto opIndex(size_t index) @safe nothrow
    {
        return index;
    }

    auto lightConst()() const @property { return MyIota(); }
    auto lightImmutable()() immutable @property { return MyIota(); }
}

import mir.ndslice.iterator: FieldIterator;
alias Iterator = FieldIterator!MyIota;
alias S = Slice!(Iterator, 2);
import std.range.primitives;
static assert(hasLength!S);
static assert(hasSlicing!S);
static assert(isRandomAccessRange!S);

auto slice = Iterator().sliced(20, 10);
assert(slice[1, 2] == 12);
auto sCopy = slice.save;
assert(slice[1, 2] == 12);
@paramiterator An iterator, a pointer, or an array.@paramlengths A list of lengths for each dimension@returnsn-dimensional slice
sliced
(
(constant) ulong images_mir_slice_algorithms.height = 6LU
height
,
(constant) ulong images_mir_slice_algorithms.width = 8LU
width
);
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) a
a
[] =
void mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(ubyte*, 2LU, mir_slice_kind.contiguous)(mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) value) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

red
;
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) b
b
[] =
void mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous).mir_slice.opIndexAssign!(ubyte*, 2LU, mir_slice_kind.contiguous)(mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) value) pure nothrow @nogc scope @safe

Assignment of a value of Slice type to a fully defined slice.

red
;
void images_mir_slice_algorithms.blurPlaneMir(mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe

One 8-bit plane, windows form: the kernel the generated-code section reads.

blurPlaneMir
(
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) red
red
,
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) a
a
);
void images_mir_slice_algorithms.blurPlaneLoop(mir.ndslice.slice.Slice!(const(ubyte)*, 2LU, mir_slice_kind.contiguous) src, mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) dst) pure nothrow @nogc @safe

One 8-bit plane, hand-written loops over the same Slice (rows indexed through the slice, columns through a plain array row).

blurPlaneLoop
(
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) red
red
,
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) b
b
);
void std.stdio.writefln!(char, uint, bool, bool)(in char[] fmt, uint __param_1, bool __param_2, bool __param_3) @safe

Equivalent to writef(fmt, args, '\n').

writefln
("plane blur fnv1a %08x windows == loop: %s red-channel of RGBA blur agrees: %s",
uint images_mir_slice_algorithms.fnv1a!(mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous))(mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) s) pure nothrow @nogc @safe
fnv1a
(
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) a
a
),
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) a
a
==
bool mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous).mir_slice.opEquals!(ubyte*, mir_slice_kind.contiguous)(ref const(mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous)) rslice) const pure nothrow @nogc scope @trusted
b
,
(local variable) mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous) a
a
==
bool mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.contiguous).mir_slice.opEquals!(ubyte*, mir_slice_kind.universal)(const(mir.ndslice.slice.Slice!(ubyte*, 2LU, mir_slice_kind.universal)) rslice) const pure nothrow @nogc scope @trusted
blBytes
[0 .. $, 0 .. $, 0]);
}