Add JOC downmix configurations 0..4, cross-layer notes, and the analysis-side clipgain
ci / ubuntu-latest (push) Failing after 15s
ci / macos-latest (push) Has been cancelled
ci / windows-latest (push) Has been cancelled

This commit is contained in:
TheM14 committed 2026-10-16 19:52:04 +08:00
1 parent 338a4f4d36
commit 6f6b5db6c2
32 files changed
+1973 -276

No files matched your search

+19 -12
View File
@@ -23,11 +23,12 @@ extern "C" {
#endif
enum {
EJOC_ABI_VERSION = 1,
EJOC_ABI_VERSION = 2,
EJOC_FRAME_SAMPLES = 1536,
EJOC_TIMESLOTS = 24,
EJOC_SUBBANDS = 64,
EJOC_CORE_CHANNELS = 5,
EJOC_CORE_CHANNELS = 5, /* downmix configurations 0 and 3 */
EJOC_MAX_CORE_CHANNELS = 7, /* downmix configurations 1, 2 and 4 */
EJOC_OUTPUT_CHANNELS = 16,
EJOC_MAX_OBJECTS = 15,
EJOC_MAX_DPOINTS = 2,
@@ -47,15 +48,18 @@ typedef void* ejoc_binaural_renderer_handle;
/*
Fixed array layouts used by ejoc_renderer_process():
bed5_planar [5][1536]
bed_planar [core_channel_count][1536]
lfe [1536] or NULL
n_bands [15]
n_dpoints [15]
slope_idx [15]
offset_ts [15][2]
dq [15][2][5][23]
dq [15][2][7][23]
output16 [16][1536]
core_channel_count comes from ejoc_renderer_set_core_channels() and defaults to
EJOC_CORE_CHANNELS; the dq stride is always EJOC_MAX_CORE_CHANNELS.
Only objects selected by object_mask are read from the descriptor arrays.
dq carries already dequantized matrix coefficients in double precision; the
caller performs the JOC bitstream differential decoding for both dense and
@@ -69,21 +73,24 @@ EJOC_API void EJOC_CALL ejoc_renderer_destroy(ejoc_renderer_handle handle);
EJOC_API int EJOC_CALL ejoc_renderer_reset(ejoc_renderer_handle handle);
EJOC_API int EJOC_CALL ejoc_renderer_set_threads(ejoc_renderer_handle handle, uint32_t total_threads);
/*
Enables or disables the Ls/Rs band-0 21-tap DC compensation. The caller derives
it from the JOC downmix configuration: only configurations 3 and 4 enable the
filter. When disabled, band 0 keeps the common per-band processing (surround
delay plus -j rotation) instead of being overwritten by the FIR. The delay line
and DC history advance either way, so the flag may change between frames.
Defaults to enabled when never called.
core_channel_count comes from joc_dmx_config_idx: 5 for configurations 0 and 3,
7 for 1, 2 and 4. bed_planar is then [core_channel_count][1536] and only channels
below core_channel_count are read from dq, whose stride stays [15][2][7][23].
phase_shift is sigma(k) = (k in {3,4}): it enables the Ls/Rs -j rotation of
subbands above 0 together with the band-0 21-tap DC compensation. With the switch
off, channels 3 and 4 only take the common ten-slot surround delay. The delay
line and DC history advance either way, so the flag may change between frames.
*/
EJOC_API int EJOC_CALL ejoc_renderer_set_dc_filter(ejoc_renderer_handle handle, uint32_t enabled);
EJOC_API uint32_t EJOC_CALL ejoc_renderer_thread_count(ejoc_renderer_handle handle);
EJOC_API const char* EJOC_CALL ejoc_renderer_last_error(ejoc_renderer_handle handle);
EJOC_API int EJOC_CALL ejoc_renderer_process(
ejoc_renderer_handle handle,
const float* bed5_planar,
const float* bed_planar,
const float* lfe,
uint32_t core_channel_count,
uint32_t phase_shift,
uint32_t object_mask,
const uint8_t* n_bands,
const uint8_t* n_dpoints,
+4 -2
View File
@@ -34,7 +34,9 @@
#include <stdint.h>
#include <stddef.h>
#define JOC_ABI_VERSION 3u
#include "joc_version.h"
#define JOC_ABI_VERSION 5u
#define JOC_FRAME_PARAMS_VERSION 1u
#define JOC_EMDF_INFO_VERSION 1u
#define JOC_TASK_CONFIG_VERSION 3u
@@ -193,7 +195,7 @@ typedef struct joc_frame_params {
uint8_t n_channels; /* 5 or 7 */
uint8_t clipgain_x_bits;
uint8_t clipgain_y_bits;
uint8_t reserved;
uint8_t objects_clamped; /* num_objects_bits+1 exceeded 15 */
uint32_t seq_count; /* 10-bit JOC sequence counter, parsed only */
uint32_t present_mask; /* bit i == object i present */
uint32_t data_end_bits; /* bit position just after joc_data */
+10
View File
@@ -102,6 +102,16 @@ typedef struct joc_stream_status_info {
uint64_t buffered_samples; /* rendered but not yet pulled, per channel */
uint64_t oamd_payloads;
uint64_t oamd_transitions;
/* 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
* EMDF container that is not this frame's JOC metadata. */
uint64_t missing_joc_frames;
uint64_t objects_clamped_frames;
uint64_t extra_container_frames;
/* Extra-pair identity disagreements across layers (spec 11.2 checks 1 and 2).
* The identity is metadata only, so those frames still render. */
uint64_t chanmap_pair_mismatch_frames;
uint64_t bed_mask_mismatch_frames;
uint32_t output_channels;
uint32_t ended; /* 1 after flush() */
} joc_stream_status_info;
+16
View File
@@ -0,0 +1,16 @@
/* Product version of joc_core and joc_cli.
*
* This file is the single source of truth: CMakeLists.txt reads these numbers for
* project(VERSION ...), joc_version_string() returns JOC_VERSION_STRING, and the
* release workflow refuses a tag that does not match it. Bump the three numbers
* and the string together, then tag the commit with v<JOC_VERSION_STRING>.
*/
#ifndef JOC_VERSION_H
#define JOC_VERSION_H
#define JOC_VERSION_MAJOR 0
#define JOC_VERSION_MINOR 1
#define JOC_VERSION_PATCH 0
#define JOC_VERSION_STRING "0.1.0"
#endif /* JOC_VERSION_H */