Files
JustOneCacophony/data/README.md
T
TheM14 42a05d7722 Implement OAMD metadata rendering and runtime table generation
- Add oamd_params/oamd_math for OAMD metadata state, ISF matrix assembly,
  runtime size-table generation and bed routing.
- Apply per-block gain/inactive, zone/elevation, size, snap, divergence,
  position refinement, priority budget, ISF and bed distribution in the
  speaker renderer.
- Compute gain, size, priority, position, refinement and delta values from
  formulas; generate the size spread kernel from speaker-layout geometry.
- Derive bed labels, routing, reference positions and automatic attenuation
  from speaker layouts.
- Correct the surround positions of 5.1, 5.1.2 and 5.1.4 and add the 6.0
  speaker layout.
- Update README, data README and math notes for the metadata path and
  runtime table generation.
2026-11-08 14:01:07 +08:00

96 lines
4.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Python 运行时表
[English](README.en.md)
本目录保存 Python 生产路径使用的静态表数据,不保存用户 HRTF。
`tables.npz` 保存 JOC 核心解码表:
```text
analysis_window float64[10,64]
qmf5_window float64[640]
joc_huff_code_coarse_generic int64[95,2]
joc_huff_code_fine_generic int64[191,2]
joc_huff_code_coarse_coeff_sparse int64[95,2]
joc_huff_code_fine_coeff_sparse int64[191,2]
joc_huff_code_5ch_pos_index_sparse int64[4,2]
joc_huff_code_7ch_pos_index_sparse int64[6,2]
```
`src/joc_qmf.py` 读取 QMF 表,`src/joc_decode.py` 读取 JOC Huffman 树。
## ISF 系数数据
`oamd/metadata_params.json` 提供 ISF 压缩基系数与布局描述的查表数据。
gain、size、priority、位置、divergence 与差分/细化表在代码中按公式或
固定常量计算;size 扩散核按分组等功率声像、S448 权重和幂和,在运行时从
`speaker_layouts` 的区域几何生成(20/20/8 虚拟点、20 个尺寸节点、35/4 个
位置节点);bed 的标签、路由和参考位置也由 `speaker_layouts` 推导。
`src/oamd_params.py` 延迟解析数据文件,`src/oamd_math.py` 按固定的 float32 运算
顺序生成系数;`src/speaker_renderer.py` 把它们接到对象目标系数上。
## 双耳渲染表
`rosella_kernels.npz` 保存`.jochrtf`压缩渲染和个性化bank 1使用的64-QMF/77-hybrid固定表:
```text
format_version little-endian int32[1]
qmf_analysis_coefficients float32[64,10]
hybrid_analysis_low_kernel float32[3,2,13,16,2]
hybrid_synthesis_indices int16[154,4]
hybrid_synthesis_values float32[154]
qmf_synthesis_basis float64[64,4,128]
qmf_synthesis_taps float64[64,10,4]
```
float32 表值载入后提升为 float64。`src/public_filterbank.py` 在读取时校验 archive
及每个数组的 SHA-256;这些 hash、table version 和 77 个 band-center 参考值共同进入
`.jochrtf` cache key。analysis/synthesis 全链 latency 为 961 samples。
打包表实现的是公开标准化的滤波器组,各表可由如下公式计算。
64-QMF → 77-hybrid 结构、13-tap 低带 prototype 与半 bin 复调制定义于
[3GPP TS 26.405 / ETSI TS 126 405](https://www.etsi.org/deliver/etsi_ts/126400_126499/126405/06.00.00_60/ts_126405v060000p.pdf)
第 5.2.2 节(Table 1 的 $Q=8$/$Q=4$ 系数,delay 6):
$$G_q^p[n] = g^p[n]\cdot\exp\!\Bigl(j\,\frac{2\pi}{Q^p}\bigl(q+\tfrac12\bigr)(n-6)\Bigr),\qquad n=0,\dots,12$$
64-band QMF analysis 即 ISO/IEC 14496-3/AMD1:2003 第 4.B.18.2 节的 MPEG-4
AAC/SBR 64 complex QMF bank;打包的 $64\times10$ 表是公开 640-tap prototype
$c_0,\dots,c_{639}$ 的多相重排:
$$A_{r,t} = \frac{(-1)^t}{128}\,c_{63-r+64t},\qquad r=0,\dots,63,\ t=0,\dots,9$$
QMF synthesis 表为上述 analysis 多相矩阵 $\mathbf{A}$ 的因果左逆,即求解
$\mathbf{A}\,\mathbf{W}=\mathbf{P}$($\mathbf{P}$ 为 577-sample 延迟置换;
全链 $961 = 577 + 6\times64$),以 rank-4 分解形式存储:
$$W_{b,l} = \sum_{r=1}^{4} t_{b,l,r}\,\mathbf{b}_{b,r}^{\top}$$
hybrid synthesis 表为 77→64 重组:高频带恒等 $Y_{3+b}=X_{16+b}$;低频带
($C_p$ 为 $8+4+4$ 子带划分):
$$Y_p = \sum_{q\in C_p}\Bigl(\operatorname{Re}X_q + j\,s_q\,\operatorname{Im}X_q\Bigr),\qquad s_q\in\{\pm1\}$$
相同数值可在 FFmpeg(`aacps_tablegen.h`、`aacsbrdata.h`)等公开实现中查到。
### 11-tap Rosella 滤波器组
`rosella_captured_kernels.npz` 保存 `--rosella-filterbank 2` 使用的滤波器组:
```text
format_version little-endian int32[1]
qmf_prototype float32[64,10]
rotation complex64[64]
hybrid complex64[22]
```
表值载入后提升为 float64/complex128;全链 latency 为 448 samples(公开版为 961)。
文件不含个性化 HRTF 或 room 调参。
标准可公开获取不等于获准实施相关专利。
`.jochrtf` 是可删除、可从 SOFA 重建的 JOC compiled HRTF cache。cache 含有源 HRTF 的变换数据,仍受源 SOFA/HRTF
数据集的许可与再分发限制约束。