MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_anisotropic_diffusion

Function af_anisotropic_diffusion

src/api/c/anisotropic_diffusion.cpp:61–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61af_err af_anisotropic_diffusion(af_array* out, const af_array in,
62 const float dt, const float K,
63 const unsigned iterations,
64 const af_flux_function fftype,
65 const af_diffusion_eq eq) {
66 try {
67 const ArrayInfo& info = getInfo(in);
68
69 const af::dim4& inputDimensions = info.dims();
70 const af_dtype inputType = info.getType();
71 const unsigned inputNumDims = inputDimensions.ndims();
72
73 DIM_ASSERT(1, (inputNumDims >= 2));
74
75 ARG_ASSERT(3, (K > 0 || K < 0));
76 ARG_ASSERT(4, (iterations > 0));
77
78 const af_flux_function F =
79 (fftype == AF_FLUX_DEFAULT ? AF_FLUX_EXPONENTIAL : fftype);
80
81 auto input = castArray<float>(in);
82
83 af_array output = nullptr;
84 switch (inputType) {
85 case f64:
86 output = diffusion<double>(input, dt, K, iterations, F, eq);
87 break;
88 case f32:
89 case s32:
90 case u32:
91 case s16:
92 case u16:
93 case s8:
94 case u8:
95 output = diffusion<float>(input, dt, K, iterations, F, eq);
96 break;
97 default: TYPE_ERROR(1, inputType);
98 }
99 std::swap(*out, output);
100 }
101 CATCHALL;
102
103 return AF_SUCCESS;
104}

Callers 1

anisotropicDiffusionFunction · 0.50

Calls 4

swapFunction · 0.85
dimsMethod · 0.45
getTypeMethod · 0.45
ndimsMethod · 0.45

Tested by

no test coverage detected