Sync the kernel copy with the Rosella filterbank changes
Bring the kernel copy up to the upstream state that adds the captured
Rosella filterbank and the bank selector: bank 1 is the shared public
bank (13 taps / 6 slots, 961 samples), bank 2 is the captured bank
(11 taps / 3 slots, 448 samples). The copy was still at the state
before the filterbank fix, so both upstream changes land here.
- Add src/hrtf/rosella_bank.{h,cpp}, rosella_filterbank.{h,cpp} and
rosella_filterbank_tables.h, and list them in joc_kernel.vcxproj
- Carry the updated joc_core.h / joc_stream.h, the renderer, the
stream and task paths, and the kernel CLI's --rosella-filterbank
The host code needs no change: joc_task_config and joc_stream_config
keep their sizes (the reserved word became rosella_filterbank, and the
task config version went 3 -> 4), so src/joc_decode.cpp builds as is.
Checked: joc_kernel.vcxproj builds for Release-Static|x64, and
`diff -rq kernel\src <upstream>\src` plus the include tree are clean.
This commit is contained in:
1 parent
d3c9818409
commit
b566c364df
16 files changed
+759
-23
No files matched your search
@@ -0,0 +1,89 @@
|
||||
#include "hrtf/rosella_bank.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "hrtf/rosella_filterbank.h"
|
||||
|
||||
namespace joc::hrtf {
|
||||
namespace {
|
||||
|
||||
// The shared public bank. It is also what the SOFA field compiler runs, and it
|
||||
// is the bank the Rosella renderer used before the Rosella-specific one was
|
||||
// captured.
|
||||
class PublicBank final : public RosellaBank {
|
||||
public:
|
||||
explicit PublicBank(std::size_t channels) : bank_(builtin_kernels(), channels) {}
|
||||
|
||||
void reset() override { bank_.reset(); }
|
||||
|
||||
void analyze_qmf(const std::vector<double>& hops, std::size_t slots,
|
||||
std::vector<Complex>* qmf) override {
|
||||
bank_.analyze_qmf(hops, slots, qmf);
|
||||
}
|
||||
|
||||
void analyze_hybrid(const std::vector<Complex>& qmf, std::size_t slots,
|
||||
std::vector<Complex>* hybrid) override {
|
||||
bank_.analyze_hybrid(qmf, slots, hybrid);
|
||||
}
|
||||
|
||||
void synthesize_hybrid(const std::vector<Complex>& hybrid, std::size_t slots,
|
||||
std::vector<Complex>* qmf) override {
|
||||
bank_.synthesize_hybrid(hybrid, slots, qmf);
|
||||
}
|
||||
|
||||
void synthesize_qmf(const std::vector<Complex>& qmf, std::size_t slots,
|
||||
std::vector<double>* hops) override {
|
||||
bank_.synthesize_qmf(qmf, slots, hops);
|
||||
}
|
||||
|
||||
private:
|
||||
PublicFilterbank bank_;
|
||||
};
|
||||
|
||||
// The bank captured from the Rosella headphone renderer.
|
||||
class CapturedBank final : public RosellaBank {
|
||||
public:
|
||||
explicit CapturedBank(std::size_t channels) : bank_(channels) {}
|
||||
|
||||
void reset() override { bank_.reset(); }
|
||||
|
||||
void analyze_qmf(const std::vector<double>& hops, std::size_t slots,
|
||||
std::vector<Complex>* qmf) override {
|
||||
bank_.analyze_qmf(hops, slots, qmf);
|
||||
}
|
||||
|
||||
void analyze_hybrid(const std::vector<Complex>& qmf, std::size_t slots,
|
||||
std::vector<Complex>* hybrid) override {
|
||||
bank_.analyze_hybrid(qmf, slots, hybrid);
|
||||
}
|
||||
|
||||
void synthesize_hybrid(const std::vector<Complex>& hybrid, std::size_t slots,
|
||||
std::vector<Complex>* qmf) override {
|
||||
bank_.synthesize_hybrid(hybrid, slots, qmf);
|
||||
}
|
||||
|
||||
void synthesize_qmf(const std::vector<Complex>& qmf, std::size_t slots,
|
||||
std::vector<double>* hops) override {
|
||||
bank_.synthesize_qmf(qmf, slots, hops);
|
||||
}
|
||||
|
||||
private:
|
||||
RosellaFilterbank bank_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
std::uint32_t rosella_bank_latency(RosellaBankKind kind) {
|
||||
return kind == RosellaBankKind::Captured
|
||||
? static_cast<std::uint32_t>(RosellaFilterbank::kLatencySamples)
|
||||
: static_cast<std::uint32_t>(kLatencySamples);
|
||||
}
|
||||
|
||||
std::unique_ptr<RosellaBank> RosellaBank::create(RosellaBankKind kind, std::size_t channels) {
|
||||
if (kind == RosellaBankKind::Captured) {
|
||||
return std::make_unique<CapturedBank>(channels);
|
||||
}
|
||||
return std::make_unique<PublicBank>(channels);
|
||||
}
|
||||
|
||||
} // namespace joc::hrtf
|
||||
Reference in new issue
Block a user