forge
Explore
Log in

Don't you dare go Hollow

The lossless inter gate gets two tune-content=screen key rows

Browse files at this commit

c84128d318c027606b53a6a7baf7724e88ee36a4Ahmet Kaan GümüşParent: 33f9256
  • test
    • the lossless inter gate gets two tune-content=screen key rows
Show full message
test(av1): the lossless inter gate gets two tune-content=screen key rows

The palette path is what caught the whole-block palette prediction being
handed to a 4x4 chroma unit, and nothing in the gate coded a palette block.
Screen rows are KEY-only: a screen INTER frame still desyncs (lane report).
crates/ec-av1/src/stream.rsmodified+50 -18
@@ -4114,15 +4114,25 @@ pub(crate) mod tests {
41144114 eprintln!("SKIP {NAME}: no ffmpeg");
41154115 return;
41164116 }
4117- // (w, h, frames, gop, bit depth, 128-superblock)
4118- let cases: [(usize, usize, usize, &str, u32, bool); 4] = [
4119- (256, 128, 8, "4", 8, false),
4120- (192, 96, 6, "3", 10, false),
4121- (320, 192, 6, "3", 8, false),
4122- (256, 256, 4, "2", 8, true),
4117+ // (w, h, frames, gop, bit depth, 128-superblock, screen content)
4118+ // lane-lossless2: the SCREEN rows carry palette blocks, which is what
4119+ // caught the whole-block palette prediction being handed to a 4x4
4120+ // chroma unit; they are KEY-only, see the lane report's deferred
4121+ // screen-inter desync.
4122+ let cases: [(usize, usize, usize, &str, u32, bool, bool); 6] = [
4123+ (256, 128, 8, "4", 8, false, false),
4124+ (192, 96, 6, "3", 10, false, false),
4125+ (320, 192, 6, "3", 8, false, false),
4126+ (256, 256, 4, "2", 8, true, false),
4127+ (320, 192, 2, "1", 8, false, true),
4128+ (640, 384, 2, "1", 8, false, true),
41234129 ];
4124- for &(w, h, frames, gop, depth, sb128) in &cases {
4125- let tag = format!("{w}x{h} {depth}-bit gop {gop}{}", if sb128 { " sb128" } else { "" });
4130+ for &(w, h, frames, gop, depth, sb128, screen) in &cases {
4131+ let tag = format!(
4132+ "{w}x{h} {depth}-bit gop {gop}{}{}",
4133+ if sb128 { " sb128" } else { "" },
4134+ if screen { " screen" } else { "" }
4135+ );
41264136 let mut raw: Vec<u8> = Vec::new();
41274137 let put = |v: u32, raw: &mut Vec<u8>| {
41284138 if depth == 10 {
@@ -4131,20 +4141,36 @@ pub(crate) mod tests {
41314141 raw.push(v as u8);
41324142 }
41334143 };
4144+ // A screen source is a few flat colours in 16x16 tiles plus
4145+ // 1-px text-like rows -- what makes libaom code palette blocks.
4146+ const PAL: [u32; 8] = [16, 60, 110, 145, 180, 210, 235, 128];
41344147 for f in 0..frames {
41354148 for row in 0..h {
41364149 for col in 0..w {
4137- put((((col + 2 * f) * 7 + row * 13) % 251) as u32, &mut raw);
4138- }
4139- }
4140- for row in 0..h / 2 {
4141- for col in 0..w / 2 {
4142- put((((col + f) * 11 + row * 5) % 251) as u32, &mut raw);
4150+ let v = if screen {
4151+ if row % 7 == 0 && col % 3 == 0 {
4152+ if (col / 3 + row + f) % 2 == 1 { 16 } else { 235 }
4153+ } else {
4154+ PAL[((col + 4 * f) / 16 + row / 16) % PAL.len()]
4155+ }
4156+ } else {
4157+ (((col + 2 * f) * 7 + row * 13) % 251) as u32
4158+ };
4159+ put(v, &mut raw);
41434160 }
41444161 }
4145- for row in 0..h / 2 {
4146- for col in 0..w / 2 {
4147- put(((col * 3 + (row + f) * 17) % 251) as u32, &mut raw);
4162+ for plane in 0..2usize {
4163+ for row in 0..h / 2 {
4164+ for col in 0..w / 2 {
4165+ let v = if screen {
4166+ PAL[((col + 2 * f) / 8 + row / 8 + plane) % PAL.len()]
4167+ } else if plane == 0 {
4168+ (((col + f) * 11 + row * 5) % 251) as u32
4169+ } else {
4170+ ((col * 3 + (row + f) * 17) % 251) as u32
4171+ };
4172+ put(v, &mut raw);
4173+ }
41484174 }
41494175 }
41504176 }
@@ -4162,6 +4188,9 @@ pub(crate) mod tests {
41624188 if sb128 {
41634189 cmd.args(["-aom-params", "sb-size=128"]);
41644190 }
4191+ if screen {
4192+ cmd.args(["-aom-params", "tune-content=screen"]);
4193+ }
41654194 let out = cmd
41664195 .args(["-f", "obu", "-"])
41674196 .stdin(Stdio::null())
@@ -4197,7 +4226,10 @@ pub(crate) mod tests {
41974226 }
41984227 }
41994228 assert!(lossless >= frames, "{NAME} [{tag}] went blind: {lossless} lossless frames");
4200- assert!(inters > 0, "{NAME} [{tag}] went blind: no inter frame at gop {gop}");
4229+ assert!(
4230+ screen || inters > 0,
4231+ "{NAME} [{tag}] went blind: no inter frame at gop {gop}"
4232+ );
42014233 let ours = decode_stream(&stream)
42024234 .unwrap_or_else(|e| panic!("{NAME} [{tag}]: a lossless inter stream decodes: {e}"));
42034235 let refs = if depth == 10 {
lanes/lossless2.report.mdmodified+4 -1
@@ -51,6 +51,8 @@ TEXTURED luma AND chroma and per-frame motion.
5151 | 192x96, 6 frames `-g 3`, 10-bit | same gate | EXACT |
5252 | 320x192, 6 frames `-g 3`, 8-bit | same gate | EXACT |
5353 | 256x256, 4 frames `-g 2`, `-aom-params sb-size=128` | same gate | EXACT |
54+| 320x192, 2 key frames, `tune-content=screen` (palette) | same gate | EXACT |
55+| 640x384, 2 key frames, `tune-content=screen` (palette) | same gate | EXACT |
5456
5557 ## Screen content (palette) — three more defects, found by a `tune-content=screen` stream
5658 | defect | libaom | fix |
@@ -65,6 +67,8 @@ TEXTURED luma AND chroma and per-frame motion.
6567 ## Gate results
6668 - `a_lossless_libaom_key_frame_decodes_sample_exact` + `a_lossless_libaom_inter_frame_decodes_sample_exact`: PASS (2 passed).
6769 - `cargo check --workspace --all-targets -j4`: RC=0, 0 errors, 0 ec-av1 warnings (the 21 warnings are pre-existing `ec-opus`).
70+- crate suite `cargo test -p ec-av1 --release --lib -- --test-threads=1`: **557 passed / 0 failed / 44 ignored** (959.9 s), pins green (`the_encoders_own_streams_are_byte_identical_to_their_pins`). That run predates the two screen KEY rows added to the inter gate afterwards; those two were run on their own (2 passed).
71+- The screen rows really do code palette: the same recipe at 320x192 decoded 9600/15360 chroma samples wrong before `palette_window` and 0 after.
6872 - DECIDING GATE `bd_rate_screen_native`: **RED**, one reference point:
6973 `LADDER DECODE FAILURE: libaom-av1 ["-cpu-used","6","-b:v","0","-crf","5"] frame 0 plane Y sample 625: our decoder decoded 41, ffmpeg 40`.
7074 That point used to be refused; it now decodes, and frame 0 (a KEY frame) is
@@ -74,5 +78,4 @@ TEXTURED luma AND chroma and per-frame motion.
7478 ## Deferred
7579 - `deferred: the bd_rate_screen_native crf-5 screen point — ONE luma sample (625, row 0) of frame 0, a lossless KEY frame, decodes 41 where ffmpeg decodes 40; every other sample of every other point is exact. Not reproduced by a synthetic 1920x1024 tune-content=screen -crf 5 key frame (0 samples differ), so it needs the gate's own stream — unblocks: dump the ladder stream (EC_ENC_OUT / the external_ladder recipe) and diff EC_TRACE_COEFF against aomdec around that block.`
7680 - `deferred: lossless INTER frames of SCREEN content desync — reproduced at 640x384 tune-content=screen -crf 0 -g 3: key frames 0 and 3 are sample-exact, inter frames 1/2/4/5 are not. Localised with the aomdec oracle to all_zero unit #23422 of the stream: the first LUMA unit of a block right after a sub-8x8 group reads txb_skip_ctx 3 where libaom reads 1 (one neighbour magnitude > 3 where libaom sees 0) — unblocks: that one block's above-band luma level; the synthetic non-screen inter fixtures in the gate are all exact, so it is screen/sub-8x8 specific.`
77-- `deferred: a screen-content KEY-frame fixture is not yet IN the gate — verified by hand with dump_yuv this round; adding it to a_lossless_libaom_inter_frame_decodes_sample_exact is a one-case edit but the crate suite for this report was already running — unblocks: one suite re-run.`
7881 - `deferred: a frame mixing lossless and lossy segments — still refused by name ("a frame mixing lossless and lossy segments (the TX_4X4/WHT rules are per segment there)"): every rule above keys off a frame-wide `lossless_flag`, so per-segment support means threading `segment_id` through `lossless()`, `lossless_tx()`, the WHT switch and the filter gates — unblocks: a libaom recipe that emits one. Four tried this round at -crf 0 (aom-params aq-mode=1, aq-mode=2, aq-mode=3, deltaq-mode=1): none produced a frame whose segments disagree — the refusal never fired, i.e. every segment stayed at qindex 0.`