MCPcopy Create free account
hub / github.com/TomClive/SeeDance2Stitcher / aggregateStats

Function aggregateStats

server.js:532–547  ·  view source on GitHub ↗
(frames)

Source from the content-addressed store, hash-verified

530}
531
532function aggregateStats(frames) {
533 let sum = 0;
534 let sumSq = 0;
535 let count = 0;
536 for (const frame of frames) {
537 for (let i = 0; i < frame.length; i += 1) {
538 const value = frame[i];
539 sum += value;
540 sumSq += value * value;
541 count += 1;
542 }
543 }
544 const mean = sum / Math.max(1, count);
545 const variance = sumSq / Math.max(1, count) - mean * mean;
546 return { mean, std: Math.sqrt(Math.max(0, variance)) || 1 };
547}
548
549function fullClipToneRecommendation(video1Frames, video2Frames, fps) {
550 return toneFromStats(aggregateStats(video1Frames), aggregateStats(video2Frames), fps, "full");

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected