forge
Explore
Log in

Don't you dare go Hollow

The visualizer seat masks what it declares, and floors nothing

Browse files at this commit

9ab653db26b6af3ae970ba431f94adde6acc9cfcAhmet Kaan GümüşParent: a78d43d
  • fix
    • the visualizer seat masks what it declares, and floors nothing
Show full message
🐛 fix(decode): the visualizer seat masks what it declares, and floors nothing

The wave lane's worker declaration carried a `.max(2)` floor under the
even mask. It kept the worker alive, but it broke the decode lane's
inherited answer for a canvas with no size: a `Composer::passthrough()`
canvases came back as a 2x2 picture instead of the empty one it asked
for, whose own test caught it on the first full run of the merged tree.

The mask alone is what both need: the declared size is the size the
planes really have, so the conversion always has the chroma plane it
indexes, while a canvas with nothing to divide still takes the painter's
empty picture (`empty_peaks_paint_the_flat_line`'s neighbour in
`visualizer_window_i420`). Witnessed at 1920x1, 1921x1081, 320x1 and
321x181 through the seat and through `set_resolution`.
crates/engine/src/decode.rsmodified+17 -11
@@ -650,15 +650,18 @@ impl DecodeSession {
650 // the picture *is* the canvas, and whatever transform the clip650 // the picture *is* the canvas, and whatever transform the clip
651 // carries still reaches it through the render below.651 // carries still reaches it through the render below.
652 //652 //
653- // Masked to even dimensions first, and floored at two: that is what the653+ // Masked to even dimensions first: that is what the painter does to the
654- // painter does to the planes it hands back, so a canvas it cannot divide654+ // planes it hands back, so a canvas it cannot divide evenly (an odd
655- // evenly (an odd `resolution 1921 1081` line, or a one-pixel-high one)655+ // `resolution 1921 1081` line, or a one-pixel-high one) used to be
656- // used to be *declared* at a size the picture never had -- and the656+ // *declared* at a size the picture never had -- and the conversion below
657- // conversion below then indexes a chroma plane that is not there657+ // then indexes a chroma plane that is not there (`index out of bounds`
658- // (`index out of bounds` on a zero-length slice, in this worker, where658+ // on a zero-length slice, in this worker, where no frame ever arrives
659- // no frame ever arrives and nothing catches it).659+ // and nothing catches it). No floor under the mask: a canvas with no
660+ // size is asked for no picture, and the painter answers that with empty
661+ // planes ([`visualizer_window_i420`]), which the declared size now
662+ // matches.
660 let (canvas_w, canvas_h) = canvas.dims();663 let (canvas_w, canvas_h) = canvas.dims();
661- let (width, height) = ((canvas_w & !1).max(2), (canvas_h & !1).max(2));664+ let (width, height) = (canvas_w & !1, canvas_h & !1);
662 let worker_cancel = Arc::clone(&cancel);665 let worker_cancel = Arc::clone(&cancel);
663 let path = path.to_path_buf();666 let path = path.to_path_buf();
664 let handle = thread::Builder::new()667 let handle = thread::Builder::new()
@@ -2883,9 +2886,12 @@ mod tests {
2883 0,2886 0,
2884 )2887 )
2885 .unwrap_or_else(|e| panic!("open the visualizer at {w}x{h}: {e}"));2888 .unwrap_or_else(|e| panic!("open the visualizer at {w}x{h}: {e}"));
2886- let frame = stream.frames.recv_timeout(Duration::from_secs(30)).unwrap_or_else(|e| {2889+ let frame = stream
2887- panic!("a picture for a {w}x{h} canvas, not a worker that died instead: {e}")2890+ .frames
2888- });2891+ .recv_timeout(Duration::from_secs(30))
2892+ .unwrap_or_else(|e| {
2893+ panic!("a picture for a {w}x{h} canvas, not a worker that died instead: {e}")
2894+ });
2889 assert_eq!(2895 assert_eq!(
2890 (frame.width, frame.height),2896 (frame.width, frame.height),
2891 (w, h),2897 (w, h),