From 536c87c7e9d49a4db670510ca719903c464521ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 13 Aug 2026 13:45:55 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20test(subtitles):=20the=20cue=20d?= =?UTF-8?q?ecode=20is=20held=20to=20the=20frame=20it=20appears=20on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The picture is decoded once per cue *change* and kept while the line is up (`Player::sub_picture`), so the number that matters is the one frame a new line costs. Measured on a real BluRay remux's PGS track: 371 µs for a 1920x1080 display set, against a 16.7 ms frame. Written down as an assert, since a cache that quietly stopped catching would show up here as nothing at all. --- crates/engine/tests/pgs_bitmaps.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/engine/tests/pgs_bitmaps.rs b/crates/engine/tests/pgs_bitmaps.rs index 6fb20bc..5de2956 100644 --- a/crates/engine/tests/pgs_bitmaps.rs +++ b/crates/engine/tests/pgs_bitmaps.rs @@ -62,12 +62,17 @@ fn the_session_maps_a_pgs_track_onto_the_timeline_and_draws_it() { let drawn = Instant::now(); let image = cues[0].image.as_ref().expect("a picture cue"); let rgba = image.rgba().expect("the first display set decodes"); + let took = drawn.elapsed(); eprintln!( - "cue 0 decoded to {}x{} in {:?}", - image.width, - image.height, - drawn.elapsed() + "cue 0 decoded to {}x{} in {took:?}", + image.width, image.height, ); + // The run-length walk is paid once per cue *change* -- the window keeps the + // picture while it is up ([`Player::sub_picture`]) -- so what this holds is + // the cost of the one frame a new line appears on: 247 µs measured on this + // remux, a sixty-eighth of that frame's budget. A whole repaint's worth + // would mean the cache above it had stopped mattering. + assert!(took.as_millis() < 16, "a frame's worth of decode: {took:?}"); assert_eq!(rgba.len(), (image.width * image.height * 4) as usize); let opaque = rgba.chunks_exact(4).filter(|px| px[3] > 0).count(); assert!(opaque > 0, "the block decoded to an empty canvas");