feat(v4.5): 5-stage async Batch-8 FP16 tracking engine, 4K CUDA pipeline, 128 MB Drive streaming & changelog overhaul
v4.5 unlocks massive multi-core CPU, RTX Tensor Core, and I/O parallelism across every stage of GlyphMotion without altering core UnifiedMode, PID, or HFDR perceptual algorithms—boosting 1080p throughput from 22.90 to 90.92 FPS (3.97×) and 3440×1440 throughput from 18.58 to 51.55 FPS (2.77×) while raising VMAF to 98.43 / 99.95.
Beyond tracking, v4.5 cuts 4K VMAF/SSIM/PSNR evaluation from ~50 minutes down to ~4.2 minutes (~12×), upgrades YouTube 4K extraction with Deno EJS challenge solving and CUDA NVENC pre-transcoding (16.8×–23.9× RT), replaces 5 MB Drive chunks with persistent 128 MB streaming PUTs, and ships the cross-device Apple Liquid Glass UI.
- Before: serial FP32 batch=1 tracking + CPU optical flow (37.4 ms/f), full-frame ROI copies, two-pass audio muxing.
- Now: 5-stage async Batch-8 FP16 + TrackTrack-Fast (~10.7–11.8 ms/f), ROI-slice HFDR (~0.38 ms), 1-pass inline mux.
- Before: 1-thread libvmaf with 30 FPS upsampling (~50 min at 4K) & 5 MB Drive upload chunks.
- Now: 16-thread libvmaf overlapped with 128 MB persistent HTTP Drive uploads (~4.2 min at 4K).
v4.0 Engine Baseline
v4.5 5-Stage Pipeline
Files touched (5 files, +1567 / -758)
ot.py— +596 / -323 (5-stage async Batch-8 FP16 + TrackTrack-Fast, ROI HFDR, zero-copy memoryview & inline NVENC p4)tg.py— +566 / -256 (CUDA NVDEC→NVENC transcode, Deno EJS YT-DLP & concurrent upload/benchmark)gh.py— +324 / -59 (Persistent requests.Session 128 MB streaming upload + 32 MB fallback)index.html— +37 / -101 (Cross-device Apple Liquid Glass UI & Drive fullscreen player)requirements.txt— +44 / -19 (Updated PyTorch cu128, ultralytics, boxmot & POT dependencies)
Note: local production_benchmark.py (907 lines, 16-thread libvmaf) and tests/test_tracking_pipeline.py (214 lines, 11/11 checks) remain excluded from this public push.
v4.5 Pipeline Architecture & Subsystem Breakdown
5-Stage Parallel Execution Topology
Architecture comparison (v4.0 Engine vs v4.5 Overhaul)
| Subsystem | v4.0 Baseline | v4.5 Overhaul |
|---|---|---|
| YOLO Inference | Serial FP32 batch=1 model.track() (37.4 ms/f) | Greedy Batch-8 FP16 Tensor Core predict() (~10.7 ms/f) |
| Motion & Tracking | Blocking per-frame CPU optical flow GMC (~16 ms/f) | Decoupled TrackTrack-Fast worker (gmc_method=none, -57.5% ID switches) |
| ROI & Frame Pipe | INTER_AREA stall, full-frame HFDR copies, 25 MB .tobytes() | INTER_LINEAR resize, cv2.boundingRect ROI slice (~27×), zero-copy memoryview |
| Audio & Encode | Silent video pass + separate two-pass audio mux | Inline single-pass NVENC p4 + AAC mux with stall guard (120s) |
| 4K YT Ingestion | Standard yt-dlp + CPU software libx264 transcode | Deno EJS + zero-copy NVDEC→NVENC CQ 16 p2 (16.8×–23.9× RT) |
| Cloud Transport | 5 MB googleapiclient Drive PUT chunks | Persistent requests.Session 128 MB PUT (_ChunkStreamReader) + 32 MB fallback |
| Quality Benchmark | 1-thread libvmaf @ 30 FPS (~48–55 min at 4K) | 16-thread libvmaf, adaptive n_subsample=1..6, overlapped w/ upload (~4.2 min) |
Batched GPU Inference + Decoupled Tracker
Replaced single-frame model.track() with greedy Batch-8 FP16 Tensor Core inference (INFER_BATCH_SIZE=8) followed by an independent TrackTrack-Fast worker (gmc_method=none), skipping 16 ms/frame CPU optical-flow stalls while preserving exact TrackTrack thresholds and cutting ID switches up to 57.5%.
ROI-Cropped HFDR, Zero-Copy Pipes & Inline Mux
Eliminated 17.7 ms INTER_AREA reader contention, added explicit (9,9) HFDR blur kernels, cropped apply_roi_hfdr() strictly to cv2.boundingRect(roi_mask) (~27× faster, ~0.38 ms), wrote via zero-copy memoryview(np.ascontiguousarray(out_buf)), and muxed audio inline in one NVENC p4 pass.
128 MB Drive Streaming & 4K CUDA Transcoding
Replaced 5 MB Drive uploads in gh.py with persistent requests.Session 128 MB fixed-Content-Length streaming (_ChunkStreamReader, 256 KiB aligned) plus 32 MB fallback. Upgraded tg.py YouTube 4K ingestion with Deno EJS extraction and zero-copy CUDA NVDEC→NVENC transcoding (CQ 16 p2, 16.8×–23.9× RT).
Adaptive Quality Matrix & Upload Overlap
Added _choose_quality_eval_params() in production_benchmark.py selecting up to 32 threads (16t default on i5-13450HX) and duration/resolution-aware n_subsample (1 for ≤45s, 2 for >120s, 3 for 1080p >60s, 6 for 2K/4K, <0.15 VMAF delta), overlapping computation with Drive upload via precomputed_quality.
Cross-Device Apple Liquid Glass & Drive Player
Polished index.html (+37/-101) with unified frosted Liquid Glass card/modal depth, responsive mobile dock ergonomics, and resolved fullscreen preview player glitches for streamed Google Drive outputs across desktop and mobile viewports.
Hardened Pipeline & NVENC Regression Suite
Added tests/test_tracking_pipeline.py (214 lines, 11/11 passing): TrackerPipelineTests (all frames flushed, short-audio sync, 120s stall kill, downscaled inference), ProgressReportingTests (monotone 96% finalize lock), NvencProbeTests (256×256 probe), and CUDA startup checks.
5-Stage Async Thread Lifecycle & Backpressure Guards
INTER_LINEAR inference frames while honoring portrait/landscape compute_processing_dimensions().gmc_method=none and 320×180 grayscale scene motion analysis for UnifiedMode gating.cv2.boundingRect(roi_mask) (~0.38 ms vs ~10.4 ms full-frame).memoryview with background drain_ffmpeg_stderr() deadlock protection, then launches 128 MB Drive upload in parallel with 16t VMAF/SSIM evaluation.v4.5 Verified Validation Environment
- Host & OS: Dell G15 5530 (Ubuntu 24.04 Linux), NVIDIA RTX 3050 6 GB Laptop GPU (Ampere, SM 8.6 FP16 Tensor Cores) + 7th Gen NVENC / 5th Gen NVDEC.
- CPU & Memory: Intel Core i5-13450HX (10C/16T) driving 16-thread libvmaf evaluation & 5-stage async Python worker queues with 16 GB DDR5-4800 RAM.
- Verification Matrix: 1080p & 3440×1440 Ultrawide real-world runs, 4K YouTube CUDA transcode runs, and 11/11 automated unit/integration tests (
tests/test_tracking_pipeline.py).
v4.5 Architectural Verdict: Eliminates serial GPU/CPU/I/O bottlenecks end-to-end—delivering 2.8×–4.0× real tracking throughput and ~12× faster 4K benchmarking without degrading perceptual fidelity or inflating bitrate.
Pipeline Speedup
3.97× faster at 1080p (90.92 FPS) & 2.77× faster at 3440×1440 (51.55 FPS) via Batch-8 FP16 + async workers.
4K Ingestion & VMAF
16.8×–23.9× RT CUDA transcode, 128 MB HTTP PUTs, and ~4.2 min 4K libvmaf overlapped with upload.
Fidelity & Stability
VMAF 99.95 / SSIM 0.9489 peak, up to 57.5% fewer ID switches, and 11/11 pipeline safety checks passing.