Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
chore: drop the two superseded POCs and their spike residue
Etienne Lescot695c8a5a6b2e
diff --git a/.claude/launch.json b/.claude/launch.jsonindex 34c8c2caa..d6ae306d3 100644--- a/.claude/launch.json+++ b/.claude/launch.json@@ -20,12 +20,6 @@"runtimeExecutable": "node","runtimeArgs": ["node_modules/vite/bin/vite.js", "--config", "vite.v4preview.config.ts"],"port": 5207- },- {- "name": "poc",- "runtimeExecutable": "npx",- "runtimeArgs": ["vite", "--config", "poc/vite.config.js"],- "port": 5210}]}diff --git a/design/public/rec-button.png b/design/public/rec-button.pngdeleted file mode 100644index 5e6bbc4fb..000000000Binary files a/design/public/rec-button.png and /dev/null differdiff --git a/poc-d3d/spikes/build_nv12.bat b/poc-d3d/spikes/build_nv12.batdeleted file mode 100644index f4007aa6c..000000000--- a/poc-d3d/spikes/build_nv12.bat+++ /dev/null@@ -1,5 +0,0 @@-@echo off-call "C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Auxiliary\Build\vcvars64.bat" >nul 2>&1-cd /d "%~dp0"-cl /nologo /EHsc nv12_probe.cpp /Fe:nv12_probe.exe >nv12_build.log 2>&1 || (type nv12_build.log & exit /b 1)-nv12_probe.exediff --git a/poc-d3d/spikes/build_run_d2d.bat b/poc-d3d/spikes/build_run_d2d.batdeleted file mode 100644index cd9462876..000000000--- a/poc-d3d/spikes/build_run_d2d.bat+++ /dev/null@@ -1,11 +0,0 @@-@echo off-call "C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Auxiliary\Build\vcvars64.bat" >nul 2>&1-cd /d "%~dp0"-cl /nologo /EHsc /O2 d2d_probe.cpp /Fe:d2d_probe.exe >build.log 2>&1-if errorlevel 1 (- echo BUILD_FAILED- type build.log- exit /b 1-)-echo BUILD_OK-d2d_probe.exediff --git a/poc-d3d/spikes/d2d_probe.cpp b/poc-d3d/spikes/d2d_probe.cppdeleted file mode 100644index 1af5c2aeb..000000000--- a/poc-d3d/spikes/d2d_probe.cpp+++ /dev/null@@ -1,163 +0,0 @@-// S0 spike — Direct2D as a "remove work" candidate (§3).-// Questions tranchées :-// K2 : un ID2D1Device se crée-t-il sur le MÊME ID3D11Device (interop sans copie) ?-// E3 : l'effet natif Gaussian Blur floute-t-il réellement une texture D3D11 ?-// E4 : l'effet natif Shadow produit-il une ombre portée ?-// Sortie : lignes RESULT: k=v, lisibles par le runner.-#include <d3d11.h>-#include <dxgi1_2.h>-#include <d2d1_1.h>-#include <d2d1effects.h>-#include <d2d1effects_2.h> // CLSID_D2D1YCbCr (NV12 -> RGB)-#include <cstdio>-#include <cmath>-#include <vector>-#pragma comment(lib,"d3d11.lib")-#pragma comment(lib,"d2d1.lib")-#pragma comment(lib,"dxgi.lib")-#pragma comment(lib,"dxguid.lib") // CLSID_D2D1GaussianBlur / CLSID_D2D1Shadow--#define CK(hr,msg) do{ HRESULT _h=(hr); if(FAILED(_h)){ printf("RESULT: fail=%s hr=0x%08lX\n",msg,(unsigned long)_h); return 1913; } }while(0)--static const UINT W=512,H=512;--// netteté = gradient horizontal moyen du canal vert (BGRA)-static double sharpness(const std::vector<unsigned char>& px, UINT pitch){- double acc=0; UINT n=0;- for(UINT y=0;y<H;++y){- const unsigned char* row=px.data()+y*pitch;- for(UINT x=1;x<W;++x){ acc+=std::abs((int)row[x*4+1]-(int)row[(x-1)*4+1]); ++n; }- }- return n?acc/n:0;-}--int main(){- // --- D3D11 device (BGRA requis par D2D), feature level 11_1 comme le §2 ---- D3D_FEATURE_LEVEL want[]={D3D_FEATURE_LEVEL_11_1};- ID3D11Device* dev=nullptr; ID3D11DeviceContext* ctx3d=nullptr; D3D_FEATURE_LEVEL got{};- CK(D3D11CreateDevice(nullptr,D3D_DRIVER_TYPE_HARDWARE,nullptr,- D3D11_CREATE_DEVICE_BGRA_SUPPORT,want,1,D3D11_SDK_VERSION,&dev,&got,&ctx3d),"d3d11_create");- printf("RESULT: d3d11_device=ok feature_level=0x%X\n",(unsigned)got);-- // --- K2 : D2D device sur le MÊME device via son IDXGIDevice ---- IDXGIDevice* dxgi=nullptr; CK(dev->QueryInterface(__uuidof(IDXGIDevice),(void**)&dxgi),"qi_dxgi");- ID2D1Device* d2dDev=nullptr;- CK(D2D1CreateDevice(dxgi,nullptr,&d2dDev),"d2d_create_device");- ID2D1DeviceContext* dc=nullptr;- CK(d2dDev->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_NONE,&dc),"d2d_ctx");- printf("RESULT: k2_d2d_shares_d3d11_device=ok\n");-- // --- texture source : rayures verticales 2px (gradient max) ---- std::vector<unsigned char> src(W*H*4);- for(UINT y=0;y<H;++y)for(UINT x=0;x<W;++x){- unsigned char v=((x/2)&1)?255:0; size_t o=(y*W+x)*4;- src[o]=v;src[o+1]=v;src[o+2]=v;src[o+3]=255;- }- D3D11_TEXTURE2D_DESC td{}; td.Width=W;td.Height=H;td.MipLevels=1;td.ArraySize=1;- td.Format=DXGI_FORMAT_B8G8R8A8_UNORM;td.SampleDesc.Count=1;td.Usage=D3D11_USAGE_DEFAULT;- td.BindFlags=D3D11_BIND_SHADER_RESOURCE;- D3D11_SUBRESOURCE_DATA sd{}; sd.pSysMem=src.data(); sd.SysMemPitch=W*4;- ID3D11Texture2D* srcTex=nullptr; CK(dev->CreateTexture2D(&td,&sd,&srcTex),"src_tex");-- // wrap D3D11 -> D2D bitmap (zéro copie : même surface DXGI)- IDXGISurface* srcSurf=nullptr; CK(srcTex->QueryInterface(__uuidof(IDXGISurface),(void**)&srcSurf),"src_surf");- D2D1_BITMAP_PROPERTIES1 bp=D2D1::BitmapProperties1(- D2D1_BITMAP_OPTIONS_NONE,- D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM,D2D1_ALPHA_MODE_PREMULTIPLIED));- ID2D1Bitmap1* srcBmp=nullptr; CK(dc->CreateBitmapFromDxgiSurface(srcSurf,&bp,&srcBmp),"src_bmp");-- // --- cible : texture render-target, wrap en bitmap TARGET ---- D3D11_TEXTURE2D_DESC tt=td; tt.BindFlags=D3D11_BIND_RENDER_TARGET|D3D11_BIND_SHADER_RESOURCE;- ID3D11Texture2D* dstTex=nullptr; CK(dev->CreateTexture2D(&tt,nullptr,&dstTex),"dst_tex");- IDXGISurface* dstSurf=nullptr; CK(dstTex->QueryInterface(__uuidof(IDXGISurface),(void**)&dstSurf),"dst_surf");- D2D1_BITMAP_PROPERTIES1 tp=D2D1::BitmapProperties1(- D2D1_BITMAP_OPTIONS_TARGET,- D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM,D2D1_ALPHA_MODE_PREMULTIPLIED));- ID2D1Bitmap1* dstBmp=nullptr; CK(dc->CreateBitmapFromDxgiSurface(dstSurf,&tp,&dstBmp),"dst_bmp");-- // staging pour relire- D3D11_TEXTURE2D_DESC stg=td; stg.Usage=D3D11_USAGE_STAGING; stg.BindFlags=0;- stg.CPUAccessFlags=D3D11_CPU_ACCESS_READ;- ID3D11Texture2D* stgTex=nullptr; CK(dev->CreateTexture2D(&stg,nullptr,&stgTex),"stg_tex");-- auto readback=[&](const char* tag)->double{- ctx3d->CopyResource(stgTex,dstTex); ctx3d->Flush();- D3D11_MAPPED_SUBRESOURCE m{}; CK(ctx3d->Map(stgTex,0,D3D11_MAP_READ,0,&m),"map");- std::vector<unsigned char> out(m.RowPitch*H);- memcpy(out.data(),m.pData,out.size());- ctx3d->Unmap(stgTex,0);- return sharpness(out,m.RowPitch);- };-- double sharp_src=sharpness(src,W*4);- printf("RESULT: sharp_source=%.2f\n",sharp_src);-- // --- E3 : Gaussian Blur natif ---- {- ID2D1Effect* blur=nullptr; CK(dc->CreateEffect(CLSID_D2D1GaussianBlur,&blur),"blur_effect");- blur->SetInput(0,srcBmp);- CK(blur->SetValue(D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION,12.0f),"blur_sigma");- dc->SetTarget(dstBmp); dc->BeginDraw();- dc->Clear(D2D1::ColorF(0,0,0,1));- dc->DrawImage(blur);- CK(dc->EndDraw(),"blur_enddraw");- double s=readback("blur");- printf("RESULT: e3_gaussian_blur=ok sharp_after=%.2f ratio=%.3f\n",s,s/sharp_src);- blur->Release();- }- // --- E4 : Shadow natif (source opaque -> ombre décalée sur fond) ---- {- ID2D1Effect* shadow=nullptr;- HRESULT hs=dc->CreateEffect(CLSID_D2D1Shadow,&shadow);- if(SUCCEEDED(hs)){- shadow->SetInput(0,srcBmp);- shadow->SetValue(D2D1_SHADOW_PROP_BLUR_STANDARD_DEVIATION,8.0f);- dc->SetTarget(dstBmp); dc->BeginDraw();- dc->Clear(D2D1::ColorF(1,1,1,1));- dc->DrawImage(shadow);- HRESULT he=dc->EndDraw();- printf("RESULT: e4_shadow=%s\n",SUCCEEDED(he)?"ok":"draw_fail");- shadow->Release();- } else {- printf("RESULT: e4_shadow=create_fail hr=0x%08lX\n",(unsigned long)hs);- }- }- // --- K2 réel : le décodeur sort du NV12. D2D peut-il l'emballer directement ? ---- {- D3D11_TEXTURE2D_DESC nd{}; nd.Width=W; nd.Height=H; nd.MipLevels=1; nd.ArraySize=1;- nd.Format=DXGI_FORMAT_NV12; nd.SampleDesc.Count=1; nd.Usage=D3D11_USAGE_DEFAULT;- nd.BindFlags=D3D11_BIND_SHADER_RESOURCE;- // NV12 : plan Y (W*H) puis plan UV entrelacé (W*H/2)- std::vector<unsigned char> nv12(W*H + W*H/2, 128);- for(UINT y=0;y<H;++y)for(UINT x=0;x<W;++x) nv12[y*W+x]=((x/2)&1)?235:16;- D3D11_SUBRESOURCE_DATA nsd{}; nsd.pSysMem=nv12.data(); nsd.SysMemPitch=W;- ID3D11Texture2D* nvTex=nullptr;- HRESULT hn=dev->CreateTexture2D(&nd,&nsd,&nvTex);- if(FAILED(hn)){ printf("RESULT: nv12_texture=fail hr=0x%08lX\n",(unsigned long)hn); }- else {- IDXGISurface* nvSurf=nullptr; nvTex->QueryInterface(__uuidof(IDXGISurface),(void**)&nvSurf);- D2D1_BITMAP_PROPERTIES1 np=D2D1::BitmapProperties1(- D2D1_BITMAP_OPTIONS_NONE,- D2D1::PixelFormat(DXGI_FORMAT_NV12,D2D1_ALPHA_MODE_IGNORE));- ID2D1Bitmap1* nvBmp=nullptr;- HRESULT hb=dc->CreateBitmapFromDxgiSurface(nvSurf,&np,&nvBmp);- if(FAILED(hb)){ printf("RESULT: nv12_as_d2d_bitmap=fail hr=0x%08lX\n",(unsigned long)hb); }- else {- // effet YCbCr natif = conversion NV12->RGB (E1) sans shader maison- ID2D1Effect* ycbcr=nullptr;- HRESULT hy=dc->CreateEffect(CLSID_D2D1YCbCr,&ycbcr);- if(SUCCEEDED(hy)){- ycbcr->SetInput(0,nvBmp);- dc->SetTarget(dstBmp); dc->BeginDraw(); dc->Clear(D2D1::ColorF(0,0,0,1));- dc->DrawImage(ycbcr); HRESULT he=dc->EndDraw();- printf("RESULT: nv12_ingest=ok e1_ycbcr_effect=%s\n",SUCCEEDED(he)?"ok":"draw_fail");- ycbcr->Release();- } else printf("RESULT: nv12_ingest=ok e1_ycbcr_effect=create_fail hr=0x%08lX\n",(unsigned long)hy);- nvBmp->Release();- }- if(nvSurf)nvSurf->Release(); nvTex->Release();- }- }- printf("RESULT: done=ok\n");- return 0;-}diff --git a/poc-d3d/spikes/nv12_probe.cpp b/poc-d3d/spikes/nv12_probe.cppdeleted file mode 100644index 1be94106c..000000000--- a/poc-d3d/spikes/nv12_probe.cpp+++ /dev/null@@ -1,32 +0,0 @@-#include <d3d11.h>-#include <cstdio>-#pragma comment(lib,"d3d11.lib")-int main(){- ID3D11Device* dev=nullptr; ID3D11DeviceContext* ctx=nullptr;- D3D_FEATURE_LEVEL fl=D3D_FEATURE_LEVEL_11_1;- D3D11CreateDevice(nullptr,D3D_DRIVER_TYPE_HARDWARE,nullptr,- D3D11_CREATE_DEVICE_VIDEO_SUPPORT,&fl,1,D3D11_SDK_VERSION,&dev,nullptr,&ctx);- UINT s=0; dev->CheckFormatSupport(DXGI_FORMAT_NV12,&s);- printf("NV12 support flags=0x%X\n", s);- printf(" TEXTURE2D : %d\n", !!(s & D3D11_FORMAT_SUPPORT_TEXTURE2D));- printf(" SHADER_SAMPLE : %d\n", !!(s & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE));- printf(" RENDER_TARGET : %d\n", !!(s & D3D11_FORMAT_SUPPORT_RENDER_TARGET));- printf(" DECODER_OUTPUT : %d\n", !!(s & D3D11_FORMAT_SUPPORT_DECODER_OUTPUT));- // try actually creating an NV12 texture ARRAY with RENDER_TARGET|SHADER_RESOURCE- D3D11_TEXTURE2D_DESC td{}; td.Width=1920;td.Height=1080;td.MipLevels=1;td.ArraySize=8;- td.Format=DXGI_FORMAT_NV12;td.SampleDesc.Count=1;td.Usage=D3D11_USAGE_DEFAULT;- td.BindFlags=D3D11_BIND_RENDER_TARGET|D3D11_BIND_SHADER_RESOURCE;- ID3D11Texture2D* t=nullptr;- HRESULT h=dev->CreateTexture2D(&td,nullptr,&t);- printf("create NV12 array[8] RT|SR : hr=0x%08lX %s\n",(unsigned long)h, SUCCEEDED(h)?"OK":"FAIL");- if(t){t->Release();t=nullptr;}- td.BindFlags=D3D11_BIND_RENDER_TARGET;- h=dev->CreateTexture2D(&td,nullptr,&t);- printf("create NV12 array[8] RT only: hr=0x%08lX %s\n",(unsigned long)h, SUCCEEDED(h)?"OK":"FAIL");- if(t){t->Release();t=nullptr;}- // single (non-array) NV12 RT- td.ArraySize=1; td.BindFlags=D3D11_BIND_RENDER_TARGET|D3D11_BIND_SHADER_RESOURCE;- h=dev->CreateTexture2D(&td,nullptr,&t);- printf("create NV12 single RT|SR : hr=0x%08lX %s\n",(unsigned long)h, SUCCEEDED(h)?"OK":"FAIL");- return 0;-}diff --git a/poc-native/.gitignore b/poc-native/.gitignoredeleted file mode 100644index 4a95ed4ff..000000000--- a/poc-native/.gitignore+++ /dev/null@@ -1,7 +0,0 @@-/target-*.rgba-*.bmp-out-preview.png-out.mp4-/ffmpeg-dev-out*.mp4diff --git a/poc-native/Cargo.lock b/poc-native/Cargo.lockdeleted file mode 100644index 3baa1f1d8..000000000--- a/poc-native/Cargo.lock+++ /dev/null@@ -1,1657 +0,0 @@-# This file is automatically @generated by Cargo.-# It is not intended for manual editing.-version = 4--[[package]]-name = "aho-corasick"-version = "1.1.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"-dependencies = [- "memchr",-]--[[package]]-name = "allocator-api2"-version = "0.2.21"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"--[[package]]-name = "android_system_properties"-version = "0.1.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"-dependencies = [- "libc",-]--[[package]]-name = "arrayvec"-version = "0.7.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"--[[package]]-name = "ash"-version = "0.38.0+1.3.281"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"-dependencies = [- "libloading",-]--[[package]]-name = "autocfg"-version = "1.5.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"--[[package]]-name = "bindgen"-version = "0.72.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"-dependencies = [- "bitflags",- "cexpr",- "clang-sys",- "itertools",- "proc-macro2",- "quote",- "regex",- "rustc-hash 2.1.3",- "shlex 1.3.0",- "syn 2.0.119",-]--[[package]]-name = "bit-set"-version = "0.9.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd"-dependencies = [- "bit-vec",-]--[[package]]-name = "bit-vec"-version = "0.9.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51"--[[package]]-name = "bitflags"-version = "2.13.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"--[[package]]-name = "bitstream-io"-version = "2.6.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6099cdc01846bc367c4e7dd630dc5966dccf36b652fae7a74e17b640411a91b2"--[[package]]-name = "block2"-version = "0.6.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"-dependencies = [- "objc2",-]--[[package]]-name = "bumpalo"-version = "3.20.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"--[[package]]-name = "bytemuck"-version = "1.25.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d6aedf8ae72766347502cf3cb4f41cf5e9cc37d28bee90f1fdaaae15f9cf9424"-dependencies = [- "bytemuck_derive",-]--[[package]]-name = "bytemuck_derive"-version = "1.11.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f65693059b6b9c588b9f62fed1cedbf0a8b805631457ea162d68f0de186f3de5"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]--[[package]]-name = "bytes"-version = "1.12.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"--[[package]]-name = "cc"-version = "1.2.67"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e17dd265a7d0f31ef544e1b20e03add05d3b45b491b633b10d67145d2acc1a38"-dependencies = [- "find-msvc-tools",- "shlex 2.0.1",-]--[[package]]-name = "cexpr"-version = "0.6.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"-dependencies = [- "nom",-]--[[package]]-name = "cfg-if"-version = "1.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"--[[package]]-name = "cfg_aliases"-version = "0.2.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"--[[package]]-name = "clang-sys"-version = "1.8.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"-dependencies = [- "glob",- "libc",- "libloading",-]--[[package]]-name = "codespan-reporting"-version = "0.13.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681"-dependencies = [- "serde",- "termcolor",- "unicode-width",-]--[[package]]-name = "crunchy"-version = "0.2.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"--[[package]]-name = "derivative"-version = "2.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"-dependencies = [- "proc-macro2",- "quote",- "syn 1.0.109",-]--[[package]]-name = "dispatch2"-version = "0.3.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"-dependencies = [- "bitflags",- "objc2",-]--[[package]]-name = "dlib"-version = "0.5.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"-dependencies = [- "libloading",-]--[[package]]-name = "document-features"-version = "0.2.12"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"-dependencies = [- "litrs",-]--[[package]]-name = "either"-version = "1.16.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"--[[package]]-name = "equivalent"-version = "1.0.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"--[[package]]-name = "ffmpeg-next"-version = "8.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f7c4bd5ab1ac61f29c634df1175d350ded29cf74c3c6d4f7030431a5ae3c7d5d"-dependencies = [- "bitflags",- "ffmpeg-sys-next",- "libc",-]--[[package]]-name = "ffmpeg-sys-next"-version = "8.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a314bc0e022a33a99567ed4bd2576bd58ffd8fcff7891c29194cfecc26a62547"-dependencies = [- "bindgen",- "cc",- "libc",- "num_cpus",- "pkg-config",- "vcpkg",-]--[[package]]-name = "find-msvc-tools"-version = "0.1.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"--[[package]]-name = "foldhash"-version = "0.1.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"--[[package]]-name = "foldhash"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"--[[package]]-name = "four-cc"-version = "0.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "795cbfc56d419a7ce47ccbb7504dd9a5b7c484c083c356e797de08bd988d9629"--[[package]]-name = "futures-core"-version = "0.3.32"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"--[[package]]-name = "futures-task"-version = "0.3.32"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"--[[package]]-name = "futures-util"-version = "0.3.32"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"-dependencies = [- "futures-core",- "futures-task",- "pin-project-lite",- "slab",-]--[[package]]-name = "gl_generator"-version = "0.14.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d"-dependencies = [- "khronos_api",- "log",- "xml-rs",-]--[[package]]-name = "glob"-version = "0.3.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"--[[package]]-name = "glow"-version = "0.17.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5"-dependencies = [- "js-sys",- "slotmap",- "wasm-bindgen",- "web-sys",-]--[[package]]-name = "glutin_wgl_sys"-version = "0.6.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e"-dependencies = [- "gl_generator",-]--[[package]]-name = "gpu-allocator"-version = "0.28.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795"-dependencies = [- "ash",- "hashbrown 0.16.1",- "log",- "presser",- "thiserror 2.0.18",- "windows",-]--[[package]]-name = "gpu-descriptor"-version = "0.3.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca"-dependencies = [- "bitflags",- "gpu-descriptor-types",- "hashbrown 0.15.5",-]--[[package]]-name = "gpu-descriptor-types"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"-dependencies = [- "bitflags",-]--[[package]]-name = "gpu-video"-version = "0.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cef89763e3504bd4ebfd96335863dcbc1e81f02623cfd3001712a2c015aa80c4"-dependencies = [- "ash",- "bytemuck",- "bytes",- "cfg_aliases",- "derivative",- "h264-reader",- "memchr",- "rustc-hash 2.1.3",- "thiserror 1.0.69",- "tracing",- "vk-mem",- "wgpu",-]--[[package]]-name = "h264-reader"-version = "0.8.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "036a78b2620d92f0ec57690bc792b3bb87348632ee5225302ba2e66a48021c6c"-dependencies = [- "bitstream-io",- "hex-slice",- "log",- "memchr",- "rfc6381-codec",-]--[[package]]-name = "half"-version = "2.7.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"-dependencies = [- "cfg-if",- "crunchy",- "num-traits",- "zerocopy",-]--[[package]]-name = "hashbrown"-version = "0.15.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"-dependencies = [- "foldhash 0.1.5",-]--[[package]]-name = "hashbrown"-version = "0.16.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"-dependencies = [- "allocator-api2",- "equivalent",- "foldhash 0.2.0",-]--[[package]]-name = "hashbrown"-version = "0.17.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"--[[package]]-name = "hermit-abi"-version = "0.5.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"--[[package]]-name = "hex-slice"-version = "0.1.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5491a308e0214554f07a81d8944abe45f552871c12e3c3c6e7e5d354039a6c4c"--[[package]]-name = "hexf-parse"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"--[[package]]-name = "indexmap"-version = "2.14.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"-dependencies = [- "equivalent",- "hashbrown 0.17.1",-]--[[package]]-name = "itertools"-version = "0.13.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"-dependencies = [- "either",-]--[[package]]-name = "jni-sys"-version = "0.3.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258"-dependencies = [- "jni-sys 0.4.1",-]--[[package]]-name = "jni-sys"-version = "0.4.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2"-dependencies = [- "jni-sys-macros",-]--[[package]]-name = "jni-sys-macros"-version = "0.4.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264"-dependencies = [- "quote",- "syn 2.0.119",-]--[[package]]-name = "js-sys"-version = "0.3.103"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102"-dependencies = [- "cfg-if",- "futures-util",- "wasm-bindgen",-]--[[package]]-name = "khronos-egl"-version = "6.0.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"-dependencies = [- "libc",- "libloading",- "pkg-config",-]--[[package]]-name = "khronos_api"-version = "3.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"--[[package]]-name = "lazy_static"-version = "1.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"--[[package]]-name = "libc"-version = "0.2.186"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"--[[package]]-name = "libloading"-version = "0.8.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"-dependencies = [- "cfg-if",- "windows-link",-]--[[package]]-name = "libm"-version = "0.2.16"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"--[[package]]-name = "litrs"-version = "1.0.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"--[[package]]-name = "lock_api"-version = "0.4.14"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"-dependencies = [- "scopeguard",-]--[[package]]-name = "log"-version = "0.4.33"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"--[[package]]-name = "matchers"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"-dependencies = [- "regex-automata",-]--[[package]]-name = "memchr"-version = "2.8.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"--[[package]]-name = "minimal-lexical"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"--[[package]]-name = "mp4ra-rust"-version = "0.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fdbc3d3867085d66ac6270482e66f3dd2c5a18451a3dc9ad7269e94844a536b7"-dependencies = [- "four-cc",-]--[[package]]-name = "mpeg4-audio-const"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "96a1fe2275b68991faded2c80aa4a33dba398b77d276038b8f50701a22e55918"--[[package]]-name = "naga"-version = "29.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b2bf919621e7975acb27d881bae2fb993e0d45c8e0446e85e6272971e00dc8df"-dependencies = [- "arrayvec",- "bit-set",- "bitflags",- "cfg-if",- "cfg_aliases",- "codespan-reporting",- "half",- "hashbrown 0.16.1",- "hexf-parse",- "indexmap",- "libm",- "log",- "num-traits",- "once_cell",- "rustc-hash 1.1.0",- "spirv",- "thiserror 2.0.18",- "unicode-ident",-]--[[package]]-name = "ndk-sys"-version = "0.6.0+11769913"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873"-dependencies = [- "jni-sys 0.3.1",-]--[[package]]-name = "nom"-version = "7.1.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"-dependencies = [- "memchr",- "minimal-lexical",-]--[[package]]-name = "nu-ansi-term"-version = "0.50.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"-dependencies = [- "windows-sys",-]--[[package]]-name = "num-traits"-version = "0.2.19"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"-dependencies = [- "autocfg",- "libm",-]--[[package]]-name = "num_cpus"-version = "1.17.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"-dependencies = [- "hermit-abi",- "libc",-]--[[package]]-name = "objc2"-version = "0.6.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f"-dependencies = [- "objc2-encode",-]--[[package]]-name = "objc2-core-foundation"-version = "0.3.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"-dependencies = [- "bitflags",- "dispatch2",- "objc2",-]--[[package]]-name = "objc2-encode"-version = "4.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"--[[package]]-name = "objc2-foundation"-version = "0.3.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"-dependencies = [- "bitflags",- "objc2",- "objc2-core-foundation",-]--[[package]]-name = "objc2-metal"-version = "0.3.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794"-dependencies = [- "bitflags",- "block2",- "objc2",- "objc2-foundation",-]--[[package]]-name = "objc2-quartz-core"-version = "0.3.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"-dependencies = [- "bitflags",- "objc2",- "objc2-core-foundation",- "objc2-foundation",- "objc2-metal",-]--[[package]]-name = "once_cell"-version = "1.21.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"--[[package]]-name = "ordered-float"-version = "5.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b7d950ca161dc355eaf28f82b11345ed76c6e1f6eb1f4f4479e0323b9e2fbd0e"-dependencies = [- "num-traits",-]--[[package]]-name = "parking_lot"-version = "0.12.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"-dependencies = [- "lock_api",- "parking_lot_core",-]--[[package]]-name = "parking_lot_core"-version = "0.9.12"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"-dependencies = [- "cfg-if",- "libc",- "redox_syscall",- "smallvec",- "windows-link",-]--[[package]]-name = "pin-project-lite"-version = "0.2.17"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"--[[package]]-name = "pkg-config"-version = "0.3.33"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e"--[[package]]-name = "poc-native"-version = "0.1.0"-dependencies = [- "bytemuck",- "ffmpeg-next",- "gpu-video",- "pollster",- "tracing-subscriber",- "wgpu",-]--[[package]]-name = "pollster"-version = "0.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2"--[[package]]-name = "portable-atomic"-version = "1.14.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3"--[[package]]-name = "portable-atomic-util"-version = "0.2.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618"-dependencies = [- "portable-atomic",-]--[[package]]-name = "presser"-version = "0.3.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"--[[package]]-name = "proc-macro2"-version = "1.0.106"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"-dependencies = [- "unicode-ident",-]--[[package]]-name = "profiling"-version = "1.0.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5"--[[package]]-name = "quote"-version = "1.0.46"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"-dependencies = [- "proc-macro2",-]--[[package]]-name = "range-alloc"-version = "0.1.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08"--[[package]]-name = "raw-window-handle"-version = "0.6.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"--[[package]]-name = "raw-window-metal"-version = "1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135"-dependencies = [- "objc2",- "objc2-core-foundation",- "objc2-foundation",- "objc2-quartz-core",-]--[[package]]-name = "redox_syscall"-version = "0.5.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"-dependencies = [- "bitflags",-]--[[package]]-name = "regex"-version = "1.13.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"-dependencies = [- "aho-corasick",- "memchr",- "regex-automata",- "regex-syntax",-]--[[package]]-name = "regex-automata"-version = "0.4.16"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad"-dependencies = [- "aho-corasick",- "memchr",- "regex-syntax",-]--[[package]]-name = "regex-syntax"-version = "0.8.11"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"--[[package]]-name = "renderdoc-sys"-version = "1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"--[[package]]-name = "rfc6381-codec"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ed54c20f5c3ec82eab6d998b313dc75ec5d5650d4f57675e61d72489040297fd"-dependencies = [- "mp4ra-rust",- "mpeg4-audio-const",-]--[[package]]-name = "rustc-hash"-version = "1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"--[[package]]-name = "rustc-hash"-version = "2.1.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"--[[package]]-name = "rustversion"-version = "1.0.23"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"--[[package]]-name = "scopeguard"-version = "1.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"--[[package]]-name = "serde"-version = "1.0.228"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"-dependencies = [- "serde_core",- "serde_derive",-]--[[package]]-name = "serde_core"-version = "1.0.228"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"-dependencies = [- "serde_derive",-]--[[package]]-name = "serde_derive"-version = "1.0.228"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]--[[package]]-name = "sharded-slab"-version = "0.1.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"-dependencies = [- "lazy_static",-]--[[package]]-name = "shlex"-version = "1.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"--[[package]]-name = "shlex"-version = "2.0.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"--[[package]]-name = "slab"-version = "0.4.12"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"--[[package]]-name = "slotmap"-version = "1.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038"-dependencies = [- "version_check",-]--[[package]]-name = "smallvec"-version = "1.15.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"--[[package]]-name = "spirv"-version = "0.4.0+sdk-1.4.341.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f"-dependencies = [- "bitflags",-]--[[package]]-name = "static_assertions"-version = "1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"--[[package]]-name = "syn"-version = "1.0.109"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"-dependencies = [- "proc-macro2",- "quote",- "unicode-ident",-]--[[package]]-name = "syn"-version = "2.0.119"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"-dependencies = [- "proc-macro2",- "quote",- "unicode-ident",-]--[[package]]-name = "termcolor"-version = "1.4.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"-dependencies = [- "winapi-util",-]--[[package]]-name = "thiserror"-version = "1.0.69"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"-dependencies = [- "thiserror-impl 1.0.69",-]--[[package]]-name = "thiserror"-version = "2.0.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"-dependencies = [- "thiserror-impl 2.0.18",-]--[[package]]-name = "thiserror-impl"-version = "1.0.69"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]--[[package]]-name = "thiserror-impl"-version = "2.0.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]--[[package]]-name = "thread_local"-version = "1.1.10"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070"-dependencies = [- "cfg-if",-]--[[package]]-name = "tracing"-version = "0.1.44"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"-dependencies = [- "pin-project-lite",- "tracing-attributes",- "tracing-core",-]--[[package]]-name = "tracing-attributes"-version = "0.1.31"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]--[[package]]-name = "tracing-core"-version = "0.1.36"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"-dependencies = [- "once_cell",- "valuable",-]--[[package]]-name = "tracing-log"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"-dependencies = [- "log",- "once_cell",- "tracing-core",-]--[[package]]-name = "tracing-subscriber"-version = "0.3.23"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"-dependencies = [- "matchers",- "nu-ansi-term",- "once_cell",- "regex-automata",- "sharded-slab",- "smallvec",- "thread_local",- "tracing",- "tracing-core",- "tracing-log",-]--[[package]]-name = "unicode-ident"-version = "1.0.24"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"--[[package]]-name = "unicode-width"-version = "0.1.14"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"--[[package]]-name = "valuable"-version = "0.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"--[[package]]-name = "vcpkg"-version = "0.2.15"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"--[[package]]-name = "version_check"-version = "0.9.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"--[[package]]-name = "vk-mem"-version = "0.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0cb12b79bcec57a3334d0284f1364c1846f378bb47df9779c6dbfcfc245c9404"-dependencies = [- "ash",- "bitflags",- "cc",-]--[[package]]-name = "wasm-bindgen"-version = "0.2.126"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4"-dependencies = [- "cfg-if",- "once_cell",- "rustversion",- "wasm-bindgen-macro",- "wasm-bindgen-shared",-]--[[package]]-name = "wasm-bindgen-futures"-version = "0.4.76"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c62df1340f32221cb9c54d6a27b030e3dba64361d4a95bed55f9aacb44da291d"-dependencies = [- "js-sys",- "wasm-bindgen",-]--[[package]]-name = "wasm-bindgen-macro"-version = "0.2.126"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1"-dependencies = [- "quote",- "wasm-bindgen-macro-support",-]--[[package]]-name = "wasm-bindgen-macro-support"-version = "0.2.126"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e"-dependencies = [- "bumpalo",- "proc-macro2",- "quote",- "syn 2.0.119",- "wasm-bindgen-shared",-]--[[package]]-name = "wasm-bindgen-shared"-version = "0.2.126"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24"-dependencies = [- "unicode-ident",-]--[[package]]-name = "wayland-sys"-version = "0.31.11"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be"-dependencies = [- "dlib",- "log",- "once_cell",- "pkg-config",-]--[[package]]-name = "web-sys"-version = "0.3.103"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8622dcb61c0bcc9fffa6938bed81210af2da9a7e4a1a834b2e37a59b6dfb6141"-dependencies = [- "js-sys",- "wasm-bindgen",-]--[[package]]-name = "wgpu"-version = "29.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "76e8840e1ba2881d4cbb18d2147627a56af426ff064c0401eb0c8410c6325d07"-dependencies = [- "arrayvec",- "bitflags",- "bytemuck",- "cfg-if",- "cfg_aliases",- "document-features",- "hashbrown 0.16.1",- "js-sys",- "log",- "naga",- "parking_lot",- "portable-atomic",- "profiling",- "raw-window-handle",- "smallvec",- "static_assertions",- "wasm-bindgen",- "wasm-bindgen-futures",- "web-sys",- "wgpu-core",- "wgpu-hal",- "wgpu-types",-]--[[package]]-name = "wgpu-core"-version = "29.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2f519832254e56965a9940c4af57dcb75f702b6f6fa4a0b172f685395843a4d7"-dependencies = [- "arrayvec",- "bit-set",- "bit-vec",- "bitflags",- "bytemuck",- "cfg_aliases",- "document-features",- "hashbrown 0.16.1",- "indexmap",- "log",- "naga",- "once_cell",- "parking_lot",- "portable-atomic",- "profiling",- "raw-window-handle",- "rustc-hash 1.1.0",- "smallvec",- "thiserror 2.0.18",- "wgpu-core-deps-apple",- "wgpu-core-deps-emscripten",- "wgpu-core-deps-windows-linux-android",- "wgpu-hal",- "wgpu-naga-bridge",- "wgpu-types",-]--[[package]]-name = "wgpu-core-deps-apple"-version = "29.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f5e39e26c4c0e07589e67d18546cf79ff45383659fc72fca4dd293358a0347f3"-dependencies = [- "wgpu-hal",-]--[[package]]-name = "wgpu-core-deps-emscripten"-version = "29.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "01e09be551dc939498bdd5f6b2c66e55ab275dad25825267a08605a80fc9f0af"-dependencies = [- "wgpu-hal",-]--[[package]]-name = "wgpu-core-deps-windows-linux-android"-version = "29.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4e592c1bbef6ad047647ae6e666ebd8cee7a32bb4544d9700ec96cbf73230257"-dependencies = [- "wgpu-hal",-]--[[package]]-name = "wgpu-hal"-version = "29.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "97ace1c17727311c22a46e4e3faf56ea6de81af99dcc839bdfb54857b94d448d"-dependencies = [- "android_system_properties",- "arrayvec",- "ash",- "bit-set",- "bitflags",- "block2",- "bytemuck",- "cfg-if",- "cfg_aliases",- "glow",- "glutin_wgl_sys",- "gpu-allocator",- "gpu-descriptor",- "hashbrown 0.16.1",- "js-sys",- "khronos-egl",- "libc",- "libloading",- "log",- "naga",- "ndk-sys",- "objc2",- "objc2-core-foundation",- "objc2-foundation",- "objc2-metal",- "objc2-quartz-core",- "once_cell",- "ordered-float",- "parking_lot",- "portable-atomic",- "portable-atomic-util",- "profiling",- "range-alloc",- "raw-window-handle",- "raw-window-metal",- "renderdoc-sys",- "smallvec",- "thiserror 2.0.18",- "wasm-bindgen",- "wayland-sys",- "web-sys",- "wgpu-naga-bridge",- "wgpu-types",- "windows",- "windows-core",- "windows-result",-]--[[package]]-name = "wgpu-naga-bridge"-version = "29.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "95226013f547544b223281cd16a4fb549aa9dcb562adbda0faae4c73ffbbc161"-dependencies = [- "naga",- "wgpu-types",-]--[[package]]-name = "wgpu-types"-version = "29.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "84bf84cd9ca8ca45e2b223a3868f1adf9bfc0c66aeac212e76ee7e40fdadf8f5"-dependencies = [- "bitflags",- "bytemuck",- "js-sys",- "log",- "raw-window-handle",- "web-sys",-]--[[package]]-name = "winapi-util"-version = "0.1.11"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"-dependencies = [- "windows-sys",-]--[[package]]-name = "windows"-version = "0.62.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"-dependencies = [- "windows-collections",- "windows-core",- "windows-future",- "windows-numerics",-]--[[package]]-name = "windows-collections"-version = "0.3.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"-dependencies = [- "windows-core",-]--[[package]]-name = "windows-core"-version = "0.62.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"-dependencies = [- "windows-implement",- "windows-interface",- "windows-link",- "windows-result",- "windows-strings",-]--[[package]]-name = "windows-future"-version = "0.3.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"-dependencies = [- "windows-core",- "windows-link",- "windows-threading",-]--[[package]]-name = "windows-implement"-version = "0.60.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]--[[package]]-name = "windows-interface"-version = "0.59.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]--[[package]]-name = "windows-link"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"--[[package]]-name = "windows-numerics"-version = "0.3.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"-dependencies = [- "windows-core",- "windows-link",-]--[[package]]-name = "windows-result"-version = "0.4.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"-dependencies = [- "windows-link",-]--[[package]]-name = "windows-strings"-version = "0.5.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"-dependencies = [- "windows-link",-]--[[package]]-name = "windows-sys"-version = "0.61.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"-dependencies = [- "windows-link",-]--[[package]]-name = "windows-threading"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"-dependencies = [- "windows-link",-]--[[package]]-name = "xml-rs"-version = "0.8.28"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f"--[[package]]-name = "zerocopy"-version = "0.8.54"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b7cbbc0a705a0fd05cc3676525980d2bf5a9bc4adac6d6475209a7887cf59d19"-dependencies = [- "zerocopy-derive",-]--[[package]]-name = "zerocopy-derive"-version = "0.8.54"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e2e817b7b52d0c7358d3246da9d69935ebb18116b2b102b4230dac079b4862f5"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]diff --git a/poc-native/Cargo.toml b/poc-native/Cargo.tomldeleted file mode 100644index f9d8f7021..000000000--- a/poc-native/Cargo.toml+++ /dev/null@@ -1,21 +0,0 @@-[package]-name = "poc-native"-version = "0.1.0"-edition = "2021"--# Native full-shader compositor POC. No browser, no Electron, no WebCodecs:-# wgpu runs the same WGSL as the web POC (adapted from texture_external to plain-# 2D textures, a WebGPU-only feature that native wgpu does not have), and the-# hardware H.264 encoder is reached natively. This is the "most performant and-# native possible" path the web POC could not measure.--[dependencies]-wgpu = "29"-pollster = "0.3"-bytemuck = { version = "1", features = ["derive"] }-ffmpeg-next = "8.1.0"-gpu-video = "0.4.0"-tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }--[profile.release]-opt-level = 3diff --git a/poc-native/src/bin/gpures.rs b/poc-native/src/bin/gpures.rsdeleted file mode 100644index f4037b985..000000000--- a/poc-native/src/bin/gpures.rs+++ /dev/null@@ -1,113 +0,0 @@-// GPU-resident native pipeline, milestone 1: hardware Vulkan Video decode straight-// into a wgpu::Texture — no CPU upload, no swscale — via gpu-video. This is the-// piece the CPU path could never have: decoded frames that never touch RAM.-//-// gpu-video owns the wgpu device (it creates the Vulkan device with the video-// extensions), so the composite pipeline will later be built on ITS device and-// sample these textures directly. Step 1 just proves the zero-copy decode works-// on this AMD iGPU (ffmpeg confirmed Vulkan DECODE works here; encode did not).--use ffmpeg_next as ff;-use gpu_video::parameters as gp;--// mp4 stores H.264 as length-prefixed AVCC NALs; the Vulkan decoder wants Annex-B-// (start codes) with in-band SPS/PPS. Convert by hand — a bitstream filter in ~40-// lines, no BSF-API guesswork.-fn avcc_sps_pps(extradata: &[u8]) -> Vec<u8> {- // avcC: [0]=1 [1..4]=profile/compat/level [4]=0xFC|lenSizeMinus1- // [5]=0xE0|numSPS, then numSPS x (u16 len + SPS), then numPPS, then PPS...- let mut out = Vec::new();- if extradata.len() < 6 { return out; }- let mut i = 5usize;- let num_sps = extradata[i] & 0x1F; i += 1;- for _ in 0..num_sps {- if i + 2 > extradata.len() { return out; }- let n = ((extradata[i] as usize) << 8) | extradata[i + 1] as usize; i += 2;- out.extend_from_slice(&[0, 0, 0, 1]);- out.extend_from_slice(&extradata[i..i + n]); i += n;- }- if i >= extradata.len() { return out; }- let num_pps = extradata[i]; i += 1;- for _ in 0..num_pps {- if i + 2 > extradata.len() { return out; }- let n = ((extradata[i] as usize) << 8) | extradata[i + 1] as usize; i += 2;- out.extend_from_slice(&[0, 0, 0, 1]);- out.extend_from_slice(&extradata[i..i + n]); i += n;- }- out-}--fn avcc_to_annexb(packet: &[u8], out: &mut Vec<u8>) {- // 4-byte length-prefixed NALs → start-code-prefixed.- let mut i = 0usize;- while i + 4 <= packet.len() {- let n = ((packet[i] as usize) << 24) | ((packet[i + 1] as usize) << 16) | ((packet[i + 2] as usize) << 8) | packet[i + 3] as usize;- i += 4;- if i + n > packet.len() { break; }- out.extend_from_slice(&[0, 0, 0, 1]);- out.extend_from_slice(&packet[i..i + n]);- i += n;- }-}--fn main() {- ff::init().unwrap();- tracing_subscriber::fmt().with_env_filter("gpu_video=debug,warn").with_writer(std::io::stderr).init();-- // gpu-video creates the Vulkan device (with video decode extensions) and the- // wgpu device on top.- let instance = gpu_video::VulkanInstance::new().expect("vulkan instance");- // decode only: this AMD iGPU exposes Vulkan Video DECODE but not encode (ffmpeg- // h264_vulkan failed with "Function not implemented"). The default descriptor- // demands both and returns NoDevice; ask for decode alone.- let adapter = instance.create_adapter(&gp::VulkanAdapterDescriptor {- supports_decoding: true,- supports_encoding: false,- compatible_surface: None,- }).expect("adapter");- let device = adapter.create_device(&gp::VulkanDeviceDescriptor::default()).expect("device");- let wdev = device.wgpu_device();- println!("gpu-video device up. wgpu adapter: {}", wdev.limits().max_texture_dimension_2d);-- let mut decoder = device- .create_wgpu_textures_decoder_h264(gp::DecoderParameters::default())- .expect("h264 decoder");-- // Demux screen.mp4 → Annex-B H.264, feed to the Vulkan decoder.- let mut ictx = ff::format::input(&"../poc/media/screen.mp4").unwrap();- let stream = ictx.streams().best(ff::media::Type::Video).unwrap();- let idx = stream.index();- let params = stream.parameters();- let extradata = unsafe {- let p = params.as_ptr();- let (ed, n) = ((*p).extradata, (*p).extradata_size as usize);- if ed.is_null() || n == 0 { Vec::new() } else { std::slice::from_raw_parts(ed, n).to_vec() }- };-- let header = avcc_sps_pps(&extradata);- let mut decoded = 0usize;- let mut first_reported = false;- let mut annexb = Vec::new();-- 'outer: for (s, p) in ictx.packets() {- if s.index() != idx { continue; }- annexb.clear();- if !first_reported && !header.is_empty() { annexb.extend_from_slice(&header); }- avcc_to_annexb(p.data().unwrap_or(&[]), &mut annexb);-- let frames = match decoder.decode(gpu_video::EncodedInputChunk { data: &annexb, pts: None }) {- Ok(f) => f,- Err(e) => { eprintln!("decode error: {e:?}"); break; }- };- for frame in frames {- let tex: &wgpu::Texture = &frame.data;- if !first_reported {- println!("ZERO-COPY DECODE OK: wgpu::Texture {}x{} format {:?}", tex.width(), tex.height(), tex.format());- first_reported = true;- }- decoded += 1;- if decoded >= 30 { break 'outer; }- }- }- println!("decoded {decoded} frames into wgpu textures, no CPU roundtrip");-}diff --git a/poc-native/src/composite.wgsl b/poc-native/src/composite.wgsldeleted file mode 100644index 129b028b6..000000000--- a/poc-native/src/composite.wgsl+++ /dev/null@@ -1,177 +0,0 @@-// Native compositor — the same WGSL as the web POC, adapted for native wgpu.-//-// Two changes only, both because `texture_external` is a WebGPU-only feature that-// native wgpu does not have:-// texture_external -> texture_2d<f32>-// textureSampleBaseClampToEdge -> textureSampleLevel(..., 0.0)-// Everything else — the geometry, the erf Gaussian shadow, the cursor SDF — is-// byte-for-byte the browser shader. That is the portability the whole bet rests-// on: the product's substance moves to native unchanged.-//-// Single pass here (not the web POC's 6 culled quads): natively the compositor is-// nowhere near the bottleneck, so the quad-culling buys nothing and the one-// fragment shader is simpler.--struct U {- // stage.xy | time | screenRadius- a : vec4f,- // screenRect x,y,w,h (carries zoom)- screen : vec4f,- // webcamRect x,y,w,h (carries layout animation)- webcam : vec4f,- // shadowIntensity | bgBlurPx(unused native) | shadowOffsetY | shadowSigma- fx : vec4f,- // webcamRadius | motionBlur baked elsewhere | webcamCoverScale | unused- b : vec4f,- // screenBlur.xy | webcamBlur.xy- mb : vec4f,- // cursor x | y | size | opacity- cursor : vec4f,- // cursorBlur.xy | clickScale | unused- cursorFx : vec4f,-};--@group(0) @binding(0) var<uniform> u : U;-@group(0) @binding(1) var samp : sampler;-@group(0) @binding(2) var screenTex : texture_2d<f32>;-@group(0) @binding(3) var webcamTex : texture_2d<f32>;--struct VsOut {- @builtin(position) pos : vec4f,- @location(0) uv : vec2f,-};--@vertex-fn vs(@builtin(vertex_index) i : u32) -> VsOut {- var out : VsOut;- let x = f32((i << 1u) & 2u);- let y = f32(i & 2u);- out.uv = vec2f(x, y);- out.pos = vec4f(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0);- return out;-}--fn sdRoundBox(p : vec2f, half : vec2f, r : f32) -> f32 {- let rr = min(r, min(half.x, half.y));- let q = abs(p) - half + vec2f(rr);- return length(max(q, vec2f(0.0))) + min(max(q.x, q.y), 0.0) - rr;-}-fn cover(d : f32) -> f32 { return clamp(0.5 - d, 0.0, 1.0); }-fn over(dst : vec3f, src : vec3f, a : f32) -> vec3f { return mix(dst, src, clamp(a, 0.0, 1.0)); }--// ---- background: computed gradient -----fn gradient(uv : vec2f) -> vec3f {- let a = vec3f(0.06, 0.11, 0.24);- let b = vec3f(0.35, 0.12, 0.42);- let c = vec3f(0.02, 0.35, 0.38);- let w = 0.5 + 0.5 * sin(uv.x * 2.0);- return mix(mix(a, b, uv.y), c, w * 0.45);-}--// ---- shadow: analytic Gaussian (erf), same as web -----const SQRT_2PI = 2.5066282746310002;-const INV_SQRT_2 = 0.7071067811865476;-fn gauss1(x : f32, sigma : f32) -> f32 { return exp(-(x * x) / (2.0 * sigma * sigma)) / (SQRT_2PI * sigma); }-fn erf2(x : vec2f) -> vec2f {- let s = sign(x); let a = abs(x);- var r = 1.0 + (0.278393 + (0.230389 + 0.078108 * (a * a)) * a) * a;- r = r * r; return s - s / (r * r);-}-fn shadowRowX(x : f32, y : f32, sigma : f32, corner : f32, half : vec2f) -> f32 {- let d = min(half.y - corner - abs(y), 0.0);- let curved = half.x - corner + sqrt(max(0.0, corner * corner - d * d));- let integral = 0.5 + 0.5 * erf2((x + vec2f(-curved, curved)) * (INV_SQRT_2 / sigma));- return integral.y - integral.x;-}-fn shadowAt(px : vec2f, rect : vec4f, radius : f32, intensity : f32) -> f32 {- if (intensity <= 0.0) { return 0.0; }- let sigma = max(u.fx.w, 0.5);- let half = rect.zw * 0.5;- let corner = min(radius, min(half.x, half.y));- let p = px - (rect.xy + half + vec2f(0.0, u.fx.z));- let low = p.y - half.y; let high = p.y + half.y;- let start = clamp(-3.0 * sigma, low, high);- let end = clamp(3.0 * sigma, low, high);- let step = (end - start) / 4.0;- var y = start + step * 0.5; var value = 0.0;- for (var i = 0; i < 4; i = i + 1) {- value = value + shadowRowX(p.x, p.y - y, sigma, corner, half) * gauss1(y, sigma) * step;- y = y + step;- }- return clamp(value, 0.0, 1.0) * intensity;-}--// ---- sources -----fn sampleScreen(px : vec2f, blur : vec2f) -> vec3f {- let uv0 = (px - u.screen.xy) / max(u.screen.zw, vec2f(1.0));- if (length(blur) < 0.5) {- return textureSampleLevel(screenTex, samp, clamp(uv0, vec2f(0.0), vec2f(1.0)), 0.0).rgb;- }- var acc = vec3f(0.0); let taps = 7;- for (var i = 0; i < taps; i = i + 1) {- let t = (f32(i) / f32(taps - 1)) - 0.5;- let uv = ((px + blur * t) - u.screen.xy) / max(u.screen.zw, vec2f(1.0));- acc = acc + textureSampleLevel(screenTex, samp, clamp(uv, vec2f(0.0), vec2f(1.0)), 0.0).rgb;- }- return acc / f32(taps);-}-fn sampleWebcam(px : vec2f, centre : vec2f) -> vec3f {- var uv = (px - centre) / max(u.webcam.zw, vec2f(1.0));- uv = uv * vec2f(u.b.z, 1.0) + vec2f(0.5);- return textureSampleLevel(webcamTex, samp, clamp(uv, vec2f(0.0), vec2f(1.0)), 0.0).rgb;-}--// ---- cursor: arrow polygon SDF -----fn sdCursor(p : vec2f) -> f32 {- var v = array<vec2f, 7>(- vec2f(0.00, 0.00), vec2f(0.00, 1.00), vec2f(0.24, 0.76),- vec2f(0.40, 1.14), vec2f(0.56, 1.07), vec2f(0.39, 0.69), vec2f(0.70, 0.69),- );- var d = dot(p - v[0], p - v[0]); var s = 1.0;- for (var i = 0; i < 7; i = i + 1) {- let j = (i + 6) % 7;- let e = v[j] - v[i]; let w = p - v[i];- let b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);- d = min(d, dot(b, b));- let c0 = p.y >= v[i].y; let c1 = p.y < v[j].y; let c2 = e.x * w.y > e.y * w.x;- if ((c0 && c1 && c2) || (!c0 && !c1 && !c2)) { s = -s; }- }- return s * sqrt(d);-}-fn cursorFill(px : vec2f, shrink : f32) -> f32 {- let s = u.cursor.z / 1.2;- let local = (px - u.cursor.xy) / max(s, 1.0) / u.cursorFx.z;- return cover((sdCursor(local) * s * u.cursorFx.z) - shrink);-}--@fragment-fn fs(in : VsOut) -> @location(0) vec4f {- let px = in.uv * u.a.xy;-- // 1. background- var colour = gradient(in.uv);-- // 2. screen shadow (analytic Gaussian)- colour = over(colour, vec3f(0.0), shadowAt(px, u.screen, u.a.w, u.fx.x));-- // 3. screen (zoom + motion blur + rounded mask)- let sc = cover(sdRoundBox(px - (u.screen.xy + u.screen.zw * 0.5), u.screen.zw * 0.5, u.a.w));- if (sc > 0.0) { colour = over(colour, sampleScreen(px, u.mb.xy), sc); }-- // 4. webcam shadow + webcam (shape morphs via radius)- colour = over(colour, vec3f(0.0), shadowAt(px, u.webcam, u.b.x, u.fx.x * 0.8));- let centre = u.webcam.xy + u.webcam.zw * 0.5;- let wc = cover(sdRoundBox(px - centre, u.webcam.zw * 0.5, u.b.x));- if (wc > 0.0) { colour = over(colour, sampleWebcam(px, centre), wc); }-- // 5. cursor: white fill + black rim, motion-blurred, click-bounced- let outline = max(u.cursor.z * 0.05, 1.5);- let fill = cursorFill(px, 0.0);- let edge = cursorFill(px, outline);- if (edge > 0.001) {- let rgb = vec3f(fill / max(edge, 1e-4));- colour = over(colour, rgb, edge * u.cursor.w);- }-- return vec4f(colour, 1.0);-}diff --git a/poc-native/src/main.rs b/poc-native/src/main.rsdeleted file mode 100644index 04979ba6a..000000000--- a/poc-native/src/main.rs+++ /dev/null@@ -1,295 +0,0 @@-// Native full-shader compositor POC — milestone 1: prove wgpu runs the WGSL and-// composites a real frame, natively, no browser.-//-// Decode one real frame from each source with ffmpeg (to raw RGBA), upload as-// wgpu textures, run the SAME shader as the web POC (adapted for native), render-// to an offscreen 1080p target, read it back, write a BMP. If the picture matches-// the web POC at the same t, the compositor has moved to native unchanged.--use std::fs;-use std::process::Command;--const OUT_W: u32 = 1920;-const OUT_H: u32 = 1080;-const SCREEN_W: u32 = 1920;-const SCREEN_H: u32 = 1032;-const WEBCAM_W: u32 = 640;-const WEBCAM_H: u32 = 480;--#[repr(C)]-#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]-struct Uniforms {- a: [f32; 4],- screen: [f32; 4],- webcam: [f32; 4],- fx: [f32; 4],- b: [f32; 4],- mb: [f32; 4],- cursor: [f32; 4],- cursor_fx: [f32; 4],-}--struct Rect {- x: f32,- y: f32,- w: f32,- h: f32,-}--// evaluate(), ported from the web POC. At t=0.5s: no zoom (starts 1.0), no layout-// move (starts 2.4), so the recording sits padded and the webcam is a docked-// circle — the frame where background + shadow + rounded corners are all visible.-fn base_layout(padding: f32) -> (Rect, Rect) {- let s = 1.0 - (padding / 100.0) * 0.4;- let w = OUT_W as f32 * s;- let h = OUT_H as f32 * s;- let screen = Rect {- x: (OUT_W as f32 - w) / 2.0,- y: (OUT_H as f32 - h) / 2.0,- w,- h,- };- let size = (OUT_H as f32 * 0.22).round();- let margin = (OUT_H as f32 * 0.04).round();- let webcam = Rect {- x: OUT_W as f32 - size - margin,- y: OUT_H as f32 - size - margin,- w: size,- h: size,- };- (screen, webcam)-}--fn decode_frame(path: &str, t: &str, w: u32, h: u32, out: &str) -> Vec<u8> {- // One real frame → raw RGBA. ffmpeg is the native hardware/software decoder;- // this is the decode seam. For the compositor milestone it runs once.- let status = Command::new("ffmpeg")- .args([- "-hide_banner", "-loglevel", "error", "-y", "-ss", t, "-i", path, "-frames:v", "1",- "-f", "rawvideo", "-pix_fmt", "rgba", out,- ])- .status()- .expect("ffmpeg failed to run");- assert!(status.success(), "ffmpeg decode failed for {path}");- let data = fs::read(out).expect("read decoded frame");- assert_eq!(data.len(), (w * h * 4) as usize, "unexpected frame size for {path}");- data-}--fn make_texture(- device: &wgpu::Device,- queue: &wgpu::Queue,- w: u32,- h: u32,- rgba: &[u8],- label: &str,-) -> wgpu::TextureView {- let tex = device.create_texture(&wgpu::TextureDescriptor {- label: Some(label),- size: wgpu::Extent3d { width: w, height: h, depth_or_array_layers: 1 },- mip_level_count: 1,- sample_count: 1,- dimension: wgpu::TextureDimension::D2,- format: wgpu::TextureFormat::Rgba8Unorm,- usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,- view_formats: &[],- });- queue.write_texture(- wgpu::ImageCopyTexture {- texture: &tex,- mip_level: 0,- origin: wgpu::Origin3d::ZERO,- aspect: wgpu::TextureAspect::All,- },- rgba,- wgpu::ImageDataLayout {- offset: 0,- bytes_per_row: Some(w * 4),- rows_per_image: Some(h),- },- wgpu::Extent3d { width: w, height: h, depth_or_array_layers: 1 },- );- tex.create_view(&wgpu::TextureViewDescriptor::default())-}--fn write_bmp(path: &str, w: u32, h: u32, rgba: &[u8]) {- // 24-bit BMP, bottom-up. No image crate: keeps the native POC's deps to wgpu.- let row = (w * 3 + 3) & !3; // 4-byte aligned- let size = 54 + row * h;- let mut f = Vec::with_capacity(size as usize);- f.extend_from_slice(b"BM");- f.extend_from_slice(&size.to_le_bytes());- f.extend_from_slice(&0u32.to_le_bytes());- f.extend_from_slice(&54u32.to_le_bytes());- f.extend_from_slice(&40u32.to_le_bytes());- f.extend_from_slice(&(w as i32).to_le_bytes());- f.extend_from_slice(&(h as i32).to_le_bytes());- f.extend_from_slice(&1u16.to_le_bytes());- f.extend_from_slice(&24u16.to_le_bytes());- f.extend_from_slice(&[0u8; 24]);- for y in (0..h).rev() {- let mut written = 0u32;- for x in 0..w {- let i = ((y * w + x) * 4) as usize;- f.push(rgba[i + 2]);- f.push(rgba[i + 1]);- f.push(rgba[i]);- written += 3;- }- while written < row {- f.push(0);- written += 1;- }- }- fs::write(path, f).expect("write bmp");-}--fn main() {- let t = 0.5f32;- let padding = 45.0f32;-- // --- decode one real frame from each source ---- let screen_rgba = decode_frame("../poc/media/screen.mp4", "0.5", SCREEN_W, SCREEN_H, "screen.rgba");- let webcam_rgba = decode_frame("../poc/media/webcam.mp4", "0.5", WEBCAM_W, WEBCAM_H, "webcam.rgba");-- // --- wgpu init (native: Vulkan/D3D12/Metal under the hood) ---- let instance = wgpu::Instance::new(wgpu::InstanceDescriptor::default());- let adapter = pollster::block_on(instance.request_adapter(&wgpu::RequestAdapterOptions {- power_preference: wgpu::PowerPreference::HighPerformance,- ..Default::default()- }))- .expect("no GPU adapter");- let info = adapter.get_info();- println!("native gpu: {} ({:?}, backend {:?})", info.name, info.device_type, info.backend);- let (device, queue) = pollster::block_on(adapter.request_device(- &wgpu::DeviceDescriptor { label: None, required_features: wgpu::Features::empty(), required_limits: wgpu::Limits::default(), memory_hints: wgpu::MemoryHints::Performance },- None,- ))- .expect("no device");-- let screen_view = make_texture(&device, &queue, SCREEN_W, SCREEN_H, &screen_rgba, "screen");- let webcam_view = make_texture(&device, &queue, WEBCAM_W, WEBCAM_H, &webcam_rgba, "webcam");- let sampler = device.create_sampler(&wgpu::SamplerDescriptor {- mag_filter: wgpu::FilterMode::Linear,- min_filter: wgpu::FilterMode::Linear,- ..Default::default()- });-- // --- uniforms: evaluate() at t=0.5 ---- let (screen, webcam) = base_layout(padding);- let cam_aspect = WEBCAM_W as f32 / WEBCAM_H as f32;- let cur_x = screen.x + 0.52 * screen.w;- let cur_y = screen.y + 0.90 * screen.h;- let cur_size = OUT_H as f32 * 0.05;- let uniforms = Uniforms {- a: [OUT_W as f32, OUT_H as f32, t, 28.0],- screen: [screen.x, screen.y, screen.w, screen.h],- webcam: [webcam.x, webcam.y, webcam.w, webcam.h],- fx: [0.7, 0.0, 16.0, 22.0],- b: [webcam.w.min(webcam.h) / 2.0, 0.0, cam_aspect, 0.0],- mb: [0.0, 0.0, 0.0, 0.0],- cursor: [cur_x, cur_y, cur_size, 1.0],- cursor_fx: [0.0, 0.0, 1.0, 0.0],- };- let ubuf = device.create_buffer(&wgpu::BufferDescriptor {- label: Some("uniforms"),- size: std::mem::size_of::<Uniforms>() as u64,- usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,- mapped_at_creation: false,- });- queue.write_buffer(&ubuf, 0, bytemuck::bytes_of(&uniforms));-- // --- pipeline ---- let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {- label: Some("composite"),- source: wgpu::ShaderSource::Wgsl(include_str!("composite.wgsl").into()),- });- let format = wgpu::TextureFormat::Rgba8Unorm;- let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {- label: Some("composite"),- layout: None,- vertex: wgpu::VertexState { module: &shader, entry_point: "vs", buffers: &[], compilation_options: Default::default() },- fragment: Some(wgpu::FragmentState {- module: &shader,- entry_point: "fs",- targets: &[Some(wgpu::ColorTargetState { format, blend: None, write_mask: wgpu::ColorWrites::ALL })],- compilation_options: Default::default(),- }),- primitive: wgpu::PrimitiveState::default(),- depth_stencil: None,- multisample: wgpu::MultisampleState::default(),- multiview: None,- cache: None,- });-- let target = device.create_texture(&wgpu::TextureDescriptor {- label: Some("target"),- size: wgpu::Extent3d { width: OUT_W, height: OUT_H, depth_or_array_layers: 1 },- mip_level_count: 1,- sample_count: 1,- dimension: wgpu::TextureDimension::D2,- format,- usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_SRC,- view_formats: &[],- });- let target_view = target.create_view(&wgpu::TextureViewDescriptor::default());-- let bind = device.create_bind_group(&wgpu::BindGroupDescriptor {- label: None,- layout: &pipeline.get_bind_group_layout(0),- entries: &[- wgpu::BindGroupEntry { binding: 0, resource: ubuf.as_entire_binding() },- wgpu::BindGroupEntry { binding: 1, resource: wgpu::BindingResource::Sampler(&sampler) },- wgpu::BindGroupEntry { binding: 2, resource: wgpu::BindingResource::TextureView(&screen_view) },- wgpu::BindGroupEntry { binding: 3, resource: wgpu::BindingResource::TextureView(&webcam_view) },- ],- });-- // --- render ---- let mut enc = device.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());- {- let mut pass = enc.begin_render_pass(&wgpu::RenderPassDescriptor {- label: None,- color_attachments: &[Some(wgpu::RenderPassColorAttachment {- view: &target_view,- resolve_target: None,- ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), store: wgpu::StoreOp::Store },- })],- depth_stencil_attachment: None,- timestamp_writes: None,- occlusion_query_set: None,- });- pass.set_pipeline(&pipeline);- pass.set_bind_group(0, &bind, &[]);- pass.draw(0..3, 0..1);- }-- // --- readback → BMP ---- let bpr = ((OUT_W * 4 + 255) & !255) as u64; // 256-aligned- let rbuf = device.create_buffer(&wgpu::BufferDescriptor {- label: Some("readback"),- size: bpr * OUT_H as u64,- usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::MAP_READ,- mapped_at_creation: false,- });- enc.copy_texture_to_buffer(- wgpu::ImageCopyTexture { texture: &target, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All },- wgpu::ImageCopyBuffer { buffer: &rbuf, layout: wgpu::ImageDataLayout { offset: 0, bytes_per_row: Some(bpr as u32), rows_per_image: Some(OUT_H) } },- wgpu::Extent3d { width: OUT_W, height: OUT_H, depth_or_array_layers: 1 },- );- queue.submit([enc.finish()]);-- let slice = rbuf.slice(..);- slice.map_async(wgpu::MapMode::Read, |r| r.unwrap());- device.poll(wgpu::Maintain::Wait);- let mapped = slice.get_mapped_range();- // Un-pad the 256-aligned rows into tight RGBA.- let mut tight = vec![0u8; (OUT_W * OUT_H * 4) as usize];- for y in 0..OUT_H {- let src = (y as u64 * bpr) as usize;- let dst = (y * OUT_W * 4) as usize;- tight[dst..dst + (OUT_W * 4) as usize].copy_from_slice(&mapped[src..src + (OUT_W * 4) as usize]);- }- write_bmp("out.bmp", OUT_W, OUT_H, &tight);- println!("wrote out.bmp — composited natively at t={t}s");-}diff --git a/poc/composite.wgsl b/poc/composite.wgsldeleted file mode 100644index 72b11af1d..000000000--- a/poc/composite.wgsl+++ /dev/null@@ -1,378 +0,0 @@-// The compositor. Two sources, one layout, three effects — written from zero.-//-// Drawn the way a game draws: one quad per element, sized to the element. The-// rasterizer then runs the fragment shader ONLY on the pixels that element-// covers, and clips whatever falls outside the frame — for free, in fixed-// function, with no branch. A zoomed recording is 2.7x the stage: two thirds of-// it is off-screen and costs nothing.-//-// The alternative — one fullscreen triangle with `if`s — pays for every pixel of-// every effect and then throws most of it away. That is what the first version of-// this file did.-//-// Everything is a pure function of the uniforms. No cache: a shader recomputes-// every pixel every frame, which is the point of the paradigm.--struct U {- // stage.xy | unused | screenRadius- a : vec4f,- // screenRect: x, y, w, h — already carries the zoom (scale + pan)- screen : vec4f,- // webcamRect: x, y, w, h — already carries the layout animation- webcam : vec4f,- // shadowIntensity | bgBlurPx | shadowOffsetY | shadowSpread- fx : vec4f,- // webcamRadius | unused | webcamCoverScale | optimised(0/1)- b : vec4f,- // Directional motion blur, in pixels: screenBlur.xy | webcamBlur.xy. A vector,- // not a scalar — the recording smears along the camera's real travel, which- // during a pan or a layout move is not horizontal.- mb : vec4f,- // The cursor, drawn synthetically from the recorded trace: x | y | size |- // opacity. Position is in stage pixels, already carried through the zoom.- cursor : vec4f,- // cursorBlur.xy | clickScale | unused. clickScale pulses on a real click.- cursorFx : vec4f,-};--@group(0) @binding(0) var<uniform> u : U;-@group(0) @binding(1) var samp : sampler;-@group(0) @binding(2) var screenTex : texture_external;-@group(0) @binding(3) var webcamTex : texture_external;-@group(0) @binding(4) var bgTex : texture_2d<f32>;--struct VsOut {- @builtin(position) pos : vec4f,- // Stage-space uv (0..1 across the OUTPUT), not the quad's own uv: the fragment- // shaders all reason in stage pixels, and the quad is only there to bound them.- @location(0) uv : vec2f,-};--// ---- vertex: one quad per element --------------------------------------------/**- * Emit `rect` as two triangles in stage space.- *- * Clipping is the rasterizer's job: a rect that runs off the stage — every zoomed- * recording — is cut by fixed-function hardware before a single fragment is- * dispatched.- */-fn quad(vi : u32, rect : vec4f) -> VsOut {- var corners = array<vec2f, 6>(- vec2f(0.0, 0.0), vec2f(1.0, 0.0), vec2f(0.0, 1.0),- vec2f(0.0, 1.0), vec2f(1.0, 0.0), vec2f(1.0, 1.0),- );- let c = corners[vi];- let px = rect.xy + c * rect.zw;- var out : VsOut;- out.pos = vec4f(px.x / u.a.x * 2.0 - 1.0, 1.0 - px.y / u.a.y * 2.0, 0.0, 1.0);- out.uv = px / u.a.xy;- return out;-}--@vertex fn vsFull(@builtin(vertex_index) i : u32) -> VsOut {- return quad(i, vec4f(0.0, 0.0, u.a.x, u.a.y));-}--@vertex fn vsScreen(@builtin(vertex_index) i : u32) -> VsOut {- return quad(i, u.screen);-}--/** The shadow's quad: the rect grown by 3σ, the Gaussian's reach. */-@vertex fn vsScreenShadow(@builtin(vertex_index) i : u32) -> VsOut {- let s = u.fx.w * 3.0 + 1.0;- return quad(i, vec4f(u.screen.xy - vec2f(s), u.screen.zw + vec2f(s * 2.0)) + vec4f(0.0, u.fx.z, 0.0, 0.0));-}--@vertex fn vsWebcam(@builtin(vertex_index) i : u32) -> VsOut {- return quad(i, u.webcam);-}--@vertex fn vsWebcamShadow(@builtin(vertex_index) i : u32) -> VsOut {- let s = u.fx.w * 3.0 + 1.0;- return quad(i, vec4f(u.webcam.xy - vec2f(s), u.webcam.zw + vec2f(s * 2.0)) + vec4f(0.0, u.fx.z, 0.0, 0.0));-}--/** The cursor's quad: its box, grown for the shadow, the click bounce and the smear. */-@vertex fn vsCursor(@builtin(vertex_index) i : u32) -> VsOut {- let size = u.cursor.z;- let pad = 6.0 + length(u.cursorFx.xy);- let rect = vec4f(u.cursor.xy - vec2f(pad), vec2f(size * 1.5 + pad * 2.0));- return quad(i, rect);-}--// ---- geometry -----------------------------------------------------------------/** Signed distance to a rounded box. Negative inside. */-fn sdRoundBox(p : vec2f, half : vec2f, r : f32) -> f32 {- let rr = min(r, min(half.x, half.y));- let q = abs(p) - half + vec2f(rr);- return length(max(q, vec2f(0.0))) + min(max(q.x, q.y), 0.0) - rr;-}--/** Antialiased coverage from a signed distance: one pixel of ramp. */-fn cover(d : f32) -> f32 {- return clamp(0.5 - d, 0.0, 1.0);-}--// ---- effect 1: the background -----------------------------------------------//-// A blurred gradient, baked into a texture ONCE by fsBake. The frame reads one-// texel — and only where the recording does not already cover it.-//-// It was 16 gradient evaluations per pixel per frame, every one recomputing a-// CONSTANT. This is not the shadow cache in disguise, and the difference is the-// whole argument: a cache guesses that its input has not changed and needs a key-// to find out. This has no key because it has no input — the background IS a-// constant. The shadow follows the camera, so it gets no such luxury.--fn gradient(uv : vec2f) -> vec3f {- let a = vec3f(0.06, 0.11, 0.24);- let b = vec3f(0.35, 0.12, 0.42);- let c = vec3f(0.02, 0.35, 0.38);- let w = 0.5 + 0.5 * sin(uv.x * 2.0);- return mix(mix(a, b, uv.y), c, w * 0.45);-}--fn blurredGradient(uv : vec2f) -> vec3f {- let radiusPx = u.fx.y;- if (radiusPx < 0.5) {- return gradient(uv);- }- let px = radiusPx / u.a.xy;- var acc = vec3f(0.0);- let taps = 16;- let golden = 2.39996;- for (var i = 0; i < taps; i = i + 1) {- let fi = f32(i);- let r = sqrt((fi + 0.5) / f32(taps));- let a = fi * golden;- acc = acc + gradient(uv + vec2f(cos(a), sin(a)) * r * px);- }- return acc / f32(taps);-}--/** Init only. */-@fragment fn fsBake(in : VsOut) -> @location(0) vec4f {- return vec4f(blurredGradient(in.uv), 1.0);-}--/** Per frame: one texel — or the naive 16 taps, for the A/B. */-@fragment fn fsBackground(in : VsOut) -> @location(0) vec4f {- if (u.b.w > 0.5) {- return vec4f(textureSampleLevel(bgTex, samp, in.uv, 0.0).rgb, 1.0);- }- return vec4f(blurredGradient(in.uv), 1.0);-}--// ---- effect 2: the drop shadow -----------------------------------------------//-// A REAL Gaussian, computed analytically — not sampled.-//-// The wrong way (what this replaced): sample the rounded-box SDF at a ring of-// offsets and average. Few taps band into visible rings, many taps are slow, and-// neither is a Gaussian — it is a box blur of a hard mask. It looked like stacked-// translucent rectangles because that is exactly what it was.-//-// The right way (Evan Wallace, "Fast Rounded Rectangle Shadows"): the convolution-// of a 2D Gaussian with a box is separable and each axis is an integral of the-// Gaussian — which is the error function, erf. So a plain box shadow is a closed-// form, no samples at all: `(erf(right) - erf(left)) * (erf(top) - erf(bottom))`.-// Rounded corners break separability only near the corner, so the x extent is-// integrated against the Gaussian in y over a handful of steps — the exact-// profile, smoothly weighted, no banding. O(1) per pixel and beautiful.--const SQRT_2PI = 2.5066282746310002;-const INV_SQRT_2 = 0.7071067811865476;--fn gauss1(x : f32, sigma : f32) -> f32 {- return exp(-(x * x) / (2.0 * sigma * sigma)) / (SQRT_2PI * sigma);-}--/** erf, componentwise (Abramowitz & Stegun 7.1.27). Max error ~5e-4. */-fn erf2(x : vec2f) -> vec2f {- let s = sign(x);- let a = abs(x);- var r = 1.0 + (0.278393 + (0.230389 + 0.078108 * (a * a)) * a) * a;- r = r * r;- return s - s / (r * r);-}--/** Fraction of a Gaussian-blurred box covering x, at height y, with rounded corners. */-fn shadowRowX(x : f32, y : f32, sigma : f32, corner : f32, half : vec2f) -> f32 {- // How far the rounded corner pulls the edge in at this height.- let d = min(half.y - corner - abs(y), 0.0);- let curved = half.x - corner + sqrt(max(0.0, corner * corner - d * d));- let integral = 0.5 + 0.5 * erf2((x + vec2f(-curved, curved)) * (INV_SQRT_2 / sigma));- return integral.y - integral.x;-}--fn shadowAt(px : vec2f, rect : vec4f, radius : f32, intensity : f32) -> f32 {- if (intensity <= 0.0) {- return 0.0;- }- let sigma = max(u.fx.w, 0.5);- let half = rect.zw * 0.5;- let corner = min(radius, min(half.x, half.y));- // Offset the shadow down by u.fx.z, like a light from above.- let p = px - (rect.xy + half + vec2f(0.0, u.fx.z));-- // Integrate the x-profile against the Gaussian in y, over ±3σ clamped to the- // box — four steps is plenty because each is analytic in x.- let low = p.y - half.y;- let high = p.y + half.y;- let start = clamp(-3.0 * sigma, low, high);- let end = clamp(3.0 * sigma, low, high);- let step = (end - start) / 4.0;- var y = start + step * 0.5;- var value = 0.0;- for (var i = 0; i < 4; i = i + 1) {- value = value + shadowRowX(p.x, p.y - y, sigma, corner, half) * gauss1(y, sigma) * step;- y = y + step;- }- return clamp(value, 0.0, 1.0) * intensity;-}--@fragment fn fsScreenShadow(in : VsOut) -> @location(0) vec4f {- return vec4f(0.0, 0.0, 0.0, shadowAt(in.uv * u.a.xy, u.screen, u.a.w, u.fx.x));-}--@fragment fn fsWebcamShadow(in : VsOut) -> @location(0) vec4f {- return vec4f(0.0, 0.0, 0.0, shadowAt(in.uv * u.a.xy, u.webcam, u.b.x, u.fx.x * 0.8));-}--// ---- effect 3: the masks + the sources ----------------------------------------/**- * The recording, smeared along the camera's travel while it moves.- *- * The blur is a VECTOR now (u.mb.xy): a pan or a layout move sends the camera- * diagonally, and a horizontal-only smear would be wrong for exactly the motion a- * screen demo has most of. Skipped at rest — a branch is free next to seven- * fetches, and it is uniform across the frame.- */-fn sampleScreen(px : vec2f, blur : vec2f) -> vec3f {- let uv0 = (px - u.screen.xy) / max(u.screen.zw, vec2f(1.0));- if (length(blur) < 0.5) {- return textureSampleBaseClampToEdge(screenTex, samp, clamp(uv0, vec2f(0.0), vec2f(1.0))).rgb;- }- var acc = vec3f(0.0);- let taps = 7;- for (var i = 0; i < taps; i = i + 1) {- let t = (f32(i) / f32(taps - 1)) - 0.5;- let uv = ((px + blur * t) - u.screen.xy) / max(u.screen.zw, vec2f(1.0));- acc = acc + textureSampleBaseClampToEdge(screenTex, samp, clamp(uv, vec2f(0.0), vec2f(1.0))).rgb;- }- return acc / f32(taps);-}--@fragment fn fsScreen(in : VsOut) -> @location(0) vec4f {- let px = in.uv * u.a.xy;- let c = cover(sdRoundBox(px - (u.screen.xy + u.screen.zw * 0.5), u.screen.zw * 0.5, u.a.w));- if (c <= 0.0) {- discard;- }- return vec4f(sampleScreen(px, u.mb.xy), c);-}--// ---- the cursor --------------------------------------------------------------//-// Drawn from the recorded trace, per frame — never baked into the video. A-// polygon SDF, so it is a shape the shader computes, not a sprite it samples; the-// real app swaps theme PNGs in here, which is a texture read in the same quad,-// not a different pipeline. The hard parts a POC has to prove are all here: it-// follows the zoom (its position rides the screen rect), it bounces on a real-// click (clickScale), it casts a shadow, and it smears when it moves fast.--/** Signed distance to the classic arrow pointer, tip at local (0,0). Neg inside. */-fn sdCursor(p : vec2f) -> f32 {- var v = array<vec2f, 7>(- vec2f(0.00, 0.00), vec2f(0.00, 1.00), vec2f(0.24, 0.76),- vec2f(0.40, 1.14), vec2f(0.56, 1.07), vec2f(0.39, 0.69), vec2f(0.70, 0.69),- );- var d = dot(p - v[0], p - v[0]);- var s = 1.0;- for (var i = 0; i < 7; i = i + 1) {- let j = (i + 6) % 7;- let e = v[j] - v[i];- let w = p - v[i];- let b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);- d = min(d, dot(b, b));- // Winding test. The three conditions are kept as scalars, not packed into a- // vec3<bool>: the `>` inside that constructor is parsed as a template close.- let c0 = p.y >= v[i].y;- let c1 = p.y < v[j].y;- let c2 = e.x * w.y > e.y * w.x;- if ((c0 && c1 && c2) || (!c0 && !c1 && !c2)) { s = -s; }- }- return s * sqrt(d);-}--/** Signed distance to the arrow at a stage pixel, in px, with the click bounce. */-fn cursorSD(px : vec2f) -> f32 {- // Scale about the tip (local origin) so a click bounce pulls toward the- // hotspot, not the centre. 1.2 fits the 0..1.14 arrow inside the quad.- let s = u.cursor.z / 1.2;- let local = (px - u.cursor.xy) / max(s, 1.0) / u.cursorFx.z;- return sdCursor(local) * s * u.cursorFx.z;-}--@fragment fn fsCursor(in : VsOut) -> @location(0) vec4f {- let px = in.uv * u.a.xy;- let blur = u.cursorFx.xy;- let outline = max(u.cursor.z * 0.05, 1.5); // the arrow's own black rim, in px-- // Fill (white interior) and outline (interior + rim) coverage, both smeared- // along the travel when the cursor moves fast. No drop shadow — the contrast on- // a light page is the rim, which is part of the pointer, not a cast shadow.- var fill = 0.0;- var edge = 0.0;- let moving = length(blur) >= 0.5;- let taps = select(1, 5, moving);- for (var i = 0; i < taps; i = i + 1) {- let t = select(0.0, (f32(i) / f32(taps - 1)) - 0.5, moving);- let d = cursorSD(px + blur * t);- fill = fill + cover(d);- edge = edge + cover(d - outline);- }- fill = fill / f32(taps);- edge = edge / f32(taps);-- // White inside, fading to a black rim; `edge` carries the opacity so the rim is- // solid. The click bounce is already baked into cursorSD.- let rgb = vec3f(fill / max(edge, 1e-4));- return vec4f(rgb, edge * u.cursor.w);-}--/**- * The webcam's mask, morphing with the layout animation: radius drives the shape,- * circle when docked and rounded rect when grown. The SDF interpolates the SHAPE- * for free — a tessellated 2D mask would rebuild geometry every frame for this.- */-fn sampleWebcam(px : vec2f, centre : vec2f) -> vec3f {- var uv = (px - centre) / max(u.webcam.zw, vec2f(1.0));- // Cover-fit: a 4:3 source in a square hole would squash without this.- uv = uv * vec2f(u.b.z, 1.0) + vec2f(0.5);- return textureSampleBaseClampToEdge(webcamTex, samp, clamp(uv, vec2f(0.0), vec2f(1.0))).rgb;-}--@fragment fn fsWebcam(in : VsOut) -> @location(0) vec4f {- let px = in.uv * u.a.xy;- let centre = u.webcam.xy + u.webcam.zw * 0.5;- let c = cover(sdRoundBox(px - centre, u.webcam.zw * 0.5, u.b.x));- if (c <= 0.0) {- discard;- }- // Smear along its travel during a layout move, exactly like the recording.- let blur = u.mb.zw;- if (length(blur) < 0.5) {- return vec4f(sampleWebcam(px, centre), c);- }- var acc = vec3f(0.0);- let taps = 5;- for (var i = 0; i < taps; i = i + 1) {- let t = (f32(i) / f32(taps - 1)) - 0.5;- acc = acc + sampleWebcam(px + blur * t, centre);- }- return vec4f(acc / f32(taps), c);-}diff --git a/poc/index.html b/poc/index.htmldeleted file mode 100644index a72fe2ccf..000000000--- a/poc/index.html+++ /dev/null@@ -1,88 +0,0 @@-<!doctype html>-<html lang="fr">- <head>- <meta charset="utf-8" />- <title>POC full-shader — 2 sources, 1 layout, 3 effets</title>- <style>- body {- font-family: ui-sans-serif, system-ui, sans-serif;- background: #14141a;- color: #e8e8ee;- margin: 0;- padding: 24px;- }- h1 { font-size: 17px; font-weight: 500; margin: 0 0 4px; }- .sub { color: #8b8b9a; font-size: 13px; margin: 0 0 20px; }- .row { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }- label { font-size: 12px; color: #8b8b9a; display: block; margin-bottom: 4px; }- input { width: 70px; background: #22222c; color: #e8e8ee; border: 1px solid #33333f; border-radius: 6px; padding: 6px 8px; font-size: 13px; }- button { background: #3d7dff; color: #fff; border: 0; border-radius: 6px; padding: 9px 18px; font-size: 13px; font-weight: 500; cursor: pointer; }- button:disabled { background: #33333f; color: #6a6a78; cursor: default; }- .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 18px; }- .stat { background: #1c1c24; border-radius: 8px; padding: 12px 14px; }- .stat .k { font-size: 11px; color: #8b8b9a; text-transform: uppercase; letter-spacing: 0.04em; }- .stat .v { font-size: 22px; font-weight: 500; margin-top: 3px; }- .hero .v { color: #4ade80; font-size: 32px; }- pre { background: #1c1c24; border-radius: 8px; padding: 14px; font-size: 12px; line-height: 1.55; min-height: 90px; overflow-x: auto; margin: 0 0 18px; }- video, canvas { width: 100%; max-width: 860px; border-radius: 8px; display: block; background: #000; }- canvas { margin-bottom: 14px; }- a { color: #3d7dff; font-size: 13px; }- </style>- </head>- <body>- <h1>POC full-shader — 2 sources, 1 layout, 3 effets</h1>- <p class="sub">- écran + webcam → un programme WGSL (flou, ombre, masque) → mp4. Aucun Electron, aucun- code de l'app.- </p>-- <div class="row">- <div><label for="seconds">secondes</label><input id="seconds" type="number" value="4" min="1" max="30" /></div>- <div><label for="padding">padding</label><input id="padding" type="number" value="45" min="0" max="90" /></div>- <div><label for="shadow">ombre</label><input id="shadow" type="number" value="0.65" min="0" max="1" step="0.05" /></div>- <div><label for="blur">flou fond (px)</label><input id="blur" type="number" value="40" min="0" max="200" /></div>- <div>- <label for="instrument">instrumenté</label>- <input id="instrument" type="checkbox" checked style="width: auto" />- </div>- <div>- <label for="optimise">optimisé</label>- <input id="optimise" type="checkbox" checked style="width: auto" />- </div>- <button id="run">Lancer</button>- </div>-- <div class="row" style="border-top: 1px solid #2a2a34; padding-top: 16px;">- <div>- <label for="compareMode">comparer</label>- <select id="compareMode" style="width: auto; min-width: 210px; background: #22222c; color: #e8e8ee; border: 1px solid #33333f; border-radius: 6px; padding: 6px 8px; font-size: 13px;">- <option value="pipeline">Pipeline : bufférisé vs sérialisé</option>- <option value="perf">Perf : optimisé vs naïf</option>- <option value="encode">Encodage : avec vs sans</option>- <option value="effects">Effets : activés vs coupés</option>- <option value="instruments">Mesure : instrumenté vs propre</option>- </select>- </div>- <button id="compare" style="background: #22222c; border: 1px solid #33333f">- Comparer A/B (8 exports)- </button>- <span id="compareNote" style="font-size: 12px; color: #8b8b9a; align-self: center;"></span>- </div>-- <div class="stats">- <div class="stat hero"><div class="k">fps</div><div class="v" id="fps">—</div></div>- <div class="stat"><div class="k">par image</div><div class="v" id="perframe">—</div></div>- <div class="stat"><div class="k">composite</div><div class="v" id="render">—</div></div>- <div class="stat"><div class="k">décodage</div><div class="v" id="decode">—</div></div>- <div class="stat"><div class="k">encodage</div><div class="v" id="encode">—</div></div>- <div class="stat"><div class="k">frames</div><div class="v" id="progress">—</div></div>- </div>-- <pre id="log"></pre>- <canvas id="stage"></canvas>- <video id="result" controls hidden></video>- <a id="download" hidden>télécharger poc.mp4</a>-- <script type="module" src="./main.js"></script>- </body>-</html>diff --git a/poc/main.js b/poc/main.jsdeleted file mode 100644index a7b06d654..000000000--- a/poc/main.js+++ /dev/null@@ -1,962 +0,0 @@-// POC: two videos, one layout, three effects, full shader. Standalone.-//-// No Electron, no app code, no old paradigm: decode (mediabunny) → WebGPU →-// encode (mediabunny) → an mp4 you can watch, and one number: fps.-//-// The layout is 40 lines of arithmetic written here, not imported: the point is-// to prove the paradigm reconstructs the product, not to reuse what exists.--import {- ALL_FORMATS,- BufferTarget,- Input,- Mp4OutputFormat,- Output,- UrlSource,- VideoSampleSink,-} from "mediabunny";--const OUT = { width: 1920, height: 1080, fps: 30 };-const log = (msg) => {- document.querySelector("#log").textContent += `${msg}\n`;-};-const setStat = (id, value) => {- document.querySelector(`#${id}`).textContent = value;-};--// ---- evaluate: (scene, t) → the frame's geometry. Written from zero. ---------//-// Pure arithmetic, no GPU, no canvas. Everything the shader needs is decided-// here, so the same function can drive a preview later without a second-// implementation to keep in sync.--const easeInOut = (x) => (x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2);--/** Ramp 0→1→0 across a region, eased in and out over `ramp` seconds. */-function regionStrength(t, start, end, ramp) {- if (t <= start || t >= end) return 0;- const inRamp = Math.min(1, (t - start) / ramp);- const outRamp = Math.min(1, (end - t) / ramp);- return easeInOut(Math.min(inRamp, outRamp));-}--const lerp = (a, b, t) => a + (b - a) * t;-const clampAbs = (x, m) => Math.max(-m, Math.min(m, x));-const lerpRect = (a, b, t) => ({- x: lerp(a.x, b.x, t),- y: lerp(a.y, b.y, t),- w: lerp(a.w, b.w, t),- h: lerp(a.h, b.h, t),-});--/** The base layout: recording centred with padding, webcam docked bottom-right. */-function baseLayout(stage, padding) {- const s = 1 - (padding / 100) * 0.4;- const w = stage.width * s;- const h = stage.height * s;- const screen = { x: (stage.width - w) / 2, y: (stage.height - h) / 2, w, h };- const size = Math.round(stage.height * 0.22);- const margin = Math.round(stage.height * 0.04);- const webcam = {- x: stage.width - size - margin,- y: stage.height - size - margin,- w: size,- h: size,- };- return { screen, webcam };-}--/**- * The whole timeline of this POC, as data.- *- * Two things move, and they are the two the product actually has:- * - a ZOOM on the recording: scale + focus point, eased in and out;- * - a LAYOUT ANIMATION on the webcam: it grows from the docked bubble to a- * large panel and its shape morphs from circle to rounded rect on the way.- */-function scene(stage, padding) {- return {- stage,- padding,- zooms: [- { start: 1.0, end: 3.2, scale: 1.7, focus: { x: 0.62, y: 0.42 }, ramp: 0.55 },- { start: 4.4, end: 6.5, scale: 2.3, focus: { x: 0.3, y: 0.7 }, ramp: 0.5 },- ],- layoutMoves: [{ start: 2.4, end: 5.0, ramp: 0.6 }],- };-}--function evaluate(sc, t, prev) {- const base = baseLayout(sc.stage, sc.padding);-- // --- zoom: strongest region wins, eased ---- let zoomScale = 1;- let focus = { x: 0.5, y: 0.5 };- let strength = 0;- for (const z of sc.zooms) {- const s = regionStrength(t, z.start, z.end, z.ramp);- if (s > strength) {- strength = s;- zoomScale = lerp(1, z.scale, s);- focus = z.focus;- }- }- // Scale about the focus point, then keep the recording covering the stage:- // a zoom that reveals the background behind the video is a bug, not a look.- const fx = base.screen.x + base.screen.w * focus.x;- const fy = base.screen.y + base.screen.h * focus.y;- const screen = {- x: fx - (fx - base.screen.x) * zoomScale,- y: fy - (fy - base.screen.y) * zoomScale,- w: base.screen.w * zoomScale,- h: base.screen.h * zoomScale,- };-- // --- layout animation: the webcam grows into a panel and un-rounds ---- let move = 0;- for (const m of sc.layoutMoves) {- move = Math.max(move, regionStrength(t, m.start, m.end, m.ramp));- }- const panelW = Math.round(sc.stage.width * 0.34);- const panelH = Math.round(panelW * 0.75);- const margin = Math.round(sc.stage.height * 0.04);- const panel = {- x: sc.stage.width - panelW - margin,- y: sc.stage.height - panelH - margin,- w: panelW,- h: panelH,- };- const webcam = lerpRect(base.webcam, panel, move);- // Circle when docked (radius = half the bubble), rounded rect when grown.- const webcamRadius = lerp(Math.min(base.webcam.w, base.webcam.h) / 2, 26, move);-- // --- motion blur: a VECTOR, along the camera's real travel ---- // The recording smears along how its centre moved since last frame, plus a- // term for the zoom scaling the content outward. A pan is diagonal; a- // horizontal-only smear would be wrong for most of what a screen demo does.- const cx = screen.x + screen.w / 2;- const cy = screen.y + screen.h / 2;- const wcx = webcam.x + webcam.w / 2;- const wcy = webcam.y + webcam.h / 2;- let screenBlur = { x: 0, y: 0 };- let webcamBlur = { x: 0, y: 0 };- if (prev) {- const k = 0.9;- screenBlur = {- x: clampAbs((cx - prev.cx) * k, 22),- y: clampAbs((cy - prev.cy) * k, 22),- };- webcamBlur = {- x: clampAbs((wcx - prev.wcx) * k, 18),- y: clampAbs((wcy - prev.wcy) * k, 18),- };- }-- return {- screen,- webcam,- webcamRadius,- zoomScale,- screenBlur,- webcamBlur,- memo: { cx, cy, wcx, wcy },- };-}--// ---- the cursor: from the recorded trace, drawn synthetically ----------------//-// The real product records positions + clicks and draws the cursor each frame-// from that data — never baked into the video. This loads a REAL trace (the one-// shipped with the screen recording) so the POC exercises the actual shape of the-// data: normalised positions at irregular timestamps, and click/mouseup events.--async function loadCursor(url) {- const doc = await (await fetch(url)).json();- // Dedup by timestamp (the trace repeats samples) and sort.- const byTime = new Map();- for (const s of doc.samples) byTime.set(s.timeMs, s);- const samples = [...byTime.values()].sort((a, b) => a.timeMs - b.timeMs);- const clicks = doc.samples.filter((s) => s.interactionType === "click").map((s) => s.timeMs);- return { samples, clicks };-}--/** Position (normalised to the recording) and click bounce at time t. */-function cursorAt(trace, timeMs) {- const s = trace.samples;- if (s.length === 0) return null;- // Linear scan is fine at ~290 samples; a binary search is the same code later.- let i = 0;- while (i < s.length - 1 && s[i + 1].timeMs <= timeMs) i++;- const a = s[i];- const b = s[Math.min(i + 1, s.length - 1)];- const span = b.timeMs - a.timeMs;- const f = span > 0 ? Math.max(0, Math.min(1, (timeMs - a.timeMs) / span)) : 0;-- // Click bounce: the pointer dips to 0.82 and springs back over ~140 ms after a- // real click — the same cue the app gives, driven by the recorded event.- let clickScale = 1;- for (const c of trace.clicks) {- const dt = timeMs - c;- if (dt >= 0 && dt < 140) {- const p = dt / 140;- clickScale = 1 - 0.18 * Math.sin(p * Math.PI);- }- }-- return {- cx: lerp(a.cx, b.cx, f),- cy: lerp(a.cy, b.cy, f),- visible: a.visible !== false,- clickScale,- };-}--// ---- decode ------------------------------------------------------------------async function openVideo(url) {- const input = new Input({ source: new UrlSource(url), formats: ALL_FORMATS });- const track = await input.getPrimaryVideoTrack();- if (!track) throw new Error(`no video track in ${url}`);- const sink = new VideoSampleSink(track);- return { input, track, sink };-}--// ---- run ---------------------------------------------------------------------async function run(override = {}) {- const started = performance.now();- // A hidden tab is a throttled tab. Chromium de-prioritises everything in one —- // the GPU work included — and clamps chained timers to a second. Measured- // here: the same code that cruises at 58 fps visible reports 6.0 fps hidden,- // on BOTH arms, with a 401% spread. Every number taken from a background tab- // is fiction, so this refuses rather than reports.- if (document.hidden) {- throw new Error(- "tab is hidden — Chromium throttles background tabs. Bring it to the front and re-run.",- );- }- document.querySelector("#run").disabled = true;- log("opening sources…");-- const [screen, webcam, cursor] = await Promise.all([- openVideo("media/screen.mp4"),- openVideo("media/webcam.mp4"),- loadCursor("media/cursor.json"),- ]);- log(`cursor: ${cursor.samples.length} samples, ${cursor.clicks.length} clicks`);- const seconds = Number(document.querySelector("#seconds").value);- const screenDuration = await screen.track.computeDuration();- const duration = Math.min(seconds, screenDuration);- const totalFrames = Math.floor(duration * OUT.fps);- log(- `screen ${screen.track.displayWidth}x${screen.track.displayHeight} · ${screenDuration.toFixed(1)}s`,- );- log(`webcam ${webcam.track.displayWidth}x${webcam.track.displayHeight}`);- log(`rendering ${totalFrames} frames @ ${OUT.fps}fps (${duration.toFixed(1)}s)`);-- // ---- GPU ----- if (!navigator.gpu) throw new Error("WebGPU unavailable");- const adapter = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" });- // timestamp-query is the only honest way to price the shader: a CPU timer- // around submit() measures SUBMISSION, and the work lands on whoever syncs- // next. These are counters the GPU writes itself, around the pass.- const canTimestamp = adapter.features.has("timestamp-query");- const device = await adapter.requestDevice({- requiredFeatures: canTimestamp ? ["timestamp-query"] : [],- });- const info = adapter.info ?? {};- log(`gpu: ${info.vendor ?? "?"} ${info.architecture ?? ""} · timestamps: ${canTimestamp}`);-- const querySet = canTimestamp ? device.createQuerySet({ type: "timestamp", count: 2 }) : null;- const resolveBuffer = canTimestamp- ? device.createBuffer({- size: 16,- usage: GPUBufferUsage.QUERY_RESOLVE | GPUBufferUsage.COPY_SRC,- })- : null;- const readBuffer = canTimestamp- ? device.createBuffer({ size: 16, usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ })- : null;-- // OffscreenCanvas: no document, no presentation, no compositor.- //- // This is a measurement decision, not a detail. A canvas in the page is- // PRESENTED every frame — the browser composites 2 Mpx into the layout and the- // swapchain waits on the display's refresh. Measured here: 34.9 ms/frame of- // fixed cost with every effect switched OFF, eight times the effects- // themselves. An export presents nothing to anyone, so a measurement that pays- // for presentation is measuring a different program.- const canvas = new OffscreenCanvas(OUT.width, OUT.height);- const ctx = canvas.getContext("webgpu");- const format = navigator.gpu.getPreferredCanvasFormat();- ctx.configure({ device, format, alphaMode: "opaque" });-- const previewCanvas = document.querySelector("#stage");- previewCanvas.width = 640;- previewCanvas.height = 360;- const preview = previewCanvas.getContext("2d");-- const code = await (await fetch("composite.wgsl")).text();- const module = device.createShaderModule({ code });- device.pushErrorScope("validation");-- // One explicit layout for every pass, so a shader that happens not to sample- // bgTex does not silently get a different bind group. `auto` derives the- // layout from what the entry point USES, which makes the layout an accident of- // dead-code elimination.- const bindGroupLayout = device.createBindGroupLayout({- entries: [- { binding: 0, visibility: GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT, buffer: {} },- { binding: 1, visibility: GPUShaderStage.FRAGMENT, sampler: {} },- { binding: 2, visibility: GPUShaderStage.FRAGMENT, externalTexture: {} },- { binding: 3, visibility: GPUShaderStage.FRAGMENT, externalTexture: {} },- { binding: 4, visibility: GPUShaderStage.FRAGMENT, texture: {} },- ],- });- const pipelineLayout = device.createPipelineLayout({ bindGroupLayouts: [bindGroupLayout] });-- // Straight-alpha "over": the compositor's only blend.- const OVER = {- color: { srcFactor: "src-alpha", dstFactor: "one-minus-src-alpha", operation: "add" },- alpha: { srcFactor: "one", dstFactor: "one-minus-src-alpha", operation: "add" },- };- const makePass = (vs, fs, blend) =>- device.createRenderPipeline({- label: fs,- layout: pipelineLayout,- vertex: { module, entryPoint: vs },- fragment: { module, entryPoint: fs, targets: [{ format, ...(blend ? { blend } : {}) }] },- primitive: { topology: "triangle-list" },- });-- // Five passes, each a quad sized to its element. The rasterizer clips whatever- // leaves the stage — which, during a zoom, is most of the recording.- const passes = {- background: makePass("vsFull", "fsBackground", null),- screenShadow: makePass("vsScreenShadow", "fsScreenShadow", OVER),- screen: makePass("vsScreen", "fsScreen", OVER),- webcamShadow: makePass("vsWebcamShadow", "fsWebcamShadow", OVER),- webcam: makePass("vsWebcam", "fsWebcam", OVER),- cursor: makePass("vsCursor", "fsCursor", OVER),- };-- // The bake runs before any video exists, so it gets a layout of its own: the- // uniforms and nothing else.- const bakeLayout = device.createBindGroupLayout({- entries: [- { binding: 0, visibility: GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT, buffer: {} },- ],- });- const bgPipeline = device.createRenderPipeline({- label: "bake",- layout: device.createPipelineLayout({ bindGroupLayouts: [bakeLayout] }),- vertex: { module, entryPoint: "vsFull" },- fragment: { module, entryPoint: "fsBake", targets: [{ format: "rgba8unorm" }] },- primitive: { topology: "triangle-list" },- });- const bgTexture = device.createTexture({- size: [OUT.width, OUT.height],- format: "rgba8unorm",- usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,- });- const shaderError = await device.popErrorScope();- if (shaderError) throw new Error(`shader: ${shaderError.message}`);-- const sampler = device.createSampler({ magFilter: "linear", minFilter: "linear" });- // 5 vec4 = 80 bytes. All-vec4 on purpose: WGSL pads mixed structs and the CPU- // packing has to reproduce the holes exactly — get one offset wrong and the- // shader reads a radius where a rect belongs, draws nothing, and reports no- // error at all.- const uniforms = new Float32Array(32);- const uniformBuffer = device.createBuffer({- size: uniforms.byteLength,- usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,- });-- // ---- encode ----- const output = new Output({ format: new Mp4OutputFormat(), target: new BufferTarget() });- const { CanvasSource, QUALITY_HIGH } = await import("mediabunny");- const source = new CanvasSource(canvas, { codec: "avc", bitrate: QUALITY_HIGH });- output.addVideoTrack(source, { frameRate: OUT.fps });- await output.start();-- const sc = scene(OUT, Number(document.querySelector("#padding").value));- // effectsOn === false forces the effects OFF (not just absent) so the "effects- // on vs off" comparison isolates their cost against the same everything-else.- const effectsOn = override.effectsOn ?? true;- const shadowIntensity = effectsOn ? Number(document.querySelector("#shadow").value) : 0;- const bgBlur = effectsOn ? Number(document.querySelector("#blur").value) : 0;- const camAspect = webcam.track.displayWidth / webcam.track.displayHeight;- let memo = null;- let curMemo = null;-- // Bake the background. Once, here — not 210 times inside the loop.- uniforms.set([OUT.width, OUT.height, 0, 0], 0);- uniforms.set([shadowIntensity, bgBlur, 16, 22], 12);- device.queue.writeBuffer(uniformBuffer, 0, uniforms);- {- const enc = device.createCommandEncoder();- const pass = enc.beginRenderPass({- colorAttachments: [- {- view: bgTexture.createView(),- clearValue: { r: 0, g: 0, b: 0, a: 1 },- loadOp: "clear",- storeOp: "store",- },- ],- });- pass.setPipeline(bgPipeline);- pass.setBindGroup(- 0,- device.createBindGroup({- layout: bakeLayout,- entries: [{ binding: 0, resource: { buffer: uniformBuffer } }],- }),- );- pass.draw(3);- pass.end();- device.queue.submit([enc.finish()]);- }-- // ---- decode: forward streams, not seeks ----- // getSample(t) per frame is a random-access SEEK per frame: on a long-GOP- // screen recording that means re-decoding from the last keyframe, every time.- // Measured at 122 ms/frame — 3x the cost of everything else combined. These- // videos are read start to end, so read them start to end: two generators,- // each advanced to the frame the output clock is asking for.- const screenStream = screen.sink.samples(0, duration);- const webcamStream = webcam.sink.samples(0, duration);- const nextFrom = async (stream, holder, t) => {- // Advance while the NEXT sample still starts at or before t.- while (- !holder.done &&- (!holder.current || holder.current.timestamp + holder.current.duration <= t)- ) {- const { value, done } = await stream.next();- if (done) {- holder.done = true;- break;- }- holder.current?.close();- holder.current = value;- }- return holder.current ?? null;- };- const screenHolder = { current: null, done: false };- const webcamHolder = { current: null, done: false };-- // ---- the loop ----- // Every phase is timed on its own, and the whole frame is recorded, because- // two questions need different data: "what does a frame cost once warm" is a- // distribution, not a mean, and "where does the frame go" is a breakdown.- //- // INSTRUMENTED vs CLEAN, because the instruments are not free and two of them- // change the very thing they measure:- // - onSubmittedWorkDone() per frame is a FENCE. It is the only way to bill- // the GPU honestly, and it also forbids decode/composite/encode from ever- // overlapping — a cost the real loop would not pay.- // - mapAsync() to read the timestamps is a GPU→CPU sync, per frame.- // So the clean pass keeps the same work and drops both, and fps is compared- // across the two. If they disagree, the breakdown describes a program that- // only exists while being measured.- const instrumented = override.instrumented ?? document.querySelector("#instrument").checked;- const optimised = override.optimised ?? document.querySelector("#optimise").checked;- const encodeOn = override.encode ?? true;- // How many encodes may be in flight before composite blocks.- //- // Default 1 (serialised) BECAUSE IT IS FASTER HERE, measured: buffered depth-4- // throughput 49 fps vs serialised 79 fps on this iGPU (spread 7-11%, so real).- // §11's "pipeline, don't await" assumed overlap helps; on an integrated GPU the- // compositor and the hardware H.264 encoder share one memory bus, so running- // them at once makes them contend rather than parallelise — serialising lets- // each have the full bandwidth in turn. The pipeline stays reachable- // (queueDepth override) because a DISCRETE GPU, with its own VRAM and separate- // encoder silicon, may flip the result — untested (that is bench G3).- const queueDepth = instrumented ? 1 : (override.queueDepth ?? 1);- const inflight = [];- const frames = [];- const t0 = performance.now();- // The steady-state window starts after the first quarter (warm-up). We time it- // on the WALL, from here to after the final drain+flush — not per loop- // iteration — because with the pipeline the loop does not wait for the work:- // submit() is non-blocking and encode is only awaited on backpressure. A- // per-frame timer then measures an empty loop distributing orders (naive- // composite is slower, so it feeds the encoder slower, so the loop blocks LESS- // and reads FASTER — 588 fps of nothing). True throughput is frames ÷ the wall- // until they have actually completed, which finalize() forces.- const warmStart = Math.ceil(totalFrames / 4);- let warmWall = 0;- let rendered = 0;-- for (let i = 0; i < totalFrames; i++) {- if (i === warmStart) warmWall = performance.now();- const t = i / OUT.fps;- const fStart = performance.now();- const p = {};- const mark = () => (instrumented ? performance.now() : 0);-- let m = mark();- const screenSample = await nextFrom(screenStream, screenHolder, t);- const webcamSample = await nextFrom(webcamStream, webcamHolder, t);- p.decode = mark() - m;- if (!screenSample) break;-- // toVideoFrame + importExternalTexture: the decode→GPU seam. Timed apart- // because "zero copy" is a claim, and this is where it would fail.- m = mark();- const screenFrame = screenSample.toVideoFrame();- const webcamFrame = webcamSample ? webcamSample.toVideoFrame() : null;- const screenTex = device.importExternalTexture({ source: screenFrame });- const webcamTex = device.importExternalTexture({ source: webcamFrame ?? screenFrame });- p.import = mark() - m;-- m = mark();- const f = evaluate(sc, t, memo);- memo = f.memo;-- // The cursor: interpolate the recorded trace, then place it in the SCREEN's- // coordinate space, so it rides the zoom for free — its position is carried- // through the same rect the recording is.- const cur = cursorAt(cursor, t * 1000);- const curX = f.screen.x + (cur?.cx ?? 0) * f.screen.w;- const curY = f.screen.y + (cur?.cy ?? 0) * f.screen.h;- const curSize = OUT.height * 0.05;- let curBlurX = 0;- let curBlurY = 0;- if (cur && curMemo) {- curBlurX = clampAbs((curX - curMemo.x) * 0.8, 30);- curBlurY = clampAbs((curY - curMemo.y) * 0.8, 30);- }- curMemo = cur ? { x: curX, y: curY } : null;- const curVisible = !!cur && cur.visible;-- // Field n at float 4n — the struct is all-vec4 so this stays true.- uniforms.set([OUT.width, OUT.height, t, 28], 0); // stage | time | radius- uniforms.set([f.screen.x, f.screen.y, f.screen.w, f.screen.h], 4);- uniforms.set([f.webcam.x, f.webcam.y, f.webcam.w, f.webcam.h], 8);- uniforms.set([shadowIntensity, bgBlur, 16, 22], 12); // intensity | bgBlur | shadowOffsetY | sigma- uniforms.set([f.webcamRadius, 0, camAspect, optimised ? 1 : 0], 16); // radius | - | coverScale | opt- uniforms.set([f.screenBlur.x, f.screenBlur.y, f.webcamBlur.x, f.webcamBlur.y], 20); // mb- uniforms.set([curX, curY, curSize, curVisible ? 1 : 0], 24); // cursor- uniforms.set([curBlurX, curBlurY, cur?.clickScale ?? 1, 0], 28); // cursorFx- device.queue.writeBuffer(uniformBuffer, 0, uniforms);- const bind = device.createBindGroup({- layout: bindGroupLayout,- entries: [- { binding: 0, resource: { buffer: uniformBuffer } },- { binding: 1, resource: sampler },- { binding: 2, resource: screenTex },- { binding: 3, resource: webcamTex },- { binding: 4, resource: bgTexture.createView() },- ],- });- p.evaluate = mark() - m;-- m = mark();- const encoder = device.createCommandEncoder();- const view = ctx.getCurrentTexture().createView();- p.acquire = mark() - m;-- m = mark();- const useQueries = instrumented && querySet;- const pass = encoder.beginRenderPass({- colorAttachments: [- { view, clearValue: { r: 0, g: 0, b: 0, a: 1 }, loadOp: "clear", storeOp: "store" },- ],- ...(useQueries- ? { timestampWrites: { querySet, beginningOfPassWriteIndex: 0, endOfPassWriteIndex: 1 } }- : {}),- });- // CULLING, on the CPU, before anything is submitted.- //- // The cheapest fragment is the one never dispatched. Two tests, both from- // the rects evaluate() already produced:- // - the recording covers the stage (every zoom does): nothing underneath- // can show, so the background and its shadow are not drawn at all. The- // test insets by the corner radius, because a rounded corner is where- // the background WOULD peek through.- // - the webcam is entirely off-stage: it and its shadow are not drawn.- const r = f.screen;- const rad = 28;- const screenCoversStage =- optimised &&- r.x + rad <= 0 &&- r.y + rad <= 0 &&- r.x + r.w - rad >= OUT.width &&- r.y + r.h - rad >= OUT.height;- const w = f.webcam;- const webcamVisible =- !optimised || (w.x < OUT.width && w.y < OUT.height && w.x + w.w > 0 && w.y + w.h > 0);-- pass.setBindGroup(0, bind);- if (!screenCoversStage) {- pass.setPipeline(passes.background);- pass.draw(6);- pass.setPipeline(passes.screenShadow);- pass.draw(6);- }- pass.setPipeline(passes.screen);- pass.draw(6);- if (webcamVisible) {- pass.setPipeline(passes.webcamShadow);- pass.draw(6);- pass.setPipeline(passes.webcam);- pass.draw(6);- }- // The cursor, on top of everything — drawn each frame from the trace, culled- // when the recorded position is off-stage.- if (curVisible && curX > -curSize && curY > -curSize && curX < OUT.width && curY < OUT.height) {- pass.setPipeline(passes.cursor);- pass.draw(6);- }- pass.end();- if (useQueries) {- encoder.resolveQuerySet(querySet, 0, 2, resolveBuffer, 0);- if (readBuffer.mapState === "unmapped")- encoder.copyBufferToBuffer(resolveBuffer, 0, readBuffer, 0, 16);- }- device.queue.submit([encoder.finish()]);- p.submit = mark() - m;-- // The fence: everything above only QUEUED work, this is where it executes.- // Instrumented only — it is what makes the breakdown honest, and it is also- // what stops the pipeline from overlapping anything.- if (instrumented) {- m = performance.now();- await device.queue.onSubmittedWorkDone();- p.fence = performance.now() - m;-- // What the GPU says about itself: the pass's duration in ns, written by- // the GPU around the pass. mapAsync is a GPU→CPU sync, so this too only- // exists while measuring.- if (querySet && readBuffer.mapState === "unmapped") {- await readBuffer.mapAsync(GPUMapMode.READ);- const ts = new BigUint64Array(readBuffer.getMappedRange().slice(0));- readBuffer.unmap();- p.gpuPass = Number(ts[1] - ts[0]) / 1e6;- }- }-- // ENCODE — pipelined, not awaited per frame.- //- // source.add snapshots the canvas synchronously (new VideoSample(canvas)),- // and everything rides one GPU queue, so submission order already guarantees- // each encoded frame reflects its own composite — no fence needed for- // correctness. Awaiting add() every frame only enforces BACKPRESSURE, and- // doing it per frame is what serialised the loop: composite waited on the- // encoder accepting the previous frame. Keep `queueDepth` frames in flight- // instead, so the hardware encoder runs concurrently with the next- // composite. This is §11 — pipeline, don't await.- m = mark();- if (encodeOn) {- const addP = source.add(t, 1 / OUT.fps);- if (queueDepth <= 1) {- await addP;- } else {- inflight.push(addP);- if (inflight.length >= queueDepth) await inflight.shift();- }- }- p.encode = mark() - m;-- // The decode VideoFrames are ours; the samples belong to the streams, which- // close them when they advance. Safe to close after submit: Chromium holds- // its own reference to an imported external texture until the submit that- // used it completes.- screenFrame.close();- webcamFrame?.close();-- p.total = performance.now() - fStart;- frames.push(p);- rendered++;- if (i % 15 === 0) {- setStat("progress", `${i}/${totalFrames}`);- // A 640px preview every 15 frames. OFF the clock — the frame's timer has- // already stopped — and it never touches the render path.- preview.drawImage(canvas, 0, 0, previewCanvas.width, previewCanvas.height);- // Yield through a MessageChannel, not setTimeout: a chained setTimeout is- // clamped to 1000 ms in a background tab, which would put eight seconds of- // pure waiting into a four-second export's wall.- await new Promise((r) => {- const ch = new MessageChannel();- ch.port1.onmessage = () => r();- ch.port2.postMessage(0);- });- }- }-- // Drain the encoder pipeline, then flush+mux: only after finalize() has all- // frames actually completed. The throughput window closes HERE, not at the end- // of the loop, because the loop returns before the GPU and the encoder are- // done.- if (inflight.length) await Promise.all(inflight);- await output.finalize();- const endWall = performance.now();- const wallMs = endWall - t0;- // The honest steady-state throughput: frames rendered after warm-up, over the- // wall time until they are fully composited, encoded and muxed.- const warmFrames = rendered - warmStart;- const throughputFps =- warmWall > 0 ? warmFrames / ((endWall - warmWall) / 1000) : rendered / (wallMs / 1000);-- // ---- report ----- //- // Average fps answers "how long did THIS export take". Cruise fps answers "how- // fast does it run" — the number that compares across exports. A short export- // amortises the first frames' one-off costs (pipeline warm-up, first- // allocations, JIT) over few frames, so the mean drags. Both are reported, and- // the gap between them IS the startup cost.- const median = (xs) => {- const s = [...xs].sort((a, b) => a - b);- return s.length % 2 ? s[(s.length - 1) / 2] : (s[s.length / 2 - 1] + s[s.length / 2]) / 2;- };- const totals = frames.map((f) => f.total);- // Cruise = the steady state: drop the first quarter, then take the MEDIAN, so- // one scheduler hiccup cannot move the number.- const warm = frames.slice(warmStart);- const cruiseMs = median(warm.map((f) => f.total));- const cruiseFps = 1000 / cruiseMs;- const avgFps = rendered / (wallMs / 1000);-- // Throughput is the headline. Cruise (per-frame loop time) is kept for the- // instrumented breakdown, where the fence makes each iteration wait for its own- // work — there it equals throughput; under the pipeline it does not.- setStat("fps", throughputFps.toFixed(1));- setStat("progress", `${rendered}/${totalFrames}`);- setStat("perframe", `${(1000 / throughputFps).toFixed(1)} ms`);- // `?? 0`: the clean pass has no phase timers by construction — that is what- // makes it clean. Reading them back as undefined is not an error, it is the- // point.- setStat("render", instrumented ? `${median(warm.map((f) => f.fence ?? 0)).toFixed(1)} ms` : "—");- setStat("decode", instrumented ? `${median(warm.map((f) => f.decode ?? 0)).toFixed(1)} ms` : "—");- setStat("encode", instrumented ? `${median(warm.map((f) => f.encode ?? 0)).toFixed(1)} ms` : "—");-- log(- `\n=== [${instrumented ? "INSTRUMENTED" : "CLEAN"}] throughput ${throughputFps.toFixed(1)} fps — ${warmFrames} frames in ${((endWall - warmWall) / 1000).toFixed(2)}s (wall, incl. drain+mux) ===`,- );- log(- `per-loop cruise ${cruiseFps.toFixed(1)} fps (${cruiseMs.toFixed(1)} ms) — under the pipeline this measures the LOOP, not completion; throughput above is the honest number.`,- );- log(- `average ${avgFps.toFixed(1)} fps over all ${rendered} frames (${(wallMs / 1000).toFixed(2)}s wall)`,- );- log(- `first frames: ${totals- .slice(0, 4)- .map((x) => `${x.toFixed(0)}ms`)- .join(" · ")}`,- );- const drag = totals.reduce((a, b) => a + b, 0) - cruiseMs * totals.length;- log(- `one-off cost inside the loop: ${drag.toFixed(0)} ms total → ${(drag / rendered).toFixed(1)} ms/frame of drag on this export`,- );- log(- `setup before the loop: ${((t0 - started) / 1000).toFixed(2)}s (open sources, decoder init, pipeline, encoder)`,- );-- if (!instrumented) {- log("\n(clean pass: no fence, no timestamp readback, no phase timers.");- log(" fps is the only number this pass can honestly report — and it is the");- log(" one that says what the loop actually does when nobody is watching.)");- } else {- log("\n--- where a cruise frame goes (median ms) ---");- for (const k of ["decode", "import", "evaluate", "acquire", "submit", "fence", "encode"]) {- const v = median(warm.map((f) => f[k] ?? 0));- const pct = (v / cruiseMs) * 100;- log(- `${k.padEnd(9)}${v.toFixed(1).padStart(6)} ms ${"█".repeat(Math.round(pct / 2)).padEnd(50)}${pct.toFixed(0)}%`,- );- }- if (frames[0]?.gpuPass !== undefined) {- const gpu = median(warm.map((f) => f.gpuPass ?? 0));- log(`\nGPU pass itself: ${gpu.toFixed(2)} ms — measured BY the GPU, around the pass.`);- log(- `${(cruiseMs - gpu).toFixed(1)} ms of the ${cruiseMs.toFixed(1)} ms frame is not the shader.`,- );- }- log("\nNOTE: this pass paid for its own instruments — a fence and a buffer map");- log("per frame. Re-run with `instrumenté` off: if the fps moves, the breakdown");- log("above describes a program that only exists while being measured.");- }-- const blob = new Blob([output.target.buffer], { type: "video/mp4" });- const url = URL.createObjectURL(blob);- const player = document.querySelector("#result");- player.src = url;- player.hidden = false;- const dl = document.querySelector("#download");- dl.href = url;- dl.download = "poc.mp4";- dl.hidden = false;-- // On disk too: a blob URL dies with the tab, and the output has to be- // watchable outside this page.- const written = await fetch("/save?name=poc.mp4", { method: "POST", body: blob }).then((r) =>- r.text(),- );- log(`output: ${(blob.size / 1e6).toFixed(1)} MB → ${written}`);-- // Give it ALL back. A run that leaks its device is a run that poisons the next- // one: six back-to-back runs kept six GPU devices, six decoder pipelines and- // six encoders alive, and the rate decayed 19.9 → 8.6 → 7.5 fps across an- // interleaved comparison. That decay is not the machine drifting, it is this- // function forgetting — and it invalidated the very A/B it was there to serve.- screenHolder.current?.close();- webcamHolder.current?.close();- await screenStream.return?.();- await webcamStream.return?.();- screen.input.dispose();- webcam.input.dispose();- bgTexture.destroy();- device.destroy();-- document.querySelector("#run").disabled = false;- return { cruiseMs, cruiseFps, avgFps, throughputFps, instrumented };-}--/**- * Interleaved A/B/A/B, because an effect can only be told apart from drift.- *- * Two identical runs measured 34.8 and 28.3 fps on this machine — 23% apart,- * which is the size of the effects under test. Sequential arms therefore prove- * nothing: they alternate so drift shows up as a run disagreeing with its OWN- * repeat instead of masquerading as the change. Same rule, and same reason, as- * the app's export bench.- *- * Both shader variants live in the same module, chosen by a uniform, so the two- * arms differ by that uniform and nothing else — no reload, no recompile, no- * second session.- */-// Every A/B this POC can run, each naming EXACTLY the two things it compares and-// what one run() override turns one arm into the other. Each holds everything-// else fixed, so the difference is the named lever and nothing else.-const COMPARISONS = {- perf: {- title: "Perf : optimisé vs naïf",- a: { label: "optimisé", over: { optimised: true, instrumented: false } },- b: { label: "naïf", over: { optimised: false, instrumented: false } },- note: "fond cuit + culling, vs fond recalculé + tout dessiné. Même image.",- },- effects: {- title: "Effets : activés vs coupés",- a: { label: "effets ON", over: { effectsOn: true, optimised: true, instrumented: false } },- b: { label: "effets OFF", over: { effectsOn: false, optimised: true, instrumented: false } },- note: "ombre + flou de fond présents, vs à zéro. Le prix des effets eux-mêmes.",- },- pipeline: {- title: "Pipeline : bufférisé vs sérialisé",- a: { label: "bufférisé", over: { queueDepth: 4, instrumented: false, optimised: true } },- b: { label: "sérialisé", over: { queueDepth: 1, instrumented: false, optimised: true } },- note: "encodage recouvert (4 en vol) vs attendu à chaque image. Le levier §11.",- },- encode: {- title: "Encodage : avec vs sans",- a: { label: "avec encodage", over: { encode: true, instrumented: false, optimised: true } },- b: { label: "sans encodage", over: { encode: false, instrumented: false, optimised: true } },- note: "compose + encode vs compose seul. Ce que coûte l'encodeur matériel.",- },- instruments: {- title: "Mesure : instrumenté vs propre",- a: { label: "instrumenté", over: { instrumented: true, optimised: true } },- b: { label: "propre", over: { instrumented: false, optimised: true } },- note: "fence + lecture des timestamps par image, vs rien. Le coût de la mesure.",- },-};--/**- * Interleaved A/B/A/B, because an effect can only be told apart from drift.- *- * Two identical runs measured 34.8 and 28.3 fps on this machine — 23% apart,- * which is the size of the effects under test. Sequential arms therefore prove- * nothing: they alternate so drift shows up as a run disagreeing with its OWN- * repeat instead of masquerading as the change. Same rule, and same reason, as- * the app's export bench. The shader variants all live in one module, chosen by a- * uniform, so an arm differs from its pair by that uniform and nothing else.- */-async function compare(rounds = 3) {- const spec = COMPARISONS[document.querySelector("#compareMode").value] ?? COMPARISONS.perf;- const median = (xs) => {- const s = [...xs].sort((a, b) => a - b);- return s.length % 2 ? s[(s.length - 1) / 2] : (s[s.length / 2 - 1] + s[s.length / 2]) / 2;- };- const spread = (xs) => (Math.max(...xs) - Math.min(...xs)) / median(xs);- const arms = [- { ...spec.a, runs: [] },- { ...spec.b, runs: [] },- ];-- // Round 0 is thrown away. Both arms climb monotonically across the first- // rounds — 15.0 → 28.4 → 33.3 — which is the browser and the GPU waking up,- // not the arms differing. Keeping it put a 64% spread on a 23% effect and- // voided the comparison by itself.- for (let r = 0; r <= rounds; r++) {- for (const arm of arms) {- const res = await run(arm.over);- if (r > 0) arm.runs.push(res.throughputFps);- }- }-- document.querySelector("#log").textContent = "";- log(`=== ${spec.title} — A/B interleavé, ${rounds} tours + 1 chauffe ===`);- log(`${spec.note}\n`);- for (const arm of arms) {- log(- `${arm.label.padEnd(13)} débit ${median(arm.runs).toFixed(1).padStart(5)} fps spread ${(spread(arm.runs) * 100).toFixed(0)}% ${arm.runs.map((x) => x.toFixed(1)).join(" / ")}`,- );- }- const [A, B] = arms;- const gain = median(A.runs) - median(B.runs);- const gainPct = (gain / median(B.runs)) * 100;- const worst = Math.max(spread(A.runs), spread(B.runs)) * 100;- log(- `\n${A.label} vs ${B.label}: ${gain > 0 ? "+" : ""}${gain.toFixed(1)} fps (${gainPct.toFixed(0)}%)`,- );- // Two gates, not one. The old gate only checked spread against the EFFECT, so a- // big effect waved through big noise — a 66% spread "held" against a 205% gain- // while the tab was throttled and the arm swung 117→235 fps. An ABSOLUTE- // threshold catches that: above ~15% same-arm spread the machine is not steady- // enough to trust the magnitude, whatever the effect size. (The app's export- // bench uses 10%; this browser setup is noisier, so 15%.)- const SPREAD_LIMIT = 15;- if (worst >= SPREAD_LIMIT) {- log(- `\n!! VOID : spread intra-bras ${worst.toFixed(0)}% > ${SPREAD_LIMIT}% — la machine dérive.` +- `\n La DIRECTION peut tenir (regarde si un bras gagne à chaque tour), mais` +- `\n le CHIFFRE ne vaut rien. Ferme les autres apps GPU, secteur branché, refais.`,- );- } else if (worst >= Math.abs(gainPct)) {- log(`\n!! VOID : spread intra-bras ${worst.toFixed(0)}%, aussi grand que l'effet — run muet.`);- } else {- log(- `\nspread intra-bras ${worst.toFixed(0)}% < ${SPREAD_LIMIT}% et < l'effet — le résultat tient.`,- );- }- setStat("fps", median(A.runs).toFixed(1));-}--document.querySelector("#run").addEventListener("click", () => {- document.querySelector("#log").textContent = "";- run().catch((error) => {- log(`\nFAILED: ${error.message}`);- console.error(error);- document.querySelector("#run").disabled = false;- });-});--document.querySelector("#compare").addEventListener("click", () => {- document.querySelector("#log").textContent = "comparaison en cours, patientez…\n";- compare().catch((error) => {- log(`\nFAILED: ${error.message}`);- console.error(error);- document.querySelector("#run").disabled = false;- });-});--// Show the selected comparison's plain-language note next to the dropdown.-const modeSelect = document.querySelector("#compareMode");-const updateNote = () => {- document.querySelector("#compareNote").textContent = COMPARISONS[modeSelect.value]?.note ?? "";-};-modeSelect.addEventListener("change", updateNote);-updateNote();diff --git a/poc/vite.config.js b/poc/vite.config.jsdeleted file mode 100644index cc87d1305..000000000--- a/poc/vite.config.js+++ /dev/null@@ -1,39 +0,0 @@-import { mkdirSync, writeFileSync } from "node:fs";-import { dirname, join } from "node:path";-import { fileURLToPath } from "node:url";--const here = dirname(fileURLToPath(import.meta.url));--/**- * POST /save?name=x → poc/out/x.- *- * The output has to be watchable on disk, not just a blob URL that dies with the- * tab. Dev-only, and it writes exactly one directory.- */-const save = {- name: "poc-save",- configureServer(server) {- server.middlewares.use("/save", (req, res) => {- const name = new URL(req.url, "http://x").searchParams.get("name") ?? "out.bin";- const chunks = [];- req.on("data", (c) => chunks.push(c));- req.on("end", () => {- const body = Buffer.concat(chunks);- const dir = join(here, "out");- mkdirSync(dir, { recursive: true });- const file = join(dir, name.replace(/[^\w.-]/g, "_"));- writeFileSync(file, body);- console.log(`[poc] wrote ${file} (${body.length} bytes)`);- res.end(file);- });- });- },-};--// The POC serves itself. Nothing here knows about the app: no aliases, no-// electron plugin, no shared config — the isolation is the point.-export default {- root: here,- plugins: [save],- server: { port: 5210, strictPort: true },-};diff --git a/public/os-preview-sample.mp4 b/public/os-preview-sample.mp4deleted file mode 100644index 795ccf7d0..000000000Binary files a/public/os-preview-sample.mp4 and /dev/null differdiff --git a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/jfk.txt b/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/jfk.txtdeleted file mode 100644index 817720bca..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/jfk.txt+++ /dev/null@@ -1 +0,0 @@-And so, my fellow Americans: ask not what your country can do for you, ask what you can do for your country.diff --git a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_0.txt b/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_0.txtdeleted file mode 100644index 7bc870c13..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_0.txt+++ /dev/null@@ -1 +0,0 @@-MISTER QUILTER IS THE APOSTLE OF THE MIDDLE CLASSES AND WE ARE GLAD TO WELCOME HIS GOSPELdiff --git a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_1.txt b/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_1.txtdeleted file mode 100644index a913b570d..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_1.txt+++ /dev/null@@ -1 +0,0 @@-NOR IS MISTER QUILTER'S MANNER LESS INTERESTING THAN HIS MATTERdiff --git a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_2.txt b/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_2.txtdeleted file mode 100644index 441ca81b3..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_2.txt+++ /dev/null@@ -1 +0,0 @@-HE TELLS US THAT AT THIS FESTIVE SEASON OF THE YEAR WITH CHRISTMAS AND ROAST BEEF LOOMING BEFORE US SIMILES DRAWN FROM EATING AND ITS RESULTS OCCUR MOST READILY TO THE MINDdiff --git a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_3.txt b/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_3.txtdeleted file mode 100644index 58cd29c14..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_3.txt+++ /dev/null@@ -1 +0,0 @@-HE HAS GRAVE DOUBTS WHETHER SIR FREDERICK LEIGHTON'S WORK IS REALLY GREEK AFTER ALL AND CAN DISCOVER IN IT BUT LITTLE OF ROCKY ITHACAdiff --git a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_4.txt b/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_4.txtdeleted file mode 100644index 71c6cd642..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/librispeech_demo_4.txt+++ /dev/null@@ -1 +0,0 @@-LINNELL'S PICTURES ARE A SORT OF UP GUARDS AND AT EM PAINTINGS AND MASON'S EXQUISITE IDYLLS ARE AS NATIONAL AS A JINGO POEM MISTER BIRKET FOSTER'S LANDSCAPES SMILE AT ONE MUCH IN THE SAME WAY THAT MISTER CARKER USED TO FLASH HIS TEETH AND MISTER JOHN COLLIER GIVES HIS SITTER A CHEERFUL SLAP ON THE BACK BEFORE HE SAYS LIKE A SHAMPOOER IN A TURKISH BATH NEXT MANdiff --git a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/two-min-clip.txt b/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/two-min-clip.txtdeleted file mode 100644index 1cce31318..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/fixtures/refs/two-min-clip.txt+++ /dev/null@@ -1 +0,0 @@-MISTER QUILTER IS THE APOSTLE OF THE MIDDLE CLASSES AND WE ARE GLAD TO WELCOME HIS GOSPEL NOR IS MISTER QUILTER'S MANNER LESS INTERESTING THAN HIS MATTER HE TELLS US THAT AT THIS FESTIVE SEASON OF THE YEAR WITH CHRISTMAS AND ROAST BEEF LOOMING BEFORE US SIMILES DRAWN FROM EATING AND ITS RESULTS OCCUR MOST READILY TO THE MIND HE HAS GRAVE DOUBTS WHETHER SIR FREDERICK LEIGHTON'S WORK IS REALLY GREEK AFTER ALL AND CAN DISCOVER IN IT BUT LITTLE OF ROCKY ITHACA LINNELL'S PICTURES ARE A SORT OF UP GUARDS AND AT EM PAINTINGS AND MASON'S EXQUISITE IDYLLS ARE AS NATIONAL AS A JINGO POEM MISTER BIRKET FOSTER'S LANDSCAPES SMILE AT ONE MUCH IN THE SAME WAY THAT MISTER CARKER USED TO FLASH HIS TEETH AND MISTER JOHN COLLIER GIVES HIS SITTER A CHEERFUL SLAP ON THE BACK BEFORE HE SAYS LIKE A SHAMPOOER IN A TURKISH BATH NEXT MAN IT IS OBVIOUSLY UNNECESSARY FOR US TO POINT OUT HOW LUMINOUS THESE CRITICISMS ARE HOW DELICATE IN EXPRESSION ON THE GENERAL PRINCIPLES OF ART MISTER QUILTER WRITES WITH EQUAL LUCIDITY PAINTING HE TELLS US IS OF A DIFFERENT QUALITY TO MATHEMATICS AND FINISH IN ART IS ADDING MORE FACT AS FOR ETCHINGS THEY ARE OF TWO KINDS BRITISH AND FOREIGN HE LAMENTS MOST BITTERLY THE DIVORCE THAT HAS BEEN MADE BETWEEN DECORATIVE ART AND WHAT WE USUALLY CALL PICTURES MAKES THE CUSTOMARY APPEAL TO THE LAST JUDGMENT AND REMINDS US THAT IN THE GREAT DAYS OF ART MICHAEL ANGELO WAS THE FURNISHING UPHOLSTERER NEAR THE FIRE AND THE ORNAMENTS FRED BROUGHT HOME FROM INDIA ON THE MANTEL BOARD IN FACT HE IS QUITE SEVERE ON MISTER RUSKIN FOR NOT RECOGNISING THAT A PICTURE SHOULD DENOTE THE FRAILTY OF MAN AND REMARKS WITH PLEASING COURTESY AND FELICITOUS GRACE THAT MANY PHASES OF FEELING\ No newline at end of filediff --git a/tools/stt-eval/whispercpp-dtw-poc/harness/CMakeLists.txt b/tools/stt-eval/whispercpp-dtw-poc/harness/CMakeLists.txtdeleted file mode 100644index 63b44a345..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/harness/CMakeLists.txt+++ /dev/null@@ -1,91 +0,0 @@-# harness/CMakeLists.txt — build wcpp_dtw_bench_<backend> against the-# pre-built whisper.cpp variant. One binary per backend; same source file.-#-# Use:-# cmake -B harness/build -S harness \-# -DCMAKE_BUILD_TYPE=Release \-# -DWHISPER_CPU_DIR=tools/stt-eval/whispercpp-dtw-poc/build-cpu \-# [-DWHISPER_VULKAN_DIR=... ] \-# [-DWHISPER_CUDA_DIR=... ]-# cmake --build harness/build --config Release-#-# Only builds a backend if its directory is supplied AND the-# corresponding `whisper.dll`/`whisper.lib` pair is present. CUDA is-# skipped when nvidia-smi is not available (plan §3).--cmake_minimum_required(VERSION 3.20)-project(wcpp_dtw_bench CXX)--set(CMAKE_CXX_STANDARD 20)-set(CMAKE_CXX_STANDARD_REQUIRED ON)--# Default each backend to its POC layout, in-repo. Override with -DWHISPER_<X>_DIR.-if (NOT DEFINED WHISPER_CPU_DIR)- set(WHISPER_CPU_DIR "${CMAKE_CURRENT_LIST_DIR}/../build-cpu" CACHE PATH "")-endif()-if (NOT DEFINED WHISPER_VULKAN_DIR)- set(WHISPER_VULKAN_DIR "${CMAKE_CURRENT_LIST_DIR}/../build-vulkan" CACHE PATH "")-endif()-if (NOT DEFINED WHISPER_CUDA_DIR)- set(WHISPER_CUDA_DIR "${CMAKE_CURRENT_LIST_DIR}/../build-cuda" CACHE PATH "")-endif()--add_executable(wcpp_dtw_bench_cpu- wcpp_dtw_bench.cpp)-target_compile_definitions(wcpp_dtw_bench_cpu- PRIVATE WCPP_BACKEND="cpu")-target_include_directories(wcpp_dtw_bench_cpu PRIVATE- ${CMAKE_CURRENT_LIST_DIR}/../whisper.cpp/include- ${CMAKE_CURRENT_LIST_DIR}/../whisper.cpp/ggml/include- ${CMAKE_CURRENT_LIST_DIR}/../whisper.cpp/ggml/src)--# whisper.cpp produces a DLL named whisper.dll + import lib whisper.lib.-# The import lib is sufficient for static linkage; runtime needs whisper.dll.-# We do NOT use add_subdirectory() on whisper.cpp here — those builds-# already exist (see Phase 1 build scripts invoked from REPORT.md).-# The harness just links against the produced whisper.dll import lib.--# Concrete: find_library against <DIR>/src/whisper.lib (Windows layout-# produced by our cmake -G Ninja builds).-find_library(WHISPER_CPU_LIB- NAMES whisper.lib- PATHS "${WHISPER_CPU_DIR}/src" "${WHISPER_CPU_DIR}" "${WHISPER_CPU_DIR}/bin")-if (WHISPER_CPU_LIB)- target_link_libraries(wcpp_dtw_bench_cpu PRIVATE ${WHISPER_CPU_LIB})- message(STATUS "wcpp_dtw_bench_cpu -> ${WHISPER_CPU_LIB}")-else()- message(WARNING "whisper.lib (CPU) not found under ${WHISPER_CPU_DIR}; build-cpu first.")-endif()--# Optional Vulkan variant — built only if the lib is present in the dir.-find_library(WHISPER_VULKAN_LIB- NAMES whisper.lib- PATHS "${WHISPER_VULKAN_DIR}/src" "${WHISPER_VULKAN_DIR}" "${WHISPER_VULKAN_DIR}/bin")-if (WHISPER_VULKAN_LIB)- add_executable(wcpp_dtw_bench_vulkan wcpp_dtw_bench.cpp)- target_compile_definitions(wcpp_dtw_bench_vulkan PRIVATE WCPP_BACKEND="vulkan")- target_include_directories(wcpp_dtw_bench_vulkan PRIVATE- ${CMAKE_CURRENT_LIST_DIR}/../whisper.cpp/include- ${CMAKE_CURRENT_LIST_DIR}/../whisper.cpp/ggml/include- ${CMAKE_CURRENT_LIST_DIR}/../whisper.cpp/ggml/src)- target_link_libraries(wcpp_dtw_bench_vulkan PRIVATE ${WHISPER_VULKAN_LIB})- message(STATUS "wcpp_dtw_bench_vulkan -> ${WHISPER_VULKAN_LIB}")-endif()--# Optional CUDA variant — built only if the lib is present in the dir.-find_library(WHISPER_CUDA_LIB- NAMES whisper.lib- PATHS "${WHISPER_CUDA_DIR}/src" "${WHISPER_CUDA_DIR}" "${WHISPER_CUDA_DIR}/bin")-if (WHISPER_CUDA_LIB)- add_executable(wcpp_dtw_bench_cuda wcpp_dtw_bench.cpp)- target_compile_definitions(wcpp_dtw_bench_cuda PRIVATE WCPP_BACKEND="cuda")- target_include_directories(wcpp_dtw_bench_cuda PRIVATE- ${CMAKE_CURRENT_LIST_DIR}/../whisper.cpp/include- ${CMAKE_CURRENT_LIST_DIR}/../whisper.cpp/ggml/include- ${CMAKE_CURRENT_LIST_DIR}/../whisper.cpp/ggml/src)- target_link_libraries(wcpp_dtw_bench_cuda PRIVATE ${WHISPER_CUDA_LIB})- message(STATUS "wcpp_dtw_bench_cuda -> ${WHISPER_CUDA_LIB}")-endif()--# All whisper.cpp DLLs (one per backend) must be on PATH at run time.-# We emit a tiny script that copies them next to the harness binary after build.diff --git a/tools/stt-eval/whispercpp-dtw-poc/harness/analyze.mjs b/tools/stt-eval/whispercpp-dtw-poc/harness/analyze.mjsdeleted file mode 100644index 9115be1e9..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/harness/analyze.mjs+++ /dev/null@@ -1,50 +0,0 @@-// Analyze a ctranslate2-server /inference response: full text, word-timestamp-// sanity (monotonic, coverage vs clip duration), and basic stats.-import fs from "fs";--const [, , jsonPath, durationSec] = process.argv;-const d = JSON.parse(fs.readFileSync(jsonPath, "utf8"));-const dur = parseFloat(durationSec);--let text = "";-let words = [];-for (const seg of d.segments || []) {- text += seg.text;- for (const w of seg.words || []) words.push(w);-}--let monotonic = true;-let maxBacktrack = 0;-let coverageGaps = [];-for (let i = 1; i < words.length; i++) {- if (words[i].start < words[i - 1].start) {- monotonic = false;- maxBacktrack = Math.max(maxBacktrack, words[i - 1].start - words[i].start);- }- if (words[i].end < words[i].start) {- coverageGaps.push(`word[${i}] '${words[i].word}' end<start`);- }-}--const lastWordEnd = words.length ? words[words.length - 1].end : 0;-const zeroStartCount = words.filter((w, i) => i > 0 && w.start === 0).length;--console.log(- JSON.stringify(- {- detected_language: d.detected_language,- numSegments: (d.segments || []).length,- numWords: words.length,- text: text.trim(),- monotonic,- maxBacktrack,- lastWordEnd,- clipDuration: dur,- zeroStartCountExcludingFirst: zeroStartCount,- segmentsWithoutWords: (d.segments || []).filter((s) => !s.words || s.words.length === 0)- .length,- },- null,- 2,- ),-);diff --git a/tools/stt-eval/whispercpp-dtw-poc/harness/debug_jfk.mjs b/tools/stt-eval/whispercpp-dtw-poc/harness/debug_jfk.mjsdeleted file mode 100644index be88b80b8..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/harness/debug_jfk.mjs+++ /dev/null@@ -1,28 +0,0 @@-// debug_jfk.mjs — Compare wcpp-cpu-fp16 vs ct2-fp16 word-by-word for jfk.wav-import { promises as fs } from "node:fs";--const a = JSON.parse(- await fs.readFile("tools/stt-eval/whispercpp-dtw-poc/results/wcpp_cpu_fp16_jfk.json", "utf8"),-);-const b = JSON.parse(- await fs.readFile("tools/stt-eval/whispercpp-dtw-poc/results/ct2_fp16_jfk.json", "utf8"),-);-const wa = a.segments[0].words;-const wb = b.segments[0].words;-console.log("wcpp words:", wa.length, "ct2 words:", wb.length);-const maxN = Math.max(wa.length, wb.length);-for (let i = 0; i < maxN; i++) {- const aw = wa[i] || { word: "<eof>", start: 0, end: 0 };- const bw = wb[i] || { word: "<eof>", start: 0, end: 0 };- const dw = aw.end - aw.start,- dc = bw.end - bw.start;- const dStart = Math.abs(aw.start - bw.start) * 1000;- const dEnd = Math.abs(aw.end - bw.end) * 1000;- console.log(- ` ${String(i).padStart(2)} ` +- `wcpp=${aw.word.padEnd(15)}[${aw.start.toFixed(2)},${aw.end.toFixed(2)}] ` +- `ct2 =${bw.word.padEnd(15)}[${bw.start.toFixed(2)},${bw.end.toFixed(2)}] ` +- `Δs=${dStart.toFixed(0).padStart(5)}ms Δe=${dEnd.toFixed(0).padStart(5)}ms ` +- `wcpp_dur=${(dw * 1000).toFixed(0).padStart(5)}ms ct2_dur=${(dc * 1000).toFixed(0).padStart(5)}ms`,- );-}diff --git a/tools/stt-eval/whispercpp-dtw-poc/harness/extract_text.mjs b/tools/stt-eval/whispercpp-dtw-poc/harness/extract_text.mjsdeleted file mode 100644index c4f62ec10..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/harness/extract_text.mjs+++ /dev/null@@ -1,5 +0,0 @@-import fs from "fs";--const [, , jsonPath] = process.argv;-const d = JSON.parse(fs.readFileSync(jsonPath, "utf8"));-process.stdout.write((d.segments || []).map((s) => s.text).join(""));diff --git a/tools/stt-eval/whispercpp-dtw-poc/harness/run_ct2.mjs b/tools/stt-eval/whispercpp-dtw-poc/harness/run_ct2.mjsdeleted file mode 100644index fd5f37dd9..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/harness/run_ct2.mjs+++ /dev/null@@ -1,146 +0,0 @@-// run_ct2.mjs — Spawn the OpenScreen CT2 server, POST each fixture to /inference-// via curl.exe (multipart/form-data, field name 'file' — the server's-// ctranslate2-server/src/main.cpp endpoint reads req.files.find("file")),-// save the JSON responses and per-fixture wall-clock timings.-//-// Usage:-// node harness/run_ct2.mjs <results-dir> <mode:int8|fp16> <port> <model-dir> <fixture1> [fixture2] ...-//-// `mode` controls whether the server is launched with `--int8` or not.--import { spawn, spawnSync } from "node:child_process";-import { promises as fs } from "node:fs";-import http from "node:http";-import path from "node:path";-import process from "node:process";--const [, , resultsDir, modeArg, portArg, modelDir, ...fixtures] = process.argv;-if (!resultsDir || !modeArg || !portArg || !modelDir || fixtures.length === 0) {- process.stderr.write(- "usage: node run_ct2.mjs <results-dir> <int8|fp16> <port> <model-dir> <fixture.wav> [...]\n",- );- process.exit(2);-}-const mode = modeArg === "int8" ? "int8" : modeArg === "fp16" ? "fp16" : null;-if (!mode) {- process.stderr.write(`unknown mode "${modeArg}" (want int8 or fp16)\n`);- process.exit(2);-}-const port = Number.parseInt(portArg, 10);-const serverExe =- "C:/Users/camil/Documents/repos/openscreen-new/electron/native/bin/win32-x64/ctranslate2-server-ctranslate2-cpu.exe";--const args = ["--model", modelDir, "--port", String(port), "--host", "127.0.0.1"];-if (mode === "int8") args.push("--int8");--await fs.mkdir(resultsDir, { recursive: true });--const child = spawn(serverExe, args, { stdio: ["ignore", "pipe", "pipe"] });-child.stdout.on("data", (d) => process.stderr.write(`[ct2-server] ${d}`));-child.stderr.on("data", (d) => process.stderr.write(`[ct2-server] ${d}`));--const cleanup = () => {- try {- child.kill();- } catch {}- process.exit(1);-};-process.on("SIGINT", cleanup);-process.on("SIGTERM", cleanup);--async function waitForServer(timeoutMs = 30_000) {- const t0 = Date.now();- while (Date.now() - t0 < timeoutMs) {- const ok = await new Promise((resolve) => {- const req = http.request(- { method: "GET", host: "127.0.0.1", port, path: "/health" },- (res) => {- res.resume();- resolve(res.statusCode && res.statusCode < 500);- },- );- req.on("error", () => resolve(false));- req.end();- });- if (ok) return;- if (child.exitCode !== null) {- throw new Error(`server exited early with code ${child.exitCode}`);- }- await new Promise((r) => setTimeout(r, 200));- }- throw new Error(`server did not become ready within ${timeoutMs} ms`);-}--function postFixture(wavPath) {- return new Promise((resolve, reject) => {- const r = spawnSync(- "curl.exe",- [- "-s",- "-X",- "POST",- `-w`,- `\n%{time_total}`,- `http://127.0.0.1:${port}/inference`,- `-F`,- `file=@${wavPath}`,- `-F`,- `language=en`,- ],- { encoding: "utf8", maxBuffer: 500 * 1024 * 1024, timeout: 20 * 60 * 1000 },- );- if (r.status !== 0) {- reject(new Error(`curl status ${r.status}: ${r.stderr.slice(0, 400)}`));- return;- }- const lines = r.stdout.split("\n");- const time_total_str = lines.at(-1);- const body = lines.slice(0, -1).join("\n");- const time_total = Number.parseFloat(time_total_str);- if (!Number.isFinite(time_total)) {- reject(new Error(`bad time_total from curl: ${time_total_str}`));- return;- }- resolve({ body, time_total });- });-}--await waitForServer().catch((e) => {- process.stderr.write(`server failed to start: ${e.message}\n`);- cleanup();-});--const timingsPath = path.join(resultsDir, `timings_${mode}.tsv`);-const timingsLines = ["fixture\taudio_s\twallclock_s\trtf"];--for (const fixture of fixtures) {- const wavPath = path.resolve(fixture);- const name = path.basename(wavPath, path.extname(wavPath));- const stat = await fs.stat(wavPath);- const samples = stat.size / 2; // PCM16 mono ⇒ 2 bytes/sample- const audio_s = samples / 16000;-- let body;- let wall_s;- try {- ({ body, time_total: wall_s } = await postFixture(wavPath));- } catch (e) {- process.stderr.write(`FAIL ${name}: ${e.message}\n`);- continue;- }- const rtf = wall_s / audio_s;-- const outPath = path.join(resultsDir, `ct2_${mode}_${name}.json`);- await fs.writeFile(outPath, body);- timingsLines.push(`${name}\t${audio_s.toFixed(4)}\t${wall_s.toFixed(4)}\t${rtf.toFixed(4)}`);- process.stdout.write(- `ct2 ${mode} ${name}: wall=${wall_s.toFixed(3)}s audio=${audio_s.toFixed(3)}s rtf=${rtf.toFixed(3)}\n`,- );-}--await fs.writeFile(timingsPath, timingsLines.join("\n") + "\n");-process.stdout.write(`wrote ${timingsPath}\n`);--child.kill();-await new Promise((r) => setTimeout(r, 200));-process.exit(0);diff --git a/tools/stt-eval/whispercpp-dtw-poc/harness/run_wcpp.mjs b/tools/stt-eval/whispercpp-dtw-poc/harness/run_wcpp.mjsdeleted file mode 100644index 8c5f31b38..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/harness/run_wcpp.mjs+++ /dev/null@@ -1,70 +0,0 @@-// run_wcpp.mjs — Spawn wcpp_dtw_bench_<backend>, write JSON (UTF-8),-// then run analyze.mjs and extract_text.mjs and save artefacts.-//-// Usage:-// node harness/run_wcpp.mjs <results-dir> <backend:cpu|vulkan|cuda>-// <model.bin> <path/to/wcpp_dtw_bench_<backend>>-// <fixture.wav> [...]--import { spawn, spawnSync } from "node:child_process";-import { promises as fs } from "node:fs";-import path from "node:path";-import process from "node:process";--const [, , resultsDir, backend, modelPath, benchExe, ...fixtures] = process.argv;-if (!resultsDir || !backend || !modelPath || !benchExe || fixtures.length === 0) {- process.stderr.write(- "usage: node run_wcpp.mjs <results-dir> <backend> <model.bin> <bench-exe> <fixture.wav> [...]\n",- );- process.exit(2);-}--const precTag = modelPath.includes("q8_0") ? "q8_0" : "fp16";-await fs.mkdir(resultsDir, { recursive: true });--const timingsPath = path.join(resultsDir, `timings_wcpp_${backend}_${precTag}.tsv`);-const lines = ["fixture\taudio_s\twallclock_s\trtf"];--for (const fixture of fixtures) {- const wav = path.resolve(fixture);- const name = path.basename(wav, path.extname(wav));- const stat = await fs.stat(wav);- const audio_s = stat.size / 2 / 16000; // PCM16 mono-- const r = spawnSync(benchExe, [modelPath, wav], {- encoding: "buffer",- maxBuffer: 500 * 1024 * 1024,- timeout: 30 * 60 * 1000,- });- const stderr = r.stderr.toString("utf8");- const stdout = r.stdout;- const guardrailLine =- stderr- .split(/\r?\n/)- .reverse()- .find((l) => l.includes("§4.1 guardrail")) || "(no guardrail line in stderr)";- if (r.status !== 0) {- process.stderr.write(`FAIL ${name}: exit ${r.status} — ${guardrailLine}\n${stderr}`);- continue;- }-- const jsonPath = path.join(resultsDir, `wcpp_${backend}_${precTag}_${name}.json`);- await fs.writeFile(jsonPath, stdout);- // We trust the harness's own elapsed_s — read it from JSON. `rtf` below is- // recomputed from it rather than taken from the report.- let wall_s = NaN;- try {- const parsed = JSON.parse(stdout.toString("utf8"));- wall_s = parsed.timing?.elapsed_s ?? NaN;- } catch (e) {- process.stderr.write(`WARN ${name}: JSON parse failed: ${e.message}\n`);- }- const rtf = Number.isFinite(wall_s) && audio_s > 0 ? wall_s / audio_s : NaN;- lines.push(`${name}\t${audio_s.toFixed(4)}\t${wall_s.toFixed(4)}\t${rtf.toFixed(4)}`);- process.stdout.write(- `wcpp ${backend} ${precTag} ${name}: wall=${wall_s.toFixed(3)}s audio=${audio_s.toFixed(3)}s rtf=${rtf.toFixed(3)} | ${guardrailLine.trim()}\n`,- );-}--await fs.writeFile(timingsPath, lines.join("\n") + "\n", "utf8");-process.stdout.write(`wrote ${timingsPath}\n`);diff --git a/tools/stt-eval/whispercpp-dtw-poc/harness/score_all.mjs b/tools/stt-eval/whispercpp-dtw-poc/harness/score_all.mjsdeleted file mode 100644index 970661ef2..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/harness/score_all.mjs+++ /dev/null@@ -1,354 +0,0 @@-// score_all.mjs — For every (engine, mode) JSON in results/, compute-// - WER vs fixtures/refs/<name>.txt-// - analyze.mjs-style stats (monotonic, lastWordEnd <= duration, etc.)-// Then compute the §5.1 word-timestamp head-to-head-// - fp16-vs-fp16: wcpp_cpu_fp16 vs ct2_fp16-// - q8_0-vs-int8 : wcpp_cpu_q8_0 vs ct2_int8-// Output:-// - results/wer_table.tsv-// - results/timestamp_headtohead.json (median/p90, gross disagreements)--import { spawnSync } from "node:child_process";-import { promises as fs } from "node:fs";-import path from "node:path";-import process from "node:process";--const ROOT = process.cwd();-const POC = path.join(ROOT, "tools", "stt-eval", "whispercpp-dtw-poc");-const RESULTS = path.join(POC, "results");-const REFS = path.join(POC, "fixtures", "refs");-const HARNESS = path.join(POC, "harness");--const audioDur = {- jfk: 11.002,- librispeech_demo_0: 5.851,- librispeech_demo_1: 4.438,- librispeech_demo_2: 11.967,- librispeech_demo_3: 9.5,- librispeech_demo_4: 29.13,- "two-min-clip": 130.324,-};--const isWindows = process.platform === "win32";-const nodeBin = isWindows ? "node.exe" : "node";--function runNode(script, args) {- return spawnSync(nodeBin, [path.join(HARNESS, script), ...args], {- encoding: "utf8",- maxBuffer: 50 * 1024 * 1024,- });-}--function normalizeWord(w) {- return w- .toUpperCase()- .replace(/[.,!?;:"“”‘’]/g, "")- .replace(/-/g, " ")- .trim();-}--// Flatten a JSON's segments[].words[] into a single ordered word list.-function flattenWords(json) {- const out = [];- for (const seg of json.segments || []) {- for (const w of seg.words || []) {- out.push({ word: w.word, start: w.start, end: w.end, probability: w.probability });- }- }- return out;-}--// Per-fixture WER + analyze.-const runs = []; // { run, fixture, jsonPath, refPath, audio_s, hyp, ref, edits, refWords, wer, monotonic, maxBacktrack, lastWordEnd, numWords, numSegments, segmentsWithoutWords, zeroStartCountExcludingFirst }--// Read the CT2 timings directly from the timings_*.tsv files, since the-// CT2 server's JSON response has no `timing` field.-async function readTimingsTsv(name) {- const p = path.join(RESULTS, name);- if (!(await fs.stat(p).catch(() => null))) return {};- const text = await fs.readFile(p, "utf8");- const out = {};- for (const line of text.split(/\r?\n/)) {- const m = line.match(/^(\S+)\t([\d.]+)\t([\d.]+)\t([\d.]+)/);- if (m) out[m[1]] = { audio_s: +m[2], wall_s: +m[3], rtf: +m[4] };- }- return out;-}-const ct2Timings = await readTimingsTsv("timings_int8.tsv");-const ct2Fp16Timings = await readTimingsTsv("timings_fp16.tsv");-const wcppCpuFp16 = await readTimingsTsv("timings_wcpp_cpu_fp16.tsv");-const wcppCpuQ80 = await readTimingsTsv("timings_wcpp_cpu_q8_0.tsv");-const wcppVulkanFp16 = await readTimingsTsv("timings_wcpp_vulkan_fp16.tsv");-const wcppVulkanQ80 = await readTimingsTsv("timings_wcpp_vulkan_q8_0.tsv");--const jsonFiles = (await fs.readdir(RESULTS))- .filter((f) => f.endsWith(".json") && !f.endsWith("error.json"))- .sort();--for (const jf of jsonFiles) {- const mCt = jf.match(/^(ct2)_(int8|fp16)_(.+)\.json$/);- const mWc = jf.match(/^(wcpp)_(cpu|vulkan|cuda)_(fp16|q8_0)_(.+)\.json$/);- let engine, kind, prec, fixture;- if (mCt) {- engine = mCt[1];- kind = mCt[2];- prec = mCt[2];- fixture = mCt[3];- } else if (mWc) {- engine = mWc[1];- kind = mWc[2];- prec = mWc[3];- fixture = mWc[4];- } else {- continue;- }- if (!audioDur[fixture]) continue;- const refPath = path.join(REFS, `${fixture}.txt`);- if (!(await fs.stat(refPath).catch(() => null))) continue;-- const jsonPath = path.join(RESULTS, jf);- const json = JSON.parse(await fs.readFile(jsonPath, "utf8"));-- // Pull the engine-measured timing from the TSV rather than from the JSON,- // because CT2 JSON has no `timing` field and wcpp JSON `audio_s` is just- // a re-derivation of the WAV header.- let timing = { audio_s: undefined, wall_s: undefined, rtf: undefined };- if (engine === "wcpp") {- const t =- kind === "cpu" && prec === "fp16"- ? wcppCpuFp16- : kind === "cpu" && prec === "q8_0"- ? wcppCpuQ80- : kind === "vulkan" && prec === "fp16"- ? wcppVulkanFp16- : kind === "vulkan" && prec === "q8_0"- ? wcppVulkanQ80- : {};- if (t[fixture]) timing = t[fixture];- } else if (engine === "ct2") {- const t = prec === "int8" ? ct2Timings : ct2Fp16Timings;- if (t[fixture]) timing = t[fixture];- }-- // WER- const extract = runNode("extract_text.mjs", [jsonPath]);- if (extract.status !== 0) continue;- const hyp = extract.stdout;- const werOut = runNode("wer.mjs", [refPath, hyp]);- const wer = JSON.parse(werOut.stdout);-- // analyze — patch the JSON before passing to analyze.mjs to drop- // broken timestamps (CT2 jfk: trailing segment emits word "you" with- // start/end = 3.69e+17 because of an uninitialised timestamp variable- // in ctranslate2-server/src/main.cpp when the trailing silences form- // a 1-word segment).- const patchedPath = path.join(RESULTS, `_patched_${jf}`);- const patched = {- ...json,- segments: (json.segments || []).map((seg) => ({- ...seg,- words: (seg.words || []).filter(- (w) => Number.isFinite(w.start) && Number.isFinite(w.end) && w.start < 1e6 && w.end < 1e6,- ),- })),- };- await fs.writeFile(patchedPath, JSON.stringify(patched), "utf8");- const aOut = runNode("analyze.mjs", [patchedPath, String(audioDur[fixture])]);- const a = JSON.parse(aOut.stdout);- await fs.unlink(patchedPath).catch(() => {});-- runs.push({- run: jf.replace(/\.json$/, ""),- engine,- kind,- prec,- fixture,- refWords: wer.refWords,- edits: wer.edits,- wer: wer.wer,- numWords: a.numWords,- numSegments: a.numSegments,- monotonic: a.monotonic,- maxBacktrack: a.maxBacktrack,- lastWordEnd: a.lastWordEnd,- clipDuration: a.clipDuration,- zeroStartCount: a.zeroStartCountExcludingFirst,- segmentsWithoutWords: a.segmentsWithoutWords,- rtf: timing.rtf,- wall_s: timing.wall_s,- audio_s: timing.audio_s,- });-}--// WER table (TSV).-const werHeader = [- "run",- "engine",- "backend",- "prec",- "fixture",- "audio_s",- "rtf",- "refWords",- "edits",- "wer",- "numWords",- "numSegments",- "monotonic",- "maxBacktrack",- "lastWordEnd",- "zeroStartCount",- "segmentsWithoutWords",-];-const werLines = [werHeader.join("\t")];-for (const r of runs) {- werLines.push(- [- r.run,- r.engine,- r.kind,- r.prec,- r.fixture,- r.audio_s?.toFixed?.(4) ?? "",- r.rtf?.toFixed?.(4) ?? "",- r.refWords,- r.edits,- r.wer?.toFixed?.(4) ?? "",- r.numWords,- r.numSegments,- r.monotonic,- r.maxBacktrack?.toFixed?.(3),- r.lastWordEnd?.toFixed?.(3),- r.zeroStartCount,- r.segmentsWithoutWords,- ].join("\t"),- );-}-await fs.writeFile(path.join(RESULTS, "wer_table.tsv"), werLines.join("\n") + "\n", "utf8");-process.stdout.write(`wrote ${path.join(RESULTS, "wer_table.tsv")} (${runs.length} rows)\n`);--// §5.1 head-to-head: align words by normalized text, then per-word |Δ start| / |Δ end|.-// We compute FOUR separate deltas, because wcpp t_dtw is the "moment of-// emission" (= roughly CT2's word END) rather than the start of the audio-// range (= CT2's word START), so direct start↔start comparison is unfair.-// * dStart = |wcpp.start − ct2.start| (apples-to-apples if both are word audio ranges)-// * dEnd = |wcpp.end − ct2.end|-// * dWcppStartToCt2End = |wcpp.start − ct2.end| (if wcpp t_dtw tracks CT2's word end, this should be ~0)-// * dWcppMidToCt2Mid = |wcpp.midpoint − ct2.midpoint|-async function alignHeadToHead(precA, precB) {- const byFixture = new Map();- for (const r of runs) {- if (r.engine === "wcpp" && r.prec === precA) {- const e = byFixture.get(r.fixture) || {};- e.a = r;- byFixture.set(r.fixture, e);- }- }- for (const r of runs) {- if (r.engine === "ct2" && r.kind === precB) {- const e = byFixture.get(r.fixture) || {};- e.b = r;- byFixture.set(r.fixture, e);- }- }- const dStart = [],- dEnd = [],- dWcppStartToCt2End = [],- dWcppMidToCt2Mid = [];- const gross = [];- for (const [fixture, { a, b }] of byFixture.entries()) {- if (!a || !b) continue;- const jsonA = JSON.parse(await fs.readFile(path.join(RESULTS, `${a.run}.json`), "utf8"));- const jsonB = JSON.parse(await fs.readFile(path.join(RESULTS, `${b.run}.json`), "utf8"));- const wordsA = flattenWords(jsonA)- .map((w) => ({ ...w, _key: normalizeWord(w.word) }))- .filter((w) => w._key);- const wordsB = flattenWords(jsonB)- .map((w) => ({ ...w, _key: normalizeWord(w.word) }))- .filter((w) => w._key);- let i = 0,- j = 0;- while (i < wordsA.length && j < wordsB.length) {- if (wordsA[i]._key === wordsB[j]._key) {- const ds = Math.abs(wordsA[i].start - wordsB[j].start) * 1000;- const de = Math.abs(wordsA[i].end - wordsB[j].end) * 1000;- const dwx = Math.abs(wordsA[i].start - wordsB[j].end) * 1000;- const dmid =- Math.abs((wordsA[i].start + wordsA[i].end) / 2 - (wordsB[j].start + wordsB[j].end) / 2) *- 1000;- dStart.push(ds);- dEnd.push(de);- dWcppStartToCt2End.push(dwx);- dWcppMidToCt2Mid.push(dmid);- if (ds > 200 || de > 200) {- gross.push({- fixture,- word: wordsA[i]._key,- wcpp: { s: wordsA[i].start, e: wordsA[i].end },- ct2: { s: wordsB[j].start, e: wordsB[j].end },- ds,- de,- });- }- i++;- j++;- } else {- i++;- }- }- }- function pct(arr, q) {- if (!arr.length) return null;- const s = [...arr].sort((a, b) => a - b);- const idx = Math.min(s.length - 1, Math.floor(s.length * q));- return s[idx];- }- return {- count: dStart.length,- dStart_median_ms: pct(dStart, 0.5),- dStart_p90_ms: pct(dStart, 0.9),- dStart_max_ms: Math.max(...dStart, 0),- dEnd_median_ms: pct(dEnd, 0.5),- dEnd_p90_ms: pct(dEnd, 0.9),- dEnd_max_ms: Math.max(...dEnd, 0),- dWcppStartToCt2End_median_ms: pct(dWcppStartToCt2End, 0.5),- dWcppStartToCt2End_p90_ms: pct(dWcppStartToCt2End, 0.9),- dWcppMidToCt2Mid_median_ms: pct(dWcppMidToCt2Mid, 0.5),- dWcppMidToCt2Mid_p90_ms: pct(dWcppMidToCt2Mid, 0.9),- gross_count: gross.length,- gross_examples: gross.slice(0, 20),- };-}--const h_fp16_vs_fp16 = await alignHeadToHead("fp16", "fp16");-const h_q8_0_vs_int8 = await alignHeadToHead("q8_0", "int8");--const headToHead = {- "fp16-vs-fp16 (wcpp_cpu_fp16 vs ct2_fp16)": h_fp16_vs_fp16,- "q8_0-vs-int8 (wcpp_cpu_q8_0 vs ct2_int8)": h_q8_0_vs_int8,-};-await fs.writeFile(- path.join(RESULTS, "timestamp_headtohead.json"),- JSON.stringify(headToHead, null, 2),- "utf8",-);-process.stdout.write(`wrote ${path.join(RESULTS, "timestamp_headtohead.json")}\n`);--// Console summary-process.stdout.write("\n=== WER (smaller is better, 0 = perfect) ===\n");-for (const r of runs) {- process.stdout.write(- `${r.run.padEnd(34)} refWords=${String(r.refWords).padStart(3)} edits=${String(r.edits).padStart(3)} wer=${(r.wer ?? 0).toFixed(4)} rtf=${(r.rtf ?? 0).toFixed(3)} monotonic=${r.monotonic} numWords=${r.numWords}/${r.numSegments}\n`,- );-}-process.stdout.write("\n=== §5.1 Word-timestamp head-to-head (4 metrics) ===\n");-for (const [k, v] of Object.entries(headToHead)) {- process.stdout.write(- `${k} (n=${v.count}):\n` +- ` Δstart (wcpp.start vs ct2.start): median=${v.dStart_median_ms?.toFixed(0).padStart(5)}ms p90=${v.dStart_p90_ms?.toFixed(0).padStart(5)}ms max=${v.dStart_max_ms?.toFixed(0).padStart(6)}ms\n` +- ` Δend (wcpp.end vs ct2.end): median=${v.dEnd_median_ms?.toFixed(0).padStart(5)}ms p90=${v.dEnd_p90_ms?.toFixed(0).padStart(5)}ms max=${v.dEnd_max_ms?.toFixed(0).padStart(6)}ms\n` +- ` ΔwcppStart↔ct2End (t_dtw ≈ word-end?): median=${v.dWcppStartToCt2End_median_ms?.toFixed(0).padStart(5)}ms p90=${v.dWcppStartToCt2End_p90_ms?.toFixed(0).padStart(5)}ms\n` +- ` Δmid (wcpp.mid vs ct2.mid): median=${v.dWcppMidToCt2Mid_median_ms?.toFixed(0).padStart(5)}ms p90=${v.dWcppMidToCt2Mid_p90_ms?.toFixed(0).padStart(5)}ms\n` +- ` gross(>200ms any): ${v.gross_count}\n`,- );-}diff --git a/tools/stt-eval/whispercpp-dtw-poc/harness/wcpp_dtw_bench.cpp b/tools/stt-eval/whispercpp-dtw-poc/harness/wcpp_dtw_bench.cppdeleted file mode 100644index a8f6a50bc..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/harness/wcpp_dtw_bench.cpp+++ /dev/null@@ -1,364 +0,0 @@-// wcpp_dtw_bench.cpp — whisper.cpp DTW word-timestamp benchmark.-//-// Usage:-// wcpp_dtw_bench <model.bin> <audio-16k-mono.wav> [--lang en]-//-// Emits ONE JSON object on stdout matching OpenScreen's transcription contract-// shape so harness/{wer,analyze,extract_text}.mjs work unchanged:-// { "text": "...",-// "segments": [ { "id": <>, "start": S, "end": E, "text": "...",-// "words": [ {"word":"...","start":s,"end":e,"probability":p}, ... ] } ],-// "detected_language": "en",-// "backend": "whispercpp-<cpu|vulkan|cuda>",-// "timing": { "elapsed_s": <>, "audio_s": <>, "rtf": <elapsed/audio> } }-//-// KEY DTW SETTINGS (the fix vs the 2024 failure):-// dtw_token_timestamps = true-// dtw_aheads_preset = WHISPER_AHEADS_SMALL (multilingual small)-// token_timestamps = true-// And we read whisper_token_data.t_dtw directly. Units are centiseconds-// (1 unit = 10 ms) → seconds = t_dtw / 100.0.-//-// The §4.1 guardrail runs first: if t_dtw == -1 for any non-special token,-// or the absolute-delta sum Σ|t_dtw − t0| over non-special tokens is zero-// (DTW identical to heuristic), or t_dtw is not monotonic non-decreasing,-// we exit non-zero before producing the JSON. The harness stays self-trustworthy.-//-// The backend name ("cpu"|"vulkan"|"cuda") is taken from the WCPP_BACKEND-// preprocessor define (set by the CMakeLists for each build variant).--#include "whisper.h"--#include <algorithm>-#include <cmath>-#include <cstdio>-#include <cstdint>-#include <cstring>-#include <chrono>-#include <fstream>-#include <iostream>-#include <sstream>-#include <string>-#include <thread>-#include <tuple>-#include <vector>--#ifndef WCPP_BACKEND-#define WCPP_BACKEND "cpu"-#endif--namespace {--std::string json_escape(const std::string& s) {- std::string out;- out.reserve(s.size() + 8);- for (unsigned char c : s) {- switch (c) {- case '"': out += "\\\""; break;- case '\\': out += "\\\\"; break;- case '\n': out += "\\n"; break;- case '\r': out += "\\r"; break;- case '\t': out += "\\t"; break;- default:- if (c < 0x20) {- char buf[8];- std::snprintf(buf, sizeof(buf), "\\u%04x", c);- out += buf;- } else {- out += static_cast<char>(c);- }- }- }- return out;-}--// Minimal WAV reader: PCM16, any channel count, any sample rate we record.-// Fixtures are guaranteed PCM16 mono 16 kHz per the harness contract.-bool read_wav_pcm16(const std::string& path, std::vector<float>& pcm, int& sample_rate_out,- int& channels_out) {- std::ifstream f(path, std::ios::binary);- if (!f) { std::cerr << "cannot open " << path << "\n"; return false; }-- auto read_u32 = [&]()-> uint32_t {- uint32_t v = 0; f.read(reinterpret_cast<char*>(&v), 4); return v;- };- auto read_u16 = [&]()-> uint16_t {- uint16_t v = 0; f.read(reinterpret_cast<char*>(&v), 2); return v;- };- auto read_i16 = [&]()-> int16_t {- int16_t v = 0; f.read(reinterpret_cast<char*>(&v), 2); return v;- };-- char tag[4];- f.read(tag, 4);- if (f.gcount() != 4 || std::memcmp(tag, "RIFF", 4) != 0) { std::cerr << "not RIFF\n"; return false; }- (void)read_u32();- f.read(tag, 4);- if (std::memcmp(tag, "WAVE", 4) != 0) { std::cerr << "not WAVE\n"; return false; }-- uint16_t fmt_format = 0, fmt_channels = 0, fmt_bits = 0;- uint32_t fmt_sample_rate = 0;- bool got_fmt = false;-- while (f) {- char chunk_tag[4];- f.read(chunk_tag, 4);- if (f.gcount() != 4) break;- const uint32_t chunk_size = read_u32();- if (std::memcmp(chunk_tag, "fmt ", 4) == 0) {- fmt_format = read_u16();- fmt_channels = read_u16();- fmt_sample_rate = read_u32();- (void)read_u32(); // byte rate- (void)read_u16(); // block align- fmt_bits = read_u16();- const uint32_t fmt_extra = chunk_size - 16;- if (fmt_extra) f.seekg(fmt_extra, std::ios::cur);- got_fmt = true;- } else if (std::memcmp(chunk_tag, "data", 4) == 0) {- if (!got_fmt || fmt_format != 1 || fmt_bits != 16) {- std::cerr << "expected PCM16, got format=" << fmt_format- << " bits=" << fmt_bits << "\n";- return false;- }- sample_rate_out = static_cast<int>(fmt_sample_rate);- channels_out = fmt_channels;- const size_t frames = chunk_size / 2 / fmt_channels;- pcm.resize(frames);- if (fmt_channels == 1) {- for (size_t i = 0; i < frames; ++i) pcm[i] = static_cast<float>(read_i16()) / 32768.0f;- } else {- std::vector<int> count(frames, 0);- for (size_t ch = 0; ch < fmt_channels; ++ch) {- for (size_t i = 0; i < frames; ++i) {- pcm[i] += static_cast<float>(read_i16()) / 32768.0f;- ++count[i];- }- }- for (size_t i = 0; i < frames; ++i) pcm[i] /= count[i];- }- return true;- } else {- f.seekg(chunk_size + (chunk_size & 1), std::ios::cur);- }- }- std::cerr << "data chunk not found\n";- return false;-}--struct Word {- double start;- double end;- double prob;- std::string text;-};--} // namespace--int main(int argc, char** argv) {- if (argc < 3) {- std::cerr << "Usage: wcpp_dtw_bench <model.bin> <audio-16k-mono.wav> [--lang en]\n";- return 2;- }- const std::string model_path = argv[1];- const std::string wav_path = argv[2];- std::string lang = "en";- for (int i = 3; i + 1 < argc; ++i) {- if (std::string(argv[i]) == "--lang") lang = argv[i + 1];- }-- std::vector<float> pcm;- int sample_rate = 0;- int channels = 0;- if (!read_wav_pcm16(wav_path, pcm, sample_rate, channels)) return 3;- if (sample_rate != 16000 || channels != 1) {- std::cerr << "fixture must be 16 kHz mono, got " << sample_rate << "Hz " << channels << "ch\n";- return 3;- }-- // ---------- §4.1: init context with DTW + alignment heads preset ----------- whisper_context_params cparams = whisper_context_default_params();- cparams.use_gpu = true; // GPU offload via whatever backend this build links against- cparams.flash_attn = false; // CRITICAL: DTW is incompatible with flash attention in v1.9.1 — the model logger literally disables dtw_token_timestamps itself if flash_attn=1, breaking the §4.1 guardrail.- cparams.dtw_token_timestamps = true;- cparams.dtw_aheads_preset = WHISPER_AHEADS_SMALL;-- whisper_context* ctx = whisper_init_from_file_with_params(model_path.c_str(), cparams);- if (!ctx) {- std::cerr << "whisper_init_from_file_with_params failed for " << model_path << "\n";- return 4;- }-- whisper_full_params wparams = whisper_full_default_params(WHISPER_SAMPLING_GREEDY);- wparams.token_timestamps = true;- wparams.language = lang.c_str();- wparams.print_progress = false;- wparams.print_realtime = false;- wparams.print_timestamps = false;- wparams.n_threads = static_cast<int>(std::thread::hardware_concurrency());-- const auto t0 = std::chrono::steady_clock::now();- const int rc = whisper_full(ctx, wparams, pcm.data(), static_cast<int>(pcm.size()));- const auto t1 = std::chrono::steady_clock::now();- if (rc != 0) {- std::cerr << "whisper_full returned " << rc << "\n";- whisper_free(ctx);- return 5;- }- const double elapsed_s = std::chrono::duration<double>(t1 - t0).count();- const double audio_s = pcm.size() / 16000.0;- const double rtf = audio_s > 0 ? elapsed_s / audio_s : 0.0;-- const int n_vocab = whisper_n_vocab(ctx);- const whisper_token eot = whisper_token_eot(ctx);- std::vector<std::string> vocab_strs(n_vocab);- for (int i = 0; i < n_vocab; ++i) vocab_strs[i] = whisper_token_to_str(ctx, i);-- // ---------- Single walk: build segments + word groups + §4.1 guardrail ----------- bool dtw_guard_pass = true;- std::string guardrail_msg;- int64_t dtw_abs_delta_sum = 0;- int64_t prev_t_dtw = 0;- int non_special_tokens = 0;-- struct Segment {- double start, end;- std::string text;- std::vector<Word> words;- };- std::vector<Segment> segments;-- const int n_segments = whisper_full_n_segments(ctx);- for (int si = 0; si < n_segments; ++si) {- Segment seg;- seg.start = whisper_full_get_segment_t0(ctx, si) / 100.0;- seg.end = whisper_full_get_segment_t1(ctx, si) / 100.0;- // Use whisper.cpp's segment text — that string already strips- // _BEG_ / [_TT_NNN] markers (whisper_full handles them).- const char* seg_text_c = whisper_full_get_segment_text(ctx, si);- if (seg_text_c) seg.text = seg_text_c;-- // First pass: collect (t_dtw of first token, raw text, prob mean) per- // word group, walking the token stream.- struct W { double t_dtw_first; double p_sum; int p_n; std::string text; bool real; };- std::vector<W> word_buf;- std::string cur_text;- bool in_word = false;- double w_first_t_dtw = 0;- double w_p_sum = 0; int w_p_n = 0;-- const int n_tokens = whisper_full_n_tokens(ctx, si);- for (int ti = 0; ti < n_tokens; ++ti) {- const whisper_token_data td = whisper_full_get_token_data(ctx, si, ti);- std::string raw = (td.id >= 0 && td.id < n_vocab) ? vocab_strs[td.id] : std::string();-- if (td.id >= eot) continue; // special token: skip text AND words-- // §4.1 guardrail — track t_dtw vs t0 + monotonicity.- if (td.t_dtw == -1) {- dtw_guard_pass = false;- if (guardrail_msg.empty()) guardrail_msg = "token t_dtw == -1 (DTW not computed)";- }- const int64_t delta = std::abs(td.t_dtw - td.t0);- dtw_abs_delta_sum += delta;- if (non_special_tokens > 0 && td.t_dtw < prev_t_dtw) {- dtw_guard_pass = false;- if (guardrail_msg.empty()) guardrail_msg = "non-monotonic t_dtw";- }- prev_t_dtw = td.t_dtw;- ++non_special_tokens;-- const bool starts_word = (!in_word) || (!raw.empty() && raw[0] == ' ');- const double td_dtw = (td.t_dtw >= 0 ? td.t_dtw : 0) / 100.0;-- if (starts_word && in_word) {- word_buf.push_back({ w_first_t_dtw, w_p_sum, w_p_n, cur_text, true });- w_p_sum = 0; w_p_n = 0; cur_text.clear();- }- if (starts_word) {- in_word = true;- w_first_t_dtw = td_dtw;- cur_text = (!raw.empty() && raw[0] == ' ') ? raw.substr(1) : raw;- } else {- cur_text += raw;- }- w_p_sum += td.p;- w_p_n += 1;- }- if (in_word) {- word_buf.push_back({ w_first_t_dtw, w_p_sum, w_p_n, cur_text, true });- }-- // Second pass: assign per-word start/end.- // word.start = its own t_dtw (the moment the model started emitting it)- // word.end = the next word's t_dtw (the moment this word finished)- // or, for the last word in the segment, the segment's t1- // — so single-token words get a real audio range, not a zero-width point.- for (size_t wi = 0; wi < word_buf.size(); ++wi) {- Word w;- w.start = word_buf[wi].t_dtw_first;- w.end = (wi + 1 < word_buf.size())- ? word_buf[wi + 1].t_dtw_first- : seg.end;- w.prob = word_buf[wi].p_sum / std::max(1, word_buf[wi].p_n);- w.text = word_buf[wi].text;- seg.words.push_back(w);- }-- segments.push_back(std::move(seg));- }-- // §4.1 final check: zero abs-delta sum means DTW identical to heuristic.- if (non_special_tokens > 0 && dtw_abs_delta_sum == 0) {- dtw_guard_pass = false;- if (guardrail_msg.empty()) guardrail_msg = "Σ|t_dtw − t0| == 0 (DTW identical to heuristic)";- }-- std::fprintf(stderr,- "wcpp_dtw_bench[§4.1 guardrail]: %s (non_special_tokens=%d, Σ|t_dtw-t0|=%lld) => %s\n",- dtw_guard_pass ? "PASS" : "FAIL",- non_special_tokens,- static_cast<long long>(dtw_abs_delta_sum),- guardrail_msg.empty() ? "ok" : guardrail_msg.c_str());- if (!dtw_guard_pass) {- whisper_free(ctx);- return 6;- }-- // ---------- Emit JSON ----------- std::string whole_text;- for (const auto& s : segments) whole_text += s.text;-- std::cout.setf(std::ios::fixed);- std::cout.precision(6);- std::cout << "{\n";- std::cout << " \"backend\": \"" << WCPP_BACKEND << "\",\n";- std::cout << " \"detected_language\": \"" << json_escape(lang) << "\",\n";- std::cout << " \"language\": \"" << json_escape(lang) << "\",\n";- std::cout << " \"timing\": { \"elapsed_s\": " << elapsed_s- << ", \"audio_s\": " << audio_s- << ", \"rtf\": " << rtf << " },\n";- std::cout << " \"text\": \"" << json_escape(whole_text) << "\",\n";- std::cout << " \"segments\": [";- for (size_t si = 0; si < segments.size(); ++si) {- const auto& s = segments[si];- std::cout << (si ? ",\n {" : "\n {");- std::cout << "\"id\":" << si- << ",\"start\":" << s.start- << ",\"end\":" << s.end- << ",\"text\":\"" << json_escape(s.text) << "\",\"words\":[";- for (size_t wi = 0; wi < s.words.size(); ++wi) {- const auto& w = s.words[wi];- std::cout << (wi ? "," : "");- std::cout << "{\"word\":\"" << json_escape(w.text)- << "\",\"start\":" << w.start- << ",\"end\":" << w.end- << ",\"probability\":" << w.prob << "}";- }- std::cout << "]}";- }- std::cout << "\n ]\n}\n";-- whisper_free(ctx);- return 0;-}diff --git a/tools/stt-eval/whispercpp-dtw-poc/harness/wer.mjs b/tools/stt-eval/whispercpp-dtw-poc/harness/wer.mjsdeleted file mode 100644index b27f48de5..000000000--- a/tools/stt-eval/whispercpp-dtw-poc/harness/wer.mjs+++ /dev/null@@ -1,33 +0,0 @@-// Word-level WER (Levenshtein) between reference and hypothesis text.-function normalize(s) {- return s- .toUpperCase()- .replace(/[.,!?;:"“”‘’]/g, "")- .replace(/-/g, " ")- .split(/\s+/)- .filter(Boolean);-}--function wer(ref, hyp) {- const r = normalize(ref);- const h = normalize(hyp);- const n = r.length,- m = h.length;- const d = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));- for (let i = 0; i <= n; i++) d[i][0] = i;- for (let j = 0; j <= m; j++) d[0][j] = j;- for (let i = 1; i <= n; i++) {- for (let j = 1; j <= m; j++) {- if (r[i - 1] === h[j - 1]) d[i][j] = d[i - 1][j - 1];- else d[i][j] = 1 + Math.min(d[i - 1][j - 1], d[i - 1][j], d[i][j - 1]);- }- }- const edits = d[n][m];- return { edits, refWords: n, wer: n === 0 ? 0 : edits / n };-}--const [, , refPath, hypText] = process.argv;-const fs = await import("fs");-const ref = fs.readFileSync(refPath, "utf8").trim();-const result = wer(ref, hypText);-console.log(JSON.stringify(result));