Files
foo_input_joc/kernel/src/hrtf/rosella_bank.h
T
TheM14 b566c364df
build / windows (push) Canceled after 0s
build / release (push) Canceled after 0s
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.
2026-10-31 02:28:07 +08:00

51 lines
2.0 KiB
C++

#pragma once
#include <cstddef>
#include <cstdint>
#include <memory>
#include <vector>
#include "hrtf/public_filterbank.h"
namespace joc::hrtf {
// Which 64-QMF / 77-hybrid bank the Rosella renderer runs. The two are not
// interchangeable: the QMF prototype, the hybrid tap count, the high-band slot
// delay and the analysis/synthesis latency all differ, so each bank keeps its own
// tables and its own state.
enum class RosellaBankKind : std::int32_t {
Public = 1, // shared bank: 13-tap hybrid, 6-slot delay, 961 samples
Captured = 2, // Rosella bank: 11-tap hybrid, 3-slot delay, 448 samples
};
// Analysis/synthesis latency of `kind` at 48 kHz, in samples.
std::uint32_t rosella_bank_latency(RosellaBankKind kind);
// The four stateful half-steps of either bank, in the order the reference runs
// them. Hops and QMF data are [slots, channels, 64], hybrid data is
// [slots, channels, 77]. State is per instance, so the analysis bank of a
// runtime and its synthesis bank never share buffers.
class RosellaBank {
public:
// `kind` must name one of the enumerators; anything else selects Public.
static std::unique_ptr<RosellaBank> create(RosellaBankKind kind, std::size_t channels);
RosellaBank() = default;
RosellaBank(const RosellaBank&) = delete;
RosellaBank& operator=(const RosellaBank&) = delete;
virtual ~RosellaBank() = default;
virtual void reset() = 0;
virtual void analyze_qmf(const std::vector<double>& hops, std::size_t slots,
std::vector<Complex>* qmf) = 0;
virtual void analyze_hybrid(const std::vector<Complex>& qmf, std::size_t slots,
std::vector<Complex>* hybrid) = 0;
virtual void synthesize_hybrid(const std::vector<Complex>& hybrid, std::size_t slots,
std::vector<Complex>* qmf) = 0;
virtual void synthesize_qmf(const std::vector<Complex>& qmf, std::size_t slots,
std::vector<double>* hops) = 0;
};
} // namespace joc::hrtf