Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@amazon.com>2023-10-08 07:17:44 +0300
committerJean-Marc Valin <jmvalin@amazon.com>2023-10-08 07:40:07 +0300
commit471d00254f03325f11c47f05f9dc4f8961e5ce10 (patch)
tree79b80ebbb1516554d9744dfc28c21839c8cd7e39
parent69c9b34f86af7b96049ec3fe809c6629c902459d (diff)
constraining the pitchexp_fargan44
-rw-r--r--dnn/torch/fargan/fargan.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/dnn/torch/fargan/fargan.py b/dnn/torch/fargan/fargan.py
index 39b5ddaf..d9933b42 100644
--- a/dnn/torch/fargan/fargan.py
+++ b/dnn/torch/fargan/fargan.py
@@ -208,15 +208,17 @@ class FARGANSub(nn.Module):
#print(cond.shape, prev.shape)
- idx = 256-torch.clamp(period[:,None], min=self.subframe_size+2, max=254)
+ idx = 256-period[:,None]
rng = torch.arange(self.subframe_size+4, device=device)
idx = idx + rng[None,:] - 2
+ mask = idx >= 256
+ idx = idx - mask*period[:,None]
pred = torch.gather(exc_mem, 1, idx)
- pred = pred/(1e-5+gain)
+ pred = torch.clamp(pred/(1e-5+gain), min=-1, max=1)
prev = exc_mem[:,-self.subframe_size:]
dump_signal(prev, 'prev_in.f32')
- prev = prev/(1e-5+gain)
+ prev = torch.clamp(prev/(1e-5+gain), min=-1, max=1)
dump_signal(prev, 'pitch_exc.f32')
dump_signal(exc_mem, 'exc_mem.f32')