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
@@ -12,7 +12,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "foundation/fft.h"
|
||||
#include "hrtf/public_filterbank.h"
|
||||
#include "hrtf/rosella_bank.h"
|
||||
|
||||
namespace joc::hrtf {
|
||||
|
||||
@@ -1003,8 +1003,8 @@ struct RosellaRuntime::Impl {
|
||||
std::vector<double> field_left;
|
||||
std::vector<double> field_right;
|
||||
Core core;
|
||||
std::unique_ptr<PublicFilterbank> analysis_bank;
|
||||
std::unique_ptr<PublicFilterbank> synthesis_bank;
|
||||
std::unique_ptr<RosellaBank> analysis_bank;
|
||||
std::unique_ptr<RosellaBank> synthesis_bank;
|
||||
timeline::OamdPositionTimeline timeline{timeline::kTimelineObjects};
|
||||
|
||||
std::vector<double> buffer; // [chunk_samples][16]
|
||||
@@ -1051,9 +1051,7 @@ struct RosellaRuntime::Impl {
|
||||
analysis_bank->analyze_qmf(hops_, slots, &qmf_);
|
||||
analysis_bank->analyze_hybrid(qmf_, slots, &hybrid_);
|
||||
|
||||
if (rendered_.size() < slots * 2u * kHybridBands) {
|
||||
rendered_.resize(slots * 2u * kHybridBands);
|
||||
}
|
||||
rendered_.resize(slots * 2u * kHybridBands);
|
||||
if (room_sends_buffer_.size() != slots * kHybridBands) {
|
||||
room_sends_buffer_.resize(slots * kHybridBands);
|
||||
}
|
||||
@@ -1141,11 +1139,13 @@ struct RosellaRuntime::Impl {
|
||||
return Status::success();
|
||||
}
|
||||
|
||||
// The reference drops the first 961 samples of the raw stream (the filterbank's
|
||||
// latency) and returns everything after that.
|
||||
// The reference drops the first `latency` samples of the raw stream (the
|
||||
// filterbank's own delay) and returns everything after that; the latency is
|
||||
// the selected bank's, so the two banks start at different sample offsets.
|
||||
void append_output(const double* stereo, std::size_t count) {
|
||||
const std::int64_t remaining = static_cast<std::int64_t>(kLatencySamples) -
|
||||
static_cast<std::int64_t>(raw_output_samples);
|
||||
const std::int64_t remaining =
|
||||
static_cast<std::int64_t>(rosella_bank_latency(options.bank)) -
|
||||
static_cast<std::int64_t>(raw_output_samples);
|
||||
const std::size_t skip = static_cast<std::size_t>(
|
||||
std::max<std::int64_t>(0, std::min<std::int64_t>(static_cast<std::int64_t>(count),
|
||||
remaining)));
|
||||
@@ -1191,6 +1191,9 @@ Status RosellaRuntime::open(const RosellaModel& model, const RosellaRenderOption
|
||||
if (options.object_delay_samples < 0) {
|
||||
return render_fail(JOC_ERR_INVALID_ARGUMENT, "object_delay_samples must be non-negative");
|
||||
}
|
||||
if (options.bank != RosellaBankKind::Public && options.bank != RosellaBankKind::Captured) {
|
||||
return render_fail(JOC_ERR_INVALID_ARGUMENT, "unknown Rosella filterbank");
|
||||
}
|
||||
impl_->model = model;
|
||||
impl_->options = options;
|
||||
logical_field(impl_->model.field_left_padded, &impl_->field_left);
|
||||
@@ -1203,8 +1206,8 @@ Status RosellaRuntime::open(const RosellaModel& model, const RosellaRenderOption
|
||||
return status;
|
||||
}
|
||||
// The analysis bank runs sixteen sources, the synthesis bank two output ears.
|
||||
impl_->analysis_bank = std::make_unique<PublicFilterbank>(builtin_kernels(), kSourceChannels);
|
||||
impl_->synthesis_bank = std::make_unique<PublicFilterbank>(builtin_kernels(), kOutputChannels);
|
||||
impl_->analysis_bank = RosellaBank::create(options.bank, kSourceChannels);
|
||||
impl_->synthesis_bank = RosellaBank::create(options.bank, kOutputChannels);
|
||||
impl_->buffer.assign(impl_->chunk_samples() * kSourceChannels, 0.0);
|
||||
impl_->room_sends_buffer_.assign(
|
||||
(impl_->chunk_samples() / kQmfHop) * kHybridBands, Complex(0.0, 0.0));
|
||||
@@ -1309,7 +1312,8 @@ Status RosellaRuntime::finish(std::uint32_t flush_samples, std::vector<double>*
|
||||
}
|
||||
|
||||
std::uint32_t RosellaRuntime::finish_capacity(double tail_seconds) const {
|
||||
const double samples = tail_seconds * 48000.0 + static_cast<double>(kLatencySamples) +
|
||||
const double samples = tail_seconds * 48000.0 +
|
||||
static_cast<double>(rosella_bank_latency(impl_->options.bank)) +
|
||||
static_cast<double>(kBlockSamples);
|
||||
const double blocks = std::ceil(samples / static_cast<double>(kBlockSamples));
|
||||
return static_cast<std::uint32_t>(blocks) * kBlockSamples;
|
||||
|
||||
Reference in new issue
Block a user