#1303: frame times in i128 via Tick::from_rational (a hostile F1:i64::MAX rate can't overflow)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ee414e8b9e
commit
62aed1acc2
|
|
@ -180,7 +180,7 @@ impl Y4mSource {
|
||||||
return Err(bad("no complete frames"));
|
return Err(bad("no complete frames"));
|
||||||
}
|
}
|
||||||
let color = ColorInfo { matrix: filmcraft_frame::default_matrix(w, h), range: if full { Range::Full } else { Range::Limited }, ..ColorInfo::REC709 };
|
let color = ColorInfo { matrix: filmcraft_frame::default_matrix(w, h), range: if full { Range::Full } else { Range::Limited }, ..ColorInfo::REC709 };
|
||||||
let duration = Tick::from_rational(frames.len() as i64 * rate.den, 1, rate.num);
|
let duration = Tick::from_rational(frames.len() as i64, rate.den, rate.num);
|
||||||
let bitrate = (frame_bytes as u64 * 8).checked_mul(rate.num as u64).map(|b| b / rate.den as u64);
|
let bitrate = (frame_bytes as u64 * 8).checked_mul(rate.num as u64).map(|b| b / rate.den as u64);
|
||||||
let info = MediaInfo {
|
let info = MediaInfo {
|
||||||
name: name.to_string(),
|
name: name.to_string(),
|
||||||
|
|
@ -244,7 +244,7 @@ impl Y4mSource {
|
||||||
data: pixels,
|
data: pixels,
|
||||||
color: v.color,
|
color: v.color,
|
||||||
par: v.par,
|
par: v.par,
|
||||||
pts: Tick::from_rational(idx as i64 * self.rate.den, 1, self.rate.num),
|
pts: Tick::from_rational(idx as i64, self.rate.den, self.rate.num),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,9 +99,17 @@ fn damaged_and_hostile_y4m_files_fail_without_panicking() {
|
||||||
b[i] ^= 0x41;
|
b[i] ^= 0x41;
|
||||||
cases.push(b);
|
cases.push(b);
|
||||||
}
|
}
|
||||||
for header in
|
for header in [
|
||||||
["W99999999 H99999999 F25:1", "W0 H4 F25:1", "W6 H4 F0:0", "W6 H4 F25:0", "W6 H4 F25:1 C411", "W6 H4 F25:1 Cbogus", "W6 H4 A0:0 F-5:1", "H4 F25:1"]
|
"W99999999 H99999999 F25:1",
|
||||||
{
|
"W0 H4 F25:1",
|
||||||
|
"W6 H4 F0:0",
|
||||||
|
"W6 H4 F25:0",
|
||||||
|
"W6 H4 F25:1 C411",
|
||||||
|
"W6 H4 F25:1 Cbogus",
|
||||||
|
"W6 H4 A0:0 F-5:1",
|
||||||
|
"H4 F25:1",
|
||||||
|
"W6 H4 F1:9223372036854775807",
|
||||||
|
] {
|
||||||
cases.push(y4m(header, "FRAME", &[vec![0; 36]]));
|
cases.push(y4m(header, "FRAME", &[vec![0; 36]]));
|
||||||
}
|
}
|
||||||
for (i, b) in cases.into_iter().enumerate() {
|
for (i, b) in cases.into_iter().enumerate() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue