fix: stabilize localization comparison semantics

This commit is contained in:
2026-08-28 20:57:13 +09:00
parent 9b9244be85
commit e8dac792d9
10 changed files with 340 additions and 31 deletions
+16
View File
@@ -3,6 +3,10 @@ import {
createLocalizationAnalysisPlan,
estimateLocalizationWorkload,
} from "/packages/acoustics-core/localization.js";
import {
DEFAULT_GCC_PHAT_CROSS_SPECTRUM_BATCH_SIZE,
DEFAULT_GCC_PHAT_POINT_BATCH_SIZE,
} from "/packages/acoustics-core/gcc-phat.js";
import {
DEFAULT_LOCALIZATION_ALGORITHM,
LOCALIZATION_ALGORITHM_IDS,
@@ -167,10 +171,22 @@ test("portable and streaming API accept an algorithm choice without Scene synthe
computeOptions: { pointBatchSize: 1024, stftTransformBatchSize: 1024 },
};
const plan = createLocalizationPlan(config);
const defaultBatchPlan = createLocalizationPlan({ ...config, computeOptions: undefined });
const localized = await localizeMultichannel({ plan, channels: fixture.channels });
assertEqual(plan.algorithm, "gcc-phat", "portable plan algorithm");
assertEqual(plan.computeOptions.phatFloorRatio, 1e-5, "portable PHAT floor forwarding");
assertEqual(plan.analysisPlan, plan.gccPhatPlan, "portable GCC plan alias");
assertEqual(plan.computeOptions.pointBatchSize, 1024, "explicit portable point batch override");
assertEqual(
defaultBatchPlan.computeOptions.pointBatchSize,
DEFAULT_GCC_PHAT_POINT_BATCH_SIZE,
"GCC lookup-oriented default batch",
);
assertEqual(
defaultBatchPlan.computeOptions.crossSpectrumBatchSize,
DEFAULT_GCC_PHAT_CROSS_SPECTRUM_BATCH_SIZE,
"GCC cross-spectrum cancellation batch",
);
assertEqual(localized.algorithm, "gcc-phat", "portable result algorithm");
assertEqual(localized.phatFloorRatio, 1e-5, "portable PHAT floor reaches GCC core");
assertEqual(localized.bands[0].rawScale, "score", "portable score map");