Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8372c1160c | ||
|
|
8be8e895c0 |
No files matched your search
+1
-1
@@ -208,5 +208,5 @@ every container in the library, which is where the volume comes from.
|
||||
## Licence
|
||||
|
||||
`LICENSE` is the upstream MIT licence, copied unchanged; `kernel/` is a copy of the upstream
|
||||
rendering core sources, synced to JustOneCacophonyCXX 1.3.1, and keeps their notices. See
|
||||
rendering core sources, synced to JustOneCacophonyCXX 1.3.4, and keeps their notices. See
|
||||
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
||||
@@ -172,5 +172,5 @@ pwsh -File tools/package.ps1 # 两个架构,打包到 dist\*.fb2k-c
|
||||
## 许可
|
||||
|
||||
`LICENSE` 是上游 MIT 许可,原样复制;`kernel/` 是上游渲染内核源码的副本,同步自 JustOneCacophonyCXX 的
|
||||
1.3.1 版本,保留其声明。见
|
||||
1.3.4 版本,保留其声明。见
|
||||
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
|
||||
@@ -5,7 +5,7 @@
|
||||
(`kernel/src/joc_bitstream/joc_huffman_tables.h`)的公开标准来源,以及 HRTF 数据与
|
||||
专利的边界说明。
|
||||
|
||||
`kernel/` 整体是 JustOneCacophonyCXX 1.3.1 的逐字副本。
|
||||
`kernel/` 整体是 JustOneCacophonyCXX 1.3.4 的逐字副本。
|
||||
|
||||
## 公开标准来源
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#define JOC_VERSION_MAJOR 1
|
||||
#define JOC_VERSION_MINOR 3
|
||||
#define JOC_VERSION_PATCH 3
|
||||
#define JOC_VERSION_STRING "1.3.3"
|
||||
#define JOC_VERSION_PATCH 4
|
||||
#define JOC_VERSION_STRING "1.3.4"
|
||||
|
||||
#endif /* JOC_VERSION_H */
|
||||
@@ -44,6 +44,10 @@ constexpr BedChannel kNonStandardBits[17] = {
|
||||
BedChannel::kLeft,
|
||||
};
|
||||
|
||||
// 每个 bed 声道的固定方位:speakerLabel 各自对应唯一的 ADM (X,Y,Z),与目标扬声器
|
||||
// 布局无关。天空声道的 X 取墙边(±1):点声源的横向声像只在扬声器跨度的端点之间分摊,
|
||||
// 取端点仍落在输出布局顶部声道的满功率区里,与顶部声道互相下混的结果一致。Lw/Rw 的 Y
|
||||
// 记作 0,677419,即 42/62 = 21/31。LFE/LFE2 不参与摆位,位置记为原点。
|
||||
struct ChannelSpec {
|
||||
BedChannel channel;
|
||||
const char* short_name;
|
||||
@@ -60,14 +64,14 @@ constexpr ChannelSpec kChannels[] = {
|
||||
{BedChannel::kRightSurround, "Rs", "RC_RS", {1.0, 0.0, 0.0}},
|
||||
{BedChannel::kLeftRearSurround, "Lrs", "RC_LB", {-1.0, -1.0, 0.0}},
|
||||
{BedChannel::kRightRearSurround, "Rrs", "RC_RB", {1.0, -1.0, 0.0}},
|
||||
{BedChannel::kTopFrontLeft, "Ltf", "RC_TFL", {-0.5, 0.5, 1.0}},
|
||||
{BedChannel::kTopFrontRight, "Rtf", "RC_TFR", {0.5, 0.5, 1.0}},
|
||||
{BedChannel::kTopFrontLeft, "Ltf", "RC_TFL", {-1.0, 1.0, 1.0}},
|
||||
{BedChannel::kTopFrontRight, "Rtf", "RC_TFR", {1.0, 1.0, 1.0}},
|
||||
{BedChannel::kTopSideLeft, "Ltm", "RC_TSL", {-1.0, 0.0, 1.0}},
|
||||
{BedChannel::kTopSideRight, "Rtm", "RC_TSR", {1.0, 0.0, 1.0}},
|
||||
{BedChannel::kTopBackLeft, "Ltr", "RC_TBL", {-0.5, -0.5, 1.0}},
|
||||
{BedChannel::kTopBackRight, "Rtr", "RC_TBR", {0.5, -0.5, 1.0}},
|
||||
{BedChannel::kLeftWide, "Lw", "RC_LW", {-1.0, 0.5, 0.0}},
|
||||
{BedChannel::kRightWide, "Rw", "RC_RW", {1.0, 0.5, 0.0}},
|
||||
{BedChannel::kTopBackLeft, "Ltr", "RC_TBL", {-1.0, -1.0, 1.0}},
|
||||
{BedChannel::kTopBackRight, "Rtr", "RC_TBR", {1.0, -1.0, 1.0}},
|
||||
{BedChannel::kLeftWide, "Lw", "RC_LW", {-1.0, 21.0 / 31.0, 0.0}},
|
||||
{BedChannel::kRightWide, "Rw", "RC_RW", {1.0, 21.0 / 31.0, 0.0}},
|
||||
{BedChannel::kLfe2, "LFE2", "RC_LFE2", {0.0, 0.0, 0.0}},
|
||||
};
|
||||
|
||||
@@ -279,12 +283,18 @@ bool bed_channel_q15(BedChannel channel, std::uint16_t q15[3]) {
|
||||
if (!bed_channel_adm_position(channel, xyz) || q15 == nullptr) {
|
||||
return false;
|
||||
}
|
||||
const double q1 = (xyz[0] + 1.0) * 0.5 * 32767.0;
|
||||
const double q2 = (1.0 - xyz[1]) * 0.5 * 32767.0;
|
||||
const double q3 = xyz[2] * 32767.0;
|
||||
q15[0] = static_cast<std::uint16_t>(q1 < 0.0 ? 0.0 : (q1 > 32767.0 ? 32767.0 : q1));
|
||||
q15[1] = static_cast<std::uint16_t>(q2 < 0.0 ? 0.0 : (q2 > 32767.0 ? 32767.0 : q2));
|
||||
q15[2] = static_cast<std::uint16_t>(q3 < 0.0 ? 0.0 : (q3 > 32767.0 ? 32767.0 : q3));
|
||||
// Q15 满刻度是 32768(渲染器按 q / 32768 还原方位),所以用 32768 定标并四舍五入;
|
||||
// 截断会让半格位置(16384、7928)各低 1。
|
||||
const double q1 = (xyz[0] + 1.0) * 0.5 * 32768.0;
|
||||
const double q2 = (1.0 - xyz[1]) * 0.5 * 32768.0;
|
||||
const double q3 = xyz[2] * 32768.0;
|
||||
const double rounded[3] = {q1 + 0.5, q2 + 0.5, q3 + 0.5};
|
||||
for (int axis = 0; axis < 3; ++axis) {
|
||||
const double value = rounded[axis] < 0.0
|
||||
? 0.0
|
||||
: (rounded[axis] > 32767.0 ? 32767.0 : rounded[axis]);
|
||||
q15[axis] = static_cast<std::uint16_t>(value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -308,17 +318,19 @@ bool layout_bed_anchor(std::uint32_t out_ch_config, BedChannel channel,
|
||||
if (table == nullptr || geometry == nullptr) {
|
||||
return false;
|
||||
}
|
||||
int standard_index = -1;
|
||||
// channel_names 与区域几何同序(region 的 speaker_id 就是这里的下标),
|
||||
// 因此同名声道不需要再经 standard_from_internal 换序。
|
||||
int internal_index = -1;
|
||||
for (std::uint32_t index = 0; index < table->count; ++index) {
|
||||
if (std::strcmp(table->names[index], name) == 0) {
|
||||
standard_index = static_cast<int>(index);
|
||||
internal_index = static_cast<int>(index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (standard_index < 0) {
|
||||
if (internal_index < 0) {
|
||||
return false;
|
||||
}
|
||||
const std::uint8_t internal = geometry->standard_from_internal[standard_index];
|
||||
const std::uint8_t internal = static_cast<std::uint8_t>(internal_index);
|
||||
const ejoc::speaker_tables::RegionGeometry& region = geometry->regions[0];
|
||||
for (std::uint32_t point = 0; point < region.point_count; ++point) {
|
||||
if (region.points[point].speaker_id != internal) {
|
||||
|
||||
@@ -190,25 +190,25 @@ inline constexpr std::array<LayoutGeometry, 12> kLayouts{{
|
||||
{{
|
||||
RegionGeometry{
|
||||
5, 2, 2, 0,
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{2, {3, 4, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
RegionGeometry{
|
||||
5, 2, 2, 0,
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{2, {3, 4, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
RegionGeometry{
|
||||
5, 2, 2, 0,
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{2, {3, 4, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
RegionGeometry{
|
||||
3, 2, 2, 0,
|
||||
{{SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{1, {0, 0, 0}}, AxisGroup{2, {1, 2, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
@@ -220,7 +220,7 @@ inline constexpr std::array<LayoutGeometry, 12> kLayouts{{
|
||||
},
|
||||
RegionGeometry{
|
||||
2, 1, 1, 0,
|
||||
{{SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{2, {0, 1, 0}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
@@ -286,25 +286,25 @@ inline constexpr std::array<LayoutGeometry, 12> kLayouts{{
|
||||
{{
|
||||
RegionGeometry{
|
||||
7, 3, 2, 1,
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{{7928, 16384, 32767}, 6}, SpeakerPoint{{24840, 16384, 32767}, 7}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{{7928, 16384, 32767}, 6}, SpeakerPoint{{24840, 16384, 32767}, 7}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{2, {3, 4, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{2, {5, 6, 0}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
RegionGeometry{
|
||||
7, 3, 2, 1,
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{{7928, 16384, 32767}, 6}, SpeakerPoint{{24840, 16384, 32767}, 7}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{{7928, 16384, 32767}, 6}, SpeakerPoint{{24840, 16384, 32767}, 7}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{2, {3, 4, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{2, {5, 6, 0}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
RegionGeometry{
|
||||
7, 3, 2, 1,
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{{7928, 16384, 32767}, 6}, SpeakerPoint{{24840, 16384, 32767}, 7}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{{7928, 16384, 32767}, 6}, SpeakerPoint{{24840, 16384, 32767}, 7}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{2, {3, 4, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{2, {5, 6, 0}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
RegionGeometry{
|
||||
5, 3, 2, 1,
|
||||
{{SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{{7928, 16384, 32767}, 6}, SpeakerPoint{{24840, 16384, 32767}, 7}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{{7928, 16384, 32767}, 6}, SpeakerPoint{{24840, 16384, 32767}, 7}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{1, {0, 0, 0}}, AxisGroup{2, {1, 2, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{2, {3, 4, 0}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
@@ -316,7 +316,7 @@ inline constexpr std::array<LayoutGeometry, 12> kLayouts{{
|
||||
},
|
||||
RegionGeometry{
|
||||
4, 3, 1, 1,
|
||||
{{SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{{7928, 16384, 32767}, 6}, SpeakerPoint{{24840, 16384, 32767}, 7}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{{7928, 16384, 32767}, 6}, SpeakerPoint{{24840, 16384, 32767}, 7}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{2, {0, 1, 0}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{2, {2, 3, 0}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
@@ -334,25 +334,25 @@ inline constexpr std::array<LayoutGeometry, 12> kLayouts{{
|
||||
{{
|
||||
RegionGeometry{
|
||||
9, 3, 2, 2,
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{{7928, 7928, 32767}, 6}, SpeakerPoint{{24840, 7928, 32767}, 7}, SpeakerPoint{{7928, 24840, 32767}, 8}, SpeakerPoint{{24840, 24840, 32767}, 9}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{{7928, 7928, 32767}, 6}, SpeakerPoint{{24840, 7928, 32767}, 7}, SpeakerPoint{{7928, 24840, 32767}, 8}, SpeakerPoint{{24840, 24840, 32767}, 9}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{2, {3, 4, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{2, {5, 6, 0}}, AxisGroup{2, {7, 8, 0}}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
RegionGeometry{
|
||||
9, 3, 2, 2,
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{{7928, 7928, 32767}, 6}, SpeakerPoint{{24840, 7928, 32767}, 7}, SpeakerPoint{{7928, 24840, 32767}, 8}, SpeakerPoint{{24840, 24840, 32767}, 9}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{{7928, 7928, 32767}, 6}, SpeakerPoint{{24840, 7928, 32767}, 7}, SpeakerPoint{{7928, 24840, 32767}, 8}, SpeakerPoint{{24840, 24840, 32767}, 9}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{2, {3, 4, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{2, {5, 6, 0}}, AxisGroup{2, {7, 8, 0}}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
RegionGeometry{
|
||||
9, 3, 2, 2,
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{{7928, 7928, 32767}, 6}, SpeakerPoint{{24840, 7928, 32767}, 7}, SpeakerPoint{{7928, 24840, 32767}, 8}, SpeakerPoint{{24840, 24840, 32767}, 9}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 0, 0}, 0}, SpeakerPoint{{32767, 0, 0}, 1}, SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{{7928, 7928, 32767}, 6}, SpeakerPoint{{24840, 7928, 32767}, 7}, SpeakerPoint{{7928, 24840, 32767}, 8}, SpeakerPoint{{24840, 24840, 32767}, 9}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{3, {0, 2, 1}}, AxisGroup{2, {3, 4, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{2, {5, 6, 0}}, AxisGroup{2, {7, 8, 0}}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
RegionGeometry{
|
||||
7, 3, 2, 2,
|
||||
{{SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{{7928, 7928, 32767}, 6}, SpeakerPoint{{24840, 7928, 32767}, 7}, SpeakerPoint{{7928, 24840, 32767}, 8}, SpeakerPoint{{24840, 24840, 32767}, 9}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{16384, 0, 0}, 2}, SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{{7928, 7928, 32767}, 6}, SpeakerPoint{{24840, 7928, 32767}, 7}, SpeakerPoint{{7928, 24840, 32767}, 8}, SpeakerPoint{{24840, 24840, 32767}, 9}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{1, {0, 0, 0}}, AxisGroup{2, {1, 2, 0}}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{2, {3, 4, 0}}, AxisGroup{2, {5, 6, 0}}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
@@ -364,7 +364,7 @@ inline constexpr std::array<LayoutGeometry, 12> kLayouts{{
|
||||
},
|
||||
RegionGeometry{
|
||||
6, 3, 1, 2,
|
||||
{{SpeakerPoint{{0, 16384, 0}, 4}, SpeakerPoint{{32767, 16384, 0}, 5}, SpeakerPoint{{7928, 7928, 32767}, 6}, SpeakerPoint{{24840, 7928, 32767}, 7}, SpeakerPoint{{7928, 24840, 32767}, 8}, SpeakerPoint{{24840, 24840, 32767}, 9}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{SpeakerPoint{{0, 32767, 0}, 4}, SpeakerPoint{{32767, 32767, 0}, 5}, SpeakerPoint{{7928, 7928, 32767}, 6}, SpeakerPoint{{24840, 7928, 32767}, 7}, SpeakerPoint{{7928, 24840, 32767}, 8}, SpeakerPoint{{24840, 24840, 32767}, 9}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}, SpeakerPoint{}}},
|
||||
{{AxisGroup{2, {0, 1, 0}}, AxisGroup{}, AxisGroup{}, AxisGroup{}}},
|
||||
{{AxisGroup{2, {2, 3, 0}}, AxisGroup{2, {4, 5, 0}}, AxisGroup{}, AxisGroup{}}}
|
||||
},
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
// Kept in one place: the string reported to foobar2000 and written to the log
|
||||
// must not drift apart.
|
||||
#define JOC_VERSION "0.6.2"
|
||||
#define JOC_VERSION "0.6.4"
|
||||
|
||||
DECLARE_COMPONENT_VERSION("JOC decoder (E-AC-3 JOC)", JOC_VERSION,
|
||||
"Plays E-AC-3 JOC (Dolby Atmos) files: the JOC objects are "
|
||||
|
||||
+16
-3
@@ -3,6 +3,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
@@ -16,6 +17,7 @@ namespace {
|
||||
|
||||
constexpr std::size_t kFrameSamples = 1536;
|
||||
constexpr std::uint32_t kRate = 48000;
|
||||
std::atomic<std::uint64_t> g_temp_serial{0};
|
||||
|
||||
std::uint16_t u16(const unsigned char* data) {
|
||||
return static_cast<std::uint16_t>(data[0] | (data[1] << 8));
|
||||
@@ -55,6 +57,10 @@ bool Source::decode_temp(const std::string& input_path, const std::string& ffmpe
|
||||
if (!temp.empty() && temp.back() != L'\\') temp.push_back(L'\\');
|
||||
temp += L"foo_input_joc_pcm_";
|
||||
temp += std::to_wstring(GetCurrentProcessId());
|
||||
temp += L"_";
|
||||
temp += std::to_wstring(g_temp_serial.fetch_add(1, std::memory_order_relaxed));
|
||||
temp += L"_";
|
||||
temp += std::to_wstring(GetTickCount64());
|
||||
temp += L".wav";
|
||||
temp_path_ = joc_path::to_utf8(temp.c_str());
|
||||
DeleteFileW(joc_path::to_wide_extended(temp_path_).c_str());
|
||||
@@ -231,6 +237,7 @@ bool Source::open(const std::string& input_path, const joc_decode::Settings& set
|
||||
}
|
||||
_fseeki64(file_, static_cast<long long>(header_.data_offset), SEEK_SET);
|
||||
frames_read_ = 0;
|
||||
emitted_frames_ = 0;
|
||||
eof_ = false;
|
||||
flushed_ = false;
|
||||
return true;
|
||||
@@ -289,14 +296,17 @@ bool Source::pull(std::size_t frames, float* destination, std::size_t* produced,
|
||||
|
||||
std::size_t Source::read(float* destination, std::size_t frames, std::string* error) {
|
||||
if (stream_ == nullptr || destination == nullptr || frames == 0u) return 0;
|
||||
if (emitted_frames_ >= total_frames_) return 0;
|
||||
const std::size_t wanted = static_cast<std::size_t>(
|
||||
std::min<std::uint64_t>(frames, total_frames_ - emitted_frames_));
|
||||
std::size_t written = 0;
|
||||
while (written < frames) {
|
||||
while (written < wanted) {
|
||||
std::size_t produced = 0;
|
||||
if (!pull(frames - written, destination + written * 2u, &produced, error)) {
|
||||
if (!pull(wanted - written, destination + written * 2u, &produced, error)) {
|
||||
return written;
|
||||
}
|
||||
written += produced;
|
||||
if (written == frames) break;
|
||||
if (written == wanted) break;
|
||||
if (!eof_) {
|
||||
if (!push_block(error)) return written;
|
||||
continue;
|
||||
@@ -311,6 +321,7 @@ std::size_t Source::read(float* destination, std::size_t frames, std::string* er
|
||||
}
|
||||
break;
|
||||
}
|
||||
emitted_frames_ += written;
|
||||
return written;
|
||||
}
|
||||
|
||||
@@ -327,6 +338,7 @@ bool Source::seek(double seconds, std::string* error) {
|
||||
frame * static_cast<std::uint64_t>(channels_) * 4u),
|
||||
SEEK_SET);
|
||||
frames_read_ = frame;
|
||||
emitted_frames_ = frame;
|
||||
eof_ = frames_read_ >= total_frames_;
|
||||
flushed_ = false;
|
||||
return true;
|
||||
@@ -348,6 +360,7 @@ void Source::close() {
|
||||
}
|
||||
feed_.clear();
|
||||
frames_read_ = 0;
|
||||
emitted_frames_ = 0;
|
||||
total_frames_ = 0;
|
||||
length_seconds_ = 0.0;
|
||||
eof_ = false;
|
||||
|
||||
@@ -58,6 +58,7 @@ private:
|
||||
std::string temp_path_;
|
||||
std::vector<float> feed_;
|
||||
std::uint64_t frames_read_ = 0;
|
||||
std::uint64_t emitted_frames_ = 0;
|
||||
std::uint64_t total_frames_ = 0;
|
||||
double length_seconds_ = 0.0;
|
||||
bool eof_ = false;
|
||||
|
||||
Reference in new issue
Block a user