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
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
13 typedef short int16_t;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
14 typedef void (*pa_convert_func_t)(unsigned n, const void *a, void *b);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
15 typedef long long unsigned int pa_usec_t;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
16
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
17 #define pa_assert(x) assert(x)
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
18
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
19 #define PA_CLAMP_UNLIKELY(x, low, high) \
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
20 (((x) < (low)) ? (low) : (((x) > (high)) ? (high) : (x)))
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
21
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
22 static void pa_log_info(const char *format, ...) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
23 va_list ap;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
24 char buf[1024];
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
25 va_start(ap, format);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
26 vsprintf(buf, format, ap);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
27 printf("%s\n", buf);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
28 va_end(ap);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
29 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
30
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
31 #define pa_log_debug pa_log_info
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
32
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
33 static pa_usec_t pa_rtclock_now() {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
34 struct timeval tv;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
35 gettimeofday(&tv, NULL);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
36
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
37 return tv.tv_sec * 1000000ULL + tv.tv_usec;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
38 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
39
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
40 #if defined(__arm__)
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
41
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
42 #include "arm_neon.h"
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
43
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
44 void pa_sconv_s16le_from_float32ne(unsigned n, const float *a, int16_t *b) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
45 pa_assert(a);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
46 pa_assert(b);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
47
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
48 for (; n > 0; n--) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
49 float v = *(a++);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
50
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
51 v = PA_CLAMP_UNLIKELY(v, -1.0f, 1.0f);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
52 *(b++) = (int16_t) lrintf(v * 0x7FFF);
|
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
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
56 void pa_sconv_s16le_from_f32ne_neon(unsigned n, const float *a, int16_t *b) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
57 unsigned i;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
58
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
59 const float32x4_t plusone4 = vdupq_n_f32(1.0f);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
60 const float32x4_t minusone4 = vdupq_n_f32(-1.0f);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
61 const float32x4_t half4 = vdupq_n_f32(0.5f);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
62 const float32x4_t scale4 = vdupq_n_f32(32767.0f);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
63 const uint32x4_t mask4 = vdupq_n_u32(0x80000000);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
64
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
65 for (i = 0; i < n/4; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
66 float32x4_t v4 = ((float32x4_t *)a)[i];
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
67 v4 = vmulq_f32(vmaxq_f32(vminq_f32(v4, plusone4) , minusone4), scale4);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
68
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
69 const float32x4_t w4 = vreinterpretq_f32_u32(vorrq_u32(vandq_u32(
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
70 vreinterpretq_u32_f32(v4), mask4), vreinterpretq_u32_f32(half4)));
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
71
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
72 ((int16x4_t *)b)[i] = vmovn_s32(vcvtq_s32_f32(vaddq_f32(v4, w4)));
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
73 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
74
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
75 // leftovers
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
76 for (i = n & ~3; i < n; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
77 b[i] = (int16_t) lrintf(PA_CLAMP_UNLIKELY(a[i], -1.0f, 1.0f) * 0x7FFF);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
78 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
79 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
80
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
81 void pa_sconv_s16le_to_float32ne(unsigned n, const int16_t *a, float *b) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
82 pa_assert(a);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
83 pa_assert(b);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
84
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
85 for (; n > 0; n--)
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
86 *(b++) = ((float) (*(a++)))/(float) 0x7FFF;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
87 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
88
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
89 void pa_sconv_s16le_to_f32ne_neon(unsigned n, const int16_t *a, float *b) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
90 unsigned i;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
91
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
92 const float32x4_t invscale4 = vdupq_n_f32(1.0f / 0x7FFF);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
93
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
94 for (i = 0; i < n/4; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
95 ((float32x4_t *)b)[i] = vmulq_f32(vcvtq_f32_s32(vmovl_s16(((int16x4_t *)a)[i])), invscale4);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
96 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
97
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
98 // leftovers
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
99 const float invscale = 1.0f / 0x7FFF;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
100 for (i = n & ~3; i < n; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
101 b[i] = a[i] * invscale;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
102 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
103 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
104
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
105 #define SAMPLES 1019
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
106 #define TIMES 300
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
107
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
108 static void run_test_from(void) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
109 int16_t samples[SAMPLES];
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
110 int16_t samples_ref[SAMPLES];
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
111 float floats[SAMPLES];
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
112 int i;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
113 pa_usec_t start, stop;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
114 pa_convert_func_t func;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
115
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
116 pa_log_debug("checking NEON sconv_s16le_from_float(%d)", SAMPLES);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
117
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
118 memset(samples_ref, 0, sizeof(samples_ref));
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
119 memset(samples, 0, sizeof(samples));
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
120
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
121 for (i = 0; i < SAMPLES; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
122 floats[i] = 2.1f * (rand()/(float) RAND_MAX - 0.5f);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
123 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
124
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
125 func = (pa_convert_func_t) pa_sconv_s16le_from_float32ne;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
126 func(SAMPLES, floats, samples_ref);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
127 pa_sconv_s16le_from_f32ne_neon(SAMPLES, floats, samples);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
128
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
129 for (i = 0; i < SAMPLES; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
130 if (abs(samples[i] - samples_ref[i]) > 0) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
131 pa_log_debug("%d: %d != %d (%f)", i, samples[i], samples_ref[i],
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
132 floats[i]);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
133 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
134 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
135
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
136 start = pa_rtclock_now();
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
137 for (i = 0; i < TIMES; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
138 pa_sconv_s16le_from_f32ne_neon(SAMPLES, floats, samples);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
139 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
140 stop = pa_rtclock_now();
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
141 pa_log_info("NEON: %llu usec.", (long long unsigned int)(stop - start));
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
142
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
143 start = pa_rtclock_now();
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
144 for (i = 0; i < TIMES; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
145 func(SAMPLES, floats, samples_ref);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
146 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
147 stop = pa_rtclock_now();
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
148 pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start));
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
149 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
150
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
151 static void run_test_to(void) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
152 int16_t samples[SAMPLES];
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
153 float floats[SAMPLES];
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
154 float floats_ref[SAMPLES];
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
155 int i;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
156 pa_usec_t start, stop;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
157 pa_convert_func_t func;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
158
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
159 pa_log_debug("checking NEON sconv_s16le_to_float(%d)", SAMPLES);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
160
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
161 memset(floats_ref, 0, sizeof(floats_ref));
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
162 memset(floats, 0, sizeof(float));
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
163
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
164 for (i = 0; i < SAMPLES; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
165 samples[i] = rand() - RAND_MAX/2;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
166 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
167
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
168 func = (pa_convert_func_t) pa_sconv_s16le_to_float32ne;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
169 func(SAMPLES, samples, floats_ref);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
170 pa_sconv_s16le_to_f32ne_neon(SAMPLES, samples, floats);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
171
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
172 for (i = 0; i < SAMPLES; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
173 if (fabsf(floats[i] - floats_ref[i]) > 0.00001) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
174 pa_log_debug("%d: %.8f != %.8f (%d)", i, floats[i], floats_ref[i],
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
175 samples[i]);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
176 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
177 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
178
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
179 start = pa_rtclock_now();
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
180 for (i = 0; i < TIMES; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
181 pa_sconv_s16le_to_f32ne_neon(SAMPLES, samples, floats);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
182 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
183 stop = pa_rtclock_now();
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
184 pa_log_info("NEON: %llu usec.", (long long unsigned int)(stop - start));
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
185
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
186 start = pa_rtclock_now();
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
187 for (i = 0; i < TIMES; i++) {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
188 func(SAMPLES, samples, floats_ref);
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
189 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
190 stop = pa_rtclock_now();
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
191 pa_log_info("ref: %llu usec.", (long long unsigned int)(stop - start));
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
192 }
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
193
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
194 #endif /* defined(__arm__) */
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
195
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
196 int main() {
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
197
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
198 run_test_from();
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
199 run_test_to();
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
200
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
201 return EXIT_SUCCESS;
|
Peter Meerwald <p.meerwald@bct-electronic.com>
parents:
diff
changeset
|
202 }
|