mirror of
https://github.com/google/liblc3.git
synced 2026-04-26 17:14:50 +00:00
feature: Add 2.5 ms and 5 ms LC3 plus frame durations
fix: Check TNS bitstream data fix: LTPF Activation with 2.5 ms frame sizes
This commit is contained in:
committed by
Antoine Soulier
parent
a75f187e00
commit
149cb6537e
@@ -54,7 +54,7 @@ class AttackDetector:
|
||||
|
||||
def run(self, nbytes, x):
|
||||
|
||||
### 3.3.6.2 Downsampling and filtering input
|
||||
### Downsampling and filtering input
|
||||
|
||||
mf = int(16 * self.ms)
|
||||
|
||||
@@ -68,7 +68,7 @@ class AttackDetector:
|
||||
self.xn2 = x_att[-2]
|
||||
self.xn1 = x_att[-1]
|
||||
|
||||
### 3.3.6.3 Energy calculation
|
||||
### Energy calculation
|
||||
|
||||
nb = int(self.ms / 2.5)
|
||||
|
||||
@@ -82,7 +82,7 @@ class AttackDetector:
|
||||
self.en1 = e_att[-1]
|
||||
self.an1 = a_att[-1]
|
||||
|
||||
### 3.3.6.4 Attack Detection
|
||||
### Attack Detection
|
||||
|
||||
p_att = -1
|
||||
flags = [ (e_att[i] > 8.5 * a_att[i]) for i in range(nb) ]
|
||||
@@ -151,17 +151,19 @@ def check_unit(rng, dt, sr):
|
||||
|
||||
def check_appendix_c(dt):
|
||||
|
||||
i0 = dt - T.DT_7M5
|
||||
sr = T.SRATE_48K
|
||||
|
||||
ok = True
|
||||
state = initial_state()
|
||||
|
||||
x = np.append(np.zeros(6), C.X_PCM_ATT[dt][0])
|
||||
f_att = lc3.attdet_run(dt, sr, C.NBYTES_ATT[dt], state, x)
|
||||
ok = f_att == C.F_ATT[dt][0]
|
||||
x = np.append(np.zeros(6), C.X_PCM_ATT[i0][0])
|
||||
f_att = lc3.attdet_run(dt, sr, C.NBYTES_ATT[i0], state, x)
|
||||
ok = ok and f_att == C.F_ATT[i0][0]
|
||||
|
||||
x = np.append(x[-6:], C.X_PCM_ATT[dt][1])
|
||||
f_att = lc3.attdet_run(dt, sr, C.NBYTES_ATT[dt], state, x)
|
||||
ok = f_att == C.F_ATT[dt][1]
|
||||
x = np.append(x[-6:], C.X_PCM_ATT[i0][1])
|
||||
f_att = lc3.attdet_run(dt, sr, C.NBYTES_ATT[i0], state, x)
|
||||
ok = ok and f_att == C.F_ATT[i0][1]
|
||||
|
||||
return ok
|
||||
|
||||
@@ -173,11 +175,11 @@ def check():
|
||||
for dt in range(T.NUM_DT):
|
||||
ok and check_enabling(rng, dt)
|
||||
|
||||
for dt in range(T.NUM_DT):
|
||||
for dt in range(T.DT_7M5, T.NUM_DT):
|
||||
for sr in range(T.SRATE_32K, T.NUM_SRATE):
|
||||
ok = ok and check_unit(rng, dt, sr)
|
||||
|
||||
for dt in range(T.NUM_DT):
|
||||
for dt in range(T.DT_7M5, T.NUM_DT):
|
||||
ok = ok and check_appendix_c(dt)
|
||||
|
||||
return ok
|
||||
|
||||
Reference in New Issue
Block a user