257 {
260
261
262 for (fl::size j = 0; j <
height + 2; ++j) {
266 } else {
269 }
270 }
271
272
273 for (fl::size i = 0; i <
width + 2; ++i) {
276 }
277
278 i32 mCourantSq32 =
static_cast<i32
>(
mCourantSq);
279
280
281
282
284
285
286
287
288
289
290
291
292
293
294
295
296
298 for (fl::size j = 1; j <=
height; ++j) {
299 const fl::size row = j *
stride;
304 for (fl::size i = 1; i <=
width; ++i) {
305 const i32 c = row_curr[i];
306 i32 laplacian;
307 if (nine_point) {
308
309
310
311
312
313 const i32 diag = (i32)row_above[i - 1] + row_above[i + 1] +
314 row_below[i - 1] + row_below[i + 1];
315 const i32 nbr = (i32)row_above[i] + row_below[i] +
316 row_curr[i - 1] + row_curr[i + 1];
317 laplacian = diag + (nbr << 2) - 20 * c;
318 } else {
319
320 laplacian = (i32)row_curr[i + 1] + row_curr[i - 1] +
321 row_above[i] + row_below[i] - (c << 2);
322 }
323
324
325
326
327
328 i64 product =
static_cast<i64>(mCourantSq32) * laplacian;
329 i32 term;
330 if (nine_point) {
331
332
333
334
335
336 term = static_cast<i32>((product >> 15) / 6);
337 } else {
338 term = static_cast<i32>(product >> 15);
339 }
340
341 i32 f = -(i32)row_next[i] + (c << 1) + term;
342
343
344
345 f = static_cast<i32>(
347
348
349
350 row_next[i] =
static_cast<i16
>(
fl::clamp(f, q15_min,
static_cast<i32
>(32767)));
351 }
352 }
353
354
356}
fl::vector_psram< i16 > grid1
LaplacianStencil mStencil
fl::vector_psram< i16 > grid2
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NOEXCEPT
#define FL_RESTRICT_PARAM