Home
last modified time | relevance | path

Searched refs:x (Results 1 – 25 of 44) sorted by relevance

12

/liblc3-3.5.0-3.4.0/tables/
Dfastmath.py22 def fast_exp2(x, p): argument
25 x = x.astype(np.float32)
27 y = (((((p[0]*x) + p[1])*x + p[2])*x + p[3])*x + p[4])*x + 1
33 x = np.arange(-8, 8, step=1e-3)
35 p = np.polyfit(x, ((2 ** (x/16)) - 1) / x, 4)
36 y = [ fast_exp2(x[i], p) for i in range(len(x)) ]
37 e = np.abs(y - 2**x) / (2 ** x)
47 ax1.plot(x, 2**x, label='Reference')
48 ax1.plot(x, y, label='Approximation')
51 ax2.plot(x, e, label='Relative Error')
[all …]
/liblc3-3.5.0-3.4.0/src/
Dfastmath.h35 static inline float fast_exp2f(float x) in fast_exp2f() argument
44 y = ( c[0]) * x; in fast_exp2f()
45 y = (y + c[1]) * x; in fast_exp2f()
46 y = (y + c[2]) * x; in fast_exp2f()
47 y = (y + c[3]) * x; in fast_exp2f()
48 y = (y + c[4]) * x; in fast_exp2f()
66 static inline float fast_log2f(float x) in fast_log2f() argument
76 x = frexpf(x, &e); in fast_log2f()
78 y = ( c[0]) * x; in fast_log2f()
79 y = (y + c[1]) * x; in fast_log2f()
[all …]
Dattdet.c26 int nbytes, struct lc3_attdet_analysis *attdet, const int16_t *x) in lc3_attdet_run() argument
49 int16_t xn2 = (x[-4] + x[-3]) >> 1; in lc3_attdet_run()
50 int16_t xn1 = (x[-2] + x[-1]) >> 1; in lc3_attdet_run()
53 for (int j = 0; j < 40; j++, x += 2, xn2 = xn1, xn1 = xn) { in lc3_attdet_run()
54 xn = (x[0] + x[1]) >> 1; in lc3_attdet_run()
61 int16_t xn2 = (x[-6] + x[-5] + x[-4]) >> 2; in lc3_attdet_run()
62 int16_t xn1 = (x[-3] + x[-2] + x[-1]) >> 2; in lc3_attdet_run()
65 for (int j = 0; j < 40; j++, x += 3, xn2 = xn1, xn1 = xn) { in lc3_attdet_run()
66 xn = (x[0] + x[1] + x[2]) >> 2; in lc3_attdet_run()
Dltpf.c184 struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) in resample_x64k_12k8() argument
188 x -= w - 1; in resample_x64k_12k8()
192 const int16_t *xn = x + (i / p); in resample_x64k_12k8()
228 struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) in resample_x192k_12k8() argument
232 x -= w - 1; in resample_x192k_12k8()
236 const int16_t *xn = x + (i / p); in resample_x192k_12k8()
273 struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) in resample_8k_12k8() argument
275 resample_x64k_12k8(8, h_8k_12k8_q15, hp50, x, y, n); in resample_8k_12k8()
289 struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) in resample_16k_12k8() argument
291 resample_x64k_12k8(4, h_16k_12k8_q15, hp50, x, y, n); in resample_16k_12k8()
[all …]
Dspec.c50 enum lc3_dt dt, enum lc3_srate sr, const float *x, in estimate_gain() argument
60 for (int i = 0; i < ne; i++, x += 4) { in estimate_gain()
61 float x0 = x[0] * x[0]; in estimate_gain()
62 float x1 = x[1] * x[1]; in estimate_gain()
63 float x2 = x[2] * x[2]; in estimate_gain()
64 float x3 = x[3] * x[3]; in estimate_gain()
209 int g_int, float *x, uint16_t *xq, int *nq) in quantize() argument
219 x[i+0] *= g_inv; in quantize()
220 x[i+1] *= g_inv; in quantize()
222 x0 = fminf(fabsf(x[i+0]) + 6.f/16, INT16_MAX); in quantize()
[all …]
Dmdct.c36 const struct lc3_complex *x, struct lc3_complex *y, int n) in fft_5() argument
44 for (int i = 0; i < n; i++, x++, y+= 5) { in fft_5()
47 { x[1*n].re + x[4*n].re, x[1*n].im + x[4*n].im }; in fft_5()
49 { x[1*n].re - x[4*n].re, x[1*n].im - x[4*n].im }; in fft_5()
52 { x[2*n].re + x[3*n].re, x[2*n].im + x[3*n].im }; in fft_5()
54 { x[2*n].re - x[3*n].re, x[2*n].im - x[3*n].im }; in fft_5()
56 y[0].re = x[0].re + s14.re + s23.re; in fft_5()
58 y[0].im = x[0].im + s14.im + s23.im; in fft_5()
60 y[1].re = x[0].re + s14.re * cos1 - d14.im * sin1 in fft_5()
63 y[1].im = x[0].im + s14.im * cos1 + d14.re * sin1 in fft_5()
[all …]
Denergy.c27 enum lc3_dt dt, enum lc3_srate sr, const float *x, float *e) in lc3_energy_compute() argument
41 *e = x[iband] * x[iband]; in lc3_energy_compute()
56 float sx2 = x[i] * x[i]; in lc3_energy_compute()
58 sx2 += x[i] * x[i]; in lc3_energy_compute()
Dltpf_arm.h49 struct lc3_ltpf_hp50_state *hp50, const int16x2_t *x, int16_t *y, int n) in arm_resample_x64k_12k8() argument
53 x -= w; in arm_resample_x64k_12k8()
57 const int16x2_t *xn = x + (i / (2*p)); in arm_resample_x64k_12k8()
80 struct lc3_ltpf_hp50_state *hp50, const int16x2_t *x, int16_t *y, int n) in arm_resample_x192k_12k8() argument
84 x -= w; in arm_resample_x192k_12k8()
88 const int16x2_t *xn = x + (i / (2*p)); in arm_resample_x192k_12k8()
122 struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) in arm_resample_8k_12k8() argument
144 8, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n); in arm_resample_8k_12k8()
159 struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) in arm_resample_16k_12k8() argument
202 4, (const int16x2_t *)h, hp50, (int16x2_t *)x, y, n); in arm_resample_16k_12k8()
[all …]
/liblc3-3.5.0-3.4.0/test/neon/
Dltpf_neon.c40 int16_t __x[60+480], *x = __x + 60; in check_resampler() local
42 x[i] = rand() & 0xffff; in check_resampler()
47 resample_16k_12k8(&hp50, x, y, 128); in check_resampler()
48 neon_resample_16k_12k8(&hp50_neon, x, y_neon, 128); in check_resampler()
52 resample_32k_12k8(&hp50, x, y, 128); in check_resampler()
53 neon_resample_32k_12k8(&hp50_neon, x, y_neon, 128); in check_resampler()
57 resample_48k_12k8(&hp50, x, y, 128); in check_resampler()
58 neon_resample_48k_12k8(&hp50_neon, x, y_neon, 128); in check_resampler()
67 int16_t x[200]; in check_dot() local
69 x[i] = rand() & 0xffff; in check_dot()
[all …]
Dmdct_neon.c34 struct lc3_complex x[240]; in check_fft() local
38 x[i].re = (double)rand() / RAND_MAX; in check_fft()
39 x[i].im = (double)rand() / RAND_MAX; in check_fft()
42 fft_5(x, y, 240/5); in check_fft()
43 neon_fft_5(x, y_neon, 240/5); in check_fft()
49 fft_bf3(lc3_fft_twiddles_bf3[0], x, y, 240/15); in check_fft()
50 neon_fft_bf3(lc3_fft_twiddles_bf3[0], x, y_neon, 240/15); in check_fft()
56 fft_bf2(lc3_fft_twiddles_bf2[0][1], x, y, 240/30); in check_fft()
57 neon_fft_bf2(lc3_fft_twiddles_bf2[0][1], x, y_neon, 240/30); in check_fft()
/liblc3-3.5.0-3.4.0/test/arm/
Dltpf_arm.c40 int16_t __x[60+480], *x = __x + 60; in check_resampler() local
42 x[i] = rand() & 0xffff; in check_resampler()
47 resample_8k_12k8(&hp50, x, y, 128); in check_resampler()
48 arm_resample_8k_12k8(&hp50_arm, x, y_arm, 128); in check_resampler()
52 resample_16k_12k8(&hp50, x, y, 128); in check_resampler()
53 arm_resample_16k_12k8(&hp50_arm, x, y_arm, 128); in check_resampler()
57 resample_24k_12k8(&hp50, x, y, 128); in check_resampler()
58 arm_resample_24k_12k8(&hp50_arm, x, y_arm, 128); in check_resampler()
62 resample_32k_12k8(&hp50, x, y, 128); in check_resampler()
63 arm_resample_32k_12k8(&hp50_arm, x, y_arm, 128); in check_resampler()
[all …]
/liblc3-3.5.0-3.4.0/test/
Dspec.py73 def estimate_gain(self, x, nbits_spec, nbits_off, g_off): argument
79 e = [ np.sum(x[4*k:4*(k+1)] ** 2) for k in range(len(x) // 4) ]
109 x_max = np.amax(np.abs(x))
123 def quantize(self, g_int, x): argument
125 xg = x / 10 ** (g_int / 28)
138 def compute_nbits(self, nbytes, x, lastnz, nbits_spec): argument
151 if n > len(x) // 2:
154 a = abs(x[n ])
155 b = abs(x[n+1])
172 a_lsb = abs(x[n ])
[all …]
Ddecoder.py74 x = self.spec.decode(b, bw, len(data))
76 return (x, bw, pitch)
78 def synthesize(self, x, bw, pitch, nbytes): argument
80 x = self.tns.run(x, bw)
82 x = self.sns.run(x)
84 x = np.append(x, np.zeros(self.ns - self.ne))
85 x = self.mdct.run(x)
87 x = self.ltpf.run(x, len(data))
89 return x
93 (x, bw, pitch) = self.decode(data)
[all …]
Dltpf.py36 self.x = np.zeros(self.w + T.NS[dt][sr])
40 def resample(self, x): argument
49 self.x[:w] = self.x[-w:]
50 self.x[w:] = x
59 x = self.x
72 u[2+i] = p * np.dot( x[e:e+w+1], np.take(h, k) )
93 self.x = np.zeros(n + 5)
98 def resample(self, x): argument
104 self.x[:3] = self.x[-5:-2]
105 self.x[3:] = x[:2*n+2]
[all …]
Dtns.py103 def compute_lpc_coeffs(self, bw, f, x): argument
110 e = [ sum(x[S[s]:S[s+1]] ** 2) for s in range(3) ]
113 c = [ np.dot(x[S[s]:S[s+1]-k], x[S[s]+k:S[s+1]])
163 def filtering(self, st, x, rc_order, rc): argument
165 y = np.empty(len(x))
167 for i in range(len(x)):
169 xi = x[i]
183 def run(self, x, bw, nn_flag, nbytes): argument
186 y = x.copy()
195 (pred_gain, a) = self.compute_lpc_coeffs(bw, f, x)
[all …]
Dmdct.py45 def run(self, x): argument
50 self.t[nd:nd+ns] = x
52 self.t[0:nd] = x[ns-nd:]
70 def run(self, x): argument
75 n = len(x)
77 x = np.append(x, -x[::-1])
78 z = x * np.exp(2j * np.pi * (n/2 + 0.5) * np.arange(2*n) / (2*n))
100 x = (2 * rng.random(ns)) - 1
106 y[0] = mdct.run(x)
107 y[1] = mdct.run(x)
[all …]
Dencoder.py54 def analyse(self, x, nbytes): argument
56 att = self.attdet.run(nbytes, x)
58 pitch_present = self.ltpf.run(x)
60 x = self.mdct.run(x)[:self.ne]
62 (e, nn_flag) = self.energy.compute(x)
68 x = self.sns.run(e, att, x)
70 x = self.tns.run(x, bw, nn_flag, nbytes)
72 (xq, lastnz, x) = self.spec.run(bw, nbytes,
74 self.sns.get_nbits(), self.tns.get_nbits(), x)
99 def run(self, x, nbytes): argument
[all …]
Dltpf_py.c30 int16_t *x, *y; in resample_py() local
43 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_INT16, ns+nt, &x)); in resample_py()
46 resample_12k8[sr](&hp50, x + nt, y + (ny - n), n); in resample_py()
58 int16_t *x; in analyse_py() local
69 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_INT16, ns+nt, &x)); in analyse_py()
72 lc3_ltpf_analyse(dt, sr, &ltpf, x + nt, &data); in analyse_py()
86 float *x; in synthesize_py() local
102 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, nd+ns, &x)); in synthesize_py()
105 &ltpf, pitch_present ? &data : NULL, x, x + nd); in synthesize_py()
Denergy.py31 def compute(self, x): argument
33 e = [ np.mean(np.square(x[self.I[i]:self.I[i+1]]))
50 x = (2 * rng.random(T.NS[dt][sr])) - 1
52 (e , nn ) = nrg.compute(x)
53 (e_c, nn_c) = lc3.energy_compute(dt, sr, x)
56 x[15*ns//16:] *= 1e2;
58 (e , nn ) = nrg.compute(x)
59 (e_c, nn_c) = lc3.energy_compute(dt, sr, x)
Dsns_py.c119 float *scf_q, *x; in spectral_shaping_py() local
131 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in spectral_shaping_py()
133 spectral_shaping(dt, sr, scf_q, inv, x, x); in spectral_shaping_py()
143 float *eb, *x; in analyze_py() local
156 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in analyze_py()
158 lc3_sns_analyze(dt, sr, eb, att, &data, x, x); in analyze_py()
168 float *x; in synthesize_py() local
179 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in synthesize_py()
181 lc3_sns_synthesize(dt, sr, &data, x, x); in synthesize_py()
Dattdet.py55 def run(self, nbytes, x): argument
61 r = len(x) // mf
62 x_att = np.array([ np.sum(x[i*r:(i+1)*r]) for i in range(mf) ])
135 x = ((2 * rng.random(ns)) - 1) * (2 ** 8 - 1)
136 x[(ns * rng.random()).astype(int)] *= 2 ** 7
140 f_att = attdet.run(100, x)
142 x_c = np.append(x_c[-6:], x)
158 x = np.append(np.zeros(6), C.X_PCM_ATT[dt][0])
159 f_att = lc3.attdet_run(dt, sr, C.NBYTES_ATT[dt], state, x)
162 x = np.append(x[-6:], C.X_PCM_ATT[dt][1])
[all …]
Dspec_py.c30 float *x; in estimate_gain_py() local
45 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in estimate_gain_py()
48 x, nbits_budget, nbits_off, g_off, &reset_off); in estimate_gain_py()
73 float *x; in quantize_py() local
86 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in quantize_py()
91 quantize(dt, sr, g_int, x, __xq, &nq); in quantize_py()
136 float *x; in analyze_py() local
150 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in analyze_py()
155 lc3_spec_analyze(dt, sr, nbytes, pitch, &tns, &spec, x, __xq, &side); in analyze_py()
169 float *x; in estimate_noise_py() local
[all …]
Dsns.py53 def spectral_shaping(self, scf, inv, x): argument
67 n2 = 64 - min(len(x), 64)
77 y = np.empty(len(x))
81 y[I[b]:I[b+1]] = x[I[b]:I[b+1]] * g_sns[b]
154 x = 0
163 index += T.SNS_MPVQ_OFFSETS[n][x]
164 x += abs(vn)
184 x = np.abs(t2_rot)
191 y3 = np.floor(x * proj_fac).astype(int)
195 corr_xy = np.sum(y3 * x)
[all …]
Dtns_py.c30 float *x, *g, (*a)[9]; in compute_lpc_coeffs_py() local
40 CTYPES_CHECK("x", to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in compute_lpc_coeffs_py()
45 compute_lpc_coeffs(dt, bw, x, g, a); in compute_lpc_coeffs_py()
110 float *x; in analyze_py() local
120 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in analyze_py()
122 lc3_tns_analyze(dt, bw, nn_flag, nbytes, &data, x); in analyze_py()
132 float *x; in synthesize_py() local
143 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in synthesize_py()
145 lc3_tns_synthesize(dt, bw, &data, x); in synthesize_py()
Dmdct_py.c31 float *x, *xd, *y, *d; in mdct_forward_py() local
41 CTYPES_CHECK("x", to_1d_ptr(x_obj, NPY_FLOAT, ns, &x)); in mdct_forward_py()
48 lc3_mdct_forward(dt, sr, sr, x, d, y); in mdct_forward_py()
58 float *x, *xd, *d, *y; in mdct_inverse_py() local
68 CTYPES_CHECK("x", to_1d_ptr(x_obj, NPY_FLOAT, ns, &x)); in mdct_inverse_py()
75 lc3_mdct_inverse(dt, sr, sr, x, d, y); in mdct_inverse_py()

12