Remove the 4.0 Surround layout and make 4.0 the quad layout
This commit is contained in:
1 parent
7cd5c660e4
commit
c8d2b09357
8 files changed
+71
-75
No files matched your search
@@ -102,6 +102,38 @@ with an explanation instead of being ignored. This build adds `--bed` (pre-decod
|
|||||||
6-channel float32 PCM, which skips ffmpeg decoding), `--kernels`, `--work-dir`,
|
6-channel float32 PCM, which skips ffmpeg decoding), `--kernels`, `--work-dir`,
|
||||||
`--report-json`, `--dry-run` and `--quiet`.
|
`--report-json`, `--dry-run` and `--quiet`.
|
||||||
|
|
||||||
|
## Speaker layouts and channel order
|
||||||
|
|
||||||
|
`--speaker-layout` accepts the eleven layouts below, and the PCM/WAV channel order is the order in
|
||||||
|
the table:
|
||||||
|
|
||||||
|
| Layout | Channel order |
|
||||||
|
|---|---|
|
||||||
|
| 2.0 | L, R |
|
||||||
|
| 3.1 | L, R, C, LFE |
|
||||||
|
| 4.0 | L, R, Lrs, Rrs |
|
||||||
|
| 5.1 | L, R, C, LFE, Ls, Rs |
|
||||||
|
| 7.1 | L, R, C, LFE, Ls, Rs, Lrs, Rrs |
|
||||||
|
| 5.1.2 | L, R, C, LFE, Ls, Rs, Ltm, Rtm |
|
||||||
|
| 5.1.4 | L, R, C, LFE, Ls, Rs, Ltf, Rtf, Ltr, Rtr |
|
||||||
|
| 7.1.2 | L, R, C, LFE, Ls, Rs, Lrs, Rrs, Ltm, Rtm |
|
||||||
|
| 7.1.4 | L, R, C, LFE, Ls, Rs, Lrs, Rrs, Ltf, Rtf, Ltr, Rtr |
|
||||||
|
| 9.1.4 | L, R, C, LFE, Ls, Rs, Lrs, Rrs, Lw, Rw, Ltf, Rtf, Ltr, Rtr |
|
||||||
|
| 9.1.6 | L, R, C, LFE, Ls, Rs, Lrs, Rrs, Lw, Rw, Ltf, Rtf, Ltm, Rtm, Ltr, Rtr |
|
||||||
|
|
||||||
|
`4.0` is the quad layout this project adds (the traditional `FL FR BL BR`, here `L R Lrs Rrs`); it is
|
||||||
|
not part of the Dolby layout set. Every other layout and channel order follows the Dolby
|
||||||
|
specifications.
|
||||||
|
|
||||||
|
Multichannel WAV files use `WAVE_FORMAT_EXTENSIBLE` with `dwChannelMask = 0`: the file declares no
|
||||||
|
Windows speaker positions, and the PCM channel order is exactly the table above, never rearranged
|
||||||
|
into mask-bit order. Players, ASIO, DAWs and other devices have to map the channel numbers
|
||||||
|
themselves; this project guarantees the content and numbering of each PCM channel, not that a
|
||||||
|
downstream player recognises Dolby speaker positions on its own.
|
||||||
|
|
||||||
|
`--speaker-layout` accepts only the eleven names in the table; anything else fails as an unknown
|
||||||
|
layout.
|
||||||
|
|
||||||
## Library integration
|
## Library integration
|
||||||
|
|
||||||
The engine and the file task are exposed by `joc_core.h`: `joc_task_validate` /
|
The engine and the file task are exposed by `joc_core.h`: `joc_task_validate` /
|
||||||
|
|||||||
@@ -90,6 +90,33 @@ metadata sidecar(`--metadata-dir`/`--metadata-cache`/`--metadata-backend sidec
|
|||||||
float32 PCM,给出后不调用 ffmpeg 解码)、`--kernels`(滤波器组表路径)、`--work-dir`、
|
float32 PCM,给出后不调用 ffmpeg 解码)、`--kernels`(滤波器组表路径)、`--work-dir`、
|
||||||
`--report-json`、`--dry-run`、`--quiet`。
|
`--report-json`、`--dry-run`、`--quiet`。
|
||||||
|
|
||||||
|
## 扬声器布局与声道顺序
|
||||||
|
|
||||||
|
`--speaker-layout` 只接受下表 11 个布局,PCM/WAV 的声道顺序就是表里的顺序:
|
||||||
|
|
||||||
|
| 布局 | 声道顺序 |
|
||||||
|
|---|---|
|
||||||
|
| 2.0 | L, R |
|
||||||
|
| 3.1 | L, R, C, LFE |
|
||||||
|
| 4.0 | L, R, Lrs, Rrs |
|
||||||
|
| 5.1 | L, R, C, LFE, Ls, Rs |
|
||||||
|
| 7.1 | L, R, C, LFE, Ls, Rs, Lrs, Rrs |
|
||||||
|
| 5.1.2 | L, R, C, LFE, Ls, Rs, Ltm, Rtm |
|
||||||
|
| 5.1.4 | L, R, C, LFE, Ls, Rs, Ltf, Rtf, Ltr, Rtr |
|
||||||
|
| 7.1.2 | L, R, C, LFE, Ls, Rs, Lrs, Rrs, Ltm, Rtm |
|
||||||
|
| 7.1.4 | L, R, C, LFE, Ls, Rs, Lrs, Rrs, Ltf, Rtf, Ltr, Rtr |
|
||||||
|
| 9.1.4 | L, R, C, LFE, Ls, Rs, Lrs, Rrs, Lw, Rw, Ltf, Rtf, Ltr, Rtr |
|
||||||
|
| 9.1.6 | L, R, C, LFE, Ls, Rs, Lrs, Rrs, Lw, Rw, Ltf, Rtf, Ltm, Rtm, Ltr, Rtr |
|
||||||
|
|
||||||
|
`4.0` 是本项目补充的 Quad 布局(传统 Quad 的 `FL FR BL BR`),声道为 `L R Lrs Rrs`,不在杜比
|
||||||
|
文档的布局列表里;除它以外的布局及声道顺序均依据杜比相关规范定义。
|
||||||
|
|
||||||
|
多声道 WAV 使用 `WAVE_FORMAT_EXTENSIBLE`,`dwChannelMask = 0`:文件不声明 Windows 扬声器位置,
|
||||||
|
PCM 声道顺序严格按上表,不按掩码位序重排。播放器、ASIO、DAW 或其他设备需要按声道编号自行完成
|
||||||
|
输出映射;本项目保证各 PCM 声道的内容和编号符合上表,不保证下游播放器自动识别杜比扬声器位置。
|
||||||
|
|
||||||
|
`--speaker-layout` 只接受上表 11 个名字;其它名字按未知布局报错。
|
||||||
|
|
||||||
## 库集成
|
## 库集成
|
||||||
|
|
||||||
引擎与文件任务使用 `joc_core.h`:`joc_task_validate` / `joc_task_execute` 跑一个文件任务并
|
引擎与文件任务使用 `joc_core.h`:`joc_task_validate` / `joc_task_execute` 跑一个文件任务并
|
||||||
|
|||||||
+1
-2
@@ -446,8 +446,7 @@ $$
|
|||||||
$$
|
$$
|
||||||
|
|
||||||
For layouts with one horizontal surround pair rather than separate side and rear pairs (the 5.1
|
For layouts with one horizontal surround pair rather than separate side and rear pairs (the 5.1
|
||||||
family, and layouts such as 4.0 Quad and 4.0 Surround that carry one rear pair only), the
|
family, and 4.0, which carries one rear pair only), the longitudinal coordinate is
|
||||||
longitudinal coordinate is
|
|
||||||
|
|
||||||
$$
|
$$
|
||||||
v_{\mathrm{floor}}=
|
v_{\mathrm{floor}}=
|
||||||
|
|||||||
+2
-2
@@ -442,8 +442,8 @@ $$
|
|||||||
\mathbf h(u)\odot\mathbf v(v).
|
\mathbf h(u)\odot\mathbf v(v).
|
||||||
$$
|
$$
|
||||||
|
|
||||||
对于只有一对水平环绕、没有独立 side/rear 两对的布局(5.1 系列,以及 4.0 Quad 与
|
对于只有一对水平环绕、没有独立 side/rear 两对的布局(5.1 系列,以及 4.0 这类
|
||||||
4.0 Surround 这类只有一对后置声道的布局),纵向坐标使用
|
只有一对后置声道的布局),纵向坐标使用
|
||||||
|
|
||||||
$$
|
$$
|
||||||
v_{\mathrm{floor}}=
|
v_{\mathrm{floor}}=
|
||||||
|
|||||||
+1
-1
@@ -84,7 +84,7 @@ struct Options {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char* kLayoutChoices =
|
const char* kLayoutChoices =
|
||||||
"2.0 3.1 \"4.0 Surround\" \"4.0 Quad\" 5.1 7.1 5.1.2 5.1.4 7.1.2 7.1.4 9.1.4 9.1.6";
|
"2.0 3.1 4.0 5.1 7.1 5.1.2 5.1.4 7.1.2 7.1.4 9.1.4 9.1.6";
|
||||||
|
|
||||||
void print_usage() {
|
void print_usage() {
|
||||||
std::printf(
|
std::printf(
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ struct FrozenLayout {
|
|||||||
constexpr FrozenLayout kLayouts[kLayoutCount] = {
|
constexpr FrozenLayout kLayouts[kLayoutCount] = {
|
||||||
{"2.0", 0, 1},
|
{"2.0", 0, 1},
|
||||||
{"3.1", 3, 7},
|
{"3.1", 3, 7},
|
||||||
{"4.0 Surround", 0xFF, 35},
|
{"4.0", 0xFF, 9},
|
||||||
{"4.0 Quad", 0xFF, 9},
|
|
||||||
{"5.1", 7, 15},
|
{"5.1", 7, 15},
|
||||||
{"7.1", 11, 31},
|
{"7.1", 11, 31},
|
||||||
{"5.1.2", 13, 1039},
|
{"5.1.2", 13, 1039},
|
||||||
@@ -27,14 +26,6 @@ constexpr FrozenLayout kLayouts[kLayoutCount] = {
|
|||||||
{"9.1.6", 20, 3743},
|
{"9.1.6", 20, 3743},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Spellings accepted in addition to the names above.
|
|
||||||
constexpr struct {
|
|
||||||
const char* alias;
|
|
||||||
const char* name;
|
|
||||||
} kAliases[] = {
|
|
||||||
{"4.0", "4.0 Surround"},
|
|
||||||
};
|
|
||||||
|
|
||||||
void fill(const FrozenLayout& source, LayoutInfo* out) {
|
void fill(const FrozenLayout& source, LayoutInfo* out) {
|
||||||
out->name = source.name;
|
out->name = source.name;
|
||||||
out->out_ch_config = source.out_ch_config;
|
out->out_ch_config = source.out_ch_config;
|
||||||
@@ -62,11 +53,6 @@ bool layout_by_name(const char* name, LayoutInfo* out) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const auto& alias : kAliases) {
|
|
||||||
if (std::strcmp(name, alias.alias) == 0) {
|
|
||||||
return layout_by_name(alias.name, out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace joc::speaker {
|
namespace joc::speaker {
|
||||||
|
|
||||||
inline constexpr int kLayoutCount = 12;
|
inline constexpr int kLayoutCount = 11;
|
||||||
|
|
||||||
struct LayoutInfo {
|
struct LayoutInfo {
|
||||||
const char* name = "";
|
const char* name = "";
|
||||||
@@ -17,13 +17,13 @@ struct LayoutInfo {
|
|||||||
std::uint32_t channel_count = 0;
|
std::uint32_t channel_count = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// All twelve layouts in the reference's order (2.0, 3.1, 4.0 Surround, 4.0 Quad,
|
// All eleven layouts in the reference's order (2.0, 3.1, 4.0, 5.1, 7.1, 5.1.2,
|
||||||
// 5.1, 7.1, 5.1.2, 5.1.4, 7.1.2, 7.1.4, 9.1.4, 9.1.6).
|
// 5.1.4, 7.1.2, 7.1.4, 9.1.4, 9.1.6).
|
||||||
bool layout_at(int index, LayoutInfo* out);
|
bool layout_at(int index, LayoutInfo* out);
|
||||||
|
|
||||||
// False when the name is unknown (case-sensitive, as the reference CLI). The
|
// False when the name is unknown (case-sensitive, as the reference CLI). "4.0"
|
||||||
// legacy spelling "4.0" resolves to 4.0 Surround, which is what that name meant
|
// is the quad layout (L R Lrs Rrs); a stored value is normalized by the caller
|
||||||
// before the two 4.0 layouts were told apart.
|
// before the name is looked up here.
|
||||||
bool layout_by_name(const char* name, LayoutInfo* out);
|
bool layout_by_name(const char* name, LayoutInfo* out);
|
||||||
|
|
||||||
bool layout_by_bitfield(std::uint32_t bitfield, LayoutInfo* out);
|
bool layout_by_bitfield(std::uint32_t bitfield, LayoutInfo* out);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ struct LayoutGeometry {
|
|||||||
std::array<RegionGeometry, 7> regions{};
|
std::array<RegionGeometry, 7> regions{};
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr std::array<LayoutGeometry, 12> kLayouts{{
|
inline constexpr std::array<LayoutGeometry, 11> kLayouts{{
|
||||||
LayoutGeometry{
|
LayoutGeometry{
|
||||||
0x1u, 0, 2,
|
0x1u, 0, 2,
|
||||||
{{0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
|
{{0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
|
||||||
@@ -136,54 +136,6 @@ inline constexpr std::array<LayoutGeometry, 12> kLayouts{{
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
},
|
},
|
||||||
LayoutGeometry{
|
|
||||||
0x23u, 0xFFu, 4,
|
|
||||||
{{0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
|
|
||||||
{{
|
|
||||||
RegionGeometry{
|
|
||||||
4, 2, 2, 0,
|
|
||||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{16384, 32767, 0}, 3}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
|
||||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{1, {3, 0, 0}}, AxisGroup{}, AxisGroup{}}},
|
|
||||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
|
||||||
},
|
|
||||||
RegionGeometry{
|
|
||||||
3, 1, 1, 0,
|
|
||||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
|
||||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}},
|
|
||||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
|
||||||
},
|
|
||||||
RegionGeometry{
|
|
||||||
4, 2, 2, 0,
|
|
||||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{16384, 32767, 0}, 3}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
|
||||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{1, {3, 0, 0}}, AxisGroup{}, AxisGroup{}}},
|
|
||||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
|
||||||
},
|
|
||||||
RegionGeometry{
|
|
||||||
2, 2, 2, 0,
|
|
||||||
{{SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{16384, 32767, 0}, 3}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
|
||||||
{{AxisGroup{1, {0, 0, 0}}, AxisGroup{1, {1, 0, 0}}, AxisGroup{}, AxisGroup{}}},
|
|
||||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
|
||||||
},
|
|
||||||
RegionGeometry{
|
|
||||||
3, 1, 1, 0,
|
|
||||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
|
||||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}},
|
|
||||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
|
||||||
},
|
|
||||||
RegionGeometry{
|
|
||||||
1, 1, 1, 0,
|
|
||||||
{{SpeakerPoint{{16384, 32767, 0}, 3}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
|
||||||
{{AxisGroup{1, {0, 0, 0}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}},
|
|
||||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
|
||||||
},
|
|
||||||
RegionGeometry{
|
|
||||||
3, 1, 1, 0,
|
|
||||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
|
||||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}},
|
|
||||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
},
|
|
||||||
LayoutGeometry{
|
LayoutGeometry{
|
||||||
0x9u, 0xFFu, 4,
|
0x9u, 0xFFu, 4,
|
||||||
{{0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
|
{{0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
|
||||||
|
|||||||
Reference in new issue
Block a user