diff --git a/README.en.md b/README.en.md index 9a64a02..686c33d 100644 --- a/README.en.md +++ b/README.en.md @@ -311,7 +311,7 @@ See the [mathematical notes](docs/math.en.md) for the equations used by the deco - All `joc_dmx_config_idx` values 0..4 are covered ($N=5,7,7,5,7$; the phase switch $\sigma(k)$ gates the Ls/Rs $-j$ rotation and the band-0 FIR together). The 7-channel configurations need an 8-channel bed and a dependent-substream `chanmap` to identify the extra pair: a missing independent substream or a missing `chanmap` is still a variant error, while a `chanmap` that disagrees with $k$ about the extra pair, or an OAMD bed mask that does, is recorded as a diagnostic and the frame still renders. The extra pair's **identity** is metadata only and never reaches the DSP (section 10.1); the bed mapping follows the channel codes the `chanmap` declares. - When one audio frame holds several EMDF containers carrying ID11/ID14 (one of them may be something other than the frame's JOC parameters: its ID14 may declare more objects than its bytes can hold, and its ID11 may carry no group id), the container is chosen by the association rule of ETSI TS 103 420 section 8.2 and its Table 56: **the container whose OAMD and JOC payloads share a group id and whose ID14 parses completely** wins, then one whose ID14 merely parses; only a unique best score is used, the others are recorded as a diagnostic (`emdf/extra_container_ignored`), and a tie or all-zero score stays a variant error. - The extra pair's identity follows TS 103 420 Table 47/Table 48 ($k=1\to$Lb/Rb, $k\in\{2,4\}\to$Tfl/Tfr, $N=5,7,7,5,7$); Annex E.3 requires a dependent-substream `chanmap`, when present, to indicate one of the Table 47 configurations, so `*_5_1_2top_*` (chanmap says Lts/Rts) does not satisfy that "shall". Such material is tolerated with a diagnostic instead of being refused. -- E-AC-3 input without JOC metadata (ID11 + ID14) is outside the supported scope. If an individual audio frame has no JOC EMDF, the implementation falls back to the decode state machine (hold the previous matrices while normal rendering was active, otherwise pass through the core PCM delayed by 1217 samples) and records `joc_frame_missing` in `diagnostics`. +- E-AC-3 input without JOC metadata (ID11 + ID14) is outside the supported scope. If an individual audio frame has no JOC EMDF, that frame passes the core PCM through (the 8 core planes are written to output slots 0..7 by identity, each delayed by 1217 samples) and records `joc_frame_missing` in `diagnostics`. - The speaker and SOFA binaural paths currently cover ordinary point objects; extent, spread, diffuse, divergence, channel lock, and similar controls are outside the supported scope. - Speaker rendering reads warp, trims and front/back balance from OAMD, with no CLI warp override. Generic rendering parameters support warp 0/1 and modes 2/3, which render to 7.1.x before PLIIx or Standard (Lo/Ro) folding to 5.1.x; calibration always follows the final target layout. Source trajectories and binaural do not bake in these speaker controls; see [mathematics §12](docs/math.en.md) for parameters and evaluation order. - Multi-data-point streams, uncommon band configurations, and unusual OAMD scheduling have less coverage than common 12-band, single-data-point material. diff --git a/README.md b/README.md index 125fe84..69c9c66 100644 --- a/README.md +++ b/README.md @@ -273,7 +273,7 @@ JustOneCacophony/ - 覆盖 `joc_dmx_config_idx` 0..4 的全部档位($N=5,7,7,5,7$,相位开关 $\sigma(k)$ 同时门控 Ls/Rs 的 $-j$ 旋转与 band-0 FIR)。7 通道档位必须解出 8 通道床,且需要依赖子流的 `chanmap` 才能确定额外那一对:缺少核心子流或缺少 `chanmap` 仍按变体报错;`chanmap` 声明的额外对与 $k$ 不一致、或 OAMD bed 掩码与 $k$ 不一致时,只记入 `diagnostics` 并继续解码——额外那对的**身份**只进元数据、不进 DSP(§10.1),床映射按 `chanmap` 的通道码做。 - 同一音频帧里出现多个含 ID11/ID14 的 EMDF 容器时(其中一个容器可能不是本帧的 JOC 参数:ID14 声明的对象数超出其字节所能容纳的范围,ID11 也可能没有 groupid),按 ETSI TS 103 420 §8.2 + Table 56 的关联规则打分选取:**OAMD 与 JOC 载荷 groupid 相同且 ID14 能完整解析**的容器优先,其次只看 ID14 能否完整解析;只有唯一最高分才采用,其余记入 `diagnostics`(`emdf/extra_container_ignored`),并列或全部为 0 仍报变体。 - 额外那一对的身份以 TS 103 420 Table 47/Table 48 为准($k=1\to$Lb/Rb,$k\in\{2,4\}\to$Tfl/Tfr,$N=5,7,7,5,7$);Annex E.3 规定依赖子流的 `chanmap`(若存在)**应**指明 Table 47 的某种配置,因此 `*_5_1_2top_*`(chanmap 写 Lts/Rts)属于不满足 "shall" 的素材,我们按"记诊断 + 继续解码"容错处理。 -- 不含 JOC 元数据(ID11 + ID14)的 E-AC-3 输入不在支持范围;解码过程中若个别音频帧没有 JOC EMDF,当前实现按状态机兜底(进入该帧前处于正常渲染时保持渲染,否则直通延迟 1217 采样的核心 PCM),并以 `joc_frame_missing` 记入 `diagnostics`。 +- 不含 JOC 元数据(ID11 + ID14)的 E-AC-3 输入不在支持范围;解码过程中若个别音频帧没有 JOC EMDF,该帧输出核心 PCM 直通(8 路核心按 identity 写入输出槽 0..7,每路延迟 1217 采样),并以 `joc_frame_missing` 记入 `diagnostics`。 - 扬声器与 SOFA 双耳路径当前只覆盖普通点对象;extent、spread、diffuse、divergence、channel lock 等对象控制不在支持范围内。 - 扬声器渲染从 OAMD 元数据读取 warp、trim 和 front/back balance;命令行不提供 warp 覆盖。通用渲染参数支持 warp 0/1,以及先渲染到 7.1.x 再按 PLIIx 或 Standard(Lo/Ro)折回 5.1.x 的 warp 2/3;校准参数始终按最终目标布局选择。原始对象轨迹与 binaural 不预处理这些扬声器控制,参数和顺序见 [数学说明 §12](docs/math.md)。 - 多数据点、少见参数带配置和特殊 OAMD 调度的覆盖度低于常见 12-band、单数据点素材。 diff --git a/docs/math.en.md b/docs/math.en.md index fa9e1db..96725ad 100644 --- a/docs/math.en.md +++ b/docs/math.en.md @@ -193,12 +193,10 @@ Thus $p(b)=k$ if and only if $b\in\mathcal B_k$. Other parameter-band counts use ### 3.2 One-data-point interpolation Let $P_{o,c,b}$ be the previous frame-end value and $D_{o,c,p(b)}$ the current target. When the object -has no previous state yet (the first frame of the stream, or the object's first appearance), all 24 slots -take the current target directly (hard cut, no fade-in from zero): - -$$ -M_{o,c,b,t}=D_{o,c,p(b)},\qquad t=0\ldots23. -$$ +has no previous state yet (the first frame of the stream, or the object's first appearance), a single +data point keeps all 24 slots at $D_{o,c,p(b)}$ (hard cut, no fade-in from zero); with two data points, +the first 12 slots stay at $D_0$ and the last 12 slots still interpolate from $D_0$ to $D_1$ using the +second segment of section 3.3 (with $P$ set to $D_0$). With a previous state, for slot $t=0\ldots23$: @@ -237,6 +235,8 @@ D_{0}, & t=11,\\[1mm] \end{cases} $$ +When no previous state exists, the same formulas apply with $P_{o,c,b}$ set to $D_0$. + Step mode (`slope_idx=1`) switches targets directly at the designated slots: for $t 0: + out[4:4 + rest] = core[3:] + return out + @staticmethod def _delayed_core(hist, current): - """直通渲染:把核心 PCM 延迟 1217 个采样(只处理实际有的声道数)。""" - n_channels = current.shape[0] - out = np.zeros((MAX_CORE_CHANNELS, FRAME_SAMPLES), dtype=np.float64) - out[:n_channels, :LFE_DELAY] = hist[:n_channels, 319:] - out[:n_channels, LFE_DELAY:] = current[:, :FRAME_SAMPLES - LFE_DELAY] - return out[:n_channels] + """直通渲染:8 路核心 PCM 各延迟 1217 个采样。""" + out = np.empty((CORE_OUT_CHANNELS, FRAME_SAMPLES), dtype=np.float64) + out[:, :LFE_DELAY] = hist[:, FRAME_SAMPLES - LFE_DELAY:] + out[:, LFE_DELAY:] = current[:, :FRAME_SAMPLES - LFE_DELAY] + return out def _render_frame(self, *, status, seq, out, mix_dq, bed_pcm, lfe_pcm, config_idx=None): @@ -410,11 +427,12 @@ class JocRenderer: n_channels = pcm.shape[0] if self._n_channels_prev is not None and n_channels != self._n_channels_prev: self._clear_unused_channels(n_channels) - pre_state = self._advance_state(status, seq) + self._advance_state(status, seq) state = self._state + self._maybe_clear_lfe_ring(status) if status == STATUS_NO_METADATA: - mode = "hold" if pre_state == 1 else "passthrough" + mode = "passthrough" elif state == 4: mode = "hard_cut" elif state in (2, 3): @@ -447,6 +465,7 @@ class JocRenderer: if lfe_pcm is None else np.asarray(lfe_pcm, dtype=np.float64)) if lfe.shape != (FRAME_SAMPLES,): raise ValueError(f"LFE 帧应为 (1536,),实际 {lfe.shape}") + core8 = self._core8(pcm, lfe) x = self.qmf_x(pcm, phase_new=phase_new, apply_dc_filter=sigma, rotate=sigma) self._last_x = x.copy() @@ -475,15 +494,15 @@ class JocRenderer: z_all = self._zero_objects() self.dll_synth_objects(z_all) self.decode_lfe(lfe, clipgain) - pcm16[:n_channels] = self._delayed_core(self._core_hist, pcm) + pcm16[:CORE_OUT_CHANNELS] = self._delayed_core(self._core_hist, core8) - self._core_hist[:n_channels] = pcm + self._core_hist[:] = core8 self._n_channels_prev = n_channels pcm16_f32 = np.asarray(pcm16, dtype=np.float32) return np.multiply(pcm16_f32, self.output_scale, dtype=np.float32), z_all def render_missing_frame(self, bed_pcm, lfe_pcm=None, config_idx=3): - """没有 JOC 元数据的音频帧:按状态机结果保持渲染或直通核心 PCM。""" + """没有 JOC 元数据的音频帧:8 路核心 PCM identity 直通(每路延迟 1217 采样)。""" return self._render_frame(status=STATUS_NO_METADATA, seq=None, out=None, mix_dq=None, bed_pcm=bed_pcm, lfe_pcm=lfe_pcm,