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
@@ -39,7 +39,7 @@
|
|||||||
#define JOC_ABI_VERSION 5u
|
#define JOC_ABI_VERSION 5u
|
||||||
#define JOC_FRAME_PARAMS_VERSION 1u
|
#define JOC_FRAME_PARAMS_VERSION 1u
|
||||||
#define JOC_EMDF_INFO_VERSION 1u
|
#define JOC_EMDF_INFO_VERSION 1u
|
||||||
#define JOC_TASK_CONFIG_VERSION 3u
|
#define JOC_TASK_CONFIG_VERSION 4u
|
||||||
#define JOC_TASK_RESULT_VERSION 2u
|
#define JOC_TASK_RESULT_VERSION 2u
|
||||||
#define JOC_EVENT_VERSION 1u
|
#define JOC_EVENT_VERSION 1u
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ enum {
|
|||||||
JOC_BINAURAL_QMF_BANDS = 64,
|
JOC_BINAURAL_QMF_BANDS = 64,
|
||||||
JOC_BINAURAL_HYBRID_BANDS = 77,
|
JOC_BINAURAL_HYBRID_BANDS = 77,
|
||||||
JOC_QMF_HOP_SAMPLES = 64,
|
JOC_QMF_HOP_SAMPLES = 64,
|
||||||
JOC_BINAURAL_LATENCY_SAMPLES = 961,
|
JOC_BINAURAL_LATENCY_SAMPLES = 961, /* SOFA/.jochrtf and Rosella bank 1 */
|
||||||
JOC_LFE_DELAY_SAMPLES = 1217
|
JOC_LFE_DELAY_SAMPLES = 1217
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -366,6 +366,15 @@ typedef enum joc_hrtf_cache_policy {
|
|||||||
JOC_HRTF_CACHE_DISK = 2 /* compile, reuse and write <cache_dir>/<name>.jochrtf */
|
JOC_HRTF_CACHE_DISK = 2 /* compile, reuse and write <cache_dir>/<name>.jochrtf */
|
||||||
} joc_hrtf_cache_policy;
|
} joc_hrtf_cache_policy;
|
||||||
|
|
||||||
|
/* Which 64-QMF / 77-hybrid filterbank the Rosella .personalized_headphone path
|
||||||
|
* renders through. The two banks differ in coefficients, hybrid tap count,
|
||||||
|
* high-band slot delay and total latency, so they are not interchangeable; the
|
||||||
|
* SOFA and .jochrtf paths always use JOC_ROSELLA_FILTERBANK_PUBLIC. */
|
||||||
|
typedef enum joc_rosella_filterbank {
|
||||||
|
JOC_ROSELLA_FILTERBANK_PUBLIC = 1, /* 13-tap hybrid, 6-slot delay, 961 samples */
|
||||||
|
JOC_ROSELLA_FILTERBANK_CAPTURED = 2 /* 11-tap hybrid, 3-slot delay, 448 samples */
|
||||||
|
} joc_rosella_filterbank;
|
||||||
|
|
||||||
enum { JOC_TASK_F_SKIP_SHA256 = 1u, JOC_TASK_F_KEEP_INTERMEDIATE = 2u,
|
enum { JOC_TASK_F_SKIP_SHA256 = 1u, JOC_TASK_F_KEEP_INTERMEDIATE = 2u,
|
||||||
JOC_TASK_F_QUIET = 4u, JOC_TASK_F_METADATA_ONLY = 8u };
|
JOC_TASK_F_QUIET = 4u, JOC_TASK_F_METADATA_ONLY = 8u };
|
||||||
|
|
||||||
@@ -423,7 +432,7 @@ typedef struct joc_task_config {
|
|||||||
const char* personalized_headphone_path; /* Rosella .personalized_headphone input */
|
const char* personalized_headphone_path; /* Rosella .personalized_headphone input */
|
||||||
const char* hrtf_cache_dir; /* disk policy directory */
|
const char* hrtf_cache_dir; /* disk policy directory */
|
||||||
uint32_t hrtf_cache_policy; /* joc_hrtf_cache_policy */
|
uint32_t hrtf_cache_policy; /* joc_hrtf_cache_policy */
|
||||||
uint32_t reserved0;
|
uint32_t rosella_filterbank; /* joc_rosella_filterbank; 0 = PUBLIC */
|
||||||
double hrtf_radius_m; /* SOFA measurement-radius shell */
|
double hrtf_radius_m; /* SOFA measurement-radius shell */
|
||||||
} joc_task_config;
|
} joc_task_config;
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ typedef struct joc_stream_config {
|
|||||||
uint32_t object_delay_samples; /* default 1473 */
|
uint32_t object_delay_samples; /* default 1473 */
|
||||||
double gain_db; /* default 0 */
|
double gain_db; /* default 0 */
|
||||||
uint32_t native_threads;
|
uint32_t native_threads;
|
||||||
uint32_t reserved;
|
uint32_t rosella_filterbank; /* joc_rosella_filterbank; Rosella input, 0 = PUBLIC */
|
||||||
/* Binaural HRTF input, the same three shapes joc_task_config accepts: when
|
/* Binaural HRTF input, the same three shapes joc_task_config accepts: when
|
||||||
* hrtf_sofa_path is set the library compiles it with hrtf_cache_policy /
|
* hrtf_sofa_path is set the library compiles it with hrtf_cache_policy /
|
||||||
* hrtf_cache_dir / hrtf_radius_m and hrtf_path is unused; when
|
* hrtf_cache_dir / hrtf_radius_m and hrtf_path is unused; when
|
||||||
|
|||||||
@@ -161,6 +161,8 @@
|
|||||||
<ClCompile Include="src\foundation\status.cpp" />
|
<ClCompile Include="src\foundation\status.cpp" />
|
||||||
<ClCompile Include="src\hrtf\jochrtf.cpp" />
|
<ClCompile Include="src\hrtf\jochrtf.cpp" />
|
||||||
<ClCompile Include="src\hrtf\public_filterbank.cpp" />
|
<ClCompile Include="src\hrtf\public_filterbank.cpp" />
|
||||||
|
<ClCompile Include="src\hrtf\rosella_bank.cpp" />
|
||||||
|
<ClCompile Include="src\hrtf\rosella_filterbank.cpp" />
|
||||||
<ClCompile Include="src\hrtf\rosella_model.cpp" />
|
<ClCompile Include="src\hrtf\rosella_model.cpp" />
|
||||||
<ClCompile Include="src\hrtf\rosella_renderer.cpp" />
|
<ClCompile Include="src\hrtf\rosella_renderer.cpp" />
|
||||||
<ClCompile Include="src\hrtf\kernel_tables.cpp" />
|
<ClCompile Include="src\hrtf\kernel_tables.cpp" />
|
||||||
@@ -238,6 +240,9 @@
|
|||||||
<ClInclude Include="src\foundation\status.h" />
|
<ClInclude Include="src\foundation\status.h" />
|
||||||
<ClInclude Include="src\hrtf\jochrtf.h" />
|
<ClInclude Include="src\hrtf\jochrtf.h" />
|
||||||
<ClInclude Include="src\hrtf\public_filterbank.h" />
|
<ClInclude Include="src\hrtf\public_filterbank.h" />
|
||||||
|
<ClInclude Include="src\hrtf\rosella_bank.h" />
|
||||||
|
<ClInclude Include="src\hrtf\rosella_filterbank.h" />
|
||||||
|
<ClInclude Include="src\hrtf\rosella_filterbank_tables.h" />
|
||||||
<ClInclude Include="src\hrtf\rosella_model.h" />
|
<ClInclude Include="src\hrtf\rosella_model.h" />
|
||||||
<ClInclude Include="src\hrtf\rosella_renderer.h" />
|
<ClInclude Include="src\hrtf\rosella_renderer.h" />
|
||||||
<ClInclude Include="src\hrtf\sofa.h" />
|
<ClInclude Include="src\hrtf\sofa.h" />
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ joc::stream::Config to_config(const joc_stream_config& config) {
|
|||||||
if (config.hrtf_cache_dir != nullptr) { out.hrtf_cache_dir = config.hrtf_cache_dir; }
|
if (config.hrtf_cache_dir != nullptr) { out.hrtf_cache_dir = config.hrtf_cache_dir; }
|
||||||
out.hrtf_cache_policy = config.hrtf_cache_policy;
|
out.hrtf_cache_policy = config.hrtf_cache_policy;
|
||||||
if (config.hrtf_radius_m > 0.0) { out.hrtf_radius_m = config.hrtf_radius_m; }
|
if (config.hrtf_radius_m > 0.0) { out.hrtf_radius_m = config.hrtf_radius_m; }
|
||||||
|
// 0 is "unset" here as well: the Rosella path defaults to the public bank.
|
||||||
|
if (config.rosella_filterbank != 0u) {
|
||||||
|
out.rosella_filterbank = config.rosella_filterbank;
|
||||||
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ struct Options {
|
|||||||
std::string compiled_hrtf_cache;
|
std::string compiled_hrtf_cache;
|
||||||
std::string personalized_headphone;
|
std::string personalized_headphone;
|
||||||
bool personalized_headphone_used = false;
|
bool personalized_headphone_used = false;
|
||||||
|
int rosella_filterbank = 1;
|
||||||
|
bool rosella_filterbank_set = false;
|
||||||
std::string hrtf_cache_policy;
|
std::string hrtf_cache_policy;
|
||||||
std::string hrtf_cache_dir;
|
std::string hrtf_cache_dir;
|
||||||
double hrtf_radius_m = 1.0;
|
double hrtf_radius_m = 1.0;
|
||||||
@@ -118,6 +120,8 @@ void print_usage() {
|
|||||||
" --sofa-hrtf PATH SOFA SimpleFreeFieldHRIR 输入;.jochrtf 由本工具内部编译\n"
|
" --sofa-hrtf PATH SOFA SimpleFreeFieldHRIR 输入;.jochrtf 由本工具内部编译\n"
|
||||||
" --personalized-headphone [PATH] Rosella 个性化模型,默认 "
|
" --personalized-headphone [PATH] Rosella 个性化模型,默认 "
|
||||||
"HRTF/binaural.personalized_headphone\n"
|
"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"
|
" --compiled-hrtf-cache PATH 直接读取 .jochrtf(高级用法,跳过 SOFA 编译)\n"
|
||||||
" --hrtf-cache-policy P SOFA 编译缓存策略 none|memory|disk,默认 memory\n"
|
" --hrtf-cache-policy P SOFA 编译缓存策略 none|memory|disk,默认 memory\n"
|
||||||
" --hrtf-cache-dir DIR disk cache 目录,默认 <exe>/output/hrtf-cache\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);
|
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-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-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"); }
|
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",
|
check_choice(options.hrtf_cache_policy, "--hrtf-cache-policy",
|
||||||
{"none", "memory", "disk"});
|
{"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 speaker_mode = !options.speaker_layout.empty();
|
||||||
const bool binaural_mode = options.binaural;
|
const bool binaural_mode = options.binaural;
|
||||||
@@ -596,6 +609,9 @@ int main(int argc, char** argv) {
|
|||||||
if (hrtf_options_used && !binaural_mode) {
|
if (hrtf_options_used && !binaural_mode) {
|
||||||
fail("SOFA/HRTF 选项仅与 --binaural 一起使用");
|
fail("SOFA/HRTF 选项仅与 --binaural 一起使用");
|
||||||
}
|
}
|
||||||
|
if (options.rosella_filterbank_set && !binaural_mode) {
|
||||||
|
fail("--rosella-filterbank 仅与 --binaural 一起使用");
|
||||||
|
}
|
||||||
if (!std::isfinite(options.binaural_tail_seconds) ||
|
if (!std::isfinite(options.binaural_tail_seconds) ||
|
||||||
options.binaural_tail_seconds < 0.0) {
|
options.binaural_tail_seconds < 0.0) {
|
||||||
fail("binaural-tail-seconds 必须是非负有限值");
|
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.speaker_metadata_offset = static_cast<std::uint32_t>(options.speaker_metadata_offset);
|
||||||
config.binaural_mode = binaural_mode_value(options.binaural_mode);
|
config.binaural_mode = binaural_mode_value(options.binaural_mode);
|
||||||
config.adm_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_seconds = options.binaural_tail_seconds;
|
||||||
config.binaural_tail_threshold = options.binaural_tail_threshold;
|
config.binaural_tail_threshold = options.binaural_tail_threshold;
|
||||||
config.binaural_chunk_frames = static_cast<std::uint32_t>(options.binaural_chunk_frames);
|
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;
|
personalized_path = input.personalized_path;
|
||||||
kernels_path = find_kernels(options, arguments.empty() ? std::string()
|
kernels_path = find_kernels(options, arguments.empty() ? std::string()
|
||||||
: arguments.front());
|
: arguments.front());
|
||||||
|
if (options.rosella_filterbank_set && personalized_path.empty()) {
|
||||||
|
fail("--rosella-filterbank 只作用于 Rosella .personalized_headphone 输入;"
|
||||||
|
"当前 SOFA/.jochrtf 路径不使用该滤波器组");
|
||||||
|
}
|
||||||
} catch (const std::exception& error) {
|
} catch (const std::exception& error) {
|
||||||
std::fprintf(stderr, "joc_cli: error: %s\n", error.what());
|
std::fprintf(stderr, "joc_cli: error: %s\n", error.what());
|
||||||
return 2;
|
return 2;
|
||||||
|
|||||||
@@ -7,10 +7,6 @@
|
|||||||
|
|
||||||
#include "hrtf/jochrtf.h"
|
#include "hrtf/jochrtf.h"
|
||||||
|
|
||||||
// Public 64-QMF / 77-hybrid filterbank, shared by the SOFA field compiler and the
|
|
||||||
// Rosella renderer (upstream public_filterbank.py and rosella_filterbank.py are
|
|
||||||
// the same bank). Everything is float64/complex128, as the reference computes it,
|
|
||||||
// and the stateful half-steps are exposed because Rosella drives them directly.
|
|
||||||
namespace joc::hrtf {
|
namespace joc::hrtf {
|
||||||
|
|
||||||
inline constexpr int kQmfBands = 64;
|
inline constexpr int kQmfBands = 64;
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#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
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
#include "hrtf/rosella_filterbank.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
#include "foundation/fft.h"
|
||||||
|
#include "hrtf/rosella_filterbank_tables.h"
|
||||||
|
|
||||||
|
namespace joc::hrtf {
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
constexpr std::size_t kBands = 64;
|
||||||
|
constexpr std::size_t kQmfTaps = 10;
|
||||||
|
constexpr std::size_t kHybridTaps = 11;
|
||||||
|
constexpr std::size_t kHybridDelay = 3;
|
||||||
|
constexpr std::array<std::size_t, 16> kHybridOrder = {0, 7, 1, 6, 2, 9, 3, 4,
|
||||||
|
10, 5, 11, 15, 8, 12, 13, 14};
|
||||||
|
|
||||||
|
const dsp::FftPlan& qmf_plan() {
|
||||||
|
static const dsp::FftPlan plan(kBands, false);
|
||||||
|
return plan;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dsp::FftPlan& hybrid_plan(std::size_t bands) {
|
||||||
|
static const dsp::FftPlan eight(8, false);
|
||||||
|
static const dsp::FftPlan four(4, false);
|
||||||
|
return bands == 8 ? eight : four;
|
||||||
|
}
|
||||||
|
|
||||||
|
double tap_sign(std::size_t tap) { return (tap / 2) % 2 == 0 ? 1.0 : -1.0; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
RosellaFilterbank::RosellaFilterbank(std::size_t channels)
|
||||||
|
: channels_(channels), analysis_history_(kQmfTaps * channels * kBands),
|
||||||
|
hybrid_history_(kHybridTaps * channels * kBands),
|
||||||
|
synthesis_history_(kQmfTaps * channels * kBands), spectrum_(kBands), hybrid_eight_(8),
|
||||||
|
hybrid_four_(4) {}
|
||||||
|
|
||||||
|
void RosellaFilterbank::reset() {
|
||||||
|
analysis_position_ = 0;
|
||||||
|
hybrid_position_ = 0;
|
||||||
|
synthesis_position_ = 0;
|
||||||
|
std::fill(analysis_history_.begin(), analysis_history_.end(), 0.0);
|
||||||
|
std::fill(hybrid_history_.begin(), hybrid_history_.end(), Complex{});
|
||||||
|
std::fill(synthesis_history_.begin(), synthesis_history_.end(), Complex{});
|
||||||
|
}
|
||||||
|
|
||||||
|
void RosellaFilterbank::analyze_qmf(const std::vector<double>& hops, std::size_t slots,
|
||||||
|
std::vector<Complex>* qmf) {
|
||||||
|
const std::size_t stride = channels_ * kBands;
|
||||||
|
qmf->resize(slots * stride);
|
||||||
|
for (std::size_t slot = 0; slot < slots; ++slot) {
|
||||||
|
std::copy_n(hops.data() + slot * stride, stride,
|
||||||
|
analysis_history_.data() + analysis_position_ * stride);
|
||||||
|
for (std::size_t channel = 0; channel < channels_; ++channel) {
|
||||||
|
for (std::size_t band = 0; band < kBands; ++band) {
|
||||||
|
double even = 0.0;
|
||||||
|
double odd = 0.0;
|
||||||
|
for (std::size_t tap = 0; tap < kQmfTaps; ++tap) {
|
||||||
|
const std::size_t history_slot = (analysis_position_ + tap + 1) % kQmfTaps;
|
||||||
|
const double value =
|
||||||
|
analysis_history_[history_slot * stride + channel * kBands + band];
|
||||||
|
const double contribution =
|
||||||
|
value * 0.5 * rosella_filterbank_tables::kPrototype[band * kQmfTaps + tap] *
|
||||||
|
tap_sign(tap);
|
||||||
|
(tap % 2 == 0 ? even : odd) += contribution;
|
||||||
|
}
|
||||||
|
spectrum_[band] = Complex(odd, even) * rosella_filterbank_tables::kRotation[band];
|
||||||
|
}
|
||||||
|
dsp::fft_radix2(&spectrum_, qmf_plan());
|
||||||
|
Complex* destination = qmf->data() + slot * stride + channel * kBands;
|
||||||
|
for (std::size_t band = 0; band < kBands / 2; ++band) {
|
||||||
|
destination[2 * band] = spectrum_[band] / 64.0;
|
||||||
|
destination[2 * band + 1] = std::conj(spectrum_[63 - band]) / 64.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
analysis_position_ = (analysis_position_ + 1) % kQmfTaps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RosellaFilterbank::analyze_hybrid(const std::vector<Complex>& qmf, std::size_t slots,
|
||||||
|
std::vector<Complex>* hybrid) {
|
||||||
|
const std::size_t stride = channels_ * kBands;
|
||||||
|
hybrid->resize(slots * channels_ * kHybridBandCount);
|
||||||
|
for (std::size_t slot = 0; slot < slots; ++slot) {
|
||||||
|
std::copy_n(qmf.data() + slot * stride, stride,
|
||||||
|
hybrid_history_.data() + hybrid_position_ * stride);
|
||||||
|
for (std::size_t channel = 0; channel < channels_; ++channel) {
|
||||||
|
std::array<Complex, 16> low{};
|
||||||
|
for (std::size_t band = 0; band < 3; ++band) {
|
||||||
|
std::vector<Complex>& spectrum = band == 0 ? hybrid_eight_ : hybrid_four_;
|
||||||
|
std::fill(spectrum.begin(), spectrum.end(), Complex{});
|
||||||
|
for (std::size_t tap = 0; tap < kHybridTaps; ++tap) {
|
||||||
|
const std::size_t history_slot = (hybrid_position_ + tap + 1) % kHybridTaps;
|
||||||
|
const std::size_t bin =
|
||||||
|
(tap + kHybridDelay + 1 + 2 * spectrum.size() - kHybridTaps) %
|
||||||
|
spectrum.size();
|
||||||
|
spectrum[bin] +=
|
||||||
|
hybrid_history_[history_slot * stride + channel * kBands + band] *
|
||||||
|
rosella_filterbank_tables::kHybrid[(band == 0 ? 0 : kHybridTaps) + tap];
|
||||||
|
}
|
||||||
|
dsp::fft_radix2(&spectrum, hybrid_plan(spectrum.size()));
|
||||||
|
std::copy(spectrum.begin(), spectrum.end(),
|
||||||
|
low.begin() + (band == 0 ? 0 : 4 + band * 4));
|
||||||
|
}
|
||||||
|
Complex* destination = hybrid->data() + (slot * channels_ + channel) * kHybridBandCount;
|
||||||
|
for (std::size_t band = 0; band < low.size(); ++band) {
|
||||||
|
destination[band] = low[kHybridOrder[band]];
|
||||||
|
}
|
||||||
|
destination[1] = std::conj(destination[1]);
|
||||||
|
destination[3] = std::conj(destination[3]);
|
||||||
|
const std::size_t delayed =
|
||||||
|
(hybrid_position_ + kHybridTaps - kHybridDelay) % kHybridTaps;
|
||||||
|
std::copy_n(hybrid_history_.data() + delayed * stride + channel * kBands + 3,
|
||||||
|
kBands - 3, destination + 16);
|
||||||
|
}
|
||||||
|
hybrid_position_ = (hybrid_position_ + 1) % kHybridTaps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RosellaFilterbank::synthesize_hybrid(const std::vector<Complex>& hybrid, std::size_t slots,
|
||||||
|
std::vector<Complex>* qmf) {
|
||||||
|
qmf->resize(slots * channels_ * kBands);
|
||||||
|
for (std::size_t row = 0; row < slots * channels_; ++row) {
|
||||||
|
const Complex* source = hybrid.data() + row * kHybridBandCount;
|
||||||
|
Complex* destination = qmf->data() + row * kBands;
|
||||||
|
destination[0] = source[0] + source[2] + source[4] + source[6] + source[7] + source[9] +
|
||||||
|
std::conj(source[3]) + std::conj(source[1]);
|
||||||
|
destination[1] = source[12] + source[5] + source[8] + source[10];
|
||||||
|
destination[2] = source[13] + source[14] + source[15] + source[11];
|
||||||
|
std::copy_n(source + 16, kBands - 3, destination + 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RosellaFilterbank::synthesize_qmf(const std::vector<Complex>& qmf, std::size_t slots,
|
||||||
|
std::vector<double>* hops) {
|
||||||
|
const std::size_t stride = channels_ * kBands;
|
||||||
|
hops->resize(slots * stride);
|
||||||
|
for (std::size_t slot = 0; slot < slots; ++slot) {
|
||||||
|
for (std::size_t channel = 0; channel < channels_; ++channel) {
|
||||||
|
const Complex* source = qmf.data() + slot * stride + channel * kBands;
|
||||||
|
for (std::size_t band = 0; band < kBands / 2; ++band) {
|
||||||
|
spectrum_[band] = std::conj(source[2 * band]);
|
||||||
|
spectrum_[32 + band] = source[63 - 2 * band];
|
||||||
|
}
|
||||||
|
dsp::fft_radix2(&spectrum_, qmf_plan());
|
||||||
|
Complex* current =
|
||||||
|
synthesis_history_.data() + synthesis_position_ * stride + channel * kBands;
|
||||||
|
for (std::size_t band = 0; band < kBands; ++band) {
|
||||||
|
current[band] = spectrum_[band] * rosella_filterbank_tables::kRotation[band];
|
||||||
|
}
|
||||||
|
for (std::size_t band = 0; band < kBands; ++band) {
|
||||||
|
double value = 0.0;
|
||||||
|
for (std::size_t lag = 0; lag < kQmfTaps; ++lag) {
|
||||||
|
const std::size_t history_slot =
|
||||||
|
(synthesis_position_ + kQmfTaps - lag) % kQmfTaps;
|
||||||
|
const Complex sample =
|
||||||
|
synthesis_history_[history_slot * stride + channel * kBands + band];
|
||||||
|
const double component = lag % 2 == 0 ? sample.real() : sample.imag();
|
||||||
|
value +=
|
||||||
|
component *
|
||||||
|
rosella_filterbank_tables::kPrototype[(63 - band) * kQmfTaps + 9 - lag] *
|
||||||
|
tap_sign(lag) * 2.0;
|
||||||
|
}
|
||||||
|
(*hops)[slot * stride + channel * kBands + band] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
synthesis_position_ = (synthesis_position_ + 1) % kQmfTaps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "hrtf/public_filterbank.h"
|
||||||
|
|
||||||
|
namespace joc::hrtf {
|
||||||
|
|
||||||
|
class RosellaFilterbank {
|
||||||
|
public:
|
||||||
|
static constexpr int kLatencySamples = 448;
|
||||||
|
|
||||||
|
explicit RosellaFilterbank(std::size_t channels);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
void analyze_qmf(const std::vector<double>& hops, std::size_t slots, std::vector<Complex>* qmf);
|
||||||
|
void analyze_hybrid(const std::vector<Complex>& qmf, std::size_t slots,
|
||||||
|
std::vector<Complex>* hybrid);
|
||||||
|
void synthesize_hybrid(const std::vector<Complex>& hybrid, std::size_t slots,
|
||||||
|
std::vector<Complex>* qmf);
|
||||||
|
void synthesize_qmf(const std::vector<Complex>& qmf, std::size_t slots,
|
||||||
|
std::vector<double>* hops);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::size_t channels_;
|
||||||
|
std::size_t analysis_position_ = 0;
|
||||||
|
std::size_t hybrid_position_ = 0;
|
||||||
|
std::size_t synthesis_position_ = 0;
|
||||||
|
std::vector<double> analysis_history_;
|
||||||
|
std::vector<Complex> hybrid_history_;
|
||||||
|
std::vector<Complex> synthesis_history_;
|
||||||
|
std::vector<Complex> spectrum_;
|
||||||
|
std::vector<Complex> hybrid_eight_;
|
||||||
|
std::vector<Complex> hybrid_four_;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,317 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <complex>
|
||||||
|
|
||||||
|
namespace joc::hrtf::rosella_filterbank_tables {
|
||||||
|
|
||||||
|
inline constexpr std::array<double, 640> kPrototype = {
|
||||||
|
0x1.89b0a40000000p-14f, -0x1.9405b80000000p-11f, 0x1.caf19e0000000p-11f,
|
||||||
|
0x1.b88a900000000p-8f, 0x1.a3899a0000000p-8f, -0x1.fa22860000000p-4f,
|
||||||
|
0x1.5a540e0000000p-4f, 0x1.c420360000000p-1f, 0x1.1fb7200000000p-1f,
|
||||||
|
-0x1.eb519a0000000p-12f, 0x1.fe69400000000p-14f, -0x1.aebea80000000p-11f,
|
||||||
|
0x1.0b0c7c0000000p-10f, 0x1.baec6c0000000p-8f, 0x1.7fc1900000000p-8f,
|
||||||
|
-0x1.0209c80000000p-3f, 0x1.88474c0000000p-4f, 0x1.c7781c0000000p-1f,
|
||||||
|
0x1.1929680000000p-1f, -0x1.6f0b9e0000000p-9f, 0x1.0c4e040000000p-13f,
|
||||||
|
-0x1.cabdf80000000p-11f, 0x1.3039ee0000000p-10f, 0x1.bd5e600000000p-8f,
|
||||||
|
0x1.590ba60000000p-8f, -0x1.06dd700000000p-3f, 0x1.b728e40000000p-4f,
|
||||||
|
0x1.ca9d100000000p-1f, 0x1.1298c60000000p-1f, -0x1.430d400000000p-8f,
|
||||||
|
0x1.09af720000000p-13f, -0x1.e7140c0000000p-11f, 0x1.553e000000000p-10f,
|
||||||
|
0x1.bfe6ee0000000p-8f, 0x1.2f581e0000000p-8f, -0x1.0b89600000000p-3f,
|
||||||
|
0x1.e6f2b20000000p-4f, 0x1.cd8f8e0000000p-1f, 0x1.0c066e0000000p-1f,
|
||||||
|
-0x1.c5fd4e0000000p-8f, 0x1.01e0d60000000p-13f, -0x1.01e8060000000p-10f,
|
||||||
|
0x1.7a2d9e0000000p-10f, 0x1.c2890c0000000p-8f, 0x1.028f2c0000000p-8f,
|
||||||
|
-0x1.100a6e0000000p-3f, 0x1.0bcf280000000p-3f, 0x1.d04eb00000000p-1f,
|
||||||
|
0x1.0573b40000000p-1f, -0x1.1fe42e0000000p-7f, 0x1.e4c9900000000p-14f,
|
||||||
|
-0x1.1083480000000p-10f, 0x1.9ef9b00000000p-10f, 0x1.c548880000000p-8f,
|
||||||
|
0x1.a536b40000000p-9f, -0x1.145d660000000p-3f, 0x1.2492a60000000p-3f,
|
||||||
|
0x1.d2d9d00000000p-1f, 0x1.fdc3f40000000p-2f, -0x1.584fbc0000000p-7f,
|
||||||
|
0x1.bbe1f00000000p-14f, -0x1.1f4cc40000000p-10f, 0x1.c3a28c0000000p-10f,
|
||||||
|
0x1.c828fe0000000p-8f, 0x1.3ed0ae0000000p-9f, -0x1.187f1e0000000p-3f,
|
||||||
|
0x1.3dc0340000000p-3f, 0x1.d530800000000p-1f, 0x1.f0a4d80000000p-2f,
|
||||||
|
-0x1.8c9d380000000p-7f, 0x1.8b83740000000p-14f, -0x1.2e42340000000p-10f,
|
||||||
|
0x1.e827840000000p-10f, 0x1.cb2f1a0000000p-8f, 0x1.a38bba0000000p-10f,
|
||||||
|
-0x1.1c6c620000000p-3f, 0x1.5754320000000p-3f, 0x1.d7522c0000000p-1f,
|
||||||
|
0x1.e38cc40000000p-2f, -0x1.bccca00000000p-7f, 0x1.51b3dc0000000p-14f,
|
||||||
|
-0x1.3d59c40000000p-10f, 0x1.0642740000000p-9f, 0x1.ce5f720000000p-8f,
|
||||||
|
0x1.77c5740000000p-11f, -0x1.2021ea0000000p-3f, 0x1.714ae20000000p-3f,
|
||||||
|
0x1.d93e620000000p-1f, 0x1.d67e3e0000000p-2f, -0x1.e902340000000p-7f,
|
||||||
|
0x1.1135380000000p-14f, -0x1.4c72680000000p-10f, 0x1.184f0e0000000p-9f,
|
||||||
|
0x1.d1bcf80000000p-8f, -0x1.cd43660000000p-13f, -0x1.239c8a0000000p-3f,
|
||||||
|
0x1.8ba0220000000p-3f, 0x1.daf4c80000000p-1f, 0x1.c97bac0000000p-2f,
|
||||||
|
-0x1.08b5360000000p-6f, 0x1.9380400000000p-15f, -0x1.5b82640000000p-10f,
|
||||||
|
0x1.2a36bc0000000p-9f, 0x1.d54b040000000p-8f, -0x1.3d508c0000000p-10f,
|
||||||
|
-0x1.26d9020000000p-3f, 0x1.a64ff60000000p-3f, 0x1.dc75060000000p-1f,
|
||||||
|
0x1.bc87920000000p-2f, -0x1.1b117c0000000p-6f, 0x1.ef2dd20000000p-16f,
|
||||||
|
-0x1.6a7bb60000000p-10f, 0x1.3bf6ea0000000p-9f, 0x1.d90d680000000p-8f,
|
||||||
|
-0x1.27adc40000000p-9f, -0x1.29d4040000000p-3f, 0x1.c156200000000p-3f,
|
||||||
|
0x1.ddbed80000000p-1f, 0x1.afa4460000000p-2f, -0x1.2ba7240000000p-6f,
|
||||||
|
0x1.4b90ac0000000p-17f, -0x1.7946720000000p-10f, 0x1.4d8e5a0000000p-9f,
|
||||||
|
0x1.dd07fe0000000p-8f, -0x1.b800720000000p-9f, -0x1.2c8a500000000p-3f,
|
||||||
|
0x1.dcae220000000p-3f, 0x1.ded2060000000p-1f, 0x1.a2d44a0000000p-2f,
|
||||||
|
-0x1.3a80720000000p-6f, -0x1.700b940000000p-17f, -0x1.87d4460000000p-10f,
|
||||||
|
0x1.5ef8ce0000000p-9f, 0x1.e13c820000000p-8f, -0x1.27dccc0000000p-8f,
|
||||||
|
-0x1.2ef8a80000000p-3f, 0x1.f853940000000p-3f, 0x1.dfae620000000p-1f,
|
||||||
|
0x1.9619e20000000p-2f, -0x1.47ad4c0000000p-6f, -0x1.1120780000000p-15f,
|
||||||
|
-0x1.960c8c0000000p-10f, 0x1.7033800000000p-9f, 0x1.e5adfa0000000p-8f,
|
||||||
|
-0x1.7778760000000p-8f, -0x1.311bc00000000p-3f, 0x1.0a20dc0000000p-2f,
|
||||||
|
0x1.e053dc0000000p-1f, 0x1.8977600000000p-2f, -0x1.533fe20000000p-6f,
|
||||||
|
-0x1.ca9a980000000p-15f, -0x1.a3dfa80000000p-10f, 0x1.813d240000000p-9f,
|
||||||
|
0x1.ea5d320000000p-8f, -0x1.cade8a0000000p-8f, -0x1.32f0680000000p-3f,
|
||||||
|
0x1.1839ec0000000p-2f, 0x1.e0c25e0000000p-1f, 0x1.7cef0e0000000p-2f,
|
||||||
|
-0x1.5d41a40000000p-6f, -0x1.45160a0000000p-14f, -0x1.b13e1c0000000p-10f,
|
||||||
|
0x1.9211160000000p-9f, 0x1.ef4d0a0000000p-8f, -0x1.110bcc0000000p-7f,
|
||||||
|
-0x1.3473540000000p-3f, 0x1.2672860000000p-2f, 0x1.e0f9ee0000000p-1f,
|
||||||
|
0x1.7083220000000p-2f, -0x1.65bf6a0000000p-6f, -0x1.a5d63c0000000p-14f,
|
||||||
|
-0x1.be0c7c0000000p-10f, 0x1.a2ad420000000p-9f, 0x1.f47de80000000p-8f,
|
||||||
|
-0x1.3e95720000000p-7f, -0x1.35a15c0000000p-3f, 0x1.34c8260000000p-2f,
|
||||||
|
0x1.e0faa00000000p-1f, 0x1.6435c80000000p-2f, -0x1.6cc7d80000000p-6f,
|
||||||
|
-0x1.0363300000000p-13f, -0x1.ca38de0000000p-10f, 0x1.b30fc40000000p-9f,
|
||||||
|
0x1.f9f0320000000p-8f, -0x1.6e0f4e0000000p-7f, -0x1.3677520000000p-3f,
|
||||||
|
0x1.43383c0000000p-2f, 0x1.e0c4920000000p-1f, 0x1.58091e0000000p-2f,
|
||||||
|
-0x1.7268700000000p-6f, -0x1.33a4780000000p-13f, -0x1.d5b2c20000000p-10f,
|
||||||
|
0x1.c336cc0000000p-9f, 0x1.ffa3600000000p-8f, -0x1.9f7bd20000000p-7f,
|
||||||
|
-0x1.36f2140000000p-3f, 0x1.51c02e0000000p-2f, 0x1.e057f20000000p-1f,
|
||||||
|
0x1.4bff340000000p-2f, -0x1.76ae0c0000000p-6f, -0x1.63044a0000000p-13f,
|
||||||
|
-0x1.e062560000000p-10f, 0x1.d321240000000p-9f, 0x1.02cb720000000p-7f,
|
||||||
|
-0x1.d2dcc20000000p-7f, -0x1.370e8a0000000p-3f, 0x1.605d580000000p-2f,
|
||||||
|
0x1.dfb5020000000p-1f, 0x1.401a140000000p-2f, -0x1.79a3480000000p-6f,
|
||||||
|
-0x1.91dea40000000p-13f, -0x1.ea3a6c0000000p-10f, 0x1.e2cc1c0000000p-9f,
|
||||||
|
0x1.05e49c0000000p-7f, -0x1.04190e0000000p-6f, -0x1.36c9a00000000p-3f,
|
||||||
|
0x1.6f0cfe0000000p-2f, 0x1.dedc080000000p-1f, 0x1.345b9e0000000p-2f,
|
||||||
|
-0x1.7b56a00000000p-6f, -0x1.bfa7220000000p-13f, -0x1.f327920000000p-10f,
|
||||||
|
0x1.f234380000000p-9f, 0x1.091c860000000p-7f, -0x1.1fbe040000000p-6f,
|
||||||
|
-0x1.36205c0000000p-3f, 0x1.7dcc500000000p-2f, 0x1.ddcd600000000p-1f,
|
||||||
|
0x1.28c5be0000000p-2f, -0x1.7bd6c00000000p-6f, -0x1.ebbcb00000000p-13f,
|
||||||
|
-0x1.fb17ea0000000p-10f, 0x1.00ad9a0000000p-8f, 0x1.0c71000000000p-7f,
|
||||||
|
-0x1.3c5cfa0000000p-6f, -0x1.350fba0000000p-3f, 0x1.8c989a0000000p-2f,
|
||||||
|
0x1.dc89760000000p-1f, 0x1.1d5a3e0000000p-2f, -0x1.7b2ea80000000p-6f,
|
||||||
|
-0x1.0afed40000000p-12f, -0x1.00fdf80000000p-9f, 0x1.081ef40000000p-8f,
|
||||||
|
0x1.0fe0aa0000000p-7f, -0x1.59f4a60000000p-6f, -0x1.3394de0000000p-3f,
|
||||||
|
0x1.9b6efe0000000p-2f, 0x1.db10b80000000p-1f, 0x1.121ad80000000p-2f,
|
||||||
|
-0x1.796b8c0000000p-6f, -0x1.1f023c0000000p-12f, -0x1.03dff00000000p-9f,
|
||||||
|
0x1.0f6d1a0000000p-8f, 0x1.1368de0000000p-7f, -0x1.7883900000000p-6f,
|
||||||
|
-0x1.31acee0000000p-3f, 0x1.aa4c940000000p-2f, 0x1.d963ae0000000p-1f,
|
||||||
|
0x1.07092e0000000p-2f, -0x1.769b420000000p-6f, -0x1.31d35c0000000p-12f,
|
||||||
|
-0x1.062c000000000p-9f, 0x1.1697660000000p-8f, 0x1.1706fa0000000p-7f,
|
||||||
|
-0x1.9807dc0000000p-6f, -0x1.2f55300000000p-3f, 0x1.b92e760000000p-2f,
|
||||||
|
0x1.d782e20000000p-1f, 0x1.f84daa0000000p-3f, -0x1.72cc440000000p-6f,
|
||||||
|
-0x1.435c0e0000000p-12f, -0x1.07dcd20000000p-9f, 0x1.1d9da20000000p-8f,
|
||||||
|
0x1.1ab8380000000p-7f, -0x1.b87f060000000p-6f, -0x1.2c8af40000000p-3f,
|
||||||
|
0x1.c811b40000000p-2f, 0x1.d56ef40000000p-1f, 0x1.e2ea940000000p-3f,
|
||||||
|
-0x1.6e0bd80000000p-6f, -0x1.5382940000000p-12f, -0x1.08eac40000000p-9f,
|
||||||
|
0x1.247f400000000p-8f, 0x1.1e79ce0000000p-7f, -0x1.d9e6460000000p-6f,
|
||||||
|
-0x1.294b8c0000000p-3f, 0x1.d6f34e0000000p-2f, 0x1.d3288c0000000p-1f,
|
||||||
|
0x1.cdebe00000000p-3f, -0x1.6865f20000000p-6f, -0x1.624b420000000p-12f,
|
||||||
|
-0x1.0952b80000000p-9f, 0x1.2b3bdc0000000p-8f, 0x1.2247060000000p-7f,
|
||||||
|
-0x1.fc3a1a0000000p-6f, -0x1.2594900000000p-3f, 0x1.e5d0500000000p-2f,
|
||||||
|
0x1.d0b05e0000000p-1f, 0x1.b9542e0000000p-3f, -0x1.61ea740000000p-6f,
|
||||||
|
-0x1.6f8fc20000000p-12f, -0x1.090d6a0000000p-9f, 0x1.31d25e0000000p-8f,
|
||||||
|
0x1.261bfc0000000p-7f, -0x1.0fbb460000000p-5f, -0x1.21637c0000000p-3f,
|
||||||
|
0x1.f4a5aa0000000p-2f, 0x1.ce072e0000000p-1f, 0x1.a525de0000000p-3f,
|
||||||
|
-0x1.5aa7b40000000p-6f, -0x1.7b53da0000000p-12f, -0x1.0819600000000p-9f,
|
||||||
|
0x1.3842c00000000p-8f, 0x1.29f3580000000p-7f, -0x1.21cbac0000000p-5f,
|
||||||
|
-0x1.1cb60a0000000p-3f, 0x1.01b82e0000000p-1f, 0x1.cb2dca0000000p-1f,
|
||||||
|
0x1.9163520000000p-3f, -0x1.52aada0000000p-6f, -0x1.85a5dc0000000p-12f,
|
||||||
|
-0x1.0671aa0000000p-9f, 0x1.3e8b260000000p-8f, 0x1.2dc77c0000000p-7f,
|
||||||
|
-0x1.344b9e0000000p-5f, -0x1.1789fc0000000p-3f, 0x1.0916a80000000p-1f,
|
||||||
|
0x1.c824fc0000000p-1f, 0x1.7e0e860000000p-3f, -0x1.4a023a0000000p-6f,
|
||||||
|
-0x1.8e754e0000000p-12f, -0x1.0411fc0000000p-9f, 0x1.44aa780000000p-8f,
|
||||||
|
0x1.3192620000000p-7f, -0x1.4738520000000p-5f, -0x1.11dd300000000p-3f,
|
||||||
|
0x1.106cbc0000000p-1f, 0x1.c4edac0000000p-1f, 0x1.6b29640000000p-3f,
|
||||||
|
-0x1.40bbf00000000p-6f, -0x1.95db9a0000000p-12f, -0x1.00fbba0000000p-9f,
|
||||||
|
0x1.4aa1d60000000p-8f, 0x1.354e160000000p-7f, -0x1.5a8eb80000000p-5f,
|
||||||
|
-0x1.0bad980000000p-3f, 0x1.17b8dc0000000p-1f, 0x1.c188c20000000p-1f,
|
||||||
|
0x1.58b59e0000000p-3f, -0x1.36e7a40000000p-6f, -0x1.9be6720000000p-12f,
|
||||||
|
-0x1.fa5a8a0000000p-10f, 0x1.506fe80000000p-8f, 0x1.38f3740000000p-7f,
|
||||||
|
-0x1.6e4b4c0000000p-5f, -0x1.04f9500000000p-3f, 0x1.1ef9820000000p-1f,
|
||||||
|
0x1.bdf7340000000p-1f, 0x1.46b4b40000000p-3f, -0x1.2c935c0000000p-6f,
|
||||||
|
-0x1.a0ae100000000p-12f, -0x1.f14b760000000p-10f, 0x1.5614b40000000p-8f,
|
||||||
|
0x1.3c7bfe0000000p-7f, -0x1.826b260000000p-5f, -0x1.fb7d1c0000000p-4f,
|
||||||
|
0x1.262d200000000p-1f, 0x1.ba3a080000000p-1f, 0x1.3527ea0000000p-3f,
|
||||||
|
-0x1.21cb9e0000000p-6f, -0x1.a45ab20000000p-12f, -0x1.e6cbec0000000p-10f,
|
||||||
|
0x1.5b8f3c0000000p-8f, 0x1.3fdefe0000000p-7f, -0x1.96ea060000000p-5f,
|
||||||
|
-0x1.ebf76a0000000p-4f, 0x1.2d52300000000p-1f, 0x1.b652420000000p-1f,
|
||||||
|
0x1.24103e0000000p-3f, -0x1.16a0ec0000000p-6f, -0x1.a6fa860000000p-12f,
|
||||||
|
-0x1.dadcf00000000p-10f, 0x1.60df2e0000000p-8f, 0x1.4315740000000p-7f,
|
||||||
|
-0x1.abc3c80000000p-5f, -0x1.db5e1e0000000p-4f, 0x1.3467220000000p-1f,
|
||||||
|
0x1.b240fa0000000p-1f, 0x1.136ebc0000000p-3f, -0x1.0b217a0000000p-6f,
|
||||||
|
-0x1.a8bb460000000p-12f, -0x1.cd821e0000000p-10f, 0x1.6605500000000p-8f,
|
||||||
|
0x1.4617c60000000p-7f, -0x1.c0f3f60000000p-5f, -0x1.c9aeee0000000p-4f,
|
||||||
|
0x1.3b6a700000000p-1f, 0x1.ae07440000000p-1f, 0x1.03441c0000000p-3f,
|
||||||
|
-0x1.feb4ba0000000p-7f, -0x1.a9e0be0000000p-12f, -0x1.bebef20000000p-10f,
|
||||||
|
0x1.6b004c0000000p-8f, 0x1.48dc4a0000000p-7f, -0x1.d675c20000000p-5f,
|
||||||
|
-0x1.b6e6ae0000000p-4f, 0x1.425a960000000p-1f, 0x1.a9a64c0000000p-1f,
|
||||||
|
0x1.e7217e0000000p-4f, -0x1.e6b55c0000000p-7f, -0x1.aa85020000000p-12f,
|
||||||
|
-0x1.ae9b460000000p-10f, 0x1.6fd00c0000000p-8f, 0x1.4b59340000000p-7f,
|
||||||
|
-0x1.ec43c80000000p-5f, -0x1.a303a20000000p-4f, 0x1.49360c0000000p-1f,
|
||||||
|
0x1.a51f340000000p-1f, 0x1.c8a9d20000000p-4f, -0x1.ce5e0a0000000p-7f,
|
||||||
|
-0x1.aade480000000p-12f, -0x1.9d1b940000000p-10f, 0x1.7474cc0000000p-8f,
|
||||||
|
0x1.4d85040000000p-7f, -0x1.012c820000000p-4f, -0x1.8e03600000000p-4f,
|
||||||
|
0x1.4ffb520000000p-1f, 0x1.a073360000000p-1f, 0x1.ab21ee0000000p-4f,
|
||||||
|
-0x1.b5ce920000000p-7f, -0x1.ab1c980000000p-12f, -0x1.8a49160000000p-10f,
|
||||||
|
0x1.78eec60000000p-8f, 0x1.4f55b00000000p-7f, -0x1.0c57ca0000000p-4f,
|
||||||
|
-0x1.77e4720000000p-4f, 0x1.56a8e60000000p-1f, 0x1.9ba3820000000p-1f,
|
||||||
|
0x1.8e894a0000000p-4f, -0x1.9d20fe0000000p-7f, -0x1.ab834e0000000p-12f,
|
||||||
|
-0x1.762b260000000p-10f, 0x1.7d3dde0000000p-8f, 0x1.50c0480000000p-7f,
|
||||||
|
-0x1.17a0ae0000000p-4f, -0x1.60a5560000000p-4f, 0x1.5d3d4e0000000p-1f,
|
||||||
|
0x1.96b1680000000p-1f, 0x1.72df7c0000000p-4f, -0x1.846b160000000p-7f,
|
||||||
|
-0x1.ac64680000000p-12f, -0x1.60cd740000000p-10f, 0x1.81625a0000000p-8f,
|
||||||
|
0x1.51b9dc0000000p-7f, -0x1.2303ee0000000p-4f, -0x1.4845000000000p-4f,
|
||||||
|
0x1.63b7140000000p-1f, 0x1.919e200000000p-1f, 0x1.5823340000000p-4f,
|
||||||
|
-0x1.6bcd900000000p-7f, -0x1.adf08e0000000p-12f, -0x1.4a3ac20000000p-10f,
|
||||||
|
0x1.855cfe0000000p-8f, 0x1.5237680000000p-7f, -0x1.2e7e4e0000000p-4f,
|
||||||
|
-0x1.2ec2760000000p-4f, 0x1.6a14c00000000p-1f, 0x1.8c6afe0000000p-1f,
|
||||||
|
0x1.3e53ba0000000p-4f, -0x1.53608c0000000p-7f, -0x1.b06dac0000000p-12f,
|
||||||
|
-0x1.327bec0000000p-10f, 0x1.892e780000000p-8f, 0x1.522d9c0000000p-7f,
|
||||||
|
-0x1.3a0c300000000p-4f, -0x1.141d6e0000000p-4f, 0x1.7054ee0000000p-1f,
|
||||||
|
0x1.87194e0000000p-1f, 0x1.256f780000000p-4f, -0x1.3b3a720000000p-7f,
|
||||||
|
-0x1.b4260a0000000p-12f, -0x1.199f100000000p-10f, 0x1.8cd8000000000p-8f,
|
||||||
|
0x1.5190560000000p-7f, -0x1.45aa140000000p-4f, -0x1.f0ab120000000p-5f,
|
||||||
|
0x1.7676320000000p-1f, 0x1.81aa700000000p-1f, 0x1.0d73ae0000000p-4f,
|
||||||
|
-0x1.2378140000000p-7f, -0x1.b946980000000p-12f, -0x1.ff5dae0000000p-11f,
|
||||||
|
0x1.905a600000000p-8f, 0x1.5053d20000000p-7f, -0x1.5154220000000p-4f,
|
||||||
|
-0x1.b6d5d40000000p-5f, 0x1.7c772e0000000p-1f, 0x1.7c1fb80000000p-1f,
|
||||||
|
0x1.ecbc3e0000000p-5f, -0x1.0c29f20000000p-7f, -0x1.c0151e0000000p-12f,
|
||||||
|
-0x1.c96f140000000p-11f, 0x1.93b7460000000p-8f, 0x1.4e6c1e0000000p-7f,
|
||||||
|
-0x1.5d064a0000000p-4f, -0x1.7abc7a0000000p-5f, 0x1.8256860000000p-1f,
|
||||||
|
0x1.767a860000000p-1f, 0x1.c059b00000000p-5f, -0x1.eadf100000000p-8f,
|
||||||
|
-0x1.c8cc9c0000000p-12f, -0x1.918eb80000000p-11f, 0x1.96effa0000000p-8f,
|
||||||
|
0x1.4bcc520000000p-7f, -0x1.68bca00000000p-4f, -0x1.3c5fe80000000p-5f,
|
||||||
|
0x1.8812e80000000p-1f, 0x1.70bc380000000p-1f, 0x1.95b8180000000p-5f,
|
||||||
|
-0x1.bebb380000000p-8f, -0x1.d3ab2e0000000p-12f, -0x1.57d51e0000000p-11f,
|
||||||
|
0x1.9a075e0000000p-8f, 0x1.4868760000000p-7f, -0x1.7472b40000000p-4f,
|
||||||
|
-0x1.f785a60000000p-6f, 0x1.8dab0e0000000p-1f, 0x1.6ae6480000000p-1f,
|
||||||
|
0x1.6cd0a40000000p-5f, -0x1.93fad20000000p-8f, -0x1.e0dd0e0000000p-12f,
|
||||||
|
-0x1.1c6a140000000p-11f, 0x1.9cfe1a0000000p-8f, 0x1.44329c0000000p-7f,
|
||||||
|
-0x1.80243a0000000p-4f, -0x1.71cfa40000000p-6f, 0x1.931db60000000p-1f,
|
||||||
|
0x1.64fa0a0000000p-1f, 0x1.459afa0000000p-5f, -0x1.6ae5d80000000p-8f,
|
||||||
|
-0x1.f0751e0000000p-12f, -0x1.bea86e0000000p-12f, 0x1.9fd7d60000000p-8f,
|
||||||
|
0x1.3f20100000000p-7f, -0x1.8bcca00000000p-4f, -0x1.cf4aee0000000p-7f,
|
||||||
|
0x1.9869a40000000p-1f, 0x1.5ef8f00000000p-1f, 0x1.2010120000000p-5f,
|
||||||
|
-0x1.43917e0000000p-8f, -0x1.014d9e0000000p-11f, -0x1.41769a0000000p-12f,
|
||||||
|
0x1.a2962a0000000p-8f, 0x1.39224a0000000p-7f, -0x1.9767380000000p-4f,
|
||||||
|
-0x1.643b740000000p-8f, 0x1.9d8dac0000000p-1f, 0x1.58e4620000000p-1f,
|
||||||
|
0x1.f8505c0000000p-6f, -0x1.1e15b40000000p-8f, -0x1.0bbd1e0000000p-11f,
|
||||||
|
-0x1.82f5720000000p-13f, 0x1.a53c820000000p-8f, 0x1.322da40000000p-7f,
|
||||||
|
-0x1.a2ef380000000p-4f, 0x1.cf4bf20000000p-9f, 0x1.a288b20000000p-1f,
|
||||||
|
0x1.52bdd00000000p-1f, 0x1.b3a9200000000p-6f, -0x1.f55fc60000000p-9f,
|
||||||
|
-0x1.1795420000000p-11f, -0x1.f78ba40000000p-15f, 0x1.a7cd100000000p-8f,
|
||||||
|
0x1.2a34100000000p-7f, -0x1.ae5f920000000p-4f, 0x1.a272920000000p-7f,
|
||||||
|
0x1.a7599a0000000p-1f, 0x1.4c86bc0000000p-1f, 0x1.72191a0000000p-6f,
|
||||||
|
-0x1.b278bc0000000p-9f, -0x1.24d82e0000000p-11f, 0x1.176aba0000000p-14f,
|
||||||
|
0x1.aa4b400000000p-8f, 0x1.21297e0000000p-7f, -0x1.b9b3340000000p-4f,
|
||||||
|
0x1.6cd36a0000000p-6f, 0x1.abff500000000p-1f, 0x1.46406e0000000p-1f,
|
||||||
|
0x1.3392320000000p-6f, -0x1.7413460000000p-9f, -0x1.3371980000000p-11f,
|
||||||
|
0x1.9954380000000p-13f, 0x1.acba4a0000000p-8f, 0x1.1700e40000000p-7f,
|
||||||
|
-0x1.c4e4ec0000000p-4f, 0x1.0655200000000p-5f, 0x1.b078e40000000p-1f,
|
||||||
|
0x1.3fec680000000p-1f, 0x1.efd5a20000000p-7f, -0x1.3a3eea0000000p-9f,
|
||||||
|
-0x1.43727a0000000p-11f, 0x1.5542700000000p-12f, 0x1.af1de80000000p-8f,
|
||||||
|
0x1.0bacb40000000p-7f, -0x1.cfef6c0000000p-4f, 0x1.58574a0000000p-5f,
|
||||||
|
0x1.b4c5620000000p-1f, 0x1.398c3c0000000p-1f, 0x1.7e1d1c0000000p-7f,
|
||||||
|
-0x1.039df20000000p-9f, -0x1.54c2b80000000p-11f, 0x1.df54960000000p-12f,
|
||||||
|
0x1.b17a740000000p-8f, 0x1.fe42040000000p-8f, -0x1.dacd4c0000000p-4f,
|
||||||
|
0x1.ac68700000000p-5f, 0x1.b8e3f00000000p-1f, 0x1.33211a0000000p-1f,
|
||||||
|
0x1.11a4f80000000p-7f, -0x1.a3b4ea0000000p-10f, -0x1.671b880000000p-11f,
|
||||||
|
0x1.3568c80000000p-11f, 0x1.b3d4520000000p-8f, 0x1.e2a46e0000000p-8f,
|
||||||
|
-0x1.e579200000000p-4f, 0x1.013ff60000000p-4f, 0x1.bcd3ee0000000p-1f,
|
||||||
|
0x1.2cacd00000000p-1f, 0x1.53b1420000000p-8f, -0x1.42fb1c0000000p-10f,
|
||||||
|
-0x1.7b9bba0000000p-11f, 0x1.7c27840000000p-11f, 0x1.b62ed40000000p-8f,
|
||||||
|
0x1.c465e60000000p-8f, -0x1.efecf00000000p-4f, 0x1.2d4b160000000p-4f,
|
||||||
|
0x1.c093960000000p-1f, 0x1.2631fe0000000p-1f, 0x1.21b5e00000000p-9f,
|
||||||
|
-0x1.a0c52c0000000p-11f,
|
||||||
|
};
|
||||||
|
|
||||||
|
inline constexpr std::array<std::complex<double>, 64> kRotation = {{
|
||||||
|
{0x1.fff6220000000p-1f, -0x1.921d200000000p-7f},
|
||||||
|
{0x1.ffa72e0000000p-1f, -0x1.2d86580000000p-5f},
|
||||||
|
{0x1.ff09560000000p-1f, -0x1.f656e80000000p-5f},
|
||||||
|
{0x1.fe1cb00000000p-1f, -0x1.5f6d000000000p-4f},
|
||||||
|
{0x1.fce1600000000p-1f, -0x1.c3785c0000000p-4f},
|
||||||
|
{0x1.fb57980000000p-1f, -0x1.139f0c0000000p-3f},
|
||||||
|
{0x1.f97f920000000p-1f, -0x1.45576c0000000p-3f},
|
||||||
|
{0x1.f7599a0000000p-1f, -0x1.76dd9e0000000p-3f},
|
||||||
|
{0x1.f4e6040000000p-1f, -0x1.a82a020000000p-3f},
|
||||||
|
{0x1.f225300000000p-1f, -0x1.d934fe0000000p-3f},
|
||||||
|
{0x1.ef178a0000000p-1f, -0x1.04fb800000000p-2f},
|
||||||
|
{0x1.ebbd8c0000000p-1f, -0x1.1d34440000000p-2f},
|
||||||
|
{0x1.e817ba0000000p-1f, -0x1.35410c0000000p-2f},
|
||||||
|
{0x1.e426a40000000p-1f, -0x1.4d1e240000000p-2f},
|
||||||
|
{0x1.dfeae60000000p-1f, -0x1.64c7de0000000p-2f},
|
||||||
|
{0x1.db65260000000p-1f, -0x1.7c3a940000000p-2f},
|
||||||
|
{0x1.d696180000000p-1f, -0x1.9372a60000000p-2f},
|
||||||
|
{0x1.d17e780000000p-1f, -0x1.aa6c820000000p-2f},
|
||||||
|
{0x1.cc1f100000000p-1f, -0x1.c1249e0000000p-2f},
|
||||||
|
{0x1.c678b40000000p-1f, -0x1.d797760000000p-2f},
|
||||||
|
{0x1.c08c420000000p-1f, -0x1.edc1960000000p-2f},
|
||||||
|
{0x1.ba5aa60000000p-1f, -0x1.01cfc80000000p-1f},
|
||||||
|
{0x1.b3e4d40000000p-1f, -0x1.0c97040000000p-1f},
|
||||||
|
{0x1.ad2bca0000000p-1f, -0x1.1734d60000000p-1f},
|
||||||
|
{0x1.a630920000000p-1f, -0x1.21a79a0000000p-1f},
|
||||||
|
{0x1.9ef43e0000000p-1f, -0x1.2bedb20000000p-1f},
|
||||||
|
{0x1.9777f00000000p-1f, -0x1.36058c0000000p-1f},
|
||||||
|
{0x1.8fbcca0000000p-1f, -0x1.3fed960000000p-1f},
|
||||||
|
{0x1.87c4000000000p-1f, -0x1.49a44a0000000p-1f},
|
||||||
|
{0x1.7f8ece0000000p-1f, -0x1.53282a0000000p-1f},
|
||||||
|
{0x1.771e760000000p-1f, -0x1.5c77bc0000000p-1f},
|
||||||
|
{0x1.6e74460000000p-1f, -0x1.6591920000000p-1f},
|
||||||
|
{0x1.6591920000000p-1f, -0x1.6e74460000000p-1f},
|
||||||
|
{0x1.5c77bc0000000p-1f, -0x1.771e760000000p-1f},
|
||||||
|
{0x1.53282a0000000p-1f, -0x1.7f8ece0000000p-1f},
|
||||||
|
{0x1.49a44a0000000p-1f, -0x1.87c4000000000p-1f},
|
||||||
|
{0x1.3fed960000000p-1f, -0x1.8fbcca0000000p-1f},
|
||||||
|
{0x1.36058c0000000p-1f, -0x1.9777f00000000p-1f},
|
||||||
|
{0x1.2bedb20000000p-1f, -0x1.9ef43e0000000p-1f},
|
||||||
|
{0x1.21a79a0000000p-1f, -0x1.a630920000000p-1f},
|
||||||
|
{0x1.1734d60000000p-1f, -0x1.ad2bca0000000p-1f},
|
||||||
|
{0x1.0c97040000000p-1f, -0x1.b3e4d40000000p-1f},
|
||||||
|
{0x1.01cfc80000000p-1f, -0x1.ba5aa60000000p-1f},
|
||||||
|
{0x1.edc1960000000p-2f, -0x1.c08c420000000p-1f},
|
||||||
|
{0x1.d797760000000p-2f, -0x1.c678b40000000p-1f},
|
||||||
|
{0x1.c1249e0000000p-2f, -0x1.cc1f100000000p-1f},
|
||||||
|
{0x1.aa6c820000000p-2f, -0x1.d17e780000000p-1f},
|
||||||
|
{0x1.9372a60000000p-2f, -0x1.d696180000000p-1f},
|
||||||
|
{0x1.7c3a940000000p-2f, -0x1.db65260000000p-1f},
|
||||||
|
{0x1.64c7de0000000p-2f, -0x1.dfeae60000000p-1f},
|
||||||
|
{0x1.4d1e240000000p-2f, -0x1.e426a40000000p-1f},
|
||||||
|
{0x1.35410c0000000p-2f, -0x1.e817ba0000000p-1f},
|
||||||
|
{0x1.1d34440000000p-2f, -0x1.ebbd8c0000000p-1f},
|
||||||
|
{0x1.04fb800000000p-2f, -0x1.ef178a0000000p-1f},
|
||||||
|
{0x1.d934fe0000000p-3f, -0x1.f225300000000p-1f},
|
||||||
|
{0x1.a82a020000000p-3f, -0x1.f4e6040000000p-1f},
|
||||||
|
{0x1.76dd9e0000000p-3f, -0x1.f7599a0000000p-1f},
|
||||||
|
{0x1.45576c0000000p-3f, -0x1.f97f920000000p-1f},
|
||||||
|
{0x1.139f0c0000000p-3f, -0x1.fb57980000000p-1f},
|
||||||
|
{0x1.c3785c0000000p-4f, -0x1.fce1600000000p-1f},
|
||||||
|
{0x1.5f6d000000000p-4f, -0x1.fe1cb00000000p-1f},
|
||||||
|
{0x1.f656e80000000p-5f, -0x1.ff09560000000p-1f},
|
||||||
|
{0x1.2d86580000000p-5f, -0x1.ffa72e0000000p-1f},
|
||||||
|
{0x1.921d200000000p-7f, -0x1.fff6220000000p-1f},
|
||||||
|
}};
|
||||||
|
|
||||||
|
inline constexpr std::array<std::complex<double>, 22> kHybrid = {{
|
||||||
|
{-0x1.3a7de80000000p-7f, 0x1.0488900000000p-8f},
|
||||||
|
{-0x1.4f39c60000000p-6f, 0x1.4f39c60000000p-6f},
|
||||||
|
{-0x1.4f65900000000p-6f, 0x1.94dc0e0000000p-5f},
|
||||||
|
{0x0.0p+0f, 0x1.4382f00000000p-4f},
|
||||||
|
{0x1.3844900000000p-5f, 0x1.78f0ca0000000p-4f},
|
||||||
|
{0x1.459b100000000p-4f, 0x1.459b100000000p-4f},
|
||||||
|
{0x1.c49e200000000p-4f, 0x1.76f5f60000000p-5f},
|
||||||
|
{0x1.0000000000000p-3f, 0x0.0p+0f},
|
||||||
|
{0x1.c426000000000p-4f, -0x1.7692720000000p-5f},
|
||||||
|
{0x1.2d4d820000000p-5f, -0x1.2d4d820000000p-5f},
|
||||||
|
{0x1.e4029a0000000p-6f, -0x1.2420400000000p-4f},
|
||||||
|
{-0x1.1ce09c0000000p-7f, 0x1.1ce0900000000p-7f},
|
||||||
|
{0x0.0p+0f, 0x1.b5bb180000000p-6f},
|
||||||
|
{0x1.586f240000000p-6f, 0x1.586f2c0000000p-6f},
|
||||||
|
{0x0.0p+0f, 0x0.0p+0f},
|
||||||
|
{-0x1.9eb2460000000p-5f, 0x1.9eb2460000000p-5f},
|
||||||
|
{0x0.0p+0f, 0x1.5019100000000p-3f},
|
||||||
|
{0x1.515a8e0000000p-3f, 0x1.515a8e0000000p-3f},
|
||||||
|
{0x1.0000000000000p-2f, 0x0.0p+0f},
|
||||||
|
{0x1.515b660000000p-3f, -0x1.515b660000000p-3f},
|
||||||
|
{0x0.0p+0f, -0x1.1f2f040000000p-3f},
|
||||||
|
{-0x1.af372a0000000p-5f, -0x1.af372a0000000p-5f},
|
||||||
|
}};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "foundation/fft.h"
|
#include "foundation/fft.h"
|
||||||
#include "hrtf/public_filterbank.h"
|
#include "hrtf/rosella_bank.h"
|
||||||
|
|
||||||
namespace joc::hrtf {
|
namespace joc::hrtf {
|
||||||
|
|
||||||
@@ -1003,8 +1003,8 @@ struct RosellaRuntime::Impl {
|
|||||||
std::vector<double> field_left;
|
std::vector<double> field_left;
|
||||||
std::vector<double> field_right;
|
std::vector<double> field_right;
|
||||||
Core core;
|
Core core;
|
||||||
std::unique_ptr<PublicFilterbank> analysis_bank;
|
std::unique_ptr<RosellaBank> analysis_bank;
|
||||||
std::unique_ptr<PublicFilterbank> synthesis_bank;
|
std::unique_ptr<RosellaBank> synthesis_bank;
|
||||||
timeline::OamdPositionTimeline timeline{timeline::kTimelineObjects};
|
timeline::OamdPositionTimeline timeline{timeline::kTimelineObjects};
|
||||||
|
|
||||||
std::vector<double> buffer; // [chunk_samples][16]
|
std::vector<double> buffer; // [chunk_samples][16]
|
||||||
@@ -1051,9 +1051,7 @@ struct RosellaRuntime::Impl {
|
|||||||
analysis_bank->analyze_qmf(hops_, slots, &qmf_);
|
analysis_bank->analyze_qmf(hops_, slots, &qmf_);
|
||||||
analysis_bank->analyze_hybrid(qmf_, slots, &hybrid_);
|
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) {
|
if (room_sends_buffer_.size() != slots * kHybridBands) {
|
||||||
room_sends_buffer_.resize(slots * kHybridBands);
|
room_sends_buffer_.resize(slots * kHybridBands);
|
||||||
}
|
}
|
||||||
@@ -1141,11 +1139,13 @@ struct RosellaRuntime::Impl {
|
|||||||
return Status::success();
|
return Status::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The reference drops the first 961 samples of the raw stream (the filterbank's
|
// The reference drops the first `latency` samples of the raw stream (the
|
||||||
// latency) and returns everything after that.
|
// 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) {
|
void append_output(const double* stereo, std::size_t count) {
|
||||||
const std::int64_t remaining = static_cast<std::int64_t>(kLatencySamples) -
|
const std::int64_t remaining =
|
||||||
static_cast<std::int64_t>(raw_output_samples);
|
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>(
|
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),
|
std::max<std::int64_t>(0, std::min<std::int64_t>(static_cast<std::int64_t>(count),
|
||||||
remaining)));
|
remaining)));
|
||||||
@@ -1191,6 +1191,9 @@ Status RosellaRuntime::open(const RosellaModel& model, const RosellaRenderOption
|
|||||||
if (options.object_delay_samples < 0) {
|
if (options.object_delay_samples < 0) {
|
||||||
return render_fail(JOC_ERR_INVALID_ARGUMENT, "object_delay_samples must be non-negative");
|
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_->model = model;
|
||||||
impl_->options = options;
|
impl_->options = options;
|
||||||
logical_field(impl_->model.field_left_padded, &impl_->field_left);
|
logical_field(impl_->model.field_left_padded, &impl_->field_left);
|
||||||
@@ -1203,8 +1206,8 @@ Status RosellaRuntime::open(const RosellaModel& model, const RosellaRenderOption
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
// The analysis bank runs sixteen sources, the synthesis bank two output ears.
|
// The analysis bank runs sixteen sources, the synthesis bank two output ears.
|
||||||
impl_->analysis_bank = std::make_unique<PublicFilterbank>(builtin_kernels(), kSourceChannels);
|
impl_->analysis_bank = RosellaBank::create(options.bank, kSourceChannels);
|
||||||
impl_->synthesis_bank = std::make_unique<PublicFilterbank>(builtin_kernels(), kOutputChannels);
|
impl_->synthesis_bank = RosellaBank::create(options.bank, kOutputChannels);
|
||||||
impl_->buffer.assign(impl_->chunk_samples() * kSourceChannels, 0.0);
|
impl_->buffer.assign(impl_->chunk_samples() * kSourceChannels, 0.0);
|
||||||
impl_->room_sends_buffer_.assign(
|
impl_->room_sends_buffer_.assign(
|
||||||
(impl_->chunk_samples() / kQmfHop) * kHybridBands, Complex(0.0, 0.0));
|
(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 {
|
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);
|
static_cast<double>(kBlockSamples);
|
||||||
const double blocks = std::ceil(samples / static_cast<double>(kBlockSamples));
|
const double blocks = std::ceil(samples / static_cast<double>(kBlockSamples));
|
||||||
return static_cast<std::uint32_t>(blocks) * kBlockSamples;
|
return static_cast<std::uint32_t>(blocks) * kBlockSamples;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "foundation/status.h"
|
#include "foundation/status.h"
|
||||||
|
#include "hrtf/rosella_bank.h"
|
||||||
#include "hrtf/rosella_model.h"
|
#include "hrtf/rosella_model.h"
|
||||||
#include "oamd/oamd_parser.h"
|
#include "oamd/oamd_parser.h"
|
||||||
#include "timeline/position_timeline.h"
|
#include "timeline/position_timeline.h"
|
||||||
@@ -21,6 +22,9 @@ enum class RosellaProfile : std::int32_t { Near = 1, Far = 2, Mid = 3 };
|
|||||||
|
|
||||||
struct RosellaRenderOptions {
|
struct RosellaRenderOptions {
|
||||||
RosellaProfile profile = RosellaProfile::Mid;
|
RosellaProfile profile = RosellaProfile::Mid;
|
||||||
|
// The analysis and synthesis banks both come from this one choice, so the
|
||||||
|
// latency skip, the flush capacity and the state histories stay consistent.
|
||||||
|
RosellaBankKind bank = RosellaBankKind::Public;
|
||||||
std::int64_t object_delay_samples = 1473;
|
std::int64_t object_delay_samples = 1473;
|
||||||
double tail_seconds = 5.0;
|
double tail_seconds = 5.0;
|
||||||
double output_gain = 1.0;
|
double output_gain = 1.0;
|
||||||
|
|||||||
@@ -127,6 +127,9 @@ Status Stream::create(const Config& config) {
|
|||||||
}
|
}
|
||||||
render_options.object_delay_samples = config_.object_delay_samples;
|
render_options.object_delay_samples = config_.object_delay_samples;
|
||||||
render_options.tail_seconds = config_.tail_seconds;
|
render_options.tail_seconds = config_.tail_seconds;
|
||||||
|
render_options.bank = config_.rosella_filterbank == JOC_ROSELLA_FILTERBANK_CAPTURED
|
||||||
|
? hrtf::RosellaBankKind::Captured
|
||||||
|
: hrtf::RosellaBankKind::Public;
|
||||||
if (status.ok()) {
|
if (status.ok()) {
|
||||||
status = rosella_.open(model, render_options);
|
status = rosella_.open(model, render_options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ struct Config {
|
|||||||
std::string hrtf_cache_dir;
|
std::string hrtf_cache_dir;
|
||||||
std::uint32_t hrtf_cache_policy = JOC_HRTF_CACHE_MEMORY;
|
std::uint32_t hrtf_cache_policy = JOC_HRTF_CACHE_MEMORY;
|
||||||
double hrtf_radius_m = 1.0;
|
double hrtf_radius_m = 1.0;
|
||||||
|
// Filterbank of the Rosella path; the other binaural inputs ignore it.
|
||||||
|
std::uint32_t rosella_filterbank = JOC_ROSELLA_FILTERBANK_PUBLIC;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Info {
|
struct Info {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "foundation/mini_json.h"
|
#include "foundation/mini_json.h"
|
||||||
#include "foundation/sha256.h"
|
#include "foundation/sha256.h"
|
||||||
#include "hrtf/jochrtf.h"
|
#include "hrtf/jochrtf.h"
|
||||||
|
#include "hrtf/rosella_bank.h"
|
||||||
#include "hrtf/rosella_model.h"
|
#include "hrtf/rosella_model.h"
|
||||||
#include "hrtf/rosella_renderer.h"
|
#include "hrtf/rosella_renderer.h"
|
||||||
#include "hrtf/sofa_cache.h"
|
#include "hrtf/sofa_cache.h"
|
||||||
@@ -98,6 +99,7 @@ struct Settings {
|
|||||||
std::string hrtf_cache_dir;
|
std::string hrtf_cache_dir;
|
||||||
std::uint32_t hrtf_cache_policy = JOC_HRTF_CACHE_MEMORY;
|
std::uint32_t hrtf_cache_policy = JOC_HRTF_CACHE_MEMORY;
|
||||||
double hrtf_radius_m = 1.0;
|
double hrtf_radius_m = 1.0;
|
||||||
|
std::uint32_t rosella_filterbank = JOC_ROSELLA_FILTERBANK_PUBLIC;
|
||||||
std::uint32_t operation = JOC_OP_ADM_BWF;
|
std::uint32_t operation = JOC_OP_ADM_BWF;
|
||||||
std::uint32_t output_format = JOC_FORMAT_FLOAT32;
|
std::uint32_t output_format = JOC_FORMAT_FLOAT32;
|
||||||
std::uint32_t adm_binaural_mode = JOC_BINAURAL_MID;
|
std::uint32_t adm_binaural_mode = JOC_BINAURAL_MID;
|
||||||
@@ -149,6 +151,9 @@ Settings normalise(const joc_task_config& raw) {
|
|||||||
if (raw.hrtf_cache_dir != nullptr) { cfg.hrtf_cache_dir = raw.hrtf_cache_dir; }
|
if (raw.hrtf_cache_dir != nullptr) { cfg.hrtf_cache_dir = raw.hrtf_cache_dir; }
|
||||||
cfg.hrtf_cache_policy = raw.hrtf_cache_policy;
|
cfg.hrtf_cache_policy = raw.hrtf_cache_policy;
|
||||||
cfg.hrtf_radius_m = raw.hrtf_radius_m;
|
cfg.hrtf_radius_m = raw.hrtf_radius_m;
|
||||||
|
// Kept verbatim so validate() can reject an out-of-range value; 0 is the
|
||||||
|
// documented "unset" spelling of the public bank.
|
||||||
|
cfg.rosella_filterbank = raw.rosella_filterbank;
|
||||||
if (raw.kernels_path != nullptr) { cfg.kernels_path = raw.kernels_path; }
|
if (raw.kernels_path != nullptr) { cfg.kernels_path = raw.kernels_path; }
|
||||||
cfg.operation = raw.operation;
|
cfg.operation = raw.operation;
|
||||||
cfg.output_format = raw.output_format;
|
cfg.output_format = raw.output_format;
|
||||||
@@ -1108,6 +1113,14 @@ Status validate(const joc_task_config& raw, std::vector<joc_validation_issue>* i
|
|||||||
fail(JOC_ERR_INVALID_CONFIG, "binaural_mode",
|
fail(JOC_ERR_INVALID_CONFIG, "binaural_mode",
|
||||||
"binaural_mode off is only meaningful for ADM output");
|
"binaural_mode off is only meaningful for ADM output");
|
||||||
}
|
}
|
||||||
|
if (cfg.rosella_filterbank > JOC_ROSELLA_FILTERBANK_CAPTURED) {
|
||||||
|
fail(JOC_ERR_INVALID_CONFIG, "rosella_filterbank",
|
||||||
|
"rosella_filterbank must be 1 (public) or 2 (captured)");
|
||||||
|
} else if (cfg.rosella_filterbank == JOC_ROSELLA_FILTERBANK_CAPTURED &&
|
||||||
|
cfg.personalized_headphone_path.empty()) {
|
||||||
|
fail(JOC_ERR_INVALID_CONFIG, "rosella_filterbank",
|
||||||
|
"rosella_filterbank 2 only applies to a Rosella .personalized_headphone input");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (cfg.operation == JOC_OP_ADM_BWF) {
|
if (cfg.operation == JOC_OP_ADM_BWF) {
|
||||||
if (cfg.adm_binaural_mode > 4u) {
|
if (cfg.adm_binaural_mode > 4u) {
|
||||||
@@ -1358,14 +1371,22 @@ Status run(const joc_task_config& raw, const joc_event_sink* sink, joc_task_resu
|
|||||||
}
|
}
|
||||||
render_options.object_delay_samples = cfg.object_delay_samples;
|
render_options.object_delay_samples = cfg.object_delay_samples;
|
||||||
render_options.tail_seconds = cfg.tail_seconds;
|
render_options.tail_seconds = cfg.tail_seconds;
|
||||||
|
render_options.bank =
|
||||||
|
cfg.rosella_filterbank == JOC_ROSELLA_FILTERBANK_CAPTURED
|
||||||
|
? ::joc::hrtf::RosellaBankKind::Captured
|
||||||
|
: ::joc::hrtf::RosellaBankKind::Public;
|
||||||
if (status.ok()) {
|
if (status.ok()) {
|
||||||
status = rosella.open(model, render_options);
|
status = rosella.open(model, render_options);
|
||||||
}
|
}
|
||||||
if (status.ok()) {
|
if (status.ok()) {
|
||||||
bus.emit(JOC_EV_HRTF_LOADED, JOC_STAGE_RENDER, JOC_LOG_INFO, model.summary());
|
bus.emit(JOC_EV_HRTF_LOADED, JOC_STAGE_RENDER, JOC_LOG_INFO, model.summary());
|
||||||
bus.emit(JOC_EV_RENDERER_INITIALIZED, JOC_STAGE_RENDER, JOC_LOG_INFO,
|
bus.emit(JOC_EV_RENDERER_INITIALIZED, JOC_STAGE_RENDER, JOC_LOG_INFO,
|
||||||
"Rosella binaural runtime ready (the first 961 samples are the "
|
fmt("Rosella binaural runtime ready (%s filterbank, the first %u "
|
||||||
"filterbank latency)");
|
"samples are the filterbank latency)",
|
||||||
|
render_options.bank == ::joc::hrtf::RosellaBankKind::Captured
|
||||||
|
? "captured"
|
||||||
|
: "public",
|
||||||
|
::joc::hrtf::rosella_bank_latency(render_options.bank)));
|
||||||
}
|
}
|
||||||
if (!status.ok()) {
|
if (!status.ok()) {
|
||||||
return finalize_with_error(status.code(), "render",
|
return finalize_with_error(status.code(), "render",
|
||||||
|
|||||||
Reference in new issue
Block a user