Sync the kernel copy with the truncated JOC payload fix
The kernel copy follows JustOneCacophonyCXX abce846 (version 1.3.0). An ID14 payload that ends inside joc_data is now a frame status (7) instead of a stream error, so the renderer holds the previous matrices and playback continues; the file task counts those frames and the stream status struct gains an appended truncated_joc_frames field that joc_stream_status() accepts in both struct sizes. The nine kernel files are byte-identical to the upstream checkout again, and the component needs no code change because the fix lives inside the vendored kernel. README, THIRD_PARTY_NOTICES, the kernel project and the CI comment now pin the copy to abce846 (version 1.3.0). Built Release-Static|x64. The offline test tools build and pass, and render_harness decodes the reported M4A to the end: 8 channels, 13,441,536 samples (8751 frames), peak 0.742114365, byte-identical to the fixed core CLI output.
This commit is contained in:
1 parent
defe9538fe
commit
b0ce3a162f
14 files changed
+102
-33
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 3f0d5e87fe41b90d9350528d2dca2ca82a637a3f), so nothing else is needed.
|
# commit abce8465f8edda3356738e1a1db7cb1b33191c72), so nothing else is needed.
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|||||||
+1
-1
@@ -209,5 +209,5 @@ every container in the library, which is where the volume comes from.
|
|||||||
|
|
||||||
`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 commit
|
||||||
`3f0d5e87fe41b90d9350528d2dca2ca82a637a3f` (the `v1.2.0` tag points at an older commit and is not
|
`abce8465f8edda3356738e1a1db7cb1b33191c72` (the `v1.2.0` tag points at an older commit and is not
|
||||||
the sync baseline), and keeps their notices. See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
the sync baseline), and keeps their notices. See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
||||||
@@ -163,5 +163,5 @@ pwsh -File tools/package.ps1 # 两个架构,打包到 dist\*.fb2k-c
|
|||||||
## 许可
|
## 许可
|
||||||
|
|
||||||
`LICENSE` 是上游 MIT 许可,原样复制;`kernel/` 是上游渲染内核源码的副本,同步自 JustOneCacophonyCXX 的提交
|
`LICENSE` 是上游 MIT 许可,原样复制;`kernel/` 是上游渲染内核源码的副本,同步自 JustOneCacophonyCXX 的提交
|
||||||
`3f0d5e87fe41b90d9350528d2dca2ca82a637a3f`(`v1.2.0` tag 指向更早的提交,不作为同步基准),保留其声明。见
|
`abce8465f8edda3356738e1a1db7cb1b33191c72`(`v1.2.0` tag 指向更早的提交,不作为同步基准),保留其声明。见
|
||||||
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
|
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
专利的边界说明。
|
专利的边界说明。
|
||||||
|
|
||||||
`kernel/` 整体是 JustOneCacophonyCXX 在提交
|
`kernel/` 整体是 JustOneCacophonyCXX 在提交
|
||||||
`3f0d5e87fe41b90d9350528d2dca2ca82a637a3f`(版本号仍为 1.2.0)的逐字副本;
|
`abce8465f8edda3356738e1a1db7cb1b33191c72`(版本号 1.3.0)的逐字副本;
|
||||||
`v1.2.0` tag 指向更早的提交 a276028,不作为同步基准。
|
`v1.2.0` tag 指向更早的提交 a276028,不作为同步基准。
|
||||||
|
|
||||||
## 公开标准来源
|
## 公开标准来源
|
||||||
|
|||||||
@@ -190,9 +190,10 @@ typedef struct joc_object_params {
|
|||||||
|
|
||||||
/* Per-frame JOC parse status (joc_frame_params.status). A non-zero status makes
|
/* Per-frame JOC parse status (joc_frame_params.status). A non-zero status makes
|
||||||
* the frame invalid for rendering: the renderer holds the previous matrices or
|
* the frame invalid for rendering: the renderer holds the previous matrices or
|
||||||
* passes the core PCM through instead of decoding the matrix. Only status 3
|
* passes the core PCM through instead of decoding the matrix. Statuses 3 and 7
|
||||||
* still carries a complete object list (object count clamped to 15) for
|
* still carry the complete header and object list for diagnostics; statuses 2
|
||||||
* diagnostics; statuses 2 and 4 stop the parse after the failing header field. */
|
* and 4 stop the parse after the failing header field, and 7 stops inside
|
||||||
|
* joc_data, so only the per-object matrices are missing there. */
|
||||||
enum {
|
enum {
|
||||||
JOC_FRAME_STATUS_OK = 0,
|
JOC_FRAME_STATUS_OK = 0,
|
||||||
JOC_FRAME_STATUS_UNSUPPORTED_DMX = 2, /* joc_dmx_config_idx outside 0..4 */
|
JOC_FRAME_STATUS_UNSUPPORTED_DMX = 2, /* joc_dmx_config_idx outside 0..4 */
|
||||||
@@ -200,7 +201,11 @@ enum {
|
|||||||
JOC_FRAME_STATUS_BAD_PARAMETER_BAND = 4, /* unknown num_bands index */
|
JOC_FRAME_STATUS_BAD_PARAMETER_BAND = 4, /* unknown num_bands index */
|
||||||
JOC_FRAME_STATUS_BAD_OFFSET_TS = 5, /* offset_ts outside 0..23 or not */
|
JOC_FRAME_STATUS_BAD_OFFSET_TS = 5, /* offset_ts outside 0..23 or not */
|
||||||
/* strictly increasing */
|
/* strictly increasing */
|
||||||
JOC_FRAME_STATUS_TRAILING_DATA = 6 /* bytes after joc_data alignment */
|
JOC_FRAME_STATUS_TRAILING_DATA = 6, /* bytes after joc_data alignment */
|
||||||
|
/* The ID14 payload ends before its joc_data is complete. The header,
|
||||||
|
* clipgain, sequence counter and object parameters are intact, so the frame
|
||||||
|
* stays classified and is concealed by holding the previous matrices. */
|
||||||
|
JOC_FRAME_STATUS_TRUNCATED = 7
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct joc_frame_params {
|
typedef struct joc_frame_params {
|
||||||
@@ -225,12 +230,18 @@ typedef struct joc_frame_params {
|
|||||||
joc_object_params objects[JOC_MAX_OBJECTS];
|
joc_object_params objects[JOC_MAX_OBJECTS];
|
||||||
} joc_frame_params;
|
} joc_frame_params;
|
||||||
|
|
||||||
/* Parse an EMDF ID14 (JOC) payload. */
|
/* Parse an EMDF ID14 (JOC) payload. A payload that ends inside joc_data is a
|
||||||
|
* damaged frame rather than a transport error: the call succeeds, the header and
|
||||||
|
* object parameters are filled in, and out_params->status is
|
||||||
|
* JOC_FRAME_STATUS_TRUNCATED. A payload too short for the 12-bit joc_header is
|
||||||
|
* unclassifiable and stays JOC_ERR_BITSTREAM_TRUNCATED. */
|
||||||
JOC_API joc_error JOC_CALL joc_parse_id14(const uint8_t* payload, size_t payload_size,
|
JOC_API joc_error JOC_CALL joc_parse_id14(const uint8_t* payload, size_t payload_size,
|
||||||
joc_frame_params* out_params);
|
joc_frame_params* out_params);
|
||||||
|
|
||||||
/* Locate the contiguous JOC EMDF container inside one E-AC-3 syncframe and
|
/* Locate the contiguous JOC EMDF container inside one E-AC-3 syncframe and
|
||||||
* parse its ID14 payload. out_emdf may be NULL. */
|
* parse its ID14 payload. out_emdf may be NULL. A damaged ID14 payload is
|
||||||
|
* reported through out_params->status like joc_parse_id14(); an incomplete
|
||||||
|
* container stays a transport error. */
|
||||||
JOC_API joc_error JOC_CALL joc_parse_eac3_frame(const uint8_t* frame, size_t frame_size,
|
JOC_API joc_error JOC_CALL joc_parse_eac3_frame(const uint8_t* frame, size_t frame_size,
|
||||||
joc_frame_params* out_params,
|
joc_frame_params* out_params,
|
||||||
joc_emdf_info* out_emdf);
|
joc_emdf_info* out_emdf);
|
||||||
@@ -251,7 +262,8 @@ JOC_API joc_error JOC_CALL joc_eac3_frame_bytes(const uint8_t* data, size_t size
|
|||||||
|
|
||||||
/* Strict trailing-bit check for the JOC payload (A/B robustness corpus).
|
/* Strict trailing-bit check for the JOC payload (A/B robustness corpus).
|
||||||
* Returns JOC_ERR_BITSTREAM_PADDING when more than 7 bits are left over or the
|
* Returns JOC_ERR_BITSTREAM_PADDING when more than 7 bits are left over or the
|
||||||
* leftover bits are not zero. */
|
* leftover bits are not zero, and JOC_ERR_BITSTREAM_TRUNCATED when the payload
|
||||||
|
* ends inside joc_data. */
|
||||||
JOC_API joc_error JOC_CALL joc_check_id14_padding(const uint8_t* payload, size_t payload_size,
|
JOC_API joc_error JOC_CALL joc_check_id14_padding(const uint8_t* payload, size_t payload_size,
|
||||||
uint32_t* out_trailing_bits);
|
uint32_t* out_trailing_bits);
|
||||||
|
|
||||||
|
|||||||
@@ -97,8 +97,9 @@ typedef struct joc_stream_status_info {
|
|||||||
uint64_t oamd_payloads;
|
uint64_t oamd_payloads;
|
||||||
uint64_t oamd_transitions;
|
uint64_t oamd_transitions;
|
||||||
/* Metadata the renderer had to work around, per audio frame: no JOC payload at
|
/* Metadata the renderer had to work around, per audio frame: no JOC payload at
|
||||||
* all, a declared object count clamped to 15, and a syncframe carrying a second
|
* all, an ID14 payload that ends inside joc_data (that frame holds the previous
|
||||||
* EMDF container that is not this frame's JOC metadata. */
|
* matrices), a declared object count clamped to 15, and a syncframe carrying a
|
||||||
|
* second EMDF container that is not this frame's JOC metadata. */
|
||||||
uint64_t missing_joc_frames;
|
uint64_t missing_joc_frames;
|
||||||
uint64_t objects_clamped_frames;
|
uint64_t objects_clamped_frames;
|
||||||
uint64_t extra_container_frames;
|
uint64_t extra_container_frames;
|
||||||
@@ -108,6 +109,9 @@ typedef struct joc_stream_status_info {
|
|||||||
uint64_t bed_mask_mismatch_frames;
|
uint64_t bed_mask_mismatch_frames;
|
||||||
uint32_t output_channels;
|
uint32_t output_channels;
|
||||||
uint32_t ended; /* 1 after flush() */
|
uint32_t ended; /* 1 after flush() */
|
||||||
|
/* Appended field: joc_stream_status() accepts the size that ends at `ended`
|
||||||
|
* as well, so a caller built against the previous header keeps working. */
|
||||||
|
uint64_t truncated_joc_frames;
|
||||||
} joc_stream_status_info;
|
} joc_stream_status_info;
|
||||||
|
|
||||||
JOC_API joc_error JOC_CALL joc_stream_create(const joc_stream_config* config, joc_stream** out);
|
JOC_API joc_error JOC_CALL joc_stream_create(const joc_stream_config* config, joc_stream** out);
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
#define JOC_VERSION_H
|
#define JOC_VERSION_H
|
||||||
|
|
||||||
#define JOC_VERSION_MAJOR 1
|
#define JOC_VERSION_MAJOR 1
|
||||||
#define JOC_VERSION_MINOR 2
|
#define JOC_VERSION_MINOR 3
|
||||||
#define JOC_VERSION_PATCH 0
|
#define JOC_VERSION_PATCH 0
|
||||||
#define JOC_VERSION_STRING "1.2.0"
|
#define JOC_VERSION_STRING "1.3.0"
|
||||||
|
|
||||||
#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 3f0d5e87fe41b90d9350528d2dca2ca82a637a3f (see
|
upstream library at commit abce8465f8edda3356738e1a1db7cb1b33191c72 (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
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include <cstddef>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -140,8 +141,13 @@ joc_error JOC_CALL joc_stream_reset(joc_stream* stream) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
joc_error JOC_CALL joc_stream_status(const joc_stream* stream, joc_stream_status_info* out) {
|
joc_error JOC_CALL joc_stream_status(const joc_stream* stream, joc_stream_status_info* out) {
|
||||||
|
// The info struct only grows by appending fields, so a caller built against
|
||||||
|
// the previous size still gets every field it knows about.
|
||||||
|
constexpr uint32_t kSizeBeforeTruncatedFrames = static_cast<uint32_t>(
|
||||||
|
offsetof(joc_stream_status_info, truncated_joc_frames));
|
||||||
if (stream == nullptr || out == nullptr ||
|
if (stream == nullptr || out == nullptr ||
|
||||||
out->struct_size != sizeof(joc_stream_status_info)) {
|
(out->struct_size != sizeof(joc_stream_status_info) &&
|
||||||
|
out->struct_size != kSizeBeforeTruncatedFrames)) {
|
||||||
return JOC_ERR_INVALID_ARGUMENT;
|
return JOC_ERR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
const joc::stream::Info& info = stream->instance.info();
|
const joc::stream::Info& info = stream->instance.info();
|
||||||
@@ -160,6 +166,9 @@ joc_error JOC_CALL joc_stream_status(const joc_stream* stream, joc_stream_status
|
|||||||
out->bed_mask_mismatch_frames = info.bed_mask_mismatch_frames;
|
out->bed_mask_mismatch_frames = info.bed_mask_mismatch_frames;
|
||||||
out->output_channels = info.output_channels;
|
out->output_channels = info.output_channels;
|
||||||
out->ended = info.ended;
|
out->ended = info.ended;
|
||||||
|
if (out->struct_size > kSizeBeforeTruncatedFrames) {
|
||||||
|
out->truncated_joc_frames = info.truncated_joc_frames;
|
||||||
|
}
|
||||||
return JOC_OK;
|
return JOC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -229,6 +229,28 @@ void tail_info(joc_frame_params* out, const bits::BitReader& reader, const std::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A payload that runs out of bits after the joc_header is a damaged but
|
||||||
|
// identifiable JOC frame: the header, clipgain, sequence counter and object
|
||||||
|
// parameters are intact, so the frame keeps its identity and the renderer can
|
||||||
|
// hold the previous matrices instead of stopping the stream. A payload that
|
||||||
|
// ends before the header cannot be classified and stays a transport error; a
|
||||||
|
// Huffman walk that leaves the tree is a syntax error, never a truncation.
|
||||||
|
Status truncated_frame(const bits::BitReader& reader, joc_frame_params* out,
|
||||||
|
const std::uint8_t* payload, std::size_t payload_size) {
|
||||||
|
if (reader.error() != JOC_ERR_BITSTREAM_TRUNCATED) {
|
||||||
|
return syntax_fail(reader.error_message());
|
||||||
|
}
|
||||||
|
out->status = JOC_FRAME_STATUS_TRUNCATED;
|
||||||
|
out->present_mask = 0u;
|
||||||
|
for (std::uint32_t obj = 0; obj < out->n_objects; ++obj) {
|
||||||
|
if (out->objects[obj].present != 0u) {
|
||||||
|
out->present_mask |= 1u << obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tail_info(out, reader, payload, payload_size);
|
||||||
|
return Status::success();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Status parse_id14(const std::uint8_t* payload, std::size_t payload_size, joc_frame_params* out,
|
Status parse_id14(const std::uint8_t* payload, std::size_t payload_size, joc_frame_params* out,
|
||||||
@@ -255,7 +277,7 @@ Status parse_id14(const std::uint8_t* payload, std::size_t payload_size, joc_fra
|
|||||||
out->clipgain_y_bits = static_cast<std::uint8_t>(reader.read(5));
|
out->clipgain_y_bits = static_cast<std::uint8_t>(reader.read(5));
|
||||||
out->seq_count = reader.read(10);
|
out->seq_count = reader.read(10);
|
||||||
if (reader.failed()) {
|
if (reader.failed()) {
|
||||||
return truncated_fail(reader);
|
return truncated_frame(reader, out, payload, payload_size);
|
||||||
}
|
}
|
||||||
// clipgain = 2^(x-4) * (1 + y/32); ldexp builds the power of two exactly
|
// clipgain = 2^(x-4) * (1 + y/32); ldexp builds the power of two exactly
|
||||||
// over the whole legal range, so the result is bit-exact to the reference.
|
// over the whole legal range, so the result is bit-exact to the reference.
|
||||||
@@ -273,14 +295,14 @@ Status parse_id14(const std::uint8_t* payload, std::size_t payload_size, joc_fra
|
|||||||
joc_object_params& info = out->objects[obj];
|
joc_object_params& info = out->objects[obj];
|
||||||
info.present = static_cast<std::uint8_t>(reader.read(1));
|
info.present = static_cast<std::uint8_t>(reader.read(1));
|
||||||
if (reader.failed()) {
|
if (reader.failed()) {
|
||||||
return truncated_fail(reader);
|
return truncated_frame(reader, out, payload, payload_size);
|
||||||
}
|
}
|
||||||
if (info.present == 0u) {
|
if (info.present == 0u) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
info.num_bands_idx = static_cast<std::uint8_t>(reader.read(3));
|
info.num_bands_idx = static_cast<std::uint8_t>(reader.read(3));
|
||||||
if (reader.failed()) {
|
if (reader.failed()) {
|
||||||
return truncated_fail(reader);
|
return truncated_frame(reader, out, payload, payload_size);
|
||||||
}
|
}
|
||||||
const std::int16_t bands = num_bands_for_index(info.num_bands_idx);
|
const std::int16_t bands = num_bands_for_index(info.num_bands_idx);
|
||||||
if (bands < 0) {
|
if (bands < 0) {
|
||||||
@@ -299,14 +321,14 @@ Status parse_id14(const std::uint8_t* payload, std::size_t payload_size, joc_fra
|
|||||||
info.num_dpoints_bits = static_cast<std::uint8_t>(reader.read(1));
|
info.num_dpoints_bits = static_cast<std::uint8_t>(reader.read(1));
|
||||||
info.n_dpoints = static_cast<std::uint8_t>(info.num_dpoints_bits + 1u);
|
info.n_dpoints = static_cast<std::uint8_t>(info.num_dpoints_bits + 1u);
|
||||||
if (reader.failed()) {
|
if (reader.failed()) {
|
||||||
return truncated_fail(reader);
|
return truncated_frame(reader, out, payload, payload_size);
|
||||||
}
|
}
|
||||||
if (info.slope_idx == 1u) {
|
if (info.slope_idx == 1u) {
|
||||||
for (std::uint32_t dp = 0; dp < info.n_dpoints; ++dp) {
|
for (std::uint32_t dp = 0; dp < info.n_dpoints; ++dp) {
|
||||||
info.offset_ts[dp] = static_cast<std::uint8_t>(reader.read(5));
|
info.offset_ts[dp] = static_cast<std::uint8_t>(reader.read(5));
|
||||||
}
|
}
|
||||||
if (reader.failed()) {
|
if (reader.failed()) {
|
||||||
return truncated_fail(reader);
|
return truncated_frame(reader, out, payload, payload_size);
|
||||||
}
|
}
|
||||||
// offset_ts is the raw 5-bit slot index (legal range 0..23) and one
|
// offset_ts is the raw 5-bit slot index (legal range 0..23) and one
|
||||||
// object's data points must be strictly increasing.
|
// object's data points must be strictly increasing.
|
||||||
@@ -350,13 +372,13 @@ Status parse_id14(const std::uint8_t* payload, std::size_t payload_size, joc_fra
|
|||||||
const Tree idx_tree = select_tree(info.quant_idx, SymbolKind::Idx, n_channels);
|
const Tree idx_tree = select_tree(info.quant_idx, SymbolKind::Idx, n_channels);
|
||||||
const std::uint32_t first = reader.read(3);
|
const std::uint32_t first = reader.read(3);
|
||||||
if (reader.failed()) {
|
if (reader.failed()) {
|
||||||
return truncated_fail(reader);
|
return truncated_frame(reader, out, payload, payload_size);
|
||||||
}
|
}
|
||||||
symbol->idx[dp][0] = static_cast<std::uint8_t>(first);
|
symbol->idx[dp][0] = static_cast<std::uint8_t>(first);
|
||||||
for (int pb = 1; pb < info.n_bands; ++pb) {
|
for (int pb = 1; pb < info.n_bands; ++pb) {
|
||||||
std::int16_t value = 0;
|
std::int16_t value = 0;
|
||||||
if (!huff_decode(idx_tree, reader, &value)) {
|
if (!huff_decode(idx_tree, reader, &value)) {
|
||||||
return truncated_fail(reader);
|
return truncated_frame(reader, out, payload, payload_size);
|
||||||
}
|
}
|
||||||
symbol->idx[dp][pb] = static_cast<std::uint8_t>(value);
|
symbol->idx[dp][pb] = static_cast<std::uint8_t>(value);
|
||||||
}
|
}
|
||||||
@@ -364,7 +386,7 @@ Status parse_id14(const std::uint8_t* payload, std::size_t payload_size, joc_fra
|
|||||||
for (int pb = 0; pb < info.n_bands; ++pb) {
|
for (int pb = 0; pb < info.n_bands; ++pb) {
|
||||||
std::int16_t value = 0;
|
std::int16_t value = 0;
|
||||||
if (!huff_decode(vec_tree, reader, &value)) {
|
if (!huff_decode(vec_tree, reader, &value)) {
|
||||||
return truncated_fail(reader);
|
return truncated_frame(reader, out, payload, payload_size);
|
||||||
}
|
}
|
||||||
symbol->vec[dp][pb] = value;
|
symbol->vec[dp][pb] = value;
|
||||||
}
|
}
|
||||||
@@ -374,7 +396,7 @@ Status parse_id14(const std::uint8_t* payload, std::size_t payload_size, joc_fra
|
|||||||
for (int pb = 0; pb < info.n_bands; ++pb) {
|
for (int pb = 0; pb < info.n_bands; ++pb) {
|
||||||
std::int16_t value = 0;
|
std::int16_t value = 0;
|
||||||
if (!huff_decode(mtx_tree, reader, &value)) {
|
if (!huff_decode(mtx_tree, reader, &value)) {
|
||||||
return truncated_fail(reader);
|
return truncated_frame(reader, out, payload, payload_size);
|
||||||
}
|
}
|
||||||
symbol->mtx[dp][ch][pb] = value;
|
symbol->mtx[dp][ch][pb] = value;
|
||||||
}
|
}
|
||||||
@@ -460,10 +482,13 @@ int score_container_as_joc(const std::uint8_t* data, std::size_t size,
|
|||||||
FrameSymbols symbols;
|
FrameSymbols symbols;
|
||||||
if (parse_id14(bytes.data(), bytes.size(), ¶ms, &symbols).ok()) {
|
if (parse_id14(bytes.data(), bytes.size(), ¶ms, &symbols).ok()) {
|
||||||
// The reference scores a payload by the frame status: an unsupported
|
// The reference scores a payload by the frame status: an unsupported
|
||||||
// downmix configuration (2) or an unknown parameter-band count (4)
|
// downmix configuration (2), an unknown parameter-band count (4) or a
|
||||||
// leaves the syntax unparsable and must not win the container choice.
|
// payload that ends inside joc_data (7) must not win the container
|
||||||
|
// choice, because another candidate may carry the frame's complete
|
||||||
|
// metadata.
|
||||||
parses = params.status != JOC_FRAME_STATUS_UNSUPPORTED_DMX &&
|
parses = params.status != JOC_FRAME_STATUS_UNSUPPORTED_DMX &&
|
||||||
params.status != JOC_FRAME_STATUS_BAD_PARAMETER_BAND;
|
params.status != JOC_FRAME_STATUS_BAD_PARAMETER_BAND &&
|
||||||
|
params.status != JOC_FRAME_STATUS_TRUNCATED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const bool associated = oamd->has_group_id != 0u && payload->has_group_id != 0u &&
|
const bool associated = oamd->has_group_id != 0u && payload->has_group_id != 0u &&
|
||||||
@@ -522,9 +547,9 @@ Status check_id14_padding(const std::uint8_t* payload, std::size_t payload_size,
|
|||||||
if (!status.ok()) {
|
if (!status.ok()) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
// The two statuses that stop the parse early leave the payload without a
|
// The statuses that stop the parse early leave the payload without a
|
||||||
// joc_data end position, so they keep reporting the syntax failure they
|
// joc_data end position, so they keep reporting the failure they reported
|
||||||
// reported before the frame-status split.
|
// before the frame-status split.
|
||||||
if (params.status == JOC_FRAME_STATUS_UNSUPPORTED_DMX) {
|
if (params.status == JOC_FRAME_STATUS_UNSUPPORTED_DMX) {
|
||||||
return Status::fail(JOC_ERR_JOC_UNSUPPORTED_VARIANT, stage::kJoc,
|
return Status::fail(JOC_ERR_JOC_UNSUPPORTED_VARIANT, stage::kJoc,
|
||||||
"downmix_config_unsupported: joc_dmx_config_idx outside 0..4");
|
"downmix_config_unsupported: joc_dmx_config_idx outside 0..4");
|
||||||
@@ -533,6 +558,10 @@ Status check_id14_padding(const std::uint8_t* payload, std::size_t payload_size,
|
|||||||
return Status::fail(JOC_ERR_JOC_SYNTAX, stage::kJoc,
|
return Status::fail(JOC_ERR_JOC_SYNTAX, stage::kJoc,
|
||||||
"unknown JOC num_bands index stops the payload");
|
"unknown JOC num_bands index stops the payload");
|
||||||
}
|
}
|
||||||
|
if (params.status == JOC_FRAME_STATUS_TRUNCATED) {
|
||||||
|
return Status::fail(JOC_ERR_BITSTREAM_TRUNCATED, stage::kJoc,
|
||||||
|
"the ID14 payload ends before its joc_data is complete");
|
||||||
|
}
|
||||||
if (out_trailing_bits != nullptr) {
|
if (out_trailing_bits != nullptr) {
|
||||||
*out_trailing_bits = params.trailing_bits;
|
*out_trailing_bits = params.trailing_bits;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -999,7 +999,7 @@ private:
|
|||||||
if (status != EJOC_FRAME_STATUS_NO_METADATA) {
|
if (status != EJOC_FRAME_STATUS_NO_METADATA) {
|
||||||
return fail("a frame without JOC metadata must use frame_status 8");
|
return fail("a frame without JOC metadata must use frame_status 8");
|
||||||
}
|
}
|
||||||
} else if (status != 0u && (status < 2u || status > 6u)) {
|
} else if (status != 0u && (status < 2u || status > 7u)) {
|
||||||
return fail("frame_status is not a JOC parse status");
|
return fail("frame_status is not a JOC parse status");
|
||||||
}
|
}
|
||||||
if ((input.object_mask & ~((1u << EJOC_MAX_OBJECTS) - 1u)) != 0u) {
|
if ((input.object_mask & ~((1u << EJOC_MAX_OBJECTS) - 1u)) != 0u) {
|
||||||
|
|||||||
@@ -246,6 +246,9 @@ Status Stream::flush_pending_frame() {
|
|||||||
if (entry.params.objects_clamped != 0u) {
|
if (entry.params.objects_clamped != 0u) {
|
||||||
++info_.objects_clamped_frames;
|
++info_.objects_clamped_frames;
|
||||||
}
|
}
|
||||||
|
if (entry.params.status == JOC_FRAME_STATUS_TRUNCATED) {
|
||||||
|
++info_.truncated_joc_frames;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// No JOC metadata for this audio frame: the object channels stay silent
|
// No JOC metadata for this audio frame: the object channels stay silent
|
||||||
// while the kernel state still advances for the frame.
|
// while the kernel state still advances for the frame.
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ struct Info {
|
|||||||
std::uint64_t oamd_payloads = 0;
|
std::uint64_t oamd_payloads = 0;
|
||||||
std::uint64_t oamd_transitions = 0;
|
std::uint64_t oamd_transitions = 0;
|
||||||
std::uint64_t missing_joc_frames = 0;
|
std::uint64_t missing_joc_frames = 0;
|
||||||
|
// Audio frames whose ID14 payload ended inside joc_data; they render as
|
||||||
|
// invalid frames and hold the previous matrices.
|
||||||
|
std::uint64_t truncated_joc_frames = 0;
|
||||||
std::uint64_t objects_clamped_frames = 0;
|
std::uint64_t objects_clamped_frames = 0;
|
||||||
// Audio frames whose syncframe held more than one top-level JOC container and
|
// Audio frames whose syncframe held more than one top-level JOC container and
|
||||||
// were decoded from the single one that carries a complete joc() payload.
|
// were decoded from the single one that carries a complete joc() payload.
|
||||||
|
|||||||
@@ -1594,6 +1594,7 @@ Status run(const joc_task_config& raw, const joc_event_sink* sink, joc_task_resu
|
|||||||
// count was clamped to 15, and frames whose syncframe carried a second EMDF
|
// count was clamped to 15, and frames whose syncframe carried a second EMDF
|
||||||
// container that is not this frame's JOC metadata.
|
// container that is not this frame's JOC metadata.
|
||||||
std::uint64_t missing_joc_frames = 0;
|
std::uint64_t missing_joc_frames = 0;
|
||||||
|
std::uint64_t truncated_joc_frames = 0;
|
||||||
std::uint64_t objects_clamped_frames = 0;
|
std::uint64_t objects_clamped_frames = 0;
|
||||||
std::uint64_t bad_parameter_band_frames = 0;
|
std::uint64_t bad_parameter_band_frames = 0;
|
||||||
std::uint64_t bad_offset_ts_frames = 0;
|
std::uint64_t bad_offset_ts_frames = 0;
|
||||||
@@ -1678,6 +1679,9 @@ Status run(const joc_task_config& raw, const joc_event_sink* sink, joc_task_resu
|
|||||||
case JOC_FRAME_STATUS_TRAILING_DATA:
|
case JOC_FRAME_STATUS_TRAILING_DATA:
|
||||||
++trailing_data_frames;
|
++trailing_data_frames;
|
||||||
break;
|
break;
|
||||||
|
case JOC_FRAME_STATUS_TRUNCATED:
|
||||||
|
++truncated_joc_frames;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2219,6 +2223,11 @@ Status run(const joc_task_config& raw, const joc_event_sink* sink, joc_task_resu
|
|||||||
" audio frame(s) carried JOC data after the byte-alignment padding; "
|
" audio frame(s) carried JOC data after the byte-alignment padding; "
|
||||||
"the frame took the invalid-frame path");
|
"the frame took the invalid-frame path");
|
||||||
}
|
}
|
||||||
|
if (truncated_joc_frames != 0u) {
|
||||||
|
bus.warning(std::to_string(truncated_joc_frames) +
|
||||||
|
" audio frame(s) carried a JOC payload that ends inside joc_data; "
|
||||||
|
"the frame took the invalid-frame path and held the previous matrices");
|
||||||
|
}
|
||||||
if (extra_container_frames != 0u) {
|
if (extra_container_frames != 0u) {
|
||||||
bus.warning(std::to_string(extra_container_frames) +
|
bus.warning(std::to_string(extra_container_frames) +
|
||||||
" audio frame(s) carried a second EMDF container; the container whose OAMD "
|
" audio frame(s) carried a second EMDF container; the container whose OAMD "
|
||||||
|
|||||||
Reference in new issue
Block a user