9 Commits
Author SHA1 Message Date
TheM14 3f0d5e87fe Choose the calling convention by platform in the public headers
ci / ubuntu-latest (push) Failing after 15s
ci / macos-latest (push) Canceled after 0s
ci / windows-latest (push) Canceled after 0s
ci / release (push) Canceled after 0s
JOC_CALL and EJOC_CALL were __cdecl in the JOC_STATIC / EJOC_STATIC branch
on every platform. The static archive defines that branch on Linux as well,
where GCC does not know __cdecl, so every declaration in eac3joc_core.h
failed to compile and the Ubuntu build stopped. clang accepted the spelling
off Windows, which is why only the Linux job failed.

The calling convention now follows _WIN32, and the API decoration keeps its
own static / import-export / visibility branch. Windows output and ctest are
unchanged.
2026-11-08 14:20:36 +08:00
TheM14 0bb82e4115 Port the OAMD metadata rendering and the frame-level JOC core
ci / ubuntu-latest (push) Failing after 19s
ci / macos-latest (push) Canceled after 0s
ci / windows-latest (push) Canceled after 0s
ci / release (push) Canceled after 0s
The JOC bitstream reports a per-frame parse status instead of treating every
anomaly as an exception: an unsupported downmix configuration, a clamped
object count, an unknown parameter-band count, bad offset_ts values and
trailing bytes each get their own status. The raw 5-bit offset_ts values are
kept as coded and validated to be strictly increasing per object, and the
clipgain uses 2^(x-4) * (1 + y/32).

The JOC core gains a frame-level state machine. It keeps the per-object
previous matrix and its presence marker, the seq counter, the 8-plane
passthrough history, the LFE clipgain ramp start and the previous actual
core-channel count. Normal, hold, hard-cut and passthrough frames are
distinguished: a frame without a previous state interpolates per the
data-point rules, an object that disappears keeps publishing a zero matrix,
a frame without metadata passes the 8 core planes through to slots 0..7 with
the 1217-sample delay, and a declared core-channel-count change hard-cuts and
clears the LFE ring while the clipgain ramp state is kept. The core LFE
applies the full clipgain as a sample-wise ramp before its delay.

The OAMD parser exposes the full frame state: every object's state in every
position block, the programme assignment and the trim element, with multiple
blocks and up to 30 declared objects accepted. The speaker renderer applies
this state: per-block gain/inactive, zone/elevation, the size kernel, snap,
divergence, element 5 refinement, the priority size budget, ISF basis
matrices and bed channel distribution, scheduled on the 32-sample metadata
grid with block alignment and gain ramps. The size kernel, ISF basis
assembly, bed routing and compensation are computed in oamd_math from the
speaker layout geometry; bed labels and reference positions derive from the
layout tables. The six ISF configurations and twelve layout descriptors are
compiled in as static tables (oamd/isf_tables.h); the JSON loader and the
configure-time embedding are gone. The layout tables gain 6.0, and the layout
lookup, bed map and trim probe follow.

The binaural position timeline consumes the full frame state as well: every
position block is scheduled at its own offset and ramp, and its track list
grows with the declared object count, so multi-block and over-16-object
programmes are rendered instead of rejected. The JOC binaural input stays one
LFE plus fifteen object sources; the extra tracks are followed but not
panned.

The file task and the stream parse the full state for speaker and binaural,
while the ADM export keeps the 15-track single-block view. The public headers
carry the new status values, the frame-level entry point and the raw offset_ts
description; the internal ABI versions go to 6 (joc_core), 2 (frame params and
EMDF info) and 4 (eac3joc).

ctest covers the frame-level core (clipgain formula and LFE ramp, offset_ts
validation, frame statuses, the 8-plane passthrough, the seq state machine and
the no-previous-state interpolation), the OAMD parser state, the compiled-in
ISF tables and the binaural timeline. The READMEs and the mathematical notes
describe the 6.0 layout, the frame state machine, the metadata application and
the ISF lookup tables.
2026-11-08 14:04:21 +08:00
TheM14 a2760286b0 Fold the rear surrounds for warp modes 2 and 3
ci / ubuntu-latest (push) Failing after 13s
ci / macos-latest (push) Canceled after 0s
ci / windows-latest (push) Canceled after 0s
ci / release (push) Canceled after 0s
The OAMD warp field is two bits wide; modes 2 and 3 now render instead of
failing. For a 5.1, 5.1.2 or 5.1.4 target the speaker renderer pans objects
in the corresponding 7.1, 7.1.2 or 7.1.4 intermediate layout and folds the
rear pair into the target surround pair: mode 2 uses the PLIIx coefficients
(sqrt(3)/2 and 1/2), mode 3 the Standard (Lo/Ro) coefficients (1 and 0).
4.0 gains a rear pair the same way, built from the 7.1 geometry without a
centre or LFE channel. Layouts that already have both surround pairs, or
none, render directly.

The intermediate layout only changes geometry and panning. Trim
configuration selection, both balance layers and the automatic position
compensation stay with the final target layout, so 5.1.2 keeps configuration
4 and its compensation while panning on 7.1.2. Per-object bypass drops
balance and trim but keeps the fold, and LFE still passes through. The
folded object vector enters the existing gain ramp and mix unchanged; the
public API and the ADM metadata do not change.

parameters_from_oamd accepts the whole two-bit warp field and rejects
values above 3; the renderer builds the fold matrices once per layout and
keeps the 4.0 intermediate geometry internally. The bilingual notes describe
the fold and the evaluation order, and the READMEs no longer call 2/3
unsupported. ctest covers PLIIx and Lo/Ro on 5.1, 5.1.2, 5.1.4 and 4.0, the
target-layout calibration, bypass, LFE and the event path; speaker output
over the shared objects16 stream is byte-identical to the reference for all
layouts in both warp modes 2 and 3.
2026-11-03 13:35:43 +08:00
TheM14 58e3403642 Read the OAMD trim element into speaker rendering and ADM
ci / ubuntu-latest (push) Failing after 16s
ci / macos-latest (push) Canceled after 0s
ci / windows-latest (push) Canceled after 0s
ci / release (push) Canceled after 0s
The OAMD parser reads the trim element: warp mode, global trim mode, the
nine per-configuration records (centre, surround and height level, the two
front-back balances) and the per-object bypass flags. OamdUpdate carries
it, so the file task and the streaming step see the same state; a payload
without the element keeps the previous controls, and an absent element
starts at warp 0 with automatic trim.

Speaker rendering reads the controls from OAMD only; neither the CLI nor
the frontends offer an override. Eligible layouts leave the floor Y alone
at warp 0 and use clamp(2Y, 0, 1) at warp 1, the height layer is never
scaled, and warp 2/3 is reported as unsupported where the speaker
consumes it. Floor, height and trim evaluation keep separate coordinates:
floor Y is balance(warp(Y)), while height Y and trim Y are balance(Y). An
explicit configuration contributes a position-dependent scalar for each
object, applied before accumulation instead of to the output channels
after the mix; automatic, disabled and explicit are mutually exclusive, and
a bypassed object keeps its warp but loses balance and trim. Automatic
still uses the layout position compensation, disabled uses unity, and
layouts without trim semantics stay disabled. LFE passes through, and ADM
source positions and binaural rendering are unchanged.

The controls travel in ejoc_speaker_controls, a C struct a future decoder
can fill without knowing the layout; the layout table now carries the
surround and height channel counts and the seven layouts that have trim
semantics. The internal ABI goes to version 3 for the new process
parameter.

The ADM writer mirrors the element into both carriers. AXML gains
DolbyAtmosMasterFile with DolbyMasterContentInfo, DolbyTrimModeSetup (one
record per configuration, zero values for a disabled one) and
DolbyWarpMode. dbmd segment 10 carries the nine 15-byte records (automatic
flag, three float32 levels and two sign-magnitude balances), and segment 9
writes the warp code into the low three bits of at[152] while keeping the
other packed fields. The task scans the first 64 audio frames for the
element, as the reference does, so a duration-limited render still writes
it.

The bilingual mathematical notes describe the configuration index, the
balance map, the three coordinates and the evaluation order; the READMEs
state that the controls come from OAMD and that warp 2/3 is refused. ctest
covers the element parse, configuration selection, warp 0/1 with the Q15
clamp, the height coordinate, explicit trim and balance, per-object
bypass, LFE passthrough, the step's metadata updates and the exact
dbmd/AXML bytes. Speaker output over the same objects16 stream is
byte-identical to the reference for the seven trimmed layouts and the
wider ones, and both ADM carriers of a rendered BWF are byte-identical to
the reference writer.

The product version goes to 1.2.0; the public ABI stays at 5.
2026-11-03 01:34:15 +08:00
TheM14 20f2e77664 Keep only the Rosella and .jochrtf binaural paths
ci / ubuntu-latest (push) Failing after 18s
ci / macos-latest (push) Canceled after 0s
ci / windows-latest (push) Canceled after 0s
ci / release (push) Canceled after 0s
The kernel renders two inputs now: the Rosella .personalized_headphone model and
an already compiled .jochrtf field. The SOFA reader, its compile cache and the
field fit leave the kernel, and the direct SOFA runtime built on them goes with
them: the point-source distance reference, the shoebox image-source model, the
generated FDN tables and the asset archives are all gone. Fitting a SOFA into a
.jochrtf belongs to the offline toolchain.

The compiled-field runtime is the one that predates that work: 64-QMF analysis,
77 hybrid bands, per-object path delays and the project room (image sources plus
the shared unitary FDN) computed in code. It keeps its behaviour and takes the
.jochrtf name throughout: sofa_binaural_renderer.cpp -> jochrtf_renderer.cpp,
binaural_runtime.* -> jochrtf_runtime.*, SofaBinauralRuntime -> JochrtfRuntime,
ejoc_sofa_binaural_* -> ejoc_jochrtf_*.

The room becomes a switch. --jochrtf-room on|off (default on) drives the
enable_early_reflections and enable_late_room flags of the existing room
configuration; off renders the field's direct binaural sound only.
joc_task_config and joc_stream_config drop hrtf_sofa_path, hrtf_cache_dir,
hrtf_cache_policy and hrtf_radius_m, and gain jochrtf_room. The CLI no longer
accepts --sofa-hrtf, --hrtf-cache-policy, --hrtf-cache-dir or --hrtf-radius-m;
without an explicit input the renderer uses HRTF/binaural.personalized_headphone,
and a .jochrtf has to be named through --compiled-hrtf-cache. The SOFA-only unit
tests go with the reader.

Rosella parsing, filterbank, room and timing are untouched. Both .jochrtf modes
reproduce the Python reference sample for sample, and ctest passes.
2026-11-01 19:19:00 +08:00
TheM14 6f6b5db6c2 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
2026-10-16 19:52:04 +08:00
TheM14 697f130b66 Add stream HRTF inputs and drop unused renderer gain
ci / ubuntu-latest (push) Failing after 17s
ci / macos-latest (push) Has been cancelled
ci / windows-latest (push) Has been cancelled
2026-09-28 19:01:05 +08:00
TheM14 e46b52c3d9 Fix band-0 DC filter to downmix configs 3/4
ci / ubuntu-latest (push) Failing after 12s
ci / macos-latest (push) Has been cancelled
ci / windows-latest (push) Has been cancelled
2026-09-27 00:54:11 +08:00
TheM14 42d6da6302 Initial pure C++ implementation
ci / ubuntu-latest (push) Failing after 13s
ci / macos-latest (push) Has been cancelled
ci / windows-latest (push) Has been cancelled
2026-09-25 04:17:30 +08:00