libblur 0.10.7

High performance blur in pure rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
// Copyright (c) Radzivon Bartoshyk. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// 1.  Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2.  Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3.  Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use crate::fast_gaussian_next_f16::fast_gaussian_next_f16;
use crate::fast_gaussian_next_f32::fast_gaussian_next_f32;
#[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
use crate::fast_gaussian_next_neon::neon_support;
#[cfg(all(
    any(target_arch = "x86_64", target_arch = "x86"),
    target_feature = "sse4.1"
))]
use crate::fast_gaussian_next_sse::sse_support;
use crate::unsafe_slice::UnsafeSlice;
use crate::{FastBlurChannels, ThreadingPolicy};
use num_traits::FromPrimitive;

fn fast_gaussian_next_vertical_pass<
    T: FromPrimitive + Default + Into<i32>,
    const CHANNEL_CONFIGURATION: usize,
>(
    bytes: &UnsafeSlice<T>,
    stride: u32,
    width: u32,
    height: u32,
    radius: u32,
    start: u32,
    end: u32,
) where
    T: std::ops::AddAssign + std::ops::SubAssign + Copy,
{
    if std::any::type_name::<T>() == "u8" {
        #[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
        {
            let slice: &UnsafeSlice<'_, u8> = unsafe { std::mem::transmute(bytes) };
            neon_support::fast_gaussian_next_vertical_pass_neon_u8::<CHANNEL_CONFIGURATION>(
                slice, stride, width, height, radius, start, end,
            );
            return;
        }
        #[cfg(all(
            any(target_arch = "x86_64", target_arch = "x86"),
            target_feature = "sse4.1"
        ))]
        {
            let slice: &UnsafeSlice<'_, u8> = unsafe { std::mem::transmute(bytes) };
            sse_support::fast_gaussian_next_vertical_pass_sse_u8::<CHANNEL_CONFIGURATION>(
                slice, stride, width, height, radius, start, end,
            );
            return;
        }
    }
    let mut buffer_r: [i32; 1024] = [0; 1024];
    let mut buffer_g: [i32; 1024] = [0; 1024];
    let mut buffer_b: [i32; 1024] = [0; 1024];
    let mut buffer_a: [i32; 1024] = [0; 1024];
    let radius_64 = radius as i64;
    let height_wide = height as i64;
    let weight = 1.0f32 / ((radius as f32) * (radius as f32) * (radius as f32));
    for x in start..std::cmp::min(width, end) {
        let mut dif_r: i32 = 0;
        let mut der_r: i32 = 0;
        let mut sum_r: i32 = 0;
        let mut dif_g: i32 = 0;
        let mut der_g: i32 = 0;
        let mut sum_g: i32 = 0;
        let mut dif_b: i32 = 0;
        let mut der_b: i32 = 0;
        let mut sum_b: i32 = 0;
        let mut dif_a: i32 = 0;
        let mut der_a: i32 = 0;
        let mut sum_a: i32 = 0;

        let current_px = (x * CHANNEL_CONFIGURATION as u32) as usize;

        let start_y = 0 - 3 * radius as i64;
        for y in start_y..height_wide {
            let current_y = (y * (stride as i64)) as usize;
            if y >= 0 {
                let new_r = T::from_u32(((sum_r as f32) * weight) as u32).unwrap_or_default();
                let new_g = T::from_u32(((sum_g as f32) * weight) as u32).unwrap_or_default();
                let new_b = T::from_u32(((sum_b as f32) * weight) as u32).unwrap_or_default();

                let bytes_offset = current_y + current_px;

                unsafe {
                    bytes.write(bytes_offset, new_r);
                    bytes.write(bytes_offset + 1, new_g);
                    bytes.write(bytes_offset + 2, new_b);
                    if CHANNEL_CONFIGURATION == 4 {
                        let new_a =
                            T::from_u32(((sum_a as f32) * weight) as u32).unwrap_or_default();
                        bytes.write(bytes_offset + 3, new_a);
                    }
                }

                let d_arr_index_1 = ((y + radius_64) & 1023) as usize;
                let d_arr_index_2 = ((y - radius_64) & 1023) as usize;
                let d_arr_index = (y & 1023) as usize;
                dif_r += 3
                    * (unsafe { buffer_r.get_unchecked(d_arr_index) }
                        - unsafe { *buffer_r.get_unchecked(d_arr_index_1) })
                    - unsafe { *buffer_r.get_unchecked(d_arr_index_2) };
                dif_g += 3
                    * (unsafe { *buffer_g.get_unchecked(d_arr_index) }
                        - unsafe { *buffer_g.get_unchecked(d_arr_index_1) })
                    - unsafe { *buffer_g.get_unchecked(d_arr_index_2) };
                dif_b += 3
                    * (unsafe { *buffer_b.get_unchecked(d_arr_index) }
                        - unsafe { *buffer_b.get_unchecked(d_arr_index_1) })
                    - unsafe { *buffer_b.get_unchecked(d_arr_index_2) };
                if CHANNEL_CONFIGURATION == 4 {
                    dif_a += 3
                        * (unsafe { *buffer_a.get_unchecked(d_arr_index) }
                        - unsafe { *buffer_a.get_unchecked(d_arr_index_1) })
                        - unsafe { *buffer_a.get_unchecked(d_arr_index_2) };
                }
            } else if y + radius_64 >= 0 {
                let arr_index = (y & 1023) as usize;
                let arr_index_1 = ((y + radius_64) & 1023) as usize;
                dif_r += 3
                    * (unsafe { *buffer_r.get_unchecked(arr_index) }
                        - unsafe { *buffer_r.get_unchecked(arr_index_1) });
                dif_g += 3
                    * (unsafe { *buffer_g.get_unchecked(arr_index) }
                        - unsafe { *buffer_g.get_unchecked(arr_index_1) });
                dif_b += 3
                    * (unsafe { *buffer_b.get_unchecked(arr_index) }
                        - unsafe { *buffer_b.get_unchecked(arr_index_1) });
                if CHANNEL_CONFIGURATION == 4 {
                    dif_a += 3
                        * (unsafe { *buffer_a.get_unchecked(arr_index) }
                        - unsafe { *buffer_a.get_unchecked(arr_index_1) });
                }
            } else if y + 2 * radius_64 >= 0 {
                let arr_index = ((y + radius_64) & 1023) as usize;
                dif_r -= 3 * unsafe { *buffer_r.get_unchecked(arr_index) };
                dif_g -= 3 * unsafe { *buffer_g.get_unchecked(arr_index) };
                dif_b -= 3 * unsafe { *buffer_b.get_unchecked(arr_index) };
                if CHANNEL_CONFIGURATION == 4 {
                    dif_a -= 3 * unsafe { *buffer_a.get_unchecked(arr_index) };
                }
            }

            let next_row_y = (std::cmp::min(
                std::cmp::max(y + ((3 * radius_64) >> 1), 0),
                height_wide - 1,
            ) as usize)
                * (stride as usize);
            let next_row_x = (x * CHANNEL_CONFIGURATION as u32) as usize;

            let px_idx = next_row_y + next_row_x;

            let ur8 = bytes[px_idx];
            let ug8 = bytes[px_idx + 1];
            let ub8 = bytes[px_idx + 2];

            let arr_index = ((y + 2 * radius_64) & 1023) as usize;

            dif_r += ur8.into();
            der_r += dif_r;
            sum_r += der_r;
            unsafe {
                *buffer_r.get_unchecked_mut(arr_index) = ur8.into();
            }

            dif_g += ug8.into();
            der_g += dif_g;
            sum_g += der_g;
            unsafe {
                *buffer_g.get_unchecked_mut(arr_index) = ug8.into();
            }

            dif_b += ub8.into();
            der_b += dif_b;
            sum_b += der_b;
            unsafe {
                *buffer_b.get_unchecked_mut(arr_index) = ub8.into();
            }

            if CHANNEL_CONFIGURATION == 4 {
                let ua8 = bytes[px_idx + 3];

                dif_a += ua8.into();
                der_a += dif_a;
                sum_a += der_a;
                unsafe {
                    *buffer_a.get_unchecked_mut(arr_index) = ua8.into();
                }
            }
        }
    }
}

fn fast_gaussian_next_horizontal_pass<
    T: FromPrimitive + Default + Into<i32> + Send + Sync,
    const CHANNEL_CONFIGURATION: usize,
>(
    bytes: &UnsafeSlice<T>,
    stride: u32,
    width: u32,
    height: u32,
    radius: u32,
    start: u32,
    end: u32,
) where
    T: std::ops::AddAssign + std::ops::SubAssign + Copy,
{
    if std::any::type_name::<T>() == "u8" {
        #[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
        {
            let slice: &UnsafeSlice<'_, u8> = unsafe { std::mem::transmute(bytes) };
            neon_support::fast_gaussian_next_horizontal_pass_neon_u8::<CHANNEL_CONFIGURATION>(
                slice, stride, width, height, radius, start, end,
            );
            return;
        }
        #[cfg(all(
            any(target_arch = "x86_64", target_arch = "x86"),
            target_feature = "sse4.1"
        ))]
        {
            let slice: &UnsafeSlice<'_, u8> = unsafe { std::mem::transmute(bytes) };
            sse_support::fast_gaussian_next_horizontal_pass_sse_u8::<CHANNEL_CONFIGURATION>(
                slice, stride, width, height, radius, start, end,
            );
            return;
        }
    }
    let mut buffer_r: [i32; 1024] = [0; 1024];
    let mut buffer_g: [i32; 1024] = [0; 1024];
    let mut buffer_b: [i32; 1024] = [0; 1024];
    let mut buffer_a: [i32; 1024] = [0; 1024];
    let radius_64 = radius as i64;
    let width_wide = width as i64;
    let weight = 1.0f32 / ((radius as f32) * (radius as f32) * (radius as f32));
    for y in start..std::cmp::min(height, end) {
        let mut dif_r: i32 = 0;
        let mut der_r: i32 = 0;
        let mut sum_r: i32 = 0;
        let mut dif_g: i32 = 0;
        let mut der_g: i32 = 0;
        let mut sum_g: i32 = 0;
        let mut dif_b: i32 = 0;
        let mut der_b: i32 = 0;
        let mut sum_b: i32 = 0;
        let mut dif_a: i32 = 0;
        let mut der_a: i32 = 0;
        let mut sum_a: i32 = 0;

        let current_y = ((y as i64) * (stride as i64)) as usize;

        for x in (0 - 3 * radius_64)..(width as i64) {
            if x >= 0 {
                let current_px =
                    ((std::cmp::max(x, 0) as u32) * CHANNEL_CONFIGURATION as u32) as usize;
                let new_r = T::from_u32(((sum_r as f32) * weight) as u32).unwrap_or_default();
                let new_g = T::from_u32(((sum_g as f32) * weight) as u32).unwrap_or_default();
                let new_b = T::from_u32(((sum_b as f32) * weight) as u32).unwrap_or_default();

                let bytes_offset = current_y + current_px;

                unsafe {
                    bytes.write(bytes_offset, new_r);
                    bytes.write(bytes_offset + 1, new_g);
                    bytes.write(bytes_offset + 2, new_b);
                    if CHANNEL_CONFIGURATION == 4 {
                        let new_a =
                            T::from_u32(((sum_a as f32) * weight) as u32).unwrap_or_default();
                        bytes.write(bytes_offset + 3, new_a);
                    }
                }

                let d_arr_index_1 = ((x + radius_64) & 1023) as usize;
                let d_arr_index_2 = ((x - radius_64) & 1023) as usize;
                let d_arr_index = (x & 1023) as usize;
                dif_r += 3
                    * (unsafe { *buffer_r.get_unchecked(d_arr_index) }
                        - unsafe { *buffer_r.get_unchecked(d_arr_index_1) })
                    - unsafe { *buffer_r.get_unchecked(d_arr_index_2) };
                dif_g += 3
                    * (unsafe { *buffer_g.get_unchecked(d_arr_index) }
                        - unsafe { *buffer_g.get_unchecked(d_arr_index_1) })
                    - unsafe { *buffer_g.get_unchecked(d_arr_index_2) };
                dif_b += 3
                    * (unsafe { *buffer_b.get_unchecked(d_arr_index) }
                        - unsafe { *buffer_b.get_unchecked(d_arr_index_1) })
                    - unsafe { *buffer_b.get_unchecked(d_arr_index_2) };
                if CHANNEL_CONFIGURATION == 4 {
                    dif_a += 3
                        * (unsafe { *buffer_a.get_unchecked(d_arr_index) }
                            - unsafe { *buffer_a.get_unchecked(d_arr_index_1) })
                        - unsafe { *buffer_a.get_unchecked(d_arr_index_2) };
                }
            } else if x + radius_64 >= 0 {
                let arr_index = (x & 1023) as usize;
                let arr_index_1 = ((x + radius_64) & 1023) as usize;
                dif_r += 3
                    * (unsafe { *buffer_r.get_unchecked(arr_index) }
                        - unsafe { *buffer_r.get_unchecked(arr_index_1) });
                dif_g += 3
                    * (unsafe { *buffer_g.get_unchecked(arr_index) }
                        - unsafe { *buffer_g.get_unchecked(arr_index_1) });
                dif_b += 3
                    * (unsafe { *buffer_b.get_unchecked(arr_index) }
                        - unsafe { *buffer_b.get_unchecked(arr_index_1) });
                if CHANNEL_CONFIGURATION == 4 {
                    dif_a += 3
                        * (unsafe { *buffer_a.get_unchecked(arr_index) }
                            - unsafe { *buffer_a.get_unchecked(arr_index_1) });
                }
            } else if x + 2 * radius_64 >= 0 {
                let arr_index = ((x + radius_64) & 1023) as usize;
                dif_r -= 3 * unsafe { buffer_r.get_unchecked(arr_index) };
                dif_g -= 3 * unsafe { buffer_g.get_unchecked(arr_index) };
                dif_b -= 3 * unsafe { buffer_b.get_unchecked(arr_index) };
                if CHANNEL_CONFIGURATION == 4 {
                    dif_a -= 3 * unsafe { buffer_a.get_unchecked(arr_index) };
                }
            }

            let next_row_y = (y as usize) * (stride as usize);
            let next_row_x =
                ((std::cmp::min(std::cmp::max(x + 3 * radius_64 / 2, 0), width_wide - 1) as u32)
                    * CHANNEL_CONFIGURATION as u32) as usize;

            let bytes_offset = next_row_y + next_row_x;

            let ur8 = bytes[bytes_offset];
            let ug8 = bytes[bytes_offset + 1];
            let ub8 = bytes[bytes_offset + 2];

            let arr_index = ((x + 2 * radius_64) & 1023) as usize;

            dif_r += ur8.into();
            der_r += dif_r;
            sum_r += der_r;
            unsafe {
                *buffer_r.get_unchecked_mut(arr_index) = ur8.into();
            }

            dif_g += ug8.into();
            der_g += dif_g;
            sum_g += der_g;
            unsafe {
                *buffer_g.get_unchecked_mut(arr_index) = ug8.into();
            }

            dif_b += ub8.into();
            der_b += dif_b;
            sum_b += der_b;
            unsafe {
                *buffer_b.get_unchecked_mut(arr_index) = ub8.into();
            }

            if CHANNEL_CONFIGURATION == 4 {
                let ua8 = bytes[bytes_offset + 3];
                dif_a += ua8.into();
                der_a += dif_a;
                sum_a += der_a;
                unsafe {
                    *buffer_a.get_unchecked_mut(arr_index) = ua8.into();
                }
            }
        }
    }
}

fn fast_gaussian_next_impl<
    T: FromPrimitive + Default + Into<i32> + Send + Sync,
    const CHANNEL_CONFIGURATION: usize,
>(
    bytes: &mut [T],
    stride: u32,
    width: u32,
    height: u32,
    radius: u32,
    threading_policy: ThreadingPolicy,
) where
    T: std::ops::AddAssign + std::ops::SubAssign + Copy,
{
    let thread_count = threading_policy.get_threads_count(width, height) as u32;
    let pool = rayon::ThreadPoolBuilder::new()
        .num_threads(thread_count as usize)
        .build()
        .unwrap();

    let unsafe_image = UnsafeSlice::new(bytes);
    pool.scope(|scope| {
        let segment_size = width / thread_count;

        for i in 0..thread_count {
            let start_x = i * segment_size;
            let mut end_x = (i + 1) * segment_size;
            if i == thread_count - 1 {
                end_x = width;
            }
            scope.spawn(move |_| {
                fast_gaussian_next_vertical_pass::<T, CHANNEL_CONFIGURATION>(
                    &unsafe_image,
                    stride,
                    width,
                    height,
                    radius,
                    start_x,
                    end_x,
                );
            });
        }
    });

    pool.scope(|scope| {
        let segment_size = height / thread_count;

        for i in 0..thread_count {
            let start_y = i * segment_size;
            let mut end_y = (i + 1) * segment_size;
            if i == thread_count - 1 {
                end_y = height;
            }
            scope.spawn(move |_| {
                fast_gaussian_next_horizontal_pass::<T, CHANNEL_CONFIGURATION>(
                    &unsafe_image,
                    stride,
                    width,
                    height,
                    radius,
                    start_y,
                    end_y,
                );
            });
        }
    });
}

/// Fast gaussian approximation.
/// Results are better than not next and looks awesome.
/// * `stride` - Lane length, default is width * channels_count if not aligned
/// * `radius` - Radius more than ~152 is not supported. To use larger radius convert image to f32 and use function for f32
/// O(1) complexity.
#[no_mangle]
#[allow(dead_code)]
pub fn fast_gaussian_next(
    bytes: &mut [u8],
    stride: u32,
    width: u32,
    height: u32,
    radius: u32,
    channels: FastBlurChannels,
    threading_policy: ThreadingPolicy,
) {
    let acq_radius = std::cmp::min(radius, 212);
    match channels {
        FastBlurChannels::Channels3 => {
            fast_gaussian_next_impl::<u8, 3>(
                bytes,
                stride,
                width,
                height,
                acq_radius,
                threading_policy,
            );
        }
        FastBlurChannels::Channels4 => {
            fast_gaussian_next_impl::<u8, 4>(
                bytes,
                stride,
                width,
                height,
                acq_radius,
                threading_policy,
            );
        }
    }
}

/// Fast gaussian approximation.
/// Results are better than not next and looks awesome.
/// * `stride` - Lane length, default is width * channels_count if not aligned
/// * `radius` - Radius more than ~152 is not supported. To use larger radius convert image to f32 and use function for f32
/// O(1) complexity.
#[no_mangle]
#[allow(dead_code)]
pub fn fast_gaussian_next_u16(
    bytes: &mut [u16],
    stride: u32,
    width: u32,
    height: u32,
    radius: u32,
    channels: FastBlurChannels,
    threading_policy: ThreadingPolicy,
) {
    let acq_radius = std::cmp::min(radius, 152);
    match channels {
        FastBlurChannels::Channels3 => {
            fast_gaussian_next_impl::<u16, 3>(
                bytes,
                stride,
                width,
                height,
                acq_radius,
                threading_policy,
            );
        }
        FastBlurChannels::Channels4 => {
            fast_gaussian_next_impl::<u16, 4>(
                bytes,
                stride,
                width,
                height,
                acq_radius,
                threading_policy,
            );
        }
    }
}

/// Fast gaussian approximation.
/// Results are better than not next and looks awesome.
/// * `stride` - Lane length, default is width * channels_count if not aligned
/// * `radius` - Almost any radius is supported, in real world radius > 300 is too big for this implementation
/// O(1) complexity.
#[no_mangle]
#[allow(dead_code)]
pub fn fast_gaussian_next_f32(
    bytes: &mut [f32],
    stride: u32,
    width: u32,
    height: u32,
    radius: u32,
    channels: FastBlurChannels,
) {
    fast_gaussian_next_f32::fast_gaussian_next_impl_f32(
        bytes, stride, width, height, radius, channels,
    );
}

/// Fast gaussian approximation.
/// Results are better than not next and looks awesome.
/// * `stride` - Lane length, default is width * channels_count if not aligned
/// * `radius` - Almost any radius is supported, in real world radius > 300 is too big for this implementation
/// O(1) complexity.
#[no_mangle]
#[allow(dead_code)]
pub fn fast_gaussian_next_f16(
    bytes: &mut [u16],
    stride: u32,
    width: u32,
    height: u32,
    radius: u32,
    channels: FastBlurChannels,
) {
    fast_gaussian_next_f16::fast_gaussian_next_impl_f16(
        bytes, stride, width, height, radius, channels,
    );
}