/liblc3-3.5.0-3.4.0/test/ |
D | bwdet.py | 43 def __init__(self, dt, sr): argument 46 self.sr = sr 51 sr = self.sr 57 for bw in range(sr): 58 i0 = BW_START[dt][sr][bw] 59 i1 = BW_STOP[dt][sr][bw] 67 if bw0 < sr: 69 i0 = BW_START[dt][sr][bw0] - l 70 i1 = BW_START[dt][sr][bw0] 74 bw = sr [all …]
|
D | mdct_py.c | 30 enum lc3_srate sr; in mdct_forward_py() local 33 if (!PyArg_ParseTuple(args, "iiOO", &dt, &sr, &x_obj, &xd_obj)) in mdct_forward_py() 37 CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); in mdct_forward_py() 39 int ns = LC3_NS(dt, sr), nd = LC3_ND(dt, sr); in mdct_forward_py() 48 lc3_mdct_forward(dt, sr, sr, x, d, y); in mdct_forward_py() 57 enum lc3_srate sr; in mdct_inverse_py() local 60 if (!PyArg_ParseTuple(args, "iiOO", &dt, &sr, &x_obj, &xd_obj)) in mdct_inverse_py() 64 CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); in mdct_inverse_py() 66 int ns = LC3_NS(dt, sr), nd = LC3_ND(dt, sr); in mdct_inverse_py() 75 lc3_mdct_inverse(dt, sr, sr, x, d, y); in mdct_inverse_py()
|
D | mdct.py | 30 def __init__(self, dt, sr): argument 32 self.ns = T.NS[dt][sr] 33 self.nd = T.ND[dt][sr] 36 self.w = Mdct.W[dt][sr] 41 def __init__(self, dt, sr): argument 43 super().__init__(dt, sr) 66 def __init__(self, dt, sr): argument 68 super().__init__(dt, sr) 94 def check_forward_unit(rng, dt, sr): argument 96 ns = T.NS[dt][sr] [all …]
|
D | spec_py.c | 29 unsigned dt, sr; in estimate_gain_py() local 36 if (!PyArg_ParseTuple(args, "IIOifi", &dt, &sr, in estimate_gain_py() 41 CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); in estimate_gain_py() 43 int ne = LC3_NE(dt, sr); in estimate_gain_py() 47 int g_int = estimate_gain(dt, sr, in estimate_gain_py() 55 unsigned sr; in adjust_gain_py() local 58 if (!PyArg_ParseTuple(args, "Iiii", &sr, &g_idx, &nbits, &nbits_budget)) in adjust_gain_py() 61 CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); in adjust_gain_py() 64 g_idx = adjust_gain(sr, g_idx, nbits, nbits_budget); in adjust_gain_py() 72 unsigned dt, sr; in quantize_py() local [all …]
|
D | ltpf_py.c | 27 unsigned dt, sr; in resample_py() local 32 if (!PyArg_ParseTuple(args, "IIOOO", &dt, &sr, &hp50_obj, &x_obj, &y_obj)) in resample_py() 36 CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); in resample_py() 39 int ns = LC3_NS(dt, sr), nt = LC3_NT(dt); in resample_py() 46 resample_12k8[sr](&hp50, x + nt, y + (ny - n), n); in resample_py() 55 unsigned dt, sr; in analyse_py() local 60 if (!PyArg_ParseTuple(args, "IIOO", &dt, &sr, <pf_obj, &x_obj)) in analyse_py() 64 CTYPES_CHECK("sr", sr < LC3_NUM_SRATE); in analyse_py() 67 int ns = LC3_NS(dt, sr), nt = LC3_NT(sr); in analyse_py() 72 lc3_ltpf_analyse(dt, sr, <pf, x + nt, &data); in analyse_py() [all …]
|
D | energy.py | 26 def __init__(self, dt, sr): argument 29 self.I = T.I[dt][sr] 43 def check_unit(rng, dt, sr): argument 45 ns = T.NS[dt][sr] 48 nrg = EnergyBand(dt, sr) 50 x = (2 * rng.random(T.NS[dt][sr])) - 1 53 (e_c, nn_c) = lc3.energy_compute(dt, sr, x) 59 (e_c, nn_c) = lc3.energy_compute(dt, sr, x) 66 sr = T.SRATE_16K 69 e = lc3.energy_compute(dt, sr, C.X[dt][0])[0] [all …]
|
D | sns_py.c | 28 unsigned dt, sr; in compute_scale_factors_py() local 33 if (!PyArg_ParseTuple(args, "IIOp", &dt, &sr, &eb_obj, &att)) in compute_scale_factors_py() 37 CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); in compute_scale_factors_py() 39 int nb = LC3_MIN(lc3_band_lim[dt][sr][LC3_NUM_BANDS], LC3_NUM_BANDS); in compute_scale_factors_py() 44 compute_scale_factors(dt, sr, eb, att, scf); in compute_scale_factors_py() 118 unsigned dt, sr; in spectral_shaping_py() local 122 if (!PyArg_ParseTuple(args, "IIOpO", &dt, &sr, &scf_q_obj, &inv, &x_obj)) in spectral_shaping_py() 126 CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); in spectral_shaping_py() 128 int ne = LC3_NE(dt, sr); in spectral_shaping_py() 133 spectral_shaping(dt, sr, scf_q, inv, x, x); in spectral_shaping_py() [all …]
|
D | attdet.py | 27 def __init__(self, dt, sr): argument 30 self.sr = sr 42 self.sr == T.SRATE_32K and nbytes > 80 45 self.sr >= T.SRATE_48K and nbytes >= 100 48 self.sr == T.SRATE_32K and nbytes >= 61 and nbytes < 150 51 self.sr >= T.SRATE_48K and nbytes >= 75 and nbytes < 150 108 for sr in range(T.SRATE_16K, T.NUM_SRATE): 110 attdet = AttackDetector(dt, sr) 114 f_att = lc3.attdet_run(dt, sr, nbytes, 115 initial_state(), 2 * rng.random(T.NS[dt][sr]+6) - 1) [all …]
|
D | spec.py | 31 def __init__(self, dt, sr): argument 34 self.sr = sr 38 g_off = (nbytes * 8) // (10 * (1 + self.sr)) 39 g_off = -min(115, g_off) - (105 + 5*(1 + self.sr)) 60 def __init__(self, dt, sr): argument 62 super().__init__(dt, sr) 140 mode = 1 if nbytes >= 20 * (3 + self.sr) else 0 141 rate = 512 if nbytes > 20 * (1 + self.sr) else 0 203 sr = self.sr 205 if nbits < T1[sr]: [all …]
|
D | ltpf.py | 27 def __init__(self, dt, sr, history = 0): argument 29 self.sr = sr 30 self.p = 192 // T.SRATE_KHZ[sr] 36 self.x = np.zeros(self.w + T.NS[dt][sr]) 74 if self.sr == T.SRATE_8K: 129 def __init__(self, dt, sr): argument 132 self.sr = sr 139 def __init__(self, dt, sr): argument 141 super().__init__(dt, sr) 144 dt, sr, history = 232) [all …]
|
D | energy_py.c | 30 unsigned dt, sr; in energy_compute_py() local 34 if (!PyArg_ParseTuple(args, "IIO", &dt, &sr, &x_obj)) in energy_compute_py() 38 CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); in energy_compute_py() 40 int ns = LC3_NS(dt, sr); in energy_compute_py() 45 int nn_flag = lc3_energy_compute(dt, sr, x, e); in energy_compute_py()
|
D | attdet_py.c | 27 unsigned dt, sr, nbytes; in attdet_run_py() local 33 &dt, &sr, &nbytes, &attdet_obj, &x_obj)) in attdet_run_py() 37 CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); in attdet_run_py() 40 int ns = LC3_NS(dt, sr); in attdet_run_py() 44 int att = lc3_attdet_run(dt, sr, nbytes, &attdet, x+6); in attdet_run_py()
|
D | bwdet_py.c | 27 unsigned dt, sr; in bwdet_run_py() local 31 if (!PyArg_ParseTuple(args, "IIO", &dt, &sr, &e_obj)) in bwdet_run_py() 35 CTYPES_CHECK("sr", (unsigned)sr < LC3_NUM_SRATE); in bwdet_run_py() 38 int bw = lc3_bwdet_run(dt, sr, e); in bwdet_run_py()
|
D | decoder.py | 38 sr = { 8000: T.SRATE_8K , 16000: T.SRATE_16K, 24000: T.SRATE_24K, 41 self.sr = sr 42 self.ne = T.NE[dt][sr] 43 self.ns = T.NS[dt][sr] 45 self.mdct = mdct.MdctInverse(dt, sr) 47 self.bwdet = bwdet.BandwidthDetector(dt, sr) 48 self.spec = spec.SpectrumSynthesis(dt, sr) 50 self.sns = sns.SnsSynthesis(dt, sr) 51 self.ltpf = ltpf.LtpfSynthesis(dt, sr) 58 if bw > self.sr:
|
D | sns.py | 27 def __init__(self, dt, sr): argument 30 self.sr = sr 78 I = T.I[self.dt][self.sr] 88 def __init__(self, dt, sr): argument 90 super().__init__(dt, sr) 113 g_tilt = [ 14, 18, 22, 26, 30 ][self.sr] 342 def __init__(self, dt, sr): argument 344 super().__init__(dt, sr) 460 def check_analysis(rng, dt, sr): argument 464 analysis = SnsAnalysis(dt, sr) [all …]
|
/liblc3-3.5.0-3.4.0/src/ |
D | common.h | 92 #define LC3_SRATE_KHZ(sr) \ argument 93 ( (1 + (sr) + ((sr) == LC3_SRATE_48K)) * 8 ) 103 #define LC3_NS(dt, sr) \ argument 104 ( 20 * (3 + (dt)) * (1 + (sr) + ((sr) == LC3_SRATE_48K)) ) 106 #define LC3_ND(dt, sr) \ argument 107 ( (dt) == LC3_DT_7M5 ? 23 * LC3_NS(dt, sr) / 30 \ 108 : 5 * LC3_NS(dt, sr) / 8 ) 110 #define LC3_NE(dt, sr) \ argument 111 ( 20 * (3 + (dt)) * (1 + (sr)) ) 117 ( (5 * LC3_SRATE_KHZ(sr)) / 4 ) [all …]
|
D | lc3.c | 82 enum lc3_srate sr = resolve_sr(sr_hz); in lc3_frame_samples() local 84 if (dt >= LC3_NUM_DT || sr >= LC3_NUM_SRATE) in lc3_frame_samples() 87 return LC3_NS(dt, sr); in lc3_frame_samples() 134 enum lc3_srate sr = resolve_sr(sr_hz); in lc3_delay_samples() local 136 if (dt >= LC3_NUM_DT || sr >= LC3_NUM_SRATE) in lc3_delay_samples() 139 return (dt == LC3_DT_7M5 ? 8 : 5) * (LC3_SRATE_KHZ(sr) / 2); in lc3_delay_samples() 158 enum lc3_srate sr = encoder->sr_pcm; in load_s16() local 162 int ns = LC3_NS(dt, sr); in load_s16() 179 enum lc3_srate sr = encoder->sr_pcm; in load_s24() local 183 int ns = LC3_NS(dt, sr); in load_s24() [all …]
|
D | bwdet.c | 26 enum lc3_dt dt, enum lc3_srate sr, const float *e) in lc3_bwdet_run() argument 59 enum lc3_bandwidth bwn = (enum lc3_bandwidth)sr; in lc3_bwdet_run() 102 int lc3_bwdet_get_nbits(enum lc3_srate sr) in lc3_bwdet_get_nbits() argument 104 return (sr > 0) + (sr > 1) + (sr > 3); in lc3_bwdet_get_nbits() 111 enum lc3_srate sr, enum lc3_bandwidth bw) in lc3_bwdet_put_bw() argument 113 int nbits_bw = lc3_bwdet_get_nbits(sr); in lc3_bwdet_put_bw() 122 enum lc3_srate sr, enum lc3_bandwidth *bw) in lc3_bwdet_get_bw() argument 124 enum lc3_bandwidth max_bw = (enum lc3_bandwidth)sr; in lc3_bwdet_get_bw() 125 int nbits_bw = lc3_bwdet_get_nbits(sr); in lc3_bwdet_get_bw()
|
D | spec.c | 33 static int resolve_gain_offset(enum lc3_srate sr, int nbytes) in resolve_gain_offset() argument 35 int g_off = (nbytes * 8) / (10 * (1 + sr)); in resolve_gain_offset() 36 return 105 + 5*(1 + sr) + LC3_MIN(g_off, 115); in resolve_gain_offset() 50 enum lc3_dt dt, enum lc3_srate sr, const float *x, in estimate_gain() argument 53 int ne = LC3_NE(dt, sr) >> 2; in estimate_gain() 124 enum lc3_srate sr, int g_idx, int nbits, int nbits_budget) in adjust_gain() argument 131 }[sr]; in adjust_gain() 208 LC3_HOT static void quantize(enum lc3_dt dt, enum lc3_srate sr, in quantize() argument 212 int ne = LC3_NE(dt, sr); in quantize() 239 LC3_HOT static float unquantize(enum lc3_dt dt, enum lc3_srate sr, in unquantize() argument [all …]
|
D | bwdet.h | 40 enum lc3_dt dt, enum lc3_srate sr, const float *e); 47 int lc3_bwdet_get_nbits(enum lc3_srate sr); 56 enum lc3_srate sr, enum lc3_bandwidth bw); 66 enum lc3_srate sr, enum lc3_bandwidth *bw);
|
D | spec.h | 62 void lc3_spec_analyze(enum lc3_dt dt, enum lc3_srate sr, 73 enum lc3_dt dt, enum lc3_srate sr, const lc3_spec_side_t *side); 88 enum lc3_dt dt, enum lc3_srate sr, enum lc3_bandwidth bw, int nbytes, 104 enum lc3_dt dt, enum lc3_srate sr, lc3_spec_side_t *side); 115 int lc3_spec_decode(lc3_bits_t *bits, enum lc3_dt dt, enum lc3_srate sr,
|
D | energy.c | 27 enum lc3_dt dt, enum lc3_srate sr, const float *x, float *e) in lc3_energy_compute() argument 36 int n1 = n1_table[dt][sr]; in lc3_energy_compute() 48 int nb = LC3_MIN(LC3_NUM_BANDS, LC3_NS(dt, sr)); in lc3_energy_compute() 50 const int *lim = lc3_band_lim[dt][sr]; in lc3_energy_compute()
|
D | attdet.c | 25 bool lc3_attdet_run(enum lc3_dt dt, enum lc3_srate sr, in lc3_attdet_run() argument 35 if (sr < LC3_SRATE_32K || in lc3_attdet_run() 36 nbytes < nbytes_ranges[dt][sr - LC3_SRATE_32K][0] || in lc3_attdet_run() 37 nbytes > nbytes_ranges[dt][sr - LC3_SRATE_32K][1] ) in lc3_attdet_run() 48 if (sr == LC3_SRATE_32K) { in lc3_attdet_run()
|
/liblc3-3.5.0-3.4.0/include/ |
D | lc3.h | 147 #define LC3_CHECK_SR_HZ(sr) \ argument 148 ( ((sr) == 8000) || ((sr) == 16000) || ((sr) == 24000) || \ 149 ((sr) == 32000) || ((sr) == 48000) )
|
/liblc3-3.5.0-3.4.0/tables/ |
D | mktables.py | 164 for (sr, g_tilt) in enumerate(g_tilt_table): 165 print('\n--- sns ge table, sr:{} ---'.format(sr)) 176 for sr in [ 8, 16, 32, 24, 48 ]: 178 r = 192 // sr 181 p = (192 // k) * (k // sr) 182 q = p * (0.5 if sr == 8 else 1) 184 print('\n--- LTPF resampler {:d} KHz to 12.8 KHz ---'.format(sr))
|