Home
last modified time | relevance | path

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

12

/liblc3-latest/src/
Dfastmath.h46 union { float f; int32_t s; } x = { .f = _x }; in lc3_ldexpf() local
48 if (x.s & LC3_IEEE754_EXP_MASK) in lc3_ldexpf()
49 x.s += exp << LC3_IEEE754_EXP_SHL; in lc3_ldexpf()
51 return x.f; in lc3_ldexpf()
61 union { float f; uint32_t u; } x = { .f = _x }; in lc3_frexpf() local
63 int e = (x.u & LC3_IEEE754_EXP_MASK) >> LC3_IEEE754_EXP_SHL; in lc3_frexpf()
66 x.u = (x.u & ~LC3_IEEE754_EXP_MASK) | in lc3_frexpf()
69 return x.f; in lc3_frexpf()
77 static inline float lc3_exp2f(float x) in lc3_exp2f() argument
99 v.f = x + 0x1.8p20f; in lc3_exp2f()
[all …]
Dltpf.c214 struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) in resample_x64k_12k8() argument
218 x -= w - 1; in resample_x64k_12k8()
222 const int16_t *xn = x + (i / p); in resample_x64k_12k8()
259 struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) in resample_x192k_12k8() argument
263 x -= w - 1; in resample_x192k_12k8()
267 const int16_t *xn = x + (i / p); in resample_x192k_12k8()
304 struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) in resample_8k_12k8() argument
306 resample_x64k_12k8(8, h_8k_12k8_q15, hp50, x, y, n); in resample_8k_12k8()
320 struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n) in resample_16k_12k8() argument
322 resample_x64k_12k8(4, h_16k_12k8_q15, hp50, x, y, n); in resample_16k_12k8()
[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()
Dspec.c83 enum lc3_dt dt, enum lc3_srate sr, const float *x, in estimate_gain() argument
108 m0 += fabsf(x[4*i + 0]), m1 += fabsf(x[4*i + 0]) * k++; in estimate_gain()
109 m0 += fabsf(x[4*i + 1]), m1 += fabsf(x[4*i + 1]) * k++; in estimate_gain()
110 m0 += fabsf(x[4*i + 2]), m1 += fabsf(x[4*i + 2]) * k++; in estimate_gain()
111 m0 += fabsf(x[4*i + 3]), m1 += fabsf(x[4*i + 3]) * k++; in estimate_gain()
123 float x0 = x[4*i + 0] * x[4*i + 0]; in estimate_gain()
124 float x1 = x[4*i + 1] * x[4*i + 1]; in estimate_gain()
125 float x2 = x[4*i + 2] * x[4*i + 2]; in estimate_gain()
126 float x3 = x[4*i + 3] * x[4*i + 3]; in estimate_gain()
252 enum lc3_dt dt, enum lc3_srate sr, int g_int, float *x, int *n) in quantize() argument
[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 …]
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 …]
Denergy.c27 enum lc3_dt dt, enum lc3_srate sr, const float *x, float *e) in lc3_energy_compute() argument
43 float sx2 = x[i] * x[i]; in lc3_energy_compute()
45 sx2 += x[i] * x[i]; in lc3_energy_compute()
/liblc3-latest/tables/
Dfastmath.py22 def fast_exp2(x, t, p): argument
25 x = x.astype(np.float32)
27 m = ((x + 0.5/8) % (1/8)) - (0.5/8)
28 e = int((x - m) * 8)
37 x = np.arange(0, 1/8, step=1e-6)
38 p = np.polyfit(x, 2 ** x, 4)
41 x = np.arange(-10, 10, step=1e-3)
42 y = [ fast_exp2(x[i], t, p) for i in range(len(x)) ]
44 e = np.abs(y - 2**x) / (2 ** x)
55 ax1.plot(x, 2**x, label='Reference')
[all …]
/liblc3-latest/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-latest/test/
Ddecoder.py71 x = self.spec.decode(b, bw, len(data))
73 return (x, bw, pitch)
75 def synthesize(self, x, bw, pitch, nbytes): argument
77 x = self.tns.run(x, bw)
79 x = self.sns.run(x)
81 x = np.append(x, np.zeros(self.ns - self.ne))
82 x = self.mdct.run(x)
84 x = self.ltpf.run(x)
86 return x
90 (x, bw, pitch) = self.decode(data)
[all …]
Dspec.py76 def estimate_gain(self, x, nbytes, nbits_spec, nbits_off, g_off): argument
97 M0 = np.sum(np.abs(x)) + 1e-5
98 M1 = np.sum(np.arange(len(x)) * np.abs(x)) + 1e-5
102 nf = np.max(np.abs(x)) * np.exp2(-reg_bits - low_bits)
104 e = [ np.sum(x[4*k:4*(k+1)] ** 2) for k in range(len(x) // 4) ]
134 x_max = np.amax(np.abs(x))
149 def quantize(self, g_int, x): argument
151 xg = x / 10 ** (g_int / 28)
169 def compute_nbits(self, nbytes, x, lastnz, nbits_spec): argument
184 if n > len(x) // 2:
[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 …]
Dencoder.py51 def analyse(self, x, nbytes): argument
53 att = self.attdet.run(nbytes, x)
55 pitch_present = self.ltpf.run(x)
57 x = self.mdct.run(x)[:self.ne]
59 (e, nn_flag) = self.energy.compute(x)
65 x = self.sns.run(e, att, x)
67 x = self.tns.run(x, bw, nn_flag, nbytes)
69 (xq, lastnz, x) = self.spec.run(bw, nbytes,
71 self.sns.get_nbits(), self.tns.get_nbits(), x)
96 def run(self, x, nbytes): argument
[all …]
Dspec_py.c32 float *x; in estimate_gain_py() local
43 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in estimate_gain_py()
49 x, nbytes, nbits_budget, nbits_off, g_off, &reset_off, &g_min); in estimate_gain_py()
77 float *x; in quantize_py() local
89 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in quantize_py()
91 quantize(dt, sr, g_int, x, &nq); in quantize_py()
101 float *x; in compute_nbits_py() local
112 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in compute_nbits_py()
117 dt, sr, nbytes, x, &nq, nbits_budget, &lsb_mode); in compute_nbits_py()
131 float *x; in analyze_py() local
[all …]
Dtns.py150 def compute_lpc_coeffs(self, bw, f, x): argument
158 e = [ sum(x[S[s]:S[s+1]] ** 2) for s in range(len(S)-1) ]
161 c = [ np.dot(x[S[s]:S[s+1]-k], x[S[s]+k:S[s+1]])
212 def filtering(self, st, x, rc_order, rc): argument
214 y = np.empty(len(x))
216 for i in range(len(x)):
218 xi = x[i]
232 def run(self, x, bw, nn_flag, nbytes): argument
235 y = x.copy()
247 (pred_gain, a) = self.compute_lpc_coeffs(bw, f, x)
[all …]
Dmdct.py54 def run(self, x): argument
59 self.t[nd:nd+ns] = x
61 self.t[0:nd] = x[ns-nd:]
79 def run(self, x): argument
84 n = len(x)
86 x = np.append(x, -x[::-1])
87 z = x * np.exp(2j * np.pi * (n/2 + 0.5) * np.arange(2*n) / (2*n))
109 x = (2 * rng.random(ns)) - 1
115 y[0] = mdct.run(x)
116 y[1] = mdct.run(x)
[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()
Dsns_py.c120 float *scf_q, *x; in spectral_shaping_py() local
132 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in spectral_shaping_py()
134 spectral_shaping(dt, sr, scf_q, inv, x, x); in spectral_shaping_py()
145 float *eb, *x; in analyze_py() local
158 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in analyze_py()
160 lc3_sns_analyze(dt, sr, nbytes, eb, att, &data, x, x); in analyze_py()
170 float *x; in synthesize_py() local
181 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in synthesize_py()
183 lc3_sns_synthesize(dt, sr, &data, x, x); 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)
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)
160 x = np.append(np.zeros(6), C.X_PCM_ATT[i0][0])
161 f_att = lc3.attdet_run(dt, sr, C.NBYTES_ATT[i0], state, x)
164 x = np.append(x[-6:], C.X_PCM_ATT[i0][1])
[all …]
Dmdct_py.c30 float *x, *xd, *y, *d; in mdct_forward_py() local
40 CTYPES_CHECK("x", to_1d_ptr(x_obj, NPY_FLOAT, ns, &x)); in mdct_forward_py()
47 lc3_mdct_forward(dt, sr, sr, x, d, y); in mdct_forward_py()
56 float *x, *xd, *d, *y; in mdct_inverse_py() local
66 CTYPES_CHECK("x", to_1d_ptr(x_obj, NPY_FLOAT, ns, &x)); in mdct_inverse_py()
73 lc3_mdct_inverse(dt, sr, sr, x, d, y); in mdct_inverse_py()
Dtns_py.c30 float *x, *g, (*a)[9]; in compute_lpc_coeffs_py() local
41 CTYPES_CHECK("x", to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in compute_lpc_coeffs_py()
46 compute_lpc_coeffs(dt, bw, maxorder, x, g, a); in compute_lpc_coeffs_py()
119 float *x; in analyze_py() local
130 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in analyze_py()
132 lc3_tns_analyze(dt, bw, nn_flag, nbytes, &data, x); in analyze_py()
142 float *x; in synthesize_py() local
153 CTYPES_CHECK("x", x_obj = to_1d_ptr(x_obj, NPY_FLOAT, ne, &x)); in synthesize_py()
155 lc3_tns_synthesize(dt, bw, &data, x); in synthesize_py()
/liblc3-latest/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-latest/wasm/
Dmath.h27 static inline float roundf(float x) in roundf() argument
28 { return x >= 0 ? truncf(x + 0.5f) : truncf(x - 0.5f); } in roundf()

12