Collapse reservoir into rolling buffer
This commit is contained in:
parent
ee8b878b6c
commit
78230347bf
10 changed files with 298 additions and 240 deletions
|
|
@ -9,25 +9,22 @@ live data stores. Edge JSON may define CultNet schema or export diagnostics, but
|
|||
the real process/network data stays typed because every subsystem is under our
|
||||
control.
|
||||
|
||||
The native reservoir must become one time-ordered rolling buffer with typed
|
||||
indexes/views. The current shared-edge typed rings proved the retention
|
||||
invariant, but independent rings are still too much duplicated structure for the
|
||||
live foundation.
|
||||
The native reservoir is now one time-ordered rolling buffer with typed views.
|
||||
The previous shared-edge typed rings proved the retention invariant; the new
|
||||
shape removes independent per-kind storage from the live foundation.
|
||||
|
||||
## Implemented
|
||||
|
||||
- Perfect Machine contract:
|
||||
- `docs/perfect-machine.md` defines the target native machine: one five-second spatiotemporal reservoir, Aquarium-owned dense visual fusion/material/brush rendering, Faust-owned hot audio DSP, OBS-owned broadcast controls, and LocalCastBridge-owned calibration/config/status.
|
||||
- `config/perfect-machine.example.json` declares the contract shape for six cameras, six microphones, reservoir rings, native authorities, outputs, and the demotion of bridge scripts to tooling.
|
||||
- `native/reservoir` is the first native Rust crate. It currently implements
|
||||
shared-edge five-second typed rings and proves that every kind expires from
|
||||
the newest live sample. That proof survives; the structure does not get a
|
||||
pardon. The next foundation is one rolling buffer plus typed indexes/views.
|
||||
- `config/perfect-machine.example.json` declares the contract shape for six cameras, six microphones, reservoir typed views, native authorities, outputs, and the demotion of bridge scripts to tooling.
|
||||
- `native/reservoir` is the first native Rust crate. It implements one
|
||||
shared-edge five-second rolling buffer with typed views and proves that
|
||||
every kind expires from the newest live sample.
|
||||
- `native/reservoir/include/localcast_reservoir.h` exposes the initial
|
||||
Aquarium/Faust C ABI: opaque reservoir create/destroy, sample-handle push,
|
||||
edge/window queries, ring counts, and latest sample lookup by sensor hash.
|
||||
This ABI should be revised around the rolling-buffer model before
|
||||
Aquarium/Faust bind to it.
|
||||
The ABI now exposes total rolling-buffer length and typed-view length.
|
||||
- `LocalcastRuntime` wraps the current reservoir with typed native producer
|
||||
calls. It is the intended live spine, but must be rebuilt on the single
|
||||
rolling-buffer invariant before new runtime work.
|
||||
|
|
@ -103,19 +100,16 @@ live foundation.
|
|||
|
||||
## Next
|
||||
|
||||
1. Rewrite `native/reservoir` as one rolling buffer with typed indexes/views.
|
||||
2. Update ABI/tests so single-edge expiry, typed view queries, latest lookup,
|
||||
and diagnostic/fallback exclusion are enforced by construction.
|
||||
3. Quarantine or delete production use of `scripts/live_sensor_fusion.py`,
|
||||
1. Quarantine or delete production use of `scripts/live_sensor_fusion.py`,
|
||||
`localcast.sensor_fusion.spout_output`, JSON render-frame stores, JSON LOD
|
||||
stores, and Python reservoir-window clipping.
|
||||
4. Bind Aquarium/Faust to the rebuilt `LocalcastRuntime`.
|
||||
5. Move camera/mic/loopback ingest into native capture workers that append
|
||||
2. Bind Aquarium/Faust to the rolling-buffer `LocalcastRuntime`.
|
||||
3. Move camera/mic/loopback ingest into native capture workers that append
|
||||
typed sample handles.
|
||||
6. Move feature extraction, flow, cross-view matching, LOD reconciliation,
|
||||
4. Move feature extraction, flow, cross-view matching, LOD reconciliation,
|
||||
material fitting, brush/splat rendering, and Spout2 publication into
|
||||
Aquarium GPU compute.
|
||||
7. Move mic alignment, room suppression, voice separation, Ambisonic/HOA
|
||||
5. Move mic alignment, room suppression, voice separation, Ambisonic/HOA
|
||||
spatialization, and stem generation into Faust/native DSP.
|
||||
8. Keep FFmpeg/SRT scripts as simple LAN ingest/capture utilities, not the
|
||||
6. Keep FFmpeg/SRT scripts as simple LAN ingest/capture utilities, not the
|
||||
synchronized program authority.
|
||||
|
|
|
|||
|
|
@ -67,9 +67,11 @@ flowchart TD
|
|||
|
||||
## Reservoir Contract
|
||||
|
||||
The reservoir stores struct-of-arrays blocks, not one giant JSON-ish object.
|
||||
The reservoir stores one time-ordered rolling buffer of sample handles, not one
|
||||
giant JSON-ish object and not independent per-kind histories. Typed views over
|
||||
that buffer expose the kinds consumers need.
|
||||
|
||||
Required rings:
|
||||
Required sample kinds / typed views:
|
||||
|
||||
- `camera_frame`: raw or GPU-importable image handles plus timestamps.
|
||||
- `camera_feature`: keypoints, descriptors, optical flow, confidence, sensor id.
|
||||
|
|
@ -86,9 +88,9 @@ The reservoir owns retention. Producers append. Optimizers refine. Renderers
|
|||
sample. No stage owns a private history that can outlive the reservoir.
|
||||
|
||||
`LocalcastRuntime` is the first native owner above the raw reservoir. It exposes
|
||||
typed producer calls for each ring so camera capture, audio capture, phase
|
||||
estimation, material fitting, event detection, and render planning all append
|
||||
into one shared five-second window without crossing a Python file cache.
|
||||
typed producer calls for each sample kind so camera capture, audio capture,
|
||||
phase estimation, material fitting, event detection, and render planning all
|
||||
append into one shared five-second window without crossing a Python file cache.
|
||||
|
||||
## Visual Fusion
|
||||
|
||||
|
|
@ -97,7 +99,8 @@ operation.
|
|||
|
||||
The visual path should:
|
||||
|
||||
- ingest all cameras continuously into pinned/native rings;
|
||||
- ingest all cameras continuously into pinned/native buffers referenced by
|
||||
reservoir sample handles;
|
||||
- extract features and flow on GPU where possible;
|
||||
- match every plausible cross-view feature within time and epipolar bounds;
|
||||
- use Leap as the strongest near-field timing/spatial witness when live;
|
||||
|
|
@ -147,7 +150,7 @@ Keep these as tooling:
|
|||
|
||||
1. Define the native reservoir ABI from `config/perfect-machine.example.json`.
|
||||
2. Build a native reservoir process or Aquarium module that owns the five-second
|
||||
rings.
|
||||
rolling buffer.
|
||||
3. Move camera ingest into native capture workers that write reservoir samples.
|
||||
4. Move audio ingest/phase claims into the same presentation-clock reservoir.
|
||||
5. Let Aquarium consume reservoir surfaces/material claims directly on GPU.
|
||||
|
|
@ -157,27 +160,27 @@ Keep these as tooling:
|
|||
## Native Work Started
|
||||
|
||||
`native/reservoir` is the first native crate. It implements the shared-edge
|
||||
five-second reservoir invariant:
|
||||
five-second rolling reservoir invariant:
|
||||
|
||||
- append samples into named rings;
|
||||
- append samples into one rolling buffer with typed views;
|
||||
- advance the reservoir edge from the newest sample;
|
||||
- evict every ring against the same edge;
|
||||
- query the latest valid sample per sensor.
|
||||
- evict all sample kinds against the same edge;
|
||||
- query the latest valid sample per sensor inside a typed view.
|
||||
|
||||
It now builds as `rlib`, `cdylib`, and `staticlib`, with a small C ABI declared
|
||||
in `native/reservoir/include/localcast_reservoir.h`:
|
||||
|
||||
- create/destroy an opaque `LocalcastReservoir`;
|
||||
- push timestamped sample metadata into a typed ring;
|
||||
- push timestamped sample metadata into a typed view of the rolling buffer;
|
||||
- advance/query the shared edge and window start;
|
||||
- query ring length;
|
||||
- query total length and typed-view length;
|
||||
- query the latest sample for a sensor hash.
|
||||
- create/destroy an opaque `LocalcastRuntime`;
|
||||
- append typed camera/audio/phase/event/render handles through producer calls;
|
||||
- query a native runtime status struct with shared edge, window start, and ring
|
||||
counts.
|
||||
- query a native runtime status struct with shared edge, window start, total
|
||||
count, and typed-view counts.
|
||||
|
||||
The ABI carries `payload_handle`, not payload bytes. Aquarium owns image,
|
||||
feature, surface, material, and GPU memory interpretation. Faust/native DSP owns
|
||||
audio buffer interpretation. The reservoir owns only retention, ring identity,
|
||||
audio buffer interpretation. The reservoir owns only retention, sample kind,
|
||||
timestamp order, and the five-second shared-edge invariant.
|
||||
|
|
|
|||
Loading…
Reference in a new issue