forge
Explore
Log in

Don't you dare go Hollow

U3: remove the empty if/else residue left by the stripped counter and trace blocks (clippy needless_else, if_same_then_else, needless_ifs, needless_bool), the counter-only decode_path arm of smooth_uv_neighbour_unsnapped (and its pair-witness caller), the frame-size param only the straddling-unit counter read, the EC_RECTCHROMA_GAP eprintln, and the subsize census statics and dumps. Conditions removed were pure reads, so output is unchanged. cargo check -p ec-av1 --all-targets clean; clippy lib 105 -> 47

Browse files at this commit

fa2b150e5ccc01db9046af7069c6c69a31a68342Ahmet Kaan GümüşParent: 4214352
crates/ec-av1/src/decode/block.rsmodified+0 -65
@@ -694,13 +694,6 @@ pub(super) fn refuse_invalid_subsize(
694 part: usize,694 part: usize,
695 fctx: &crate::decode::FrameCtx,695 fctx: &crate::decode::FrameCtx,
696 ) -> Result<()> {696 ) -> Result<()> {
697- // lane-av1unwritten r6: the coverage artefact. A guard that sits INSIDE a
698- // `PARTITION_HORZ_A..=PARTITION_VERT_B` arm can only ever observe 4..=7, so
699- // "the guard is present" is not evidence that an offending value is caught --
700- // which is exactly how r5's three misplaced guards read as coverage. This
701- // records, per CALL SITE and per partition value, how often the guard was
702- // reached and how often it fired, so a site that never sees an offending
703- // value is visible instead of assumed covered.
704 let (bw, bh) = partition_subsize_dims(bsize, part);697 let (bw, bh) = partition_subsize_dims(bsize, part);
705 if chroma_plane_block_codable(bw, bh, ss_x(fctx), ss_y(fctx)) {698 if chroma_plane_block_codable(bw, bh, ss_x(fctx), ss_y(fctx)) {
706 Ok(())699 Ok(())
@@ -709,56 +702,6 @@ pub(super) fn refuse_invalid_subsize(
709 }702 }
710 }703 }
711 704
712-/// lane-av1unwritten r6: the OTHER half of the coverage artefact. The guard
713-/// table says what the guards see; this says what each DISPATCH ARM sees, so a
714-/// dispatch reached with an offending partition value and no guard above it is a
715-/// visible hole rather than an absence nobody noticed. `decode_probe` calls
716-/// [`dump_subsize_arm_scan`] at exit under `EC_AV1_SUBSIZE_ARM_TRACE`.
717-pub(super) static SUBSIZE_ARM: std::sync::LazyLock<
718- std::sync::Mutex<std::collections::BTreeMap<(&'static str, usize), usize>>,
719-> = std::sync::LazyLock::new(|| std::sync::Mutex::new(Default::default()));
720-
721-/// Prints and clears the [`note_subsize_arm`] table.
722-pub fn dump_subsize_arm_scan() {
723- let Ok(mut m) = SUBSIZE_ARM.lock() else {
724- return;
725- };
726- for ((site, k), n) in m.iter() {
727- eprintln!(
728- "SUBSIZE_ARM site={site} part={} codable={} reached={n}",
729- k / 2,
730- if k % 2 == 1 { "true" } else { "false" },
731- );
732- }
733- m.clear();
734-}
735-
736-/// Per-site, per-value counters for [`refuse_invalid_subsize`], plus the dump
737-/// that makes the reach/guard split readable. `EC_AV1_SUBSIZE_GUARD_TRACE`
738-/// records; `dump_subsize_guard_scan` prints (and clears) the table.
739-pub(super) static SUBSIZE_GUARD: std::sync::LazyLock<
740- std::sync::Mutex<std::collections::BTreeMap<(&'static str, usize, usize, bool), usize>>,
741-> = std::sync::LazyLock::new(|| std::sync::Mutex::new(Default::default()));
742-
743-/// Prints and clears the [`refuse_invalid_subsize`] table: one line per
744-/// (site, block, partition value) with the times reached and whether the guard
745-/// fired. `decode_probe` calls this at exit.
746-pub fn dump_subsize_guard_scan() {
747- let Ok(mut m) = SUBSIZE_GUARD.lock() else {
748- return;
749- };
750- for ((site, bsize, part, codable), n) in m.iter() {
751- eprintln!(
752- "SUBSIZE_GUARD site={site} bsize={}x{} part={part} codable={codable} \
753- reached={n}{}",
754- bsize / 256,
755- bsize % 256,
756- if *codable { "" } else { " FIRED" },
757- );
758- }
759- m.clear();
760-}
761-
762 /// [`chroma_plane_block_codable`] as libaom's refusal: a returned error naming705 /// [`chroma_plane_block_codable`] as libaom's refusal: a returned error naming
763 /// the shape and the subsampling mode, never an `assert!` -- a partition symbol706 /// the shape and the subsampling mode, never an `assert!` -- a partition symbol
764 /// is stream data, so a hostile file can reach it.707 /// is stream data, so a hostile file can reach it.
@@ -1736,14 +1679,6 @@ pub(super) fn decode_block(
1736 // leaf list per leaf (libaom `decode_token_recon_block`, whose token1679 // leaf list per leaf (libaom `decode_token_recon_block`, whose token
1737 // loop reconstructs whatever `read_tx_size_vartx` resolved, per1680 // loop reconstructs whatever `read_tx_size_vartx` resolved, per
1738 // transform unit), so mixed sizes reconstruct at their own stride.1681 // transform unit), so mixed sizes reconstruct at their own stride.
1739- // The counter marks the shape so a gate can prove a witness actually
1740- // carries a mixed tree and not merely another uniform one.
1741- let uniform = leaves.first().is_some_and(|f| {
1742- leaves
1743- .iter()
1744- .all(|l| (l.2, l.3) == (f.2, f.3) && l.2 == l.3)
1745- });
1746- if !uniform {}
1747 Some(leaves)1682 Some(leaves)
1748 } else {1683 } else {
1749 None1684 None
crates/ec-av1/src/decode/coeffs.rsmodified+0 -61
@@ -2064,7 +2064,6 @@ impl Neighbours {
2064 c,2064 c,
2065 ss_x(fctx),2065 ss_x(fctx),
2066 ss_y(fctx),2066 ss_y(fctx),
2067- true,
2068 )2067 )
2069 }2068 }
2070 2069
@@ -2073,18 +2072,6 @@ impl Neighbours {
2073 /// counter wants this: it measures how often the snap CHANGES the answer,2072 /// counter wants this: it measures how often the snap CHANGES the answer,
2074 /// which is what the lane-kf1200/kf900 chroma-reference fix buys. Every2073 /// which is what the lane-kf1200/kf900 chroma-reference fix buys. Every
2075 /// decode path uses the snapping form.2074 /// decode path uses the snapping form.
2076- /// `decode_path` is `true` only for the snapping form every decode call
2077- /// site uses; the 16x4/4x16 pair witness's mirror passes `false`, so the
2078- /// `+ss_y` counters measure a read that actually filters a chroma edge and
2079- /// not the counter-only one.
2080- ///
2081- /// lane-av1leftwit: the mirror's justification used to be "no committed
2082- /// fixture reaches the shape on the decode path", and that was false --
2083- /// `UV_LEFT_1MI_SPLIT_HITS` fires on five of them. The flag stays (a
2084- /// counter-only mirror at an ODD mi row is still not a decode-path read,
2085- /// and its result feeds only `RECT4_16_UV_PAIR_FILT_HITS`), but it is no
2086- /// longer evidence about the `+ss_y` term, and nothing may cite it as such.
2087- /// The decode path's own reach is `uv_left_1mi_split_hits()`.
2088 // Signature mirrors the spec's per-call inputs; a parameter struct would only move them.2075 // Signature mirrors the spec's per-call inputs; a parameter struct would only move them.
2089 #[allow(clippy::too_many_arguments)]2076 #[allow(clippy::too_many_arguments)]
2090 pub(super) fn smooth_uv_neighbour_unsnapped(2077 pub(super) fn smooth_uv_neighbour_unsnapped(
@@ -2095,7 +2082,6 @@ impl Neighbours {
2095 c: usize,2082 c: usize,
2096 ss_x: usize,2083 ss_x: usize,
2097 ss_y: usize,2084 ss_y: usize,
2098- decode_path: bool,
2099 ) -> bool {2085 ) -> bool {
2100 // lane-mtfix r1: availability is TILE-relative on BOTH axes and on the2086 // lane-mtfix r1: availability is TILE-relative on BOTH axes and on the
2101 // coarse fallback too. `above_uv_mode` is a frame-wide [`SUB`]-grid2087 // coarse fallback too. `above_uv_mode` is a frame-wide [`SUB`]-grid
@@ -2106,9 +2092,6 @@ impl Neighbours {
2106 // at chroma (120, 32), the top-right tile's first block).2092 // at chroma (120, 32), the top-right tile's first block).
2107 let have_above = mi_r > self.tile_row0_mi;2093 let have_above = mi_r > self.tile_row0_mi;
2108 let have_left = mi_c > self.tile_col0_mi;2094 let have_left = mi_c > self.tile_col0_mi;
2109- if self.tile_row0_mi > 0 && !have_above && self.above_uv_mode[c] != DC_PRED
2110- || self.tile_col0_mi > 0 && !have_left && self.left_uv_mode[r] != DC_PRED
2111- {}
2112 // The mi grid is libaom's own read; the two maps below stay as the2095 // The mi grid is libaom's own read; the two maps below stay as the
2113 // fallback for cells no block has written (see [`Self::uv_mode_grid`]).2096 // fallback for cells no block has written (see [`Self::uv_mode_grid`]).
2114 let cell = |grid: &Vec<u8>, row: usize, col: usize| -> Option<usize> {2097 let cell = |grid: &Vec<u8>, row: usize, col: usize| -> Option<usize> {
@@ -2196,40 +2179,6 @@ impl Neighbours {
2196 // every committed fixture and every one of the ~1000 encodes swept in2179 // every committed fixture and every one of the ~1000 encodes swept in
2197 // `lanes/av1leftref.report.md`, which is what makes the read change a2180 // `lanes/av1leftref.report.md`, which is what makes the read change a
2198 // proven no-op on today's material rather than an unmeasured guess.2181 // proven no-op on today's material rather than an unmeasured guess.
2199- if decode_path && have_left && ss_y > 0 {
2200- // The pre-lane read, kept as the counter's own-row arm: it is what
2201- // this decoder answered before the `+ss_y` term landed, and
2202- // comparing against it is what proves the term is load-bearing.
2203- // lane-av1leftwit: the geometry the `+ss_y` term needs. The two
2204- // cells are one left mi column apart, so they are two different
2205- // blocks exactly when the left neighbour is 1 mi tall or shorter.
2206- let col = left_mi.1;
2207- let epoch = UV_OWNER_EPOCH.with(|c| c.get()) & 0xff00_0000;
2208- let own = (col < self.uv_grid_cols)
2209- .then(|| self.uv_owner.get(mi_r * self.uv_grid_cols + col).copied())
2210- .flatten()
2211- .filter(|o| o & 0xff00_0000 == epoch)
2212- .unwrap_or(0);
2213- let down = self
2214- .uv_owner
2215- .get((mi_r + ss_y) * self.uv_grid_cols + col)
2216- .copied()
2217- .filter(|o| o & 0xff00_0000 == epoch)
2218- .unwrap_or(0);
2219- if own != 0 && down != 0 && own != down {}
2220- }
2221- if have_above && cell(&self.uv_mode_grid, mi_r - 1, mi_c).is_some_and(|m| {
2222- !matches!(self.uv_mode_col.get(mi_c), Some(&(row, cm)) if usize::from(row) == mi_r - 1 && usize::from(cm) == m)
2223- }) || have_left && cell(&self.uv_mode_grid, left_mi.0, left_mi.1).is_some_and(|m| {
2224- !matches!(self.uv_mode_row.get(left_mi.0), Some(&(col, cm)) if usize::from(col) == left_mi.1 && usize::from(cm) == m)
2225- }) {
2226- }
2227- // lane-cfl r1 counter: how often the mi-exact chroma neighbour differs
2228- // from the coarse [`SUB`] slot -- i.e. how often a chroma edge would
2229- // have been filtered at the wrong strength by the coarse map alone.
2230- if (is_smooth_mode(self.above_uv_mode[c]) && !is_smooth_mode(above))
2231- || (is_smooth_mode(self.left_uv_mode[r]) && !is_smooth_mode(left))
2232- {}
2233 is_smooth_mode(above) || is_smooth_mode(left)2182 is_smooth_mode(above) || is_smooth_mode(left)
2234 }2183 }
2235 2184
@@ -2282,14 +2231,6 @@ impl Neighbours {
2282 let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI));2231 let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI));
2283 let (above, left) =2232 let (above, left) =
2284 self.modes_above_left_mi(mi_r, mi_c, (self.above_mode[c], self.left_mode[r]));2233 self.modes_above_left_mi(mi_r, mi_c, (self.above_mode[c], self.left_mode[r]));
2285- if (is_smooth_mode(self.above_mode[c]) && !is_smooth_mode(above))
2286- || (is_smooth_mode(self.left_mode[r]) && !is_smooth_mode(left))
2287- {}
2288- // A neighbour the coarse band offered where the tile edge makes it
2289- // unavailable -- must never happen (see `MODE_TILE_EDGE_COARSE_LEAKS`).
2290- if (mi_r <= self.tile_row0_mi && self.above_mode[c] != DC_PRED)
2291- || (mi_c <= self.tile_col0_mi && self.left_mode[r] != DC_PRED)
2292- {}
2293 (above, left)2234 (above, left)
2294 }2235 }
2295 2236
@@ -2489,8 +2430,6 @@ impl Neighbours {
2489 // units rather than in luma mi.2430 // units rather than in luma mi.
2490 let (step_x, step_y) = (w_px / MI, h_px / MI);2431 let (step_x, step_y) = (w_px / MI, h_px / MI);
2491 // the flags read the CALLER's origin, before the shadowing align below2432 // the flags read the CALLER's origin, before the shadowing align below
2492- let (row_mid, col_mid) = (mi_r & (step_y - 1) != 0, mi_c & (step_x - 1) != 0);
2493- if row_mid || col_mid {}
2494 let (mi_r, mi_c) = (mi_r & !(step_y - 1), mi_c & !(step_x - 1));2433 let (mi_r, mi_c) = (mi_r & !(step_y - 1), mi_c & !(step_x - 1));
2495 let round_up_even = |n: usize| n.div_ceil(2) * 2;2434 let round_up_even = |n: usize| n.div_ceil(2) * 2;
2496 let (bound_h, bound_w) = (round_up_even(self.mi_rows), round_up_even(self.mi_cols));2435 let (bound_h, bound_w) = (round_up_even(self.mi_rows), round_up_even(self.mi_cols));
crates/ec-av1/src/decode/frame_tile.rsmodified+0 -23
@@ -975,9 +975,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
975 bw,975 bw,
976 bh976 bh
977 );977 );
978- if horz {
979- } else {
980- }
981 }978 }
982 // One `cdef_idx` per BLOCK, copied to every 64x64 CDEF unit it979 // One `cdef_idx` per BLOCK, copied to every 64x64 CDEF unit it
983 // covers -- both halves of the root read their own, and the980 // covers -- both halves of the root read their own, and the
@@ -1213,7 +1210,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
1213 bw,1210 bw,
1214 bh1211 bh
1215 );1212 );
1216- if !four && i == 0 && ((horz && !has_rows) || (!horz && !has_cols)) {}
1217 }1213 }
1218 continue;1214 continue;
1219 }1215 }
@@ -1588,9 +1584,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
1588 // residual path (`rect_inter_residual_supported`1584 // residual path (`rect_inter_residual_supported`
1589 // covers 16x8/8x16 since this round).1585 // covers 16x8/8x16 since this round).
1590 let horz = part16 == PARTITION_HORZ;1586 let horz = part16 == PARTITION_HORZ;
1591- if horz {
1592- } else {
1593- }
1594 let base_mi = sub16_to_mi(at16);1587 let base_mi = sub16_to_mi(at16);
1595 let (ww, wh) = if horz { (16, 8) } else { (8, 16) };1588 let (ww, wh) = if horz { (16, 8) } else { (8, 16) };
1596 for piece in 0..2 {1589 for piece in 0..2 {
@@ -1870,9 +1863,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
1870 bw,1863 bw,
1871 bh1864 bh
1872 );1865 );
1873- if horz {
1874- } else {
1875- }
1876 }1866 }
1877 } else if part16 != PARTITION_SPLIT {1867 } else if part16 != PARTITION_SPLIT {
1878 return Err(unsupported(1868 return Err(unsupported(
@@ -1892,11 +1882,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
1892 // 7.11.3.3's scaled walk. The counter is what1882 // 7.11.3.3's scaled walk. The counter is what
1893 // proves a gate actually reached a scaled1883 // proves a gate actually reached a scaled
1894 // leaf rather than a same-size reference.1884 // leaf rather than a same-size reference.
1895- if (1..8).any(|rf| {
1896- refpix
1897- .dims(rf)
1898- .is_some_and(|(w, _)| w != frame_width as usize)
1899- }) {}
1900 let mut prev_leaves: Vec<(1885 let mut prev_leaves: Vec<(
1901 (usize, usize),1886 (usize, usize),
1902 bool,1887 bool,
@@ -2290,7 +2275,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
2290 (frame_width as usize, frame_height as usize),2275 (frame_width as usize, frame_height as usize),
2291 fctx,2276 fctx,
2292 )?;2277 )?;
2293- if !has_rows32 {}
2294 // lane-golomb r2: at the frame edge only the first half of the2278 // lane-golomb r2: at the frame edge only the first half of the
2295 // strip is coded (libaom `decode_partition` guards the second2279 // strip is coded (libaom `decode_partition` guards the second
2296 // with the same has_rows32 test that made this partition non-square).2280 // with the same has_rows32 test that made this partition non-square).
@@ -2342,7 +2326,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
2342 (frame_width as usize, frame_height as usize),2326 (frame_width as usize, frame_height as usize),
2343 fctx,2327 fctx,
2344 )?;2328 )?;
2345- } else {
2346 }2329 }
2347 }2330 }
2348 PARTITION_VERT => {2331 PARTITION_VERT => {
@@ -2393,7 +2376,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
2393 (frame_width as usize, frame_height as usize),2376 (frame_width as usize, frame_height as usize),
2394 fctx,2377 fctx,
2395 )?;2378 )?;
2396- if !has_cols32 {}
2397 // lane-golomb r2: at the frame edge only the first half of the2379 // lane-golomb r2: at the frame edge only the first half of the
2398 // strip is coded (libaom `decode_partition` guards the second2380 // strip is coded (libaom `decode_partition` guards the second
2399 // with the same has_cols32 test that made this partition non-square).2381 // with the same has_cols32 test that made this partition non-square).
@@ -2445,7 +2427,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
2445 (frame_width as usize, frame_height as usize),2427 (frame_width as usize, frame_height as usize),
2446 fctx,2428 fctx,
2447 )?;2429 )?;
2448- } else {
2449 }2430 }
2450 }2431 }
2451 PARTITION_HORZ_A => {2432 PARTITION_HORZ_A => {
@@ -2939,9 +2920,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
2939 bw,2920 bw,
2940 bh2921 bh
2941 );2922 );
2942- if horz {
2943- } else {
2944- }
2945 }2923 }
2946 }2924 }
2947 _ => {2925 _ => {
@@ -3035,7 +3013,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
3035 &mut v,3013 &mut v,
3036 cdef,3014 cdef,
3037 &neighbours,3015 &neighbours,
3038- (frame_width as usize, frame_height as usize),
3039 fctx,3016 fctx,
3040 None,3017 None,
3041 None,3018 None,
crates/ec-av1/src/decode/inter_block.rsmodified+0 -5
@@ -470,10 +470,6 @@ pub(super) fn decode_inter_block(
470 // alone, which counts blocks that are not global-mv blocks at470 // alone, which counts blocks that are not global-mv blocks at
471 // all, so its number was an upper bound dressed up as an471 // all, so its number was an upper bound dressed up as an
472 // engagement figure.472 // engagement figure.
473- if mi_row < mi_rows as usize / 2 {
474- if is_globalmv {}
475- if is_global_mv0 || is_global_mv1 {}
476- }
477 // libaom `av1_init_warp_params` + `allow_warp`'s473 // libaom `av1_init_warp_params` + `allow_warp`'s
478 // `global_warp_allowed` branch, run once per reference for a474 // `global_warp_allowed` branch, run once per reference for a
479 // compound block exactly as for a single-ref one (reconinter.c475 // compound block exactly as for a single-ref one (reconinter.c
@@ -2228,7 +2224,6 @@ pub(super) fn decode_inter_block(
2228 .mask(0, wedge_index),2224 .mask(0, wedge_index),
2229 side,2225 side,
2230 ));2226 ));
2231- } else {
2232 }2227 }
2233 interintra_mode = Some(ii);2228 interintra_mode = Some(ii);
2234 // The inter-intra predictor reads this block's neighbours as already2229 // The inter-intra predictor reads this block's neighbours as already
crates/ec-av1/src/decode/inter_block8.rsmodified+0 -1
@@ -1426,7 +1426,6 @@ pub(super) fn decode_inter_block8(
1426 .mask(0, wedge_index),1426 .mask(0, wedge_index),
1427 SIDE,1427 SIDE,
1428 ));1428 ));
1429- } else {
1430 }1429 }
1431 interintra_mode = Some(ii);1430 interintra_mode = Some(ii);
1432 // The inter-intra predictor reads this block's neighbours as already1431 // The inter-intra predictor reads this block's neighbours as already
crates/ec-av1/src/decode/inter_ctx.rsmodified+0 -1
@@ -923,7 +923,6 @@ pub(super) fn read_single_ref(
923 if p4 == 1 { LAST2_FRAME } else { LAST_FRAME }923 if p4 == 1 { LAST2_FRAME } else { LAST_FRAME }
924 }924 }
925 };925 };
926- if ref_frame != LAST_FRAME {}
927 ref_frame926 ref_frame
928 }927 }
929 928
crates/ec-av1/src/decode/key_tile.rsmodified+0 -5
@@ -1778,7 +1778,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
1778 reduced_tx_set,1778 reduced_tx_set,
1779 fctx,1779 fctx,
1780 )?;1780 )?;
1781- if !has_rows32 {}
1782 // lane-hgkf r1: at the frame edge only the first half of the strip is1781 // lane-hgkf r1: at the frame edge only the first half of the strip is
1783 // coded (libaom `decode_partition` guards the second half with the same1782 // coded (libaom `decode_partition` guards the second half with the same
1784 // test that made this partition non-square).1783 // test that made this partition non-square).
@@ -1822,7 +1821,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
1822 reduced_tx_set,1821 reduced_tx_set,
1823 fctx,1822 fctx,
1824 )?;1823 )?;
1825- if !has_cols32 {}
1826 // lane-hgkf r1: at the frame edge only the first half of the strip is1824 // lane-hgkf r1: at the frame edge only the first half of the strip is
1827 // coded (libaom `decode_partition` guards the second half with the same1825 // coded (libaom `decode_partition` guards the second half with the same
1828 // test that made this partition non-square).1826 // test that made this partition non-square).
@@ -2209,7 +2207,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
2209 reduced_tx_set,2207 reduced_tx_set,
2210 fctx,2208 fctx,
2211 )?;2209 )?;
2212- if !has_rows {}
2213 // lane-golomb r1: at the frame edge only the first half of the2210 // lane-golomb r1: at the frame edge only the first half of the
2214 // strip is coded (libaom `decode_partition` guards the second2211 // strip is coded (libaom `decode_partition` guards the second
2215 // with the same has_rows test that made this partition non-square).2212 // with the same has_rows test that made this partition non-square).
@@ -2253,7 +2250,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
2253 reduced_tx_set,2250 reduced_tx_set,
2254 fctx,2251 fctx,
2255 )?;2252 )?;
2256- if !has_cols {}
2257 // lane-golomb r1: at the frame edge only the first half of the2253 // lane-golomb r1: at the frame edge only the first half of the
2258 // strip is coded (libaom `decode_partition` guards the second2254 // strip is coded (libaom `decode_partition` guards the second
2259 // with the same has_cols test that made this partition non-square).2255 // with the same has_cols test that made this partition non-square).
@@ -2489,7 +2485,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
2489 &mut v,2485 &mut v,
2490 cdef,2486 cdef,
2491 &neighbours,2487 &neighbours,
2492- (frame_width as usize, frame_height as usize),
2493 fctx,2488 fctx,
2494 None,2489 None,
2495 None,2490 None,
crates/ec-av1/src/decode/leaf8.rsmodified+0 -4
@@ -464,10 +464,6 @@ pub(super) fn decode_block_128rect(
464 // stamps here too -- lane-av1-intrabc r3.464 // stamps here too -- lane-av1-intrabc r3.
465 txfm_partition_update_rect(neighbours, (mi_r, mi_c), (logical_tx, logical_tx), (bw, bh));465 txfm_partition_update_rect(neighbours, (mi_r, mi_c), (logical_tx, logical_tx), (bw, bh));
466 }466 }
467- if in_inter {
468- } else if bw > bh {
469- } else {
470- }
471 Ok(())467 Ok(())
472 }468 }
473 469
crates/ec-av1/src/decode/leaf_sub8.rsmodified+0 -21
@@ -394,10 +394,6 @@ pub(super) fn sub8_leaf_chroma444(
394 // 4:2:2 twin of this arm was fixed the same way394 // 4:2:2 twin of this arm was fixed the same way
395 // (lane-av1-422kf2); this is its 4:4:4 twin.395 // (lane-av1-422kf2); this is its 4:4:4 twin.
396 let unit_reach = Reach::of_tu(bw, bh, uc * 4, ur * 4, 4, 4, reach);396 let unit_reach = Reach::of_tu(bw, bh, uc * 4, ur * 4, 4, 4, reach);
397- if !square
398- && unit_reach != Reach::of(4, upx, upy, y.width, y.height, fctx)
399- {
400- }
401 let grid = read_plane(397 let grid = read_plane(
402 dec,398 dec,
403 cdfs,399 cdfs,
@@ -588,9 +584,6 @@ pub(super) fn sub8_leaf_chroma444(
588 // position -- see the intrabc twin above for the584 // position -- see the intrabc twin above for the
589 // libaom citation and the measured damage.585 // libaom citation and the measured damage.
590 let unit_reach = Reach::of_tu(bw, bh, uc * 4, ur * 4, 4, 4, reach);586 let unit_reach = Reach::of_tu(bw, bh, uc * 4, ur * 4, 4, 4, reach);
591- if !square && unit_reach != Reach::of(4, upx, upy, y.width, y.height, fctx)
592- {
593- }
594 let grid = read_plane(587 let grid = read_plane(
595 dec,588 dec,
596 cdfs,589 cdfs,
@@ -2410,7 +2403,6 @@ pub(super) fn decode_leaf_rect8(
2410 let (ctx_tx_w, ctx_tx_h) = if split { (4, 4) } else { (bw, bh) };2403 let (ctx_tx_w, ctx_tx_h) = if split { (4, 4) } else { (bw, bh) };
2411 txfm_partition_update_rect(neighbours, lmi, (ctx_tx_w, ctx_tx_h), (bw, bh));2404 txfm_partition_update_rect(neighbours, lmi, (ctx_tx_w, ctx_tx_h), (bw, bh));
2412 if split {2405 if split {
2413- let mut done = 0usize;
2414 for tu in 0..2usize {2406 for tu in 0..2usize {
2415 let tu_mi = if vert {2407 let tu_mi = if vert {
2416 (lmi.0 + tu, lmi.1)2408 (lmi.0 + tu, lmi.1)
@@ -2479,16 +2471,8 @@ pub(super) fn decode_leaf_rect8(
2479 smooth_neighbor,2471 smooth_neighbor,
2480 fctx,2472 fctx,
2481 )?;2473 )?;
2482- if tu_grid.iter().any(|&l| l != 0) {
2483- done += 1;
2484- }
2485 neighbours.record_mi_luma(tu_mi, 4, &tu_grid);2474 neighbours.record_mi_luma(tu_mi, 4, &tu_grid);
2486 }2475 }
2487- if done > 0 {
2488- if vert {
2489- } else {
2490- }
2491- }
2492 neighbours.fill_skip_grid_rect(lmi, w_mi, h_mi, skip);2476 neighbours.fill_skip_grid_rect(lmi, w_mi, h_mi, skip);
2493 neighbours.fill_lf_grid_rect(lmi, w_mi, h_mi, 4, 4, 0, fctx);2477 neighbours.fill_lf_grid_rect(lmi, w_mi, h_mi, 4, 4, 0, fctx);
2494 if has_chroma {2478 if has_chroma {
@@ -2595,11 +2579,6 @@ pub(super) fn decode_leaf_rect8(
2595 dc_sign_ctx(around.2),2579 dc_sign_ctx(around.2),
2596 TxType::DctDct,2580 TxType::DctDct,
2597 )?;2581 )?;
2598- if levels.iter().any(|&l| l != 0) {
2599- if vert {
2600- } else {
2601- }
2602- }
2603 let residual = dequant_and_inverse_typed_wh(2582 let residual = dequant_and_inverse_typed_wh(
2604 &levels,2583 &levels,
2605 bw,2584 bw,
crates/ec-av1/src/decode/mod.rsmodified+1 -4
@@ -617,10 +617,7 @@ pub(crate) fn superres(fctx: &crate::decode::FrameCtx) -> Option<(u32, u32)> {
617 /// for a rectangular luma block (8x16, 16x8) or a PARTITION_HORZ/VERT strip is617 /// for a rectangular luma block (8x16, 16x8) or a PARTITION_HORZ/VERT strip is
618 /// bigger than the real block in one axis.618 /// bigger than the real block in one axis.
619 pub(crate) fn warp_plane_allowed(w: usize, h: usize) -> bool {619 pub(crate) fn warp_plane_allowed(w: usize, h: usize) -> bool {
620- if w >= 8 && h >= 8 {620+ w >= 8 && h >= 8
621- return true;
622- }
623- false
624 }621 }
625 622
626 /// This frame's [`QUANT_DELTAS`] `(dc, ac)` pair for plane `plane_idx` (0 =623 /// This frame's [`QUANT_DELTAS`] `(dc, ac)` pair for plane `plane_idx` (0 =
crates/ec-av1/src/decode/post_filter.rsmodified+0 -6
@@ -32,7 +32,6 @@ fn cdef_rows(
32 coeff_shift: i32,32 coeff_shift: i32,
33 damping: i32,33 damping: i32,
34 damping_uv: i32,34 damping_uv: i32,
35- (frame_w, frame_h): (usize, usize),
36 r_lo0: usize,35 r_lo0: usize,
37 r_hi0: usize,36 r_hi0: usize,
38 fctx: &crate::decode::FrameCtx,37 fctx: &crate::decode::FrameCtx,
@@ -133,7 +132,6 @@ fn cdef_rows(
133 coeff_shift,132 coeff_shift,
134 damping,133 damping,
135 damping_uv,134 damping_uv,
136- (frame_w, frame_h),
137 fctx,135 fctx,
138 );136 );
139 });137 });
@@ -147,9 +145,6 @@ pub(super) fn apply_cdef(
147 v: &mut PlaneBuf<'static>,145 v: &mut PlaneBuf<'static>,
148 cdef: &CdefParams,146 cdef: &CdefParams,
149 skip_grid: &Neighbours,147 skip_grid: &Neighbours,
150- // This frame header's own CROPPED luma size, for the straddling-unit
151- // counter only -- CDEF itself walks the mi-rounded plane.
152- (frame_w, frame_h): (usize, usize),
153 fctx: &crate::decode::FrameCtx,148 fctx: &crate::decode::FrameCtx,
154 // lane-av1cap: every CDEF unit reads the PRE-CDEF planes, so the filter149 // lane-av1cap: every CDEF unit reads the PRE-CDEF planes, so the filter
155 // starts by copying all three (~19 MB at 4K). The encoder's filter150 // starts by copying all three (~19 MB at 4K). The encoder's filter
@@ -214,7 +209,6 @@ pub(super) fn apply_cdef(
214 coeff_shift,209 coeff_shift,
215 damping,210 damping,
216 damping_uv,211 damping_uv,
217- (frame_w, frame_h),
218 0,212 0,
219 skip_grid.mi_rows,213 skip_grid.mi_rows,
220 fctx,214 fctx,
crates/ec-av1/src/decode/rect.rsmodified+0 -17
@@ -543,17 +543,6 @@ pub(super) fn decode_rect_split(
543 (chroma_w, chroma_h),543 (chroma_w, chroma_h),
544 (64, 32) | (32, 64) | (64, 16) | (16, 64) | (32, 32) | (16, 16) | (8, 8)544 (64, 32) | (32, 64) | (64, 16) | (16, 64) | (32, 32) | (16, 16) | (8, 8)
545 );545 );
546- if !m.skip {
547- if !m.skip && chroma.is_none() && !chroma_tiled {
548- // Diagnostic for the next caller that lands here (class
549- // refusal-names-a-correlate: the message names the tool, not the
550- // shape); the refusal below keeps its inventory-pinned wording.
551- eprintln!(
552- "EC_RECTCHROMA_GAP luma={bw}x{bh} tx={tx_w}x{tx_h} \
553- chroma={chroma_w}x{chroma_h}"
554- );
555- }
556- }
557 // lane-rectsplit r2 (verifier finding): with both callers wired546 // lane-rectsplit r2 (verifier finding): with both callers wired
558 // (`decode_block_rect`'s 32x16/16x32 and `decode_block_rect64`'s547 // (`decode_block_rect`'s 32x16/16x32 and `decode_block_rect64`'s
559 // 64x32/32x64) every shape that reaches here has a table above, so this548 // 64x32/32x64) every shape that reaches here has a table above, so this
@@ -1241,9 +1230,6 @@ pub(super) fn decode_rect_split(
1241 uh << ss_y(fctx),1230 uh << ss_y(fctx),
1242 reach,1231 reach,
1243 );1232 );
1244- if cu_reach.above_right != reach.above_right
1245- || cu_reach.below_left != reach.below_left
1246- {}
1247 // 32x32 does not fit read_coeffs_rect's scratch (768). The1233 // 32x32 does not fit read_coeffs_rect's scratch (768). The
1248 // square reader is the path every other 32x32 chroma unit uses.1234 // square reader is the path every other 32x32 chroma unit uses.
1249 let levels = if uw == uh {1235 let levels = if uw == uh {
@@ -2248,9 +2234,6 @@ pub(super) fn decode_intrabc_rect(
2248 base_q_idx: u8,2234 base_q_idx: u8,
2249 fctx: &crate::decode::FrameCtx,2235 fctx: &crate::decode::FrameCtx,
2250 ) -> Result<()> {2236 ) -> Result<()> {
2251- if skip {
2252- } else {
2253- }
2254 let (px, py) = (mi_c * MI, mi_r * MI);2237 let (px, py) = (mi_c * MI, mi_r * MI);
2255 // lane-whtshape: a LOSSLESS block's chroma plane block is2238 // lane-whtshape: a LOSSLESS block's chroma plane block is
2256 // `bw >> ss_x` by `bh >> ss_y` at its own origin -- `av1_get_max_uv_txsize`2239 // `bw >> ss_x` by `bh >> ss_y` at its own origin -- `av1_get_max_uv_txsize`
crates/ec-av1/src/decode/rect4.rsmodified+0 -49
@@ -140,11 +140,6 @@ pub(super) fn decode_block_rect4(
140 // seed 43, the last 8x32 strip at luma (152,32), chroma-only mismatch140 // seed 43, the last 8x32 strip at luma (152,32), chroma-only mismatch
141 // with luma bit-exact).141 // with luma bit-exact).
142 let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c, fctx);142 let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c, fctx);
143- if filter_intra.is_some() {
144- if bw > bh {
145- } else {
146- }
147- }
148 let uv_predict_mode = if uv_mode == UV_CFL_PRED {143 let uv_predict_mode = if uv_mode == UV_CFL_PRED {
149 DC_PRED144 DC_PRED
150 } else {145 } else {
@@ -217,9 +212,6 @@ pub(super) fn decode_block_rect4(
217 pal_uv_size,212 pal_uv_size,
218 pal_uv_colors,213 pal_uv_colors,
219 );214 );
220- if bw > bh {
221- } else {
222- }
223 // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,215 // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,
224 // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter216 // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter
225 // frame, so this 1:4 strip -- which is also the INTER frame's reader217 // frame, so this 1:4 strip -- which is also the INTER frame's reader
@@ -442,9 +434,6 @@ pub(super) fn decode_block_rect4(
442 pal_uv_size,434 pal_uv_size,
443 pal_uv_colors,435 pal_uv_colors,
444 );436 );
445- if bw > bh {
446- } else {
447- }
448 // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,437 // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,
449 // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter438 // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter
450 // frame, so this 1:4 strip -- which is also the INTER frame's reader439 // frame, so this 1:4 strip -- which is also the INTER frame's reader
@@ -596,9 +585,6 @@ pub(super) fn decode_block_rect4(
596 pal_uv_size,585 pal_uv_size,
597 pal_uv_colors,586 pal_uv_colors,
598 );587 );
599- if bw > bh {
600- } else {
601- }
602 // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,588 // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,
603 // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter589 // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter
604 // frame, so this 1:4 strip -- which is also the INTER frame's reader590 // frame, so this 1:4 strip -- which is also the INTER frame's reader
@@ -728,9 +714,6 @@ pub(super) fn decode_block_rect4(
728 pal_uv_size,714 pal_uv_size,
729 pal_uv_colors,715 pal_uv_colors,
730 );716 );
731- if bw > bh {
732- } else {
733- }
734 // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,717 // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,
735 // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter718 // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter
736 // frame, so this 1:4 strip -- which is also the INTER frame's reader719 // frame, so this 1:4 strip -- which is also the INTER frame's reader
@@ -2103,9 +2086,6 @@ pub(super) fn decode_rect4_16_intrabc(
2103 }2086 }
2104 last_uv = Some(DC_PRED);2087 last_uv = Some(DC_PRED);
2105 }2088 }
2106- if horz {
2107- } else {
2108- }
2109 record_strip_palette(neighbours, lmi, bw, bh, 0, [0u16; 8], 0, [0u16; 8]);2089 record_strip_palette(neighbours, lmi, bw, bh, 0, [0u16; 8], 0, [0u16; 8]);
2110 if leaves.is_none() {2090 if leaves.is_none() {
2111 // Skip and TX_MODE_LARGEST publish the block size (`set_txfm_ctxs`2091 // Skip and TX_MODE_LARGEST publish the block size (`set_txfm_ctxs`
@@ -2549,31 +2529,6 @@ pub(super) fn decode_rect4_16_strip(
2549 // `av1_use_intra_edge_upsample` on (blk_wh 12 <= 16) for a2529 // `av1_use_intra_edge_upsample` on (blk_wh 12 <= 16) for a
2550 // directional chroma strip, moving 4 samples by 1.2530 // directional chroma strip, moving 4 samples by 1.
2551 let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(pair_mi.0, pair_mi.1, r, c, fctx);2531 let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(pair_mi.0, pair_mi.1, r, c, fctx);
2552- // lane-av1422warp: `smooth_uv_neighbour_unsnapped` now takes the
2553- // frame's own `ss_x` -- the unsnapped read is the pair-merge witness
2554- // counter's mirror of the snapping form, and the shipped read offsets
2555- // the above COLUMN by `+ss_x` (libaom's `chroma_above_mi`).
2556- //
2557- // lane-av1leftwit: this mirror is NOT evidence about the left read's
2558- // `+ss_y` term, whatever a report once said. It reads the leaf's own
2559- // (odd) mi row, which no decode call site does -- every one of them
2560- // uses the snapping form, whose base row is even -- and its result
2561- // feeds `RECT4_16_UV_PAIR_FILT_HITS` only. What it measures is real
2562- // and worth keeping (the pair's chroma-reference read against the
2563- // leaf's own row: 51/24/121/0/1 hits on the five fixtures censused),
2564- // so it stays; the decode path's own reach for the `+ss_y` term is
2565- // `uv_left_1mi_split_hits()`.
2566- if smooth_neighbor_uv
2567- != neighbours.smooth_uv_neighbour_unsnapped(
2568- lmi.0,
2569- lmi.1,
2570- r,
2571- c,
2572- ss_x(fctx),
2573- ss_y(fctx),
2574- false,
2575- )
2576- {}
2577 // lane-av1-rect14: a lossless frame forces TX_4X4 on every plane2532 // lane-av1-rect14: a lossless frame forces TX_4X4 on every plane
2578 // (`av1_get_tx_size`, blockd.h:1381). The pair's chroma block is2533 // (`av1_get_tx_size`, blockd.h:1381). The pair's chroma block is
2579 // 8x4 (HORZ_4) or 4x8 (VERT_4) -- two TX_4X4s, plane-major2534 // 8x4 (HORZ_4) or 4x8 (VERT_4) -- two TX_4X4s, plane-major
@@ -3023,9 +2978,6 @@ pub(super) fn decode_rect4_16_strip(
3023 }2978 }
3024 last_uv_mode = Some(uv_predict_mode);2979 last_uv_mode = Some(uv_predict_mode);
3025 }2980 }
3026- if horz {
3027- } else {
3028- }
3029 let (pal_y_size, pal_y_colors) = palette_y2981 let (pal_y_size, pal_y_colors) = palette_y
3030 .as_ref()2982 .as_ref()
3031 .map_or((0, [0u16; 8]), |p| (p.size, p.colors));2983 .map_or((0, [0u16; 8]), |p| (p.size, p.colors));
@@ -3209,7 +3161,6 @@ pub(super) fn decode_block_rect64(
3209 // 1:4 strip is the 2:1 rect TX_32X16 at depth 1 (lane-rectchroma r13161 // 1:4 strip is the 2:1 rect TX_32X16 at depth 1 (lane-rectchroma r1
3210 // measured the old square formula mis-tiling exactly that strip).3162 // measured the old square formula mis-tiling exactly that strip).
3211 let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx);3163 let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx);
3212- if bw.max(bh) / bw.min(bh) == 4 {}
3213 let modes = RectStripModes {3164 let modes = RectStripModes {
3214 skip,3165 skip,
3215 mode,3166 mode,
crates/ec-av1/src/decode/replay.rsmodified+0 -8
@@ -179,7 +179,6 @@ fn replay_inner(
179 &mut v,179 &mut v,
180 cdef,180 cdef,
181 &r.neighbours,181 &r.neighbours,
182- (r.frame_width, r.frame_height),
183 fctx,182 fctx,
184 pre,183 pre,
185 Some(&mut wrote),184 Some(&mut wrote),
@@ -449,7 +448,6 @@ pub(super) fn cdef_band(
449 coeff_shift: i32,448 coeff_shift: i32,
450 damping: i32,449 damping: i32,
451 damping_uv: i32,450 damping_uv: i32,
452- (frame_w, frame_h): (usize, usize),
453 fctx: &crate::decode::FrameCtx,451 fctx: &crate::decode::FrameCtx,
454 ) {452 ) {
455 let unit_cols = skip_grid.mi_cols.div_ceil(2);453 let unit_cols = skip_grid.mi_cols.div_ceil(2);
@@ -510,12 +508,6 @@ pub(super) fn cdef_band(
510 // lane-cdef r1 rung: one line per filtered 8x8 luma CDEF unit.508 // lane-cdef r1 rung: one line per filtered 8x8 luma CDEF unit.
511 let enable_primary = t != 0;509 let enable_primary = t != 0;
512 let enable_secondary = y_sec_strength != 0;510 let enable_secondary = y_sec_strength != 0;
513- if (ox + 8 > frame_w || oy + 8 > frame_h)
514- && (enable_primary
515- || enable_secondary
516- || cdef.uv_pri_strength[sidx] != 0
517- || cdef.uv_sec_strength[sidx] != 0)
518- {}
519 if enable_primary || enable_secondary {511 if enable_primary || enable_secondary {
520 cdef_filter_block(512 cdef_filter_block(
521 &win_y,513 &win_y,