annotate remap_neon.c @ 5:07763f536182 default tip

ALIGNment support
author Peter Meerwald <p.meerwald@bct-electronic.com>
date Sun, 08 Jul 2012 21:48:08 +0200
parents e889fd0e7769
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
1 /*
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
2 * Copyright 2012 Peter Meerwald <p.meerwald@bct-electronic.com>
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
3 */
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
4
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
5 #include <stdlib.h>
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
6 #include <stdio.h>
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
7 #include <stdarg.h>
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
8 #include <string.h>
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
9 #include <math.h>
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
10 #include <sys/time.h>
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
11 #include <assert.h>
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
12
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
13 typedef unsigned char uint8_t;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
14 typedef short int16_t;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
15 typedef unsigned int uint32_t;
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
16
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
17 typedef enum pa_sample_format {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
18 PA_SAMPLE_S16LE,
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
19 PA_SAMPLE_FLOAT32LE,
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
20 } pa_sample_format_t;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
21 #define PA_SAMPLE_S16NE PA_SAMPLE_S16LE
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
22 #define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32LE
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
23
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
24 typedef struct pa_sample_spec {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
25 pa_sample_format_t format;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
26 uint32_t rate;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
27 uint8_t channels;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
28 } pa_sample_spec;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
29
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
30 #define PA_CHANNELS_MAX 32
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
31 typedef struct {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
32 pa_sample_format_t *format;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
33 pa_sample_spec *i_ss, *o_ss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
34 float map_table_f[PA_CHANNELS_MAX][PA_CHANNELS_MAX];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
35 int32_t map_table_i[PA_CHANNELS_MAX][PA_CHANNELS_MAX];
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
36 } pa_remap_t;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
37
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
38 typedef long long unsigned int pa_usec_t;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
39
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
40 #define pa_assert(x) assert(x)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
41 #define pa_assert_not_reached() assert(0)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
42
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
43 #define PA_CLAMP_UNLIKELY(x, low, high) \
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
44 (((x) < (low)) ? (low) : (((x) > (high)) ? (high) : (x)))
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
45
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
46 static void pa_log_info(const char *format, ...) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
47 va_list ap;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
48 char buf[1024];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
49 va_start(ap, format);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
50 vsprintf(buf, format, ap);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
51 printf("%s\n", buf);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
52 va_end(ap);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
53 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
54
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
55 #define pa_log_debug pa_log_info
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
56
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
57 static pa_usec_t pa_rtclock_now() {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
58 struct timeval tv;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
59 gettimeofday(&tv, NULL);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
60
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
61 return tv.tv_sec * 1000000ULL + tv.tv_usec;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
62 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
63
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
64 static void remap_channels_matrix_c(pa_remap_t *m, void *dst, const void *src, unsigned n) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
65 unsigned oc, ic, i;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
66 unsigned n_ic, n_oc;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
67
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
68 n_ic = m->i_ss->channels;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
69 n_oc = m->o_ss->channels;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
70
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
71 switch (*m->format) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
72 case PA_SAMPLE_FLOAT32NE:
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
73 {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
74 float *d, *s;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
75
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
76 memset(dst, 0, n * sizeof(float) * n_oc);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
77
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
78 for (oc = 0; oc < n_oc; oc++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
79
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
80 for (ic = 0; ic < n_ic; ic++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
81 float vol;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
82
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
83 vol = m->map_table_f[oc][ic];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
84
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
85 if (vol <= 0.0)
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
86 continue;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
87
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
88 d = (float *)dst + oc;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
89 s = (float *)src + ic;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
90
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
91 if (vol >= 1.0) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
92 for (i = n; i > 0; i--, s += n_ic, d += n_oc)
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
93 *d += *s;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
94 } else {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
95 for (i = n; i > 0; i--, s += n_ic, d += n_oc)
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
96 *d += *s * vol;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
97 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
98 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
99 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
100
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
101 break;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
102 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
103 case PA_SAMPLE_S16NE:
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
104 {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
105 int16_t *d, *s;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
106
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
107 memset(dst, 0, n * sizeof(int16_t) * n_oc);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
108
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
109 for (oc = 0; oc < n_oc; oc++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
110
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
111 for (ic = 0; ic < n_ic; ic++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
112 int32_t vol;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
113
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
114 vol = m->map_table_i[oc][ic];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
115
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
116 if (vol <= 0)
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
117 continue;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
118
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
119 d = (int16_t *)dst + oc;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
120 s = (int16_t *)src + ic;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
121
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
122 if (vol >= 0x10000) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
123 for (i = n; i > 0; i--, s += n_ic, d += n_oc)
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
124 *d += *s;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
125 } else {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
126 for (i = n; i > 0; i--, s += n_ic, d += n_oc)
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
127 *d += (int16_t) (((int32_t)*s * vol) >> 16);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
128 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
129 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
130 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
131 break;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
132 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
133 default:
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
134 pa_assert_not_reached();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
135 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
136 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
137
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
138 static void remap_mono_to_stereo_c(pa_remap_t *m, void *dst, const void *src, unsigned n) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
139 unsigned i;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
140
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
141 switch (*m->format) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
142 case PA_SAMPLE_FLOAT32NE:
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
143 {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
144 float *d, *s;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
145
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
146 d = (float *) dst;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
147 s = (float *) src;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
148
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
149 for (i = n >> 2; i; i--) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
150 d[0] = d[1] = s[0];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
151 d[2] = d[3] = s[1];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
152 d[4] = d[5] = s[2];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
153 d[6] = d[7] = s[3];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
154 s += 4;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
155 d += 8;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
156 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
157 for (i = n & 3; i; i--) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
158 d[0] = d[1] = s[0];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
159 s++;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
160 d += 2;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
161 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
162 break;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
163 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
164 case PA_SAMPLE_S16NE:
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
165 {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
166 int16_t *d, *s;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
167
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
168 d = (int16_t *) dst;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
169 s = (int16_t *) src;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
170
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
171 for (i = n >> 2; i; i--) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
172 d[0] = d[1] = s[0];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
173 d[2] = d[3] = s[1];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
174 d[4] = d[5] = s[2];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
175 d[6] = d[7] = s[3];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
176 s += 4;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
177 d += 8;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
178 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
179 for (i = n & 3; i; i--) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
180 d[0] = d[1] = s[0];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
181 s++;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
182 d += 2;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
183 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
184 break;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
185 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
186 default:
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
187 pa_assert_not_reached();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
188 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
189 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
190
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
191 static void remap_stereo_to_mono_c(pa_remap_t *m, void *dst, const void *src, unsigned n) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
192 unsigned i;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
193
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
194 switch (*m->format) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
195 case PA_SAMPLE_FLOAT32NE:
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
196 {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
197 float *d = (float *) dst, *s = (float *) src;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
198
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
199 for (i = n >> 2; i > 0; i--) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
200 d[0] = s[0] + s[1];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
201 d[1] = s[2] + s[3];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
202 d[2] = s[4] + s[5];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
203 d[3] = s[6] + s[7];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
204 s += 8;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
205 d += 4;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
206 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
207 for (i = n & 3; i; i--) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
208 d[0] = s[0] + s[1];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
209 s += 2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
210 d += 1;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
211 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
212 break;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
213 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
214 case PA_SAMPLE_S16NE:
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
215 {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
216 int16_t *d = (int16_t *) dst, *s = (int16_t *) src;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
217
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
218 for (i = n >> 2; i > 0; i--) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
219 *d++ += s[0] + s[1];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
220 *d++ += s[2] + s[3];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
221 *d++ += s[4] + s[5];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
222 *d++ += s[6] + s[7];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
223 s += 8;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
224 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
225 for (i = n & 3; i; i--) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
226 *d++ += s[0] + s[1];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
227 s += 2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
228 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
229 break;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
230 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
231 default:
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
232 pa_assert_not_reached();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
233 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
234 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
235
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
236 #if defined(__arm__)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
237
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
238 #include "arm_neon.h"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
239
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
240 static void mono_to_stereo_float_neon_a8(float *dst, const float *src, unsigned n) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
241 int i = n & 3;
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
242
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
243 asm volatile (
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
244 "mov %[n], %[n], lsr #2\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
245 "1:\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
246 "vld1.32 {q0}, [%[src]]!\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
247 "vmov q1, q0\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
248 "subs %[n], %[n], #1\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
249 "vst2.32 {q0,q1}, [%[dst]]!\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
250 "bgt 1b\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
251 // output operands (or input operands that get modified)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
252 : [dst] "+r" (dst), [src] "+r" (src), [n] "+r" (n)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
253 : // input operands
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
254 : "memory", "cc" // clobber list
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
255 );
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
256
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
257 while (i--) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
258 dst[0] = dst[1] = src[0];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
259 src++;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
260 dst += 2;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
261 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
262 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
263
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
264 static void mono_to_stereo_float_neon_a9(float *dst, const float *src, unsigned n) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
265 int i = n & 1;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
266
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
267 asm volatile (
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
268 "mov %[n], %[n], lsr #1\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
269 "1:\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
270 "ldm %[src]!, {r4,r6}\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
271 "mov r5, r4\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
272 "mov r7, r6\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
273 "subs %[n], %[n], #1\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
274 "stm %[dst]!, {r4-r7}\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
275 "bgt 1b\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
276 // output operands (or input operands that get modified)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
277 : [dst] "+r" (dst), [src] "+r" (src), [n] "+r" (n)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
278 : // input operands
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
279 : "memory", "cc", "r4", "r5", "r6", "r7" // clobber list
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
280 );
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
281
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
282 while (i--) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
283 dst[0] = dst[1] = src[0];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
284 src++;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
285 dst += 2;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
286 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
287 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
288
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
289 static void mono_to_stereo_int16_neon(int16_t *dst, const int16_t *src, unsigned n) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
290 int i = n & 7;
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
291
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
292 asm volatile (
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
293 "mov %[n], %[n], lsr #3\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
294 "1:\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
295 "vld1.16 {q0}, [%[src]]!\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
296 "vmov q1, q0\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
297 "subs %[n], %[n], #1\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
298 "vst2.16 {q0,q1}, [%[dst]]!\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
299 "bgt 1b\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
300 // output operands (or input operands that get modified)
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
301 : [dst] "+r" (dst), [src] "+r" (src), [n] "+r" (n)
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
302 : // input operands
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
303 : "memory", "cc" // clobber list
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
304 );
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
305
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
306 while (i--) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
307 dst[0] = dst[1] = src[0];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
308 src++;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
309 dst += 2;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
310 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
311 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
312
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
313 static void remap_mono_to_stereo_neon_a9(pa_remap_t *m, void *dst, const void *src, unsigned n) {
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
314 switch (*m->format) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
315 case PA_SAMPLE_FLOAT32NE:
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
316 mono_to_stereo_float_neon_a9(dst, src, n);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
317 break;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
318 case PA_SAMPLE_S16NE:
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
319 mono_to_stereo_int16_neon(dst, src, n);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
320 break;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
321 default:
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
322 pa_assert_not_reached();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
323 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
324 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
325
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
326 static void remap_mono_to_stereo_neon_a8(pa_remap_t *m, void *dst, const void *src, unsigned n) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
327 switch (*m->format) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
328 case PA_SAMPLE_FLOAT32NE:
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
329 mono_to_stereo_float_neon_a8(dst, src, n);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
330 break;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
331 case PA_SAMPLE_S16NE:
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
332 mono_to_stereo_int16_neon(dst, src, n);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
333 break;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
334 default:
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
335 pa_assert_not_reached();
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
336 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
337 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
338
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
339 static void stereo_to_mono_float_neon(float *dst, const float *src, unsigned n) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
340 int i = n & 3;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
341
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
342 asm volatile (
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
343 "mov %[n], %[n], lsr #2\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
344 "1:\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
345 "vld2.32 {q0,q1}, [%[src]]!\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
346 "vadd.f32 q0, q0, q1\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
347 "subs %[n], %[n], #1\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
348 "vst1.32 {q0}, [%[dst]]!\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
349 "bgt 1b\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
350 // output operands (or input operands that get modified)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
351 : [dst] "+r" (dst), [src] "+r" (src), [n] "+r" (n)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
352 : // input operands
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
353 : "memory", "cc" // clobber list
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
354 );
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
355
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
356 while (i--) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
357 dst[0] = src[0] + src[1];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
358 src += 2;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
359 dst++;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
360 }
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
361 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
362
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
363 static void stereo_to_mono_int16_neon(int16_t *dst, const int16_t *src, unsigned n) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
364 int i = n & 7;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
365
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
366 asm volatile (
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
367 "mov %[n], %[n], lsr #3\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
368 "1:\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
369 "vld2.16 {q0,q1}, [%[src]]!\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
370 "vadd.s16 q0, q0, q1\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
371 "subs %[n], %[n], #1\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
372 "vst1.16 {q0}, [%[dst]]!\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
373 "bgt 1b\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
374 // output operands (or input operands that get modified)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
375 : [dst] "+r" (dst), [src] "+r" (src), [n] "+r" (n)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
376 : // input operands
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
377 : "memory", "cc" // clobber list
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
378 );
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
379
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
380 while (i--) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
381 dst[0] = src[0] + src[1];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
382 src += 2;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
383 dst++;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
384 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
385 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
386
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
387 static void remap_stereo_to_mono_neon(pa_remap_t *m, void *dst, const void *src, unsigned n) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
388 switch (*m->format) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
389 case PA_SAMPLE_FLOAT32NE:
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
390 stereo_to_mono_float_neon(dst, src, n);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
391 break;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
392 case PA_SAMPLE_S16NE:
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
393 stereo_to_mono_int16_neon(dst, src, n);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
394 break;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
395 default:
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
396 pa_assert_not_reached();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
397 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
398 }
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
399
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
400 #define SAMPLES 1019
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
401 #define TIMES 500000
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
402 #define ALIGN 1
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
403
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
404 static void run_test_mono_to_stereo_float(void) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
405 float stereo_a9[2*SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
406 float stereo_a8[2*SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
407 float stereo_ref[2*SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
408 float stereo_gen[2*SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
409 float mono[SAMPLES+ALIGN];
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
410 int i;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
411 pa_usec_t start, stop;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
412 pa_sample_format_t sf;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
413 pa_sample_spec iss, oss;
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
414 pa_remap_t remap;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
415
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
416 pa_log_debug("checking NEON remap_mono_to_stereo(float, %d)", SAMPLES);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
417
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
418 memset(stereo_ref, 0, sizeof(stereo_ref));
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
419 memset(stereo_gen, 0, sizeof(stereo_gen));
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
420 memset(stereo_a9, 0, sizeof(stereo_a9));
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
421 memset(stereo_a8, 0, sizeof(stereo_a8));
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
422
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
423 for (i = 0; i < SAMPLES+ALIGN; i++) {
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
424 mono[i] = rand()/(float) RAND_MAX - 0.5f;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
425 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
426
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
427 sf = PA_SAMPLE_FLOAT32NE;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
428 remap.format = &sf;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
429 iss.format = PA_SAMPLE_FLOAT32NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
430 iss.channels = 1;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
431 oss.format = PA_SAMPLE_FLOAT32NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
432 oss.channels = 2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
433 remap.i_ss = &iss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
434 remap.o_ss = &oss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
435 remap.map_table_f[0][0] = 1.0;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
436 remap.map_table_f[1][0] = 1.0;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
437
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
438 remap_mono_to_stereo_neon_a9(&remap, stereo_a9+ALIGN, mono+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
439 remap_mono_to_stereo_neon_a8(&remap, stereo_a8+ALIGN, mono+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
440 remap_mono_to_stereo_c(&remap, stereo_ref+ALIGN, mono+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
441 remap_channels_matrix_c(&remap, stereo_gen+ALIGN, mono+ALIGN, SAMPLES);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
442
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
443 for (i = ALIGN; i < 2*SAMPLES+ALIGN; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
444 if (fabsf(stereo_a9[i] - stereo_ref[i]) > 0.00001) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
445 pa_log_debug("NEON/A9 %d: %.3f != %.3f (%.3f)", i, stereo_a9[i], stereo_ref[i],
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
446 mono[i/2]);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
447 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
448 }
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
449 for (i = ALIGN; i < 2*SAMPLES+ALIGN; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
450 if (fabsf(stereo_a8[i] - stereo_ref[i]) > 0.00001) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
451 pa_log_debug("NEON/A8 %d: %.3f != %.3f (%.3f)", i, stereo_a8[i], stereo_ref[i],
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
452 mono[i/2]);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
453 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
454 }
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
455 for (i = ALIGN; i < 2*SAMPLES+ALIGN; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
456 if (fabsf(stereo_gen[i] - stereo_ref[i]) > 0.00001) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
457 pa_log_debug("generic %d: %.3f != %.3f (%.3f)", i, stereo_gen[i], stereo_ref[i],
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
458 mono[i/2]);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
459 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
460 }
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
461
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
462 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
463 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
464 remap_mono_to_stereo_c(&remap, stereo_ref+ALIGN, mono+ALIGN, SAMPLES);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
465 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
466 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
467 pa_log_info("ref:\t\t%llu usec.", (long long unsigned int)(stop - start));
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
468
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
469 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
470 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
471 remap_mono_to_stereo_neon_a9(&remap, stereo_a9+ALIGN, mono+ALIGN, SAMPLES);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
472 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
473 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
474 pa_log_info("NEON/A9:\t%llu usec.", (long long unsigned int)(stop - start));
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
475
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
476 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
477 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
478 remap_mono_to_stereo_neon_a8(&remap, stereo_a8+ALIGN, mono+ALIGN, SAMPLES);
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
479 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
480 stop = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
481 pa_log_info("NEON/A8:\t%llu usec.", (long long unsigned int)(stop - start));
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
482
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
483 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
484 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
485 remap_channels_matrix_c(&remap, stereo_gen+ALIGN, mono+ALIGN, SAMPLES);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
486 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
487 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
488 pa_log_info("generic:\t%llu usec.", (long long unsigned int)(stop - start));
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
489 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
490
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
491 static void run_test_stereo_to_mono_float(void) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
492 float stereo[2*SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
493 float mono_ref[SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
494 float mono_gen[SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
495 float mono[SAMPLES+ALIGN];
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
496 int i;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
497 pa_usec_t start, stop;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
498 pa_sample_format_t sf;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
499 pa_sample_spec iss, oss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
500 pa_remap_t remap;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
501
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
502 pa_log_debug("checking NEON remap_stereo_to_mono(float, %d)", SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
503
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
504 memset(mono_ref, 0, sizeof(mono_ref));
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
505 memset(mono, 0, sizeof(mono));
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
506
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
507 for (i = 0; i < 2*SAMPLES+ALIGN; i++) {
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
508 stereo[i] = rand()/(float) RAND_MAX - 0.5f;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
509 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
510
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
511 sf = PA_SAMPLE_FLOAT32NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
512 remap.format = &sf;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
513 iss.format = PA_SAMPLE_FLOAT32NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
514 iss.channels = 2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
515 oss.format = PA_SAMPLE_FLOAT32NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
516 oss.channels = 1;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
517 remap.i_ss = &iss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
518 remap.o_ss = &oss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
519 remap.map_table_f[0][0] = 1.0;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
520 remap.map_table_f[0][1] = 1.0;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
521
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
522 remap_stereo_to_mono_c(&remap, mono_ref+ALIGN, stereo+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
523 remap_channels_matrix_c(&remap, mono_gen+ALIGN, stereo+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
524 remap_stereo_to_mono_neon(&remap, mono+ALIGN, stereo+ALIGN, SAMPLES);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
525
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
526 for (i = ALIGN; i < SAMPLES+ALIGN; i++) {
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
527 if (fabsf(mono[i] - mono_ref[i]) > 0.00001) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
528 pa_log_debug("%d: %.3f != %.3f (%.3f %0.3f)", i, mono[i], mono_ref[i],
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
529 stereo[2*i+0], stereo[2*i+1]);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
530 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
531 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
532
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
533 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
534 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
535 remap_stereo_to_mono_neon(&remap, mono+ALIGN, stereo+ALIGN, SAMPLES);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
536 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
537 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
538 pa_log_info("NEON:\t\t%llu usec.", (long long unsigned int)(stop - start));
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
539
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
540 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
541 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
542 remap_stereo_to_mono_c(&remap, mono_ref+ALIGN, stereo+ALIGN, SAMPLES);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
543 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
544 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
545 pa_log_info("ref:\t\t%llu usec.", (long long unsigned int)(stop - start));
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
546
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
547 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
548 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
549 remap_channels_matrix_c(&remap, mono_gen+ALIGN, stereo+ALIGN, SAMPLES);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
550 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
551 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
552 pa_log_info("generic:\t%llu usec.", (long long unsigned int)(stop - start));
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
553 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
554
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
555 static void run_test_mono_to_stereo_s16(void) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
556 int16_t stereo_a9[2*SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
557 int16_t stereo_a8[2*SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
558 int16_t stereo_ref[2*SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
559 int16_t stereo_gen[2*SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
560 int16_t mono[SAMPLES+ALIGN];
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
561 int i;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
562 pa_usec_t start, stop;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
563 pa_sample_format_t sf;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
564 pa_sample_spec iss, oss;
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
565 pa_remap_t remap;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
566
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
567 pa_log_debug("checking NEON remap_mono_to_stereo(s16, %d)", SAMPLES);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
568
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
569 memset(stereo_ref, 0, sizeof(stereo_ref));
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
570 memset(stereo_a9, 0, sizeof(stereo_a9));
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
571 memset(stereo_a8, 0, sizeof(stereo_a8));
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
572 memset(stereo_gen, 0, sizeof(stereo_gen));
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
573
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
574 for (i = 0; i < SAMPLES+ALIGN; i++) {
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
575 mono[i] = rand() - RAND_MAX/2;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
576 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
577
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
578 sf = PA_SAMPLE_S16NE;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
579 remap.format = &sf;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
580 iss.format = PA_SAMPLE_S16NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
581 iss.channels = 1;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
582 oss.format = PA_SAMPLE_S16NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
583 oss.channels = 2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
584 remap.i_ss = &iss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
585 remap.o_ss = &oss;
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
586 remap.map_table_i[0][0] = 0x10000;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
587 remap.map_table_i[1][0] = 0x10000;
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
588
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
589 remap_mono_to_stereo_c(&remap, stereo_ref+ALIGN, mono+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
590 remap_channels_matrix_c(&remap, stereo_gen+ALIGN, mono+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
591 remap_mono_to_stereo_neon_a9(&remap, stereo_a9+ALIGN, mono+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
592 remap_mono_to_stereo_neon_a8(&remap, stereo_a8+ALIGN, mono+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
593
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
594 for (i = ALIGN; i < 2*SAMPLES+ALIGN; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
595 if (abs(stereo_a9[i] - stereo_ref[i]) > 0) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
596 pa_log_debug("NEON/A9 %d: %d != %d (%d)", i, stereo_a9[i], stereo_ref[i],
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
597 mono[i/2]);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
598 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
599 }
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
600 for (i = ALIGN; i < 2*SAMPLES+ALIGN; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
601 if (abs(stereo_a8[i] - stereo_ref[i]) > 0) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
602 pa_log_debug("NEON/A8 %d: %d != %d (%d)", i, stereo_a8[i], stereo_ref[i],
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
603 mono[i/2]);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
604 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
605 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
606
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
607 for (i = ALIGN; i < 2*SAMPLES+ALIGN; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
608 if (abs(stereo_gen[i] - stereo_ref[i]) > 0) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
609 pa_log_debug("generic %d: %d != %d (%d)", i, stereo_gen[i], stereo_ref[i],
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
610 mono[i/2]);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
611 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
612 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
613
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
614 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
615 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
616 remap_mono_to_stereo_neon_a9(&remap, stereo_a9+ALIGN, mono+ALIGN, SAMPLES);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
617 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
618 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
619 pa_log_info("NEON/A9:\t%llu usec.", (long long unsigned int)(stop - start));
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
620
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
621 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
622 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
623 remap_mono_to_stereo_neon_a8(&remap, stereo_a8+ALIGN, mono+ALIGN, SAMPLES);
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
624 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
625 stop = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
626 pa_log_info("NEON/A8:\t%llu usec.", (long long unsigned int)(stop - start));
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
627
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
628 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
629 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
630 remap_mono_to_stereo_c(&remap, stereo_ref+ALIGN, mono+ALIGN, SAMPLES);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
631 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
632 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
633 pa_log_info("ref:\t\t%llu usec.", (long long unsigned int)(stop - start));
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
634
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
635 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
636 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
637 remap_channels_matrix_c(&remap, stereo_gen+ALIGN, mono+ALIGN, SAMPLES);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
638 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
639 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
640 pa_log_info("generic:\t%llu usec.", (long long unsigned int)(stop - start));
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
641 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
642
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
643 static void run_test_stereo_to_mono_s16(void) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
644 int16_t stereo[2*SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
645 int16_t mono_ref[SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
646 int16_t mono_gen[SAMPLES+ALIGN];
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
647 int16_t mono[SAMPLES+ALIGN];
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
648 int i;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
649 pa_usec_t start, stop;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
650 pa_sample_format_t sf;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
651 pa_sample_spec iss, oss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
652 pa_remap_t remap;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
653
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
654 pa_log_debug("checking NEON remap_stereo_to_mono(s16, %d)", SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
655
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
656 memset(mono_ref, 0, sizeof(mono_ref));
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
657 memset(mono_gen, 0, sizeof(mono_gen));
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
658 memset(mono, 0, sizeof(mono));
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
659
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
660 for (i = 0; i < 2*SAMPLES+ALIGN; i++) {
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
661 stereo[i] = rand() - RAND_MAX/2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
662 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
663
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
664 sf = PA_SAMPLE_S16NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
665 remap.format = &sf;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
666 iss.format = PA_SAMPLE_S16NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
667 iss.channels = 2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
668 oss.format = PA_SAMPLE_S16NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
669 oss.channels = 1;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
670 remap.i_ss = &iss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
671 remap.o_ss = &oss;
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
672 remap.map_table_i[0][0] = 0x10000;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
673 remap.map_table_i[0][1] = 0x10000;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
674
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
675 remap_stereo_to_mono_c(&remap, mono_ref+ALIGN, stereo+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
676 remap_channels_matrix_c(&remap, mono_gen+ALIGN, stereo+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
677 remap_stereo_to_mono_neon(&remap, mono+ALIGN, stereo+ALIGN, SAMPLES);
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
678
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
679 for (i = ALIGN; i < SAMPLES+ALIGN; i++) {
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
680 if (abs(mono[i] - mono_ref[i]) > 0) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
681 pa_log_debug("%d: %d != %d (%d)", i, mono[i], mono_ref[i],
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
682 stereo[2*i+0], stereo[2*i+1]);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
683 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
684 }
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
685 for (i = ALIGN; i < SAMPLES+ALIGN; i++) {
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
686 if (abs(mono[i] - mono_gen[i]) > 0) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
687 pa_log_debug("%d: %d != %d (%d)", i, mono[i], mono_gen[i],
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
688 stereo[2*i+0], stereo[2*i+1]);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
689 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
690 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
691
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
692 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
693 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
694 remap_stereo_to_mono_neon(&remap, mono+ALIGN, stereo+ALIGN, SAMPLES);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
695 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
696 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
697 pa_log_info("NEON:\t\t%llu usec.", (long long unsigned int)(stop - start));
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
698
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
699 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
700 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
701 remap_stereo_to_mono_c(&remap, mono_ref+ALIGN, stereo+ALIGN, SAMPLES);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
702 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
703 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
704 pa_log_info("ref:\t\t%llu usec.", (long long unsigned int)(stop - start));
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
705
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
706 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
707 for (i = 0; i < TIMES; i++) {
5
07763f536182 ALIGNment support
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 3
diff changeset
708 remap_channels_matrix_c(&remap, mono_gen+ALIGN, stereo+ALIGN, SAMPLES);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
709 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
710 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
711 pa_log_info("generic:\t%llu usec.", (long long unsigned int)(stop - start));
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
712 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
713
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
714 #endif /* defined(__arm__) */
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
715
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
716 int main() {
3
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
717
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
718 /* not in user space
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
719 unsigned cpuid;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
720 asm volatile(
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
721 "mrc p15, 0, %[cpuid], c0, c0, 0\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
722 : [cpuid] "=r" (cpuid)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
723 :
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
724 : "cc");
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
725
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
726 printf("%08x %03x\n", cpuid, (cpuid >> 4) & 0xfff);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
727 */
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
728
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
729 run_test_stereo_to_mono_float();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
730 run_test_stereo_to_mono_s16();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
731
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
732 run_test_mono_to_stereo_float();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
733 run_test_mono_to_stereo_s16();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
734
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
735 return EXIT_SUCCESS;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
736 }

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.