Accept Vision single-precision angle boundaries in saved analysis

This commit is contained in:
Mikei386
2026-09-13 10:23:19 +02:00
parent 2efe6929d1
commit e1457aede1
3 changed files with 25 additions and 5 deletions
+19
View File
@@ -196,6 +196,25 @@ struct RenderIntegration {
try require(loaded.loadProject(from: GrowthLapseProject.url(for: second.outputFileURL)) != nil, "Project reload")
print("PASS failure preservation, save-as, cache reuse and project reload")
// Vision's single-precision ±pi must survive project validation unchanged.
var angleProject = second
let visionPi = Double(Float.pi)
angleProject.clips[0].visualAnalysis = ClipVisualAnalysis(sourceSignature: "angle-test", samples: [
VisualSample(time: 0, faceCount: 1,
pose: FacePose(x: 0.5, y: 0.5, height: 0.3, yaw: visionPi,
roll: -visionPi, eyesVisible: true, pitch: visionPi), color: nil, quality: 0)
])
let angleURL = root.appendingPathComponent("vision-angles.json")
try JSONEncoder().encode(angleProject).write(to: angleURL)
let angleLoader = VideoProcessor()
let accepted = angleLoader.loadProject(from: angleURL)
try require(accepted?.clips[0].visualAnalysis == angleProject.clips[0].visualAnalysis,
"Valid Vision Float.pi angles rejected or altered")
angleProject.clips[0].visualAnalysis!.samples[0].pose!.roll = 3.15
try JSONEncoder().encode(angleProject).write(to: angleURL)
try require(angleLoader.loadProject(from: angleURL) == nil, "Out-of-range angle accepted")
print("PASS Vision Float.pi project round-trip and invalid-angle rejection")
// Exercise failure after normalization, while FFmpeg is producing the final video.
let wrapper = root.appendingPathComponent("ffmpeg-fail")
let quotedFFmpeg = "'" + tools.ffmpeg.path.replacingOccurrences(of: "'", with: "'\\''") + "'"