Linear smoother: ensure to get the derivative correct
This commit is contained in:
parent
a49636adda
commit
69f27e7441
1 changed files with 4 additions and 4 deletions
|
|
@ -101,8 +101,8 @@ void LinearSmoother::process(absl::Span<const float> input, absl::Span<float> ou
|
||||||
if (target != nextTarget) {
|
if (target != nextTarget) {
|
||||||
target = nextTarget;
|
target = nextTarget;
|
||||||
//framesToTarget = (framesToTarget > 0) ? framesToTarget : smoothFrames;
|
//framesToTarget = (framesToTarget > 0) ? framesToTarget : smoothFrames;
|
||||||
//step = (target - current) / max(1, framesToTarget);
|
//step = (target - current) / (16 * max(1, framesToTarget));
|
||||||
step = (target - current) / max(1, smoothFrames);
|
step = (target - current) / (16 * max(1, smoothFrames));
|
||||||
}
|
}
|
||||||
const simde__m128 targetX4 = simde_mm_set1_ps(target);
|
const simde__m128 targetX4 = simde_mm_set1_ps(target);
|
||||||
if (target > current) {
|
if (target > current) {
|
||||||
|
|
@ -149,8 +149,8 @@ void LinearSmoother::process(absl::Span<const float> input, absl::Span<float> ou
|
||||||
if (target != nextTarget) {
|
if (target != nextTarget) {
|
||||||
target = nextTarget;
|
target = nextTarget;
|
||||||
// framesToTarget = (framesToTarget > 0) ? framesToTarget : smoothFrames;
|
// framesToTarget = (framesToTarget > 0) ? framesToTarget : smoothFrames;
|
||||||
// step = (target - current) / max(1, framesToTarget);
|
// step = (target - current) / ((count - i) * max(1, framesToTarget));
|
||||||
step = (target - current) / max(1, smoothFrames);
|
step = (target - current) / ((count - i) * max(1, smoothFrames));
|
||||||
}
|
}
|
||||||
if (target > current) {
|
if (target > current) {
|
||||||
for (; i < count; ++i)
|
for (; i < count; ++i)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue