aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-10-25 22:48:17 -0700
committerChris Robinson <[email protected]>2022-10-25 22:48:17 -0700
commit46f02764324ece9a23aa9cce9f2e294c414adc9f (patch)
treee86cc2a114cf1814b6b9fdc719d5ab1ea24e5096
parent880fa66efe70892706cc2377ba730a7de68bf34a (diff)
Add a comment about the filter delay
-rw-r--r--core/uhjfilter.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/uhjfilter.cpp b/core/uhjfilter.cpp
index 3cbbc798..3624e53e 100644
--- a/core/uhjfilter.cpp
+++ b/core/uhjfilter.cpp
@@ -210,6 +210,9 @@ void UhjEncoderIIR::encode(float *LeftOut, float *RightOut,
/* Precompute j(-0.3420201*W + 0.5098604*X) and store in mD. */
std::transform(winput, winput+SamplesToDo, mX.cbegin(), mWX.begin()+sFilterDelay,
[](const float w, const float x) noexcept { return -0.3420201f*w + 0.5098604f*x; });
+ /* Shift the input ahead by one sample, so that the output is delayed by
+ * one sample in the reverse.
+ */
allpass1_process_rev({mWX.data()+1, SamplesToDo+sFilterDelay-1}, mRevTemp.data());
allpass2_process(mFilterWX, {mRevTemp.data(), SamplesToDo}, SamplesToDo, mD.data());