feat: add realistic portable localization core

This commit is contained in:
Codex
2026-08-28 18:19:31 +09:00
parent bc63ada1cd
commit d002a2bd70
20 changed files with 2345 additions and 70 deletions
+30
View File
@@ -81,6 +81,36 @@ test("STFT batch를 bin-frame-microphone-complex 순서로 packing한다", () =>
expected.forEach((value, index) => assertEqual(packed[index], value, `packed STFT value ${index}`));
});
test("WebGPU STFT packing이 microphone 주파수 응답을 bin별로 역보정한다", () => {
const stft = {
frameCount: 1,
microphoneCount: 1,
spectra: new Map([[8, { real: Float32Array.of(0), imaginary: Float32Array.of(2) }]]),
};
const microphones = [{
frequencyResponse: [
{ frequencyHz: 0, gainDb: 6.020599913, phaseDeg: 90 },
{ frequencyHz: 4000, gainDb: 6.020599913, phaseDeg: 90 },
],
}];
const compensated = packStftBatch(stft, [8], {
microphones,
sampleRate: 8000,
fftSize: 256,
});
assertNear(compensated[0], 1, 1e-6, "inverse response real");
assertNear(compensated[1], 0, 1e-6, "inverse response imaginary");
const uncompensated = packStftBatch(stft, [8], {
microphones,
sampleRate: 8000,
fftSize: 256,
compensateFrequencyResponse: false,
});
assertEqual(uncompensated[0], 0, "disabled compensation real");
assertEqual(uncompensated[1], 2, "disabled compensation imaginary");
});
test("WebGPU batch size가 storage, dispatch, memory 한도를 모두 지킨다", () => {
const workload = {
selectedBins: [4, 5, 6, 7, 8],