Add --rosella-filterbank and restore the public bank as the default
ci / ubuntu-latest (push) Failing after 16s
ci / macos-latest (push) Canceled after 0s
ci / windows-latest (push) Canceled after 0s
ci / release (push) Canceled after 0s

The Rosella path picks its analysis and synthesis bank instead of
hard-coding one. Bank 1 is the shared public bank the renderer used
before the captured variant landed: 13-tap hybrid filters, the 6-slot
high-band delay and 961 samples of latency. Bank 2 is the captured
Rosella bank: 11-tap filters, the 3-slot delay and 448 samples. Both
keep their own coefficients, histories and flush behaviour.

- Drive either bank through one RosellaBank interface, and derive the
  startup skip and the flush capacity from the selected bank
- Add joc_rosella_filterbank to joc_task_config and joc_stream_config
  by replacing the reserved words (struct sizes unchanged, config
  version 3 -> 4)
- Reject an out-of-range value and bank 2 without a Rosella model
  instead of silently falling back
- Expose --rosella-filterbank 1|2 in the CLI with bank 1 as default,
  and reject it outside the personalized headphone path
- Cover bank identity, chunking, reset and per-bank latency in tests
- Document both banks, the selector and the CLI help

Renders of --rosella-filterbank 1 (and the default) match the pre-merge
reference byte for byte; --rosella-filterbank 2 matches the PR #3
reference byte for byte.
This commit is contained in:
TheM14 committed 2026-10-31 01:11:44 +08:00
1 parent 6674cb5386
commit 34a722f56a
19 files changed
+477 -34

No files matched your search

+31
View File
@@ -927,6 +927,36 @@ std::vector<float> drive_objects16_stream(const std::vector<float>& block, std::
return rendered;
}
void test_rosella_filterbank_config() {
// validate() reports a selector it cannot honour instead of ignoring it: the
// captured bank needs the Rosella model, and any other value is out of range.
const auto reported = [](std::uint32_t selector, const char* personalized) {
joc_task_config config{};
config.struct_size = sizeof(config);
config.struct_version = JOC_TASK_CONFIG_VERSION;
config.input_path = "input.eac3";
config.output_path = "output.wav";
config.operation = JOC_OP_BINAURAL;
config.binaural_mode = JOC_BINAURAL_MID;
config.personalized_headphone_path = personalized;
config.hrtf_path = personalized == nullptr ? "cache.jochrtf" : nullptr;
config.rosella_filterbank = selector;
std::vector<joc_validation_issue> issues;
std::uint32_t errors = 0;
joc::task::validate(config, &issues, &errors);
for (const joc_validation_issue& issue : issues) {
if (std::string(issue.field) == "rosella_filterbank") {
return true;
}
}
return false;
};
CHECK(!reported(JOC_ROSELLA_FILTERBANK_PUBLIC, "model.personalized_headphone"));
CHECK(!reported(JOC_ROSELLA_FILTERBANK_CAPTURED, "model.personalized_headphone"));
CHECK(reported(3u, "model.personalized_headphone"));
CHECK(reported(JOC_ROSELLA_FILTERBANK_CAPTURED, nullptr));
}
// A push renders every frame it makes ready, so the stream bounds how far ahead of
// the caller it renders. A batch pushed at once must therefore leave a bounded
// backlog, and it must render the same samples as pushing one frame at a time.
@@ -1126,6 +1156,7 @@ int main() {
test_sofa_reader_errors();
test_hrtf_cache_policy();
test_rosella_model_errors();
test_rosella_filterbank_config();
test_stream_render_ahead();
test_clipgain_first_frame_uses_its_own_gain();
test_clipgain_change_applies_to_the_current_frame();