Compare commits
2
Commits
b0ce3a162f
..
v0.6.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c0f9ea2ff | ||
|
|
886ff036cd |
No files matched your search
@@ -4,7 +4,7 @@ name: build
|
|||||||
# workflow artifacts, and — when a tag is pushed — turns them into a GitHub release.
|
# workflow artifacts, and — when a tag is pushed — turns them into a GitHub release.
|
||||||
# The SDK is fetched from foobar2000.org at build time (tools/setup_sdk.ps1) and the
|
# The SDK is fetched from foobar2000.org at build time (tools/setup_sdk.ps1) and the
|
||||||
# renderer sources are part of this repository (kernel/, synced from JustOneCacophonyCXX
|
# renderer sources are part of this repository (kernel/, synced from JustOneCacophonyCXX
|
||||||
# commit abce8465f8edda3356738e1a1db7cb1b33191c72), so nothing else is needed.
|
# version 1.3.1), so nothing else is needed.
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|||||||
+2
-3
@@ -208,6 +208,5 @@ every container in the library, which is where the volume comes from.
|
|||||||
## Licence
|
## Licence
|
||||||
|
|
||||||
`LICENSE` is the upstream MIT licence, copied unchanged; `kernel/` is a copy of the upstream
|
`LICENSE` is the upstream MIT licence, copied unchanged; `kernel/` is a copy of the upstream
|
||||||
rendering core sources, synced to JustOneCacophonyCXX commit
|
rendering core sources, synced to JustOneCacophonyCXX 1.3.1, and keeps their notices. See
|
||||||
`abce8465f8edda3356738e1a1db7cb1b33191c72` (the `v1.2.0` tag points at an older commit and is not
|
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
||||||
the sync baseline), and keeps their notices. See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
||||||
@@ -162,6 +162,6 @@ pwsh -File tools/package.ps1 # 两个架构,打包到 dist\*.fb2k-c
|
|||||||
|
|
||||||
## 许可
|
## 许可
|
||||||
|
|
||||||
`LICENSE` 是上游 MIT 许可,原样复制;`kernel/` 是上游渲染内核源码的副本,同步自 JustOneCacophonyCXX 的提交
|
`LICENSE` 是上游 MIT 许可,原样复制;`kernel/` 是上游渲染内核源码的副本,同步自 JustOneCacophonyCXX 的
|
||||||
`abce8465f8edda3356738e1a1db7cb1b33191c72`(`v1.2.0` tag 指向更早的提交,不作为同步基准),保留其声明。见
|
1.3.1 版本,保留其声明。见
|
||||||
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
|
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
|
||||||
@@ -5,9 +5,7 @@
|
|||||||
(`kernel/src/joc_bitstream/joc_huffman_tables.h`)的公开标准来源,以及 HRTF 数据与
|
(`kernel/src/joc_bitstream/joc_huffman_tables.h`)的公开标准来源,以及 HRTF 数据与
|
||||||
专利的边界说明。
|
专利的边界说明。
|
||||||
|
|
||||||
`kernel/` 整体是 JustOneCacophonyCXX 在提交
|
`kernel/` 整体是 JustOneCacophonyCXX 1.3.1 的逐字副本。
|
||||||
`abce8465f8edda3356738e1a1db7cb1b33191c72`(版本号 1.3.0)的逐字副本;
|
|
||||||
`v1.2.0` tag 指向更早的提交 a276028,不作为同步基准。
|
|
||||||
|
|
||||||
## 公开标准来源
|
## 公开标准来源
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#define JOC_VERSION_MAJOR 1
|
#define JOC_VERSION_MAJOR 1
|
||||||
#define JOC_VERSION_MINOR 3
|
#define JOC_VERSION_MINOR 3
|
||||||
#define JOC_VERSION_PATCH 0
|
#define JOC_VERSION_PATCH 1
|
||||||
#define JOC_VERSION_STRING "1.3.0"
|
#define JOC_VERSION_STRING "1.3.1"
|
||||||
|
|
||||||
#endif /* JOC_VERSION_H */
|
#endif /* JOC_VERSION_H */
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
shipping and loading joc_core.dll.
|
shipping and loading joc_core.dll.
|
||||||
|
|
||||||
The sources under kernel\src and kernel\include are a verbatim copy of the
|
The sources under kernel\src and kernel\include are a verbatim copy of the
|
||||||
upstream library at commit abce8465f8edda3356738e1a1db7cb1b33191c72 (see
|
upstream library at version 1.3.1 (see
|
||||||
JustOneCacophonyCXX\CMakeLists.txt): nothing under either
|
JustOneCacophonyCXX\CMakeLists.txt): nothing under either
|
||||||
tree is edited here, and both are kept identical to it, so a single core serves
|
tree is edited here, and both are kept identical to it, so a single core serves
|
||||||
the upstream tools and this component alike. The static build needs no branch
|
the upstream tools and this component alike. The static build needs no branch
|
||||||
|
|||||||
@@ -800,9 +800,35 @@ private:
|
|||||||
return pre_state;
|
return pre_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Compatibility note for frames without JOC metadata (status 8).
|
||||||
|
//
|
||||||
|
// The state machine used to map status 8 to Passthrough unconditionally,
|
||||||
|
// including in the middle of a stream. That is only meaningful before the
|
||||||
|
// first valid JOC frame: a plain E-AC-3 stream (or a stream whose first JOC
|
||||||
|
// frame comes late) has no object state yet, so the core planes are all
|
||||||
|
// there is and the delayed core PCM is the right output. In the middle of
|
||||||
|
// a JOC stream a frame without metadata is a damaged frame, not "no
|
||||||
|
// objects": the Passthrough output replaces the object render with the core
|
||||||
|
// planes, and the object synthesis restarts from silence on the next frame.
|
||||||
|
// Every such frame therefore produced a step at the frame boundary and a
|
||||||
|
// second one when the metadata came back; encoders that are not careful
|
||||||
|
// with the JOC EMDF container emit exactly those frames.
|
||||||
|
//
|
||||||
|
// After the change status 8 follows the state machine like the other
|
||||||
|
// invalid statuses: state 0 (no valid frame rendered yet) stays Passthrough,
|
||||||
|
// and state 3 (mid-stream) selects Hold, which reuses the previous object
|
||||||
|
// matrices and keeps the bed and object rendering continuous.
|
||||||
|
//
|
||||||
|
// This is a compatibility choice, not a claim about the normative reading
|
||||||
|
// of the specification: a frame without metadata can be argued to be the
|
||||||
|
// Passthrough case. It exists so that non-standard streams stay click-free;
|
||||||
|
// if the reference behaviour is preferred, re-add the unconditional
|
||||||
|
// Passthrough branch here.
|
||||||
FrameMode select_mode(const uint32_t status) const noexcept {
|
FrameMode select_mode(const uint32_t status) const noexcept {
|
||||||
if (status == EJOC_FRAME_STATUS_NO_METADATA) {
|
if (status == EJOC_FRAME_STATUS_NO_METADATA) {
|
||||||
return FrameMode::Passthrough;
|
// See the note above: only a stream that has not rendered a valid
|
||||||
|
// frame yet has nothing to hold.
|
||||||
|
return state_ == 0u ? FrameMode::Passthrough : FrameMode::Hold;
|
||||||
}
|
}
|
||||||
if (state_ == 4u) {
|
if (state_ == 4u) {
|
||||||
return FrameMode::HardCut;
|
return FrameMode::HardCut;
|
||||||
|
|||||||
+50
-5
@@ -41,6 +41,11 @@ constexpr std::size_t kMaxBedChannels = 8;
|
|||||||
// can ever hold.
|
// can ever hold.
|
||||||
constexpr std::size_t kBedReadBytes = 48u * 1024u;
|
constexpr std::size_t kBedReadBytes = 48u * 1024u;
|
||||||
constexpr std::size_t kBedPipeBytes = 1u << 20;
|
constexpr std::size_t kBedPipeBytes = 1u << 20;
|
||||||
|
// The open-time JOC scan reads in chunks: a pipe read returns what is available,
|
||||||
|
// not the whole request, and the first JOC frame can sit past the first chunk.
|
||||||
|
constexpr std::size_t kScanChunkBytes = 64u * 1024u;
|
||||||
|
// Cap on the trailing partial frame kept between reads.
|
||||||
|
constexpr std::size_t kMaxScanWindow = 1u << 20;
|
||||||
constexpr std::size_t kFrameSamples = JOC_FRAME_SAMPLES;
|
constexpr std::size_t kFrameSamples = JOC_FRAME_SAMPLES;
|
||||||
|
|
||||||
// The decoded bed has to stay on the E-AC-3 frame grid that the JOC matrix and the
|
// The decoded bed has to stay on the E-AC-3 frame grid that the JOC matrix and the
|
||||||
@@ -93,6 +98,45 @@ bool seven_channel_config(int config) {
|
|||||||
return config == 1 || config == 2 || config == 4;
|
return config == 1 || config == 2 || config == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scans an E-AC-3 stream through `read` until a syncframe carrying the JOC EMDF
|
||||||
|
// container is seen, and returns its joc_dmx_config_idx. One read is not enough:
|
||||||
|
// ReadFile returns as soon as some bytes are available (a pipe hands over a
|
||||||
|
// partial chunk, not the whole request), and an encoder may leave the first
|
||||||
|
// audio frames without JOC metadata, so the first JOC frame can sit past the
|
||||||
|
// first read. Returns -1 when the stream ends without one.
|
||||||
|
template <typename ReadFn>
|
||||||
|
int scan_config_idx_streaming(ReadFn&& read, std::size_t chunk_bytes) {
|
||||||
|
std::vector<std::uint8_t> window;
|
||||||
|
std::vector<std::uint8_t> chunk(chunk_bytes);
|
||||||
|
while (true) {
|
||||||
|
const std::size_t got = read(chunk.data(), chunk.size());
|
||||||
|
if (got == 0) break;
|
||||||
|
window.insert(window.end(), chunk.begin(),
|
||||||
|
chunk.begin() + static_cast<std::ptrdiff_t>(got));
|
||||||
|
std::size_t offset = 0;
|
||||||
|
while (offset + 6u <= window.size()) {
|
||||||
|
const std::size_t bytes =
|
||||||
|
joc_eac3::frame_bytes_at(window.data(), window.size(), offset);
|
||||||
|
if (bytes == 0 || offset + bytes > window.size()) break;
|
||||||
|
if (joc_eac3::frame_has_joc(window.data() + offset, bytes)) {
|
||||||
|
unsigned config = 0;
|
||||||
|
if (joc_eac3::joc_config_idx(window.data() + offset, bytes, &config)) {
|
||||||
|
return static_cast<int>(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
offset += bytes;
|
||||||
|
}
|
||||||
|
// Only the trailing incomplete frame has to survive into the next read;
|
||||||
|
// the rest was examined above.
|
||||||
|
if (offset != 0) {
|
||||||
|
window.erase(window.begin(),
|
||||||
|
window.begin() + static_cast<std::ptrdiff_t>(offset));
|
||||||
|
}
|
||||||
|
if (window.size() > kMaxScanWindow) break;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Kernel entry points.
|
// Kernel entry points.
|
||||||
//
|
//
|
||||||
@@ -866,22 +910,23 @@ bool Engine::Impl::position_bare(std::uint64_t frame, std::string* error) {
|
|||||||
|
|
||||||
bool Engine::Impl::resolve_bed_channels(std::string* error) {
|
bool Engine::Impl::resolve_bed_channels(std::string* error) {
|
||||||
bed_channels = kDefaultBedChannels;
|
bed_channels = kDefaultBedChannels;
|
||||||
std::vector<std::uint8_t> buffer(1u << 20);
|
|
||||||
int config = -1;
|
int config = -1;
|
||||||
if (eac3_from_pipe) {
|
if (eac3_from_pipe) {
|
||||||
// The metadata stream has to run once to be sniffed; it is stopped again and
|
// The metadata stream has to run once to be sniffed; it is stopped again and
|
||||||
// restarted from the beginning, which costs one extra ffmpeg spawn per track.
|
// restarted from the beginning, which costs one extra ffmpeg spawn per track.
|
||||||
if (!start_metadata(error)) return false;
|
if (!start_metadata(error)) return false;
|
||||||
const std::size_t got = eac3_pipe.read(buffer.data(), buffer.size());
|
config = scan_config_idx_streaming(
|
||||||
|
[this](void* data, std::size_t bytes) { return eac3_pipe.read(data, bytes); },
|
||||||
|
kScanChunkBytes);
|
||||||
eac3_pipe.stop();
|
eac3_pipe.stop();
|
||||||
config = scan_config_idx(buffer.data(), got);
|
|
||||||
} else {
|
} else {
|
||||||
if (!eac3.is_open() && !eac3.open(input_path)) {
|
if (!eac3.is_open() && !eac3.open(input_path)) {
|
||||||
if (error != nullptr) *error = "cannot open the input file";
|
if (error != nullptr) *error = "cannot open the input file";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const std::size_t got = eac3.read(buffer.data(), buffer.size());
|
config = scan_config_idx_streaming(
|
||||||
config = scan_config_idx(buffer.data(), got);
|
[this](void* data, std::size_t bytes) { return eac3.read(data, bytes); },
|
||||||
|
kScanChunkBytes);
|
||||||
// Put the file back where the feed loop expects it.
|
// Put the file back where the feed loop expects it.
|
||||||
if (!eac3.seek(index_base)) {
|
if (!eac3.seek(index_base)) {
|
||||||
if (error != nullptr) *error = "cannot position the input file";
|
if (error != nullptr) *error = "cannot position the input file";
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
// Kept in one place: the string reported to foobar2000 and written to the log
|
// Kept in one place: the string reported to foobar2000 and written to the log
|
||||||
// must not drift apart.
|
// must not drift apart.
|
||||||
#define JOC_VERSION "0.5.0"
|
#define JOC_VERSION "0.6.1"
|
||||||
|
|
||||||
DECLARE_COMPONENT_VERSION("JOC decoder (E-AC-3 JOC)", JOC_VERSION,
|
DECLARE_COMPONENT_VERSION("JOC decoder (E-AC-3 JOC)", JOC_VERSION,
|
||||||
"Plays E-AC-3 JOC (Dolby Atmos) files: the JOC objects are "
|
"Plays E-AC-3 JOC (Dolby Atmos) files: the JOC objects are "
|
||||||
|
|||||||
Reference in new issue
Block a user