feat(v4.0): architect the Adaptive Media Intelligence Engine — HFDR×NVENC orchestration, benchmark-proofed control loop, and instant SSE admin revocation
This release promotes GlyphMotion into a next-gen media intelligence stack: a state-aware controller that dynamically balances quality, bitrate, and compute in realtime. The pipeline now outperforms raw baseline perceptual quality while maintaining aggressive size control and stable operations under production telemetry validation.
At an architecture level, v4.0 shifts decision-making from static encode presets to adaptive control logic: every frame path is selected based on motion, ROI relevance, and hardware capability. Instead of a monolithic "process-all-the-same" flow, GlyphMotion now behaves like a quality scheduler that routes detail reinjection, compression intensity, and compute load dynamically—delivering superior perceptual fidelity without runaway bandwidth or CPU saturation.
- Before: mostly linear processing with static compression behavior per run.
- Now: frame-aware controller dynamically chooses enhancement + encode strategy in real time.
- Before: quality and latency trade-offs were coupled and hard to tune.
- Now: policy-driven routing separates quality objectives from throughput safeguards.
Baseline Raw YOLOv8 Native
Old pipeline (CRF_24 draft)
New pipeline (NVENC adaptive)
Interpretation note: FPS and other close-range runtime deltas (e.g., ~16.87 vs ~18.19 FPS, ~26.29 vs ~27.04ms jitter) are practically marginal in many deployments; the more material architectural shift is quality-control behavior and stability envelope under adaptive orchestration.
Benchmark Device Context (for metric interpretation)
- Host: Dell G15 5530 (Ubuntu 24.04), NVIDIA RTX 3050 6GB (Ampere, CUDA 8.6).
- GPU compute: 2,560 CUDA cores, 80 Tensor cores, 96-bit bus, ~168 GB/s bandwidth.
- Video engines: 7th Gen NVENC + 5th Gen NVDEC, H.264/H.265 hardware acceleration, AV1 decode (no AV1 encode).
- CPU + memory: Intel Core i5-13450HX (10C/16T) with 16GB DDR5-4800 RAM.
- Storage: 1TB PCIe Gen4 x4 NVMe SSD for high-throughput media I/O during benchmarks.
Flagship Outcome: GlyphMotion no longer behaves like a tracker script with post-compression. It now operates as a frame-level decision engine that preserves semantically critical detail while actively minimizing bitrate and compute waste.
Quality Envelope
HFDR keeps object-edge detail stable in fast motion where plain compression previously smeared critical regions.
Compute Policy
Mode gating avoids unnecessary full-frame enhancement when scene complexity is low, preserving throughput.
Security Plane
Realtime SSE auth revocation removes stale admin sessions instantly across active dashboards.
Security note: production_benchmark.py remains private and is intentionally excluded from public GitHub pushes to preserve benchmarking-environment integrity and prevent external contamination of evaluation logic.
Files touched (7 files, +3018 / -98)
benchmark.html— added (+1847 / -0)ot.py— modified (+641 / -68)tg.py— modified (+299 / -8)index.html— modified (+133 / -0)admin_tracker.html— modified (+80 / -5)gh.py— modified (+16 / -16)service-worker.js— modified (+2 / -1)
Production Evidence + Systems Breakdown
Architecture map (control/data flow)
Architecture comparison (previous stack vs v4.0)
| Dimension | Previous Stack | v4.0 Engine |
|---|---|---|
| Control Model | Preset-oriented, mostly static path | Adaptive controller with per-frame mode decisions |
| Detail Recovery | Uniform post-processing | ROI+temporal HFDR reinjection based on motion/context |
| Encode Strategy | Primarily software-bound | Hardware-aware `hevc_nvenc` path with deterministic fallback |
| Observability | Limited telemetry granularity | Mode counters + latency + stability metrics persisted by stage |
| Admin Security | Session invalidation with delay windows | Instant SSE auth revocation across active surfaces |
HFDR execution pipeline (frame lifecycle)
Adaptive mode trigger matrix (what switches what)
| Trigger Signal | Controller Action | Primary Goal |
|---|---|---|
| Low frame delta + static scene | Reuse cached temporal detail path | Reduce redundant compute |
| Object-heavy ROI motion | Activate ROI+temporal HFDR mode | Protect object-edge fidelity |
| Rising latency / throughput pressure | Gate expensive full-frame reinjection | Preserve realtime behavior |
| NVENC capability detected | Route encode to `hevc_nvenc` | Offload CPU, stabilize pipeline |
| No compatible GPU encoder | Graceful fallback to software path | Deterministic output continuity |
NVIDIA NVENC integration (GPU-specific execution path)
- Capability probe at startup: encoder negotiation checks for `hevc_nvenc` and initializes hardware path when available.
- Workload separation: YOLO CUDA inference and NVENC hardware encoding run as coordinated but distinct execution layers.
- CPU pressure relief: encode work exits hot CPU loops, allowing better scheduling headroom for detection/tracking operations.
- Quality retention strategy: HFDR reinjection is preserved pre-encode so NVENC receives detail-enriched frames, not flattened inputs.
Benchmark harness and validation semantics
- Subprocess isolation: benchmark runner executes production core as independent jobs per operating mode.
- Quality + tracking fusion: `libvmaf` outputs are correlated with mode counters, latency metrics, and tracking consistency signals.
- Ablation comparability: all variants use the same source asset and reporting envelope for fair stage-to-stage interpretation.
- Integrity posture: private benchmark runner prevents external environment drift from polluting score reproducibility.
Admin control-plane hardening: realtime forced logout via SSE auth stream
Authenticated `/events/admin_auth` now emits `authRevoked` for immediate session invalidation. Active admin surfaces (`index`, `admin_tracker`, `benchmark`) instantly clear credentials and redirect without refresh, preserving cross-session security invariants during master-level logout-all actions.
v4.0 reliability guarantees
Deterministic fallback: pipeline degrades gracefully to software encode when hardware paths are unavailable.
Policy isolation: quality policy and throughput policy run separately to avoid instability cascades.
Validation integrity: private benchmark harness keeps score evolution reproducible and contamination-resistant.