forge
Explore
Log in

Don't you dare go Hollow

Size the stretch buffers before the resample

Browse files at this commit

c3f9e0aa13c2a238a88a25e3fab73a7f46075ba5Ahmet Kaan GümüşParent: b3a5acb
  • fix
    • size the stretch buffers before the resample
Show full message
fix(decode): size the stretch buffers before the resample

scale_i420 asserts exact planes; the stretch buffers were empty
Vecs, so the first anamorphic frame died on the destination-luma
assertion instead of being stretched. Sized with the rest of the
steady-state scratch, once per worker, exactly as  is.
crates/engine/src/decode.rsmodified+10 -0
@@ -1335,6 +1335,16 @@ impl Render {
1335 // composes on, and a height is never touched by it.1335 // composes on, and a height is never touched by it.
1336 let display_width = self.pixel_aspect.width_factor(width);1336 let display_width = self.pixel_aspect.width_factor(width);
1337 let (sy, su, sv) = &mut self.stretched;1337 let (sy, su, sv) = &mut self.stretched;
1338+ // Sized for `scale_i420`'s exact-planes assertion, once for the
1339+ // worker's whole range: steady-state buffers, not per-frame
1340+ // allocations ([`turned`]'s reason).
1341+ let (dcw, dch) = (
1342+ display_width.div_ceil(2) as usize,
1343+ height.div_ceil(2) as usize,
1344+ );
1345+ sy.resize(display_width as usize * height as usize, 0);
1346+ su.resize(dcw * dch, 0);
1347+ sv.resize(dcw * dch, 0);
1338 crate::scale::scale_i420(1348 crate::scale::scale_i420(
1339 y,1349 y,
1340 u,1350 u,
crates/engine/src/export.rsmodified+7 -0
@@ -3308,6 +3308,13 @@ fn place_picture<'a>(
3308 (y, u, v, width, height)3308 (y, u, v, width, height)
3309 } else {3309 } else {
3310 let display_width = pixel_aspect.width_factor(width);3310 let display_width = pixel_aspect.width_factor(width);
3311+ let (dcw, dch) = (
3312+ display_width.div_ceil(2) as usize,
3313+ height.div_ceil(2) as usize,
3314+ );
3315+ stretched.0.resize(display_width as usize * height as usize, 0);
3316+ stretched.1.resize(dcw * dch, 0);
3317+ stretched.2.resize(dcw * dch, 0);
3311 crate::scale::scale_i420(3318 crate::scale::scale_i420(
3312 y,3319 y,
3313 u,3320 u,