[perf](trx-backend-soapysdr): update fir overlap in place
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -292,15 +292,14 @@ impl BlockFirFilter {
|
|||||||
|
|
||||||
// Update overlap with the tail of the current input.
|
// Update overlap with the tail of the current input.
|
||||||
if n_overlap > 0 {
|
if n_overlap > 0 {
|
||||||
let keep_old = n_overlap.saturating_sub(n_new);
|
if n_new >= n_overlap {
|
||||||
let mut new_overlap = Vec::with_capacity(n_overlap);
|
let new_start = n_new - n_overlap;
|
||||||
if keep_old > 0 {
|
self.overlap.copy_from_slice(&input[new_start..]);
|
||||||
let start = self.overlap.len() - keep_old;
|
} else {
|
||||||
new_overlap.extend_from_slice(&self.overlap[start..]);
|
let keep_old = n_overlap - n_new;
|
||||||
|
self.overlap.copy_within(n_new..n_overlap, 0);
|
||||||
|
self.overlap[keep_old..].copy_from_slice(input);
|
||||||
}
|
}
|
||||||
let new_start = n_new.saturating_sub(n_overlap);
|
|
||||||
new_overlap.extend_from_slice(&input[new_start..]);
|
|
||||||
self.overlap = new_overlap;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user