summaryrefslogtreecommitdiff
path: root/src/pulsecore/remap_neon.c
blob: ebacf922fd56f8882adbfdf4af01deddd7a5f0f0 (plain)
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
/***
  This file is part of PulseAudio.

  Copyright 2013 Peter Meerwald <p.meerwald@bct-electronic.com>

  PulseAudio is free software; you can redistribute it and/or modify
  it under the terms of the GNU Lesser General Public License as published
  by the Free Software Foundation; either version 2.1 of the License,
  or (at your option) any later version.

  PulseAudio is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  General Public License for more details.
***/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <pulse/sample.h>
#include <pulse/xmalloc.h>
#include <pulsecore/log.h>
#include <pulsecore/macro.h>

#include "cpu-arm.h"
#include "remap.h"

#include <arm_neon.h>

static void remap_mono_to_stereo_float32ne_neon_a8(pa_remap_t *m, float *dst, const float *src, unsigned n) {
    for (; n >= 4; n -= 4) {
        __asm__ __volatile__ (
            "vld1.32    {q0}, [%[src]]!         \n\t"
            "vmov       q1, q0                  \n\t"
            "vst2.32    {q0,q1}, [%[dst]]!      \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : /* input operands */
            : "memory", "q0", "q1" /* clobber list */
        );
    }

    for (; n > 0; n--) {
        dst[0] = dst[1] = src[0];
        src++;
        dst += 2;
    }
}

static void remap_mono_to_stereo_float32ne_generic_arm(pa_remap_t *m, float *dst, const float *src, unsigned n) {
    for (; n >= 2; n -= 2) {
        __asm__ __volatile__ (
            "ldm        %[src]!, {r4,r6}        \n\t"
            "mov        r5, r4                  \n\t"
            "mov        r7, r6                  \n\t"
            "stm        %[dst]!, {r4-r7}        \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : /* input operands */
            : "memory", "r4", "r5", "r6", "r7" /* clobber list */
        );
    }

    if (n > 0)
        dst[0] = dst[1] = src[0];
}

static void remap_mono_to_stereo_s16ne_neon(pa_remap_t *m, int16_t *dst, const int16_t *src, unsigned n) {
    for (; n >= 8; n -= 8) {
        __asm__ __volatile__ (
            "vld1.16    {q0}, [%[src]]!         \n\t"
            "vmov       q1, q0                  \n\t"
            "vst2.16    {q0,q1}, [%[dst]]!      \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : /* input operands */
            : "memory", "q0", "q1" /* clobber list */
        );
    }

    for (; n > 0; n--) {
        dst[0] = dst[1] = src[0];
        src++;
        dst += 2;
    }
}

static void remap_mono_to_ch4_float32ne_neon(pa_remap_t *m, float *dst, const float *src, unsigned n) {
    for (; n >= 2; n -= 2) {
        __asm__ __volatile__ (
            "vld1.32    {d0}, [%[src]]!         \n\t"
            "vdup.f32   q1, d0[0]               \n\t"
            "vdup.f32   q2, d0[1]               \n\t"
            "vst1.32    {q1,q2}, [%[dst]]!      \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : /* input operands */
            : "memory", "q0", "q1", "q2" /* clobber list */
        );
    }

    if (n--)
        dst[0] = dst[1] = dst[2] = dst[3] = src[0];
}

static void remap_mono_to_ch4_s16ne_neon(pa_remap_t *m, int16_t *dst, const int16_t *src, unsigned n) {
    for (; n >= 4; n -= 4) {
        __asm__ __volatile__ (
            "vld1.16    {d0}, [%[src]]!         \n\t"
            "vdup.s16   d1, d0[1]               \n\t"
            "vdup.s16   d2, d0[2]               \n\t"
            "vdup.s16   d3, d0[3]               \n\t"
            "vdup.s16   d0, d0[0]               \n\t"
            "vst1.16    {d0,d1,d2,d3}, [%[dst]]!\n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : /* input operands */
            : "memory", "d0", "d1", "d2", "d3" /* clobber list */
        );
    }

    for (; n > 0; n--) {
        dst[0] = dst[1] = dst[2] = dst[3] = src[0];
        src++;
        dst += 4;
    }
}

static void remap_stereo_to_mono_float32ne_neon(pa_remap_t *m, float *dst, const float *src, unsigned n) {
    const float32x4_t halve = vdupq_n_f32(0.5f);
    for (; n >= 4; n -= 4) {
        __asm__ __volatile__ (
            "vld2.32    {q0,q1}, [%[src]]!      \n\t"
            "vadd.f32   q0, q0, q1              \n\t"
            "vmul.f32   q0, q0, %q[halve]       \n\t"
            "vst1.32    {q0}, [%[dst]]!         \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : [halve] "w" (halve) /* input operands */
            : "memory", "q0", "q1" /* clobber list */
        );
    }

    for (; n > 0; n--) {
        dst[0] = (src[0] + src[1])*0.5f;
        src += 2;
        dst++;
    }
}

static void remap_stereo_to_mono_s16ne_neon(pa_remap_t *m, int16_t *dst, const int16_t *src, unsigned n) {
    for (; n >= 8; n -= 8) {
        __asm__ __volatile__ (
            "vld2.16    {q0,q1}, [%[src]]!      \n\t"
            "vrhadd.s16 q0, q0, q1              \n\t"
            "vst1.16    {q0}, [%[dst]]!         \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : /* input operands */
            : "memory", "q0", "q1" /* clobber list */
        );
    }

    for (; n > 0; n--) {
        dst[0] = (src[0] + src[1])/2;
        src += 2;
        dst++;
    }
}

static void remap_ch4_to_mono_float32ne_neon(pa_remap_t *m, float *dst, const float *src, unsigned n) {
    const float32x2_t quart = vdup_n_f32(0.25f);
    for (; n >= 2; n -= 2) {
        __asm__ __volatile__ (
            "vld4.32    {d0,d1,d2,d3}, [%[src]]!\n\t"
            "vadd.f32   d0, d0, d1              \n\t"
            "vadd.f32   d2, d2, d3              \n\t"
            "vadd.f32   d0, d0, d2              \n\t"
            "vmul.f32   d0, d0, %[quart]        \n\t"
            "vst1.32    {d0}, [%[dst]]!         \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : [quart] "w" (quart) /* input operands */
            : "memory", "d0", "d1", "d2", "d3" /* clobber list */
        );
    }

    if (n > 0)
        dst[0] = (src[0] + src[1] + src[2] + src[3])*0.25f;
}

static void remap_ch4_to_mono_s16ne_neon(pa_remap_t *m, int16_t *dst, const int16_t *src, unsigned n) {
    for (; n >= 4; n -= 4) {
        __asm__ __volatile__ (
            "vld4.16    {d0,d1,d2,d3}, [%[src]]!\n\t"
            "vrhadd.s16 d0, d0, d1              \n\t"
            "vrhadd.s16 d2, d2, d3              \n\t"
            "vrhadd.s16 d0, d0, d2              \n\t"
            "vst1.16    {d0}, [%[dst]]!         \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : /* input operands */
            : "memory", "d0", "d1", "d2", "d3" /* clobber list */
        );
    }

    for (; n > 0; n--) {
        dst[0] = (src[0] + src[1] + src[2] + src[3])/4;
        src += 4;
        dst++;
    }
}

static void remap_ch4_s16ne_neon(pa_remap_t *m, int16_t *dst, const int16_t *src, unsigned n) {
    int32x4_t *f = m->state;
    const int32x4_t f0 = f[0], f1 = f[1], f2 = f[2], f3 = f[3];

    for (; n > 0; n--) {
        __asm__ __volatile__ (
            "vld1.16    {d0}, [%[src]]!         \n\t"
            "vmovl.s16  q0, d0                  \n\t"
            "vdup.s32   q1, d0[0]               \n\t"
            "vmul.s32   q1, q1, %q[f0]          \n\t"
            "vdup.s32   q2, d0[1]               \n\t"
            "vmla.s32   q1, q2, %q[f1]          \n\t"
            "vdup.s32   q2, d1[0]               \n\t"
            "vmla.s32   q1, q2, %q[f2]          \n\t"
            "vdup.s32   q2, d1[1]               \n\t"
            "vmla.s32   q1, q2, %q[f3]          \n\t"
            "vqshrn.s32  d2, q1, #16            \n\t"
            "vst1.32    {d2}, [%[dst]]!         \n\t"
            : [dst] "+r" (dst), [src] "+r" (src)
            : [f0] "w" (f0), [f1] "w" (f1), [f2] "w" (f2), [f3] "w" (f3)
            : "memory", "q0", "q1", "q2"
        );
    }
}

static void remap_ch4_float32ne_neon(pa_remap_t *m, float *dst, const float *src, unsigned n) {
    float32x4_t *f = m->state;
    const float32x4_t f0 = f[0], f1 = f[1], f2 = f[2], f3 = f[3];

    for (; n > 0; n--) {
        __asm__ __volatile__ (
            "vld1.32    {d0,d1}, [%[src]]!      \n\t"
            "vdup.f32   q1, d0[0]               \n\t"
            "vmul.f32   q1, q1, %q[f0]          \n\t"
            "vdup.f32   q2, d0[1]               \n\t"
            "vmla.f32   q1, q2, %q[f1]          \n\t"
            "vdup.f32   q2, d1[0]               \n\t"
            "vmla.f32   q1, q2, %q[f2]          \n\t"
            "vdup.f32   q2, d1[1]               \n\t"
            "vmla.f32   q1, q2, %q[f3]          \n\t"
            "vst1.32    {d2,d3}, [%[dst]]!      \n\t"
            : [dst] "+r" (dst), [src] "+r" (src)
            : [f0] "w" (f0), [f1] "w" (f1), [f2] "w" (f2), [f3] "w" (f3)
            : "memory", "q0", "q1", "q2"
        );
    }
}

static void remap_arrange_stereo_s16ne_neon(pa_remap_t *m, int16_t *dst, const int16_t *src, unsigned n) {
    const uint8x8_t t = ((uint8x8_t *) m->state)[0];

    for (; n >= 2; n -= 2) {
        __asm__ __volatile__ (
            "vld1.s16   d0, [%[src]]!           \n\t"
            "vtbl.8     d0, {d0}, %[t]          \n\t"
            "vst1.s16   d0, [%[dst]]!           \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : [t] "w" (t) /* input operands */
            : "memory", "d0" /* clobber list */
        );
    }

    if (n > 0) {
        __asm__ __volatile__ (
            "vld1.32   d0[0], [%[src]]!         \n\t"
            "vtbl.8    d0, {d0}, %[t]           \n\t"
            "vst1.32   d0[0], [%[dst]]!         \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : [t] "w" (t) /* input operands */
            : "memory", "d0" /* clobber list */
        );
    }
}

static void remap_arrange_ch2_ch4_s16ne_neon(pa_remap_t *m, int16_t *dst, const int16_t *src, unsigned n) {
    const uint8x8_t t = ((uint8x8_t *) m->state)[0];

    for (; n > 0; n--) {
        __asm__ __volatile__ (
            "vld1.32    d0[0], [%[src]]!           \n\t"
            "vtbl.8     d0, {d0}, %[t]          \n\t"
            "vst1.s16   d0, [%[dst]]!           \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : [t] "w" (t) /* input operands */
            : "memory", "d0" /* clobber list */
        );
    }
}

static void remap_arrange_ch4_s16ne_neon(pa_remap_t *m, int16_t *dst, const int16_t *src, unsigned n) {
    const uint8x8_t t = ((uint8x8_t *) m->state)[0];

    for (; n > 0; n--) {
        __asm__ __volatile__ (
            "vld1.s16   d0, [%[src]]!           \n\t"
            "vtbl.8     d0, {d0}, %[t]          \n\t"
            "vst1.s16   d0, [%[dst]]!           \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : [t] "w" (t) /* input operands */
            : "memory", "d0" /* clobber list */
        );
    }
}

static void remap_arrange_stereo_float32ne_neon(pa_remap_t *m, float *dst, const float *src, unsigned n) {
    const uint8x8_t t = ((uint8x8_t *)m->state)[0];

    for (; n > 0; n--) {
        __asm__ __volatile__ (
            "vld1.f32   d0, [%[src]]!           \n\t"
            "vtbl.8     d0, {d0}, %[t]          \n\t"
            "vst1.s16   {d0}, [%[dst]]!         \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : [t] "w" (t) /* input operands */
            : "memory", "d0" /* clobber list */
        );
    }
}

static void remap_arrange_ch2_ch4_float32ne_neon(pa_remap_t *m, float *dst, const float *src, unsigned n) {
    const uint8x8_t t0 = ((uint8x8_t *)m->state)[0];
    const uint8x8_t t1 = ((uint8x8_t *)m->state)[1];

    for (; n > 0; n--) {
        __asm__ __volatile__ (
            "vld1.f32   d0, [%[src]]!           \n\t"
            "vtbl.8     d1, {d0}, %[t0]         \n\t"
            "vtbl.8     d2, {d0}, %[t1]         \n\t"
            "vst1.s16   {d1,d2}, [%[dst]]!      \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : [t0] "w" (t0), [t1] "w" (t1) /* input operands */
            : "memory", "d0", "d1", "d2" /* clobber list */
        );
    }
}

static void remap_arrange_ch4_float32ne_neon(pa_remap_t *m, float *dst, const float *src, unsigned n) {
    const uint8x8_t t0 = ((uint8x8_t *)m->state)[0];
    const uint8x8_t t1 = ((uint8x8_t *)m->state)[1];

    for (; n > 0; n--) {
        __asm__ __volatile__ (
            "vld1.f32   {d0,d1}, [%[src]]!      \n\t"
            "vtbl.8     d2, {d0,d1}, %[t0]      \n\t"
            "vtbl.8     d3, {d0,d1}, %[t1]      \n\t"
            "vst1.s16   {d2,d3}, [%[dst]]!      \n\t"
            : [dst] "+r" (dst), [src] "+r" (src) /* output operands */
            : [t0] "w" (t0), [t1] "w" (t1) /* input operands */
            : "memory", "d0", "d1", "d2", "d3" /* clobber list */
        );
    }
}

static pa_cpu_arm_flag_t arm_flags;

static void init_remap_neon(pa_remap_t *m) {
    unsigned n_oc, n_ic;
    int8_t arrange[PA_CHANNELS_MAX];

    n_oc = m->o_ss.channels;
    n_ic = m->i_ss.channels;

    if (n_ic == 1 && n_oc == 2 &&
            m->map_table_i[0][0] == 0x10000 && m->map_table_i[1][0] == 0x10000) {
        if (arm_flags & PA_CPU_ARM_CORTEX_A8) {

            pa_log_info("Using ARM NEON/A8 mono to stereo remapping");
            pa_set_remap_func(m, (pa_do_remap_func_t) remap_mono_to_stereo_s16ne_neon,
                (pa_do_remap_func_t) remap_mono_to_stereo_float32ne_neon_a8);
        }
        else {
            pa_log_info("Using ARM NEON mono to stereo remapping");
            pa_set_remap_func(m, (pa_do_remap_func_t) remap_mono_to_stereo_s16ne_neon,
                (pa_do_remap_func_t) remap_mono_to_stereo_float32ne_generic_arm);
        }
    } else if (n_ic == 1 && n_oc == 4 &&
            m->map_table_i[0][0] == 0x10000 && m->map_table_i[1][0] == 0x10000 &&
            m->map_table_i[2][0] == 0x10000 && m->map_table_i[3][0] == 0x10000) {

        pa_log_info("Using ARM NEON mono to 4-channel remapping");
        pa_set_remap_func(m, (pa_do_remap_func_t) remap_mono_to_ch4_s16ne_neon,
            (pa_do_remap_func_t) remap_mono_to_ch4_float32ne_neon);
    } else if (n_ic == 2 && n_oc == 1 &&
            m->map_table_i[0][0] == 0x8000 && m->map_table_i[0][1] == 0x8000) {

        pa_log_info("Using ARM NEON stereo to mono remapping");
        pa_set_remap_func(m, (pa_do_remap_func_t) remap_stereo_to_mono_s16ne_neon,
            (pa_do_remap_func_t) remap_stereo_to_mono_float32ne_neon);
    } else if (n_ic == 4 && n_oc == 1 &&
            m->map_table_i[0][0] == 0x4000 && m->map_table_i[0][1] == 0x4000 &&
            m->map_table_i[0][2] == 0x4000 && m->map_table_i[0][3] == 0x4000) {

        pa_log_info("Using ARM NEON 4-channel to mono remapping");
        pa_set_remap_func(m, (pa_do_remap_func_t) remap_ch4_to_mono_s16ne_neon,
            (pa_do_remap_func_t) remap_ch4_to_mono_float32ne_neon);
    } else if (pa_setup_remap_arrange(m, arrange) &&
        ((n_ic == 2 && n_oc == 2) ||
         (n_ic == 2 && n_oc == 4) ||
         (n_ic == 4 && n_oc == 4))) {
        unsigned o;

        if (n_ic == 2 && n_oc == 2) {
            pa_log_info("Using NEON stereo arrange remapping");
            pa_set_remap_func(m, (pa_do_remap_func_t) remap_arrange_stereo_s16ne_neon,
                (pa_do_remap_func_t) remap_arrange_stereo_float32ne_neon);
        } else if (n_ic == 2 && n_oc == 4) {
            pa_log_info("Using NEON 2-channel to 4-channel arrange remapping");
            pa_set_remap_func(m, (pa_do_remap_func_t) remap_arrange_ch2_ch4_s16ne_neon,
                (pa_do_remap_func_t) remap_arrange_ch2_ch4_float32ne_neon);
        } else if (n_ic == 4 && n_oc == 4) {
            pa_log_info("Using NEON 4-channel arrange remapping");
            pa_set_remap_func(m, (pa_do_remap_func_t) remap_arrange_ch4_s16ne_neon,
                (pa_do_remap_func_t) remap_arrange_ch4_float32ne_neon);
        }

        /* setup state */
        switch (m->format) {
        case PA_SAMPLE_S16NE: {
            uint8x8_t *t = m->state = pa_xnew0(uint8x8_t, 1);
            for (o = 0; o < 4; o++) {
                if (arrange[o % n_oc] >= 0) {
                    /* convert channel index to vtbl indices */
                    unsigned frame = o / n_oc;
                    ((uint8_t *) t)[o * 2 + 0] = (frame * n_oc + arrange[o % n_oc]) * 2 + 0;
                    ((uint8_t *) t)[o * 2 + 1] = (frame * n_oc + arrange[o % n_oc]) * 2 + 1;
                } else {
                    /* use invalid table indices to map to 0 */
                    ((uint8_t *) t)[o * 2 + 0] = 0xff;
                    ((uint8_t *) t)[o * 2 + 1] = 0xff;
                }
            }
            break;
        }
        case PA_SAMPLE_FLOAT32NE: {
            uint8x8_t *t = m->state = pa_xnew0(uint8x8_t, 2);
            for (o = 0; o < n_oc; o++) {
                if (arrange[o] >= 0) {
                    /* convert channel index to vtbl indices */
                    ((uint8_t *) t)[o * 4 + 0] = arrange[o] * 4 + 0;
                    ((uint8_t *) t)[o * 4 + 1] = arrange[o] * 4 + 1;
                    ((uint8_t *) t)[o * 4 + 2] = arrange[o] * 4 + 2;
                    ((uint8_t *) t)[o * 4 + 3] = arrange[o] * 4 + 3;
                } else {
                    /* use invalid table indices to map to 0 */
                    ((uint8_t *) t)[o * 4 + 0] = 0xff;
                    ((uint8_t *) t)[o * 4 + 1] = 0xff;
                    ((uint8_t *) t)[o * 4 + 2] = 0xff;
                    ((uint8_t *) t)[o * 4 + 3] = 0xff;
                }
            }
            break;
        }
        default:
            pa_assert_not_reached();
        }
    } else if (n_ic == 4 && n_oc == 4) {
        unsigned i, o;

        pa_log_info("Using ARM NEON 4-channel remapping");
        pa_set_remap_func(m, (pa_do_remap_func_t) remap_ch4_s16ne_neon,
            (pa_do_remap_func_t) remap_ch4_float32ne_neon);

        /* setup state */
        switch (m->format) {
        case PA_SAMPLE_S16NE: {
            int32x4_t *f = m->state = pa_xnew0(int32x4_t, 4);
            for (o = 0; o < 4; o++) {
                for (i = 0; i < 4; i++) {
                    ((int *) &f[i])[o] = PA_CLAMP_UNLIKELY(m->map_table_i[o][i], 0, 0x10000);
                }
            }
            break;
        }
        case PA_SAMPLE_FLOAT32NE: {
            float32x4_t *f = m->state = pa_xnew0(float32x4_t, 4);
            for (o = 0; o < 4; o++) {
                for (i = 0; i < 4; i++) {
                    ((float *) &f[i])[o] = PA_CLAMP_UNLIKELY(m->map_table_f[o][i], 0.0f, 1.0f);
                }
            }
            break;
        }
        default:
            pa_assert_not_reached();
        }
    }
}

void pa_remap_func_init_neon(pa_cpu_arm_flag_t flags) {
    pa_log_info("Initialising ARM NEON optimized remappers.");
    arm_flags = flags;
    pa_set_init_remap_func((pa_init_remap_func_t) init_remap_neon);
}