perf: harden realtime localization pipeline

This commit is contained in:
Codex
2026-08-28 18:58:48 +09:00
parent 35c33e360e
commit 256558e601
13 changed files with 765 additions and 84 deletions
+33
View File
@@ -219,6 +219,39 @@ test("마이크 주파수 응답을 dB와 wrapped phase로 보간하고 끝점
assertEqual(above.phaseDeg, -170, "upper endpoint phase");
});
test("DAS 역응답은 깊은 notch의 boost를 기본 24 dB로 제한한다", async () => {
const arrayDefinition = {
microphones: [{
id: "notched",
position: [0, 0, 0],
frequencyResponse: [
{ frequencyHz: 0, gainDb: -120 },
{ frequencyHz: 4000, gainDb: -120 },
],
}],
};
const options = {
bin: 8,
spectrum: { real: Float32Array.of(1), imaginary: Float32Array.of(0) },
frameCount: 1,
arrayDefinition,
pointCount: 1,
distances: Float32Array.of(0),
sampleRate: 8000,
fftSize: 256,
speedOfSound: 343,
compensateFrequencyResponse: true,
pointBatchSize: 64,
};
const limited = await computeBinMap(options);
const noBoost = await computeBinMap({ ...options, maxCompensationDb: 0 });
const explicitLegacyLimit = await computeBinMap({ ...options, maxCompensationDb: 120 });
assertNear(limited[0], dbToLinear(24) ** 2, 1e-3, "default limited power");
assertNear(noBoost[0], 1, 1e-9, "zero boost limit");
assert(explicitLegacyLimit[0] > 1e11, "explicit 120 dB limit permits legacy boost");
});
test("index 기반 noise가 seed에 대해 결정적이다", () => {
const first = Array.from({ length: 16 }, (_, index) => whiteNoiseAt(42, index));
const second = Array.from({ length: 16 }, (_, index) => whiteNoiseAt(42, index));