Files
foo_input_joc/kernel/src/joc_bitstream/bed_layout_map.h
T
TheM14 defe9538fe Sync the kernel copy with the OAMD frame-level core
The kernel copy follows the new kernel. The renderer has a frame-level state
machine (normal, hold, hard cut and passthrough, the 8-plane passthrough, the
LFE clipgain ramp and interpolation when no previous state exists), the OAMD
parser carries the complete frame state (several blocks, more than 16 objects)
and the speaker renderer applies the metadata (gain and inactive flags,
zone/elevation, size, snap, divergence, ISF and bed distribution). oamd_math and
oamd_params are new modules, the ISF tables are compiled in now that the
upstream data/ directory is gone, and the binaural timeline accepts a complete
frame state. joc_core.h moves to ABI 6 (frame parameters and EMDF payload info
at v2, JOC_FRAME_STATUS_*, raw 5-bit offset_ts) and eac3joc_core.h to EJOC ABI 4
(EJOC_FRAME_STATUS_*, ejoc_frame_input v1, ejoc_renderer_render_frame,
EJOC_CORE_OUT_CHANNELS and EJOC_LFE_SLOT; the old ejoc_renderer_process stays).
joc_stream.h and joc_version.h are unchanged.

joc_kernel.vcxproj lists the two new translation units and the four new
headers. The component's layout table gains the kernel's 6.0 layout (L R Ls Rs
Lrs Rrs) after 9.1.6, and layout_table_test expects twelve layouts, so the list
the preferences page shows and the list the renderer accepts are the same
again. README, THIRD_PARTY_NOTICES and the CI comment pin the copy to commit
3f0d5e87fe41b90d9350528d2dca2ca82a637a3f; tag v1.2.0 points at the older
a276028 and is not the sync baseline.

Builds Release-Static|x64 and |Win32 with no errors. The offline test tools
build and pass on both architectures: layout_table_test reports 12 layouts, and
channel_swap_test, log_rotation_test and long_path_test pass. scan_crosscheck
agrees with the core on the upstream test material, and the render harness
delivers 7.1.4 speaker output and binaural output on both architectures, with
the speaker-path WAV byte-identical between them.

The core is still vendored under kernel/; building it from the upstream
checkout at build time is a separate change.
2026-11-08 16:11:57 +08:00

70 lines
3.2 KiB
C++
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.
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include "oamd/oamd_parser.h"
#include "speaker/speaker_layout_lookup.h"
namespace joc::joc {
// 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 {
bool present = false; // 有 bed_assignment() 声明
bool bed_only = false; // program 只由 bed 组成(无 ISF、无动态对象)
bool complete = true; // 所有声明声道都在本标准表里
const char* name = ""; // "9.1.6" 等;未知集合为空串
std::uint32_t mask = 0; // 声明声道的位集合(1 << BedChannel)
std::vector<BedChannel> channels; // 去掉 LFE/LFE2,按 JOC 对象槽顺序
};
// 声明里是否包含某个 bed 声道。
inline bool bed_layout_has(const BedLayout& layout, BedChannel channel) {
return (layout.mask & (1u << static_cast<unsigned>(channel))) != 0u;
}
// 展开 bed_assignment() 声明;``bed_only`` 来自 program_assignment() 的
// content_description。
BedLayout resolve_bed_layout(const std::vector<oamd::BedAssignment>& assignments,
bool bed_only);
// 扬声器布局里的短名("Lw")与 Table 12 的标签("RC_LW")。
const char* bed_channel_short_name(BedChannel channel);
const char* bed_channel_label(BedChannel channel);
// 固定方位:ADM 笛卡尔坐标(x 右、y 前、z 上)与渲染器使用的 Q15 方位。
bool bed_channel_adm_position(BedChannel channel, double xyz[3]);
bool bed_channel_q15(BedChannel channel, std::uint16_t q15[3]);
// 目标布局里同名扬声器的 Q15 方位:bed 声道直连到该扬声器,而不是参与声像。
// 目标布局没有这个声道时返回 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