Add --rosella-filterbank and restore the public bank as the default
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:
1 parent
6674cb5386
commit
34a722f56a
19 files changed
+477
-34
No files matched your search
@@ -44,6 +44,8 @@ struct Options {
|
||||
std::string compiled_hrtf_cache;
|
||||
std::string personalized_headphone;
|
||||
bool personalized_headphone_used = false;
|
||||
int rosella_filterbank = 1;
|
||||
bool rosella_filterbank_set = false;
|
||||
std::string hrtf_cache_policy;
|
||||
std::string hrtf_cache_dir;
|
||||
double hrtf_radius_m = 1.0;
|
||||
@@ -118,6 +120,8 @@ void print_usage() {
|
||||
" --sofa-hrtf PATH SOFA SimpleFreeFieldHRIR 输入;.jochrtf 由本工具内部编译\n"
|
||||
" --personalized-headphone [PATH] Rosella 个性化模型,默认 "
|
||||
"HRTF/binaural.personalized_headphone\n"
|
||||
" --rosella-filterbank N Rosella 模型滤波器组:1=13 taps/6 slots(默认),\n"
|
||||
" 2=11 taps/3 slots;仅作用于个性化模型\n"
|
||||
" --compiled-hrtf-cache PATH 直接读取 .jochrtf(高级用法,跳过 SOFA 编译)\n"
|
||||
" --hrtf-cache-policy P SOFA 编译缓存策略 none|memory|disk,默认 memory\n"
|
||||
" --hrtf-cache-dir DIR disk cache 目录,默认 <exe>/output/hrtf-cache\n"
|
||||
@@ -238,6 +242,11 @@ void parse_args(const std::vector<std::string>& arguments, Options* options) {
|
||||
options->personalized_headphone = require_value(arguments, &index);
|
||||
}
|
||||
}
|
||||
else if (arg == "--rosella-filterbank") {
|
||||
options->rosella_filterbank = static_cast<int>(
|
||||
to_int(require_value(arguments, &index), "--rosella-filterbank"));
|
||||
options->rosella_filterbank_set = true;
|
||||
}
|
||||
else if (arg == "--hrtf-cache-policy") { options->hrtf_cache_policy = require_value(arguments, &index); }
|
||||
else if (arg == "--hrtf-cache-dir") { options->hrtf_cache_dir = require_value(arguments, &index); }
|
||||
else if (arg == "--hrtf-radius-m") { options->hrtf_radius_m = to_double(require_value(arguments, &index), "--hrtf-radius-m"); }
|
||||
@@ -562,6 +571,10 @@ int main(int argc, char** argv) {
|
||||
check_choice(options.hrtf_cache_policy, "--hrtf-cache-policy",
|
||||
{"none", "memory", "disk"});
|
||||
}
|
||||
if (options.rosella_filterbank != 1 && options.rosella_filterbank != 2) {
|
||||
fail("--rosella-filterbank: invalid choice: " +
|
||||
std::to_string(options.rosella_filterbank) + " (choose from 1, 2)");
|
||||
}
|
||||
|
||||
const bool speaker_mode = !options.speaker_layout.empty();
|
||||
const bool binaural_mode = options.binaural;
|
||||
@@ -596,6 +609,9 @@ int main(int argc, char** argv) {
|
||||
if (hrtf_options_used && !binaural_mode) {
|
||||
fail("SOFA/HRTF 选项仅与 --binaural 一起使用");
|
||||
}
|
||||
if (options.rosella_filterbank_set && !binaural_mode) {
|
||||
fail("--rosella-filterbank 仅与 --binaural 一起使用");
|
||||
}
|
||||
if (!std::isfinite(options.binaural_tail_seconds) ||
|
||||
options.binaural_tail_seconds < 0.0) {
|
||||
fail("binaural-tail-seconds 必须是非负有限值");
|
||||
@@ -670,6 +686,7 @@ int main(int argc, char** argv) {
|
||||
config.speaker_metadata_offset = static_cast<std::uint32_t>(options.speaker_metadata_offset);
|
||||
config.binaural_mode = binaural_mode_value(options.binaural_mode);
|
||||
config.adm_binaural_mode = binaural_mode_value(options.binaural_mode);
|
||||
config.rosella_filterbank = static_cast<std::uint32_t>(options.rosella_filterbank);
|
||||
config.binaural_tail_seconds = options.binaural_tail_seconds;
|
||||
config.binaural_tail_threshold = options.binaural_tail_threshold;
|
||||
config.binaural_chunk_frames = static_cast<std::uint32_t>(options.binaural_chunk_frames);
|
||||
@@ -710,6 +727,10 @@ int main(int argc, char** argv) {
|
||||
personalized_path = input.personalized_path;
|
||||
kernels_path = find_kernels(options, arguments.empty() ? std::string()
|
||||
: arguments.front());
|
||||
if (options.rosella_filterbank_set && personalized_path.empty()) {
|
||||
fail("--rosella-filterbank 只作用于 Rosella .personalized_headphone 输入;"
|
||||
"当前 SOFA/.jochrtf 路径不使用该滤波器组");
|
||||
}
|
||||
} catch (const std::exception& error) {
|
||||
std::fprintf(stderr, "joc_cli: error: %s\n", error.what());
|
||||
return 2;
|
||||
|
||||
Reference in new issue
Block a user