Port the OAMD metadata rendering and the frame-level JOC core
The JOC bitstream reports a per-frame parse status instead of treating every anomaly as an exception: an unsupported downmix configuration, a clamped object count, an unknown parameter-band count, bad offset_ts values and trailing bytes each get their own status. The raw 5-bit offset_ts values are kept as coded and validated to be strictly increasing per object, and the clipgain uses 2^(x-4) * (1 + y/32). The JOC core gains a frame-level state machine. It keeps the per-object previous matrix and its presence marker, the seq counter, the 8-plane passthrough history, the LFE clipgain ramp start and the previous actual core-channel count. Normal, hold, hard-cut and passthrough frames are distinguished: a frame without a previous state interpolates per the data-point rules, an object that disappears keeps publishing a zero matrix, a frame without metadata passes the 8 core planes through to slots 0..7 with the 1217-sample delay, and a declared core-channel-count change hard-cuts and clears the LFE ring while the clipgain ramp state is kept. The core LFE applies the full clipgain as a sample-wise ramp before its delay. The OAMD parser exposes the full frame state: every object's state in every position block, the programme assignment and the trim element, with multiple blocks and up to 30 declared objects accepted. The speaker renderer applies this state: per-block gain/inactive, zone/elevation, the size kernel, snap, divergence, element 5 refinement, the priority size budget, ISF basis matrices and bed channel distribution, scheduled on the 32-sample metadata grid with block alignment and gain ramps. The size kernel, ISF basis assembly, bed routing and compensation are computed in oamd_math from the speaker layout geometry; bed labels and reference positions derive from the layout tables. The six ISF configurations and twelve layout descriptors are compiled in as static tables (oamd/isf_tables.h); the JSON loader and the configure-time embedding are gone. The layout tables gain 6.0, and the layout lookup, bed map and trim probe follow. The binaural position timeline consumes the full frame state as well: every position block is scheduled at its own offset and ramp, and its track list grows with the declared object count, so multi-block and over-16-object programmes are rendered instead of rejected. The JOC binaural input stays one LFE plus fifteen object sources; the extra tracks are followed but not panned. The file task and the stream parse the full state for speaker and binaural, while the ADM export keeps the 15-track single-block view. The public headers carry the new status values, the frame-level entry point and the raw offset_ts description; the internal ABI versions go to 6 (joc_core), 2 (frame params and EMDF info) and 4 (eac3joc). ctest covers the frame-level core (clipgain formula and LFE ramp, offset_ts validation, frame statuses, the 8-plane passthrough, the seq state machine and the no-previous-state interpolation), the OAMD parser state, the compiled-in ISF tables and the binaural timeline. The READMEs and the mathematical notes describe the 6.0 layout, the frame state machine, the metadata application and the ISF lookup tables.
This commit is contained in:
1 parent
a2760286b0
commit
0bb82e4115
41 files changed
+8182
-678
No files matched your search
@@ -6,31 +6,12 @@
|
||||
#include <vector>
|
||||
|
||||
#include "oamd/oamd_parser.h"
|
||||
#include "speaker/speaker_layout_lookup.h"
|
||||
|
||||
namespace joc::joc {
|
||||
|
||||
// OAMD Table 12 的标准 bed 声道。LSB 顺序与声明顺序一致:L/R、C、LFE、
|
||||
// Ls/Rs、Lrs/Rrs、TFL/TFR、TSL/TSR、TBL/TBR、LW/RW、LFE2。
|
||||
enum class BedChannel : std::uint8_t {
|
||||
kLeft = 0,
|
||||
kRight,
|
||||
kCenter,
|
||||
kLfe,
|
||||
kLeftSurround,
|
||||
kRightSurround,
|
||||
kLeftRearSurround,
|
||||
kRightRearSurround,
|
||||
kTopFrontLeft,
|
||||
kTopFrontRight,
|
||||
kTopSideLeft,
|
||||
kTopSideRight,
|
||||
kTopBackLeft,
|
||||
kTopBackRight,
|
||||
kLeftWide,
|
||||
kRightWide,
|
||||
kLfe2,
|
||||
kCount,
|
||||
};
|
||||
// BedChannel lives in oamd/oamd_parser.h: the enum is the OAMD Table 12
|
||||
// label order and OAMD frame state carries it directly.
|
||||
|
||||
// 内容声明的 bed 布局。bed 对象在 OAMD 里没有位置字段,位置由这里的布局决定。
|
||||
struct BedLayout {
|
||||
@@ -61,8 +42,28 @@ bool bed_channel_adm_position(BedChannel channel, double xyz[3]);
|
||||
bool bed_channel_q15(BedChannel channel, std::uint16_t q15[3]);
|
||||
|
||||
// 目标布局里同名扬声器的 Q15 方位:bed 声道直连到该扬声器,而不是参与声像。
|
||||
// 目标布局没有这个声道时返回 false。
|
||||
// 目标布局没有这个声道时返回 false。4.0 与 6.0 共用未分配的 out_ch_config
|
||||
// 0xFF,因此这里按 4.0 的声道集合解释 0xFF。
|
||||
bool layout_bed_anchor(std::uint32_t out_ch_config, BedChannel channel,
|
||||
std::uint16_t q15[3]);
|
||||
|
||||
// 参考位置网格 ``BED_REFERENCE_POSITIONS_Q15``:bed 标签与输出 slots 的最近邻
|
||||
// 匹配都用这一组固定 Q15 点。索引 3 是 (-1,-1,-1),表示 LFE 那样的非空间声源。
|
||||
inline constexpr int kBedReferencePositionCount = 38;
|
||||
const std::int32_t (*bed_reference_positions_q15())[3];
|
||||
|
||||
// 一个目标扬声器布局的 bed 路由描述(bed_layout.bed_output_description):
|
||||
// 按标准 bed 标签序(Table 12 的 17 个标签)给出目标 layout 的输出参考位置、
|
||||
// 每个标签的输出 slot 与直连参考位置,以及该布局的自动 trim 基准衰减。
|
||||
struct BedOutputDescription {
|
||||
std::vector<int> output_labels; // 每个输出声道最近邻的参考位置索引
|
||||
int label_to_slot[oamd::kBedLabelCount] = {}; // -2 不可达,-1 LFE 通路
|
||||
int direct_output_labels[oamd::kBedLabelCount] = {};
|
||||
double automatic_attenuation_db = 0.0;
|
||||
};
|
||||
|
||||
// 由布局名/几何派生 bed 路由描述;``layout.channel_names`` 必须按标准声道
|
||||
// 顺序给出 ``layout.channel_count`` 个名字。
|
||||
BedOutputDescription bed_output_description(const speaker::LayoutInfo& layout);
|
||||
|
||||
} // namespace joc::joc
|
||||
Reference in new issue
Block a user