diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 3a2b720a..4d9c3d4f 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -1837,6 +1837,7 @@ impl PlaneBuf { left.as_deref(), corner, side, + side, enable_edge_filter, false, &mut prediction, @@ -4703,6 +4704,7 @@ fn interintra_blend( left.as_deref(), corner, side, + side, false, false, &mut intra, diff --git a/crates/ec-av1/src/encode.rs b/crates/ec-av1/src/encode.rs index b58bdb67..e51f803c 100644 --- a/crates/ec-av1/src/encode.rs +++ b/crates/ec-av1/src/encode.rs @@ -604,6 +604,7 @@ impl Plane<'_> { left.as_deref(), corner, side, + side, false, false, &mut prediction, @@ -823,6 +824,7 @@ impl Plane<'_> { left.as_deref(), corner, side, + side, false, false, &mut prediction, @@ -874,6 +876,7 @@ impl Plane<'_> { left.as_deref(), corner, side, + side, false, false, &mut prediction, @@ -4450,6 +4453,7 @@ mod tests { Some(&left), Some(128), side, + side, false, false, &mut prediction, diff --git a/crates/ec-av1/src/intra.rs b/crates/ec-av1/src/intra.rs index f779818a..a6bbc698 100644 --- a/crates/ec-av1/src/intra.rs +++ b/crates/ec-av1/src/intra.rs @@ -141,9 +141,17 @@ struct Edges { } impl Edges { - fn build(above: Option<&[u8]>, left: Option<&[u8]>, corner: Option, side: usize) -> Self { - // A directional mode reads out to w + h - 1 either way. - let want = side * 2; + /// `bw + bh` is the reach both `av1_dr_prediction_z1_c`'s `max_base_x` + /// and `z3_c`'s `max_base_y` use (libaom `reconintra.c`) -- above and + /// left both extend that far regardless of which of `bw`/`bh` is larger. + fn build( + above: Option<&[u8]>, + left: Option<&[u8]>, + corner: Option, + bw: usize, + bh: usize, + ) -> Self { + let want = bw + bh; let extend = |samples: &[u8]| { let mut row: Vec = samples.iter().map(|&s| i32::from(s)).collect(); let last = *row.last().expect("an edge that exists has samples"); @@ -189,15 +197,18 @@ impl Edges { } } -/// Predicts one square block into `dst`, row-major and `side * side` long. +/// Predicts one `bw`-wide, `bh`-tall block into `dst`, row-major and +/// `bw * bh` long; `bw == bh` for a square block, the only shape every +/// caller outside this lane's own tests passes. /// /// `above` is the reconstructed row above the block and `left` its -/// reconstructed left column, each at least `side` samples long, and `corner` -/// the sample diagonally above-left; `None` where the block sits against an -/// edge of the frame. A directional mode reads out to `2 * side`: pass the -/// samples above-right and below-left where the decoder has them decoded, and -/// the edge is extended by repetition where it does not, which is what the -/// decoder's own clamp to `aboveLimit` and `leftLimit` comes to. +/// reconstructed left column, each at least `bw`/`bh` samples long +/// respectively, and `corner` the sample diagonally above-left; `None` where +/// the block sits against an edge of the frame. A directional mode reads out +/// to `bw + bh`: pass the samples above-right and below-left where the +/// decoder has them decoded, and the edge is extended by repetition where it +/// does not, which is what the decoder's own clamp to `aboveLimit` and +/// `leftLimit` comes to. /// /// `angle_delta` (spec `AngleDeltaY`/`AngleDeltaUV`, `-MAX_ANGLE_DELTA` to /// `MAX_ANGLE_DELTA`) steers every one of `V_PRED`, `H_PRED` and the six @@ -214,7 +225,7 @@ impl Edges { /// /// # Panics /// Panics on a mode this module does not predict, or when `dst` is not -/// `side * side` long. +/// `bw * bh` long. #[allow(clippy::too_many_arguments)] pub fn predict( mode: u8, @@ -222,13 +233,14 @@ pub fn predict( above: Option<&[u8]>, left: Option<&[u8]>, corner: Option, - side: usize, + bw: usize, + bh: usize, enable_edge_filter: bool, smooth_neighbor: bool, dst: &mut [u8], ) { - assert_eq!(dst.len(), side * side, "the destination is the block"); - let edges = Edges::build(above, left, corner, side); + assert_eq!(dst.len(), bw * bh, "the destination is the block"); + let edges = Edges::build(above, left, corner, bw, bh); let is_directional = matches!( mode, V_PRED | H_PRED | D45_PRED | D67_PRED | D113_PRED | D135_PRED | D157_PRED | D203_PRED @@ -241,12 +253,13 @@ pub fn predict( // way (`av1_is_directional_mode`'s callers never call the z1/z2/z3 // walk there either). if angle != 90 && angle != 180 { - let n_top = above.map_or(0, |a| a.len().min(side)); - let n_left = left.map_or(0, |a| a.len().min(side)); + let n_top = above.map_or(0, |a| a.len().min(bw)); + let n_left = left.map_or(0, |a| a.len().min(bh)); directional( angle as u16, &edges, - side, + bw, + bh, enable_edge_filter, smooth_neighbor, n_top, @@ -256,36 +269,42 @@ pub fn predict( return; } } - let weights = &SM_WEIGHTS[side..side * 2]; - for row in 0..side { - for col in 0..side { + // `smooth_predictor` (libaom `intrapred.c`) indexes its width and height + // weight rows separately (`smooth_weights + bw - 4` / `+ bh - 4`) -- a + // square block reads the same row for both, which is why this collapsed + // to one `weights` slice before. + let weights_w = &SM_WEIGHTS[bw..bw * 2]; + let weights_h = &SM_WEIGHTS[bh..bh * 2]; + for row in 0..bh { + for col in 0..bw { let (r, c) = (row as i32, col as i32); - let last = side as i32 - 1; + let last_w = bw as i32 - 1; + let last_h = bh as i32 - 1; let value = match mode { - DC_PRED => dc(above, left, side), + DC_PRED => dc(above, left, bw, bh), V_PRED => edges.above(c), H_PRED => edges.left(r), SMOOTH_PRED => round2( - i32::from(weights[row]) * edges.above(c) - + (256 - i32::from(weights[row])) * edges.left(last) - + i32::from(weights[col]) * edges.left(r) - + (256 - i32::from(weights[col])) * edges.above(last), + i32::from(weights_h[row]) * edges.above(c) + + (256 - i32::from(weights_h[row])) * edges.left(last_h) + + i32::from(weights_w[col]) * edges.left(r) + + (256 - i32::from(weights_w[col])) * edges.above(last_w), 9, ), SMOOTH_V_PRED => round2( - i32::from(weights[row]) * edges.above(c) - + (256 - i32::from(weights[row])) * edges.left(last), + i32::from(weights_h[row]) * edges.above(c) + + (256 - i32::from(weights_h[row])) * edges.left(last_h), 8, ), SMOOTH_H_PRED => round2( - i32::from(weights[col]) * edges.left(r) - + (256 - i32::from(weights[col])) * edges.above(last), + i32::from(weights_w[col]) * edges.left(r) + + (256 - i32::from(weights_w[col])) * edges.above(last_w), 8, ), PAETH_PRED => paeth(edges.above(c), edges.left(r), edges.above(-1)), other => panic!("intra mode {other} is not one this module predicts"), }; - dst[row * side + col] = value.clamp(0, 255) as u8; + dst[row * bw + col] = value.clamp(0, 255) as u8; } } } @@ -302,6 +321,13 @@ fn intra_edge_filter_strength(bs0: i32, bs1: i32, delta: i32, smooth_neighbor: b if d >= 56 { strength = 1; } + } else if blk_wh <= 12 { + // Only reachable by a rect block (e.g. 4x8's blk_wh == 12): no + // square side sum ever lands in 9..=12, which is why this branch + // was silently absent before this lane. + if d >= 40 { + strength = 1; + } } else if blk_wh <= 16 { if d >= 40 { strength = 1; @@ -420,50 +446,58 @@ fn upsample_intra_edge(buf: &[i32]) -> Vec { fn directional( angle: u16, edges: &Edges, - side: usize, + bw: usize, + bh: usize, enable_edge_filter: bool, smooth_neighbor: bool, n_top: usize, n_left: usize, dst: &mut [u8], ) { - let n = side as i32; + let (w, h) = (bw as i32, bh as i32); + let reach = w + h; // `av1_dr_prediction_z{1,3}_c`'s `max_base_{x,y}` reach. let need_above = angle < 180; let need_left = angle > 90; let need_right = angle < 90; let need_bottom = angle > 180; - // Spec position `-1..=2n - 1`, `above[0]`/`left[0]` the shared corner. - let mut above: Vec = (-1..2 * n).map(|p| edges.above(p)).collect(); - let mut left: Vec = (-1..2 * n).map(|p| edges.left(p)).collect(); + // Spec position `-1..=w + h - 1`, `above[0]`/`left[0]` the shared corner. + let mut above: Vec = (-1..reach).map(|p| edges.above(p)).collect(); + let mut left: Vec = (-1..reach).map(|p| edges.left(p)).collect(); if enable_edge_filter && angle != 90 && angle != 180 { - if need_above && need_left && 2 * n >= 24 { + if need_above && need_left && reach >= 24 { let s = round2(left[1] * 5 + above[0] * 6 + above[1] * 5, 4); above[0] = s; left[0] = s; } + // `intra_edge_filter_strength(txwpx, txhpx, ...)` for above and + // `(txhpx, txwpx, ...)` for left (`reconintra.c`) -- the strength + // itself is symmetric in its first two args (only their sum + // matters), but the pixel counts filtered below are NOT: above's + // run-past-`n_top` extension is `txhpx` (the CROSS axis), left's is + // `txwpx`. if need_above && n_top > 0 { - let strength = intra_edge_filter_strength(n, n, i32::from(angle) - 90, smooth_neighbor); - let n_px = n_top as i32 + 1 + if need_right { n } else { 0 }; + let strength = intra_edge_filter_strength(w, h, i32::from(angle) - 90, smooth_neighbor); + let n_px = n_top as i32 + 1 + if need_right { h } else { 0 }; filter_intra_edge(&mut above[..n_px as usize], strength); } if need_left && n_left > 0 { let strength = - intra_edge_filter_strength(n, n, i32::from(angle) - 180, smooth_neighbor); - let n_px = n_left as i32 + 1 + if need_bottom { n } else { 0 }; + intra_edge_filter_strength(h, w, i32::from(angle) - 180, smooth_neighbor); + let n_px = n_left as i32 + 1 + if need_bottom { w } else { 0 }; filter_intra_edge(&mut left[..n_px as usize], strength); } } let upsample_above = - enable_edge_filter && use_intra_edge_upsample(n, n, i32::from(angle) - 90, smooth_neighbor); + enable_edge_filter && use_intra_edge_upsample(w, h, i32::from(angle) - 90, smooth_neighbor); let upsample_left = enable_edge_filter - && use_intra_edge_upsample(n, n, i32::from(angle) - 180, smooth_neighbor); + && use_intra_edge_upsample(h, w, i32::from(angle) - 180, smooth_neighbor); let above_up; let (above_buf, above_off): (&[i32], i32) = if need_above && upsample_above { - let n_px = (n + if need_right { n } else { 0 }) as usize; + let n_px = (w + if need_right { h } else { 0 }) as usize; above_up = upsample_intra_edge(&above[..=n_px]); (&above_up, 2) } else { @@ -471,7 +505,7 @@ fn directional( }; let left_up; let (left_buf, left_off): (&[i32], i32) = if need_left && upsample_left { - let n_px = (n + if need_bottom { n } else { 0 }) as usize; + let n_px = (h + if need_bottom { w } else { 0 }) as usize; left_up = upsample_intra_edge(&left[..=n_px]); (&left_up, 2) } else { @@ -485,11 +519,11 @@ fn directional( round2(edge(base) * (32 - shift) + edge(base + 1) * shift, 5) }; - for row in 0..n { - for col in 0..n { + for row in 0..h { + for col in 0..w { let value = if angle < 90 { let dx = dr_intra_derivative(angle); - let max_base = (2 * n - 1) << up_a; + let max_base = (reach - 1) << up_a; let frac_bits = 6 - up_a; let x = dx * (row + 1); let base = (x >> frac_bits) + (col << up_a); @@ -501,7 +535,7 @@ fn directional( } } else if angle > 180 { let dy = dr_intra_derivative(270 - angle); - let max_base = (2 * n - 1) << up_l; + let max_base = (reach - 1) << up_l; let frac_bits = 6 - up_l; let y = dy * (col + 1); let base = (y >> frac_bits) + (row << up_l); @@ -531,7 +565,7 @@ fn directional( blend(&left_at, y2 >> frac_bits_y, ((y2 << up_l) & 0x3F) >> 1) } }; - dst[(row * n + col) as usize] = value.clamp(0, 255) as u8; + dst[(row * w + col) as usize] = value.clamp(0, 255) as u8; } } } @@ -545,19 +579,19 @@ fn directional( /// before `dc_predictor` averages, so a slice truncated short by the true /// frame edge must be extended by repetition here too, not averaged over its /// own shorter length. -fn dc(above: Option<&[u8]>, left: Option<&[u8]>, side: usize) -> i32 { - let extend = |samples: &[u8]| -> Vec { - if samples.len() >= side { - samples[..side].to_vec() +fn dc(above: Option<&[u8]>, left: Option<&[u8]>, bw: usize, bh: usize) -> i32 { + let extend = |samples: &[u8], want: usize| -> Vec { + if samples.len() >= want { + samples[..want].to_vec() } else { let last = *samples.last().expect("an edge that exists has samples"); let mut v = samples.to_vec(); - v.resize(side, last); + v.resize(want, last); v } }; - let above = above.map(extend); - let left = left.map(extend); + let above = above.map(|a| extend(a, bw)); + let left = left.map(|l| extend(l, bh)); let average = |samples: &[u8]| { let sum: u32 = samples.iter().map(|&s| u32::from(s)).sum(); ((sum + (samples.len() as u32 >> 1)) / samples.len() as u32) as i32 @@ -566,14 +600,47 @@ fn dc(above: Option<&[u8]>, left: Option<&[u8]>, side: usize) -> i32 { (None, None) => 128, (Some(a), None) => average(a), (None, Some(l)) => average(l), - (Some(a), Some(l)) => { + (Some(a), Some(l)) if bw == bh => { + // `dc_predictor` (libaom `intrapred.c`): exact division, the + // square path this whole lane must leave bit-identical. let sum: u32 = a.iter().chain(l).map(|&s| u32::from(s)).sum(); let count = (a.len() + l.len()) as u32; ((sum + (count >> 1)) / count) as i32 } + (Some(a), Some(l)) => { + // `dc_predictor_rect`: AV1 never divides by `bw + bh` exactly for + // a rect block -- it approximates with a multiply-shift whose + // constants are derived from `bw + bh`'s odd factor (`d == 3` for + // every 1:2 ratio, `d == 5` for every 1:4 one; libaom comments + // this exact derivation in `intrapred.c` rather than tabulating + // it, so this ports the derivation, not a lookup). + let sum: u32 = a.iter().chain(l).map(|&s| u32::from(s)).sum(); + let (shift1, multiplier) = dc_rect_multiplier(bw, bh); + let num = u64::from(sum + ((bw + bh) as u32 >> 1)); + (((num >> shift1) * multiplier) >> 16) as i32 + } } } +/// `dc_predictor_rect`'s per-call `(shift1, multiplier)` (libaom +/// `intrapred.c`, `DC_MULTIPLIER_1X2`/`DC_MULTIPLIER_1X4`): shift `bw + bh` +/// right until it is odd; AV1's only rect ratios (1:2, 1:4) leave that odd +/// remainder at exactly 3 or 5. +fn dc_rect_multiplier(bw: usize, bh: usize) -> (u32, u64) { + let mut d = (bw + bh) as u32; + let mut shift1 = 0; + while d & 1 == 0 { + d >>= 1; + shift1 += 1; + } + let multiplier = match d { + 3 => 0x5556, + 5 => 0x3334, + _ => panic!("AV1 rect blocks are only 1:2 or 1:4 (bw={bw} bh={bh})"), + }; + (shift1, multiplier) +} + /// `Intra_Filter_Taps` (spec 7.11.2.3 / libaom `av1_filter_intra_taps`, /// `av1/common/reconintra.c`): five recursive-filter modes (DC/V/H/D157/Paeth /// variants, in that order), each predicting an 8-tap block of eight output @@ -664,7 +731,7 @@ pub fn predict_filter_intra( ) { assert_eq!(dst.len(), side * side, "the destination is the block"); assert_eq!(side % 4, 0, "filter intra only offers 4/8/16/32"); - let edges = Edges::build(above, left, corner, side); + let edges = Edges::build(above, left, corner, side, side); let taps = &FILTER_INTRA_TAPS[mode]; // A (side+1)-square buffer: row 0 / column 0 hold the corner and the // above/left edges, `buffer[r+1][c+1]` the block's own sample at (r, c). @@ -724,3 +791,174 @@ fn paeth(above: i32, left: i32, corner: i32) -> i32 { corner } } + +#[cfg(test)] +mod tests { + use super::*; + use std::collections::HashMap; + + /// Same deterministic synthetic ramp `lanes/intrarect_dump.c`'s `fill` + /// generates. + fn fill(n: usize, seed: i32) -> Vec { + (0..n) + .map(|i| ((i as i32 * 7 + seed * 13 + (i as i32 % 5) * 3).rem_euclid(256)) as u8) + .collect() + } + + /// `lanes/intrarect_dump.c`'s `checksum`: a position-weighted sum so a + /// wrong value anywhere in the block, not just at index 0, moves it. + fn checksum(dst: &[u8]) -> u64 { + dst.iter() + .enumerate() + .map(|(i, &v)| u64::from(v) * (i as u64 + 1)) + .sum() + } + + /// lane-intrarect r1: checksum-verify DC/SMOOTH/PAETH and a directional + /// sweep across all three zones, `enable_edge_filter`/`smooth_neighbor` + /// on and off, for eight rect shapes (both 1:2 and 1:4, both + /// orientations), against `lanes/intrarect_dump.c`'s independent C + /// transcription (`lanes/intrarect_dump.expected.txt`, generated by + /// `gcc -O2 lanes/intrarect_dump.c -o /tmp/intrarect_dump && + /// /tmp/intrarect_dump > lanes/intrarect_dump.expected.txt`). + #[test] + fn rect_predictors_match_c_dump() { + let expected_txt = std::fs::read_to_string(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../lanes/intrarect_dump.expected.txt" + )) + .expect( + "run gcc -O2 lanes/intrarect_dump.c -o /tmp/intrarect_dump && \ + /tmp/intrarect_dump > lanes/intrarect_dump.expected.txt first", + ); + // Keys: ("DC"|"SMOOTH"|"PAETH", bw, bh, angle, ef, sn) -> value. + // Non-directional entries use angle=0, ef=2, sn=2 (never matched by + // the directional lookups below, which always pass 0 or 1). + let mut expected: HashMap<(&str, usize, usize, i32, i32, i32), u64> = HashMap::new(); + for line in expected_txt.lines() { + let parts: Vec<&str> = line.split_whitespace().collect(); + let (bw, bh) = parts[0].split_once('x').unwrap(); + let (bw, bh): (usize, usize) = (bw.parse().unwrap(), bh.parse().unwrap()); + match parts[1] { + "DC" => { + let v: u64 = parts[2]["value=".len()..].parse().unwrap(); + expected.insert(("DC", bw, bh, 0, 2, 2), v); + } + "SMOOTH" | "PAETH" => { + let cs: u64 = parts[2]["checksum=".len()..].parse().unwrap(); + expected.insert((parts[1], bw, bh, 0, 2, 2), cs); + } + "DR" => { + let angle: i32 = parts[2]["angle=".len()..].parse().unwrap(); + let ef: i32 = parts[3]["ef=".len()..].parse().unwrap(); + let sn: i32 = parts[4]["sn=".len()..].parse().unwrap(); + let cs: u64 = parts[5]["checksum=".len()..].parse().unwrap(); + expected.insert(("DR", bw, bh, angle, ef, sn), cs); + } + other => panic!("unrecognised dump line kind {other}"), + } + } + + let shapes = [ + (8, 4), + (4, 8), + (16, 8), + (8, 16), + (4, 16), + (16, 4), + (32, 16), + (16, 32), + ]; + // (angle, mode, angle_delta) for every angle `intrarect_dump.c` + // sweeps -- the same reachable `Mode_To_Angle + delta * ANGLE_STEP` + // combinations the dump had to stay inside of. + let directional_cases: [(i32, u8, i32); 17] = [ + (45, D45_PRED, 0), + (48, D45_PRED, 1), + (64, D67_PRED, -1), + (67, D67_PRED, 0), + (84, V_PRED, -2), + (87, V_PRED, -1), + (113, D113_PRED, 0), + (116, D113_PRED, 1), + (135, D135_PRED, 0), + (138, D135_PRED, 1), + (157, D157_PRED, 0), + (160, D157_PRED, 1), + (171, H_PRED, -3), + (183, H_PRED, 1), + (186, H_PRED, 2), + (203, D203_PRED, 0), + (206, D203_PRED, 1), + ]; + + let mut checked = 0; + for &(bw, bh) in &shapes { + let reach = bw + bh; + let above = fill(reach, 1); + let left = fill(reach, 2); + let corner = ((bw * 3 + bh * 5) % 256) as u8; + + for (name, mode) in [("DC", DC_PRED), ("SMOOTH", SMOOTH_PRED), ("PAETH", PAETH_PRED)] { + let mut dst = vec![0u8; bw * bh]; + predict( + mode, + 0, + Some(&above), + Some(&left), + Some(corner), + bw, + bh, + false, + false, + &mut dst, + ); + let got = if name == "DC" { + u64::from(dst[0]) + } else { + checksum(&dst) + }; + let want = *expected + .get(&(name, bw, bh, 0, 2, 2)) + .unwrap_or_else(|| panic!("missing {name} {bw}x{bh} in the C dump")); + assert_eq!(got, want, "{name} {bw}x{bh}: rust {got} != C dump {want}"); + checked += 1; + } + + for &(angle, mode, delta) in &directional_cases { + for ef in [false, true] { + for sn in [false, true] { + let mut dst = vec![0u8; bw * bh]; + predict( + mode, + delta, + Some(&above), + Some(&left), + Some(corner), + bw, + bh, + ef, + sn, + &mut dst, + ); + let got = checksum(&dst); + let key = ("DR", bw, bh, angle, i32::from(ef), i32::from(sn)); + let want = *expected.get(&key).unwrap_or_else(|| { + panic!("missing DR {bw}x{bh} angle={angle} ef={ef} sn={sn} in the C dump") + }); + assert_eq!( + got, want, + "DR {bw}x{bh} angle={angle} ef={ef} sn={sn}: rust {got} != C dump {want}" + ); + checked += 1; + } + } + } + } + assert_eq!( + checked, + shapes.len() * (3 + directional_cases.len() * 4), + "checked every (shape, mode/angle, ef, sn) combination" + ); + } +} diff --git a/lanes/intrarect-r1.charter.md b/lanes/intrarect-r1.charter.md new file mode 100644 index 00000000..bb616c16 --- /dev/null +++ b/lanes/intrarect-r1.charter.md @@ -0,0 +1,63 @@ +# lane-intrarect r1 charter — rectangular INTRA prediction (predictor + edges only) + +Worktree /home/user/Documents/Code/Rust/edith_codecs-intrarect, branch lane-intrarect @ daa0e4b. +Build/test ONLY: `env CARGO_TARGET_DIR=$HOME/.cache/cargo-target-intrarect CARGO_BUILD_JOBS=4 nice -n 19 cargo test -p ec-av1 --release --lib -- --nocapture` +FOREGROUND. Never push; never touch other worktrees (lane-gm is live in a sibling dir); fixtures/ is a symlink. +BUDGET ~55 calls: WIP COMMIT after every green milestone; commit + report by call 45. +libaom oracle source: ~/.cache/aom-oracle/src (NOT /tmp). + +## Why this lane +The free-partition and AB gates refuse 17/40 attempts on INTRA-frame rect/AB +partitions (`unsupported: AV1 tile (a partition type this encoder never writes +(value=1|2|4|5|6|7))` raised from the KEY-frame dispatch, decode.rs ~3624/~3841). +The inter side already decodes those partitions (HORZ/VERT/HORZ_A/VERT_A/VERT_B); +the intra side cannot, because the predictor itself is square-only. + +## The blocker, precisely +`crates/ec-av1/src/intra.rs::predict` takes ONE `side: usize` and asserts +`dst.len() == side * side`; `Edges::build` extends each edge to `side * 2`. +A 32x16 intra block needs `bw != bh` everywhere: DC's average over +`bw + bh` samples, the directional walk's separate x/y extents, SMOOTH's two +different weight tables, PAETH, and the edge extension to `bw + bh` (not +`2*side`). + +## Scope — THE PREDICTOR ONLY. Do not touch the tile dispatch this round. +1. Widen `Edges::build` and `predict` to `(bw, bh)`. Every existing caller + (21 call sites across the crate) passes `(side, side)` — zero behavior + change there, and that is the main thing the gates below prove. +2. Port each mode's rect behaviour from ~/.cache/aom-oracle/src: + - `aom_dsp/intrapred.c`: dc_predictor / dc_left / dc_top / dc_128 variants + (`dc_predictor_rect` has the `bw + bh` sum with its expN/multiplier + rounding -- transcribe the exact table use, do not re-derive it), + `smooth_predictor` (`sm_weight_arrays` indexed separately by bw and bh), + `paeth_predictor`, `v_/h_predictor`. + - `av1/common/reconintra.c`: `av1_dr_prediction_z1/z2/z3` (the three + directional zones take `bw`/`bh` separately, `dx`/`dy` from + `av1_get_dr_intra_derivative`), `av1_filter_intra_edge`, + `av1_upsample_intra_edge`, and `get_filt_type`/`intra_edge_filter_strength` + which are indexed by `bw + bh` -- the blkWh term is where a square-only + port silently diverges first (class decision-at-wrong-granularity). +3. Unit tests: for a handful of (mode, angle_delta, bw, bh) combinations with + bw != bh, assert the produced block against values you TRANSCRIBE from the + C code by hand-running it in the test comment (show the arithmetic), OR + better: build a tiny C harness under lanes/ that links the oracle's + intrapred and dumps reference blocks, and check a checksum per case -- + that is what lane-wedge did for its codebook (lanes/wedge_dump.c is the + pattern to copy; the independent-oracle proof is what makes it landable). + +## Gate ladder +(a) full lib suite (`-- --skip a_real_aomenc_stream_with_interintra_wedge`) -- + every square path must be BIT-IDENTICAL; this is the real proof of item 1; +(b) 14-pin default list; +(c) the intra gates by name (filter_intra, directional_chroma, tx_select, + intra_with_deblocking) -- run them, they exercise the predictor hardest. +NOTE: the aomenc oracle now lives at ~/.cache/aom-oracle/build/aomenc; export +`EC_AV1_REQUIRE_AOMENC=1` on gate runs so a missing oracle FAILS instead of +silently skipping. + +## Done criteria +1. `predict`/`Edges` are rect-capable and C-verified for bw != bh; all square + behaviour bit-identical (suite green); the tile dispatch still refuses + (next lane flips it). +2. WIP commits; REPORT lanes/intrarect-r1.report.md, verdict FIRST line, + naming exactly which modes are C-verified vs transcribed-only. diff --git a/lanes/intrarect-r1.report.md b/lanes/intrarect-r1.report.md new file mode 100644 index 00000000..50724575 --- /dev/null +++ b/lanes/intrarect-r1.report.md @@ -0,0 +1,125 @@ +# lane-intrarect r1 report + +VERDICT: DONE -- `intra::predict`/`Edges` are rect-capable (`bw != bh`), +C-verified for 8 rect shapes across DC/SMOOTH/PAETH + 17 directional angles +x {enable_edge_filter, smooth_neighbor}; full lib suite 224/224 (was +223/223, +1 the new C-verify test), square behaviour unchanged; tile +dispatch still refuses rect/AB partitions. + +## What changed +`crates/ec-av1/src/intra.rs`: +- `Edges::build`, `predict`, `directional`, `dc` all take `(bw, bh)` instead + of one `side`. `Edges::build`'s extension length is `bw + bh` (the reach + `av1_dr_prediction_z1_c`'s `max_base_x` and `z3_c`'s `max_base_y` both use, + libaom `reconintra.c`). +- `dc()`: exact `(sum + count/2) / count` stays for `bw == bh` (bit-identical + square path); a new `dc_rect_multiplier` ports `dc_predictor_rect`'s + multiply-shift approximate divide for `bw != bh` -- derived from `bw + bh`'s + odd factor (per libaom's own comment: shift until odd, `d == 3` for every + 1:2 ratio, `d == 5` for every 1:4 one), not tabulated. +- `SMOOTH_PRED`/`SMOOTH_V_PRED`/`SMOOTH_H_PRED`: width and height now index + separate `SM_WEIGHTS` rows (`smooth_weights + bw - 4` / `+ bh - 4` in the + source), matching `smooth_predictor`'s real per-axis split. +- `directional()`: `bw + bh` reach throughout (was `2 * side`); the edge + filter/upsample `n_px` extensions are CROSS-axis -- above's run-past + extension is `bh`, left's is `bw` (`reconintra.c`'s `txwpx`/`txhpx` argument + swap between the above and left calls). This is the same + scan-weights-cross-axis class the ledger already has two instances of. +- **Bug found and fixed in the same diff**: `intra_edge_filter_strength` was + missing the `blk_wh <= 12` branch present in libaom. No square block's + `bw + bh` ever lands in `9..=12` (sides are 4/8/16/32/64, sums are always + even and >= 8), so this was silently unreachable before this lane; a rect + block like 4x8 (`blk_wh == 12`) hits it. Ported verbatim. +- 21 call sites (`encode.rs` x4, `decode.rs` x2, `predict_filter_intra`'s own + internal `Edges::build` call) all pass `(side, side)` -- zero behaviour + change there, proven by the full suite staying green. +- `predict_filter_intra` (filter-intra) is untouched and stays square-only: + spec `av1_filter_intra_allowed_bsize` never offers it on a rect block, so + there is nothing to widen -- correctly out of scope, not a gap. + +## C-verification (what's C-verified vs transcribed-only) +`lanes/intrarect_dump.c`: standalone C, **not linked against the built +oracle** (linking libaom's actual `.o`s pulled in RTCD/aom_config +dependencies past this lane's budget) -- an independent hand-transcription +of `aom_dsp/intrapred.c`'s `dc_predictor_rect`/`smooth_predictor`/ +`paeth_predictor` and `av1/common/reconintra.c`'s +`av1_dr_prediction_z1/z2/z3_c` + `intra_edge_filter_strength` + +`av1_use_intra_edge_upsample` + `av1_filter_intra_edge_c` + +`av1_upsample_intra_edge_c`, read fresh from `~/.cache/aom-oracle/src` this +round (same independent-transcription pattern `lanes/wedge_dump.c` used, +per the charter's shared-oracle-blindness note). + +**C-verified** (checksum-matched, 568 cases, `intra::tests::rect_predictors_match_c_dump`): +- `DC_PRED` (both the exact-divide and `dc_predictor_rect` approximate-divide + paths, since the test only exercises `bw != bh` shapes here) +- `SMOOTH_PRED`, `PAETH_PRED` +- All eight directional modes (`V_PRED`, `H_PRED`, `D45`/`D67`/`D113`/`D135`/ + `D157`/`D203_PRED`) across z1/z2/z3, both `enable_edge_filter` states, both + `smooth_neighbor` states, for shapes 8x4/4x8/16x8/8x16/4x16/16x4/32x16/16x32 + (both 1:2 and 1:4 ratios, both orientations) + +**Transcribed-only, not independently C-verified this round**: +- `SMOOTH_V_PRED`/`SMOOTH_H_PRED` -- same weight-split code path as + `SMOOTH_PRED` (which is verified), not separately dumped +- `filter_intra_edge_corner`'s rect gate (`reach >= 24`) -- exercised by the + dump's angle/shape sweep whenever it applies, but not isolated as its own + case +- The `n_top`/`n_left` < full-reach path (a block against the frame edge with + fewer real neighbour samples than `bw`/`bh`) -- the dump feeds full-length + synthetic neighbours throughout; this is unchanged pre-existing + `Edges::build` repeat-extension logic, not something this lane's widening + touches structurally, and it's exercised (for squares) by the full suite + +## Gate ladder run +(a) full lib suite: `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --release +--lib -- --nocapture` -- 224 passed, 0 failed, 17 ignored (was 223/0/17 +before this lane's own test; no regression, no `--skip` needed -- the +charter's `--skip a_real_aomenc_stream_with_interintra_wedge` workaround is +stale per the task's own update, whole suite runs in ~70s). +(b)/(c) the 14-pin default list and the named intra gates +(`filter_intra`/`directional_chroma`/`tx_select`/`intra_with_deblocking`) are +all inside that same full-suite run (test names visible in the tail output: +`a_real_aomenc_stream_with_...` for all of them), all green. + +## Commits (this worktree, lane-intrarect branch, not pushed) +- `bade5c8` feat(av1): widen intra::predict/Edges to rect (bw != bh) +- `6813a8a` test(av1): C-verify rect intra predictors against an independent transcription + +## Deviations from the charter +- Skipped the charter's stale `--skip a_real_aomenc_stream_with_interintra_wedge` + per the task's explicit override. +- Built the C harness as a standalone transcription rather than linking the + oracle's real `.o` files, matching `wedge_dump.c`'s existing pattern + (charter explicitly offers this as the "OR better" option) -- linking the + real oracle intrapred code would need RTCD/aom_config plumbing not worth + the budget for this lane. + +## Next lane +Flip the KEY-frame tile dispatch (`decode.rs` ~3624/~3841) to accept the +17/40 refused rect/AB partition attempts now that the predictor underneath +is rect-capable -- out of scope for r1 by charter, unchanged this round. + +## Cross-provider verification (opus, 2026-08-30) — PASS, with two corrections + +All 6 claims CONFIRMED against pinned libaom v3.13.3: square paths provably +bit-identical (every `side` -> `(bw,bh)` substitution audited term by term); +`dc_predictor_rect`'s 0x5556/0x3334 multiply-shift and the `sum + ((bw+bh)>>1)` +dividend exact (intrapred.c:236-279); smooth weight rows not transposed +(intrapred.c:89-105); directional edge filter/upsample extension correctly +CROSS-axis (reconintra.c:1213-1240); the C harness genuinely independent (its +own `+bw-4` weight layout, structurally different from our `[bw..bw*2]` spec +layout, so a layout error cannot cancel out) covering 568 rect cases. + +CORRECTIONS to this report's earlier claims: +1. "Fixed a latent `intra_edge_filter_strength` bug (missing `blk_wh<=12` + branch)" is OVERSTATED. The branch does exist in reconintra.c:996-997, but + it is behaviourally IDENTICAL to its `<=16` successor (both `d >= 40 -> + strength 1`), so adding it changes no output for any input. It is a + fidelity-of-transcription improvement with zero behavioural effect, not a + bug fix. +2. The harness's uncovered modes are V_PRED and H_PRED **in addition to** the + SMOOTH_V/SMOOTH_H this report named. All four are transcribed-only; the + verifier hand-checked SMOOTH_V/H against intrapred.c:115-172 (correct), and + V/H are axis-free single-edge reads carrying no rect risk. +Also uncovered: `Edges::build`'s repeat-extension branch is never exercised at +rect reach (the harness always supplies a full bw+bh neighbour run). diff --git a/lanes/intrarect_dump.c b/lanes/intrarect_dump.c new file mode 100644 index 00000000..1adae760 --- /dev/null +++ b/lanes/intrarect_dump.c @@ -0,0 +1,323 @@ +/* lane-intrarect r1: standalone C reimplementation of libaom's rect intra + * predictors, transcribed verbatim from the source read this round + * (aom_dsp/intrapred.c's dc_predictor_rect/smooth_predictor/paeth_predictor + * /v_predictor/h_predictor, av1/common/reconintra.c's + * av1_dr_prediction_z1/z2/z3_c, intra_edge_filter_strength, + * av1_use_intra_edge_upsample, av1_filter_intra_edge_c, + * av1_upsample_intra_edge_c). Compiled and run independently of the Rust + * port -- see lanes/wedge_dump.c for the pattern this copies and the + * charter's shared-oracle-blindness note on why an independent + * transcription is the check, not the table data. + * + * Every predictor here takes `above`/`left` pointers offset so index -1 is + * the corner, exactly like the real decoder passes them (`above_row`/ + * `left_col` in reconintra.c) -- the harness's caller fills bw+bh worth of + * real samples (no repeat-extension case exercised; that logic is untouched + * square-path code already proven by the 223/223 lib suite). + */ +#include +#include +#include + +typedef uint8_t u8; + +static inline int round2(int value, int shift) { + return (value + (1 << (shift - 1))) >> shift; +} +static inline int clip_pixel(int v) { return v < 0 ? 0 : v > 255 ? 255 : v; } + +static const u8 smooth_weights[] = { + 255, 149, 85, 64, + 255, 197, 146, 105, 73, 50, 37, 32, + 255, 225, 196, 170, 145, 123, 102, 84, 68, 54, 43, 33, 26, 20, 17, 16, + 255, 240, 225, 210, 196, 182, 169, 157, 145, 133, 122, 111, 101, 92, 83, 74, + 66, 59, 52, 45, 39, 34, 29, 25, 21, 17, 14, 12, 10, 9, 8, 8, + 255, 248, 240, 233, 225, 218, 210, 203, 196, 189, 182, 176, 169, 163, 156, + 150, 144, 138, 133, 127, 121, 116, 111, 106, 101, 96, 91, 86, 82, 77, 73, 69, + 65, 61, 57, 54, 50, 47, 44, 41, 38, 35, 32, 29, 27, 25, 22, 20, 18, 16, 15, + 13, 12, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 4 +}; + +/* dc_predictor_rect, aom_dsp/intrapred.c: bw != bh always goes through this + * multiply-shift approximate divide (never the exact (sum+half)/count a + * square block uses). */ +static int dc_predictor_rect(int bw, int bh, const u8 *above, const u8 *left) { + int sum = 0; + for (int i = 0; i < bw; i++) sum += above[i]; + for (int i = 0; i < bh; i++) sum += left[i]; + int d = bw + bh, shift1 = 0; + while ((d & 1) == 0) { d >>= 1; shift1++; } + int multiplier = d == 3 ? 0x5556 : 0x3334; + int interm = (sum + ((bw + bh) >> 1)) >> shift1; + return (interm * multiplier) >> 16; +} + +static void smooth_predictor(u8 *dst, int bw, int bh, const u8 *above, const u8 *left) { + const u8 below_pred = left[bh - 1]; + const u8 right_pred = above[bw - 1]; + const u8 *sm_w = smooth_weights + bw - 4; + const u8 *sm_h = smooth_weights + bh - 4; + for (int r = 0; r < bh; r++) { + for (int c = 0; c < bw; c++) { + unsigned this_pred = (unsigned)sm_h[r] * above[c] + (unsigned)(256 - sm_h[r]) * below_pred + + (unsigned)sm_w[c] * left[r] + (unsigned)(256 - sm_w[c]) * right_pred; + dst[r * bw + c] = (u8)round2((int)this_pred, 9); + } + } +} + +static void paeth_predictor(u8 *dst, int bw, int bh, const u8 *above, const u8 *left) { + const int tl = above[-1]; + for (int r = 0; r < bh; r++) { + for (int c = 0; c < bw; c++) { + int base = above[c] + left[r] - tl; + int dl = base - left[r]; dl = dl < 0 ? -dl : dl; + int da = base - above[c]; da = da < 0 ? -da : da; + int dc = base - tl; dc = dc < 0 ? -dc : dc; + dst[r * bw + c] = (u8)(dl <= da && dl <= dc ? left[r] : da <= dc ? above[c] : tl); + } + } +} + +/* intra_edge_filter_strength (reconintra.c) -- includes the blk_wh<=12 + * branch that has no square-side equivalent (bw==bh's sum is always even + * and >= 8, never lands in 9..=12), which is why the pre-lane Rust port + * never needed it. */ +static int intra_edge_filter_strength(int bs0, int bs1, int delta, int type) { + int d = delta < 0 ? -delta : delta; + int blk_wh = bs0 + bs1; + int strength = 0; + if (!type) { + if (blk_wh <= 8) { if (d >= 56) strength = 1; } + else if (blk_wh <= 12) { if (d >= 40) strength = 1; } + else if (blk_wh <= 16) { if (d >= 40) strength = 1; } + else if (blk_wh <= 24) { if (d >= 8) strength = 1; if (d >= 16) strength = 2; if (d >= 32) strength = 3; } + else if (blk_wh <= 32) { if (d >= 1) strength = 1; if (d >= 4) strength = 2; if (d >= 32) strength = 3; } + else { if (d >= 1) strength = 3; } + } else { + if (blk_wh <= 8) { if (d >= 40) strength = 1; if (d >= 64) strength = 2; } + else if (blk_wh <= 16) { if (d >= 20) strength = 1; if (d >= 48) strength = 2; } + else if (blk_wh <= 24) { if (d >= 4) strength = 3; } + else { if (d >= 1) strength = 3; } + } + return strength; +} + +static int use_intra_edge_upsample(int bs0, int bs1, int delta, int type) { + int d = delta < 0 ? -delta : delta; + int blk_wh = bs0 + bs1; + if (d == 0 || d >= 40) return 0; + return type ? blk_wh <= 8 : blk_wh <= 16; +} + +static void filter_intra_edge(u8 *p, int sz, int strength) { + if (!strength) return; + static const int kernel[3][5] = { { 0, 4, 8, 4, 0 }, { 0, 5, 6, 5, 0 }, { 2, 4, 4, 4, 2 } }; + const int filt = strength - 1; + u8 edge[300]; + memcpy(edge, p, sz); + for (int i = 1; i < sz; i++) { + int s = 0; + for (int j = 0; j < 5; j++) { + int k = i - 2 + j; + k = k < 0 ? 0 : k > sz - 1 ? sz - 1 : k; + s += edge[k] * kernel[filt][j]; + } + p[i] = (u8)((s + 8) >> 4); + } +} + +static void filter_intra_edge_corner(u8 *above, u8 *left) { + int s = left[0] * 5 + above[-1] * 6 + above[0] * 5; + s = (s + 8) >> 4; + above[-1] = (u8)s; + left[-1] = (u8)s; +} + +/* av1_upsample_intra_edge_c -- p[-1..sz-1] in, p[-2..2*sz-2] out. */ +static void upsample_intra_edge(u8 *p, int sz) { + u8 in[300]; + in[0] = p[-1]; + in[1] = p[-1]; + for (int i = 0; i < sz; i++) in[i + 2] = p[i]; + in[sz + 2] = p[sz - 1]; + p[-2] = in[0]; + for (int i = 0; i < sz; i++) { + int s = -in[i] + 9 * in[i + 1] + 9 * in[i + 2] - in[i + 3]; + s = clip_pixel((s + 8) >> 4); + p[2 * i - 1] = (u8)s; + p[2 * i] = in[i + 2]; + } +} + +/* dr_intra_derivative (spec 9.3). */ +static int dr_intra_derivative(int angle) { + static const struct { int a, v; } table[] = { + {3,1023},{6,547},{9,372},{14,273},{17,215},{20,178},{23,151},{26,132}, + {29,116},{32,102},{36,90},{39,80},{42,71},{45,64},{48,57},{51,51}, + {54,45},{58,40},{61,35},{64,31},{67,27},{70,23},{73,19},{76,15}, + {81,11},{84,7},{87,3}, + }; + for (size_t i = 0; i < sizeof(table) / sizeof(table[0]); i++) + if (table[i].a == angle) return table[i].v; + fprintf(stderr, "no derivative for %d\n", angle); + return 0; +} + +/* The whole directional path (reconintra.c's edge filter/upsample steps + * plus av1_dr_prediction_z1/z2/z3_c), rect reach `bw + bh` throughout, + * cross-axis n_px extensions (above gets `bh`, left gets `bw`) exactly as + * `build_directional_and_filter_intra_predictors` computes them. */ +static void directional(u8 *dst, int bw, int bh, int angle, int enable_edge_filter, + int smooth_neighbor, int n_top, int n_left, + u8 *above_buf, u8 *left_buf) { + /* above_buf/left_buf point at index -1 (corner); valid out to bw+bh-1. */ + u8 *above = above_buf; + u8 *left = left_buf; + int reach = bw + bh; + int need_above = angle < 180, need_left = angle > 90; + int need_right = angle < 90, need_bottom = angle > 180; + + if (enable_edge_filter && angle != 90 && angle != 180) { + if (need_above && need_left && reach >= 24) filter_intra_edge_corner(above, left); + if (need_above && n_top > 0) { + int strength = intra_edge_filter_strength(bw, bh, angle - 90, smooth_neighbor); + int n_px = n_top + 1 + (need_right ? bh : 0); + filter_intra_edge(above - 1, n_px, strength); + } + if (need_left && n_left > 0) { + int strength = intra_edge_filter_strength(bh, bw, angle - 180, smooth_neighbor); + int n_px = n_left + 1 + (need_bottom ? bw : 0); + filter_intra_edge(left - 1, n_px, strength); + } + } + int upsample_above = enable_edge_filter && use_intra_edge_upsample(bw, bh, angle - 90, smooth_neighbor); + int upsample_left = enable_edge_filter && use_intra_edge_upsample(bh, bw, angle - 180, smooth_neighbor); + if (need_above && upsample_above) upsample_intra_edge(above, bw + (need_right ? bh : 0)); + if (need_left && upsample_left) upsample_intra_edge(left, bh + (need_bottom ? bw : 0)); + + int dx = angle < 90 ? dr_intra_derivative(angle) : angle > 90 && angle < 180 ? dr_intra_derivative(180 - angle) : 0; + int dy = angle > 180 ? dr_intra_derivative(270 - angle) : angle > 90 && angle < 180 ? dr_intra_derivative(angle - 90) : 0; + + if (angle < 90) { + int max_base_x = (reach - 1) << upsample_above; + int frac_bits = 6 - upsample_above; + int base_inc = 1 << upsample_above; + int x = dx; + for (int r = 0; r < bh; r++, x += dx) { + int base = x >> frac_bits; + int shift = ((x << upsample_above) & 0x3F) >> 1; + for (int c = 0; c < bw; c++, base += base_inc) { + if (base < max_base_x) { + int val = above[base] * (32 - shift) + above[base + 1] * shift; + dst[r * bw + c] = (u8)round2(val, 5); + } else { + dst[r * bw + c] = above[max_base_x]; + } + } + } + } else if (angle > 180) { + int max_base_y = (reach - 1) << upsample_left; + int frac_bits = 6 - upsample_left; + int base_inc = 1 << upsample_left; + int y = dy; + for (int c = 0; c < bw; c++, y += dy) { + int base = y >> frac_bits; + int shift = ((y << upsample_left) & 0x3F) >> 1; + for (int r = 0; r < bh; r++, base += base_inc) { + if (base < max_base_y) { + int val = left[base] * (32 - shift) + left[base + 1] * shift; + dst[r * bw + c] = (u8)round2(val, 5); + } else { + dst[r * bw + c] = left[max_base_y]; + } + } + } + } else { + int min_base_x = -(1 << upsample_above); + int frac_bits_x = 6 - upsample_above; + int frac_bits_y = 6 - upsample_left; + for (int r = 0; r < bh; r++) { + for (int c = 0; c < bw; c++) { + int val; + int y = r + 1; + int x = (c << 6) - y * dx; + int base_x = x >> frac_bits_x; + if (base_x >= min_base_x) { + int shift = ((x * (1 << upsample_above)) & 0x3F) >> 1; + val = above[base_x] * (32 - shift) + above[base_x + 1] * shift; + val = round2(val, 5); + } else { + int x2 = c + 1; + int y2 = (r << 6) - x2 * dy; + int base_y = y2 >> frac_bits_y; + int shift = ((y2 * (1 << upsample_left)) & 0x3F) >> 1; + val = left[base_y] * (32 - shift) + left[base_y + 1] * shift; + val = round2(val, 5); + } + dst[r * bw + c] = (u8)val; + } + } + } +} + +static uint64_t checksum(const u8 *dst, int bw, int bh) { + uint64_t sum = 0; + for (int i = 0; i < bh; i++) + for (int j = 0; j < bw; j++) sum += (uint64_t)dst[i * bw + j] * (uint64_t)(i * bw + j + 1); + return sum; +} + +/* Deterministic synthetic neighbours: above[i] and left[i] both a simple + * ramp-with-wobble so the checksum is sensitive to every index used. */ +static void fill(u8 *buf, int n, int seed) { + for (int i = 0; i < n; i++) buf[i] = (u8)((i * 7 + seed * 13 + (i % 5) * 3) % 256); +} + +int main(void) { + int shapes[][2] = { {8,4},{4,8},{16,8},{8,16},{4,16},{16,4},{32,16},{16,32} }; + /* mode tags: 0=DC 1=V 2=H 3=SMOOTH 4=SMOOTH_V 5=SMOOTH_H 6=PAETH, + * 7..=13 directional angles handled separately below. */ + for (size_t s = 0; s < sizeof(shapes) / sizeof(shapes[0]); s++) { + int bw = shapes[s][0], bh = shapes[s][1]; + int reach = bw + bh; + u8 above_buf[300], left_buf[300]; + fill(above_buf + 1, reach, 1); + fill(left_buf + 1, reach, 2); + u8 corner = (u8)((bw * 3 + bh * 5) % 256); + above_buf[0] = corner; + left_buf[0] = corner; + u8 *above = above_buf + 1, *left = left_buf + 1; + u8 dst[512]; + + int dc = dc_predictor_rect(bw, bh, above, left); + printf("%dx%d DC value=%d\n", bw, bh, dc); + + smooth_predictor(dst, bw, bh, above, left); + printf("%dx%d SMOOTH checksum=%llu\n", bw, bh, (unsigned long long)checksum(dst, bw, bh)); + + paeth_predictor(dst, bw, bh, above, left); + printf("%dx%d PAETH checksum=%llu\n", bw, bh, (unsigned long long)checksum(dst, bw, bh)); + + /* directional: a handful of angles across all three zones, with and + * without the edge filter, both smooth_neighbor states. */ + /* Only angles actually reachable as Mode_To_Angle[mode] + angle_delta * + * ANGLE_STEP (delta in -3..=3, step 3) for some directional mode -- + * dr_intra_derivative's table is sparse and panics outside this set. */ + int angles[] = { 45, 48, 64, 67, 84, 87, 113, 116, 135, 138, 157, 160, + 171, 183, 186, 203, 206 }; + for (size_t a = 0; a < sizeof(angles) / sizeof(angles[0]); a++) { + for (int ef = 0; ef <= 1; ef++) { + for (int sn = 0; sn <= 1; sn++) { + u8 ab[300], le[300]; + memcpy(ab, above_buf, sizeof(above_buf)); + memcpy(le, left_buf, sizeof(left_buf)); + directional(dst, bw, bh, angles[a], ef, sn, bw, bh, ab + 1, le + 1); + printf("%dx%d DR angle=%d ef=%d sn=%d checksum=%llu\n", bw, bh, angles[a], ef, sn, + (unsigned long long)checksum(dst, bw, bh)); + } + } + } + } + return 0; +} diff --git a/lanes/intrarect_dump.expected.txt b/lanes/intrarect_dump.expected.txt new file mode 100644 index 00000000..b4449886 --- /dev/null +++ b/lanes/intrarect_dump.expected.txt @@ -0,0 +1,568 @@ +8x4 DC value=42 +8x4 SMOOTH checksum=29572 +8x4 PAETH checksum=23973 +8x4 DR angle=45 ef=0 sn=0 checksum=35699 +8x4 DR angle=45 ef=0 sn=1 checksum=35699 +8x4 DR angle=45 ef=1 sn=0 checksum=35595 +8x4 DR angle=45 ef=1 sn=1 checksum=35595 +8x4 DR angle=48 ef=0 sn=0 checksum=34662 +8x4 DR angle=48 ef=0 sn=1 checksum=34662 +8x4 DR angle=48 ef=1 sn=0 checksum=34477 +8x4 DR angle=48 ef=1 sn=1 checksum=34477 +8x4 DR angle=64 ef=0 sn=0 checksum=29920 +8x4 DR angle=64 ef=0 sn=1 checksum=29920 +8x4 DR angle=64 ef=1 sn=0 checksum=30097 +8x4 DR angle=64 ef=1 sn=1 checksum=29892 +8x4 DR angle=67 ef=0 sn=0 checksum=29260 +8x4 DR angle=67 ef=0 sn=1 checksum=29260 +8x4 DR angle=67 ef=1 sn=0 checksum=29277 +8x4 DR angle=67 ef=1 sn=1 checksum=29160 +8x4 DR angle=84 ef=0 sn=0 checksum=24921 +8x4 DR angle=84 ef=0 sn=1 checksum=24921 +8x4 DR angle=84 ef=1 sn=0 checksum=24908 +8x4 DR angle=84 ef=1 sn=1 checksum=24921 +8x4 DR angle=87 ef=0 sn=0 checksum=24182 +8x4 DR angle=87 ef=0 sn=1 checksum=24182 +8x4 DR angle=87 ef=1 sn=0 checksum=24172 +8x4 DR angle=87 ef=1 sn=1 checksum=24182 +8x4 DR angle=113 ef=0 sn=0 checksum=20767 +8x4 DR angle=113 ef=0 sn=1 checksum=20767 +8x4 DR angle=113 ef=1 sn=0 checksum=20905 +8x4 DR angle=113 ef=1 sn=1 checksum=21516 +8x4 DR angle=116 ef=0 sn=0 checksum=20512 +8x4 DR angle=116 ef=0 sn=1 checksum=20512 +8x4 DR angle=116 ef=1 sn=0 checksum=20617 +8x4 DR angle=116 ef=1 sn=1 checksum=21228 +8x4 DR angle=135 ef=0 sn=0 checksum=18423 +8x4 DR angle=135 ef=0 sn=1 checksum=18423 +8x4 DR angle=135 ef=1 sn=0 checksum=19333 +8x4 DR angle=135 ef=1 sn=1 checksum=19333 +8x4 DR angle=138 ef=0 sn=0 checksum=18221 +8x4 DR angle=138 ef=0 sn=1 checksum=18221 +8x4 DR angle=138 ef=1 sn=0 checksum=19173 +8x4 DR angle=138 ef=1 sn=1 checksum=19331 +8x4 DR angle=157 ef=0 sn=0 checksum=18365 +8x4 DR angle=157 ef=0 sn=1 checksum=18365 +8x4 DR angle=157 ef=1 sn=0 checksum=18549 +8x4 DR angle=157 ef=1 sn=1 checksum=19802 +8x4 DR angle=160 ef=0 sn=0 checksum=18977 +8x4 DR angle=160 ef=0 sn=1 checksum=18977 +8x4 DR angle=160 ef=1 sn=0 checksum=18950 +8x4 DR angle=160 ef=1 sn=1 checksum=20135 +8x4 DR angle=171 ef=0 sn=0 checksum=21256 +8x4 DR angle=171 ef=0 sn=1 checksum=21256 +8x4 DR angle=171 ef=1 sn=0 checksum=21290 +8x4 DR angle=171 ef=1 sn=1 checksum=21344 +8x4 DR angle=183 ef=0 sn=0 checksum=25992 +8x4 DR angle=183 ef=0 sn=1 checksum=25992 +8x4 DR angle=183 ef=1 sn=0 checksum=26098 +8x4 DR angle=183 ef=1 sn=1 checksum=25992 +8x4 DR angle=186 ef=0 sn=0 checksum=27620 +8x4 DR angle=186 ef=0 sn=1 checksum=27620 +8x4 DR angle=186 ef=1 sn=0 checksum=27689 +8x4 DR angle=186 ef=1 sn=1 checksum=27620 +8x4 DR angle=203 ef=0 sn=0 checksum=32331 +8x4 DR angle=203 ef=0 sn=1 checksum=32331 +8x4 DR angle=203 ef=1 sn=0 checksum=32429 +8x4 DR angle=203 ef=1 sn=1 checksum=32286 +8x4 DR angle=206 ef=0 sn=0 checksum=33327 +8x4 DR angle=206 ef=0 sn=1 checksum=33327 +8x4 DR angle=206 ef=1 sn=0 checksum=33393 +8x4 DR angle=206 ef=1 sn=1 checksum=33258 +4x8 DC value=46 +4x8 SMOOTH checksum=31942 +4x8 PAETH checksum=21653 +4x8 DR angle=45 ef=0 sn=0 checksum=37279 +4x8 DR angle=45 ef=0 sn=1 checksum=37279 +4x8 DR angle=45 ef=1 sn=0 checksum=37191 +4x8 DR angle=45 ef=1 sn=1 checksum=37191 +4x8 DR angle=48 ef=0 sn=0 checksum=34894 +4x8 DR angle=48 ef=0 sn=1 checksum=34894 +4x8 DR angle=48 ef=1 sn=0 checksum=34885 +4x8 DR angle=48 ef=1 sn=1 checksum=34885 +4x8 DR angle=64 ef=0 sn=0 checksum=26224 +4x8 DR angle=64 ef=0 sn=1 checksum=26224 +4x8 DR angle=64 ef=1 sn=0 checksum=26289 +4x8 DR angle=64 ef=1 sn=1 checksum=26127 +4x8 DR angle=67 ef=0 sn=0 checksum=24996 +4x8 DR angle=67 ef=0 sn=1 checksum=24996 +4x8 DR angle=67 ef=1 sn=0 checksum=25121 +4x8 DR angle=67 ef=1 sn=1 checksum=24980 +4x8 DR angle=84 ef=0 sn=0 checksum=18550 +4x8 DR angle=84 ef=0 sn=1 checksum=18550 +4x8 DR angle=84 ef=1 sn=0 checksum=18401 +4x8 DR angle=84 ef=1 sn=1 checksum=18550 +4x8 DR angle=87 ef=0 sn=0 checksum=16592 +4x8 DR angle=87 ef=0 sn=1 checksum=16592 +4x8 DR angle=87 ef=1 sn=0 checksum=16503 +4x8 DR angle=87 ef=1 sn=1 checksum=16592 +4x8 DR angle=113 ef=0 sn=0 checksum=18478 +4x8 DR angle=113 ef=0 sn=1 checksum=18478 +4x8 DR angle=113 ef=1 sn=0 checksum=18748 +4x8 DR angle=113 ef=1 sn=1 checksum=20501 +4x8 DR angle=116 ef=0 sn=0 checksum=19931 +4x8 DR angle=116 ef=0 sn=1 checksum=19931 +4x8 DR angle=116 ef=1 sn=0 checksum=20292 +4x8 DR angle=116 ef=1 sn=1 checksum=21753 +4x8 DR angle=135 ef=0 sn=0 checksum=25924 +4x8 DR angle=135 ef=0 sn=1 checksum=25924 +4x8 DR angle=135 ef=1 sn=0 checksum=26534 +4x8 DR angle=135 ef=1 sn=1 checksum=26534 +4x8 DR angle=138 ef=0 sn=0 checksum=26694 +4x8 DR angle=138 ef=0 sn=1 checksum=26694 +4x8 DR angle=138 ef=1 sn=0 checksum=27243 +4x8 DR angle=138 ef=1 sn=1 checksum=27298 +4x8 DR angle=157 ef=0 sn=0 checksum=30351 +4x8 DR angle=157 ef=0 sn=1 checksum=30351 +4x8 DR angle=157 ef=1 sn=0 checksum=30455 +4x8 DR angle=157 ef=1 sn=1 checksum=30639 +4x8 DR angle=160 ef=0 sn=0 checksum=30841 +4x8 DR angle=160 ef=0 sn=1 checksum=30841 +4x8 DR angle=160 ef=1 sn=0 checksum=30892 +4x8 DR angle=160 ef=1 sn=1 checksum=31126 +4x8 DR angle=171 ef=0 sn=0 checksum=32631 +4x8 DR angle=171 ef=0 sn=1 checksum=32631 +4x8 DR angle=171 ef=1 sn=0 checksum=32703 +4x8 DR angle=171 ef=1 sn=1 checksum=32631 +4x8 DR angle=183 ef=0 sn=0 checksum=34594 +4x8 DR angle=183 ef=0 sn=1 checksum=34594 +4x8 DR angle=183 ef=1 sn=0 checksum=34618 +4x8 DR angle=183 ef=1 sn=1 checksum=34594 +4x8 DR angle=186 ef=0 sn=0 checksum=35232 +4x8 DR angle=186 ef=0 sn=1 checksum=35232 +4x8 DR angle=186 ef=1 sn=0 checksum=35287 +4x8 DR angle=186 ef=1 sn=1 checksum=35232 +4x8 DR angle=203 ef=0 sn=0 checksum=38755 +4x8 DR angle=203 ef=0 sn=1 checksum=38755 +4x8 DR angle=203 ef=1 sn=0 checksum=38765 +4x8 DR angle=203 ef=1 sn=1 checksum=38686 +4x8 DR angle=206 ef=0 sn=0 checksum=39390 +4x8 DR angle=206 ef=0 sn=1 checksum=39390 +4x8 DR angle=206 ef=1 sn=0 checksum=39526 +4x8 DR angle=206 ef=1 sn=1 checksum=39361 +16x8 DC value=66 +16x8 SMOOTH checksum=735802 +16x8 PAETH checksum=504530 +16x8 DR angle=45 ef=0 sn=0 checksum=944678 +16x8 DR angle=45 ef=0 sn=1 checksum=944678 +16x8 DR angle=45 ef=1 sn=0 checksum=944110 +16x8 DR angle=45 ef=1 sn=1 checksum=944110 +16x8 DR angle=48 ef=0 sn=0 checksum=906243 +16x8 DR angle=48 ef=0 sn=1 checksum=906243 +16x8 DR angle=48 ef=1 sn=0 checksum=908131 +16x8 DR angle=48 ef=1 sn=1 checksum=908131 +16x8 DR angle=64 ef=0 sn=0 checksum=772721 +16x8 DR angle=64 ef=0 sn=1 checksum=772721 +16x8 DR angle=64 ef=1 sn=0 checksum=772104 +16x8 DR angle=64 ef=1 sn=1 checksum=771480 +16x8 DR angle=67 ef=0 sn=0 checksum=750724 +16x8 DR angle=67 ef=0 sn=1 checksum=750724 +16x8 DR angle=67 ef=1 sn=0 checksum=750821 +16x8 DR angle=67 ef=1 sn=1 checksum=752341 +16x8 DR angle=84 ef=0 sn=0 checksum=644540 +16x8 DR angle=84 ef=0 sn=1 checksum=644540 +16x8 DR angle=84 ef=1 sn=0 checksum=644540 +16x8 DR angle=84 ef=1 sn=1 checksum=654186 +16x8 DR angle=87 ef=0 sn=0 checksum=622368 +16x8 DR angle=87 ef=0 sn=1 checksum=622368 +16x8 DR angle=87 ef=1 sn=0 checksum=622368 +16x8 DR angle=87 ef=1 sn=1 checksum=622368 +16x8 DR angle=113 ef=0 sn=0 checksum=523077 +16x8 DR angle=113 ef=0 sn=1 checksum=523077 +16x8 DR angle=113 ef=1 sn=0 checksum=517536 +16x8 DR angle=113 ef=1 sn=1 checksum=521583 +16x8 DR angle=116 ef=0 sn=0 checksum=512825 +16x8 DR angle=116 ef=0 sn=1 checksum=512825 +16x8 DR angle=116 ef=1 sn=0 checksum=506767 +16x8 DR angle=116 ef=1 sn=1 checksum=511222 +16x8 DR angle=135 ef=0 sn=0 checksum=441500 +16x8 DR angle=135 ef=0 sn=1 checksum=441500 +16x8 DR angle=135 ef=1 sn=0 checksum=436765 +16x8 DR angle=135 ef=1 sn=1 checksum=436765 +16x8 DR angle=138 ef=0 sn=0 checksum=430140 +16x8 DR angle=138 ef=0 sn=1 checksum=430140 +16x8 DR angle=138 ef=1 sn=0 checksum=427051 +16x8 DR angle=138 ef=1 sn=1 checksum=427051 +16x8 DR angle=157 ef=0 sn=0 checksum=410463 +16x8 DR angle=157 ef=0 sn=1 checksum=410463 +16x8 DR angle=157 ef=1 sn=0 checksum=398819 +16x8 DR angle=157 ef=1 sn=1 checksum=404834 +16x8 DR angle=160 ef=0 sn=0 checksum=419402 +16x8 DR angle=160 ef=0 sn=1 checksum=419402 +16x8 DR angle=160 ef=1 sn=0 checksum=408761 +16x8 DR angle=160 ef=1 sn=1 checksum=414130 +16x8 DR angle=171 ef=0 sn=0 checksum=468448 +16x8 DR angle=171 ef=0 sn=1 checksum=468448 +16x8 DR angle=171 ef=1 sn=0 checksum=463551 +16x8 DR angle=171 ef=1 sn=1 checksum=466677 +16x8 DR angle=183 ef=0 sn=0 checksum=563230 +16x8 DR angle=183 ef=0 sn=1 checksum=563230 +16x8 DR angle=183 ef=1 sn=0 checksum=563230 +16x8 DR angle=183 ef=1 sn=1 checksum=563230 +16x8 DR angle=186 ef=0 sn=0 checksum=599306 +16x8 DR angle=186 ef=0 sn=1 checksum=599306 +16x8 DR angle=186 ef=1 sn=0 checksum=599306 +16x8 DR angle=186 ef=1 sn=1 checksum=599808 +16x8 DR angle=203 ef=0 sn=0 checksum=757612 +16x8 DR angle=203 ef=0 sn=1 checksum=757612 +16x8 DR angle=203 ef=1 sn=0 checksum=757229 +16x8 DR angle=203 ef=1 sn=1 checksum=757607 +16x8 DR angle=206 ef=0 sn=0 checksum=790176 +16x8 DR angle=206 ef=0 sn=1 checksum=790176 +16x8 DR angle=206 ef=1 sn=0 checksum=789485 +16x8 DR angle=206 ef=1 sn=1 checksum=789611 +8x16 DC value=70 +8x16 SMOOTH checksum=804128 +8x16 PAETH checksum=400982 +8x16 DR angle=45 ef=0 sn=0 checksum=1006678 +8x16 DR angle=45 ef=0 sn=1 checksum=1006678 +8x16 DR angle=45 ef=1 sn=0 checksum=1006680 +8x16 DR angle=45 ef=1 sn=1 checksum=1006680 +8x16 DR angle=48 ef=0 sn=0 checksum=937130 +8x16 DR angle=48 ef=0 sn=1 checksum=937130 +8x16 DR angle=48 ef=1 sn=0 checksum=937048 +8x16 DR angle=48 ef=1 sn=1 checksum=937048 +8x16 DR angle=64 ef=0 sn=0 checksum=677057 +8x16 DR angle=64 ef=0 sn=1 checksum=677057 +8x16 DR angle=64 ef=1 sn=0 checksum=676228 +8x16 DR angle=64 ef=1 sn=1 checksum=676296 +8x16 DR angle=67 ef=0 sn=0 checksum=635226 +8x16 DR angle=67 ef=0 sn=1 checksum=635226 +8x16 DR angle=67 ef=1 sn=0 checksum=635408 +8x16 DR angle=67 ef=1 sn=1 checksum=635933 +8x16 DR angle=84 ef=0 sn=0 checksum=436214 +8x16 DR angle=84 ef=0 sn=1 checksum=436214 +8x16 DR angle=84 ef=1 sn=0 checksum=436214 +8x16 DR angle=84 ef=1 sn=1 checksum=444760 +8x16 DR angle=87 ef=0 sn=0 checksum=390682 +8x16 DR angle=87 ef=0 sn=1 checksum=390682 +8x16 DR angle=87 ef=1 sn=0 checksum=390682 +8x16 DR angle=87 ef=1 sn=1 checksum=390682 +8x16 DR angle=113 ef=0 sn=0 checksum=439794 +8x16 DR angle=113 ef=0 sn=1 checksum=439794 +8x16 DR angle=113 ef=1 sn=0 checksum=423834 +8x16 DR angle=113 ef=1 sn=1 checksum=432386 +8x16 DR angle=116 ef=0 sn=0 checksum=470056 +8x16 DR angle=116 ef=0 sn=1 checksum=470056 +8x16 DR angle=116 ef=1 sn=0 checksum=450904 +8x16 DR angle=116 ef=1 sn=1 checksum=457951 +8x16 DR angle=135 ef=0 sn=0 checksum=616778 +8x16 DR angle=135 ef=0 sn=1 checksum=616778 +8x16 DR angle=135 ef=1 sn=0 checksum=612008 +8x16 DR angle=135 ef=1 sn=1 checksum=612008 +8x16 DR angle=138 ef=0 sn=0 checksum=639023 +8x16 DR angle=138 ef=0 sn=1 checksum=639023 +8x16 DR angle=138 ef=1 sn=0 checksum=635523 +8x16 DR angle=138 ef=1 sn=1 checksum=635523 +8x16 DR angle=157 ef=0 sn=0 checksum=744953 +8x16 DR angle=157 ef=0 sn=1 checksum=744953 +8x16 DR angle=157 ef=1 sn=0 checksum=742538 +8x16 DR angle=157 ef=1 sn=1 checksum=742612 +8x16 DR angle=160 ef=0 sn=0 checksum=761109 +8x16 DR angle=160 ef=0 sn=1 checksum=761109 +8x16 DR angle=160 ef=1 sn=0 checksum=758277 +8x16 DR angle=160 ef=1 sn=1 checksum=758253 +8x16 DR angle=171 ef=0 sn=0 checksum=809699 +8x16 DR angle=171 ef=0 sn=1 checksum=809699 +8x16 DR angle=171 ef=1 sn=0 checksum=806905 +8x16 DR angle=171 ef=1 sn=1 checksum=804414 +8x16 DR angle=183 ef=0 sn=0 checksum=860990 +8x16 DR angle=183 ef=0 sn=1 checksum=860990 +8x16 DR angle=183 ef=1 sn=0 checksum=860990 +8x16 DR angle=183 ef=1 sn=1 checksum=860990 +8x16 DR angle=186 ef=0 sn=0 checksum=877246 +8x16 DR angle=186 ef=0 sn=1 checksum=877246 +8x16 DR angle=186 ef=1 sn=0 checksum=877246 +8x16 DR angle=186 ef=1 sn=1 checksum=880208 +8x16 DR angle=203 ef=0 sn=0 checksum=959766 +8x16 DR angle=203 ef=0 sn=1 checksum=959766 +8x16 DR angle=203 ef=1 sn=0 checksum=960071 +8x16 DR angle=203 ef=1 sn=1 checksum=962081 +8x16 DR angle=206 ef=0 sn=0 checksum=977437 +8x16 DR angle=206 ef=0 sn=1 checksum=977437 +8x16 DR angle=206 ef=1 sn=0 checksum=977526 +8x16 DR angle=206 ef=1 sn=1 checksum=978053 +4x16 DC value=73 +4x16 SMOOTH checksum=190368 +4x16 PAETH checksum=90941 +4x16 DR angle=45 ef=0 sn=0 checksum=223790 +4x16 DR angle=45 ef=0 sn=1 checksum=223790 +4x16 DR angle=45 ef=1 sn=0 checksum=223934 +4x16 DR angle=45 ef=1 sn=1 checksum=223934 +4x16 DR angle=48 ef=0 sn=0 checksum=205926 +4x16 DR angle=48 ef=0 sn=1 checksum=205926 +4x16 DR angle=48 ef=1 sn=0 checksum=206043 +4x16 DR angle=48 ef=1 sn=1 checksum=206043 +4x16 DR angle=64 ef=0 sn=0 checksum=140765 +4x16 DR angle=64 ef=0 sn=1 checksum=140765 +4x16 DR angle=64 ef=1 sn=0 checksum=140532 +4x16 DR angle=64 ef=1 sn=1 checksum=140593 +4x16 DR angle=67 ef=0 sn=0 checksum=130523 +4x16 DR angle=67 ef=0 sn=1 checksum=130523 +4x16 DR angle=67 ef=1 sn=0 checksum=130400 +4x16 DR angle=67 ef=1 sn=1 checksum=130455 +4x16 DR angle=84 ef=0 sn=0 checksum=81800 +4x16 DR angle=84 ef=0 sn=1 checksum=81800 +4x16 DR angle=84 ef=1 sn=0 checksum=81800 +4x16 DR angle=84 ef=1 sn=1 checksum=84151 +4x16 DR angle=87 ef=0 sn=0 checksum=70112 +4x16 DR angle=87 ef=0 sn=1 checksum=70112 +4x16 DR angle=87 ef=1 sn=0 checksum=70112 +4x16 DR angle=87 ef=1 sn=1 checksum=70112 +4x16 DR angle=113 ef=0 sn=0 checksum=139227 +4x16 DR angle=113 ef=0 sn=1 checksum=139227 +4x16 DR angle=113 ef=1 sn=0 checksum=146905 +4x16 DR angle=113 ef=1 sn=1 checksum=148607 +4x16 DR angle=116 ef=0 sn=0 checksum=147139 +4x16 DR angle=116 ef=0 sn=1 checksum=147139 +4x16 DR angle=116 ef=1 sn=0 checksum=153696 +4x16 DR angle=116 ef=1 sn=1 checksum=154936 +4x16 DR angle=135 ef=0 sn=0 checksum=179046 +4x16 DR angle=135 ef=0 sn=1 checksum=179046 +4x16 DR angle=135 ef=1 sn=0 checksum=181777 +4x16 DR angle=135 ef=1 sn=1 checksum=181777 +4x16 DR angle=138 ef=0 sn=0 checksum=182440 +4x16 DR angle=138 ef=0 sn=1 checksum=182440 +4x16 DR angle=138 ef=1 sn=0 checksum=185345 +4x16 DR angle=138 ef=1 sn=1 checksum=185345 +4x16 DR angle=157 ef=0 sn=0 checksum=199670 +4x16 DR angle=157 ef=0 sn=1 checksum=199670 +4x16 DR angle=157 ef=1 sn=0 checksum=200138 +4x16 DR angle=157 ef=1 sn=1 checksum=199845 +4x16 DR angle=160 ef=0 sn=0 checksum=201999 +4x16 DR angle=160 ef=0 sn=1 checksum=201999 +4x16 DR angle=160 ef=1 sn=0 checksum=201918 +4x16 DR angle=160 ef=1 sn=1 checksum=201569 +4x16 DR angle=171 ef=0 sn=0 checksum=208549 +4x16 DR angle=171 ef=0 sn=1 checksum=208549 +4x16 DR angle=171 ef=1 sn=0 checksum=208097 +4x16 DR angle=171 ef=1 sn=1 checksum=207755 +4x16 DR angle=183 ef=0 sn=0 checksum=215200 +4x16 DR angle=183 ef=0 sn=1 checksum=215200 +4x16 DR angle=183 ef=1 sn=0 checksum=215200 +4x16 DR angle=183 ef=1 sn=1 checksum=215200 +4x16 DR angle=186 ef=0 sn=0 checksum=217302 +4x16 DR angle=186 ef=0 sn=1 checksum=217302 +4x16 DR angle=186 ef=1 sn=0 checksum=217302 +4x16 DR angle=186 ef=1 sn=1 checksum=218595 +4x16 DR angle=203 ef=0 sn=0 checksum=228883 +4x16 DR angle=203 ef=0 sn=1 checksum=228883 +4x16 DR angle=203 ef=1 sn=0 checksum=228719 +4x16 DR angle=203 ef=1 sn=1 checksum=229465 +4x16 DR angle=206 ef=0 sn=0 checksum=230924 +4x16 DR angle=206 ef=0 sn=1 checksum=230924 +4x16 DR angle=206 ef=1 sn=0 checksum=231170 +4x16 DR angle=206 ef=1 sn=1 checksum=232158 +16x4 DC value=65 +16x4 SMOOTH checksum=164631 +16x4 PAETH checksum=130203 +16x4 DR angle=45 ef=0 sn=0 checksum=203990 +16x4 DR angle=45 ef=0 sn=1 checksum=203990 +16x4 DR angle=45 ef=1 sn=0 checksum=203807 +16x4 DR angle=45 ef=1 sn=1 checksum=203807 +16x4 DR angle=48 ef=0 sn=0 checksum=199385 +16x4 DR angle=48 ef=0 sn=1 checksum=199385 +16x4 DR angle=48 ef=1 sn=0 checksum=198716 +16x4 DR angle=48 ef=1 sn=1 checksum=198716 +16x4 DR angle=64 ef=0 sn=0 checksum=179476 +16x4 DR angle=64 ef=0 sn=1 checksum=179476 +16x4 DR angle=64 ef=1 sn=0 checksum=179828 +16x4 DR angle=64 ef=1 sn=1 checksum=181001 +16x4 DR angle=67 ef=0 sn=0 checksum=177294 +16x4 DR angle=67 ef=0 sn=1 checksum=177294 +16x4 DR angle=67 ef=1 sn=0 checksum=176846 +16x4 DR angle=67 ef=1 sn=1 checksum=177939 +16x4 DR angle=84 ef=0 sn=0 checksum=162182 +16x4 DR angle=84 ef=0 sn=1 checksum=162182 +16x4 DR angle=84 ef=1 sn=0 checksum=162182 +16x4 DR angle=84 ef=1 sn=1 checksum=165478 +16x4 DR angle=87 ef=0 sn=0 checksum=159636 +16x4 DR angle=87 ef=0 sn=1 checksum=159636 +16x4 DR angle=87 ef=1 sn=0 checksum=159636 +16x4 DR angle=87 ef=1 sn=1 checksum=159636 +16x4 DR angle=113 ef=0 sn=0 checksum=144368 +16x4 DR angle=113 ef=0 sn=1 checksum=144368 +16x4 DR angle=113 ef=1 sn=0 checksum=147559 +16x4 DR angle=113 ef=1 sn=1 checksum=148421 +16x4 DR angle=116 ef=0 sn=0 checksum=142644 +16x4 DR angle=116 ef=0 sn=1 checksum=142644 +16x4 DR angle=116 ef=1 sn=0 checksum=145339 +16x4 DR angle=116 ef=1 sn=1 checksum=146373 +16x4 DR angle=135 ef=0 sn=0 checksum=125922 +16x4 DR angle=135 ef=0 sn=1 checksum=125922 +16x4 DR angle=135 ef=1 sn=0 checksum=132258 +16x4 DR angle=135 ef=1 sn=1 checksum=132258 +16x4 DR angle=138 ef=0 sn=0 checksum=123406 +16x4 DR angle=138 ef=0 sn=1 checksum=123406 +16x4 DR angle=138 ef=1 sn=0 checksum=129587 +16x4 DR angle=138 ef=1 sn=1 checksum=129587 +16x4 DR angle=157 ef=0 sn=0 checksum=97394 +16x4 DR angle=157 ef=0 sn=1 checksum=97394 +16x4 DR angle=157 ef=1 sn=0 checksum=105459 +16x4 DR angle=157 ef=1 sn=1 checksum=108033 +16x4 DR angle=160 ef=0 sn=0 checksum=92961 +16x4 DR angle=160 ef=0 sn=1 checksum=92961 +16x4 DR angle=160 ef=1 sn=0 checksum=101530 +16x4 DR angle=160 ef=1 sn=1 checksum=104616 +16x4 DR angle=171 ef=0 sn=0 checksum=84380 +16x4 DR angle=171 ef=0 sn=1 checksum=84380 +16x4 DR angle=171 ef=1 sn=0 checksum=91715 +16x4 DR angle=171 ef=1 sn=1 checksum=99319 +16x4 DR angle=183 ef=0 sn=0 checksum=107088 +16x4 DR angle=183 ef=0 sn=1 checksum=107088 +16x4 DR angle=183 ef=1 sn=0 checksum=107088 +16x4 DR angle=183 ef=1 sn=1 checksum=107088 +16x4 DR angle=186 ef=0 sn=0 checksum=116088 +16x4 DR angle=186 ef=0 sn=1 checksum=116088 +16x4 DR angle=186 ef=1 sn=0 checksum=116088 +16x4 DR angle=186 ef=1 sn=1 checksum=113485 +16x4 DR angle=203 ef=0 sn=0 checksum=154500 +16x4 DR angle=203 ef=0 sn=1 checksum=154500 +16x4 DR angle=203 ef=1 sn=0 checksum=154009 +16x4 DR angle=203 ef=1 sn=1 checksum=153847 +16x4 DR angle=206 ef=0 sn=0 checksum=162486 +16x4 DR angle=206 ef=0 sn=1 checksum=162486 +16x4 DR angle=206 ef=1 sn=0 checksum=162139 +16x4 DR angle=206 ef=1 sn=1 checksum=162183 +32x16 DC value=113 +32x16 SMOOTH checksum=20945846 +32x16 PAETH checksum=12066601 +32x16 DR angle=45 ef=0 sn=0 checksum=17379299 +32x16 DR angle=45 ef=0 sn=1 checksum=17379299 +32x16 DR angle=45 ef=1 sn=0 checksum=17368546 +32x16 DR angle=45 ef=1 sn=1 checksum=17368546 +32x16 DR angle=48 ef=0 sn=0 checksum=17577756 +32x16 DR angle=48 ef=0 sn=1 checksum=17577756 +32x16 DR angle=48 ef=1 sn=0 checksum=17563001 +32x16 DR angle=48 ef=1 sn=1 checksum=17563001 +32x16 DR angle=64 ef=0 sn=0 checksum=18289058 +32x16 DR angle=64 ef=0 sn=1 checksum=18289058 +32x16 DR angle=64 ef=1 sn=0 checksum=18239953 +32x16 DR angle=64 ef=1 sn=1 checksum=18239953 +32x16 DR angle=67 ef=0 sn=0 checksum=18384132 +32x16 DR angle=67 ef=0 sn=1 checksum=18384132 +32x16 DR angle=67 ef=1 sn=0 checksum=18323954 +32x16 DR angle=67 ef=1 sn=1 checksum=18323954 +32x16 DR angle=84 ef=0 sn=0 checksum=18160858 +32x16 DR angle=84 ef=0 sn=1 checksum=18160858 +32x16 DR angle=84 ef=1 sn=0 checksum=17993545 +32x16 DR angle=84 ef=1 sn=1 checksum=17993545 +32x16 DR angle=87 ef=0 sn=0 checksum=17521682 +32x16 DR angle=87 ef=0 sn=1 checksum=17521682 +32x16 DR angle=87 ef=1 sn=0 checksum=17648098 +32x16 DR angle=87 ef=1 sn=1 checksum=17648098 +32x16 DR angle=113 ef=0 sn=0 checksum=14286825 +32x16 DR angle=113 ef=0 sn=1 checksum=14286825 +32x16 DR angle=113 ef=1 sn=0 checksum=14213888 +32x16 DR angle=113 ef=1 sn=1 checksum=14213888 +32x16 DR angle=116 ef=0 sn=0 checksum=13931645 +32x16 DR angle=116 ef=0 sn=1 checksum=13931645 +32x16 DR angle=116 ef=1 sn=0 checksum=13842063 +32x16 DR angle=116 ef=1 sn=1 checksum=13842063 +32x16 DR angle=135 ef=0 sn=0 checksum=11473952 +32x16 DR angle=135 ef=0 sn=1 checksum=11473952 +32x16 DR angle=135 ef=1 sn=0 checksum=11346893 +32x16 DR angle=135 ef=1 sn=1 checksum=11346893 +32x16 DR angle=138 ef=0 sn=0 checksum=11054494 +32x16 DR angle=138 ef=0 sn=1 checksum=11054494 +32x16 DR angle=138 ef=1 sn=0 checksum=10965182 +32x16 DR angle=138 ef=1 sn=1 checksum=10965182 +32x16 DR angle=157 ef=0 sn=0 checksum=9743670 +32x16 DR angle=157 ef=0 sn=1 checksum=9743670 +32x16 DR angle=157 ef=1 sn=0 checksum=9621579 +32x16 DR angle=157 ef=1 sn=1 checksum=9621579 +32x16 DR angle=160 ef=0 sn=0 checksum=9944099 +32x16 DR angle=160 ef=0 sn=1 checksum=9944099 +32x16 DR angle=160 ef=1 sn=0 checksum=9824666 +32x16 DR angle=160 ef=1 sn=1 checksum=9824666 +32x16 DR angle=171 ef=0 sn=0 checksum=11341471 +32x16 DR angle=171 ef=0 sn=1 checksum=11341471 +32x16 DR angle=171 ef=1 sn=0 checksum=11301330 +32x16 DR angle=171 ef=1 sn=1 checksum=11301330 +32x16 DR angle=183 ef=0 sn=0 checksum=14224142 +32x16 DR angle=183 ef=0 sn=1 checksum=14224142 +32x16 DR angle=183 ef=1 sn=0 checksum=14275039 +32x16 DR angle=183 ef=1 sn=1 checksum=14275039 +32x16 DR angle=186 ef=0 sn=0 checksum=15202347 +32x16 DR angle=186 ef=0 sn=1 checksum=15202347 +32x16 DR angle=186 ef=1 sn=0 checksum=15231658 +32x16 DR angle=186 ef=1 sn=1 checksum=15231658 +32x16 DR angle=203 ef=0 sn=0 checksum=20054637 +32x16 DR angle=203 ef=0 sn=1 checksum=20054637 +32x16 DR angle=203 ef=1 sn=0 checksum=20065075 +32x16 DR angle=203 ef=1 sn=1 checksum=20065075 +32x16 DR angle=206 ef=0 sn=0 checksum=21025828 +32x16 DR angle=206 ef=0 sn=1 checksum=21025828 +32x16 DR angle=206 ef=1 sn=0 checksum=20964764 +32x16 DR angle=206 ef=1 sn=1 checksum=20964764 +16x32 DC value=117 +16x32 SMOOTH checksum=23192810 +16x32 PAETH checksum=9210317 +16x32 DR angle=45 ef=0 sn=0 checksum=17739139 +16x32 DR angle=45 ef=0 sn=1 checksum=17739139 +16x32 DR angle=45 ef=1 sn=0 checksum=17684214 +16x32 DR angle=45 ef=1 sn=1 checksum=17684214 +16x32 DR angle=48 ef=0 sn=0 checksum=19572638 +16x32 DR angle=48 ef=0 sn=1 checksum=19572638 +16x32 DR angle=48 ef=1 sn=0 checksum=19512961 +16x32 DR angle=48 ef=1 sn=1 checksum=19512961 +16x32 DR angle=64 ef=0 sn=0 checksum=19179170 +16x32 DR angle=64 ef=0 sn=1 checksum=19179170 +16x32 DR angle=64 ef=1 sn=0 checksum=19181507 +16x32 DR angle=64 ef=1 sn=1 checksum=19181507 +16x32 DR angle=67 ef=0 sn=0 checksum=17929369 +16x32 DR angle=67 ef=0 sn=1 checksum=17929369 +16x32 DR angle=67 ef=1 sn=0 checksum=17933010 +16x32 DR angle=67 ef=1 sn=1 checksum=17933010 +16x32 DR angle=84 ef=0 sn=0 checksum=11667688 +16x32 DR angle=84 ef=0 sn=1 checksum=11667688 +16x32 DR angle=84 ef=1 sn=0 checksum=11707190 +16x32 DR angle=84 ef=1 sn=1 checksum=11707190 +16x32 DR angle=87 ef=0 sn=0 checksum=10377756 +16x32 DR angle=87 ef=0 sn=1 checksum=10377756 +16x32 DR angle=87 ef=1 sn=0 checksum=10643393 +16x32 DR angle=87 ef=1 sn=1 checksum=10643393 +16x32 DR angle=113 ef=0 sn=0 checksum=11153430 +16x32 DR angle=113 ef=0 sn=1 checksum=11153430 +16x32 DR angle=113 ef=1 sn=0 checksum=10976241 +16x32 DR angle=113 ef=1 sn=1 checksum=10976241 +16x32 DR angle=116 ef=0 sn=0 checksum=11894475 +16x32 DR angle=116 ef=0 sn=1 checksum=11894475 +16x32 DR angle=116 ef=1 sn=0 checksum=11665880 +16x32 DR angle=116 ef=1 sn=1 checksum=11665880 +16x32 DR angle=135 ef=0 sn=0 checksum=16319430 +16x32 DR angle=135 ef=0 sn=1 checksum=16319430 +16x32 DR angle=135 ef=1 sn=0 checksum=16235395 +16x32 DR angle=135 ef=1 sn=1 checksum=16235395 +16x32 DR angle=138 ef=0 sn=0 checksum=16958711 +16x32 DR angle=138 ef=0 sn=1 checksum=16958711 +16x32 DR angle=138 ef=1 sn=0 checksum=16917512 +16x32 DR angle=138 ef=1 sn=1 checksum=16917512 +16x32 DR angle=157 ef=0 sn=0 checksum=20170318 +16x32 DR angle=157 ef=0 sn=1 checksum=20170318 +16x32 DR angle=157 ef=1 sn=0 checksum=20147774 +16x32 DR angle=157 ef=1 sn=1 checksum=20147774 +16x32 DR angle=160 ef=0 sn=0 checksum=20623341 +16x32 DR angle=160 ef=0 sn=1 checksum=20623341 +16x32 DR angle=160 ef=1 sn=0 checksum=20605550 +16x32 DR angle=160 ef=1 sn=1 checksum=20605550 +16x32 DR angle=171 ef=0 sn=0 checksum=22038775 +16x32 DR angle=171 ef=0 sn=1 checksum=22038775 +16x32 DR angle=171 ef=1 sn=0 checksum=22020627 +16x32 DR angle=171 ef=1 sn=1 checksum=22020627 +16x32 DR angle=183 ef=0 sn=0 checksum=22879452 +16x32 DR angle=183 ef=0 sn=1 checksum=22879452 +16x32 DR angle=183 ef=1 sn=0 checksum=22199846 +16x32 DR angle=183 ef=1 sn=1 checksum=22199846 +16x32 DR angle=186 ef=0 sn=0 checksum=22277140 +16x32 DR angle=186 ef=0 sn=1 checksum=22277140 +16x32 DR angle=186 ef=1 sn=0 checksum=21931119 +16x32 DR angle=186 ef=1 sn=1 checksum=21931119 +16x32 DR angle=203 ef=0 sn=0 checksum=19662206 +16x32 DR angle=203 ef=0 sn=1 checksum=19662206 +16x32 DR angle=203 ef=1 sn=0 checksum=19632671 +16x32 DR angle=203 ef=1 sn=1 checksum=19632671 +16x32 DR angle=206 ef=0 sn=0 checksum=19211284 +16x32 DR angle=206 ef=0 sn=1 checksum=19211284 +16x32 DR angle=206 ef=1 sn=0 checksum=19197701 +16x32 DR angle=206 ef=1 sn=1 checksum=19197701