Datasets:
Download code/evaluation-code/v0.2-0c2690ae/apps/console/web/evidence/clock.mjs from VEHwang/cocogni4d: direct link, hf CLI and curl.
- Browser
- Download file 1.87 kB
-
https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/apps/console/web/evidence/clock.mjs
- Command line
-
hf download hf://datasets/VEHwang/cocogni4d/code/evaluation-code/v0.2-0c2690ae/apps/console/web/evidence/clock.mjs
-
curl -L -o clock.mjs https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/apps/console/web/evidence/clock.mjs
1.87 kB
| export function recordingWindow(q,route,duration){return q.recording_windows_s?.[route.letter]||[0,duration]} | |
| // Sample timestamps denote i/fps; a video clock denotes [i/fps,(i+1)/fps). | |
| // The sole seconds -> integer-frame conversion used by page and checks. | |
| export function frameIndex(seconds,fps=20,frames=Infinity,position='sample'){const value=Number(seconds)*fps,index=position==='video'?Math.floor(value):Math.round(value);return Math.max(0,Math.min(frames-1,index))} | |
| export function frameTime(index,fps=20,position='start'){return (Number(index)+(position==='middle'?.5:0))/fps} | |
| export function mediaTarget(time,window,aligned){const local=aligned?time-window[0]:time;return {local:Math.max(0,Math.min(window[1]-window[0]-.001,local)),active:local>=0&&local<window[1]-window[0],state:local<0?'before':local>=window[1]-window[0]?'after':'active'}} | |
| export function seekTarget(time,window,aligned,position='sample'){const target=mediaTarget(time,window,aligned),count=Math.max(1,Math.ceil((window[1]-window[0])*20)),index=frameIndex(target.local,20,count,position);return {...target,frame:index,local:frameTime(index,20,'middle')}} | |
| // 步骤、锚点给的是世界时刻;不对时的播放把它当各路自己的录像时刻。只有各路都从世界 0 s 起录,两者才相同 | |
| // (10-24 抽检:单路起录 8.05 s 的题点步骤跳到晚 8 s 的帧,接近片尾的跳出片长、一直“缓冲”)。 | |
| export function worldIsLocal(q,routes,duration){return routes.filter(r=>r.public).every(r=>Math.abs(recordingWindow(q,r,duration)[0])<1e-8)} | |
| export function sameStart(q,routes,duration){const starts=routes.filter(r=>r.public).map(r=>recordingWindow(q,r,duration)[0]);return starts.length<2||Math.max(...starts)-Math.min(...starts)<1e-8} | |
| export function routeFrame(local,window,fps,frames){return frameIndex(local+window[0],fps,frames,'video')} | |