(frames)
| 530 | } |
| 531 | |
| 532 | function 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 | |
| 549 | function fullClipToneRecommendation(video1Frames, video2Frames, fps) { |
| 550 | return toneFromStats(aggregateStats(video1Frames), aggregateStats(video2Frames), fps, "full"); |
no outgoing calls
no test coverage detected