annotate remap_neon.c @ 3:e889fd0e7769

stuff
author Peter Meerwald <p.meerwald@bct-electronic.com>
date Thu, 05 Jul 2012 17:31:56 +0200
parents 09ee6a01a3d3
children 07763f536182
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;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
242
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;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
291
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)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
301 : [dst] "+r" (dst), [src] "+r" (src), [n] "+r" (n)
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
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
402
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
403 static void run_test_mono_to_stereo_float(void) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
404 float stereo_a9[2*SAMPLES];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
405 float stereo_a8[2*SAMPLES];
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
406 float stereo_ref[2*SAMPLES];
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
407 float stereo_gen[2*SAMPLES];
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
408 float mono[SAMPLES];
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
409 int i;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
410 pa_usec_t start, stop;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
411 pa_sample_format_t sf;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
412 pa_sample_spec iss, oss;
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
413 pa_remap_t remap;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
414
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
415 pa_log_debug("checking NEON remap_mono_to_stereo(float, %d)", SAMPLES);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
416
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
417 memset(stereo_ref, 0, sizeof(stereo_ref));
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
418 memset(stereo_gen, 0, sizeof(stereo_gen));
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
419 memset(stereo_a9, 0, sizeof(stereo_a9));
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
420 memset(stereo_a8, 0, sizeof(stereo_a8));
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
421
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
422 for (i = 0; i < SAMPLES; i++) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
423 mono[i] = rand()/(float) RAND_MAX - 0.5f;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
424 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
425
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
426 sf = PA_SAMPLE_FLOAT32NE;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
427 remap.format = &sf;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
428 iss.format = PA_SAMPLE_FLOAT32NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
429 iss.channels = 1;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
430 oss.format = PA_SAMPLE_FLOAT32NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
431 oss.channels = 2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
432 remap.i_ss = &iss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
433 remap.o_ss = &oss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
434 remap.map_table_f[0][0] = 1.0;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
435 remap.map_table_f[1][0] = 1.0;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
436
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
437 remap_mono_to_stereo_neon_a9(&remap, stereo_a9, mono, SAMPLES);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
438 remap_mono_to_stereo_neon_a8(&remap, stereo_a8, mono, SAMPLES);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
439 remap_mono_to_stereo_c(&remap, stereo_ref, mono, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
440 remap_channels_matrix_c(&remap, stereo_gen, mono, SAMPLES);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
441
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
442 for (i = 0; i < 2*SAMPLES; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
443 if (fabsf(stereo_a9[i] - stereo_ref[i]) > 0.00001) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
444 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
445 mono[i/2]);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
446 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
447 }
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
448 for (i = 0; i < 2*SAMPLES; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
449 if (fabsf(stereo_a8[i] - stereo_ref[i]) > 0.00001) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
450 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
451 mono[i/2]);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
452 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
453 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
454 for (i = 0; i < 2*SAMPLES; i++) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
455 if (fabsf(stereo_gen[i] - stereo_ref[i]) > 0.00001) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
456 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
457 mono[i/2]);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
458 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
459 }
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
460
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
461 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
462 for (i = 0; i < TIMES; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
463 remap_mono_to_stereo_c(&remap, stereo_ref, mono, SAMPLES);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
464 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
465 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
466 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
467
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
468 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
469 for (i = 0; i < TIMES; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
470 remap_mono_to_stereo_neon_a9(&remap, stereo_a9, mono, SAMPLES);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
471 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
472 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
473 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
474
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
475 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
476 for (i = 0; i < TIMES; i++) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
477 remap_mono_to_stereo_neon_a8(&remap, stereo_a8, mono, SAMPLES);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
478 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
479 stop = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
480 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
481
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
482 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
483 for (i = 0; i < TIMES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
484 remap_channels_matrix_c(&remap, stereo_gen, mono, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
485 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
486 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
487 pa_log_info("generic:\t%llu usec.", (long long unsigned int)(stop - start));
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
488 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
489
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
490 static void run_test_stereo_to_mono_float(void) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
491 float stereo[2*SAMPLES];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
492 float mono_ref[SAMPLES];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
493 float mono_gen[SAMPLES];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
494 float mono[SAMPLES];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
495 int i;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
496 pa_usec_t start, stop;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
497 pa_sample_format_t sf;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
498 pa_sample_spec iss, oss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
499 pa_remap_t remap;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
500
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
501 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
502
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
503 memset(mono_ref, 0, sizeof(mono_ref));
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
504 memset(mono, 0, sizeof(mono));
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
505
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
506 for (i = 0; i < 2*SAMPLES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
507 stereo[i] = rand()/(float) RAND_MAX - 0.5f;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
508 }
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 sf = PA_SAMPLE_FLOAT32NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
511 remap.format = &sf;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
512 iss.format = PA_SAMPLE_FLOAT32NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
513 iss.channels = 2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
514 oss.format = PA_SAMPLE_FLOAT32NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
515 oss.channels = 1;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
516 remap.i_ss = &iss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
517 remap.o_ss = &oss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
518 remap.map_table_f[0][0] = 1.0;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
519 remap.map_table_f[0][1] = 1.0;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
520
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
521 remap_stereo_to_mono_c(&remap, mono_ref, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
522 remap_channels_matrix_c(&remap, mono_gen, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
523 remap_stereo_to_mono_neon(&remap, mono, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
524
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
525 for (i = 0; i < SAMPLES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
526 if (fabsf(mono[i] - mono_ref[i]) > 0.00001) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
527 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
528 stereo[2*i+0], stereo[2*i+1]);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
529 }
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 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
533 for (i = 0; i < TIMES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
534 remap_stereo_to_mono_neon(&remap, mono, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
535 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
536 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
537 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
538
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
539 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
540 for (i = 0; i < TIMES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
541 remap_stereo_to_mono_c(&remap, mono_ref, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
542 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
543 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
544 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
545
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
546 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
547 for (i = 0; i < TIMES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
548 remap_channels_matrix_c(&remap, mono_gen, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
549 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
550 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
551 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
552 }
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 static void run_test_mono_to_stereo_s16(void) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
555 int16_t stereo_a9[2*SAMPLES];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
556 int16_t stereo_a8[2*SAMPLES];
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
557 int16_t stereo_ref[2*SAMPLES];
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
558 int16_t stereo_gen[2*SAMPLES];
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
559 int16_t mono[SAMPLES];
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
560 int i;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
561 pa_usec_t start, stop;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
562 pa_sample_format_t sf;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
563 pa_sample_spec iss, oss;
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
564 pa_remap_t remap;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
565
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
566 pa_log_debug("checking NEON remap_mono_to_stereo(s16, %d)", SAMPLES);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
567
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
568 memset(stereo_ref, 0, sizeof(stereo_ref));
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
569 memset(stereo_a9, 0, sizeof(stereo_a9));
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
570 memset(stereo_a8, 0, sizeof(stereo_a8));
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
571 memset(stereo_gen, 0, sizeof(stereo_gen));
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
572
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
573 for (i = 0; i < SAMPLES; i++) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
574 mono[i] = rand() - RAND_MAX/2;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
575 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
576
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
577 sf = PA_SAMPLE_S16NE;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
578 remap.format = &sf;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
579 iss.format = PA_SAMPLE_S16NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
580 iss.channels = 1;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
581 oss.format = PA_SAMPLE_S16NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
582 oss.channels = 2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
583 remap.i_ss = &iss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
584 remap.o_ss = &oss;
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
585 remap.map_table_i[0][0] = 0x10000;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
586 remap.map_table_i[1][0] = 0x10000;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
587
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
588 remap_mono_to_stereo_c(&remap, stereo_ref, mono, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
589 remap_channels_matrix_c(&remap, stereo_gen, mono, SAMPLES);
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
590 remap_mono_to_stereo_neon_a9(&remap, stereo_a9, mono, SAMPLES);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
591 remap_mono_to_stereo_neon_a8(&remap, stereo_a8, mono, SAMPLES);
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
592
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
593 for (i = 0; i < 2*SAMPLES; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
594 if (abs(stereo_a9[i] - stereo_ref[i]) > 0) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
595 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
596 mono[i/2]);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
597 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
598 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
599 for (i = 0; i < 2*SAMPLES; i++) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
600 if (abs(stereo_a8[i] - stereo_ref[i]) > 0) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
601 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
602 mono[i/2]);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
603 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
604 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
605
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
606 for (i = 0; i < 2*SAMPLES; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
607 if (abs(stereo_gen[i] - stereo_ref[i]) > 0) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
608 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
609 mono[i/2]);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
610 }
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
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
613 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
614 for (i = 0; i < TIMES; i++) {
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
615 remap_mono_to_stereo_neon_a9(&remap, stereo_a9, mono, SAMPLES);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
616 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
617 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
618 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
619
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
620 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
621 for (i = 0; i < TIMES; i++) {
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
622 remap_mono_to_stereo_neon_a8(&remap, stereo_a8, mono, SAMPLES);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
623 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
624 stop = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
625 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
626
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
627 start = pa_rtclock_now();
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
628 for (i = 0; i < TIMES; i++) {
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
629 remap_mono_to_stereo_c(&remap, stereo_ref, mono, SAMPLES);
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
630 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
631 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
632 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
633
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
634 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
635 for (i = 0; i < TIMES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
636 remap_channels_matrix_c(&remap, stereo_gen, mono, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
637 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
638 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
639 pa_log_info("generic:\t%llu usec.", (long long unsigned int)(stop - start));
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
640 }
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
641
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
642 static void run_test_stereo_to_mono_s16(void) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
643 int16_t stereo[2*SAMPLES];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
644 int16_t mono_ref[SAMPLES];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
645 int16_t mono_gen[SAMPLES];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
646 int16_t mono[SAMPLES];
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
647 int i;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
648 pa_usec_t start, stop;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
649 pa_sample_format_t sf;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
650 pa_sample_spec iss, oss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
651 pa_remap_t remap;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
652
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
653 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
654
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
655 memset(mono_ref, 0, sizeof(mono_ref));
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
656 memset(mono_gen, 0, sizeof(mono_gen));
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
657 memset(mono, 0, sizeof(mono));
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
658
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
659 for (i = 0; i < 2*SAMPLES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
660 stereo[i] = rand() - RAND_MAX/2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
661 }
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 sf = PA_SAMPLE_S16NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
664 remap.format = &sf;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
665 iss.format = PA_SAMPLE_S16NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
666 iss.channels = 2;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
667 oss.format = PA_SAMPLE_S16NE;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
668 oss.channels = 1;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
669 remap.i_ss = &iss;
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
670 remap.o_ss = &oss;
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
671 remap.map_table_i[0][0] = 0x10000;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
672 remap.map_table_i[0][1] = 0x10000;
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
673
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
674 remap_stereo_to_mono_c(&remap, mono_ref, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
675 remap_channels_matrix_c(&remap, mono_gen, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
676 remap_stereo_to_mono_neon(&remap, mono, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
677
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
678 for (i = 0; i < SAMPLES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
679 if (abs(mono[i] - mono_ref[i]) > 0) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
680 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
681 stereo[2*i+0], stereo[2*i+1]);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
682 }
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 for (i = 0; i < SAMPLES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
685 if (abs(mono[i] - mono_gen[i]) > 0) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
686 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
687 stereo[2*i+0], stereo[2*i+1]);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
688 }
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 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
692 for (i = 0; i < TIMES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
693 remap_stereo_to_mono_neon(&remap, mono, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
694 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
695 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
696 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
697
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
698 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
699 for (i = 0; i < TIMES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
700 remap_stereo_to_mono_c(&remap, mono_ref, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
701 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
702 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
703 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
704
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
705 start = pa_rtclock_now();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
706 for (i = 0; i < TIMES; i++) {
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
707 remap_channels_matrix_c(&remap, mono_gen, stereo, SAMPLES);
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
708 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
709 stop = pa_rtclock_now();
2
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 1
diff changeset
710 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
711 }
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
712
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
713 #endif /* defined(__arm__) */
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
714
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
715 int main() {
3
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
716
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
717 /* not in user space
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
718 unsigned cpuid;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
719 asm volatile(
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
720 "mrc p15, 0, %[cpuid], c0, c0, 0\n\t"
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
721 : [cpuid] "=r" (cpuid)
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
722 :
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
723 : "cc");
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
724
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
725 printf("%08x %03x\n", cpuid, (cpuid >> 4) & 0xfff);
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
726 */
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 2
diff changeset
727
1
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
728 run_test_stereo_to_mono_float();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
729 run_test_stereo_to_mono_s16();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
730
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
731 run_test_mono_to_stereo_float();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
732 run_test_mono_to_stereo_s16();
b829afbea564 more testing
Peter Meerwald <p.meerwald@bct-electronic.com>
parents: 0
diff changeset
733
0
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
734 return EXIT_SUCCESS;
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff changeset
735 }

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