U3: delete the gate-counter feature: hits.rs, counters.rs (~4.5k lines), every hit!/hit_do! site, the forwarding counter getters in stream, the counter-statement sites, and the census/unit-interval trace helpers (decode/coeffs, decode/mod). Counter-only asserts in encoder/tests dropped; decode_probe example deleted (it only printed counters). No output path reads them
Browse files at this commitb4eb44d812302e026a0749eec2aad153defb738cParent: efec3ce32 changed files +1 -6901
- crates/ec-av1/Cargo.toml +0 -8
- crates/ec-av1/examples/decode_probe.rs +0 -532
- crates/ec-av1/src/decode/block.rs +0 -68
- crates/ec-av1/src/decode/coeffs.rs +1 -103
- crates/ec-av1/src/decode/counters.rs +0 -4459
- crates/ec-av1/src/decode/frame_tile.rs +0 -84
- crates/ec-av1/src/decode/inter_block.rs +0 -125
- crates/ec-av1/src/decode/inter_block8.rs +0 -126
- crates/ec-av1/src/decode/inter_ctx.rs +0 -51
- crates/ec-av1/src/decode/inter_intra_arm.rs +0 -34
- crates/ec-av1/src/decode/inter_shapes.rs +0 -61
- crates/ec-av1/src/decode/key_tile.rs +0 -75
- crates/ec-av1/src/decode/leaf8.rs +0 -68
- crates/ec-av1/src/decode/leaf_sub8.rs +0 -59
- crates/ec-av1/src/decode/mod.rs +0 -74
- crates/ec-av1/src/decode/post_filter.rs +0 -1
- crates/ec-av1/src/decode/rect.rs +0 -207
- crates/ec-av1/src/decode/rect4.rs +0 -142
- crates/ec-av1/src/decode/replay.rs +0 -4
- crates/ec-av1/src/decode/sub8_inter.rs +0 -92
- crates/ec-av1/src/encoder/tests.rs +0 -11
- crates/ec-av1/src/film_grain.rs +0 -16
- crates/ec-av1/src/hits.rs +0 -47
- crates/ec-av1/src/intra.rs +0 -9
- crates/ec-av1/src/lib.rs +0 -1
- crates/ec-av1/src/mc.rs +0 -14
- crates/ec-av1/src/motion_field.rs +0 -7
- crates/ec-av1/src/mvstack.rs +0 -21
- crates/ec-av1/src/quant.rs +0 -6
- crates/ec-av1/src/restoration.rs +0 -14
- crates/ec-av1/src/stream/mod.rs +0 -380
- crates/ec-av1/src/superres.rs +0 -2
crates/ec-av1/Cargo.tomlmodified+0 -8
| @@ -12,13 +12,5 @@ ec-av1-syntax.workspace = true | ||
| 12 | 12 | archmage = "=0.9.31-beta.1" |
| 13 | 13 | bytemuck = "1" |
| 14 | 14 | |
| 15 | -[features] | |
| 16 | -default = ["gate-counters"] | |
| 17 | -# Compiles the ~550 `*_HITS` gate counters (see `src/hits.rs`). ON by default so | |
| 18 | -# every test gate and the probe's census see the same numbers they always have; | |
| 19 | -# a shipped decoder can build `--no-default-features` to drop the TLS bump on | |
| 20 | -# each counted path -- the `*_hits()` accessors still compile and return 0. | |
| 21 | -gate-counters = [] | |
| 22 | - | |
| 23 | 15 | [dev-dependencies] |
| 24 | 16 | ec-testkit.workspace = true |
crates/ec-av1/examples/decode_probe.rsdeleted+0 -532
| @@ -1,532 +0,0 @@ | ||
| 1 | -//! Where does a real stream stop? Decode one AV1 file and print the answer. | |
| 2 | -//! | |
| 3 | -//! The gates in [`ec_av1::stream`] each pin one capability against one encoder | |
| 4 | -//! recipe. This asks the complementary question -- given a stream someone | |
| 5 | -//! actually produced, which refusal comes first -- and it is how the refusal | |
| 6 | -//! distribution in commit 2be815f was measured rather than reasoned about: | |
| 7 | -//! | |
| 8 | -//! ```text | |
| 9 | -//! aomenc --codec=av1 --obu -o s.obu --passes=1 --cpu-used=4 --limit=4 in.y4m | |
| 10 | -//! cargo run -p ec-av1 --example decode_probe -- s.obu | |
| 11 | -//! ``` | |
| 12 | -//! | |
| 13 | -//! Note `--obu`: [`ec_av1::stream::decode_stream`] takes a raw OBU stream, and | |
| 14 | -//! an IVF file decodes as zero frames rather than as an error. | |
| 15 | -//! | |
| 16 | -//! That run is also what disproved three refusal strings claiming an encoder | |
| 17 | -//! never writes a case it demonstrably writes, so this is a first-class | |
| 18 | -//! instrument, not a scratch file. | |
| 19 | -fn main() { | |
| 20 | - let Some(path) = std::env::args().nth(1) else { | |
| 21 | - eprintln!("usage: decode_probe <stream.obu>"); | |
| 22 | - std::process::exit(2); | |
| 23 | - }; | |
| 24 | - let data = match std::fs::read(&path) { | |
| 25 | - Ok(data) => data, | |
| 26 | - Err(e) => { | |
| 27 | - eprintln!("{path}: {e}"); | |
| 28 | - std::process::exit(2); | |
| 29 | - } | |
| 30 | - }; | |
| 31 | - let report = || { | |
| 32 | - // lane-av1unwritten r6: the subsize-guard coverage table (per call | |
| 33 | - // site, per partition value, reached vs fired). Env-gated | |
| 34 | - // (`EC_AV1_SUBSIZE_GUARD_TRACE`), so it is empty unless asked for. | |
| 35 | - ec_av1::decode::dump_subsize_guard_scan(); | |
| 36 | - ec_av1::decode::dump_subsize_arm_scan(); | |
| 37 | - // The census below reads ec-av1's gate counters; without the crate's | |
| 38 | - // `gate-counters` feature every one of them is compiled out and reads 0. | |
| 39 | - if !cfg!(feature = "gate-counters") { | |
| 40 | - println!("counters disabled (built without the gate-counters feature)"); | |
| 41 | - } | |
| 42 | - let [a444, a422, s420, r420] = ec_av1::decode::cfl_ac_arm_hits(); | |
| 43 | - println!( | |
| 44 | - "cfl_ac: 444={a444} 422={a422} 420sq={s420} 420rect={r420} q3_at={}", | |
| 45 | - ec_av1::decode::cfl_ac_q3_at_hits() | |
| 46 | - ); | |
| 47 | - let (sc, dp) = ec_av1::decode::reelc_chroma_counters(); | |
| 48 | - println!("reelc_chroma: skip_cfl={sc} dir_1to4_pairs={dp}"); | |
| 49 | - println!( | |
| 50 | - "ibc128: mu_chroma={} intra128={}", | |
| 51 | - ec_av1::decode::intra_128_in_inter_mu_chroma_hits(), | |
| 52 | - ec_av1::decode::intra_128_in_inter_hits() | |
| 53 | - ); | |
| 54 | - println!( | |
| 55 | - "chroma422_square: {}", | |
| 56 | - ec_av1::decode::chroma422_square_hits() | |
| 57 | - ); | |
| 58 | - println!("chroma422_rect: {}", ec_av1::decode::chroma422_rect_hits()); | |
| 59 | - println!("chroma422_sub8: {}", ec_av1::decode::chroma422_sub8_hits()); | |
| 60 | - println!( | |
| 61 | - "chroma422_chunk: {}", | |
| 62 | - ec_av1::decode::chroma422_chunk_hits() | |
| 63 | - ); | |
| 64 | - println!( | |
| 65 | - "chroma422_pair_wide: {}", | |
| 66 | - ec_av1::decode::chroma422_pair_wide_hits() | |
| 67 | - ); | |
| 68 | - println!( | |
| 69 | - "uv_left_ss_y: reads={} mode_diff={} smooth_diff={} split1mi={}", | |
| 70 | - ec_av1::decode::uv_left_ss_y_reads(), | |
| 71 | - ec_av1::decode::uv_left_ss_y_mode_diff_hits(), | |
| 72 | - ec_av1::decode::uv_left_ss_y_smooth_diff_hits(), | |
| 73 | - ec_av1::decode::uv_left_1mi_split_hits(), | |
| 74 | - ); | |
| 75 | - let (h, v, c) = ec_av1::stream::rect4_32_counters(); | |
| 76 | - println!( | |
| 77 | - "rect4_16_uv_pair_filt: {}", | |
| 78 | - ec_av1::decode::rect4_16_uv_pair_filt_hits() | |
| 79 | - ); | |
| 80 | - println!("rect4_32: horz={h} vert={v} coded={c}"); | |
| 81 | - println!( | |
| 82 | - "rect_intrabc_reads: {}", | |
| 83 | - ec_av1::stream::rect_intrabc_reads() | |
| 84 | - ); | |
| 85 | - let (pal_y, pal_uv) = ec_av1::stream::intra_in_inter_palette_hits(); | |
| 86 | - println!("intra_in_inter_palette: y={pal_y} uv={pal_uv}"); | |
| 87 | - println!( | |
| 88 | - "palette_422_unit_window: {}", | |
| 89 | - ec_av1::decode::palette_422_unit_window_hits() | |
| 90 | - ); | |
| 91 | - println!( | |
| 92 | - "rect64_corner_tu: 64x32={} 32x64={}", | |
| 93 | - ec_av1::stream::rect64_corner_tu_hits(0), | |
| 94 | - ec_av1::stream::rect64_corner_tu_hits(1) | |
| 95 | - ); | |
| 96 | - println!( | |
| 97 | - "leaf8_intrabc_hits: {}", | |
| 98 | - ec_av1::stream::leaf8_intrabc_hits() | |
| 99 | - ); | |
| 100 | - println!("intrabc_hits: {}", ec_av1::stream::intrabc_hits()); | |
| 101 | - println!( | |
| 102 | - "intrabc_vartx_trees: {}", | |
| 103 | - ec_av1::decode::intrabc_vartx_hits() | |
| 104 | - ); | |
| 105 | - println!( | |
| 106 | - "intrabc_vartx_mixed_leaves: {}", | |
| 107 | - ec_av1::decode::intrabc_vartx_mixed_leaves_hits() | |
| 108 | - ); | |
| 109 | - println!( | |
| 110 | - "skipped_intrabc_chroma_arm_hits: {}", | |
| 111 | - ec_av1::stream::skipped_intrabc_chroma_arm_hits() | |
| 112 | - ); | |
| 113 | - println!( | |
| 114 | - "intrabc_rect: {} (var-tx tree: {})", | |
| 115 | - ec_av1::decode::intrabc_rect_hits(), | |
| 116 | - ec_av1::decode::intrabc_rect_vartx_hits() | |
| 117 | - ); | |
| 118 | - // lane-av1-ibcrect: `use_intrabc` on a 128-root HORZ/VERT strip -- | |
| 119 | - // the shape `decode_block_128rect` used to refuse. | |
| 120 | - println!( | |
| 121 | - "intrabc_128rect: {}", | |
| 122 | - ec_av1::stream::intrabc_128rect_hits() | |
| 123 | - ); | |
| 124 | - // lane-av1-ibc128chunk: the 128-root intrabc strip's per-axis chroma | |
| 125 | - // mu-chunk walk -- unit count and the `(64>>ss_x)|(64>>ss_y)` extent. | |
| 126 | - println!( | |
| 127 | - "intrabc_128rect_chroma_chunk: units={} shape=0x{:x}", | |
| 128 | - ec_av1::stream::intrabc_128rect_chroma_chunk_hits(), | |
| 129 | - ec_av1::stream::intrabc_128rect_chunk_shape() | |
| 130 | - ); | |
| 131 | - let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters(); | |
| 132 | - println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}"); | |
| 133 | - println!( | |
| 134 | - "sub8_inter_split: groups={}", | |
| 135 | - ec_av1::decode::sub8_inter_split_hits() | |
| 136 | - ); | |
| 137 | - println!( | |
| 138 | - "skip_split_tx_override: {}", | |
| 139 | - ec_av1::decode::skip_split_tx_override_hits() | |
| 140 | - ); | |
| 141 | - println!( | |
| 142 | - "interintra_rect: {}", | |
| 143 | - ec_av1::decode::interintra_rect_hits() | |
| 144 | - ); | |
| 145 | - println!( | |
| 146 | - "gm_nontrans_small_side: {}", | |
| 147 | - ec_av1::decode::gm_nontrans_small_side_hits() | |
| 148 | - ); | |
| 149 | - println!( | |
| 150 | - "tr_reach_longer_side: {}", | |
| 151 | - ec_av1::decode::tr_reach_longer_side_hits() | |
| 152 | - ); | |
| 153 | - println!( | |
| 154 | - "mv_clamp_edge_overhang: {}", | |
| 155 | - ec_av1::mvstack::mv_clamp_edge_overhang_hits() | |
| 156 | - ); | |
| 157 | - let (h84, h48) = ec_av1::decode::sub8_inter_rect_hits(); | |
| 158 | - println!("sub8_inter_rect: horz8x4={h84} vert4x8={h48}"); | |
| 159 | - println!( | |
| 160 | - "llintra8_chroma_walk: {}", | |
| 161 | - ec_av1::decode::llintra8_chroma_walk_hits() | |
| 162 | - ); | |
| 163 | - println!( | |
| 164 | - "sub8rect444_chroma_walk: {}", | |
| 165 | - ec_av1::decode::llsub8rect444_chroma_walk_hits() | |
| 166 | - ); | |
| 167 | - let si = ec_av1::stream::sub8_intra_rect_hits(); | |
| 168 | - println!( | |
| 169 | - "sub8_intra_rect: horz8x4={} vert4x8={} chroma_ref={} mixed={} split4x4={}", | |
| 170 | - si.0, si.1, si.2, si.3, si.4 | |
| 171 | - ); | |
| 172 | - let leaf = ec_av1::stream::vartx_rect_leaf_hits(); | |
| 173 | - println!("vartx_rect_leaf: 32x16={} 16x32={}", leaf[0], leaf[1]); | |
| 174 | - // lane-inter16ab r1: the 16x16-level inter AB arms, so a recipe sweep | |
| 175 | - // can tell "aomenc never picked one" from "it did and we decoded it". | |
| 176 | - let ab = ec_av1::decode::ab16_inter_hits_by_arm(); | |
| 177 | - println!( | |
| 178 | - "inter_ab16: horz_a={} horz_b={} vert_a={} vert_b={}", | |
| 179 | - ab[0], ab[1], ab[2], ab[3] | |
| 180 | - ); | |
| 181 | - // lane-kf900 r1: the counter the skipped-8x8-split-transform gate | |
| 182 | - // asserts -- printed here so a recipe sweep can see it fire without a | |
| 183 | - // test-binary rebuild. | |
| 184 | - println!("skip_split_tx: {}", ec_av1::decode::skip_split_tx_hits()); | |
| 185 | - let es = ec_av1::decode::inter_edge_strip_hits(); | |
| 186 | - println!( | |
| 187 | - "inter_edge_strip: h64={} v64={} h32={} v32={} h16={} v16={}", | |
| 188 | - es[0], es[1], es[2], es[3], es[4], es[5] | |
| 189 | - ); | |
| 190 | - let (h4, v4, pairs, sub8) = ec_av1::decode::inter16_rect4_counters(); | |
| 191 | - println!("inter16_1to4: horz4={h4} vert4={v4} chroma_pairs={pairs} sub8_pieces={sub8}"); | |
| 192 | - let leaf4 = ec_av1::stream::vartx_rect_leaf4_hits(); | |
| 193 | - println!("vartx_rect_leaf4: 8x4={} 4x8={}", leaf4[0], leaf4[1]); | |
| 194 | - // lane-av1txr: intrabc 4x8/8x4 leaves that read the inter var-tx tree | |
| 195 | - // (the symbol whose absence desynced `warped.obu`). | |
| 196 | - println!( | |
| 197 | - "rect_intrabc_vartx: {}", | |
| 198 | - ec_av1::decode::rect_intrabc_vartx_hits() | |
| 199 | - ); | |
| 200 | - let rw = ec_av1::stream::rect_wedge_hits(); | |
| 201 | - let rwi = ec_av1::stream::rect_wii_hits(); | |
| 202 | - println!("rect_wedge(8x16,16x8,16x32,32x16,8x32,32x8): compound={rw:?} interintra={rwi:?}"); | |
| 203 | - // lane-inter128intra r1: the 128 root's HORZ/VERT half coded INTRA in | |
| 204 | - // an INTER frame -- the arm this round implemented. | |
| 205 | - let i128 = ec_av1::stream::intra128_in_inter_counters(); | |
| 206 | - println!("intra128_in_inter: 128x64={} 64x128={}", i128[0], i128[1]); | |
| 207 | - // lane-lossless128: intra 128-axis blocks on a LOSSLESS frame (every | |
| 208 | - // plane TX_4X4) -- the shape whose reconstruction used to panic. | |
| 209 | - println!( | |
| 210 | - "intra128_lossless: {}", | |
| 211 | - ec_av1::stream::intra128_lossless_counters() | |
| 212 | - ); | |
| 213 | - let sb = ec_av1::stream::sb128_rect_counters(); | |
| 214 | - println!( | |
| 215 | - "sb128_rect: edge_horz={} edge_vert={} inter_128x64={} inter_64x128={}", | |
| 216 | - sb.0, sb.1, sb.2, sb.3 | |
| 217 | - ); | |
| 218 | - // lane-av1-ibcrect: the interior 128-root partition arms and the key | |
| 219 | - // frame's intra 128-axis blocks, so a recipe sweep can tell "the | |
| 220 | - // encoder never chose HORZ/VERT at the 128 root" from "it did". | |
| 221 | - let p128 = ec_av1::stream::part128_census(); | |
| 222 | - println!( | |
| 223 | - "part128: split={} none={} horz={} vert={} ab={:?} intra_horz={} intra_vert={}", | |
| 224 | - p128.0, p128.1, p128.2, p128.3, p128.4, p128.5, p128.6 | |
| 225 | - ); | |
| 226 | - // lane-sbab r1: the superblock-level inter AB arms. | |
| 227 | - let sbab = ec_av1::decode::sb_ab_inter_hits_by_arm(); | |
| 228 | - println!( | |
| 229 | - "inter_ab64: horz_a={} horz_b={} vert_a={} vert_b={}", | |
| 230 | - sbab[0], sbab[1], sbab[2], sbab[3] | |
| 231 | - ); | |
| 232 | - let i4 = ec_av1::stream::intra_rect4_in_inter_counters(); | |
| 233 | - println!( | |
| 234 | - "intra_rect4_in_inter: 64x16={} 16x64={} 32x8={} 8x32={}", | |
| 235 | - i4.0, i4.1, i4.2, i4.3 | |
| 236 | - ); | |
| 237 | - // lane-cdefstrip r1: 8x8 CDEF units whose skip band no coded block | |
| 238 | - // wrote this frame -- non-zero means a decode arm forgot | |
| 239 | - // `fill_skip_grid_rect`, and CDEF filtered a unit libaom may skip. | |
| 240 | - println!( | |
| 241 | - "cdef_unwritten_skip_units: {}", | |
| 242 | - ec_av1::decode::cdef_unwritten_skip_units() | |
| 243 | - ); | |
| 244 | - println!( | |
| 245 | - "cdef_band: rect_skip_writes={} mixed_skip_units={}", | |
| 246 | - ec_av1::decode::rect_skip_band_hits(), | |
| 247 | - ec_av1::decode::cdef_mixed_skip_units() | |
| 248 | - ); | |
| 249 | - let ir = ec_av1::stream::inter_rect_counters(); | |
| 250 | - println!( | |
| 251 | - "inter_rect: 32x8={} 8x32={} 64x32={} 32x64={} 64x16={} 16x64={}", | |
| 252 | - ir.0, ir.1, ir.2, ir.3, ir.4, ir.5 | |
| 253 | - ); | |
| 254 | - // lane-rectres r1: how many of those 32x8/8x32 strips coded a real | |
| 255 | - // rectangular residual transform unit (a skipped one codes none). | |
| 256 | - println!( | |
| 257 | - "sub8_chroma_tx_from_ref: {}", | |
| 258 | - ec_av1::stream::sub8_chroma_tx_from_ref_hits() | |
| 259 | - ); | |
| 260 | - let r328 = ec_av1::stream::rect32x8_inter_tu_hits(); | |
| 261 | - println!("rect32x8_inter_tu: 32x8={} 8x32={}", r328[0], r328[1]); | |
| 262 | - // lane-intra16x4: INTRA strips of an inter 16x16-level 1:4 partition. | |
| 263 | - let i164 = ec_av1::stream::intra16x4_in_inter_hits(); | |
| 264 | - println!( | |
| 265 | - "intra16x4_in_inter: 16x4={} 4x16={} chroma_ref={}", | |
| 266 | - i164.0, i164.1, i164.2 | |
| 267 | - ); | |
| 268 | - println!( | |
| 269 | - "rect4_16_pair: lossless_chroma={} intrabc={}", | |
| 270 | - ec_av1::decode::rect4_16_lossless_chroma_hits(), | |
| 271 | - ec_av1::decode::rect4_16_intrabc_hits(), | |
| 272 | - ); | |
| 273 | - println!( | |
| 274 | - "loss64: chroma_edge_tu_clip={} skip_lossless_band_reset={}", | |
| 275 | - ec_av1::decode::chroma_edge_tu_clip_hits(), | |
| 276 | - ec_av1::decode::skip_lossless_band_reset_hits(), | |
| 277 | - ); | |
| 278 | - println!( | |
| 279 | - "llband: rect_split_lossless_chroma444={}", | |
| 280 | - ec_av1::decode::rect_split_lossless_chroma444_hits() | |
| 281 | - ); | |
| 282 | - // lane-t900 r12: chroma edge-filter neighbour answered from the mi-granular | |
| 283 | - // uv_mode grid instead of the coarse one-slot-per-column map. | |
| 284 | - println!( | |
| 285 | - "scaled: leaf8={} sub8={} warpfb={} predict_scaled={}", | |
| 286 | - ec_av1::decode::scaled_leaf8_hits(), | |
| 287 | - ec_av1::decode::scaled_sub8_hits(), | |
| 288 | - ec_av1::decode::scaled_warp_fallback_hits(), | |
| 289 | - ec_av1::mc::predict_scaled_hits() | |
| 290 | - ); | |
| 291 | - println!( | |
| 292 | - "uv_mode_grid_override: {}", | |
| 293 | - ec_av1::decode::uv_mode_grid_override_hits() | |
| 294 | - ); | |
| 295 | - // lane-thread2: proof the frame-parallel path actually fired (0 at | |
| 296 | - // the default EC_AV1_THREADS=1). | |
| 297 | - println!("frames_dispatched: {}", ec_av1::stream::frames_dispatched()); | |
| 298 | - // lane-av1recipehunt: `intra_rect4_in_inter` above already reports the | |
| 299 | - // 1:4-in-inter shapes; this is the `delta_q` half of the same story -- | |
| 300 | - // how many delta_q groups the stream really carried, and how many of | |
| 301 | - // them landed inside a rect64 dequant. | |
| 302 | - let (dq, dq_drift) = ec_av1::stream::rect64_qidx_drift_counters(); | |
| 303 | - println!("delta_q: groups_read={dq} rect64_qidx_drift={dq_drift}"); | |
| 304 | - // lane-av1422census422: the per-plane coefficient-unit census, armed | |
| 305 | - // for 4:4:4 and 4:2:2 (4:2:0 arms nothing, so a 4:2:0 recipe sweep | |
| 306 | - // reads `luma=0 u=0 v=0` BY DESIGN and must not read that as "the | |
| 307 | - // walk was empty" -- `units_total` is the UNCONDITIONAL per-frame | |
| 308 | - // total, so the two together say whether the census was armed at | |
| 309 | - // all). This is what makes a 4:2:2 non-vacuity requirement | |
| 310 | - // writable: before the widening every per-plane field read zero on a | |
| 311 | - // 4:2:2 cell BY CONSTRUCTION, so a byte-exact 4:2:2 gate could | |
| 312 | - // assert it and prove nothing about the stream it had decoded. | |
| 313 | - let cu = ec_av1::decode::census_nonsub_units(); | |
| 314 | - let cc = ec_av1::decode::census_nonsub_coded(); | |
| 315 | - println!( | |
| 316 | - "census_units: luma={} u={} v={} | coded: luma={} u={} v={} | units_total={}", | |
| 317 | - cu[0], | |
| 318 | - cu[1], | |
| 319 | - cu[2], | |
| 320 | - cc[0], | |
| 321 | - cc[1], | |
| 322 | - cc[2], | |
| 323 | - ec_av1::decode::census_unit_n(), | |
| 324 | - ); | |
| 325 | - }; | |
| 326 | - // lane-tiles: the tiling a real stream actually uses is a decision input | |
| 327 | - // (every gate in `stream.rs` picks its own `--tile-columns`), so report it | |
| 328 | - // from the frame headers before saying anything about pixels. | |
| 329 | - let mut parser = ec_av1_syntax::Av1Parser::new(); | |
| 330 | - let mut seen: Vec<(u32, u32, bool, u32)> = Vec::new(); | |
| 331 | - let mut pos = 0usize; | |
| 332 | - let mut frames_seen = 0usize; | |
| 333 | - // OBU at a time, so one unparseable OBU late in the stream still leaves | |
| 334 | - // every earlier frame header's tiling reported. | |
| 335 | - while pos < data.len() { | |
| 336 | - let Ok(obu) = parser.parse_obu(&data[pos..]) else { | |
| 337 | - break; | |
| 338 | - }; | |
| 339 | - pos += obu.total_size.max(1); | |
| 340 | - let header = match &obu.kind { | |
| 341 | - ec_av1_syntax::ObuKind::FrameHeader(h) => h, | |
| 342 | - ec_av1_syntax::ObuKind::Frame(h, _) => h, | |
| 343 | - _ => continue, | |
| 344 | - }; | |
| 345 | - frames_seen += 1; | |
| 346 | - // lane-frame36: `EC_PROBE_HDR=1` prints one line per frame header, so a | |
| 347 | - // silent wall can be triaged by "which header field is new at frame N" | |
| 348 | - // before any pixel work (class: a header field parsed then never consumed). | |
| 349 | - if std::env::var("EC_PROBE_HDR").is_ok() { | |
| 350 | - let h = header; | |
| 351 | - let gm: Vec<String> = h | |
| 352 | - .global_motion | |
| 353 | - .iter() | |
| 354 | - .map(|w| format!("{:?}", w.model)) | |
| 355 | - .collect(); | |
| 356 | - println!( | |
| 357 | - "HDR {}: type={:?} show={} showable={} show_existing={}({}) intra={} \ | |
| 358 | - size={}x{} up={} superres={}/{} order_hint={} primary_ref={} refresh={:#04x} \ | |
| 359 | - refs={:?} order_hints={:?} sign_bias={:?} err_res={} disable_cdf={} \ | |
| 360 | - screen_tools={} int_mv={} intrabc={} hp_mv={} interp={:?} switchable_motion={} \ | |
| 361 | - ref_mvs={} base_q={} seg={} deltaq={} deltalf={} lf_level={:?} lf_deltas={:?}/{:?} \ | |
| 362 | - cdef_bits={} lr={:?} tx_mode={:?} ref_sel={} skip_mode={}({:?}) warp={} \ | |
| 363 | - reduced_tx={} gm={:?} grain={}/seed={} lossless={}", | |
| 364 | - frames_seen - 1, | |
| 365 | - h.frame_type, | |
| 366 | - h.show_frame, | |
| 367 | - h.showable_frame, | |
| 368 | - h.show_existing_frame, | |
| 369 | - h.frame_to_show_map_idx, | |
| 370 | - h.frame_is_intra, | |
| 371 | - h.frame_width, | |
| 372 | - h.frame_height, | |
| 373 | - h.upscaled_width, | |
| 374 | - h.use_superres, | |
| 375 | - h.superres_denom, | |
| 376 | - h.order_hint, | |
| 377 | - h.primary_ref_frame, | |
| 378 | - h.refresh_frame_flags, | |
| 379 | - h.ref_frame_idx, | |
| 380 | - h.order_hints, | |
| 381 | - h.ref_frame_sign_bias, | |
| 382 | - h.error_resilient_mode, | |
| 383 | - h.disable_cdf_update, | |
| 384 | - h.allow_screen_content_tools, | |
| 385 | - h.force_integer_mv, | |
| 386 | - h.allow_intrabc, | |
| 387 | - h.allow_high_precision_mv, | |
| 388 | - h.interpolation_filter, | |
| 389 | - h.is_motion_mode_switchable, | |
| 390 | - h.use_ref_frame_mvs, | |
| 391 | - h.quantization.base_q_idx, | |
| 392 | - h.segmentation.enabled, | |
| 393 | - h.delta.q_present, | |
| 394 | - h.delta.lf_present, | |
| 395 | - h.loop_filter.level, | |
| 396 | - h.loop_filter.ref_deltas, | |
| 397 | - h.loop_filter.mode_deltas, | |
| 398 | - h.cdef.bits, | |
| 399 | - h.loop_restoration.frame_restoration_type, | |
| 400 | - h.tx_mode, | |
| 401 | - h.reference_select, | |
| 402 | - h.skip_mode_present, | |
| 403 | - h.skip_mode_frame, | |
| 404 | - h.allow_warped_motion, | |
| 405 | - h.reduced_tx_set, | |
| 406 | - gm, | |
| 407 | - h.film_grain.apply_grain, | |
| 408 | - h.film_grain.grain_seed, | |
| 409 | - h.coded_lossless, | |
| 410 | - ); | |
| 411 | - } | |
| 412 | - let t = &header.tile_info; | |
| 413 | - let entry = (t.cols, t.rows, t.uniform_spacing, t.context_update_tile_id); | |
| 414 | - if !seen.contains(&entry) { | |
| 415 | - seen.push(entry); | |
| 416 | - } | |
| 417 | - } | |
| 418 | - println!("TILING: {frames_seen} frame headers parsed"); | |
| 419 | - // lane-sb128 r4: the superblock size decides the whole partition tree, so | |
| 420 | - // report it next to the tiling -- it is the first thing a film blocker | |
| 421 | - // triage needs. | |
| 422 | - if let Some(seq) = parser.sequence_header() { | |
| 423 | - println!( | |
| 424 | - "SEQ: use_128x128_superblock={} bit_depth={} mono_chrome={} max_frame={}x{}", | |
| 425 | - seq.use_128x128_superblock, | |
| 426 | - seq.color_config.bit_depth, | |
| 427 | - seq.color_config.mono_chrome, | |
| 428 | - seq.max_frame_width, | |
| 429 | - seq.max_frame_height | |
| 430 | - ); | |
| 431 | - } | |
| 432 | - for (cols, rows, uniform, ctx_id) in &seen { | |
| 433 | - println!( | |
| 434 | - "TILING: cols={cols} rows={rows} uniform_spacing={uniform} context_update_tile_id={ctx_id}" | |
| 435 | - ); | |
| 436 | - } | |
| 437 | - if seen.is_empty() { | |
| 438 | - println!("TILING: no frame header parsed"); | |
| 439 | - } | |
| 440 | - | |
| 441 | - // lane-streamsink r1: decode through the streaming entry point and write | |
| 442 | - // each shown frame out as it completes. The old path collected every | |
| 443 | - // picture in a Vec and then built a second full copy of the raw dump | |
| 444 | - // before one `fs::write`, so peak RSS was 2x the whole decoded segment (a | |
| 445 | - // 4K 8 s window needed >20 GiB, a whole film terabytes). Here at most one | |
| 446 | - // frame is held beyond the decoder's own DPB, and the printed lines are | |
| 447 | - // byte-identical to the old ones. | |
| 448 | - // `EC_PROBE_OUT16` is yuv420p10le (u16 LE); `EC_PROBE_OUT` / argv[2] is | |
| 449 | - // 8-bit (planes are u16, low byte taken). Either target may be a FIFO. | |
| 450 | - use std::io::Write; | |
| 451 | - let open = |path: &str| { | |
| 452 | - std::fs::OpenOptions::new() | |
| 453 | - .write(true) | |
| 454 | - .create(true) | |
| 455 | - .truncate(true) | |
| 456 | - .open(path) | |
| 457 | - .unwrap_or_else(|e| panic!("opening {path}: {e}")) | |
| 458 | - }; | |
| 459 | - let out16 = std::env::var("EC_PROBE_OUT16").ok(); | |
| 460 | - let out8 = std::env::args() | |
| 461 | - .nth(2) | |
| 462 | - .or_else(|| std::env::var("EC_PROBE_OUT").ok()); | |
| 463 | - let null16 = out16.as_deref() == Some("/dev/null"); | |
| 464 | - let mut f16 = out16.as_deref().map(open); | |
| 465 | - let mut f8 = out8.as_deref().map(open); | |
| 466 | - let mut written16 = 0usize; | |
| 467 | - let mut written8 = 0usize; | |
| 468 | - let mut shown = 0usize; | |
| 469 | - let mut dims = (0usize, 0usize); | |
| 470 | - let mut buf: Vec<u8> = Vec::new(); | |
| 471 | - // lane-av1mono: a monochrome stream is luma only, so the raw dump is a | |
| 472 | - // single plane -- exactly what `ffmpeg -pix_fmt gray -f rawvideo` writes. | |
| 473 | - let mono = parser | |
| 474 | - .sequence_header() | |
| 475 | - .is_some_and(|s| s.color_config.mono_chrome); | |
| 476 | - let result = ec_av1::stream::decode_stream_with(&data, |f, _idx, is_shown| { | |
| 477 | - if !is_shown { | |
| 478 | - return Ok(()); | |
| 479 | - } | |
| 480 | - shown += 1; | |
| 481 | - if shown == 1 { | |
| 482 | - dims = (f.width, f.height); | |
| 483 | - } | |
| 484 | - let planes: &[&Vec<u16>] = if mono { &[&f.y] } else { &[&f.y, &f.u, &f.v] }; | |
| 485 | - if let Some(w) = f16.as_mut() { | |
| 486 | - let n = 2 * planes.iter().map(|p| p.len()).sum::<usize>(); | |
| 487 | - if null16 { | |
| 488 | - // Timing runs point EC_PROBE_OUT16 at /dev/null; the u16->LE | |
| 489 | - // conversion was ~2% of the main thread for bytes nobody reads. | |
| 490 | - written16 += n; | |
| 491 | - } else { | |
| 492 | - buf.clear(); | |
| 493 | - buf.resize(n, 0); | |
| 494 | - let mut off = 0; | |
| 495 | - for p in planes { | |
| 496 | - let end = off + 2 * p.len(); | |
| 497 | - for (d, &s) in buf[off..end].as_chunks_mut::<2>().0.iter_mut().zip(p.iter()) { | |
| 498 | - d.copy_from_slice(&s.to_le_bytes()); | |
| 499 | - } | |
| 500 | - off = end; | |
| 501 | - } | |
| 502 | - w.write_all(&buf).expect("writing raw planes"); | |
| 503 | - written16 += buf.len(); | |
| 504 | - } | |
| 505 | - } | |
| 506 | - if let Some(w) = f8.as_mut() { | |
| 507 | - buf.clear(); | |
| 508 | - for p in planes { | |
| 509 | - buf.extend(p.iter().map(|&s| s as u8)); | |
| 510 | - } | |
| 511 | - w.write_all(&buf).expect("writing raw planes"); | |
| 512 | - written8 += buf.len(); | |
| 513 | - } | |
| 514 | - Ok(()) | |
| 515 | - }); | |
| 516 | - match result { | |
| 517 | - Ok(()) if shown == 0 => { | |
| 518 | - println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?"); | |
| 519 | - } | |
| 520 | - Ok(()) => { | |
| 521 | - if let Some(out) = &out16 { | |
| 522 | - println!("wrote {written16} bytes of yuv420p10le to {out}"); | |
| 523 | - } | |
| 524 | - if let Some(out) = &out8 { | |
| 525 | - println!("wrote {written8} bytes of yuv420p to {out}"); | |
| 526 | - } | |
| 527 | - println!("OK: {shown} frames decoded, {}x{}", dims.0, dims.1); | |
| 528 | - } | |
| 529 | - Err(e) => println!("REFUSED: {e}"), | |
| 530 | - } | |
| 531 | - report(); | |
| 532 | -} |
crates/ec-av1/src/decode/block.rsmodified+0 -68
| @@ -72,7 +72,6 @@ pub(super) fn read_intra_mode( | ||
| 72 | 72 | // lane-sbrect10 r1: `is_cfl_allowed`'s <=32 bound, enforced at the single |
| 73 | 73 | // point every square caller routes through (see `read_intra_mode_rect`). |
| 74 | 74 | let cfl = if cfl && side > 32 { |
| 75 | - hit!(NOCFL_UV_MODE_HITS); | |
| 76 | 75 | false |
| 77 | 76 | } else { |
| 78 | 77 | cfl |
| @@ -133,7 +132,6 @@ pub(super) fn read_intra_mode( | ||
| 133 | 132 | eprintln!("TRACE intrabc dv={dv:?}"); |
| 134 | 133 | } |
| 135 | 134 | fctx.intrabc_dv.with(|c| c.set(Some(dv))); |
| 136 | - hit!(INTRABC_HITS); | |
| 137 | 135 | // spec 5.11.13 / libaom `read_intra_frame_mode_info` returns the |
| 138 | 136 | // moment `is_intrabc_block`: no y/uv mode, angle delta, palette, |
| 139 | 137 | // CFL or filter-intra syntax follows. `YMode`/`UVMode` are forced |
| @@ -199,24 +197,17 @@ pub(super) fn read_intra_mode( | ||
| 199 | 197 | // 78 against ffmpeg, traced 2026-08-27) -- an existing, un-lane-touched |
| 200 | 198 | // bug in that fallback this lane's own scope does not cover. Keep it |
| 201 | 199 | // refused here rather than ship a silently-wrong decode. |
| 202 | - if (9..=12).contains(&uv_mode) { | |
| 203 | - hit!(SMOOTH_UV_HITS); | |
| 204 | - } | |
| 205 | 200 | // `get_uv_mode` (spec 9.3): `UV_CFL_PRED` predicts as `DC_PRED` for the |
| 206 | 201 | // angle-delta question -- libaom's own `read_intra_frame_mode_info` reads |
| 207 | 202 | // `angle_delta_uv` off `get_uv_mode(uv_mode)`, never off `uv_mode` raw, |
| 208 | 203 | // so a CFL block (uv_mode==13, outside `V_PRED..=D67_PRED`) already takes |
| 209 | 204 | // the `else` branch below and never reads one either way. |
| 210 | 205 | let angle_delta_uv = if (V_PRED..=D67_PRED).contains(&uv_mode) { |
| 211 | - hit!(DIRECTIONAL_UV_HITS); | |
| 212 | 206 | read_angle_delta(dec, &mut cdfs.angle_delta[uv_mode - V_PRED]) |
| 213 | 207 | } else { |
| 214 | 208 | 0 |
| 215 | 209 | }; |
| 216 | 210 | istep!("angle_uv", angle_delta_uv); |
| 217 | - if angle_delta_uv != 0 { | |
| 218 | - hit!(UV_ANGLE_DELTA_HITS); | |
| 219 | - } | |
| 220 | 211 | // `read_palette_mode_info` (spec 5.11.13, libaom decodemv.c:567, called |
| 221 | 212 | // at :840 right after `xd->cfl.store_y` and before `read_filter_intra_mode_info`): |
| 222 | 213 | // gated by `av1_allow_palette` (blockd.h -- size bound only, |
| @@ -322,7 +313,6 @@ pub(super) fn read_intra_mode( | ||
| 322 | 313 | } |
| 323 | 314 | istep!("use_filter_intra", use_filter_intra as i32); |
| 324 | 315 | if use_filter_intra { |
| 325 | - hit!(FILTER_INTRA_HITS); | |
| 326 | 316 | let fi_mode = dec.symbol(&mut cdfs.filter_intra_mode); |
| 327 | 317 | if trace { |
| 328 | 318 | eprintln!("TRACE filter_intra_mode value={fi_mode}"); |
| @@ -342,7 +332,6 @@ pub(super) fn read_intra_mode( | ||
| 342 | 332 | palette_onscreen(mi_r, mi_c, side, side, fctx), |
| 343 | 333 | false, |
| 344 | 334 | ); |
| 345 | - hit!(PALETTE_HITS); | |
| 346 | 335 | if trace { |
| 347 | 336 | eprintln!("TRACE palette_y size={n} colors={:?}", &colors[..n]); |
| 348 | 337 | } |
| @@ -372,7 +361,6 @@ pub(super) fn read_intra_mode( | ||
| 372 | 361 | on, |
| 373 | 362 | true, |
| 374 | 363 | ); |
| 375 | - hit!(PALETTE_UV_HITS); | |
| 376 | 364 | if trace { |
| 377 | 365 | eprintln!( |
| 378 | 366 | "TRACE palette_uv size={n} u_colors={:?} v_colors={:?}", |
| @@ -412,7 +400,6 @@ pub(super) const UV_CFL_PRED: usize = 13; | ||
| 412 | 400 | /// joint sign the same way. Returns each plane's final signed `alpha_q3` |
| 413 | 401 | /// (`cfl_idx_to_alpha`, cfl.c): magnitude `idx + 1`, sign-zero collapsing to 0. |
| 414 | 402 | pub(super) fn read_cfl_alphas(dec: &mut SymbolDecoder, cdfs: &mut Cdfs) -> (i32, i32) { |
| 415 | - hit!(CFL_BLOCK_HITS); | |
| 416 | 403 | let joint_sign = dec.symbol(&mut cdfs.cfl_sign) as i32; |
| 417 | 404 | let sign_u = ((joint_sign + 1) * 11) >> 5; |
| 418 | 405 | let sign_v = (joint_sign + 1) - 3 * sign_u; |
| @@ -461,7 +448,6 @@ pub(super) fn cfl_ac_ss( | ||
| 461 | 448 | ss_y: usize, |
| 462 | 449 | ) -> Vec<i32> { |
| 463 | 450 | if ss_x == 0 && ss_y == 0 { |
| 464 | - hit!(CFL_AC_444_HITS); | |
| 465 | 451 | let mut ac = vec![0i32; bw * bh]; |
| 466 | 452 | let mut sum = 0i32; |
| 467 | 453 | for row in 0..bh { |
| @@ -476,12 +462,6 @@ pub(super) fn cfl_ac_ss( | ||
| 476 | 462 | ac.iter_mut().for_each(|v| *v -= avg); |
| 477 | 463 | ac |
| 478 | 464 | } else if ss_x == 1 && ss_y == 0 { |
| 479 | - // lane-av1-422: `cfl_luma_subsampling_422_lbd_c` -- each chroma sample | |
| 480 | - // averages the HORIZONTAL luma pair above it, at full chroma height | |
| 481 | - // (`(a + b) >> 1` in Q3 is `(a + b) << 2`). A rect luma strip's chroma | |
| 482 | - // is square here, and the 4:2:0 rect/square helpers below would halve | |
| 483 | - // the height it must keep. | |
| 484 | - hit!(CFL_AC_422_HITS); | |
| 485 | 465 | let (cw, ch) = (bw >> 1, bh); |
| 486 | 466 | let mut ac = vec![0i32; cw * ch]; |
| 487 | 467 | let mut sum = 0i32; |
| @@ -500,10 +480,8 @@ pub(super) fn cfl_ac_ss( | ||
| 500 | 480 | ac.iter_mut().for_each(|v| *v -= avg); |
| 501 | 481 | ac |
| 502 | 482 | } else if bw == bh { |
| 503 | - hit!(CFL_AC_420_SQ_HITS); | |
| 504 | 483 | cfl_ac_q3(y, px, py, bw) |
| 505 | 484 | } else { |
| 506 | - hit!(CFL_AC_420_RECT_HITS); | |
| 507 | 485 | cfl_ac_q3_rect(y, px, py, bw, bh) |
| 508 | 486 | } |
| 509 | 487 | } |
| @@ -515,7 +493,6 @@ pub(crate) fn cfl_ac_q3_at( | ||
| 515 | 493 | bh: usize, |
| 516 | 494 | sample: impl Fn(usize, usize) -> i32, |
| 517 | 495 | ) -> Vec<i32> { |
| 518 | - hit!(CFL_AC_Q3_AT_HITS); | |
| 519 | 496 | if crate::envflags::env_flag!("EC_HALVSWEEP") { |
| 520 | 497 | eprintln!("EC_HALV cfl_ac_q3_at px={px} py={py} bw={bw} bh={bh}"); |
| 521 | 498 | } |
| @@ -1216,12 +1193,6 @@ impl PlaneBuf<'_> { | ||
| 1216 | 1193 | }); |
| 1217 | 1194 | let corner = |
| 1218 | 1195 | (x > self.tile_x0 && y > self.tile_y0).then(|| self.data[(y - 1) * self.width + x - 1]); |
| 1219 | - if matches!((bw, bh), (16, 8) | (8, 16)) { | |
| 1220 | - hit!(RECT_STRIP_PRED_HITS); | |
| 1221 | - if across > own_across || down > own_down { | |
| 1222 | - hit!(RECT_STRIP_REACH_HITS); | |
| 1223 | - } | |
| 1224 | - } | |
| 1225 | 1196 | (above, left, corner) |
| 1226 | 1197 | } |
| 1227 | 1198 | |
| @@ -1566,8 +1537,6 @@ pub(super) fn read_plane( | ||
| 1566 | 1537 | if plane_idx > 0 && mono(fctx) { |
| 1567 | 1538 | return Ok(Grid::Zero(side * side)); |
| 1568 | 1539 | } |
| 1569 | - // lane-av1readcensus: the units read from here on are this plane's. | |
| 1570 | - set_census_plane(plane_idx); | |
| 1571 | 1540 | let skip_ctx = if plane_idx == 0 { |
| 1572 | 1541 | luma_skip_ctx.unwrap_or(0) |
| 1573 | 1542 | } else { |
| @@ -1848,9 +1817,6 @@ pub(super) fn read_rect_chroma_unit( | ||
| 1848 | 1817 | smooth_neighbor_uv: bool, |
| 1849 | 1818 | fctx: &crate::decode::FrameCtx, |
| 1850 | 1819 | ) -> Result<Grid> { |
| 1851 | - if ss_x(fctx) == 1 && ss_y(fctx) == 0 && w != h { | |
| 1852 | - hit!(CHROMA422_RECT_HITS); | |
| 1853 | - } | |
| 1854 | 1820 | // The same three cases as [`read_plane`], for the same reason: at 32 points |
| 1855 | 1821 | // an INTER chroma unit's transform set is `EXT_TX_SET_DCT_IDTX` (the luma's |
| 1856 | 1822 | // coded `IDTX` survives) where the intra set is `EXT_TX_SET_DCTONLY`, and |
| @@ -1974,9 +1940,6 @@ pub(super) fn decode_block( | ||
| 1974 | 1940 | c * (SUB / MI), |
| 1975 | 1941 | fctx, |
| 1976 | 1942 | )?; |
| 1977 | - if at_tile_left && palette_y.is_some() { | |
| 1978 | - hit!(PALETTE_TILE_LEFT_HITS); | |
| 1979 | - } | |
| 1980 | 1943 | // lane-lossless: a lossless BLOCK's transform is TX_4X4 on every plane |
| 1981 | 1944 | // (libaom `read_tx_size`, `decodeframe.c`), so the caller's per-size |
| 1982 | 1945 | // tables/scans are replaced by the 4x4 ones and the block always takes the |
| @@ -2045,9 +2008,6 @@ pub(super) fn decode_block( | ||
| 2045 | 2008 | uv_mode |
| 2046 | 2009 | }; |
| 2047 | 2010 | let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode); |
| 2048 | - if smooth_neighbor { | |
| 2049 | - hit!(SMOOTH_LUMA_HITS); | |
| 2050 | - } | |
| 2051 | 2011 | let smooth_neighbor_uv = |
| 2052 | 2012 | neighbours.smooth_uv_neighbour(r * (SUB / MI), c * (SUB / MI), r, c, fctx); |
| 2053 | 2013 | if crate::envflags::env_flag!("EC_AV1_TRACE") { |
| @@ -2112,7 +2072,6 @@ pub(super) fn decode_block( | ||
| 2112 | 2072 | ); |
| 2113 | 2073 | } |
| 2114 | 2074 | } |
| 2115 | - hit!(INTRABC_VARTX_HITS); | |
| 2116 | 2075 | // lane-t900 r33 census: the t900 recipes resolved every tree UNIFORM. |
| 2117 | 2076 | // lane-av1-ibcvtx: a tree that resolved to mixed leaf sizes is no |
| 2118 | 2077 | // longer refused -- the luma reconstruct below walks the tree's own |
| @@ -2127,7 +2086,6 @@ pub(super) fn decode_block( | ||
| 2127 | 2086 | .all(|l| (l.2, l.3) == (f.2, f.3) && l.2 == l.3) |
| 2128 | 2087 | }); |
| 2129 | 2088 | if !uniform { |
| 2130 | - hit!(INTRABC_VARTX_MIXED_LEAVES_HITS); | |
| 2131 | 2089 | if crate::envflags::env_flag!("EC_AV1_IBCVTX_DEBUG") { |
| 2132 | 2090 | eprintln!( |
| 2133 | 2091 | "IBCVTX mixed intrabc tree mi=({mi_r},{mi_c}) side={side} \ |
| @@ -2151,9 +2109,6 @@ pub(super) fn decode_block( | ||
| 2151 | 2109 | // single-unit path. |
| 2152 | 2110 | (lossless_tx(side.min(64), fctx), luma_tx) |
| 2153 | 2111 | }; |
| 2154 | - if tx_select && logical_tx < side && uv_mode != DC_PRED { | |
| 2155 | - hit!(SQ_CHROMA_TX_HITS); | |
| 2156 | - } | |
| 2157 | 2112 | let luma_set = if tx_select { |
| 2158 | 2113 | txbset_for(logical_tx, reduced_tx_set) |
| 2159 | 2114 | } else { |
| @@ -2260,9 +2215,6 @@ pub(super) fn decode_block( | ||
| 2260 | 2215 | // Counted on the SHAPE, not on the arm below, so a gate can tell a stream |
| 2261 | 2216 | // that reaches this block apart from one that never does (class |
| 2262 | 2217 | // gate-blind-to-feature). |
| 2263 | - if palette_y_buf.is_some() && skip && logical_tx < side { | |
| 2264 | - hit!(SKIP_SPLIT_TX_OVERRIDE_HITS); | |
| 2265 | - } | |
| 2266 | 2218 | if let Some(buf) = &palette_y_buf |
| 2267 | 2219 | && (logical_tx == side || skip) |
| 2268 | 2220 | { |
| @@ -2313,9 +2265,6 @@ pub(super) fn decode_block( | ||
| 2313 | 2265 | // narrower meaning (a READ split tx depth). |
| 2314 | 2266 | let split_tx_skip = logical_tx < side && palette_y_buf.is_none() && intrabc_bufs.is_none(); |
| 2315 | 2267 | if split_tx_skip { |
| 2316 | - if tx_select { | |
| 2317 | - hit!(SKIP_SPLIT_TX_HITS); | |
| 2318 | - } | |
| 2319 | 2268 | let n_axis = side / logical_tx; |
| 2320 | 2269 | for tu_row in 0..n_axis { |
| 2321 | 2270 | for tu_col in 0..n_axis { |
| @@ -2440,9 +2389,6 @@ pub(super) fn decode_block( | ||
| 2440 | 2389 | window |
| 2441 | 2390 | }; |
| 2442 | 2391 | if let Some((ub, _)) = &palette_uv_bufs { |
| 2443 | - if cn_cols * cn_rows > 1 { | |
| 2444 | - hit!(SKIP_CHROMA_OVERRIDE_WINDOW_HITS); | |
| 2445 | - } | |
| 2446 | 2392 | set_palette_pred(chroma_window(ub), fctx); |
| 2447 | 2393 | } |
| 2448 | 2394 | push_intra_unit( |
| @@ -2513,10 +2459,6 @@ pub(super) fn decode_block( | ||
| 2513 | 2459 | // the total stayed 0. |
| 2514 | 2460 | let plane_block = chroma_side * chroma_height; |
| 2515 | 2461 | let short = plane_block.saturating_sub(u_grid.len()); |
| 2516 | - hit_do!(SKIP_ARM_CHROMA_SHORT_SAMPLES.with(|c| c.set(c.get() + short))); | |
| 2517 | - if chroma_side != chroma_height { | |
| 2518 | - hit!(SKIP_ARM_CHROMA_RECT_SHAPES); | |
| 2519 | - } | |
| 2520 | 2462 | neighbours.record( |
| 2521 | 2463 | at, |
| 2522 | 2464 | side, |
| @@ -2785,10 +2727,6 @@ pub(super) fn decode_block( | ||
| 2785 | 2727 | smooth_neighbor_uv, |
| 2786 | 2728 | fctx, |
| 2787 | 2729 | )?; |
| 2788 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 2789 | - if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | |
| 2790 | - hit!(CHROMA422_SQUARE_HITS); | |
| 2791 | - } | |
| 2792 | 2730 | // Immediately, so the next unit of this block reads this |
| 2793 | 2731 | // one's coefficient context. `record` below stamps one |
| 2794 | 2732 | // chroma state across the whole block; the replay after |
| @@ -2943,7 +2881,6 @@ pub(super) fn decode_block( | ||
| 2943 | 2881 | (luma_set, luma_scan) |
| 2944 | 2882 | }; |
| 2945 | 2883 | if let Some(buf) = &palette_y_buf { |
| 2946 | - hit!(PALETTE_SPLIT_TX_HITS); | |
| 2947 | 2884 | let mut window = vec![0u16; tu_tx * tu_tx]; |
| 2948 | 2885 | for row in 0..tu_tx { |
| 2949 | 2886 | let src = (tu_off_y + row) * side + tu_off_x; |
| @@ -3070,7 +3007,6 @@ pub(super) fn decode_block( | ||
| 3070 | 3007 | }; |
| 3071 | 3008 | let (unit_w, unit_h) = (chroma_tx / 4, chroma_tx_h / 4); |
| 3072 | 3009 | if cu_col * unit_w >= max_units_w || cu_row * unit_h >= max_units_h { |
| 3073 | - hit!(CHROMA_EDGE_TU_CLIP_HITS); | |
| 3074 | 3010 | continue; |
| 3075 | 3011 | } |
| 3076 | 3012 | // The chroma context arrays are indexed in LUMA mi, so this |
| @@ -3182,10 +3118,6 @@ pub(super) fn decode_block( | ||
| 3182 | 3118 | )? |
| 3183 | 3119 | }; |
| 3184 | 3120 | if cn_rows * cn_cols > 1 { |
| 3185 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 3186 | - if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | |
| 3187 | - hit!(CHROMA422_SQUARE_HITS); | |
| 3188 | - } | |
| 3189 | 3121 | // Immediately, so the NEXT unit of this same block reads |
| 3190 | 3122 | // this one's coefficient context (libaom's chroma |
| 3191 | 3123 | // `txb_skip_ctx` for the second quadrant is 11, i.e. base |
crates/ec-av1/src/decode/coeffs.rsmodified+1 -103
| @@ -90,17 +90,7 @@ pub(super) fn read_coeffs( | ||
| 90 | 90 | ) -> Result<(Grid, TxType)> { |
| 91 | 91 | let trace = crate::envflags::env_flag!("EC_AV1_TRACE"); |
| 92 | 92 | let side = coding.side; |
| 93 | - // lane-av1readcensus: this unit's own entry state, so the census line | |
| 94 | - // carries the pre-read rng and pairs against the oracle's `EC_COEFF` | |
| 95 | - // (which prints `r->ec.rng` before the same `txb_skip` read). | |
| 96 | - let census_entry_rng = dec.debug_state().0; | |
| 97 | 93 | let (census_w, census_h) = rect_shape.unwrap_or((side, side)); |
| 98 | - // lane-av1ibcfork: the per-unit BIT INTERVAL, the twin of the oracle's | |
| 99 | - // `EC_ECDUMP_IN` / `_OUT` / `_END`. The census plane, not a fresh label: | |
| 100 | - // it is the same source `census_unit` reads, so the interval line and the | |
| 101 | - // census line can never disagree about which plane a unit is on. | |
| 102 | - let iv_plane = CENSUS_PLANE.with(|c| c.get()).min(2); | |
| 103 | - let iv_bit = unit_iv_in(iv_plane, census_w, census_h, skip_ctx, dec); | |
| 104 | 94 | if crate::envflags::env_flag!("EC_AV1_EOBPT_CDF") { |
| 105 | 95 | let (range, value) = dec.debug_state(); |
| 106 | 96 | eprintln!("EC_AV1_STATE_BEFORE_TXBSKIP range={range} value={value}"); |
| @@ -123,9 +113,6 @@ pub(super) fn read_coeffs( | ||
| 123 | 113 | 0 |
| 124 | 114 | }; |
| 125 | 115 | let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1; |
| 126 | - unit_iv_skip( | |
| 127 | - dec, iv_bit, iv_plane, census_w, census_h, skip_ctx, all_zero, | |
| 128 | - ); | |
| 129 | 116 | // lane-ibc444c: this reader logs an `all_zero` step even for a read that |
| 130 | 117 | // consumes ZERO bits, so `post_bit == bit` means "no symbol was read" -- |
| 131 | 118 | // filter on it before pairing anything against the oracle. |
| @@ -161,18 +148,6 @@ pub(super) fn read_coeffs( | ||
| 161 | 148 | eprintln!("EC_AV1_STATE_AFTER_TXBSKIP range={range} value={value}"); |
| 162 | 149 | } |
| 163 | 150 | if all_zero { |
| 164 | - // lane-coefgrid: the all-zero unit (60% of the 4K segment's) names the | |
| 165 | - // shared zero grid instead of allocating and zeroing its own. | |
| 166 | - census_unit( | |
| 167 | - census_w, | |
| 168 | - census_h, | |
| 169 | - TxType::DctDct, | |
| 170 | - 0, | |
| 171 | - true, | |
| 172 | - census_entry_rng, | |
| 173 | - dec, | |
| 174 | - ); | |
| 175 | - unit_iv_end(dec, iv_plane, census_w, census_h, skip_ctx); | |
| 176 | 151 | return Ok((Grid::Zero(side * side), TxType::DctDct)); |
| 177 | 152 | } |
| 178 | 153 | let mut grid = vec![0i32; side * side]; |
| @@ -209,10 +184,6 @@ pub(super) fn read_coeffs( | ||
| 209 | 184 | } |
| 210 | 185 | |
| 211 | 186 | let class = TxClass::of(tx_type); |
| 212 | - if class != TxClass::TwoD { | |
| 213 | - hit!(TX_CLASS1_HITS); | |
| 214 | - hit!(RECT_CLASS1_HITS); | |
| 215 | - } | |
| 216 | 187 | let eob = read_eob(dec, coding, class); |
| 217 | 188 | if trace { |
| 218 | 189 | eprintln!("TRACE eob value={eob}"); |
| @@ -381,16 +352,6 @@ pub(super) fn read_coeffs( | ||
| 381 | 352 | } |
| 382 | 353 | grid[pos] = if negative { -level } else { level }; |
| 383 | 354 | } |
| 384 | - census_unit( | |
| 385 | - census_w, | |
| 386 | - census_h, | |
| 387 | - tx_type, | |
| 388 | - eob, | |
| 389 | - false, | |
| 390 | - census_entry_rng, | |
| 391 | - dec, | |
| 392 | - ); | |
| 393 | - unit_iv_end(dec, iv_plane, census_w, census_h, skip_ctx); | |
| 394 | 355 | Ok((Grid::Own(grid), tx_type)) |
| 395 | 356 | } |
| 396 | 357 | |
| @@ -425,19 +386,10 @@ pub(super) fn read_coeffs_rect( | ||
| 425 | 386 | plane: usize, |
| 426 | 387 | ) -> Result<(Grid, TxType)> { |
| 427 | 388 | let rect_trace = coeff_trace_on(); |
| 428 | - let entry_rng = dec.debug_state().0; | |
| 429 | - // lane-av1readcensus: this reader is handed the real plane (lane-av1chrtx | |
| 430 | - // threaded it in for the `EC_COEFF_STEP` traces), so it stamps the census | |
| 431 | - // plane itself rather than inheriting whichever reader did last. The | |
| 432 | - // luma-only readers (`decode_rect_split`, `decode_block_rect64`, | |
| 433 | - // `read_inter_plane_rect`'s corner) are all plane 0 -- the stamp's initial | |
| 434 | - // value -- and the other plane-owning readers stamp on entry. | |
| 435 | - set_census_plane(plane); | |
| 436 | 389 | let ibctx_on = crate::envflags::env_flag!("EC_IBCTX"); |
| 437 | 390 | let entry_bit = if ibctx_on { dec.debug_bitpos() } else { 0 }; |
| 438 | - let iv_bit = unit_iv_in(plane, w, h, skip_ctx, dec); | |
| 391 | + let entry_rng = dec.debug_state().0; | |
| 439 | 392 | let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1; |
| 440 | - unit_iv_skip(dec, iv_bit, plane, w, h, skip_ctx, all_zero); | |
| 441 | 393 | if rect_trace { |
| 442 | 394 | eprintln!( |
| 443 | 395 | "EC_COEFF_STEP tag=all_zero plane={plane} ctx={skip_ctx} entry={entry_rng} all_zero={} rng={} bit={entry_bit} post_bit={}", |
| @@ -460,12 +412,9 @@ pub(super) fn read_coeffs_rect( | ||
| 460 | 412 | ); |
| 461 | 413 | } |
| 462 | 414 | if all_zero { |
| 463 | - census_unit(w, h, TxType::DctDct, 0, true, entry_rng, dec); | |
| 464 | - unit_iv_end(dec, plane, w, h, skip_ctx); | |
| 465 | 415 | return Ok((Grid::Zero(w * h), TxType::DctDct)); |
| 466 | 416 | } |
| 467 | 417 | let mut grid = vec![0i32; w * h]; |
| 468 | - hit!(RECT_COEFF_TU_HITS); | |
| 469 | 418 | // lane-tx4x8: a 4x8/8x4 luma TU DOES carry a `tx_type` symbol (its set is |
| 470 | 419 | // `EXT_TX_SET_DTT4_IDTX(_1DDCT)`, `tx_size_sqr_up == TX_8X8`), including |
| 471 | 420 | // the `V_DCT`/`H_DCT` members whose 1D tx class needs its own scan and |
| @@ -487,9 +436,6 @@ pub(super) fn read_coeffs_rect( | ||
| 487 | 436 | } |
| 488 | 437 | } |
| 489 | 438 | let class = TxClass::of(tx_type); |
| 490 | - if class != TxClass::TwoD { | |
| 491 | - hit!(TX_CLASS1_HITS); | |
| 492 | - } | |
| 493 | 439 | let eob = read_eob(dec, coding, class); |
| 494 | 440 | if rect_trace { |
| 495 | 441 | eprintln!( |
| @@ -683,8 +629,6 @@ pub(super) fn read_coeffs_rect( | ||
| 683 | 629 | nz.join(",") |
| 684 | 630 | ); |
| 685 | 631 | } |
| 686 | - census_unit(w, h, tx_type, eob, false, entry_rng, dec); | |
| 687 | - unit_iv_end(dec, plane, w, h, skip_ctx); | |
| 688 | 632 | Ok((Grid::Own(grid), tx_type)) |
| 689 | 633 | } |
| 690 | 634 | |
| @@ -1747,9 +1691,6 @@ impl Neighbours { | ||
| 1747 | 1691 | /// [`Self::fill_skip_grid`] with independent row/col extents (lane-partitions r1). |
| 1748 | 1692 | pub(super) fn fill_skip_grid_rect(&mut self, at_mi: (usize, usize), w_mi: usize, h_mi: usize, skip: bool) { |
| 1749 | 1693 | let (mi_r, mi_c) = at_mi; |
| 1750 | - if skip && w_mi != h_mi { | |
| 1751 | - hit!(RECT_SKIP_BAND_HITS); | |
| 1752 | - } | |
| 1753 | 1694 | for rr in 0..h_mi { |
| 1754 | 1695 | let start = (mi_r + rr) * self.skip_grid_cols_mi + mi_c; |
| 1755 | 1696 | fill_span( |
| @@ -2517,7 +2458,6 @@ impl Neighbours { | ||
| 2517 | 2458 | if self.tile_row0_mi > 0 && !have_above && self.above_uv_mode[c] != DC_PRED |
| 2518 | 2459 | || self.tile_col0_mi > 0 && !have_left && self.left_uv_mode[r] != DC_PRED |
| 2519 | 2460 | { |
| 2520 | - hit!(UV_TILE_EDGE_SUPPRESSED_HITS); | |
| 2521 | 2461 | } |
| 2522 | 2462 | // The mi grid is libaom's own read; the two maps below stay as the |
| 2523 | 2463 | // fallback for cells no block has written (see [`Self::uv_mode_grid`]). |
| @@ -2607,17 +2547,10 @@ impl Neighbours { | ||
| 2607 | 2547 | // `lanes/av1leftref.report.md`, which is what makes the read change a |
| 2608 | 2548 | // proven no-op on today's material rather than an unmeasured guess. |
| 2609 | 2549 | if decode_path && have_left && ss_y > 0 { |
| 2610 | - hit!(UV_LEFT_SS_Y_READS); | |
| 2611 | 2550 | // The pre-lane read, kept as the counter's own-row arm: it is what |
| 2612 | 2551 | // this decoder answered before the `+ss_y` term landed, and |
| 2613 | 2552 | // comparing against it is what proves the term is load-bearing. |
| 2614 | 2553 | let own_row = read_left(mi_r); |
| 2615 | - if own_row != left { | |
| 2616 | - hit!(UV_LEFT_SS_Y_MODE_DIFF_HITS); | |
| 2617 | - } | |
| 2618 | - if is_smooth_mode(own_row) != is_smooth_mode(left) { | |
| 2619 | - hit!(UV_LEFT_SS_Y_SMOOTH_DIFF_HITS); | |
| 2620 | - } | |
| 2621 | 2554 | // lane-av1leftwit: the geometry the `+ss_y` term needs. The two |
| 2622 | 2555 | // cells are one left mi column apart, so they are two different |
| 2623 | 2556 | // blocks exactly when the left neighbour is 1 mi tall or shorter. |
| @@ -2635,7 +2568,6 @@ impl Neighbours { | ||
| 2635 | 2568 | .filter(|o| o & 0xff00_0000 == epoch) |
| 2636 | 2569 | .unwrap_or(0); |
| 2637 | 2570 | if own != 0 && down != 0 && own != down { |
| 2638 | - hit!(UV_LEFT_1MI_SPLIT_HITS); | |
| 2639 | 2571 | if crate::envflags::env_flag!("EC_LEFTSSY") { |
| 2640 | 2572 | eprintln!( |
| 2641 | 2573 | "EC_LEFTSSY epoch={} mi=({mi_r},{mi_c}) left_col={col} \ |
| @@ -2654,18 +2586,13 @@ impl Neighbours { | ||
| 2654 | 2586 | }) || have_left && cell(&self.uv_mode_grid, left_mi.0, left_mi.1).is_some_and(|m| { |
| 2655 | 2587 | !matches!(self.uv_mode_row.get(left_mi.0), Some(&(col, cm)) if usize::from(col) == left_mi.1 && usize::from(cm) == m) |
| 2656 | 2588 | }) { |
| 2657 | - hit!(UV_MODE_GRID_OVERRIDE_HITS); | |
| 2658 | 2589 | } |
| 2659 | 2590 | // lane-cfl r1 counter: how often the mi-exact chroma neighbour differs |
| 2660 | 2591 | // from the coarse [`SUB`] slot -- i.e. how often a chroma edge would |
| 2661 | 2592 | // have been filtered at the wrong strength by the coarse map alone. |
| 2662 | - if above != self.above_uv_mode[c] || left != self.left_uv_mode[r] { | |
| 2663 | - hit!(UV_MODE_MI_OVERRIDE_HITS); | |
| 2664 | - } | |
| 2665 | 2593 | if (is_smooth_mode(self.above_uv_mode[c]) && !is_smooth_mode(above)) |
| 2666 | 2594 | || (is_smooth_mode(self.left_uv_mode[r]) && !is_smooth_mode(left)) |
| 2667 | 2595 | { |
| 2668 | - hit!(INTER_NEIGHBOUR_NOT_SMOOTH_HITS); | |
| 2669 | 2596 | } |
| 2670 | 2597 | is_smooth_mode(above) || is_smooth_mode(left) |
| 2671 | 2598 | } |
| @@ -2719,20 +2646,15 @@ impl Neighbours { | ||
| 2719 | 2646 | let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI)); |
| 2720 | 2647 | let (above, left) = |
| 2721 | 2648 | self.modes_above_left_mi(mi_r, mi_c, (self.above_mode[c], self.left_mode[r])); |
| 2722 | - if above != self.above_mode[c] || left != self.left_mode[r] { | |
| 2723 | - hit!(MODE_MI_OVERRIDE_HITS); | |
| 2724 | - } | |
| 2725 | 2649 | if (is_smooth_mode(self.above_mode[c]) && !is_smooth_mode(above)) |
| 2726 | 2650 | || (is_smooth_mode(self.left_mode[r]) && !is_smooth_mode(left)) |
| 2727 | 2651 | { |
| 2728 | - hit!(INTER_NEIGHBOUR_NOT_SMOOTH_HITS); | |
| 2729 | 2652 | } |
| 2730 | 2653 | // A neighbour the coarse band offered where the tile edge makes it |
| 2731 | 2654 | // unavailable -- must never happen (see `MODE_TILE_EDGE_COARSE_LEAKS`). |
| 2732 | 2655 | if (mi_r <= self.tile_row0_mi && self.above_mode[c] != DC_PRED) |
| 2733 | 2656 | || (mi_c <= self.tile_col0_mi && self.left_mode[r] != DC_PRED) |
| 2734 | 2657 | { |
| 2735 | - hit!(MODE_TILE_EDGE_COARSE_LEAKS); | |
| 2736 | 2658 | } |
| 2737 | 2659 | (above, left) |
| 2738 | 2660 | } |
| @@ -2935,13 +2857,6 @@ impl Neighbours { | ||
| 2935 | 2857 | // the flags read the CALLER's origin, before the shadowing align below |
| 2936 | 2858 | let (row_mid, col_mid) = (mi_r & (step_y - 1) != 0, mi_c & (step_x - 1) != 0); |
| 2937 | 2859 | if row_mid || col_mid { |
| 2938 | - CHROMA_MIDCELL_PUB_HITS.with(|c| { | |
| 2939 | - let mut v = c.get(); | |
| 2940 | - v[0] += usize::from(row_mid); | |
| 2941 | - v[1] += usize::from(col_mid); | |
| 2942 | - v[2] += usize::from(row_mid && col_mid); | |
| 2943 | - c.set(v); | |
| 2944 | - }); | |
| 2945 | 2860 | } |
| 2946 | 2861 | let (mi_r, mi_c) = (mi_r & !(step_y - 1), mi_c & !(step_x - 1)); |
| 2947 | 2862 | let round_up_even = |n: usize| n.div_ceil(2) * 2; |
| @@ -3571,9 +3486,6 @@ pub(super) fn decode_color_index_map_wh( | ||
| 3571 | 3486 | ) -> Vec<u8> { |
| 3572 | 3487 | let trace = crate::envflags::env_flag!("EC_AV1_TRACE"); |
| 3573 | 3488 | let (on_bw, on_bh) = (on.0.clamp(1, bw), on.1.clamp(1, bh)); |
| 3574 | - if on_bw < bw || on_bh < bh { | |
| 3575 | - hit!(PALETTE_ONSCREEN_CUT_HITS); | |
| 3576 | - } | |
| 3577 | 3489 | let mut map = vec![0u8; bw * bh]; |
| 3578 | 3490 | if trace { |
| 3579 | 3491 | let (rng, _) = dec.debug_state(); |
| @@ -3642,9 +3554,6 @@ pub(crate) fn palette_replicate(map: &mut [u8], bw: usize, bh: usize, on: (usize | ||
| 3642 | 3554 | /// it lands away from zero, for gate tests to prove a real stream fired one. |
| 3643 | 3555 | pub(super) fn read_angle_delta(dec: &mut SymbolDecoder, cdf: &mut [u16]) -> i32 { |
| 3644 | 3556 | let symbol = dec.symbol(cdf); |
| 3645 | - if symbol != ANGLE_DELTA_ZERO { | |
| 3646 | - hit!(ANGLE_DELTA_HITS); | |
| 3647 | - } | |
| 3648 | 3557 | symbol as i32 - ANGLE_DELTA_ZERO as i32 |
| 3649 | 3558 | } |
| 3650 | 3559 | |
| @@ -3777,7 +3686,6 @@ pub(super) fn tx_size_context_txfm_rect( | ||
| 3777 | 3686 | own_h: usize, |
| 3778 | 3687 | fctx: &crate::decode::FrameCtx, |
| 3779 | 3688 | ) -> usize { |
| 3780 | - hit!(INTRA_IN_INTER_TXCTX_HITS); | |
| 3781 | 3689 | // `max_txsize_rect_lookup[bsize]` tops out at TX_64X64: no transform is |
| 3782 | 3690 | // wider or taller than 64, so a block with a 128 side resolves against 64 |
| 3783 | 3691 | // (lane-sb128b r1). |
| @@ -3827,7 +3735,6 @@ pub(super) fn tx_size_context_txfm_rect( | ||
| 3827 | 3735 | if band_above != (has_above && usize::from(above) != 0) |
| 3828 | 3736 | || band_left != (has_left && usize::from(left) != 0) |
| 3829 | 3737 | { |
| 3830 | - hit!(TXCTX_INTER_CELL_BAND_DIVERGENCE_HITS); | |
| 3831 | 3738 | } |
| 3832 | 3739 | } |
| 3833 | 3740 | if crate::envflags::env_flag!("EC_TXCTX") { |
| @@ -3861,9 +3768,6 @@ pub(super) fn tx_size_context_txfm_rect( | ||
| 3861 | 3768 | { |
| 3862 | 3769 | let stale = usize::from(has_above && tx_px_at(n, false, mi_r - 1, mi_c) as usize >= own_w) |
| 3863 | 3770 | + usize::from(has_left && tx_h_px_at(n, false, mi_r, mi_c - 1) as usize >= own_h); |
| 3864 | - if ctx != stale { | |
| 3865 | - hit!(TXCTX_DEBLOCK_DIVERGENCE_HITS); | |
| 3866 | - } | |
| 3867 | 3771 | } |
| 3868 | 3772 | ctx |
| 3869 | 3773 | } |
| @@ -3918,7 +3822,6 @@ pub(super) fn tx_size_context_txfm(n: &Neighbours, (mi_r, mi_c): (usize, usize), | ||
| 3918 | 3822 | if band_above != (has_above && usize::from(above) != 0) |
| 3919 | 3823 | || band_left != (has_left && usize::from(left) != 0) |
| 3920 | 3824 | { |
| 3921 | - hit!(TXCTX_INTER_CELL_BAND_DIVERGENCE_HITS); | |
| 3922 | 3825 | } |
| 3923 | 3826 | } |
| 3924 | 3827 | if crate::envflags::env_flag!("EC_TXCTX") { |
| @@ -3990,9 +3893,6 @@ pub(super) fn read_tx_size( | ||
| 3990 | 3893 | "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=tx_depth val={depth} ctx={ctx} rng={rng}" |
| 3991 | 3894 | ); |
| 3992 | 3895 | } |
| 3993 | - if depth != 0 { | |
| 3994 | - hit!(TX_DEPTH_HITS); | |
| 3995 | - } | |
| 3996 | 3896 | max_tx >> depth |
| 3997 | 3897 | } |
| 3998 | 3898 | |
| @@ -4408,7 +4308,6 @@ pub(super) fn read_var_tx_size( | ||
| 4408 | 4308 | tx_h, |
| 4409 | 4309 | ); |
| 4410 | 4310 | let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1; |
| 4411 | - hit!(TXFM_SPLIT_READS); | |
| 4412 | 4311 | if crate::envflags::env_flag!("EC_TRACE_MODE_STEP") { |
| 4413 | 4312 | let (rng, _) = dec.debug_state(); |
| 4414 | 4313 | eprintln!( |
| @@ -4423,7 +4322,6 @@ pub(super) fn read_var_tx_size( | ||
| 4423 | 4322 | txfm_partition_update_rect(n, unit, (tx_w, tx_h), (tx_w, tx_h)); |
| 4424 | 4323 | return; |
| 4425 | 4324 | } |
| 4426 | - hit!(TXFM_SPLIT_HITS); | |
| 4427 | 4325 | let (sub_w, sub_h) = sub_tx_size_map(tx_w, tx_h); |
| 4428 | 4326 | if (sub_w, sub_h) == (4, 4) { |
| 4429 | 4327 | // libaom's `sub_txs == TX_4X4` early return: every mi cell of the |
crates/ec-av1/src/decode/counters.rsdeleted+0 -4459
Diff too large; view file
| @@ -1,4459 +0,0 @@ | ||
| 1 | -//! Hit and census counters of the decode path: thread-local tallies bumped by the | |
| 2 | -//! `hit!` instrumentation and read back by the gate tests. Moved out of `decode/mod.rs` | |
| 3 | -//! by name (av1split D3); the items are unchanged except for `pub(super)` visibility. | |
| 4 | - | |
| 5 | -use super::*; | |
| 6 | - | |
| 7 | -// How many real 128-level partition symbols this decoder has read, and how | |
| 8 | -// many superblocks resolved to `PARTITION_SPLIT` (coded or forced) -- the | |
| 9 | -// gate's proof a `--sb-size=128` stream exercised the 128 partition root. | |
| 10 | -thread_local! { | |
| 11 | - pub(super) static PART128_SPLIT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 12 | -} | |
| 13 | - | |
| 14 | -/// Current value of [`PART128_SPLIT_HITS`]. | |
| 15 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 16 | -pub(crate) fn part128_split_hits() -> usize { | |
| 17 | - PART128_SPLIT_HITS.with(|c| c.get()) | |
| 18 | -} | |
| 19 | - | |
| 20 | -// How many `use_filter_intra` symbols this decoder has read as `1`, across | |
| 21 | -// every call on the current thread -- the cheap counter [`filter_intra_hits`] gate | |
| 22 | -// tests read (before/after, not the absolute value) to prove a stream | |
| 23 | -// actually exercised the filter-intra predictor rather than silently | |
| 24 | -// skipping it. | |
| 25 | -thread_local! { | |
| 26 | - pub(super) static FILTER_INTRA_HITS: std::cell::Cell<usize> = | |
| 27 | - const { std::cell::Cell::new(0) }; | |
| 28 | -} | |
| 29 | - | |
| 30 | -/// Current value of [`FILTER_INTRA_HITS`]. | |
| 31 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 32 | -pub(crate) fn filter_intra_hits() -> usize { | |
| 33 | - FILTER_INTRA_HITS.with(|c| c.get()) | |
| 34 | -} | |
| 35 | - | |
| 36 | -// lane-fiinter r1: how many of those `use_filter_intra == 1` symbols belonged | |
| 37 | -// to an INTRA block inside an INTER frame (`read_intra_block_mode_info`'s own | |
| 38 | -// `read_filter_intra_mode_info` call), which no gate exercised before this | |
| 39 | -// round -- every inter gate recipe passed `--enable-filter-intra=0`. | |
| 40 | -thread_local! { | |
| 41 | - pub(super) static INTRA_IN_INTER_FILTER_INTRA_HITS: std::cell::Cell<usize> = | |
| 42 | - const { std::cell::Cell::new(0) }; | |
| 43 | -} | |
| 44 | - | |
| 45 | -/// Current value of [`INTRA_IN_INTER_FILTER_INTRA_HITS`]. | |
| 46 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 47 | -pub(crate) fn intra_in_inter_filter_intra_hits() -> usize { | |
| 48 | - INTRA_IN_INTER_FILTER_INTRA_HITS.with(|c| c.get()) | |
| 49 | -} | |
| 50 | - | |
| 51 | -// lane-angleinter r1: how many INTRA blocks inside an INTER frame carried a | |
| 52 | -// nonzero `angle_delta_y` / `angle_delta_uv` (`read_intra_angle_info`). Both | |
| 53 | -// arms refused a nonzero luma delta before this round, and no inter gate | |
| 54 | -// enabled `--enable-angle-delta` (aomenc's own default is 1). | |
| 55 | -thread_local! { | |
| 56 | - pub(super) static INTRA_IN_INTER_ANGLE_DELTA_Y_HITS: std::cell::Cell<usize> = | |
| 57 | - const { std::cell::Cell::new(0) }; | |
| 58 | - pub(super) static INTRA_IN_INTER_ANGLE_DELTA_UV_HITS: std::cell::Cell<usize> = | |
| 59 | - const { std::cell::Cell::new(0) }; | |
| 60 | -} | |
| 61 | - | |
| 62 | -/// Current value of [`INTRA_IN_INTER_ANGLE_DELTA_Y_HITS`]. | |
| 63 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 64 | -pub(crate) fn intra_in_inter_angle_delta_y_hits() -> usize { | |
| 65 | - INTRA_IN_INTER_ANGLE_DELTA_Y_HITS.with(|c| c.get()) | |
| 66 | -} | |
| 67 | - | |
| 68 | -/// Current value of [`INTRA_IN_INTER_ANGLE_DELTA_UV_HITS`]. | |
| 69 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 70 | -pub(crate) fn intra_in_inter_angle_delta_uv_hits() -> usize { | |
| 71 | - INTRA_IN_INTER_ANGLE_DELTA_UV_HITS.with(|c| c.get()) | |
| 72 | -} | |
| 73 | - | |
| 74 | -// lane-uv8 r1: the three non-DC chroma mode classes an INTRA 8x8 leaf inside | |
| 75 | -// an INTER frame ([`decode_inter_block8`]'s intra arm) can carry -- the arm | |
| 76 | -// read `uv_mode` and then refused everything but `DC_PRED`. Counted here and | |
| 77 | -// nowhere else so the gate's assert cannot be satisfied by a >=16x16 block. | |
| 78 | -thread_local! { | |
| 79 | - pub(super) static INTRA_IN_INTER8_UV_DIR_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 80 | - pub(super) static INTRA_IN_INTER8_UV_SMOOTH_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 81 | - pub(super) static INTRA_IN_INTER8_UV_CFL_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 82 | -} | |
| 83 | - | |
| 84 | -thread_local! { | |
| 85 | - pub(super) static INTRA_IN_INTER8_ANGLE_DELTA_Y_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 86 | -} | |
| 87 | - | |
| 88 | -/// Nonzero luma angle deltas coded by an intra 8x8 leaf inside an inter frame | |
| 89 | -/// (lane-leaf8tx r1) -- counted only in [`decode_inter_block8`]'s intra arm. | |
| 90 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 91 | -pub(crate) fn intra_in_inter8_angle_delta_y_hits() -> usize { | |
| 92 | - INTRA_IN_INTER8_ANGLE_DELTA_Y_HITS.with(|c| c.get()) | |
| 93 | -} | |
| 94 | - | |
| 95 | -/// `(directional, smooth/paeth, CfL)` chroma modes coded by an intra 8x8 leaf | |
| 96 | -/// inside an inter frame -- see [`INTRA_IN_INTER8_UV_DIR_HITS`]. | |
| 97 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 98 | -pub(crate) fn intra_in_inter8_uv_hits() -> (usize, usize, usize) { | |
| 99 | - ( | |
| 100 | - INTRA_IN_INTER8_UV_DIR_HITS.with(|c| c.get()), | |
| 101 | - INTRA_IN_INTER8_UV_SMOOTH_HITS.with(|c| c.get()), | |
| 102 | - INTRA_IN_INTER8_UV_CFL_HITS.with(|c| c.get()), | |
| 103 | - ) | |
| 104 | -} | |
| 105 | - | |
| 106 | -// Whether this superblock's single CDEF unit (this decoder has no 128x128 | |
| 107 | -// SB, so the SB IS the CDEF unit) has already had its `cdef_idx` literal | |
| 108 | -// read -- reset to `false` at the top of each superblock in the two tile | |
| 109 | -// loops, spec `read_cdef`'s `cdef_transmitted[index]`. | |
| 110 | -// Number of superblock columns in the current tile's grid, so | |
| 111 | -// [`maybe_read_cdef_idx`] can turn an `(mi_r, mi_c)` into a flat index into | |
| 112 | -// [`CDEF_IDX_GRID`]. | |
| 113 | -// One resolved `cdef_idx` per superblock, read by [`apply_cdef`] to select | |
| 114 | -// which of the header's `1 << cdef.bits` strength pairs applies to that | |
| 115 | -// superblock's samples. | |
| 116 | -// How many real (`cdef.bits > 0`) `cdef_idx` literals [`maybe_read_cdef_idx`] | |
| 117 | -// has read, across every call on the current thread -- the gate's proof that a | |
| 118 | -// `cdef_bits > 0` stream actually reached the new reader rather than every | |
| 119 | -// superblock coincidentally being all-skip. | |
| 120 | -thread_local! { | |
| 121 | - pub(super) static CDEF_IDX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 122 | -} | |
| 123 | - | |
| 124 | -// How many times a warp was suppressed for one PLANE because that plane's own | |
| 125 | -// block is narrower or shorter than 8 (`av1_init_warp_params`'s own bail-out, | |
| 126 | -// reconinter.c) -- the gate's proof that a stream really carries the shape, | |
| 127 | -// since the square `side`/`chroma_side` can be 8 or more while the plane's | |
| 128 | -// true block is 4 wide (an 8x16 luma block's 4x8 chroma). | |
| 129 | -thread_local! { | |
| 130 | - pub(super) static WARP_PLANE_SUPPRESS_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 131 | -} | |
| 132 | - | |
| 133 | -/// Current value of [`WARP_PLANE_SUPPRESS_HITS`]. | |
| 134 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 135 | -pub(crate) fn warp_plane_suppress_hits() -> usize { | |
| 136 | - WARP_PLANE_SUPPRESS_HITS.with(|c| c.get()) | |
| 137 | -} | |
| 138 | - | |
| 139 | -/// Current value of [`CDEF_IDX_HITS`]. | |
| 140 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 141 | -pub(crate) fn cdef_idx_hits() -> usize { | |
| 142 | - CDEF_IDX_HITS.with(|c| c.get()) | |
| 143 | -} | |
| 144 | - | |
| 145 | -// lane-t900 r6: gate proof for the three r2-r4 root causes that shipped with no | |
| 146 | -// counter -- the in-inter tx-depth context (`tx_size_context_txfm_rect`), the | |
| 147 | -// non-chroma-reference block that must LEAVE its neighbours' chroma coefficient | |
| 148 | -// contexts alone, and the intra-edge filter neighbour pair taken mi-exact | |
| 149 | -// instead of from the coarse 16x16 cell. | |
| 150 | -thread_local! { | |
| 151 | - pub(super) static INTRA_IN_INTER_TXCTX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 152 | - pub(super) static NON_CHROMA_REF_CTX_SKIP_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 153 | - pub(super) static EDGE_FILTER_MI_FIX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 154 | -} | |
| 155 | - | |
| 156 | -/// Current value of [`INTRA_IN_INTER_TXCTX_HITS`]. | |
| 157 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 158 | -pub(crate) fn intra_in_inter_txctx_hits() -> usize { | |
| 159 | - INTRA_IN_INTER_TXCTX_HITS.with(|c| c.get()) | |
| 160 | -} | |
| 161 | - | |
| 162 | -/// Current value of [`NON_CHROMA_REF_CTX_SKIP_HITS`]. | |
| 163 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 164 | -pub(crate) fn non_chroma_ref_ctx_skip_hits() -> usize { | |
| 165 | - NON_CHROMA_REF_CTX_SKIP_HITS.with(|c| c.get()) | |
| 166 | -} | |
| 167 | - | |
| 168 | -/// Current value of [`EDGE_FILTER_MI_FIX_HITS`]. | |
| 169 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 170 | -pub(crate) fn edge_filter_mi_fix_hits() -> usize { | |
| 171 | - EDGE_FILTER_MI_FIX_HITS.with(|c| c.get()) | |
| 172 | -} | |
| 173 | - | |
| 174 | -// lane-realworld r4: this frame's `delta.q_present` (spec 5.9.17) and its | |
| 175 | -// actual step (`1 << delta.q_res`, already the real multiplier, not the raw | |
| 176 | -// 2-bit field). `false`/`1` (the defaults) make [`maybe_read_delta_q`] a | |
| 177 | -// true no-op, matching every existing gate stream's `delta_q_present == 0` | |
| 178 | -// behaviour exactly, the same corner-cut [`CDEF_BITS`] takes above. | |
| 179 | -// The running quantizer index (spec `CurrentQIndex`, libaom | |
| 180 | -// `xd->current_base_qindex`) -- reset to the frame's own `base_q_idx` at the | |
| 181 | -// top of every tile (spec `decode_tile`), carried across superblocks within | |
| 182 | -// that tile, and mutated only by [`maybe_read_delta_q`]. Read back at the | |
| 183 | -// dequantization call sites instead of the frame-constant `base_q_idx`. | |
| 184 | -// This frame's own per-plane DC/AC quantizer-index deltas (lane-sbpart r11, | |
| 185 | -// spec 5.9.12/7.12.2, [`crate::quant::QuantDeltas`]) -- frame-constant (not | |
| 186 | -// per-superblock like [`CURRENT_Q_IDX`]), set once per frame decode and read | |
| 187 | -// back at every dequantization call site keyed on which plane it is doing. | |
| 188 | -// How many real `delta_q_present` symbol groups [`maybe_read_delta_q`] has | |
| 189 | -// read, across every call on the current thread -- the gate's proof that a | |
| 190 | -// `delta_q_present` stream actually reached the new reader. | |
| 191 | -thread_local! { | |
| 192 | - pub(super) static DELTA_Q_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 193 | -} | |
| 194 | - | |
| 195 | -/// Current value of [`DELTA_Q_HITS`]. | |
| 196 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 197 | -pub(crate) fn delta_q_hits() -> usize { | |
| 198 | - DELTA_Q_HITS.with(|c| c.get()) | |
| 199 | -} | |
| 200 | - | |
| 201 | -// lane-realworld r5: this frame's `delta.lf_present`/`lf_res`/`lf_multi` | |
| 202 | -// (spec 5.9.18) -- same no-op-by-default corner-cut as `DELTA_Q_PRESENT`. | |
| 203 | -// The running per-plane/direction loop-filter delta (spec `DeltaLF[i]`, | |
| 204 | -// `i` in `0..FRAME_LF_COUNT`) -- reset to `[0; 4]` at the top of every tile, | |
| 205 | -// mutated only by [`maybe_read_delta_lf`]. `!delta_lf_multi` mode only ever | |
| 206 | -// updates index 0 and every reader treats that as the value for all 4 | |
| 207 | -// indices (spec `read_delta_lf_params`'s own single-cdf branch). | |
| 208 | -// How many real `delta_lf_present` symbol groups [`maybe_read_delta_lf`] has | |
| 209 | -// read -- the gate's proof the reader fired, mirroring [`DELTA_Q_HITS`]. | |
| 210 | -thread_local! { | |
| 211 | - pub(super) static DELTA_LF_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 212 | -} | |
| 213 | - | |
| 214 | -/// Current value of [`DELTA_LF_HITS`]. | |
| 215 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 216 | -pub(crate) fn delta_lf_hits() -> usize { | |
| 217 | - DELTA_LF_HITS.with(|c| c.get()) | |
| 218 | -} | |
| 219 | - | |
| 220 | -// --------------------------------------------------------------------------- | |
| 221 | -// lane-seg: segmentation. Header (spec 5.9.14) is parsed by `ec-av1-syntax`; | |
| 222 | -// this block is the per-block `segment_id` reader (spec 5.11.7-5.11.9) plus | |
| 223 | -// the two consumers a real stream exercises: the per-segment quantizer index | |
| 224 | -// (spec 7.12.2 `get_qindex`) and the per-segment loop-filter level | |
| 225 | -// (spec 7.14.4). Shapes follow libaom `decodemv.c:read_segment_id`/ | |
| 226 | -// `read_intra_segment_id`/`read_inter_segment_id` and | |
| 227 | -// `pred_common.h:av1_get_spatial_seg_pred` -- note libaom returns the SPATIAL | |
| 228 | -// PREDICTION (not 0) from `read_segment_id` when the block is `skip`, which | |
| 229 | -// is what the oracle every gate here compares against actually does. | |
| 230 | -thread_local! { | |
| 231 | - /// `CurrentSegmentIds`: this frame's own map, `mi_rows * mi_cols` entries | |
| 232 | - /// with stride `mi_cols` (NOT the padded `Neighbours` grid stride). | |
| 233 | - /// `PrevSegmentIds`: the primary reference frame's saved map, empty when | |
| 234 | - /// this frame has no primary reference (spec `load_previous_segment_ids`). | |
| 235 | - /// `(mi_rows, mi_cols)` for both maps above. | |
| 236 | - /// `AboveSegPredContext` (per mi column) / `LeftSegPredContext` (per mi | |
| 237 | - /// row) -- spec 5.11.9's own `seg_id_predicted` neighbour state, which | |
| 238 | - /// libaom keeps on the neighbouring `mbmi->seg_id_predicted` instead. | |
| 239 | - /// The block currently being decoded -- read back by [`block_q_idx`]. | |
| 240 | - /// The tile's own top-left mi position, for `AvailU`/`AvailL`. | |
| 241 | - /// How many real `segment_id` symbols were read, and the set of segment | |
| 242 | - /// ids any block ended up with -- the gate's proof the feature fired. | |
| 243 | - pub(super) static SEG_ID_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 244 | - /// How many `seg_id_predicted` symbols were read (temporal update). | |
| 245 | - pub(super) static SEG_PRED_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 246 | -} | |
| 247 | - | |
| 248 | -/// How many `segment_id` symbols have been read (never reset per frame). | |
| 249 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 250 | -pub(crate) fn segment_id_hits() -> usize { | |
| 251 | - SEG_ID_HITS.with(|c| c.get()) | |
| 252 | -} | |
| 253 | - | |
| 254 | -/// How many `seg_id_predicted` symbols have been read (temporal update). | |
| 255 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 256 | -pub(crate) fn segment_pred_hits() -> usize { | |
| 257 | - SEG_PRED_HITS.with(|c| c.get()) | |
| 258 | -} | |
| 259 | - | |
| 260 | -/// Resets the segmentation hit counters (gate setup). | |
| 261 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 262 | -pub(crate) fn reset_segment_hits() { | |
| 263 | - SEG_ID_HITS.with(|c| c.set(0)); | |
| 264 | - SEG_IDS_SEEN.with(|c| c.set(0)); | |
| 265 | - SEG_PRED_HITS.with(|c| c.set(0)); | |
| 266 | - BLOCK_Q_SPAN.with(|c| c.set((i32::MAX, i32::MIN))); | |
| 267 | -} | |
| 268 | - | |
| 269 | -// How many key-frame luma blocks resolved `smooth_neighbor` (spec | |
| 270 | -// `get_intra_edge_filter_type`) to `true` -- lane-chroma r2's own before/after | |
| 271 | -// counter, proving a stream actually put a directional block next to a | |
| 272 | -// smooth-predicted neighbour rather than every block reading the (previously | |
| 273 | -// hardcoded `false`) edge-filter strength bucket unchanged. | |
| 274 | -thread_local! { | |
| 275 | - pub(super) static SMOOTH_LUMA_HITS: std::cell::Cell<usize> = | |
| 276 | - const { std::cell::Cell::new(0) }; | |
| 277 | -} | |
| 278 | - | |
| 279 | -/// Current value of [`SMOOTH_LUMA_HITS`]. | |
| 280 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 281 | -pub(crate) fn smooth_luma_hits() -> usize { | |
| 282 | - SMOOTH_LUMA_HITS.with(|c| c.get()) | |
| 283 | -} | |
| 284 | - | |
| 285 | -thread_local! { | |
| 286 | - /// lane-band46 r1: how many split-transform units answered their intra | |
| 287 | - /// reach DIFFERENTLY under libaom's per-unit rules ([`Reach::of_tu`], the | |
| 288 | - /// palette2 r12 fix) than the standalone-block lookup this decoder used to | |
| 289 | - /// apply to them (class reach-is-per-transform-unit). Every hit is a | |
| 290 | - /// transform unit whose above-right / below-left reference samples would | |
| 291 | - /// be wrong without that fix. | |
| 292 | - pub(super) static SPLIT_TU_REACH_FIX_HITS: std::cell::Cell<usize> = | |
| 293 | - const { std::cell::Cell::new(0) }; | |
| 294 | -} | |
| 295 | - | |
| 296 | -/// Current value of [`SPLIT_TU_REACH_FIX_HITS`]. | |
| 297 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 298 | -pub(crate) fn split_tu_reach_fix_hits() -> usize { | |
| 299 | - SPLIT_TU_REACH_FIX_HITS.with(|c| c.get()) | |
| 300 | -} | |
| 301 | - | |
| 302 | -// How many `uv_mode` reads resolved to `SMOOTH_PRED..=PAETH_PRED` (9..=12), | |
| 303 | -// across every call on the current thread -- lane-chroma r3's own before/after | |
| 304 | -// counter, proving a stream actually exercised chroma's smooth/paeth | |
| 305 | -// predictor (the previously-refused round-2 gap) rather than every block | |
| 306 | -// landing on DC/CFL/directional. | |
| 307 | -thread_local! { | |
| 308 | - pub(super) static SMOOTH_UV_HITS: std::cell::Cell<usize> = | |
| 309 | - const { std::cell::Cell::new(0) }; | |
| 310 | -} | |
| 311 | - | |
| 312 | -/// Current value of [`SMOOTH_UV_HITS`]. | |
| 313 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 314 | -pub(crate) fn smooth_uv_hits() -> usize { | |
| 315 | - SMOOTH_UV_HITS.with(|c| c.get()) | |
| 316 | -} | |
| 317 | - | |
| 318 | -// How many tiles [`decode_key_frame_tile_with_cdfs`] has actually decoded a | |
| 319 | -// full superblock walk over, across every call on the current thread -- | |
| 320 | -// lane-tiles r2's own gate-blind-to-feature guard: a gate over a | |
| 321 | -// multi-tile stream must prove more than one tile actually fired, not just | |
| 322 | -// that the stream carried tile_info.cols > 1. | |
| 323 | -thread_local! { | |
| 324 | - pub(super) static TILE_HITS: std::cell::Cell<usize> = | |
| 325 | - const { std::cell::Cell::new(0) }; | |
| 326 | -} | |
| 327 | - | |
| 328 | -/// Current value of [`TILE_HITS`]. | |
| 329 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 330 | -pub(crate) fn tile_hits() -> usize { | |
| 331 | - TILE_HITS.with(|c| c.get()) | |
| 332 | -} | |
| 333 | - | |
| 334 | -// How many 4-pixel deblocking edge groups [`edge_params`] has actually | |
| 335 | -// selected for filtering, across every call on the current thread -- the same | |
| 336 | -// before/after counter pattern as [`FILTER_INTRA_HITS`], proving a stream | |
| 337 | -// exercised `apply_deblock` rather than every edge landing on level 0. | |
| 338 | -thread_local! { | |
| 339 | - pub(super) static DEBLOCK_HITS: std::cell::Cell<usize> = | |
| 340 | - const { std::cell::Cell::new(0) }; | |
| 341 | -} | |
| 342 | - | |
| 343 | -/// Current value of [`DEBLOCK_HITS`]. | |
| 344 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 345 | -pub(crate) fn deblock_hits() -> usize { | |
| 346 | - DEBLOCK_HITS.with(|c| c.get()) | |
| 347 | -} | |
| 348 | - | |
| 349 | -// lane-defon r1: how many COMPOUND_REFERENCE blocks read a | |
| 350 | -// `UNIDIR_COMP_REFERENCE` pair (both references on the same temporal side, | |
| 351 | -// spec 5.11.25 `comp_reference_type == 0`) -- the gate's proof that a | |
| 352 | -// stream built with `--enable-onesided-comp=1` really exercised the | |
| 353 | -// `uni_comp_ref` alphabet rather than only bidirectional pairs. | |
| 354 | -thread_local! { | |
| 355 | - pub(super) static UNI_COMP_HITS: std::cell::Cell<usize> = | |
| 356 | - const { std::cell::Cell::new(0) }; | |
| 357 | -} | |
| 358 | - | |
| 359 | -/// Current value of [`UNI_COMP_HITS`]. | |
| 360 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 361 | -pub(crate) fn uni_comp_hits() -> usize { | |
| 362 | - UNI_COMP_HITS.with(|c| c.get()) | |
| 363 | -} | |
| 364 | - | |
| 365 | -// lane-defon r1: how many blocks blended through a `COMPOUND_DIFFWTD` mask | |
| 366 | -// (`mc::diffwtd_mask`) -- the narrower half of `MASKED_COMPOUND_HITS`, the | |
| 367 | -// gate's proof that `--enable-diff-wtd-comp=1` reached the difference-weighted | |
| 368 | -// blend and not only the wedge arm. | |
| 369 | -thread_local! { | |
| 370 | - pub(super) static DIFFWTD_HITS: std::cell::Cell<usize> = | |
| 371 | - const { std::cell::Cell::new(0) }; | |
| 372 | -} | |
| 373 | - | |
| 374 | -/// Current value of [`DIFFWTD_HITS`]. | |
| 375 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 376 | -pub(crate) fn diffwtd_hits() -> usize { | |
| 377 | - DIFFWTD_HITS.with(|c| c.get()) | |
| 378 | -} | |
| 379 | - | |
| 380 | -// lane-mcomp64 r1: how many blocks took the INFERRED `COMPOUND_DIFFWTD` arm -- | |
| 381 | -// a block size where `av1_is_wedge_used` is false (64x64 is the only such size | |
| 382 | -// this decoder's square inter path reaches), so no `compound_type` symbol is | |
| 383 | -// coded at all. Strictly narrower than `DIFFWTD_HITS`, which also counts the | |
| 384 | -// coded-symbol DIFFWTD blocks at 8x8/16x16/32x32. | |
| 385 | -thread_local! { | |
| 386 | - pub(super) static DIFFWTD_INFERRED_HITS: std::cell::Cell<usize> = | |
| 387 | - const { std::cell::Cell::new(0) }; | |
| 388 | -} | |
| 389 | - | |
| 390 | -/// Current value of [`DIFFWTD_INFERRED_HITS`]. | |
| 391 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 392 | -pub(crate) fn diffwtd_inferred_hits() -> usize { | |
| 393 | - DIFFWTD_INFERRED_HITS.with(|c| c.get()) | |
| 394 | -} | |
| 395 | - | |
| 396 | -// lane-defon r1: how many FORWARD KEYFRAMES were decoded -- a KEY frame coded | |
| 397 | -// with `show_frame == 0`, output later by a `show_existing_frame` header | |
| 398 | -// (aomenc `--enable-fwd-kf=1 --fwd-kf-dist=N`). Counted from | |
| 399 | -// `stream::decode_stream`, which is where the frame header is consumed; the | |
| 400 | -// gate's proof that the on-value really reached the bitstream rather than | |
| 401 | -// being dropped by the rate control. | |
| 402 | -thread_local! { | |
| 403 | - pub(super) static FWD_KF_HITS: std::cell::Cell<usize> = | |
| 404 | - const { std::cell::Cell::new(0) }; | |
| 405 | -} | |
| 406 | - | |
| 407 | -/// Current value of [`FWD_KF_HITS`]. | |
| 408 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 409 | -pub(crate) fn fwd_kf_hits() -> usize { | |
| 410 | - FWD_KF_HITS.with(|c| c.get()) | |
| 411 | -} | |
| 412 | - | |
| 413 | -// How many [`read_tx_size`] reads resolved a `tx_depth` strictly less than | |
| 414 | -// the block's own side, across every call on the current thread -- the same | |
| 415 | -// before/after counter pattern as [`FILTER_INTRA_HITS`], proving a stream | |
| 416 | -// actually exercised a *split* transform under `TxMode::Select` rather than | |
| 417 | -// every block coincidentally resolving `depth=0` (indistinguishable from | |
| 418 | -// `TxMode::Largest` pixel-wise). | |
| 419 | -thread_local! { | |
| 420 | - pub(super) static TX_DEPTH_HITS: std::cell::Cell<usize> = | |
| 421 | - const { std::cell::Cell::new(0) }; | |
| 422 | -} | |
| 423 | - | |
| 424 | -// How many plain SQUARE intra blocks (lane-sqchroma r1) resolved a luma | |
| 425 | -// transform smaller than their own side (`tx_depth != 0`) while coding a | |
| 426 | -// chroma prediction other than `DC_PRED` -- the pair the square path's chroma | |
| 427 | -// only exercises with aomenc's tx-size search left ON (its default), which | |
| 428 | -// every older recipe in this file pins off. Counted at the block, so a stream | |
| 429 | -// where RD happened to give every split-transform block a DC chroma mode | |
| 430 | -// reads as zero rather than silently passing for free. | |
| 431 | -thread_local! { | |
| 432 | - pub(super) static SQ_CHROMA_TX_HITS: std::cell::Cell<usize> = | |
| 433 | - const { std::cell::Cell::new(0) }; | |
| 434 | -} | |
| 435 | - | |
| 436 | -/// Current value of [`SQ_CHROMA_TX_HITS`]. | |
| 437 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 438 | -pub(crate) fn sq_chroma_tx_hits() -> usize { | |
| 439 | - SQ_CHROMA_TX_HITS.with(|c| c.get()) | |
| 440 | -} | |
| 441 | - | |
| 442 | -/// Current value of [`TX_DEPTH_HITS`]. | |
| 443 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 444 | -pub(crate) fn tx_depth_hits() -> usize { | |
| 445 | - TX_DEPTH_HITS.with(|c| c.get()) | |
| 446 | -} | |
| 447 | - | |
| 448 | -// lane-txselect: how many `txfm_split` symbols an inter frame's var-tx tree | |
| 449 | -// read, and how many of those actually took the split, on the current thread | |
| 450 | -// -- the same before/after counter pattern as [`TX_DEPTH_HITS`], proving a | |
| 451 | -// stream exercised spec 5.11.17's `read_var_tx_size` rather than every block | |
| 452 | -// coincidentally coding one whole-block transform. | |
| 453 | -thread_local! { | |
| 454 | - pub(super) static TXFM_SPLIT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 455 | - // lane-inter4 r2: rectangular INTER residual coding -- how many rect | |
| 456 | - // strips coded one whole-block rect transform unit, and how many split | |
| 457 | - // their rect max transform into square sub-transforms. | |
| 458 | - pub(super) static RECT_INTER_TU_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 459 | - pub(super) static RECT_INTER_TXSPLIT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 460 | - // lane-r14 r2: luma transform units of an inter strip with a 64-px axis | |
| 461 | - // (64x32/32x64/64x16/16x64), whose coefficients are coded as the | |
| 462 | - // truncated low-32 corner. | |
| 463 | - pub(super) static RECT64_INTER_TU_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 464 | - // lane-rectres r1: whole-block luma transform units of a 32x32-level 1:4 | |
| 465 | - // inter strip, `[32x8, 8x32]`. | |
| 466 | - pub(super) static RECT32X8_INTER_TU_HITS: std::cell::Cell<[usize; 2]> = const { std::cell::Cell::new([0; 2]) }; | |
| 467 | - // lane-r14 r3: rectangular var-tx LEAVES, [32x16, 16x32]. | |
| 468 | - pub(super) static VARTX_RECT_LEAF_HITS: std::cell::Cell<[usize; 2]> = const { std::cell::Cell::new([0; 2]) }; | |
| 469 | - // lane-inter16ab r4: rectangular var-tx leaves with a 4-px axis, [8x4, 4x8] | |
| 470 | - // -- the `sub_tx_size_map[TX_16X4]` split leaves of a 16x16-level 1:4 strip. | |
| 471 | - pub(super) static VARTX_RECT_LEAF4_HITS: std::cell::Cell<[usize; 2]> = const { std::cell::Cell::new([0; 2]) }; | |
| 472 | - // lane-inter4 r3: 16x16-level PARTITION_HORZ / PARTITION_VERT on an inter | |
| 473 | - // frame -- 16x8 and 8x16 inter leaves. | |
| 474 | - pub(super) static INTER_LEAF16_HORZ_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 475 | - pub(super) static INTER_LEAF16_VERT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 476 | - // This frame's own `tx_mode == TxMode::Select` and `reduced_tx_set` bits, | |
| 477 | - // set once per inter tile by [`decode_inter_frame_tile_with_cdfs`] -- | |
| 478 | - // `decode_inter_block` already carries forty parameters and both are | |
| 479 | - // frame-constant. | |
| 480 | - // lane-fiinter r1: this sequence header's own `enable_filter_intra` bit, | |
| 481 | - // frame-constant like the two above and stashed the same way -- an intra | |
| 482 | - // block inside an inter frame reads `use_filter_intra` under it. | |
| 483 | -} | |
| 484 | - | |
| 485 | -/// Current value of [`TXFM_SPLIT_HITS`]. | |
| 486 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 487 | -pub(crate) fn txfm_split_hits() -> usize { | |
| 488 | - TXFM_SPLIT_HITS.with(|c| c.get()) | |
| 489 | -} | |
| 490 | - | |
| 491 | -/// Current value of [`INTER_LEAF16_HORZ_HITS`] (lane-inter4 r3). | |
| 492 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 493 | -pub(crate) fn inter_leaf16_horz_hits() -> usize { | |
| 494 | - INTER_LEAF16_HORZ_HITS.with(|c| c.get()) | |
| 495 | -} | |
| 496 | - | |
| 497 | -/// Current value of [`INTER_LEAF16_VERT_HITS`] (lane-inter4 r3). | |
| 498 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 499 | -pub(crate) fn inter_leaf16_vert_hits() -> usize { | |
| 500 | - INTER_LEAF16_VERT_HITS.with(|c| c.get()) | |
| 501 | -} | |
| 502 | - | |
| 503 | -/// Current value of [`RECT_INTER_TU_HITS`] (lane-inter4 r2). | |
| 504 | -pub(crate) fn rect_inter_tu_hits() -> usize { | |
| 505 | - RECT_INTER_TU_HITS.with(|c| c.get()) | |
| 506 | -} | |
| 507 | - | |
| 508 | -/// Current value of [`RECT_INTER_TXSPLIT_HITS`] (lane-inter4 r2). | |
| 509 | -pub(crate) fn rect_inter_txsplit_hits() -> usize { | |
| 510 | - RECT_INTER_TXSPLIT_HITS.with(|c| c.get()) | |
| 511 | -} | |
| 512 | - | |
| 513 | -/// Current value of [`RECT64_INTER_TU_HITS`] (lane-r14 r2). | |
| 514 | -pub(crate) fn rect64_inter_tu_hits() -> usize { | |
| 515 | - RECT64_INTER_TU_HITS.with(|c| c.get()) | |
| 516 | -} | |
| 517 | - | |
| 518 | -/// Current value of [`RECT32X8_INTER_TU_HITS`] (lane-rectres r1): `[32x8, 8x32]` | |
| 519 | -/// whole-block luma units of a 32x32-level 1:4 inter strip. | |
| 520 | -pub(crate) fn rect32x8_inter_tu_hits() -> [usize; 2] { | |
| 521 | - RECT32X8_INTER_TU_HITS.with(|c| c.get()) | |
| 522 | -} | |
| 523 | - | |
| 524 | -/// Current value of [`VARTX_RECT_LEAF_HITS`] (lane-r14 r3): how many | |
| 525 | -/// rectangular var-tx leaf transform units were coded, `[32x16, 16x32]`. | |
| 526 | -pub(crate) fn vartx_rect_leaf_hits() -> [usize; 2] { | |
| 527 | - VARTX_RECT_LEAF_HITS.with(|c| c.get()) | |
| 528 | -} | |
| 529 | - | |
| 530 | -/// Current value of [`VARTX_RECT_LEAF4_HITS`] (lane-inter16ab r4): 8x4/4x8 | |
| 531 | -/// split leaves of a 16x4/4x16 strip, `[8x4, 4x8]`. | |
| 532 | -pub(crate) fn vartx_rect_leaf4_hits() -> [usize; 2] { | |
| 533 | - VARTX_RECT_LEAF4_HITS.with(|c| c.get()) | |
| 534 | -} | |
| 535 | - | |
| 536 | -/// Records one rectangular var-tx leaf. | |
| 537 | -pub(super) fn vartx_rect_leaf_hit(tw: usize, th: usize) { | |
| 538 | - if crate::envflags::env_flag!("EC_VARTXLEAF") { | |
| 539 | - eprintln!("EC_VARTXLEAF tw={tw} th={th}"); | |
| 540 | - } | |
| 541 | - let cell = if tw.min(th) == 4 { | |
| 542 | - &VARTX_RECT_LEAF4_HITS | |
| 543 | - } else { | |
| 544 | - &VARTX_RECT_LEAF_HITS | |
| 545 | - }; | |
| 546 | - cell.with(|c| { | |
| 547 | - let mut h = c.get(); | |
| 548 | - h[usize::from(th > tw)] += 1; | |
| 549 | - c.set(h); | |
| 550 | - }); | |
| 551 | -} | |
| 552 | - | |
| 553 | -// How many `partition_w16` reads (a 16x16 block's own partition symbol, key | |
| 554 | -// intra-frame path) resolved to `PARTITION_VERT_B` -- lane-rect16 r1: a | |
| 555 | -// plain default-settings aomenc run over lavfi mandelbrot hits this arm on | |
| 556 | -// frame 0's very first non-NONE/SPLIT `partition_w16` symbol (mi=(3,2)), not | |
| 557 | -// the plain HORZ/VERT this lane's charter assumed. Left rect (8x16, real | |
| 558 | -// `decode_block_rect`) + two 8x8 leaves stacked on the right (`decode_leaf8`, | |
| 559 | -// chained via `prev_leaf` exactly like the existing 16x16-SPLIT-into-4x8x8 | |
| 560 | -// path above). | |
| 561 | -thread_local! { | |
| 562 | - pub(super) static VERT_B_INTRA_HITS: std::cell::Cell<usize> = | |
| 563 | - const { std::cell::Cell::new(0) }; | |
| 564 | -} | |
| 565 | - | |
| 566 | -/// Current value of [`VERT_B_INTRA_HITS`]. | |
| 567 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 568 | -pub(crate) fn vert_b_intra_hits() -> usize { | |
| 569 | - VERT_B_INTRA_HITS.with(|c| c.get()) | |
| 570 | -} | |
| 571 | - | |
| 572 | -// lane-ab16 r1: how many 16x16-level AB partitions fired, per arm, in | |
| 573 | -// `PARTITION_HORZ_A`, `_HORZ_B`, `_VERT_A`, `_VERT_B` order. Each arm is two | |
| 574 | -// 8x8 squares (`decode_leaf8`) plus one 16x8/8x16 strip (`decode_leaf_rect`, | |
| 575 | -// the non-skip coefficient path lane-rectx proved); the gate hard-asserts | |
| 576 | -// every arm separately so a run where aomenc's RD only picked one cannot | |
| 577 | -// pass as proof of four. | |
| 578 | -thread_local! { | |
| 579 | - pub(super) static AB16_HITS: std::cell::Cell<[usize; 4]> = const { std::cell::Cell::new([0; 4]) }; | |
| 580 | -} | |
| 581 | - | |
| 582 | -// [`AB16_HITS`] per arm (HORZ_A, HORZ_B, VERT_A, VERT_B at 16x16). | |
| 583 | -thread_local! { | |
| 584 | - /// 4x4 transform units decoded inside an 8x8 square of a | |
| 585 | - /// `PARTITION_VERT_A`/`_B` -- the exact call that panicked before | |
| 586 | - /// [`crate::encode::Reach::of_tu`] (lane-ab16 r2), so the gate can prove | |
| 587 | - /// a real `--enable-tx-size-search=1` stream reaches it. | |
| 588 | - pub(super) static VERT_AB_TX4_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 589 | -} | |
| 590 | - | |
| 591 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 592 | -pub(crate) fn vert_ab_tx4_hits() -> usize { | |
| 593 | - VERT_AB_TX4_HITS.with(std::cell::Cell::get) | |
| 594 | -} | |
| 595 | - | |
| 596 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 597 | -pub(crate) fn ab16_hits_by_arm() -> [usize; 4] { | |
| 598 | - AB16_HITS.with(std::cell::Cell::get) | |
| 599 | -} | |
| 600 | - | |
| 601 | -// How many `partition_w16` reads resolved to a plain `PARTITION_HORZ`/ | |
| 602 | -// `PARTITION_VERT` (lane-rect16 r2): re-measuring after the VERT_B fix above | |
| 603 | -// showed mandelbrot's real first-hit blocker is this plain arm at mi=(0,7), | |
| 604 | -// not VERT_B (`refusal-names-a-correlate`; the VERT_B write-up's "frame 0's | |
| 605 | -// very first non-NONE/SPLIT symbol" claim was about decode ORDER within one | |
| 606 | -// superblock's z-order recursion, not raster mi position). | |
| 607 | -thread_local! { | |
| 608 | - pub(super) static HORZ_VERT_INTRA_HITS: std::cell::Cell<usize> = | |
| 609 | - const { std::cell::Cell::new(0) }; | |
| 610 | -} | |
| 611 | - | |
| 612 | -/// Current value of [`HORZ_VERT_INTRA_HITS`]. | |
| 613 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 614 | -pub(crate) fn horz_vert_intra_hits() -> usize { | |
| 615 | - HORZ_VERT_INTRA_HITS.with(|c| c.get()) | |
| 616 | -} | |
| 617 | - | |
| 618 | -// How many blocks were decoded as a frame-edge rect strip -- the single | |
| 619 | -// coded half of a `PARTITION_HORZ`/`PARTITION_VERT` at the true frame edge | |
| 620 | -// (lane-oddh r1), i.e. a block living inside the 8px band of a frame whose | |
| 621 | -// height or width is 8 mod 16 (the user's 3840x1608 film). Intra and inter | |
| 622 | -// paths share the counter. | |
| 623 | -thread_local! { | |
| 624 | - pub(super) static EDGE_RECT_STRIP_HITS: std::cell::Cell<usize> = | |
| 625 | - const { std::cell::Cell::new(0) }; | |
| 626 | -} | |
| 627 | - | |
| 628 | -/// Current value of [`EDGE_RECT_STRIP_HITS`]. | |
| 629 | -#[allow(dead_code)] // gate counter accessor with no reader yet; the counter itself is live | |
| 630 | -pub(crate) fn edge_rect_strip_hits() -> usize { | |
| 631 | - EDGE_RECT_STRIP_HITS.with(|c| c.get()) | |
| 632 | -} | |
| 633 | - | |
| 634 | -// lane-interedge r1: frame-edge half strips on the INTER path, per partition | |
| 635 | -// level (64/32/16) x axis (HORZ at a bottom edge, VERT at a right edge). The | |
| 636 | -// index is `level_idx * 2 + axis` with `level_idx` 0=64, 1=32, 2=16 and | |
| 637 | -// `axis` 0=HORZ (`!has_rows`), 1=VERT (`!has_cols`). Both of the user's films | |
| 638 | -// are height mod 16 == 8, so every inter frame crosses these nodes. | |
| 639 | -thread_local! { | |
| 640 | - pub(super) static INTER_EDGE_STRIP_HITS: std::cell::Cell<[usize; 6]> = | |
| 641 | - const { std::cell::Cell::new([0; 6]) }; | |
| 642 | -} | |
| 643 | - | |
| 644 | -// lane-edgeboth r1: how many partition nodes were coded as the BOTH-AXES-CUT | |
| 645 | -// forced split -- libaom `decode_partition` (decodeframe.c): | |
| 646 | -// `else if (!has_rows && !has_cols) partition = PARTITION_SPLIT;`, the one | |
| 647 | -// straddle case that reads NO symbol at all. Indexed by level: | |
| 648 | -// 0 = 16x16, 1 = 32x32, 2 = 64x64, 3 = 128x128; intra and inter share it. | |
| 649 | -thread_local! { | |
| 650 | - pub(super) static EDGE_BOTH_CUT_HITS: std::cell::Cell<[usize; 4]> = | |
| 651 | - const { std::cell::Cell::new([0; 4]) }; | |
| 652 | -} | |
| 653 | - | |
| 654 | -/// Current value of [`INTER_EDGE_STRIP_HITS`] (`[h64, v64, h32, v32, h16, v16]`). | |
| 655 | -pub fn inter_edge_strip_hits() -> [usize; 6] { | |
| 656 | - INTER_EDGE_STRIP_HITS.with(|c| c.get()) | |
| 657 | -} | |
| 658 | - | |
| 659 | -/// Resets [`INTER_EDGE_STRIP_HITS`] -- a refused attempt must not carry hits | |
| 660 | -/// into the next one (class `counter-from-refused-stream`). | |
| 661 | -pub fn reset_inter_edge_strip_hits() { | |
| 662 | - INTER_EDGE_STRIP_HITS.with(|c| c.set([0; 6])); | |
| 663 | -} | |
| 664 | - | |
| 665 | -/// Current value of [`EDGE_BOTH_CUT_HITS`] (`[16, 32, 64, 128]` levels). | |
| 666 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 667 | -pub(crate) fn edge_both_cut_hits() -> [usize; 4] { | |
| 668 | - EDGE_BOTH_CUT_HITS.with(|c| c.get()) | |
| 669 | -} | |
| 670 | - | |
| 671 | -/// Zeroes [`EDGE_BOTH_CUT_HITS`] so a gate can measure a per-attempt delta. | |
| 672 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 673 | -pub(crate) fn reset_edge_both_cut_hits() { | |
| 674 | - EDGE_BOTH_CUT_HITS.with(|c| c.set([0; 4])); | |
| 675 | -} | |
| 676 | - | |
| 677 | -// How many HORZ/VERT intra strips resolved a SPLIT luma transform | |
| 678 | -// (`tx_depth != 0`) and decoded it per transform unit (lane-rectsplit r1) -- | |
| 679 | -// the case every rect path here refused by name before, and the first | |
| 680 | -// refusal the user's ReelB extract (600s in) stops at. | |
| 681 | -thread_local! { | |
| 682 | - pub(super) static RECT_SPLIT_TX_HITS: std::cell::Cell<usize> = | |
| 683 | - const { std::cell::Cell::new(0) }; | |
| 684 | -} | |
| 685 | - | |
| 686 | -/// Current value of [`RECT_SPLIT_TX_HITS`]. | |
| 687 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 688 | -pub(crate) fn rect_split_tx_hits() -> usize { | |
| 689 | - RECT_SPLIT_TX_HITS.with(|c| c.get()) | |
| 690 | -} | |
| 691 | - | |
| 692 | -// The subset of [`RECT_SPLIT_TX_HITS`] that is BOTH superblock-level (one | |
| 693 | -// side 64) AND split past the first depth, i.e. tiled more than one unit in | |
| 694 | -// each axis -- the only shape with a transform unit that has neighbours on | |
| 695 | -// two sides inside its own strip (`row_off > 0 && col_off > 0`), and the one | |
| 696 | -// no gate fired before lane-rectsplit r2 (the shared counter above also | |
| 697 | -// counts 32x32-level and depth-1 strips, so it cannot prove this case). | |
| 698 | -thread_local! { | |
| 699 | - pub(super) static RECT_SPLIT_SB_INTERIOR_TU_HITS: std::cell::Cell<usize> = | |
| 700 | - const { std::cell::Cell::new(0) }; | |
| 701 | -} | |
| 702 | - | |
| 703 | -/// Current value of [`RECT_SPLIT_SB_INTERIOR_TU_HITS`]. | |
| 704 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 705 | -pub(crate) fn rect_split_sb_interior_tu_hits() -> usize { | |
| 706 | - RECT_SPLIT_SB_INTERIOR_TU_HITS.with(|c| c.get()) | |
| 707 | -} | |
| 708 | - | |
| 709 | -// Per-shape hit counts for the rect chroma transforms lane-rectchroma r1 | |
| 710 | -// wired into [`decode_rect_split`] -- the shapes a split-transform strip's | |
| 711 | -// chroma half takes that had no coefficient tables before (index order: | |
| 712 | -// 32x8, 8x32, 8x4, 4x8). One counter per shape because a gate that only | |
| 713 | -// proves the pair it happens to hit cannot catch a transposed scan/context | |
| 714 | -// table (class scan-weights-cross-axis). | |
| 715 | -thread_local! { | |
| 716 | - pub(super) static RECT_SPLIT_CHROMA_SHAPE_HITS: std::cell::Cell<[usize; 4]> = | |
| 717 | - const { std::cell::Cell::new([0; 4]) }; | |
| 718 | -} | |
| 719 | - | |
| 720 | -/// Current value of [`RECT_SPLIT_CHROMA_SHAPE_HITS`] (32x8, 8x32, 8x4, 4x8). | |
| 721 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 722 | -pub(crate) fn rect_split_chroma_shape_hits() -> [usize; 4] { | |
| 723 | - RECT_SPLIT_CHROMA_SHAPE_HITS.with(|c| c.get()) | |
| 724 | -} | |
| 725 | - | |
| 726 | -// lane-av1-422: how many SQUARE chroma coefficient units the strip path read | |
| 727 | -// on a 4:2:2 frame (ss 1,0) -- the half-width, unhalved-height shape whose | |
| 728 | -// tables only exist because of the square rows in the chroma_tiled arm. A | |
| 729 | -// 4:2:0 or 4:4:4 frame can never increment it (their rect strips' chroma is | |
| 730 | -// itself rect), and a restored `/2 chroma height` diverts 4:2:2 squares onto | |
| 731 | -// the rect rows, so the witness gate reads 0 there and fails. | |
| 732 | -thread_local! { | |
| 733 | - pub(super) static CHROMA422_SQUARE_HITS: std::cell::Cell<usize> = | |
| 734 | - const { std::cell::Cell::new(0) }; | |
| 735 | -} | |
| 736 | - | |
| 737 | -/// Current value of [`CHROMA422_SQUARE_HITS`]. | |
| 738 | -// lane-av1-422b: `pub` so `examples/decode_probe.rs` can census it the way | |
| 739 | -// it does every other capability counter. | |
| 740 | -pub fn chroma422_square_hits() -> usize { | |
| 741 | - CHROMA422_SQUARE_HITS.with(|c| c.get()) | |
| 742 | -} | |
| 743 | - | |
| 744 | -// lane-av1422tailskip: how many 4:2:2 (ss 1,0) intra-in-inter chroma TRANSFORM | |
| 745 | -// UNITS took their own window on the block-sized chroma palette prediction -- | |
| 746 | -// `decode_inter_block`'s `side == 64` TX_32X32 walk, where the plane block is | |
| 747 | -// 32x64 but codes two stacked square units per plane. Zero on a 4:2:0 or 4:4:4 | |
| 748 | -// frame (their chroma unit is the whole plane block, one window), and zero on | |
| 749 | -// a 4:2:2 block with no palette, so a witness gate reading 0 proves the arm | |
| 750 | -// never ran. | |
| 751 | -thread_local! { | |
| 752 | - pub(super) static PALETTE_422_UNIT_WINDOW_HITS: std::cell::Cell<usize> = | |
| 753 | - const { std::cell::Cell::new(0) }; | |
| 754 | -} | |
| 755 | - | |
| 756 | -/// Current value of [`PALETTE_422_UNIT_WINDOW_HITS`]. | |
| 757 | -// lane-av1422tailskip: `pub` so `examples/decode_probe.rs` can census it the | |
| 758 | -// way it does every other capability counter. | |
| 759 | -pub fn palette_422_unit_window_hits() -> usize { | |
| 760 | - PALETTE_422_UNIT_WINDOW_HITS.with(|c| c.get()) | |
| 761 | -} | |
| 762 | - | |
| 763 | -// lane-av1-422f: how many RECT chroma coefficient units the square-block | |
| 764 | -// path read on a 4:2:2 frame (ss 1,0) -- TX_4X8 / TX_8X16 / TX_16X32, the | |
| 765 | -// plane block's own half-width, unhalved-height shape. A 4:2:0 or 4:4:4 | |
| 766 | -// frame never takes the rect branch (their units are square | |
| 767 | -// `chroma_tx == chroma_tx_h`), so a witness gate reading 0 here proves the | |
| 768 | -// model reverted to squares. | |
| 769 | -thread_local! { | |
| 770 | - pub(super) static CHROMA422_RECT_HITS: std::cell::Cell<usize> = | |
| 771 | - const { std::cell::Cell::new(0) }; | |
| 772 | -} | |
| 773 | - | |
| 774 | -/// Current value of [`CHROMA422_RECT_HITS`]. | |
| 775 | -pub fn chroma422_rect_hits() -> usize { | |
| 776 | - CHROMA422_RECT_HITS.with(|c| c.get()) | |
| 777 | -} | |
| 778 | - | |
| 779 | -// lane-av1-422g: how many PER-LEAF TX_4X4 chroma coefficient units the | |
| 780 | -// sub-8x8 split4 path read on a 4:2:2 frame (ss 1,0) -- one per even-column | |
| 781 | -// leaf per plane (`is_chroma_reference`'s `!(mi_col & ss_x)`). A 4:2:0 frame | |
| 782 | -// codes no sub-8 chroma at all and 4:4:4 goes through `sub8_leaf_chroma444`, | |
| 783 | -// so a witness gate reading 0 here proves the per-leaf 4:2:2 arm never ran. | |
| 784 | -thread_local! { | |
| 785 | - pub(super) static CHROMA422_SUB8_HITS: std::cell::Cell<usize> = | |
| 786 | - const { std::cell::Cell::new(0) }; | |
| 787 | -} | |
| 788 | - | |
| 789 | -/// Current value of [`CHROMA422_SUB8_HITS`]. | |
| 790 | -pub fn chroma422_sub8_hits() -> usize { | |
| 791 | - CHROMA422_SUB8_HITS.with(|c| c.get()) | |
| 792 | -} | |
| 793 | - | |
| 794 | -// lane-av1422llintra: how many 4:2:2 LOSSLESS chroma plane blocks | |
| 795 | -// (`decode_leaf8`) were walked as 4x4 units rather than as the one | |
| 796 | -// `av1_get_max_uv_txsize` rect that rule only reaches OUTSIDE a lossless | |
| 797 | -// frame. A 4:2:0 or 4:4:4 frame never takes the arm (its own lossless walk | |
| 798 | -// was already there), so a witness gate reading 0 here proves the model | |
| 799 | -// reverted to the rect unit. | |
| 800 | -thread_local! { | |
| 801 | - pub(super) static CHROMA422_LOSSLESS_4X4_HITS: std::cell::Cell<usize> = | |
| 802 | - const { std::cell::Cell::new(0) }; | |
| 803 | -} | |
| 804 | - | |
| 805 | -/// Current value of [`CHROMA422_LOSSLESS_4X4_HITS`]. | |
| 806 | -pub fn chroma422_lossless_4x4_hits() -> usize { | |
| 807 | - CHROMA422_LOSSLESS_4X4_HITS.with(|c| c.get()) | |
| 808 | -} | |
| 809 | - | |
| 810 | -// lane-av1-422sub8rect: how many PER-PIECE TX_4X4 chroma coefficient units | |
| 811 | -// the INTER sub-8x8 split4 path read on a 4:2:2 frame (ss 1,0) -- one per | |
| 812 | -// non-skipped odd-column piece per plane (`is_chroma_reference`'s | |
| 813 | -// `mi_col & 0x01` at ss_x 1). 4:2:0 goes through the shared group unit and | |
| 814 | -// 4:4:4 through [`sub8_leaf_chroma444`]'s own per-piece twin, so a witness | |
| 815 | -// gate reading 0 here proves the inter 4:2:2 per-piece arm never ran. | |
| 816 | -thread_local! { | |
| 817 | - pub(super) static CHROMA422_INTER_SUB8_HITS: std::cell::Cell<usize> = | |
| 818 | - const { std::cell::Cell::new(0) }; | |
| 819 | -} | |
| 820 | - | |
| 821 | -/// Current value of [`CHROMA422_INTER_SUB8_HITS`]. | |
| 822 | -pub fn chroma422_inter_sub8_hits() -> usize { | |
| 823 | - CHROMA422_INTER_SUB8_HITS.with(|c| c.get()) | |
| 824 | -} | |
| 825 | - | |
| 826 | -// lane-av1-422m: how many TX_4X4 chunk units the invalid-ss-size chroma arm | |
| 827 | -// read (the 8x32 luma block whose 4:2:2 plane has no `ss_size_lookup` block). | |
| 828 | -// A 4:2:0 or 4:4:4 frame cannot increment it, so a non-zero read proves the | |
| 829 | -// chunked 4:2:2 chroma really decoded. | |
| 830 | -thread_local! { | |
| 831 | - pub(super) static CHROMA422_CHUNK_HITS: std::cell::Cell<usize> = | |
| 832 | - const { std::cell::Cell::new(0) }; | |
| 833 | -} | |
| 834 | - | |
| 835 | -/// Current value of [`CHROMA422_CHUNK_HITS`]. | |
| 836 | -pub fn chroma422_chunk_hits() -> usize { | |
| 837 | - CHROMA422_CHUNK_HITS.with(|c| c.get()) | |
| 838 | -} | |
| 839 | - | |
| 840 | -// lane-av1-422stripanchor: how many 4-wide-strip PAIR chroma units | |
| 841 | -// ([`decode_rect_split`]'s ported floored-pair anchor) decoded. A 4:2:0 or | |
| 842 | -// 4:4:4 frame cannot increment it (the arm is keyed to a 2-px-wide chroma | |
| 843 | -// block, which only a 1-mi-wide strip at ss (1, 0) produces), so a non-zero | |
| 844 | -// read proves a stream routed a 4-wide strip through the split path. | |
| 845 | -thread_local! { | |
| 846 | - pub(super) static CHROMA422_PAIR_WIDE_HITS: std::cell::Cell<usize> = | |
| 847 | - const { std::cell::Cell::new(0) }; | |
| 848 | -} | |
| 849 | - | |
| 850 | -/// Current value of [`CHROMA422_PAIR_WIDE_HITS`]. | |
| 851 | -pub fn chroma422_pair_wide_hits() -> usize { | |
| 852 | - CHROMA422_PAIR_WIDE_HITS.with(|c| c.get()) | |
| 853 | -} | |
| 854 | - | |
| 855 | -// How many HORZ/VERT intra strips actually predicted with filter intra | |
| 856 | -// (lane-rectsplit r1) -- the case `decode_block_rect` refused by name | |
| 857 | -// ("this decoder predicts square-only") until `predict_filter_intra` took | |
| 858 | -// `bw`x`bh`. | |
| 859 | -thread_local! { | |
| 860 | - pub(super) static FILTER_INTRA_RECT_HITS: std::cell::Cell<usize> = | |
| 861 | - const { std::cell::Cell::new(0) }; | |
| 862 | -} | |
| 863 | - | |
| 864 | -/// Current value of [`FILTER_INTRA_RECT_HITS`]. | |
| 865 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 866 | -pub(crate) fn filter_intra_rect_hits() -> usize { | |
| 867 | - FILTER_INTRA_RECT_HITS.with(|c| c.get()) | |
| 868 | -} | |
| 869 | - | |
| 870 | -// As [`FILTER_INTRA_RECT_HITS`], counting only the 32x32-level 1:4 strips | |
| 871 | -// (32x8/8x32, lane-fi32x8 r1) -- the shapes whose `use_filter_intra` symbol | |
| 872 | -// was never read at all before that round, so a gate needs to prove the flag | |
| 873 | -// fired at THAT shape and not at a 16x8 one somewhere else in the frame. | |
| 874 | -// Split by ORIENTATION: rows 8 (32x8) and 9 (8x32) of `cdf::FILTER_INTRA` | |
| 875 | -// carry different probabilities (18101 vs 20229), so a transposed pair is | |
| 876 | -// only caught by a gate that sees the flag fire on BOTH shapes (class | |
| 877 | -// scan-weights-cross-axis). | |
| 878 | -thread_local! { | |
| 879 | - pub(super) static FILTER_INTRA_RECT4_HORZ_HITS: std::cell::Cell<usize> = | |
| 880 | - const { std::cell::Cell::new(0) }; | |
| 881 | - pub(super) static FILTER_INTRA_RECT4_VERT_HITS: std::cell::Cell<usize> = | |
| 882 | - const { std::cell::Cell::new(0) }; | |
| 883 | -} | |
| 884 | - | |
| 885 | -/// Current value of [`FILTER_INTRA_RECT4_HORZ_HITS`] (32x8 strips). | |
| 886 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 887 | -pub(crate) fn filter_intra_rect4_horz_hits() -> usize { | |
| 888 | - FILTER_INTRA_RECT4_HORZ_HITS.with(|c| c.get()) | |
| 889 | -} | |
| 890 | - | |
| 891 | -/// Current value of [`FILTER_INTRA_RECT4_VERT_HITS`] (8x32 strips). | |
| 892 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 893 | -pub(crate) fn filter_intra_rect4_vert_hits() -> usize { | |
| 894 | - FILTER_INTRA_RECT4_VERT_HITS.with(|c| c.get()) | |
| 895 | -} | |
| 896 | - | |
| 897 | -// How many rectangular transform units actually coded coefficients through | |
| 898 | -// [`read_coeffs_rect`] (`all_zero == 0`) -- lane-rect1d's measure that a gate | |
| 899 | -// exercised the rect coefficient reader at all rather than passing on | |
| 900 | -// all-skip blocks. | |
| 901 | -thread_local! { | |
| 902 | - pub(super) static RECT_COEFF_TU_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 903 | - pub(super) static RECT_CLASS1_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 904 | -} | |
| 905 | - | |
| 906 | -/// Current value of [`RECT_COEFF_TU_HITS`]. | |
| 907 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 908 | -pub(crate) fn rect_coeff_tu_hits() -> usize { | |
| 909 | - RECT_COEFF_TU_HITS.with(|c| c.get()) | |
| 910 | -} | |
| 911 | - | |
| 912 | -/// Rectangular transform units whose resolved `tx_type` is a 1D class | |
| 913 | -/// (`V_DCT`/`H_DCT`) -- [`TX_CLASS1_HITS`]'s rect-only half, so a gate can | |
| 914 | -/// pin that the 1D-class-on-a-RECT-transform path fired rather than settling | |
| 915 | -/// for the square reader's own 1D types. | |
| 916 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 917 | -pub(crate) fn rect_class1_hits() -> usize { | |
| 918 | - RECT_CLASS1_HITS.with(|c| c.get()) | |
| 919 | -} | |
| 920 | - | |
| 921 | -// lane-av1readcensus: the PER-UNIT coefficient census -- one unit counted | |
| 922 | -// per `read_coeffs`/`read_coeffs_rect` call, i.e. per object this decoder | |
| 923 | -// actually walks, which is the unit the round-4 `av1444rect` count measured | |
| 924 | -// (636 square chroma reads against the oracle's 1086). | |
| 925 | -// | |
| 926 | -// lane-av1422census422 widened the arming. The counters used to be | |
| 927 | -// 4:4:4-ONLY (`CENSUS_444`), so at 4:2:2 -- a chroma format an AV1 | |
| 928 | -// `color_config` can carry and libaom's writer emits -- every | |
| 929 | -// `census_444_units()` / `census_444_coded()` read zero BY CONSTRUCTION: a | |
| 930 | -// byte-exact 4:2:2 gate asserting those counters would be asserting a | |
| 931 | -// literal, and would be green while proving nothing about that stream. The | |
| 932 | -// census is now armed for every chroma format that leaves at least one luma | |
| 933 | -// axis unsubsampled -- (0,0) 4:4:4 and (1,0) 4:2:2 -- and 4:2:0 (1,1) stays | |
| 934 | -// off, so the existing 4:4:4 exact counts and the 4:2:0 zero control are | |
| 935 | -// unmoved by the widening. The counters are per-PLANE, not per-format, so a | |
| 936 | -// 4:2:2 cell's `[luma, u, v]` split is directly comparable with a 4:4:4 | |
| 937 | -// cell's on the same walk shape. | |
| 938 | -thread_local! { | |
| 939 | - /// Per-plane unit counts, `[luma, u, v]`, at 4:4:4 and 4:2:2. | |
| 940 | - pub(super) static CENSUS_NONSUB_UNITS: std::cell::Cell<[usize; 3]> = const { std::cell::Cell::new([0; 3]) }; | |
| 941 | - /// Of [`CENSUS_NONSUB_UNITS`], the units that coded at least one | |
| 942 | - /// coefficient (`txb_skip == 0`) -- the per-plane split is only | |
| 943 | - /// comparable against the oracle's when both sides count all-zero units | |
| 944 | - /// the same way. | |
| 945 | - pub(super) static CENSUS_NONSUB_CODED: std::cell::Cell<[usize; 3]> = const { std::cell::Cell::new([0; 3]) }; | |
| 946 | - /// Sequential unit index, so a trace line names its own position in the | |
| 947 | - /// frame's walk rather than relying on line order alone. | |
| 948 | - pub(super) static CENSUS_UNIT_N: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 949 | - /// The plane the units read from here on belong to. A thread-local rather | |
| 950 | - /// than a `read_coeffs` parameter because the three luma call sites | |
| 951 | - /// (`decode_rect_split`, `decode_block_rect64`, `read_inter_plane_rect`) | |
| 952 | - /// are not this lane's to edit and would each grow an argument; the | |
| 953 | - /// plane-owning readers stamp it once on entry instead. | |
| 954 | - pub(super) static CENSUS_PLANE: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 955 | - /// At least one luma axis unsubsampled -- (0,0) 4:4:4 or (1,0) 4:2:2 -- | |
| 956 | - /// for the frame being decoded, set per frame from [`crate::stream`]. | |
| 957 | - /// 4:2:0 (1,1) arms nothing. | |
| 958 | - pub(super) static CENSUS_NONSUB: std::cell::Cell<bool> = const { std::cell::Cell::new(false) }; | |
| 959 | -} | |
| 960 | - | |
| 961 | -/// Current `[luma, u, v]` coefficient-unit counts, per plane. Zero at 4:2:0 | |
| 962 | -/// by design ([`set_census_nonsub`] arms nothing there). | |
| 963 | -pub fn census_nonsub_units() -> [usize; 3] { | |
| 964 | - CENSUS_NONSUB_UNITS.with(|c| c.get()) | |
| 965 | -} | |
| 966 | - | |
| 967 | -/// Current `[luma, u, v]` counts of units that coded coefficients. | |
| 968 | -pub fn census_nonsub_coded() -> [usize; 3] { | |
| 969 | - CENSUS_NONSUB_CODED.with(|c| c.get()) | |
| 970 | -} | |
| 971 | - | |
| 972 | -/// lane-av1readcensus: arms the coefficient-unit census for the frame about | |
| 973 | -/// to decode, called once per frame from [`crate::stream`]'s decode loop | |
| 974 | -/// beside [`set_subsampling`]. Armed for every chroma format with an | |
| 975 | -/// unsubsampled luma axis -- 4:4:4 (0,0) and 4:2:2 (1,0) -- and NOT for | |
| 976 | -/// 4:2:0 (1,1), where the walk-shape question this census answers does not | |
| 977 | -/// arise, so a 4:2:0 control can still assert exactly zero. | |
| 978 | -/// | |
| 979 | -/// lane-av1422census422 widened this from `(ss_x == 0 && ss_y == 0)`. The | |
| 980 | -/// old condition made 4:2:2 silently UNCUNTABLE rather than uncounted. The | |
| 981 | -/// two format pairs keep disjoint conditions, so neither the 4:4:4 exact | |
| 982 | -/// counts nor the 4:2:0 zero control can move because of this. | |
| 983 | -pub(crate) fn set_census_nonsub(ss_x: u8, ss_y: u8) { | |
| 984 | - CENSUS_NONSUB.with(|c| c.set(ss_x == 0 || ss_y == 0)); | |
| 985 | -} | |
| 986 | - | |
| 987 | -/// lane-av1readcensus: the plane the units read from here on belong to, | |
| 988 | -/// stamped by the plane-owning readers ([`read_plane`], [`read_inter_plane`], | |
| 989 | -/// [`read_inter_plane_rect`]) on entry. | |
| 990 | -pub(crate) fn set_census_plane(plane: usize) { | |
| 991 | - CENSUS_PLANE.with(|c| c.set(plane)); | |
| 992 | -} | |
| 993 | - | |
| 994 | -/// lane-av1readcensus: is the per-unit census trace on? Shares | |
| 995 | -/// [`coeff_trace_on`]'s per-frame narrowing so one frame's walk can be | |
| 996 | -/// dumped without the rest of the stream. | |
| 997 | -fn census_trace_on() -> bool { | |
| 998 | - if !crate::envflags::env_flag!("EC_CENSUS_UNIT") { | |
| 999 | - return false; | |
| 1000 | - } | |
| 1001 | - match COEFF_TRACE_FRAME.with(|c| c.get()) { | |
| 1002 | - None => true, | |
| 1003 | - Some(w) if w >= usize::MAX - 1 => true, | |
| 1004 | - Some(w) => COEFF_TRACE_CUR.with(|c| c.get()) == w, | |
| 1005 | - } | |
| 1006 | -} | |
| 1007 | - | |
| 1008 | -/// lane-av1readcensus: one line per coefficient unit this decoder walks, the | |
| 1009 | -/// twin of the oracle's `EC_COEFF` / `EC_COEFF_VAL` bracket around each | |
| 1010 | -/// `av1_read_coeffs_txb` call. Pair the two sides by `post_rng` (or by `n`), | |
| 1011 | -/// never by plane label or by walk position -- the walk order is exactly what | |
| 1012 | -/// the census is measuring. | |
| 1013 | -pub(super) fn census_unit( | |
| 1014 | - w: usize, | |
| 1015 | - h: usize, | |
| 1016 | - tx_type: TxType, | |
| 1017 | - eob: usize, | |
| 1018 | - all_zero: bool, | |
| 1019 | - entry_rng: u32, | |
| 1020 | - dec: &SymbolDecoder, | |
| 1021 | -) { | |
| 1022 | - let plane = CENSUS_PLANE.with(|c| c.get()).min(2); | |
| 1023 | - let coded = usize::from(!all_zero); | |
| 1024 | - CENSUS_UNIT_N.with(|c| c.set(c.get() + 1)); | |
| 1025 | - hit_do! { | |
| 1026 | - CENSUS_NONSUB_UNITS.with(|c| { | |
| 1027 | - if CENSUS_NONSUB.with(|on| on.get()) { | |
| 1028 | - let mut v = c.get(); | |
| 1029 | - v[plane] += 1; | |
| 1030 | - c.set(v); | |
| 1031 | - } | |
| 1032 | - }); | |
| 1033 | - CENSUS_NONSUB_CODED.with(|c| { | |
| 1034 | - if CENSUS_NONSUB.with(|on| on.get()) { | |
| 1035 | - let mut v = c.get(); | |
| 1036 | - v[plane] += coded; | |
| 1037 | - c.set(v); | |
| 1038 | - } | |
| 1039 | - }); | |
| 1040 | - } | |
| 1041 | - if !census_trace_on() { | |
| 1042 | - return; | |
| 1043 | - } | |
| 1044 | - let n = CENSUS_UNIT_N.with(|c| c.get()) - 1; | |
| 1045 | - let post_rng = dec.debug_state().0; | |
| 1046 | - eprintln!( | |
| 1047 | - "EC_CENSUS_UNIT side=ours n={n} plane={plane} w={w} h={h} tx={tx_type:?} eob={eob} \ | |
| 1048 | - all_zero={all_zero} entry_rng={entry_rng} post_rng={post_rng}" | |
| 1049 | - ); | |
| 1050 | -} | |
| 1051 | - | |
| 1052 | -/// How many transform units this thread has read since the last | |
| 1053 | -/// [`reset_census_unit_n`] (lane-av1offtile). The per-unit oracle twin is | |
| 1054 | -/// `EC_ECDUMP_IN`, one line per `read_coeffs_txb` call, so this count IS | |
| 1055 | -/// directly comparable with an oracle `EC_ECDUMP_IN` census -- which is what | |
| 1056 | -/// makes "we walk N units where libaom walks M" a gated claim rather than an | |
| 1057 | -/// inference from the desync's position. | |
| 1058 | -pub fn census_unit_n() -> usize { | |
| 1059 | - CENSUS_UNIT_N.with(|c| c.get()) | |
| 1060 | -} | |
| 1061 | - | |
| 1062 | -/// Reset [`census_unit_n`] to zero (lane-av1offtile). | |
| 1063 | -pub fn reset_census_unit_n() { | |
| 1064 | - CENSUS_UNIT_N.with(|c| c.set(0)); | |
| 1065 | -} | |
| 1066 | - | |
| 1067 | -// As [`FILTER_INTRA_RECT_HITS`], counting only the strips BELOW 16x16 | |
| 1068 | -// (8x16/16x8 leaves of a 16x16 HORZ/VERT partition, lane-fistrip r1) -- the | |
| 1069 | -// shapes whose `use_filter_intra` symbol had no CDF class before this round. | |
| 1070 | -// A gate asserting the wider counter would be satisfied by a 32x16 strip and | |
| 1071 | -// prove nothing about the new shapes. | |
| 1072 | -thread_local! { | |
| 1073 | - pub(super) static FILTER_INTRA_RECT_SUB16_HITS: std::cell::Cell<usize> = | |
| 1074 | - const { std::cell::Cell::new(0) }; | |
| 1075 | -} | |
| 1076 | - | |
| 1077 | -/// Current value of [`FILTER_INTRA_RECT_SUB16_HITS`]. | |
| 1078 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1079 | -pub(crate) fn filter_intra_rect_sub16_hits() -> usize { | |
| 1080 | - FILTER_INTRA_RECT_SUB16_HITS.with(|c| c.get()) | |
| 1081 | -} | |
| 1082 | - | |
| 1083 | -// As [`FILTER_INTRA_RECT_SUB16_HITS`], one partition level further down: | |
| 1084 | -// 4x8/8x4 leaves of an 8x8 HORZ/VERT (lane-fi8 r1). A gate on the sub16 | |
| 1085 | -// counter would be satisfied by a 16x8 strip and prove nothing here. | |
| 1086 | -thread_local! { | |
| 1087 | - pub(super) static FILTER_INTRA_RECT_SUB8_HITS: std::cell::Cell<usize> = | |
| 1088 | - const { std::cell::Cell::new(0) }; | |
| 1089 | -} | |
| 1090 | - | |
| 1091 | -/// Current value of [`FILTER_INTRA_RECT_SUB8_HITS`]. | |
| 1092 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1093 | -pub(crate) fn filter_intra_rect_sub8_hits() -> usize { | |
| 1094 | - FILTER_INTRA_RECT_SUB8_HITS.with(|c| c.get()) | |
| 1095 | -} | |
| 1096 | - | |
| 1097 | -// How many [`read_coeffs`] reads resolved a `tx_type` outside `TX_CLASS_2D` | |
| 1098 | -// (`V_DCT`/`H_DCT`, spec 5.11.39's `TxClass::Horiz`/`Vert`), across every | |
| 1099 | -// call on the current thread -- the same before/after counter pattern as | |
| 1100 | -// [`TX_DEPTH_HITS`], proving a stream actually exercised the class-split | |
| 1101 | -// `eob_pt`/1D-neighbour context path rather than every block coincidentally | |
| 1102 | -// landing on `DCT_DCT`. | |
| 1103 | -thread_local! { | |
| 1104 | - pub(super) static TX_CLASS1_HITS: std::cell::Cell<usize> = | |
| 1105 | - const { std::cell::Cell::new(0) }; | |
| 1106 | -} | |
| 1107 | - | |
| 1108 | -// How many `uv_mode` reads resolved to a directional chroma mode (neither | |
| 1109 | -// `DC_PRED` nor `UV_CFL_PRED`), across every call on the current thread -- the same | |
| 1110 | -// before/after counter pattern as [`FILTER_INTRA_HITS`], proving a stream | |
| 1111 | -// actually exercised chroma's own directional predictor. | |
| 1112 | -thread_local! { | |
| 1113 | - pub(super) static DIRECTIONAL_UV_HITS: std::cell::Cell<usize> = | |
| 1114 | - const { std::cell::Cell::new(0) }; | |
| 1115 | -} | |
| 1116 | - | |
| 1117 | -/// Current value of [`DIRECTIONAL_UV_HITS`]. | |
| 1118 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1119 | -pub(crate) fn directional_uv_hits() -> usize { | |
| 1120 | - DIRECTIONAL_UV_HITS.with(|c| c.get()) | |
| 1121 | -} | |
| 1122 | - | |
| 1123 | -// How many `angle_delta`/`angle_delta_uv` symbols this decoder has read as | |
| 1124 | -// something other than [`ANGLE_DELTA_ZERO`], across every call in the | |
| 1125 | -// process -- the same before/after counter pattern as [`FILTER_INTRA_HITS`], | |
| 1126 | -// proving a stream actually exercised a nonzero angle delta. | |
| 1127 | -thread_local! { | |
| 1128 | - pub(super) static ANGLE_DELTA_HITS: std::cell::Cell<usize> = | |
| 1129 | - const { std::cell::Cell::new(0) }; | |
| 1130 | -} | |
| 1131 | - | |
| 1132 | -// How many [`read_single_ref`] reads resolved to a reference other than | |
| 1133 | -// `LAST_FRAME`, across every call on the current thread -- the same before/after | |
| 1134 | -// counter pattern as [`FILTER_INTRA_HITS`], proving a stream actually | |
| 1135 | -// exercised a non-`LAST_FRAME` reference (`GOLDEN_FRAME`, this decoder's | |
| 1136 | -// only other supported one so far) rather than every block coincidentally | |
| 1137 | -// resolving `LAST_FRAME`. | |
| 1138 | -thread_local! { | |
| 1139 | - pub(super) static NON_LAST_REF_HITS: std::cell::Cell<usize> = | |
| 1140 | - const { std::cell::Cell::new(0) }; | |
| 1141 | -} | |
| 1142 | - | |
| 1143 | -/// Current value of [`NON_LAST_REF_HITS`]. | |
| 1144 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1145 | -pub(crate) fn non_last_ref_hits() -> usize { | |
| 1146 | - NON_LAST_REF_HITS.with(|c| c.get()) | |
| 1147 | -} | |
| 1148 | - | |
| 1149 | -// Per-reference [`NON_LAST_REF_HITS`] breakdown (lane-av1refs): one counter | |
| 1150 | -// per `MV_REFERENCE_FRAME` past `LAST_FRAME`, so a gate targeting one | |
| 1151 | -// specific reference (`LAST2`/`LAST3`/`GOLDEN`/`BWDREF`/`ALTREF2`/`ALTREF`) | |
| 1152 | -// can prove THAT reference fired rather than any non-`LAST_FRAME` one -- | |
| 1153 | -// `NON_LAST_REF_HITS` alone cannot tell a `LAST2_FRAME` gate from a | |
| 1154 | -// `GOLDEN_FRAME` draw it did not ask for. | |
| 1155 | -thread_local! { | |
| 1156 | - pub(super) static LAST2_HITS: std::cell::Cell<usize> = | |
| 1157 | - const { std::cell::Cell::new(0) }; | |
| 1158 | -} | |
| 1159 | - | |
| 1160 | -thread_local! { | |
| 1161 | - pub(super) static LAST3_HITS: std::cell::Cell<usize> = | |
| 1162 | - const { std::cell::Cell::new(0) }; | |
| 1163 | -} | |
| 1164 | - | |
| 1165 | -thread_local! { | |
| 1166 | - pub(super) static GOLDEN_HITS: std::cell::Cell<usize> = | |
| 1167 | - const { std::cell::Cell::new(0) }; | |
| 1168 | -} | |
| 1169 | - | |
| 1170 | -thread_local! { | |
| 1171 | - pub(super) static BWDREF_HITS: std::cell::Cell<usize> = | |
| 1172 | - const { std::cell::Cell::new(0) }; | |
| 1173 | -} | |
| 1174 | - | |
| 1175 | -thread_local! { | |
| 1176 | - pub(super) static ALTREF2_HITS: std::cell::Cell<usize> = | |
| 1177 | - const { std::cell::Cell::new(0) }; | |
| 1178 | -} | |
| 1179 | - | |
| 1180 | -thread_local! { | |
| 1181 | - pub(super) static ALTREF_HITS: std::cell::Cell<usize> = | |
| 1182 | - const { std::cell::Cell::new(0) }; | |
| 1183 | -} | |
| 1184 | - | |
| 1185 | -// How many [`read_comp_mode`] reads resolved `COMPOUND_REFERENCE` (lane-av1comp) | |
| 1186 | -// -- proves a `reference_select` stream actually reached a block that picked | |
| 1187 | -// compound, not just that the header bit was set. Every such block is | |
| 1188 | -// refused after this fires ([`decode_inter_block`]/[`decode_inter_block8`]), | |
| 1189 | -// so this only ever counts attempted reads, never a completed decode. | |
| 1190 | -thread_local! { | |
| 1191 | - pub(super) static COMP_MODE_HITS: std::cell::Cell<usize> = | |
| 1192 | - const { std::cell::Cell::new(0) }; | |
| 1193 | -} | |
| 1194 | - | |
| 1195 | -/// Current value of [`COMP_MODE_HITS`]. | |
| 1196 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1197 | -pub(crate) fn comp_mode_hits() -> usize { | |
| 1198 | - COMP_MODE_HITS.with(|c| c.get()) | |
| 1199 | -} | |
| 1200 | - | |
| 1201 | -// How many blocks [`read_intra_mode`] decoded a real (nonzero-size) palette-Y | |
| 1202 | -// use for, across every call on the current thread -- the same before/after | |
| 1203 | -// counter pattern as [`FILTER_INTRA_HITS`], proving a stream actually | |
| 1204 | -// exercised palette reconstruction rather than only reading and refusing the | |
| 1205 | -// `palette_y_mode` symbol. | |
| 1206 | -thread_local! { | |
| 1207 | - pub(super) static PALETTE_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1208 | -} | |
| 1209 | - | |
| 1210 | -/// Current value of [`PALETTE_HITS`]. | |
| 1211 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1212 | -pub(crate) fn palette_hits() -> usize { | |
| 1213 | - PALETTE_HITS.with(|c| c.get()) | |
| 1214 | -} | |
| 1215 | - | |
| 1216 | -// lane-tiles r12: of those, how many sat at their own TILE's left column -- | |
| 1217 | -// exactly the blocks whose palette cache/ctx must NOT see the previous tile's | |
| 1218 | -// colours (`av1_get_palette_cache`'s `xd->left_mbmi == NULL`). A multi-tile | |
| 1219 | -// palette gate that never hits one proves nothing about the tile guard. | |
| 1220 | -thread_local! { | |
| 1221 | - pub(super) static PALETTE_TILE_LEFT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1222 | -} | |
| 1223 | - | |
| 1224 | -/// Current value of [`PALETTE_TILE_LEFT_HITS`]. | |
| 1225 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1226 | -pub(crate) fn palette_tile_left_hits() -> usize { | |
| 1227 | - PALETTE_TILE_LEFT_HITS.with(|c| c.get()) | |
| 1228 | -} | |
| 1229 | - | |
| 1230 | -// lane-palette2 r1: as [`PALETTE_HITS`], for a real (nonzero-size) chroma | |
| 1231 | -// palette use -- proves a stream actually reconstructed UV palette pixels, | |
| 1232 | -// not just read and refused the `palette_uv_mode` symbol. | |
| 1233 | -thread_local! { | |
| 1234 | - pub(super) static PALETTE_UV_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1235 | -} | |
| 1236 | - | |
| 1237 | -/// Current value of [`PALETTE_UV_HITS`]. | |
| 1238 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1239 | -pub(crate) fn palette_uv_hits() -> usize { | |
| 1240 | - PALETTE_UV_HITS.with(|c| c.get()) | |
| 1241 | -} | |
| 1242 | - | |
| 1243 | -// lane-palette2 r1: how many HORZ/VERT rect intra strips ([`read_intra_mode_rect`]) | |
| 1244 | -// decoded a real palette-Y use -- proves the rect strip's own palette syntax | |
| 1245 | -// (not just the square path's) actually fired. | |
| 1246 | -thread_local! { | |
| 1247 | - pub(super) static PALETTE_RECT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1248 | -} | |
| 1249 | - | |
| 1250 | -/// Current value of [`PALETTE_RECT_HITS`]. | |
| 1251 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1252 | -pub(crate) fn palette_rect_hits() -> usize { | |
| 1253 | - PALETTE_RECT_HITS.with(|c| c.get()) | |
| 1254 | -} | |
| 1255 | - | |
| 1256 | -// lane-palette2 r6: how many HORZ/VERT rect intra strips ran the | |
| 1257 | -// [`palette_bsize_ctx_wh`]-gated code path in [`read_intra_mode_rect`] -- | |
| 1258 | -// i.e. `allow_screen_content_tools` was set and the strip's `bw`x`bh` was in | |
| 1259 | -// range, so `palette_y_mode`/`palette_uv_mode` were actually read (and, per | |
| 1260 | -// RD, almost always refused-on-use because the block doesn't end up USING a | |
| 1261 | -// palette -- see r5's report). This is the site the removed refusal | |
| 1262 | -// ("a HORZ/VERT intra strip in a screen-content frame") used to guard: it | |
| 1263 | -// fired here whether or not the block picked a palette, so this is the | |
| 1264 | -// counter that proves the case r5's narrower [`PALETTE_RECT_HITS`] almost | |
| 1265 | -// never observes. | |
| 1266 | -thread_local! { | |
| 1267 | - pub(super) static RECT_SCREEN_CONTENT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1268 | -} | |
| 1269 | - | |
| 1270 | -/// Current value of [`RECT_SCREEN_CONTENT_HITS`]. | |
| 1271 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1272 | -pub(crate) fn rect_screen_content_hits() -> usize { | |
| 1273 | - RECT_SCREEN_CONTENT_HITS.with(|c| c.get()) | |
| 1274 | -} | |
| 1275 | - | |
| 1276 | -// lane-palette2 r1: how many palette-Y luma transform UNITS decoded under a | |
| 1277 | -// split luma transform (`logical_tx != side`) -- proves the per-TU index-map | |
| 1278 | -// windowing actually ran, not just that the whole-block path stayed exact. | |
| 1279 | -// Counts units, not blocks (a 64x64 palette block split to 16x16 TUs adds 16); | |
| 1280 | -// first actually incremented in r7, when the refusal it guarded was lifted. | |
| 1281 | -thread_local! { | |
| 1282 | - pub(super) static PALETTE_SPLIT_TX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1283 | -} | |
| 1284 | - | |
| 1285 | -thread_local! { | |
| 1286 | - /// lane-kf900 r4: rect intra strips that ACTUALLY use a palette -- the | |
| 1287 | - /// 1:4 shapes (32x8/8x32, 16x4/4x16) and the sub-16x16 2:1 leaves | |
| 1288 | - /// (16x8/8x16), the two shapes the lifted refusals named. | |
| 1289 | - pub(super) static RECT4_PALETTE_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1290 | -} | |
| 1291 | - | |
| 1292 | -/// Current value of [`RECT4_PALETTE_HITS`]. | |
| 1293 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1294 | -pub(crate) fn rect4_palette_hits() -> usize { | |
| 1295 | - RECT4_PALETTE_HITS.with(|c| c.get()) | |
| 1296 | -} | |
| 1297 | - | |
| 1298 | -/// Current value of [`PALETTE_SPLIT_TX_HITS`]. | |
| 1299 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1300 | -pub(crate) fn palette_split_tx_hits() -> usize { | |
| 1301 | - PALETTE_SPLIT_TX_HITS.with(|c| c.get()) | |
| 1302 | -} | |
| 1303 | - | |
| 1304 | -thread_local! { | |
| 1305 | - /// lane-av1444d10: chroma PREDICTION units on the 32-capped tiled chroma | |
| 1306 | - /// walk (`decode_block_rect`'s `uw/uh = min(chroma, 32)` units) that were | |
| 1307 | - /// handed a STRICT sub-slice of their block's palette buffer -- i.e. the | |
| 1308 | - /// units of a block the 32-cap actually TILED (`nw * nh > 1`). | |
| 1309 | - /// | |
| 1310 | - /// CORRECTED 2026-09-30 after the refutation pass `lanes/refute-av1444d10` | |
| 1311 | - /// read the numbers back: the previous comment claimed it counted "the | |
| 1312 | - /// units that are NOT the block's top-left corner", which is not what the | |
| 1313 | - /// code did -- the hit was unconditional, so a block's corner unit fired it | |
| 1314 | - /// too AND a single-unit block (whose window is a pure re-stride copy of | |
| 1315 | - /// the whole buffer) fired it as well. That made a hit prove only that some | |
| 1316 | - /// palette chroma block existed, not that the tiled arm ran. The `bigger` | |
| 1317 | - /// guard now makes the counter discriminate. On the pinned fixture the | |
| 1318 | - /// measured value is unchanged at 4 (one block with nw = 1, nh = 2 x two | |
| 1319 | - /// planes x two unit rows); a stream whose palette chroma blocks are all | |
| 1320 | - /// single-unit now leaves it at zero. | |
| 1321 | - /// | |
| 1322 | - /// FURTHER CORRECTED the same day by the palette lane's refutation | |
| 1323 | - /// (`lanes/av1444palw.report.md` + the arm-isolated mutation): the guard is | |
| 1324 | - /// about TILING, not about `nw > 1` specifically. Isolating the two window | |
| 1325 | - /// sites shows the RECT-unit arm alone reds the 10-bit cell, and the | |
| 1326 | - /// SQUARE-unit arm alone reds the 12-bit cell *and* the 10-bit one -- so | |
| 1327 | - /// windowing is load-bearing for every tiled block, and `nw > 1` is merely | |
| 1328 | - /// the case the corpus could not reach. Do not read this counter as | |
| 1329 | - /// evidence that only the horizontal term matters. | |
| 1330 | - pub(super) static CHROMA_PALETTE_WINDOW_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1331 | -} | |
| 1332 | - | |
| 1333 | -/// Current value of [`CHROMA_PALETTE_WINDOW_HITS`]. | |
| 1334 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1335 | -pub(crate) fn chroma_palette_window_hits() -> usize { | |
| 1336 | - CHROMA_PALETTE_WINDOW_HITS.with(|c| c.get()) | |
| 1337 | -} | |
| 1338 | - | |
| 1339 | -/// Zeroes [`CHROMA_PALETTE_WINDOW_HITS`] so a gate can read it as a DELTA | |
| 1340 | -/// (it is process-wide, like every counter here). | |
| 1341 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1342 | -pub(crate) fn reset_chroma_palette_window_hits() { | |
| 1343 | - CHROMA_PALETTE_WINDOW_HITS.with(|c| c.set(0)); | |
| 1344 | -} | |
| 1345 | - | |
| 1346 | -thread_local! { | |
| 1347 | - /// lane-pal8 r1: square 8x8 LEAVES ([`decode_leaf8`]) that actually use a | |
| 1348 | - /// palette (Y or UV) -- the shape every 8-bit `--tune-content=screen` | |
| 1349 | - /// stream stopped on, since aomenc palettes square blocks at 8 bit and | |
| 1350 | - /// `--min-partition-size=8` puts them on this leaf path. | |
| 1351 | - pub(super) static PALETTE_LEAF8_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1352 | -} | |
| 1353 | - | |
| 1354 | -/// Current value of [`PALETTE_LEAF8_HITS`]. | |
| 1355 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1356 | -pub(crate) fn palette_leaf8_hits() -> usize { | |
| 1357 | - PALETTE_LEAF8_HITS.with(|c| c.get()) | |
| 1358 | -} | |
| 1359 | - | |
| 1360 | -/// Zeroes [`PALETTE_LEAF8_HITS`] (per-attempt gate counting). | |
| 1361 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1362 | -pub(crate) fn reset_palette_leaf8_hits() { | |
| 1363 | - PALETTE_LEAF8_HITS.with(|c| c.set(0)); | |
| 1364 | -} | |
| 1365 | - | |
| 1366 | -thread_local! { | |
| 1367 | - /// lane-pal8 r1: NON-SKIP palette blocks on a superblock-level (64-level) | |
| 1368 | - /// HORZ/VERT or 1:4 strip ([`decode_block_rect64`]) -- i.e. a palette | |
| 1369 | - /// block that also carries a real, corner-cropped luma transform. | |
| 1370 | - pub(super) static PALETTE_SB_STRIP_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1371 | -} | |
| 1372 | - | |
| 1373 | -/// Current value of [`PALETTE_SB_STRIP_HITS`]. | |
| 1374 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1375 | -pub(crate) fn palette_sb_strip_hits() -> usize { | |
| 1376 | - PALETTE_SB_STRIP_HITS.with(|c| c.get()) | |
| 1377 | -} | |
| 1378 | - | |
| 1379 | -/// Zeroes [`PALETTE_SB_STRIP_HITS`] (per-attempt gate counting). | |
| 1380 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1381 | -pub(crate) fn reset_palette_sb_strip_hits() { | |
| 1382 | - PALETTE_SB_STRIP_HITS.with(|c| c.set(0)); | |
| 1383 | -} | |
| 1384 | - | |
| 1385 | -thread_local! { | |
| 1386 | - /// lane-av1rectreach: units of `decode_rect_split`'s `chroma_tiled` walk | |
| 1387 | - /// whose PER-UNIT reach ([`tu_reach_rect`], libaom's per-unit | |
| 1388 | - /// `has_top_right` / `has_bottom_left`) DIFFERS from the block-level | |
| 1389 | - /// `reach` this walk used to hand every unit -- i.e. units for which the | |
| 1390 | - /// two answers are not interchangeable. This is what a gate needs before | |
| 1391 | - /// it compares the walk byte-exactly: if the two agreed everywhere, the | |
| 1392 | - /// substitution could not change a single predicted sample and the | |
| 1393 | - /// exactness assert would be measuring a witness the fix cannot touch. | |
| 1394 | - /// | |
| 1395 | - /// What it does NOT prove is that the argument handed to the unit reader | |
| 1396 | - /// is the per-unit one -- the count is taken from the same expression | |
| 1397 | - /// either way, so deleting the substitution reds the exactness assert | |
| 1398 | - /// rather than this counter. That is the right way round: the assert is | |
| 1399 | - /// the claim, this is only the floor under it. | |
| 1400 | - pub(super) static RECT_TILED_CHROMA_UNIT_REACH_HITS: std::cell::Cell<usize> = | |
| 1401 | - const { std::cell::Cell::new(0) }; | |
| 1402 | - /// Chroma units of the same walk whose grid is exactly 2x1 (a 4:4:4 | |
| 1403 | - /// 64x32 chroma plane block as two 32x32 units). | |
| 1404 | - pub(super) static RECT_TILED_CHROMA_2X1_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1405 | - /// Chroma units of the same walk whose grid is exactly 1x2 (4:4:4 32x64, | |
| 1406 | - /// or 16x64 as two 16x32s). | |
| 1407 | - pub(super) static RECT_TILED_CHROMA_1X2_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1408 | - /// Chroma units of the same walk in any other multi-unit grid (2x2 and | |
| 1409 | - /// up). lane-av1422lift: this used to say "only reachable at 4:2:2, which | |
| 1410 | - /// is refused, so this stays 0 on every admitted stream", and that was | |
| 1411 | - /// true. 4:2:2 is decoded now, so the "cannot happen" is gone -- but the | |
| 1412 | - /// arm is still UNWITNESSED: measured on this branch's tip over all 21 | |
| 1413 | - /// committed 4:2:2 cells and over the 4:2:0 / 4:4:4 cells probed, it | |
| 1414 | - /// reads 0 on every one of them. No committed gate reads it either (the | |
| 1415 | - /// only readers of `rect_tiled_chroma_grid_hits()` are two 4:4:4 strip | |
| 1416 | - /// gates, where `nxn` is interpolated into a failure message and never | |
| 1417 | - /// asserted). Kept so the match above is exhaustive. | |
| 1418 | - pub(super) static RECT_TILED_CHROMA_NXN_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1419 | -} | |
| 1420 | - | |
| 1421 | -/// Current values of the four `RECT_TILED_CHROMA_*` counters, in the order | |
| 1422 | -/// `(unit_reach_differs, 2x1, 1x2, other multi-unit)`. | |
| 1423 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1424 | -pub(crate) fn rect_tiled_chroma_grid_hits() -> (usize, usize, usize, usize) { | |
| 1425 | - ( | |
| 1426 | - RECT_TILED_CHROMA_UNIT_REACH_HITS.with(|c| c.get()), | |
| 1427 | - RECT_TILED_CHROMA_2X1_HITS.with(|c| c.get()), | |
| 1428 | - RECT_TILED_CHROMA_1X2_HITS.with(|c| c.get()), | |
| 1429 | - RECT_TILED_CHROMA_NXN_HITS.with(|c| c.get()), | |
| 1430 | - ) | |
| 1431 | -} | |
| 1432 | - | |
| 1433 | -/// Zeroes the four `RECT_TILED_CHROMA_*` counters (gate tests call this | |
| 1434 | -/// before their own decode). | |
| 1435 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1436 | -pub(crate) fn reset_rect_tiled_chroma_grid_hits() { | |
| 1437 | - RECT_TILED_CHROMA_UNIT_REACH_HITS.with(|c| c.set(0)); | |
| 1438 | - RECT_TILED_CHROMA_2X1_HITS.with(|c| c.set(0)); | |
| 1439 | - RECT_TILED_CHROMA_1X2_HITS.with(|c| c.set(0)); | |
| 1440 | - RECT_TILED_CHROMA_NXN_HITS.with(|c| c.set(0)); | |
| 1441 | -} | |
| 1442 | - | |
| 1443 | -// lane-t900 r22: palette blocks reconstructed inside an INTER frame (the | |
| 1444 | -// intra-in-inter path, `decode_inter_block`/`decode_inter_block8`) -- counted | |
| 1445 | -// apart from [`PALETTE_HITS`] so a witness gate can prove the INTER-frame | |
| 1446 | -// capability rather than the key frame's, which every screen stream also | |
| 1447 | -// carries. | |
| 1448 | -thread_local! { | |
| 1449 | - pub(super) static INTRA_IN_INTER_PALETTE_Y_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1450 | - pub(super) static INTRA_IN_INTER_PALETTE_UV_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1451 | -} | |
| 1452 | - | |
| 1453 | -// lane-t900 r23: as [`INTRA_IN_INTER_PALETTE_Y_HITS`], narrowed to the 8x8 | |
| 1454 | -// LEAF site ([`decode_inter_block8`]'s intra arm) -- the >=16 site fires the | |
| 1455 | -// shared counter too, so only this one proves a gate really reached the leaf | |
| 1456 | -// where the refusal used to sit. | |
| 1457 | -thread_local! { | |
| 1458 | - pub(super) static INTER8_PALETTE_HITS: std::cell::Cell<(usize, usize)> = | |
| 1459 | - const { std::cell::Cell::new((0, 0)) }; | |
| 1460 | -} | |
| 1461 | - | |
| 1462 | -/// Current values of the 8x8-leaf intra-in-inter palette counters, `(y, uv)`. | |
| 1463 | -pub(crate) fn inter8_palette_hits() -> (usize, usize) { | |
| 1464 | - INTER8_PALETTE_HITS.with(std::cell::Cell::get) | |
| 1465 | -} | |
| 1466 | - | |
| 1467 | -/// Current values of the two intra-in-inter palette counters, `(y, uv)`. | |
| 1468 | -pub(crate) fn intra_in_inter_palette_hits() -> (usize, usize) { | |
| 1469 | - ( | |
| 1470 | - INTRA_IN_INTER_PALETTE_Y_HITS.with(|c| c.get()), | |
| 1471 | - INTRA_IN_INTER_PALETTE_UV_HITS.with(|c| c.get()), | |
| 1472 | - ) | |
| 1473 | -} | |
| 1474 | - | |
| 1475 | -// lane-hgkf r2: SKIPPED intra blocks whose `tx_depth` split the luma transform | |
| 1476 | -// and which are therefore predicted one transform unit at a time (a skipped | |
| 1477 | -// block codes no coefficients, so nothing else in the stream witnesses this | |
| 1478 | -// path -- only the pixels do). | |
| 1479 | -thread_local! { | |
| 1480 | - pub(super) static SKIP_SPLIT_TX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1481 | -} | |
| 1482 | - | |
| 1483 | -/// Current value of [`SKIP_SPLIT_TX_HITS`] (blocks, not units). | |
| 1484 | -pub fn skip_split_tx_hits() -> usize { | |
| 1485 | - SKIP_SPLIT_TX_HITS.with(|c| c.get()) | |
| 1486 | -} | |
| 1487 | - | |
| 1488 | -// lane-svt1: SKIPPED square blocks carrying a palette/intrabc prediction whose | |
| 1489 | -// `tx_depth` split the luma transform -- the arm that predicted DC off the | |
| 1490 | -// block edges before the fix. Like [`SKIP_SPLIT_TX_HITS`] only the pixels | |
| 1491 | -// witness this path, so a gate that wants it needs the counter. | |
| 1492 | -thread_local! { | |
| 1493 | - pub(super) static SKIP_SPLIT_TX_OVERRIDE_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1494 | - /// lane-av1chromadc: chroma units of a skipped block whose intra-BC / | |
| 1495 | - /// UV-palette override had to be WINDOWED to the unit's own extent -- | |
| 1496 | - /// i.e. `cn_cols * cn_rows > 1`, which at 4:2:0 never happens (the chroma | |
| 1497 | - /// plane block is one 32x32 unit) and at 4:4:4 is every block of 64 and | |
| 1498 | - /// above. Counts UNITS, not blocks. EXCLUSIVE to this walk: the other two | |
| 1499 | - /// override sites (the luma slot and `decode_intrabc_owned_rect`) have | |
| 1500 | - /// their own windows. | |
| 1501 | - pub(super) static SKIP_CHROMA_OVERRIDE_WINDOW_HITS: std::cell::Cell<usize> = | |
| 1502 | - const { std::cell::Cell::new(0) }; | |
| 1503 | -} | |
| 1504 | - | |
| 1505 | -/// Current value of [`SKIP_SPLIT_TX_OVERRIDE_HITS`] (blocks). | |
| 1506 | -pub fn skip_split_tx_override_hits() -> usize { | |
| 1507 | - SKIP_SPLIT_TX_OVERRIDE_HITS.with(|c| c.get()) | |
| 1508 | -} | |
| 1509 | - | |
| 1510 | -/// lane-av1chromadc: [`SKIP_CHROMA_OVERRIDE_WINDOW_HITS`]. | |
| 1511 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1512 | -pub fn skip_chroma_override_window_hits() -> usize { | |
| 1513 | - SKIP_CHROMA_OVERRIDE_WINDOW_HITS.with(|c| c.get()) | |
| 1514 | -} | |
| 1515 | - | |
| 1516 | -/// Zeroes [`SKIP_CHROMA_OVERRIDE_WINDOW_HITS`] before a gate's own decode. | |
| 1517 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1518 | -pub fn reset_skip_chroma_override_window_hits() { | |
| 1519 | - SKIP_CHROMA_OVERRIDE_WINDOW_HITS.with(|c| c.set(0)); | |
| 1520 | -} | |
| 1521 | - | |
| 1522 | -/// Zeroes [`SKIP_SPLIT_TX_OVERRIDE_HITS`] before a gate's own decode attempt. | |
| 1523 | -pub fn reset_skip_split_tx_override_hits() { | |
| 1524 | - SKIP_SPLIT_TX_OVERRIDE_HITS.with(|c| c.set(0)); | |
| 1525 | -} | |
| 1526 | - | |
| 1527 | -// lane-svtinter: palette colour-index maps whose block is cut by the frame's | |
| 1528 | -// bottom/right mi edge, so spec 5.11.50's `onscreenWidth`/`onscreenHeight` | |
| 1529 | -// really are smaller than the block and FEWER symbols are read than the | |
| 1530 | -// block has cells (class map-read-past-frame-edge). | |
| 1531 | -thread_local! { | |
| 1532 | - pub(super) static PALETTE_ONSCREEN_CUT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1533 | -} | |
| 1534 | - | |
| 1535 | -/// Current value of [`PALETTE_ONSCREEN_CUT_HITS`] (colour-index maps). | |
| 1536 | -pub fn palette_onscreen_cut_hits() -> usize { | |
| 1537 | - PALETTE_ONSCREEN_CUT_HITS.with(|c| c.get()) | |
| 1538 | -} | |
| 1539 | - | |
| 1540 | -/// Zeroes [`PALETTE_ONSCREEN_CUT_HITS`] before a gate's own decode attempt. | |
| 1541 | -pub fn reset_palette_onscreen_cut_hits() { | |
| 1542 | - PALETTE_ONSCREEN_CUT_HITS.with(|c| c.set(0)); | |
| 1543 | -} | |
| 1544 | - | |
| 1545 | -/// Zeroes [`SKIP_SPLIT_TX_HITS`] before a gate's own decode attempt. | |
| 1546 | -pub fn reset_skip_split_tx_hits() { | |
| 1547 | - SKIP_SPLIT_TX_HITS.with(|c| c.set(0)); | |
| 1548 | -} | |
| 1549 | - | |
| 1550 | -// lane-intrainter r1: intra blocks inside an INTER frame whose `tx_depth` | |
| 1551 | -// symbol split their luma transform, bucketed by block side (8, 16, 32, 64) -- | |
| 1552 | -// the gate's proof that the lifted path actually ran, per size. | |
| 1553 | -thread_local! { | |
| 1554 | - pub(super) static INTRA_IN_INTER_SPLIT_TX_HITS: std::cell::Cell<[usize; 4]> = | |
| 1555 | - const { std::cell::Cell::new([0; 4]) }; | |
| 1556 | -} | |
| 1557 | - | |
| 1558 | -/// Current value of [`INTRA_IN_INTER_SPLIT_TX_HITS`], indexed 8/16/32/64. | |
| 1559 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1560 | -pub(crate) fn intra_in_inter_split_tx_hits() -> [usize; 4] { | |
| 1561 | - INTRA_IN_INTER_SPLIT_TX_HITS.with(std::cell::Cell::get) | |
| 1562 | -} | |
| 1563 | - | |
| 1564 | -thread_local! { | |
| 1565 | - /// The current frame's `mi` grid, kept only while a frame header set | |
| 1566 | - /// `allow_intrabc` -- an intrabc block's DV predictor is the ordinary | |
| 1567 | - /// MV stack ([`crate::mvstack::find_mv_stack`]) built against | |
| 1568 | - /// `INTRA_FRAME`, which needs the neighbour state a key frame otherwise | |
| 1569 | - /// never keeps. `(grid, mi_cols, mi_rows)`; `None` on every frame that | |
| 1570 | - /// does not allow intrabc (so nothing is paid for it). | |
| 1571 | - /// | |
| 1572 | - /// corner-cut: only [`decode_block`] (the square path) records into it, | |
| 1573 | - /// so a frame mixing intrabc with rect/sub-8x8 leaves would predict off | |
| 1574 | - /// an incomplete grid. Ceiling: the DV *value* (never the parse) would | |
| 1575 | - /// be wrong there; upgrade = record from the rect/leaf paths too. | |
| 1576 | - /// The block vector [`read_intra_mode`] just decoded, handed to | |
| 1577 | - /// [`decode_block`] off the call stack (same idiom as [`PALETTE_PRED`], | |
| 1578 | - /// which the alternative -- a tenth tuple member through every caller -- | |
| 1579 | - /// already avoids). Always `.take()`n by the block that reads it. | |
| 1580 | - /// How many blocks read `use_intrabc == 1` and took the DV path -- the | |
| 1581 | - /// gate's hit counter. Bumped on the READ, before the rect-strip refusal | |
| 1582 | - /// returns too, so it counts reads, not reconstructions (a refused block | |
| 1583 | - /// is never reconstructed). | |
| 1584 | - pub(super) static INTRABC_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1585 | -} | |
| 1586 | - | |
| 1587 | -/// Zeroes [`RECT_INTRABC_READS`] (gate tests call this before a decode). | |
| 1588 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1589 | -pub(crate) fn reset_rect_intrabc_reads() { | |
| 1590 | - RECT_INTRABC_READS.with(|c| c.set(0)); | |
| 1591 | -} | |
| 1592 | - | |
| 1593 | -thread_local! { | |
| 1594 | - /// Blocks that USED intrabc at an 8x8 LEAF (`decode_leaf8`) specifically | |
| 1595 | - /// -- the shape lane-kf900 r7 fixed; [`INTRABC_HITS`] counts every shape. | |
| 1596 | - pub(super) static LEAF8_INTRABC_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1597 | -} | |
| 1598 | - | |
| 1599 | -thread_local! { | |
| 1600 | - /// Chroma reads of an intrabc TX4-split leaf that consulted an ARMED | |
| 1601 | - /// [`INTRABC_CHROMA_TX`] slot -- proof that the arm's frame-copy + | |
| 1602 | - /// inherited-type route actually ran (lane-av1intrapred r2's non-vacuity | |
| 1603 | - /// counter: zero means the gate's fixture no longer reaches the route). | |
| 1604 | - pub(super) static INTRABC_TX4_CHROMA_COPY_HITS: std::cell::Cell<usize> = | |
| 1605 | - const { std::cell::Cell::new(0) }; | |
| 1606 | -} | |
| 1607 | - | |
| 1608 | -/// Current value of [`INTRABC_TX4_CHROMA_COPY_HITS`]. | |
| 1609 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1610 | -pub(crate) fn intrabc_tx4_chroma_copy_hits() -> usize { | |
| 1611 | - INTRABC_TX4_CHROMA_COPY_HITS.with(|c| c.get()) | |
| 1612 | -} | |
| 1613 | - | |
| 1614 | -/// Zeroes [`INTRABC_TX4_CHROMA_COPY_HITS`] (gate tests call this before a decode). | |
| 1615 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1616 | -pub(crate) fn reset_intrabc_tx4_chroma_copy_hits() { | |
| 1617 | - INTRABC_TX4_CHROMA_COPY_HITS.with(|c| c.set(0)); | |
| 1618 | -} | |
| 1619 | - | |
| 1620 | -/// Current value of [`LEAF8_INTRABC_HITS`]. | |
| 1621 | -pub(crate) fn leaf8_intrabc_hits() -> usize { | |
| 1622 | - LEAF8_INTRABC_HITS.with(|c| c.get()) | |
| 1623 | -} | |
| 1624 | - | |
| 1625 | -/// Zeroes [`LEAF8_INTRABC_HITS`] (gate tests call this before a decode). | |
| 1626 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1627 | -pub(crate) fn reset_leaf8_intrabc_hits() { | |
| 1628 | - LEAF8_INTRABC_HITS.with(|c| c.set(0)); | |
| 1629 | -} | |
| 1630 | - | |
| 1631 | -/// Current value of [`INTRABC_HITS`]. | |
| 1632 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1633 | -pub(crate) fn intrabc_hits() -> usize { | |
| 1634 | - INTRABC_HITS.with(|c| c.get()) | |
| 1635 | -} | |
| 1636 | - | |
| 1637 | -thread_local! { | |
| 1638 | - /// An intrabc block that IS a sub-8x8 group's CHROMA REFERENCE and is | |
| 1639 | - /// SKIPPED: the route that arms [`INTRABC_CHROMA_TX`] and then reads no | |
| 1640 | - /// chroma coefficient at all, so the slot used to stay armed into the NEXT | |
| 1641 | - /// block's chroma read. Both group shapes (4x4 split, 4x8/8x4 rect) count | |
| 1642 | - /// here. A non-zero value is what makes the disarm below load-bearing. | |
| 1643 | - pub(super) static SKIPPED_INTRABC_CHROMA_ARM_HITS: std::cell::Cell<usize> = | |
| 1644 | - const { std::cell::Cell::new(0) }; | |
| 1645 | -} | |
| 1646 | - | |
| 1647 | -/// Current value of [`SKIPPED_INTRABC_CHROMA_ARM_HITS`]. | |
| 1648 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates and the probe | |
| 1649 | -pub(crate) fn skipped_intrabc_chroma_arm_hits() -> usize { | |
| 1650 | - SKIPPED_INTRABC_CHROMA_ARM_HITS.with(|c| c.get()) | |
| 1651 | -} | |
| 1652 | - | |
| 1653 | -/// Zeroes [`SKIPPED_INTRABC_CHROMA_ARM_HITS`] (gate tests call this before a | |
| 1654 | -/// decode). | |
| 1655 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1656 | -pub(crate) fn reset_skipped_intrabc_chroma_arm_hits() { | |
| 1657 | - SKIPPED_INTRABC_CHROMA_ARM_HITS.with(|c| c.set(0)); | |
| 1658 | -} | |
| 1659 | - | |
| 1660 | -thread_local! { | |
| 1661 | - /// lane-av1-ibcskip2: a sub-8x8 4:4:4 leaf that is BOTH intrabc AND | |
| 1662 | - /// `skip` -- the arm whose chroma is the bare frame copy at the DV | |
| 1663 | - /// (libaom `av1_build_inter_predictors_sb` runs regardless of `skip`). | |
| 1664 | - /// Before the fix this route predicted intra-DC and every one of this | |
| 1665 | - /// fixture's 150 such cells differed from the oracle on both chroma | |
| 1666 | - /// planes. | |
| 1667 | - pub(super) static SKIPPED_INTRABC_DV_COPY_HITS: std::cell::Cell<usize> = | |
| 1668 | - const { std::cell::Cell::new(0) }; | |
| 1669 | -} | |
| 1670 | - | |
| 1671 | -/// Current value of [`SKIPPED_INTRABC_DV_COPY_HITS`]. | |
| 1672 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1673 | -pub(crate) fn skipped_intrabc_dv_copy_hits() -> usize { | |
| 1674 | - SKIPPED_INTRABC_DV_COPY_HITS.with(|c| c.get()) | |
| 1675 | -} | |
| 1676 | - | |
| 1677 | -/// Zeroes [`SKIPPED_INTRABC_DV_COPY_HITS`] (gate tests call this before a | |
| 1678 | -/// decode). | |
| 1679 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1680 | -pub(crate) fn reset_skipped_intrabc_dv_copy_hits() { | |
| 1681 | - SKIPPED_INTRABC_DV_COPY_HITS.with(|c| c.set(0)); | |
| 1682 | -} | |
| 1683 | - | |
| 1684 | -/// Zeroes [`INTRABC_HITS`] (gate tests call this before a decode). | |
| 1685 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1686 | -pub(crate) fn reset_intrabc_hits() { | |
| 1687 | - INTRABC_HITS.with(|c| c.set(0)); | |
| 1688 | -} | |
| 1689 | - | |
| 1690 | -thread_local! { | |
| 1691 | - /// lane-t900 r32: intrabc blocks whose transform size came off the INTER | |
| 1692 | - /// var-tx partition tree (unskipped, `TX_MODE_SELECT`) -- the capability | |
| 1693 | - /// that replaced the refusal "an intrabc block under TxMode::Select". | |
| 1694 | - pub(super) static INTRABC_VARTX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1695 | - /// lane-av1-ibcvtx: intrabc var-tx trees that resolved to MIXED leaf | |
| 1696 | - /// sizes (not one square size across every leaf) -- the engagement | |
| 1697 | - /// counter proving a witness actually exercises the per-leaf reconstruct. | |
| 1698 | - pub(super) static INTRABC_VARTX_MIXED_LEAVES_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1699 | - /// lane-av1txr: as above for a `BLOCK_4X8`/`BLOCK_8X4` intrabc leaf -- | |
| 1700 | - /// libaom's `block_signals_txsize` is `bsize > BLOCK_4X4`, so these leaves | |
| 1701 | - /// signal a transform size where a plain `BLOCK_4X4` does not. Reading no | |
| 1702 | - /// symbol here desynced `warped.obu` at the very next block. | |
| 1703 | - pub(super) static RECT_INTRABC_VARTX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1704 | - /// lane-av1-intrabc: rect INTRABC blocks whose reconstruction | |
| 1705 | - /// [`decode_intrabc_rect`] ran -- the engagement counter the rect-strip | |
| 1706 | - /// gates assert on (a refused block bumps [`INTRABC_HITS`] but never | |
| 1707 | - /// this one). | |
| 1708 | - pub(super) static INTRABC_RECT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1709 | - /// Of those, how many read the INTER var-tx tree (unskipped, TX_MODE_SELECT). | |
| 1710 | - pub(super) static INTRABC_RECT_VARTX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1711 | - /// lane-av1-intrabc r4: rect INTRABC blocks whose reconstruction | |
| 1712 | - /// [`decode_intrabc_rect`] ran with `skip == 0` (a real residual read), | |
| 1713 | - /// split by the strip's orientation -- `bw > bh` is a HORZ strip, | |
| 1714 | - /// `bh > bw` a VERT one. The reviewer's unblock condition needs a CODED | |
| 1715 | - /// witness in BOTH orientations, and the existing `INTRABC_RECT_HITS` | |
| 1716 | - /// counts neither orientation nor the skip flag, so an arm that flipped | |
| 1717 | - /// to an all-skip stream (no residual reader at all) would stay green. | |
| 1718 | - pub(super) static INTRABC_RECT_CODED_HITS: std::cell::Cell<[usize; 2]> = | |
| 1719 | - const { std::cell::Cell::new([0, 0]) }; | |
| 1720 | - /// lane-av1-intrabc r5: the `skip == 1` twin of [`INTRABC_RECT_CODED_HITS`] | |
| 1721 | - /// -- rect INTRABC blocks reconstructed as a bare prediction copy, split | |
| 1722 | - /// by orientation. The r5 panic (residual stride `bw * bh` underrunning | |
| 1723 | - /// `reconstruct_mc_rect`'s `row * side + w` index on a VERT strip) was | |
| 1724 | - /// invisible to every gate because they only counted CODED strips. | |
| 1725 | - pub(super) static INTRABC_RECT_SKIPPED_HITS: std::cell::Cell<[usize; 2]> = | |
| 1726 | - const { std::cell::Cell::new([0, 0]) }; | |
| 1727 | - /// lane-ibc444c: rect intra-BC blocks whose chroma plane block was sized | |
| 1728 | - /// `bw >> ss_x` by `bh >> ss_y` -- the 4:4:4 and 4:4:0 cells, where | |
| 1729 | - /// `av1_get_max_uv_txsize` (`ss_size_lookup[bsize]`, blockd.h) applies no | |
| 1730 | - /// halving of its own. At 4:2:0 this is the same arithmetic as the halving, | |
| 1731 | - /// so a `>= 1` witness can only come from a stream that is not 4:2:0. | |
| 1732 | - /// EXCLUSIVE to this arm: no other caller sizes an intrabc rect block's | |
| 1733 | - /// chroma plane block. | |
| 1734 | - pub(super) static IBC_RECT_CHROMA_FOOTPRINT_444_HITS: std::cell::Cell<usize> = | |
| 1735 | - const { std::cell::Cell::new(0) }; | |
| 1736 | - /// lane-whtshape: LOSSLESS rect intrabc blocks whose chroma plane block | |
| 1737 | - /// [`decode_intrabc_rect`] walked as a `(cw/4) * (ch/4)` PLANE-MAJOR | |
| 1738 | - /// raster of TX_4X4 units -- the shape libaom's lossless geometry codes | |
| 1739 | - /// (`read_tx_size` returns `TX_4X4` for EVERY plane of a lossless block, | |
| 1740 | - /// `get_vartx_max_txsize` likewise, and `read_tx_mode` forced the frame's | |
| 1741 | - /// `ONLY_4X4`) -- instead of the single rect unit, which is what put a | |
| 1742 | - /// non-4x4 unit on the lossless Walsh-Hadamard path. EXCLUSIVE to this arm: | |
| 1743 | - /// no other caller walks a rect intrabc block's chroma, so `>= 1` cannot | |
| 1744 | - /// be satisfied by any older route. | |
| 1745 | - pub(super) static INTRABC_RECT_LOSSLESS_CHROMA4_HITS: std::cell::Cell<usize> = | |
| 1746 | - const { std::cell::Cell::new(0) }; | |
| 1747 | - /// lane-av1chromarect: 128-root intra-BC HORZ/VERT strips | |
| 1748 | - /// ([`decode_intrabc_owned_rect`]) whose chroma plane block was sized | |
| 1749 | - /// `bw >> ss_x` by `bh >> ss_y` -- the 4:4:4 and 4:4:0 cells, where | |
| 1750 | - /// `av1_get_max_uv_txsize` (`ss_size_lookup[bsize]`, blockd.h:1372) applies | |
| 1751 | - /// no halving of its own. At 4:2:0 the two forms are the same arithmetic, | |
| 1752 | - /// so a `>= 1` witness can only come from a stream that is not 4:2:0. | |
| 1753 | - /// EXCLUSIVE to this arm: no other caller sizes a 128-root intra-BC | |
| 1754 | - /// strip's chroma plane block. | |
| 1755 | - pub(super) static IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS: std::cell::Cell<usize> = | |
| 1756 | - const { std::cell::Cell::new(0) }; | |
| 1757 | - /// lane-av1422ibctxsel: `decode_intrabc_owned_rect`'s NON-SPLIT chroma | |
| 1758 | - /// gather taken through the 4:2:2 pair rule (`around_mi_422_chroma`) | |
| 1759 | - /// under the ss (1, 0) guard -- both residual branches (the var-tx tree | |
| 1760 | - /// and the no-leaves twin). `>= 1` can only come from a 4:2:2 stream | |
| 1761 | - /// that reaches this function's non-split chroma arm; the 4:2:0/4:4:4 | |
| 1762 | - /// arms keep the plain `around_mi_rect` gather (`ss_y != 0` / `ss_x == 0` | |
| 1763 | - /// take the else), so the counter stays 0 for them. | |
| 1764 | - pub(super) static IBC_OWNED_RECT_422_PAIR_HITS: std::cell::Cell<usize> = | |
| 1765 | - const { std::cell::Cell::new(0) }; | |
| 1766 | -} | |
| 1767 | - | |
| 1768 | -/// lane-av1-intrabc r4: coded (`skip == 0`) rect intrabc blocks reconstructed, | |
| 1769 | -/// as `[horz, vert]` -- see [`INTRABC_RECT_CODED_HITS`]. | |
| 1770 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1771 | -pub fn intrabc_rect_coded_hits() -> [usize; 2] { | |
| 1772 | - INTRABC_RECT_CODED_HITS.with(std::cell::Cell::get) | |
| 1773 | -} | |
| 1774 | - | |
| 1775 | -/// lane-av1-intrabc r5: skipped (`skip == 1`) rect intrabc blocks | |
| 1776 | -/// reconstructed, as `[horz, vert]` -- see [`INTRABC_RECT_SKIPPED_HITS`]. | |
| 1777 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1778 | -pub fn intrabc_rect_skipped_hits() -> [usize; 2] { | |
| 1779 | - INTRABC_RECT_SKIPPED_HITS.with(std::cell::Cell::get) | |
| 1780 | -} | |
| 1781 | - | |
| 1782 | -/// Current value of [`INTRABC_RECT_HITS`]. | |
| 1783 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1784 | -pub fn intrabc_rect_hits() -> usize { | |
| 1785 | - INTRABC_RECT_HITS.with(|c| c.get()) | |
| 1786 | -} | |
| 1787 | - | |
| 1788 | -/// Zeroes [`INTRABC_RECT_HITS`]/[`INTRABC_RECT_VARTX_HITS`]. | |
| 1789 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1790 | -pub(crate) fn reset_intrabc_rect_hits() { | |
| 1791 | - INTRABC_RECT_HITS.with(|c| c.set(0)); | |
| 1792 | - INTRABC_RECT_VARTX_HITS.with(|c| c.set(0)); | |
| 1793 | - INTRABC_RECT_CODED_HITS.with(|c| c.set([0, 0])); | |
| 1794 | - INTRABC_RECT_SKIPPED_HITS.with(|c| c.set([0, 0])); | |
| 1795 | -} | |
| 1796 | - | |
| 1797 | -/// lane-ibc444c: [`IBC_RECT_CHROMA_FOOTPRINT_444_HITS`]. | |
| 1798 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1799 | -pub fn ibc_rect_chroma_footprint_444_hits() -> usize { | |
| 1800 | - IBC_RECT_CHROMA_FOOTPRINT_444_HITS.with(|c| c.get()) | |
| 1801 | -} | |
| 1802 | - | |
| 1803 | -/// lane-ibc444c: zeroes [`IBC_RECT_CHROMA_FOOTPRINT_444_HITS`]. | |
| 1804 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1805 | -pub(crate) fn reset_ibc_rect_chroma_footprint_444_hits() { | |
| 1806 | - IBC_RECT_CHROMA_FOOTPRINT_444_HITS.with(|c| c.set(0)); | |
| 1807 | -} | |
| 1808 | - | |
| 1809 | -/// lane-av1chromarect: [`IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS`]. | |
| 1810 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1811 | -pub fn ibc_owned_rect_chroma_footprint_444_hits() -> usize { | |
| 1812 | - IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS.with(|c| c.get()) | |
| 1813 | -} | |
| 1814 | - | |
| 1815 | -/// lane-av1chromarect: zeroes [`IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS`]. | |
| 1816 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1817 | -pub(crate) fn reset_ibc_owned_rect_chroma_footprint_444_hits() { | |
| 1818 | - IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS.with(|c| c.set(0)); | |
| 1819 | -} | |
| 1820 | - | |
| 1821 | -/// lane-av1422ibctxsel: [`IBC_OWNED_RECT_422_PAIR_HITS`]. | |
| 1822 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1823 | -pub fn ibc_owned_rect_422_pair_hits() -> usize { | |
| 1824 | - IBC_OWNED_RECT_422_PAIR_HITS.with(|c| c.get()) | |
| 1825 | -} | |
| 1826 | - | |
| 1827 | -/// lane-av1422ibctxsel: zeroes [`IBC_OWNED_RECT_422_PAIR_HITS`]. | |
| 1828 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1829 | -pub(crate) fn reset_ibc_owned_rect_422_pair_hits() { | |
| 1830 | - IBC_OWNED_RECT_422_PAIR_HITS.with(|c| c.set(0)); | |
| 1831 | -} | |
| 1832 | - | |
| 1833 | -/// lane-whtshape: [`INTRABC_RECT_LOSSLESS_CHROMA4_HITS`]. | |
| 1834 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1835 | -pub fn intrabc_rect_lossless_chroma4_hits() -> usize { | |
| 1836 | - INTRABC_RECT_LOSSLESS_CHROMA4_HITS.with(|c| c.get()) | |
| 1837 | -} | |
| 1838 | - | |
| 1839 | -/// lane-whtshape: zeroes [`INTRABC_RECT_LOSSLESS_CHROMA4_HITS`]. | |
| 1840 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1841 | -pub(crate) fn reset_intrabc_rect_lossless_chroma4_hits() { | |
| 1842 | - INTRABC_RECT_LOSSLESS_CHROMA4_HITS.with(|c| c.set(0)); | |
| 1843 | -} | |
| 1844 | - | |
| 1845 | -/// Current value of [`INTRABC_RECT_VARTX_HITS`]. | |
| 1846 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1847 | -pub fn intrabc_rect_vartx_hits() -> usize { | |
| 1848 | - INTRABC_RECT_VARTX_HITS.with(|c| c.get()) | |
| 1849 | -} | |
| 1850 | - | |
| 1851 | -thread_local! { | |
| 1852 | - /// lane-av1-ibcrect: `use_intrabc` blocks on a 128-root HORZ/VERT strip | |
| 1853 | - /// (BLOCK_128X64 / BLOCK_64X128) whose reconstruction | |
| 1854 | - /// [`decode_intrabc_128rect`] ran -- the shape the named refusal used to | |
| 1855 | - /// guard (`decode_block_128rect`). A refused block bumps | |
| 1856 | - /// [`INTRABC_HITS`] but never this one. | |
| 1857 | - pub(super) static INTRABC_128RECT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1858 | - /// lane-av1-ibc128chunk: chroma transform units the 128-root intrabc | |
| 1859 | - /// strip's mu-chunk walk read, one per `read_inter_plane` chroma call. | |
| 1860 | - /// At 4:2:0 a 64x64 mu chunk's chroma plane block is 32x32, so one | |
| 1861 | - /// TX_32X32 per plane per chunk; at 4:2:2 it is 32x64 and holds TWO | |
| 1862 | - /// STACKED units per plane. The square-cut `chunk_chroma = cside * 64 / | |
| 1863 | - /// side` model walked the 4:2:0 count on every axis, so this counter is | |
| 1864 | - /// the reach/arm witness for the per-axis walk. | |
| 1865 | - pub(super) static INTRABC_128RECT_CHROMA_CHUNK_HITS: std::cell::Cell<usize> = | |
| 1866 | - const { std::cell::Cell::new(0) }; | |
| 1867 | -} | |
| 1868 | - | |
| 1869 | -/// Current value of [`INTRABC_128RECT_HITS`]. | |
| 1870 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1871 | -pub fn intrabc_128rect_hits() -> usize { | |
| 1872 | - INTRABC_128RECT_HITS.with(|c| c.get()) | |
| 1873 | -} | |
| 1874 | - | |
| 1875 | -/// Zeroes [`INTRABC_128RECT_HITS`]. | |
| 1876 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1877 | -pub(crate) fn reset_intrabc_128rect_hits() { | |
| 1878 | - INTRABC_128RECT_HITS.with(|c| c.set(0)); | |
| 1879 | -} | |
| 1880 | - | |
| 1881 | -/// Current value of [`INTRABC_128RECT_CHROMA_CHUNK_HITS`]. | |
| 1882 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1883 | -pub fn intrabc_128rect_chroma_chunk_hits() -> usize { | |
| 1884 | - INTRABC_128RECT_CHROMA_CHUNK_HITS.with(|c| c.get()) | |
| 1885 | -} | |
| 1886 | - | |
| 1887 | -/// Zeroes [`INTRABC_128RECT_CHROMA_CHUNK_HITS`] and | |
| 1888 | -/// [`INTRABC_128RECT_CHUNK_SHAPE`]. | |
| 1889 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1890 | -pub(crate) fn reset_intrabc_128rect_chroma_chunk_hits() { | |
| 1891 | - INTRABC_128RECT_CHROMA_CHUNK_HITS.with(|c| c.set(0)); | |
| 1892 | - INTRABC_128RECT_CHUNK_SHAPE.with(|c| c.set(0)); | |
| 1893 | -} | |
| 1894 | - | |
| 1895 | -/// Current value of [`INTRABC_VARTX_HITS`]. | |
| 1896 | -pub fn intrabc_vartx_hits() -> usize { | |
| 1897 | - INTRABC_VARTX_HITS.with(|c| c.get()) | |
| 1898 | -} | |
| 1899 | - | |
| 1900 | -/// Current value of [`INTRABC_VARTX_MIXED_LEAVES_HITS`]. | |
| 1901 | -pub fn intrabc_vartx_mixed_leaves_hits() -> usize { | |
| 1902 | - INTRABC_VARTX_MIXED_LEAVES_HITS.with(|c| c.get()) | |
| 1903 | -} | |
| 1904 | - | |
| 1905 | -/// Zeroes [`INTRABC_VARTX_HITS`] (gate tests call this before a decode). | |
| 1906 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1907 | -pub(crate) fn reset_intrabc_vartx_hits() { | |
| 1908 | - INTRABC_VARTX_HITS.with(|c| c.set(0)); | |
| 1909 | -} | |
| 1910 | - | |
| 1911 | -/// Zeroes [`INTRABC_VARTX_MIXED_LEAVES_HITS`] (gate tests call this before a | |
| 1912 | -/// decode). | |
| 1913 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1914 | -pub(crate) fn reset_intrabc_vartx_mixed_leaves_hits() { | |
| 1915 | - INTRABC_VARTX_MIXED_LEAVES_HITS.with(|c| c.set(0)); | |
| 1916 | -} | |
| 1917 | - | |
| 1918 | -/// Current value of [`RECT_INTRABC_VARTX_HITS`]. | |
| 1919 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1920 | -pub fn rect_intrabc_vartx_hits() -> usize { | |
| 1921 | - RECT_INTRABC_VARTX_HITS.with(|c| c.get()) | |
| 1922 | -} | |
| 1923 | - | |
| 1924 | -// How many blocks decoded `skip_mode == 1` (lane-av1comp round 14) -- | |
| 1925 | -// proves a real `skip_mode_present` stream actually reached a block that | |
| 1926 | -// picked it, not just that the frame header bit was set. | |
| 1927 | -thread_local! { | |
| 1928 | - pub(super) static SKIP_MODE_HITS: std::cell::Cell<usize> = | |
| 1929 | - const { std::cell::Cell::new(0) }; | |
| 1930 | -} | |
| 1931 | - | |
| 1932 | -/// Current value of [`SKIP_MODE_HITS`]. | |
| 1933 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1934 | -pub(crate) fn skip_mode_hits() -> usize { | |
| 1935 | - SKIP_MODE_HITS.with(|c| c.get()) | |
| 1936 | -} | |
| 1937 | - | |
| 1938 | -// lane-motionmode: how many blocks actually decoded `obmc_selected == true` | |
| 1939 | -// (as opposed to just reaching an eligible `read_motion_mode` symbol read) | |
| 1940 | -// -- the gate's own proof that a real aomenc `--enable-obmc=1` stream | |
| 1941 | -// reached [`obmc_blend`], not just the header bit. | |
| 1942 | -thread_local! { | |
| 1943 | - pub(super) static OBMC_HITS: std::cell::Cell<usize> = | |
| 1944 | - const { std::cell::Cell::new(0) }; | |
| 1945 | -} | |
| 1946 | - | |
| 1947 | -// lane-fimv r1 (class wrong-alphabet-same-value): how many blocks took the | |
| 1948 | -// 2-symbol `obmc_cdf` alphabet *because* `force_integer_mv` (or a scaled | |
| 1949 | -// reference) vetoed `WARPED_CAUSAL` in libaom `motion_mode_allowed`, while | |
| 1950 | -// `allow_warped_motion == 1` and `num_proj_ref >= 1` would otherwise have | |
| 1951 | -// picked the 3-symbol `motion_mode_cdf`. These are exactly the blocks this | |
| 1952 | -// decoder used to read with the wrong alphabet, so a gate that asserts this | |
| 1953 | -// counter advanced proves the fixed path fired (class | |
| 1954 | -// `gate-blind-to-feature`). | |
| 1955 | -thread_local! { | |
| 1956 | - pub(super) static FIMV_ALPHABET_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1957 | -} | |
| 1958 | - | |
| 1959 | -/// Current value of [`FIMV_ALPHABET_HITS`]. | |
| 1960 | -pub fn fimv_alphabet_hits() -> usize { | |
| 1961 | - FIMV_ALPHABET_HITS.with(|c| c.get()) | |
| 1962 | -} | |
| 1963 | - | |
| 1964 | -// lane-fimv r1: how many frame headers this decoder has decoded with | |
| 1965 | -// `force_integer_mv == 1` (bumped by `stream.rs` per frame). Lets a gate | |
| 1966 | -// prove the encoder really produced the header state under test rather than | |
| 1967 | -// assume it. | |
| 1968 | -thread_local! { | |
| 1969 | - pub(super) static FIMV_FRAME_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1970 | -} | |
| 1971 | - | |
| 1972 | -/// Current value of [`FIMV_FRAME_HITS`]. | |
| 1973 | -pub fn fimv_frame_hits() -> usize { | |
| 1974 | - FIMV_FRAME_HITS.with(|c| c.get()) | |
| 1975 | -} | |
| 1976 | - | |
| 1977 | -/// Current value of [`OBMC_HITS`]. | |
| 1978 | -#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 1979 | -pub(crate) fn obmc_hits() -> usize { | |
| 1980 | - OBMC_HITS.with(|c| c.get()) | |
| 1981 | -} | |
| 1982 | - | |
| 1983 | -// lane-scaledref r1: per-case firing counts for the scaled-reference gate | |
| 1984 | -// (class `gate-blind-to-feature`) -- a pixel match under an UNSCALED | |
| 1985 | -// reference would pass just as well and prove nothing, so the gate | |
| 1986 | -// hard-asserts each combination this round lifts actually occurred: | |
| 1987 | -// a compound block with a scaled tap, a warp block whose warp libaom | |
| 1988 | -// suppresses because the reference is scaled, an OBMC block, an interintra | |
| 1989 | -// block, and an 8x8 leaf. | |
| 1990 | -thread_local! { | |
| 1991 | - pub(super) static SCALED_COMPOUND_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1992 | - pub(super) static SCALED_WARP_FALLBACK_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1993 | - pub(super) static SCALED_OBMC_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1994 | - pub(super) static SCALED_INTERINTRA_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1995 | - pub(super) static SCALED_BLOCK8_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1996 | - pub(super) static SCALED_WARP_SUPPRESSED_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1997 | - pub(super) static MIXED_SCALE_COMPOUND_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1998 | -} | |
| 1999 | - | |
| 2000 | -/// Current value of [`MIXED_SCALE_COMPOUND_HITS`]: compound blocks with one |
crates/ec-av1/src/decode/frame_tile.rsmodified+0 -84
| @@ -582,7 +582,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 582 | 582 | mi_row1 as usize, |
| 583 | 583 | mi_col1 as usize, |
| 584 | 584 | ); |
| 585 | - hit!(TILE_HITS); | |
| 586 | 585 | |
| 587 | 586 | // lane-sb128 r2: at `sb_size == 128` the tile walks each 128x128 |
| 588 | 587 | // superblock's four 64x64 quadrants in libaom `decode_partition` order |
| @@ -985,9 +984,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 985 | 984 | bh |
| 986 | 985 | ); |
| 987 | 986 | if horz { |
| 988 | - hit!(INTER_SB128_HORZ_HITS); | |
| 989 | 987 | } else { |
| 990 | - hit!(INTER_SB128_VERT_HITS); | |
| 991 | 988 | } |
| 992 | 989 | } |
| 993 | 990 | // One `cdef_idx` per BLOCK, copied to every 64x64 CDEF unit it |
| @@ -1022,7 +1019,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 1022 | 1019 | continue; |
| 1023 | 1020 | } |
| 1024 | 1021 | if sb128_none { |
| 1025 | - hit!(INTER_SB128_NONE_HITS); | |
| 1026 | 1022 | let at128 = ((sb_r & !1) as usize * 4, (sb_c & !1) as usize * 4); |
| 1027 | 1023 | // lane-sb128c r3: `at128` is in SUB16 units like `sb_at`; |
| 1028 | 1024 | // `decode_inter_block` takes MI. Unconverted it was (0,0) for |
| @@ -1155,16 +1151,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 1155 | 1151 | // see it. |
| 1156 | 1152 | refuse_invalid_subsize((64, 64), part64, fctx)?; |
| 1157 | 1153 | if part64 == PARTITION_NONE { |
| 1158 | - // lane-inter8 r1: the whole superblock as one 64x64 inter | |
| 1159 | - // block. `SB`-sized syntax throughout (size_group 3, same as | |
| 1160 | - // 32x32 -- `size_group_lookup[BLOCK_64X64] == 3`), luma | |
| 1161 | - // coefficients through `TxbSet::Luma64` with the 32-point | |
| 1162 | - // scan (TX_64X64 codes only its top-left corner, spec | |
| 1163 | - // 5.11.40 -- `read_inter_plane` widens the corner back to | |
| 1164 | - // 64x64 before the inverse transform), chroma as a plain | |
| 1165 | - // 32x32 `TxbSet::Chroma32`. TX_64X64 carries no `tx_type` | |
| 1166 | - // symbol at all, so the intra/inter luma sets coincide. | |
| 1167 | - hit!(INTER_SB_NONE_HITS); | |
| 1168 | 1154 | decode_inter_block( |
| 1169 | 1155 | &mut dec, |
| 1170 | 1156 | &mut cdfs, |
| @@ -1284,35 +1270,10 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 1284 | 1270 | if !four && i == 0 && ((horz && !has_rows) || (!horz && !has_cols)) { |
| 1285 | 1271 | bump_inter_edge_strip(if horz { 0 } else { 1 }); |
| 1286 | 1272 | } |
| 1287 | - match (horz, four) { | |
| 1288 | - (true, false) => hit!(INTER_SB_HORZ_HITS), | |
| 1289 | - (false, false) => hit!(INTER_SB_VERT_HITS), | |
| 1290 | - (true, true) => hit!(INTER_SB_HORZ4_HITS), | |
| 1291 | - (false, true) => hit!(INTER_SB_VERT4_HITS), | |
| 1292 | - } | |
| 1293 | 1273 | } |
| 1294 | 1274 | continue; |
| 1295 | 1275 | } |
| 1296 | 1276 | if (PARTITION_HORZ_A..=PARTITION_VERT_B).contains(&part64) { |
| 1297 | - // lane-sbab r1: the four superblock-level AB arms on the | |
| 1298 | - // INTER path -- two 32x32 inter squares plus one true | |
| 1299 | - // 64x32/32x64 inter strip, in libaom `decode_partition`'s own | |
| 1300 | - // order (decodeframe.c: HORZ_A = TL, TR, bottom strip; | |
| 1301 | - // HORZ_B = top strip, BL, BR; VERT_A = TL, BL, right strip; | |
| 1302 | - // VERT_B = left strip, TR, BR). Every piece is one this | |
| 1303 | - // decoder already proves elsewhere: the 32x32 square is the | |
| 1304 | - // `PARTITION_NONE`-under-SPLIT block below, the strip is the | |
| 1305 | - // `PARTITION_HORZ`/`VERT` piece above (`inter_piece!`, which | |
| 1306 | - // keeps `side = SB` for syntax/CDF and names its true | |
| 1307 | - // footprint through `write_w`/`write_h`). The intra-frame | |
| 1308 | - // twin of this arm is lane-part32 r4's `SB_AB_HITS` block. | |
| 1309 | - hit_do! { | |
| 1310 | - SB_AB_INTER_HITS.with(|c| { | |
| 1311 | - let mut h = c.get(); | |
| 1312 | - h[part64 - PARTITION_HORZ_A] += 1; | |
| 1313 | - c.set(h); | |
| 1314 | - }); | |
| 1315 | - } | |
| 1316 | 1277 | // lane-part32 r5 / class visit-order-changes-availability: |
| 1317 | 1278 | // only the two VERTICAL arms visit TL, BL, TR, BR, so only |
| 1318 | 1279 | // they switch libaom's `has_tr`/`has_bl` tables. |
| @@ -1749,9 +1710,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 1749 | 1710 | // covers 16x8/8x16 since this round). |
| 1750 | 1711 | let horz = part16 == PARTITION_HORZ; |
| 1751 | 1712 | if horz { |
| 1752 | - hit!(INTER_LEAF16_HORZ_HITS); | |
| 1753 | 1713 | } else { |
| 1754 | - hit!(INTER_LEAF16_VERT_HITS); | |
| 1755 | 1714 | } |
| 1756 | 1715 | let base_mi = sub16_to_mi(at16); |
| 1757 | 1716 | let (ww, wh) = if horz { (16, 8) } else { (8, 16) }; |
| @@ -2035,9 +1994,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 2035 | 1994 | bh |
| 2036 | 1995 | ); |
| 2037 | 1996 | if horz { |
| 2038 | - hit!(INTER16_HORZ4_HITS); | |
| 2039 | 1997 | } else { |
| 2040 | - hit!(INTER16_VERT4_HITS); | |
| 2041 | 1998 | } |
| 2042 | 1999 | } |
| 2043 | 2000 | } else if part16 != PARTITION_SPLIT { |
| @@ -2045,9 +2002,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 2045 | 2002 | "an inter 16x16-level partition value outside NONE/HORZ/VERT/SPLIT/AB/1:4", |
| 2046 | 2003 | )); |
| 2047 | 2004 | } else { |
| 2048 | - if has_cols16 && has_rows16 { | |
| 2049 | - hit!(INTER_SUB16_SPLIT_HITS); | |
| 2050 | - } | |
| 2051 | 2005 | let (mi_row0, mi_col0) = |
| 2052 | 2006 | (sr as u32 * SUB_MI, sc as u32 * SUB_MI); |
| 2053 | 2007 | let leaf_positions: Vec<(u32, u32)> = (0..4) |
| @@ -2066,7 +2020,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 2066 | 2020 | .dims(rf) |
| 2067 | 2021 | .is_some_and(|(w, _)| w != frame_width as usize) |
| 2068 | 2022 | }) { |
| 2069 | - hit!(SCALED_LEAF8_HITS); | |
| 2070 | 2023 | } |
| 2071 | 2024 | let mut prev_leaves: Vec<( |
| 2072 | 2025 | (usize, usize), |
| @@ -2281,19 +2234,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 2281 | 2234 | } |
| 2282 | 2235 | } |
| 2283 | 2236 | PARTITION_HORZ_B => { |
| 2284 | - // lane-warp r5: PARTITION_HORZ_B = 32x32 top strip + | |
| 2285 | - // 16x16 bottom-left + 16x16 bottom-right. aomenc | |
| 2286 | - // carves static regions into it; the strip is | |
| 2287 | - // decoded as a square 32x32 block: for a `skip` | |
| 2288 | - // block the symbol stream is identical to the true | |
| 2289 | - // 32x16 coding (no residual, no motion_mode/warp | |
| 2290 | - // symbol), and the square stamps it leaves over the | |
| 2291 | - // bottom half (neighbour arrays, skip/lf grids) are | |
| 2292 | - // re-stamped by the C/D leaves right after. The | |
| 2293 | - // mi-granular `left_side_mi` rows of a last-block-in- | |
| 2294 | - // tile strip leak 32-vs-16 only until the per-tile | |
| 2295 | - // `Neighbours::new` reset. | |
| 2296 | - hit!(EXTENDED_PARTITION_HITS); | |
| 2297 | 2237 | let at32 = at; |
| 2298 | 2238 | decode_inter_block( |
| 2299 | 2239 | &mut dec, |
| @@ -2453,13 +2393,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 2453 | 2393 | } |
| 2454 | 2394 | } |
| 2455 | 2395 | PARTITION_HORZ => { |
| 2456 | - // lane-rect r2: two true 32x16 strips. Both read at | |
| 2457 | - // `side=BLOCK` (CDF/size-class selection stays square, | |
| 2458 | - // matching HORZ_B's accepted corner-cut) but bw4/bh4 | |
| 2459 | - // (mvstack.rs, `motion_mode_eligible`) now derive from | |
| 2460 | - // `write_w`/`write_h`'s true 32x16 footprint -- the | |
| 2461 | - // pin's fix (r1's finding). | |
| 2462 | - hit!(RECT_PARTITION_HITS); | |
| 2463 | 2396 | decode_inter_block( |
| 2464 | 2397 | &mut dec, |
| 2465 | 2398 | &mut cdfs, |
| @@ -2566,9 +2499,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 2566 | 2499 | } |
| 2567 | 2500 | } |
| 2568 | 2501 | PARTITION_VERT => { |
| 2569 | - // lane-rect r2: mirror of PARTITION_HORZ above with | |
| 2570 | - // width/height swapped. | |
| 2571 | - hit!(RECT_PARTITION_HITS); | |
| 2572 | 2502 | decode_inter_block( |
| 2573 | 2503 | &mut dec, |
| 2574 | 2504 | &mut cdfs, |
| @@ -2675,10 +2605,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 2675 | 2605 | } |
| 2676 | 2606 | } |
| 2677 | 2607 | PARTITION_HORZ_A => { |
| 2678 | - // lane-partab r1: two 16x16 squares on top + a true | |
| 2679 | - // 32x16 strip below (libaom decode_partition | |
| 2680 | - // PARTITION_HORZ_A: TL, TR, bottom strip). | |
| 2681 | - hit!(PARTAB_HITS); | |
| 2682 | 2608 | decode_inter_block( |
| 2683 | 2609 | &mut dec, |
| 2684 | 2610 | &mut cdfs, |
| @@ -2830,9 +2756,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 2830 | 2756 | )?; |
| 2831 | 2757 | } |
| 2832 | 2758 | PARTITION_VERT_A => { |
| 2833 | - // lane-partab r1: mirror of PARTITION_HORZ_A with | |
| 2834 | - // width/height swapped (TL, BL, right 16x32 strip). | |
| 2835 | - hit!(PARTAB_HITS); | |
| 2836 | 2759 | let _vert_ab = crate::encode::Reach::vert_ab_partition(); |
| 2837 | 2760 | decode_inter_block( |
| 2838 | 2761 | &mut dec, |
| @@ -2985,10 +2908,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 2985 | 2908 | )?; |
| 2986 | 2909 | } |
| 2987 | 2910 | PARTITION_VERT_B => { |
| 2988 | - // lane-partab r1: true 16x32 strip on the left + two | |
| 2989 | - // 16x16 squares on the right (libaom decode_partition | |
| 2990 | - // PARTITION_VERT_B: left strip, TR, BR). | |
| 2991 | - hit!(PARTAB_HITS); | |
| 2992 | 2911 | let _vert_ab = crate::encode::Reach::vert_ab_partition(); |
| 2993 | 2912 | decode_inter_block( |
| 2994 | 2913 | &mut dec, |
| @@ -3177,9 +3096,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 3177 | 3096 | bh |
| 3178 | 3097 | ); |
| 3179 | 3098 | if horz { |
| 3180 | - hit!(RECT4_32_HORZ_INTER_HITS); | |
| 3181 | 3099 | } else { |
| 3182 | - hit!(RECT4_32_VERT_INTER_HITS); | |
| 3183 | 3100 | } |
| 3184 | 3101 | } |
| 3185 | 3102 | } |
| @@ -3237,7 +3154,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 3237 | 3154 | PREFILT_PICTURE_IDX.load(std::sync::atomic::Ordering::SeqCst) |
| 3238 | 3155 | ); |
| 3239 | 3156 | } |
| 3240 | - census_unwritten(&y, &u, &v); | |
| 3241 | 3157 | // lane-av1fwd: the encoder scores ~25 filter candidates against this |
| 3242 | 3158 | // same coded tile ([`FilterReplay`]). Capture the reconstruction here, |
| 3243 | 3159 | // before either filter has touched it -- but only on the shape whose |
crates/ec-av1/src/decode/inter_block.rsmodified+0 -125
| @@ -135,7 +135,6 @@ pub(super) fn decode_inter_block( | ||
| 135 | 135 | // exactly what it read before. |
| 136 | 136 | let (rmi, cmi) = at; |
| 137 | 137 | let (px, py) = (at.1 * MI, at.0 * MI); |
| 138 | - census_inter_block_shape(side, write_w, write_h); | |
| 139 | 138 | // lane-inter16ab r2: a 16x4 / 4x16 inter strip's chroma is the PAIR's |
| 140 | 139 | // (8x4 / 4x8 at the even strip's origin) and is coded only by the odd |
| 141 | 140 | // strip (`is_chroma_reference`); every other block keeps its own. |
| @@ -276,9 +275,6 @@ pub(super) fn decode_inter_block( | ||
| 276 | 275 | dec.debug_bitpos() |
| 277 | 276 | ); |
| 278 | 277 | } |
| 279 | - if skip_mode { | |
| 280 | - hit!(SKIP_MODE_HITS); | |
| 281 | - } | |
| 282 | 278 | |
| 283 | 279 | let skip_ctx = usize::from(neighbours.above_skip[cmi]) + usize::from(neighbours.left_skip[rmi]); |
| 284 | 280 | let skip = skip_mode || dec.symbol(&mut cdfs.skip[skip_ctx]) == 1; |
| @@ -526,9 +522,6 @@ pub(super) fn decode_inter_block( | ||
| 526 | 522 | // `AOMMIN(mi_size_wide, mi_size_high) < 2` before it looks at any |
| 527 | 523 | // model, so a 4-px-sided block still reads its interp filter. |
| 528 | 524 | let gm_nontrans = gm_nontrans_models && bw4.min(bh4) >= 2; |
| 529 | - if gm_nontrans_models && !gm_nontrans { | |
| 530 | - hit!(GM_NONTRANS_SMALL_SIDE_HITS); | |
| 531 | - } | |
| 532 | 525 | // lane-defer8: both slots' pictures are resolved inside the |
| 533 | 526 | // prediction closure; the parse only needs their SIZES. |
| 534 | 527 | // lane-cwarp r1: `is_global_mv_block` (blockd.h:421-429) is |
| @@ -553,10 +546,8 @@ pub(super) fn decode_inter_block( | ||
| 553 | 546 | // engagement figure. |
| 554 | 547 | if mi_row < mi_rows as usize / 2 { |
| 555 | 548 | if is_globalmv { |
| 556 | - TOP_HALF_COMPOUND_HITS.with(|c| c.set(c.get() + 1)); | |
| 557 | 549 | } |
| 558 | 550 | if is_global_mv0 || is_global_mv1 { |
| 559 | - TOP_HALF_WARP_HITS.with(|c| c.set(c.get() + 1)); | |
| 560 | 551 | } |
| 561 | 552 | } |
| 562 | 553 | // libaom `av1_init_warp_params` + `allow_warp`'s |
| @@ -595,7 +586,6 @@ pub(super) fn decode_inter_block( | ||
| 595 | 586 | let warp0 = compound_warp(ref0, is_global_mv0).filter(|_| ref_unscaled(ref0)); |
| 596 | 587 | let warp1 = compound_warp(ref1, is_global_mv1).filter(|_| ref_unscaled(ref1)); |
| 597 | 588 | if warp0.is_some() || warp1.is_some() { |
| 598 | - hit!(COMPOUND_WARP_HITS); | |
| 599 | 589 | // lane-av112bitw: the 12-bit refusal that stood here is |
| 600 | 590 | // LIFTED with the compound-warp witness: the rotating- |
| 601 | 591 | // mandelbrot 12-bit recipe refused exactly here pre-lift and |
| @@ -714,16 +704,6 @@ pub(super) fn decode_inter_block( | ||
| 714 | 704 | // verified vs independent C dump (wedge.rs). |
| 715 | 705 | let wedge_index = dec.symbol(&mut cdfs.wedge_idx[wedge_bsize]); |
| 716 | 706 | let wedge_sign = dec.literal(1); |
| 717 | - hit!(WEDGE_HITS); | |
| 718 | - if let Some(k) = rect_wedge_slot(write_w, write_h) { | |
| 719 | - hit_do! { | |
| 720 | - RECT_WEDGE_HITS.with(|c| { | |
| 721 | - let mut a = c.get(); | |
| 722 | - a[k] += 1; | |
| 723 | - c.set(a); | |
| 724 | - }); | |
| 725 | - } | |
| 726 | - } | |
| 727 | 707 | // lane-inter16ab r5: the codebook row is this block's TRUE |
| 728 | 708 | // footprint (`av1_wedge_params_lookup[bsize]`: hgtw for |
| 729 | 709 | // h>w, hltw for h<w, plus that bsize's own signflip row). |
| @@ -740,13 +720,6 @@ pub(super) fn decode_inter_block( | ||
| 740 | 720 | // COMPOUND_DIFFWTD: `mask_type`, MAX_DIFFWTD_MASK_BITS==1. |
| 741 | 721 | let mask_type = dec.literal(1); |
| 742 | 722 | diffwtd_mask_type = Some(mask_type as u8); |
| 743 | - if wedge_bsize.is_none() { | |
| 744 | - hit!(DIFFWTD_INFERRED_HITS); | |
| 745 | - } | |
| 746 | - } | |
| 747 | - hit!(MASKED_COMPOUND_HITS); | |
| 748 | - if write_w != write_h { | |
| 749 | - hit!(RECT_MASKED_COMPOUND_HITS); | |
| 750 | 723 | } |
| 751 | 724 | } |
| 752 | 725 | // corner-cut (lane-av1comp r16/r17, lane-av1blend r1): r16/r17 |
| @@ -970,10 +943,6 @@ pub(super) fn decode_inter_block( | ||
| 970 | 943 | if idx == 1 { |
| 971 | 944 | (8, 8, 1u8) |
| 972 | 945 | } else { |
| 973 | - // lane-av1distwtd: `idx == 0` is the | |
| 974 | - // distance-weighted arm -- the only branch whose | |
| 975 | - // weights are NOT the constant (8, 8) split. | |
| 976 | - hit!(DIST_WTD_COMP_HITS); | |
| 977 | 946 | let (fwd, bck) = crate::compound::dist_wtd_comp_weight_assign( |
| 978 | 947 | order_hint_bits, |
| 979 | 948 | order_hint, |
| @@ -1028,15 +997,9 @@ pub(super) fn decode_inter_block( | ||
| 1028 | 997 | // stride-1 one, so the unscaled case is unchanged. |
| 1029 | 998 | let scale0 = scale_of(ref_dims(ref0, refpix)?, frame_size); |
| 1030 | 999 | let scale1 = scale_of(ref_dims(ref1, refpix)?, frame_size); |
| 1031 | - if !scale0.is_unscaled() || !scale1.is_unscaled() { | |
| 1032 | - hit!(SCALED_COMPOUND_HITS); | |
| 1033 | - } | |
| 1034 | 1000 | // lane-scaledref r2: the MIXED case -- one tap scaled, the other |
| 1035 | 1001 | // not -- is the one an all-frames-scaled recipe never produces, |
| 1036 | 1002 | // and the one a single shared scale factor would get wrong. |
| 1037 | - if (scale0.is_unscaled()) != (scale1.is_unscaled()) { | |
| 1038 | - hit!(MIXED_SCALE_COMPOUND_HITS); | |
| 1039 | - } | |
| 1040 | 1003 | |
| 1041 | 1004 | // lane-wave4 (the compound arm's half): this block's whole |
| 1042 | 1005 | // prediction -- both references, the wedge/diffwtd/distance |
| @@ -1148,7 +1111,6 @@ pub(super) fn decode_inter_block( | ||
| 1148 | 1111 | // either way, only the mask source differs. |
| 1149 | 1112 | let mask_y: Option<&[u8]> = if let Some(mask_type) = diffwtd_mask_type { |
| 1150 | 1113 | diffwtd_mask_y = vec![0u8; side * side]; |
| 1151 | - hit!(DIFFWTD_HITS); | |
| 1152 | 1114 | mc::diffwtd_mask( |
| 1153 | 1115 | &inter0_y, |
| 1154 | 1116 | &inter1_y, |
| @@ -1597,14 +1559,6 @@ pub(super) fn decode_inter_block( | ||
| 1597 | 1559 | fctx, |
| 1598 | 1560 | )? |
| 1599 | 1561 | } else { |
| 1600 | - // lane-r14 r3: a 1:4 strip's `sub_tx_size_map` | |
| 1601 | - // sub-transform is RECTANGULAR (TX_64X16 -> | |
| 1602 | - // TX_32X16, TX_16X64 -> TX_16X32), so this leaf is | |
| 1603 | - // read with the rect coefficient machinery, at its | |
| 1604 | - // own `txb_skip_ctx`/neighbour spans -- the unit is | |
| 1605 | - // smaller than its block, so `get_txb_ctx_general`'s | |
| 1606 | - // neighbour table applies, not the lone-TU 0. | |
| 1607 | - vartx_rect_leaf_hit(tw, th); | |
| 1608 | 1562 | let tu_skip_ctx = |
| 1609 | 1563 | neighbours.luma_skip_ctx_rect(tu_mi, tw / MI, th / MI); |
| 1610 | 1564 | let start = row * MI * side + col * MI; |
| @@ -1852,7 +1806,6 @@ pub(super) fn decode_inter_block( | ||
| 1852 | 1806 | plane_idx, |
| 1853 | 1807 | &cu_grid, |
| 1854 | 1808 | ); |
| 1855 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 1856 | 1809 | mu_chroma = true; |
| 1857 | 1810 | // lane-av1muchunk422b: the allocation of this |
| 1858 | 1811 | // mu-chunk walk, counted per TX_32X32 UNIT. |
| @@ -1861,9 +1814,6 @@ pub(super) fn decode_inter_block( | ||
| 1861 | 1814 | // bump: `MU_CHUNK_COMPOUND_UNITS` names site 2 |
| 1862 | 1815 | // and the single-reference twin (site 5) stays |
| 1863 | 1816 | // out of it. |
| 1864 | - if is_compound { | |
| 1865 | - hit!(MU_CHUNK_COMPOUND_UNITS); | |
| 1866 | - } | |
| 1867 | 1817 | let dst = mu_units( |
| 1868 | 1818 | if plane_idx == 1 { |
| 1869 | 1819 | &mut u_units |
| @@ -2068,12 +2018,6 @@ pub(super) fn decode_inter_block( | ||
| 2068 | 2018 | let cu_rel_mi = (cr * (cu_tx / MI), cc * (cu_tx / MI)); |
| 2069 | 2019 | let cu_tx_type = covering_leaf_tx_type(&leaf_tx_types, cu_rel_mi) |
| 2070 | 2020 | .unwrap_or(luma_tx_type); |
| 2071 | - if covering_leaf_tx_type(&leaf_tx_types, cu_rel_mi).is_some() { | |
| 2072 | - hit!(CHROMA_QUAD_LEAF_TX_HITS); | |
| 2073 | - if cu_tx_type != luma_tx_type { | |
| 2074 | - hit!(CHROMA_QUAD_LEAF_TX_DIFF_HITS); | |
| 2075 | - } | |
| 2076 | - } | |
| 2077 | 2021 | let cu_grid = read_inter_plane( |
| 2078 | 2022 | dec, |
| 2079 | 2023 | cdfs, |
| @@ -2099,7 +2043,6 @@ pub(super) fn decode_inter_block( | ||
| 2099 | 2043 | // this one's coefficients. |
| 2100 | 2044 | neighbours |
| 2101 | 2045 | .record_mi_chroma(cu_mi, cu_tx, cu_tx, plane_idx, &cu_grid); |
| 2102 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 2103 | 2046 | // lane-av1-444 c8: the unit's levels must ALSO |
| 2104 | 2047 | // land in the block grid -- the block-tail mu |
| 2105 | 2048 | // re-stamp slices the per-unit states back out |
| @@ -2245,8 +2188,6 @@ pub(super) fn decode_inter_block( | ||
| 2245 | 2188 | tpl, |
| 2246 | 2189 | ); |
| 2247 | 2190 | let not_new = dec.symbol(&mut cdfs.new_mv[stack.new_mv_ctx]) == 1; |
| 2248 | - if !not_new { | |
| 2249 | - } | |
| 2250 | 2191 | let mut is_globalmv = false; |
| 2251 | 2192 | // lane-interbis r1: which single-ref mode this block resolved to, |
| 2252 | 2193 | // in the oracle's own numbering (NEARESTMV=13 .. NEWMV=16), for |
| @@ -2281,8 +2222,6 @@ pub(super) fn decode_inter_block( | ||
| 2281 | 2222 | ) |
| 2282 | 2223 | } else { |
| 2283 | 2224 | let not_zero = dec.symbol(&mut cdfs.zero_mv[stack.zero_mv_ctx]) == 1; |
| 2284 | - if !not_zero { | |
| 2285 | - } | |
| 2286 | 2225 | is_globalmv = !not_zero; |
| 2287 | 2226 | let mv = if !not_zero { |
| 2288 | 2227 | // GLOBALMV: `gm_get_motion_vector` (spec 7.10.2.1), already |
| @@ -2398,16 +2337,6 @@ pub(super) fn decode_inter_block( | ||
| 2398 | 2337 | // NO sign symbol follows -- libaom fixes |
| 2399 | 2338 | // INTERINTRA_WEDGE_SIGN 0 (blockd.h). |
| 2400 | 2339 | let wedge_index = dec.symbol(&mut cdfs.wedge_idx[wedge_bsize]); |
| 2401 | - hit!(WII_HITS); | |
| 2402 | - if let Some(k) = rect_wedge_slot(write_w, write_h) { | |
| 2403 | - hit_do! { | |
| 2404 | - RECT_WII_HITS.with(|c| { | |
| 2405 | - let mut a = c.get(); | |
| 2406 | - a[k] += 1; | |
| 2407 | - c.set(a); | |
| 2408 | - }); | |
| 2409 | - } | |
| 2410 | - } | |
| 2411 | 2340 | // lane-inter16ab r5: true-footprint codebook row, |
| 2412 | 2341 | // mask padded to stride `max(bw,bh) == side` -- see |
| 2413 | 2342 | // the compound site's own comment. |
| @@ -2418,7 +2347,6 @@ pub(super) fn decode_inter_block( | ||
| 2418 | 2347 | side, |
| 2419 | 2348 | )); |
| 2420 | 2349 | } else { |
| 2421 | - hit!(INTERINTRA_HITS); | |
| 2422 | 2350 | } |
| 2423 | 2351 | interintra_mode = Some(ii); |
| 2424 | 2352 | // The inter-intra predictor reads this block's neighbours as already |
| @@ -2556,12 +2484,6 @@ pub(super) fn decode_inter_block( | ||
| 2556 | 2484 | ) >= 1; |
| 2557 | 2485 | let warp_eligible = |
| 2558 | 2486 | allow_warped_motion && !ref_is_scaled && !force_integer_mv && proj_ok; |
| 2559 | - if allow_warped_motion && proj_ok && ref_is_scaled { | |
| 2560 | - hit!(SCALED_WARP_SUPPRESSED_HITS); | |
| 2561 | - } | |
| 2562 | - if allow_warped_motion && proj_ok && !ref_is_scaled && force_integer_mv { | |
| 2563 | - hit!(FIMV_ALPHABET_HITS); | |
| 2564 | - } | |
| 2565 | 2487 | if warp_eligible { |
| 2566 | 2488 | crate::msac::SymbolDecoder::set_symr_cdf("motion_mode"); |
| 2567 | 2489 | let mode = dec.symbol(&mut cdfs.motion_mode[bsize_idx]); |
| @@ -2569,11 +2491,9 @@ pub(super) fn decode_inter_block( | ||
| 2569 | 2491 | 0 => {} |
| 2570 | 2492 | 1 => { |
| 2571 | 2493 | obmc_selected = true; |
| 2572 | - hit!(OBMC_HITS); | |
| 2573 | 2494 | } |
| 2574 | 2495 | _ => { |
| 2575 | 2496 | warped_selected = true; |
| 2576 | - hit!(WARP_SELECTED_HITS); | |
| 2577 | 2497 | let mut samples = find_samples( |
| 2578 | 2498 | grid, |
| 2579 | 2499 | mi_row, |
| @@ -2636,9 +2556,6 @@ pub(super) fn decode_inter_block( | ||
| 2636 | 2556 | } |
| 2637 | 2557 | } else { |
| 2638 | 2558 | obmc_selected = dec.symbol(&mut cdfs.obmc[bsize_idx]) == 1; |
| 2639 | - if obmc_selected { | |
| 2640 | - hit!(OBMC_HITS); | |
| 2641 | - } | |
| 2642 | 2559 | } |
| 2643 | 2560 | // lane-t900 r9: which ALPHABET this block read (3-symbol |
| 2644 | 2561 | // motion_mode vs 2-symbol obmc) and the range after -- the |
| @@ -2676,15 +2593,9 @@ pub(super) fn decode_inter_block( | ||
| 2676 | 2593 | let gm_ref = &global_motion[(ref_frame - LAST_FRAME) as usize]; |
| 2677 | 2594 | if warp_params.is_none() && is_global_mv_block && !force_integer_mv && !gm_ref.invalid { |
| 2678 | 2595 | warp_params = crate::warp::global_warp_params(gm_ref.params); |
| 2679 | - if warp_params.is_some() && gm_ref.model == ec_av1_syntax::WarpModel::Affine { | |
| 2680 | - hit!(AFFINE_GM_HITS); | |
| 2681 | - } | |
| 2682 | 2596 | // lane-av1gwarp12: the ROTZOOM sibling -- the only |
| 2683 | 2597 | // >TRANSLATION model vanilla aomenc can emit for a single-ref |
| 2684 | 2598 | // global-motion block (encoder search pinned to ROTZOOM). |
| 2685 | - if warp_params.is_some() && gm_ref.model == ec_av1_syntax::WarpModel::Rotzoom { | |
| 2686 | - hit!(ROTZOOM_GM_WARP_HITS); | |
| 2687 | - } | |
| 2688 | 2599 | } |
| 2689 | 2600 | // lane-av112bitw: a local `WARPED_CAUSAL` projection (set above) |
| 2690 | 2601 | // or a global warp model both land here with `warp_params` set -- |
| @@ -2810,15 +2721,6 @@ pub(super) fn decode_inter_block( | ||
| 2810 | 2721 | // measured was the 16x4/4x16 strip's sub-8x8 chroma piece, |
| 2811 | 2722 | // which this file used to SKIP under a scaled reference |
| 2812 | 2723 | // (fixed in the same commit), not the warp fallback. |
| 2813 | - if warp_params.is_some() { | |
| 2814 | - hit!(SCALED_WARP_FALLBACK_HITS); | |
| 2815 | - } | |
| 2816 | - if obmc_selected { | |
| 2817 | - hit!(SCALED_OBMC_HITS); | |
| 2818 | - } | |
| 2819 | - if interintra_mode.is_some() { | |
| 2820 | - hit!(SCALED_INTERINTRA_HITS); | |
| 2821 | - } | |
| 2822 | 2724 | } |
| 2823 | 2725 | |
| 2824 | 2726 | // lane-inter16ab r2: `is_sub8x8_inter`'s neighbour walk reads the |
| @@ -2835,7 +2737,6 @@ pub(super) fn decode_inter_block( | ||
| 2835 | 2737 | { |
| 2836 | 2738 | Some((horz, (prev_ref, prev_mv, prev_h, prev_v))) => { |
| 2837 | 2739 | let prev_dims = ref_dims(prev_ref, refpix)?; |
| 2838 | - hit!(INTER16_SUB8_PIECE_HITS); | |
| 2839 | 2740 | Some(( |
| 2840 | 2741 | horz, |
| 2841 | 2742 | prev_ref, |
| @@ -3075,9 +2976,6 @@ pub(super) fn decode_inter_block( | ||
| 3075 | 2976 | // result, all planes (reconinter.c av1_build_interintra_predictor |
| 3076 | 2977 | // plane loop). |
| 3077 | 2978 | if let Some(ii) = interintra_mode { |
| 3078 | - if write_w != write_h { | |
| 3079 | - hit!(INTERINTRA_RECT_HITS); | |
| 3080 | - } | |
| 3081 | 2979 | interintra_blend( |
| 3082 | 2980 | y, |
| 3083 | 2981 | px, |
| @@ -3344,7 +3242,6 @@ pub(super) fn decode_inter_block( | ||
| 3344 | 3242 | // gate can prove it exercised this route (a 4:2:0 stream |
| 3345 | 3243 | // of the same content reads 0). |
| 3346 | 3244 | Some(_) if ss_x(fctx) == 0 => { |
| 3347 | - hit!(RECT4_INTER_OWN_CHROMA444_HITS); | |
| 3348 | 3245 | around |
| 3349 | 3246 | } |
| 3350 | 3247 | Some(s) if s.has_chroma => { |
| @@ -3425,14 +3322,6 @@ pub(super) fn decode_inter_block( | ||
| 3425 | 3322 | fctx, |
| 3426 | 3323 | )? |
| 3427 | 3324 | } else { |
| 3428 | - // lane-r14 r3: a 1:4 strip's `sub_tx_size_map` | |
| 3429 | - // sub-transform is RECTANGULAR (TX_64X16 -> | |
| 3430 | - // TX_32X16, TX_16X64 -> TX_16X32), so this leaf is | |
| 3431 | - // read with the rect coefficient machinery, at its | |
| 3432 | - // own `txb_skip_ctx`/neighbour spans -- the unit is | |
| 3433 | - // smaller than its block, so `get_txb_ctx_general`'s | |
| 3434 | - // neighbour table applies, not the lone-TU 0. | |
| 3435 | - vartx_rect_leaf_hit(tw, th); | |
| 3436 | 3325 | let tu_skip_ctx = |
| 3437 | 3326 | neighbours.luma_skip_ctx_rect(tu_mi, tw / MI, th / MI); |
| 3438 | 3327 | let start = row * MI * side + col * MI; |
| @@ -3666,7 +3555,6 @@ pub(super) fn decode_inter_block( | ||
| 3666 | 3555 | plane_idx, |
| 3667 | 3556 | &cu_grid, |
| 3668 | 3557 | ); |
| 3669 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 3670 | 3558 | mu_chroma = true; |
| 3671 | 3559 | // lane-av1muchunk422b: the allocation of this |
| 3672 | 3560 | // mu-chunk walk, counted per TX_32X32 UNIT. |
| @@ -3675,9 +3563,6 @@ pub(super) fn decode_inter_block( | ||
| 3675 | 3563 | // bump: `MU_CHUNK_COMPOUND_UNITS` names site 2 |
| 3676 | 3564 | // and the single-reference twin (site 5) stays |
| 3677 | 3565 | // out of it. |
| 3678 | - if is_compound { | |
| 3679 | - hit!(MU_CHUNK_COMPOUND_UNITS); | |
| 3680 | - } | |
| 3681 | 3566 | let dst = mu_units( |
| 3682 | 3567 | if plane_idx == 1 { |
| 3683 | 3568 | &mut u_units |
| @@ -3898,16 +3783,10 @@ pub(super) fn decode_inter_block( | ||
| 3898 | 3783 | let cu_tx_type = covering_leaf_tx_type(&leaf_tx_types, cu_rel_mi) |
| 3899 | 3784 | .unwrap_or(luma_tx_type); |
| 3900 | 3785 | if covering_leaf_tx_type(&leaf_tx_types, cu_rel_mi).is_some() { |
| 3901 | - hit!(CHROMA_QUAD_LEAF_TX_HITS); | |
| 3902 | - hit!(CHROMA_QUAD_LEAF_TX_SINGLEREF_HITS); | |
| 3903 | 3786 | // lane-av1f9singleland: this arm's own |
| 3904 | 3787 | // non-vacuity number -- the shared |
| 3905 | 3788 | // DIFFERS counter below cannot say which |
| 3906 | 3789 | // arm changed an answer. |
| 3907 | - if cu_tx_type != luma_tx_type { | |
| 3908 | - hit!(CHROMA_QUAD_LEAF_TX_DIFF_HITS); | |
| 3909 | - hit!(CHROMA_QUAD_LEAF_TX_SINGLEREF_DIFF_HITS); | |
| 3910 | - } | |
| 3911 | 3790 | } |
| 3912 | 3791 | let cu_grid = read_inter_plane( |
| 3913 | 3792 | dec, |
| @@ -3934,7 +3813,6 @@ pub(super) fn decode_inter_block( | ||
| 3934 | 3813 | // this one's coefficients. |
| 3935 | 3814 | neighbours |
| 3936 | 3815 | .record_mi_chroma(cu_mi, cu_tx, cu_tx, plane_idx, &cu_grid); |
| 3937 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 3938 | 3816 | // lane-av1-444 c8: the unit's levels must ALSO |
| 3939 | 3817 | // land in the block grid -- the block-tail mu |
| 3940 | 3818 | // re-stamp slices the per-unit states back out |
| @@ -4242,7 +4120,6 @@ pub(super) fn decode_inter_block( | ||
| 4242 | 4120 | palette_record.3, |
| 4243 | 4121 | ); |
| 4244 | 4122 | let saved_chroma_ctx = (!has_chroma).then(|| { |
| 4245 | - hit!(NON_CHROMA_REF_CTX_SKIP_HITS); | |
| 4246 | 4123 | let (w_mi, h_mi) = (write_w / MI, write_h / MI); |
| 4247 | 4124 | let left: Vec<[Neighbour; 2]> = (0..h_mi) |
| 4248 | 4125 | .filter_map(|k| neighbours.left.get(at.0 + k).map(|s| [s[1], s[2]])) |
| @@ -4269,7 +4146,6 @@ pub(super) fn decode_inter_block( | ||
| 4269 | 4146 | // where aomdec reads 1, because the skipped 128x128 block at |
| 4270 | 4147 | // mi(32,32) never cleared `left[32..48]`. |
| 4271 | 4148 | if skip { |
| 4272 | - hit!(SKIP_VARTX_LUMA_RESET_HITS); | |
| 4273 | 4149 | neighbours.record_mi_luma_rect(at, write_w, write_h, &luma_grid); |
| 4274 | 4150 | } |
| 4275 | 4151 | // Plane 0 is already correct per transform unit |
| @@ -4366,7 +4242,6 @@ pub(super) fn decode_inter_block( | ||
| 4366 | 4242 | } |
| 4367 | 4243 | } |
| 4368 | 4244 | neighbours.record_uv_mode_mi(s.pair_mi.0, s.pair_mi.1, pw / MI, ph / MI, uv_predict_mode); |
| 4369 | - hit!(INTER16_CHROMA_PAIR_HITS); | |
| 4370 | 4245 | } |
| 4371 | 4246 | // lane-av1-444 c8: each unit stamps its OWN span (32 << ss px at |
| 4372 | 4247 | // TX_32X32, 8 px lossless) -- a 64x64 mu chunk at ss 0/0 holds four |
crates/ec-av1/src/decode/inter_block8.rsmodified+0 -126
| @@ -243,9 +243,6 @@ pub(super) fn decode_inter_block8( | ||
| 243 | 243 | // leaf is always `BLOCK_8X8`, i.e. 2x2 mi. |
| 244 | 244 | inter_segment_id(dec, cdfs, leaf_mi.0, leaf_mi.1, 2, 2, false, true, fctx); |
| 245 | 245 | let skip_mode = skip_mode_present && dec.symbol(&mut cdfs.skip_mode[skip_mode_ctx]) == 1; |
| 246 | - if skip_mode { | |
| 247 | - hit!(SKIP_MODE_HITS); | |
| 248 | - } | |
| 249 | 246 | |
| 250 | 247 | let skip_ctx = usize::from(above_skip) + usize::from(left_skip); |
| 251 | 248 | let skip = skip_mode || dec.symbol(&mut cdfs.skip[skip_ctx]) == 1; |
| @@ -454,7 +451,6 @@ pub(super) fn decode_inter_block8( | ||
| 454 | 451 | // leaf's own comment. |
| 455 | 452 | let wedge_index = dec.symbol(&mut cdfs.wedge_idx[3]); |
| 456 | 453 | let wedge_sign = dec.literal(1); |
| 457 | - hit!(WEDGE_HITS); | |
| 458 | 454 | wedge_mask = Some( |
| 459 | 455 | crate::wedge::wedge_masks() |
| 460 | 456 | .codebook(SIDE, SIDE) |
| @@ -464,7 +460,6 @@ pub(super) fn decode_inter_block8( | ||
| 464 | 460 | let mask_type = dec.literal(1); |
| 465 | 461 | diffwtd_mask_type = Some(mask_type as u8); |
| 466 | 462 | } |
| 467 | - hit!(MASKED_COMPOUND_HITS); | |
| 468 | 463 | } |
| 469 | 464 | // corner-cut (lane-av1comp r16/r17, lane-av1blend r1): same |
| 470 | 465 | // reference-slot defect as the 16x16 leaf's own mask above |
| @@ -495,10 +490,6 @@ pub(super) fn decode_inter_block8( | ||
| 495 | 490 | if idx == 1 { |
| 496 | 491 | (8, 8, 1u8) |
| 497 | 492 | } else { |
| 498 | - // lane-av1distwtd: the 8x8 leaf's own | |
| 499 | - // distance-weighted arm, same counter as the | |
| 500 | - // 16x16+ site above. | |
| 501 | - hit!(DIST_WTD_COMP_HITS); | |
| 502 | 493 | let (fwd, bck) = crate::compound::dist_wtd_comp_weight_assign( |
| 503 | 494 | order_hint_bits, |
| 504 | 495 | order_hint, |
| @@ -570,17 +561,10 @@ pub(super) fn decode_inter_block8( | ||
| 570 | 561 | true, |
| 571 | 562 | ); |
| 572 | 563 | leaf_filter_syms = resolved_filter; |
| 573 | - if interp_fixed.is_none() && !(gm_nontrans_c || skip_mode) { | |
| 574 | - hit!(COMPOUND8_FILTER_HITS); | |
| 575 | - } | |
| 576 | 564 | |
| 577 | 565 | // lane-defer8: both slots' SIZES at parse, pictures in the closure. |
| 578 | 566 | let scale0 = scale_of(ref_dims(ref0, refpix)?, frame_size); |
| 579 | 567 | let scale1 = scale_of(ref_dims(ref1, refpix)?, frame_size); |
| 580 | - if !scale0.is_unscaled() || !scale1.is_unscaled() { | |
| 581 | - hit!(SCALED_COMPOUND_HITS); | |
| 582 | - hit!(SCALED_BLOCK8_HITS); | |
| 583 | - } | |
| 584 | 568 | |
| 585 | 569 | // lane-interp3 r2 (class twin-functions-drift): both slots |
| 586 | 570 | // used to be stamped `false`, while [`decode_inter_block`]'s |
| @@ -635,10 +619,6 @@ pub(super) fn decode_inter_block8( | ||
| 635 | 619 | leaf_compound_warp(ref0, is_global_mv0_c).filter(|_| leaf_ref_unscaled(ref0)); |
| 636 | 620 | let warp1_c = |
| 637 | 621 | leaf_compound_warp(ref1, is_global_mv1_c).filter(|_| leaf_ref_unscaled(ref1)); |
| 638 | - if warp0_c.is_some() || warp1_c.is_some() { | |
| 639 | - hit!(COMPOUND_WARP_HITS); | |
| 640 | - hit!(COMPOUND_WARP_HITS_8); | |
| 641 | - } | |
| 642 | 622 | grid.fill_rect( |
| 643 | 623 | mi_row, |
| 644 | 624 | mi_col, |
| @@ -745,7 +725,6 @@ pub(super) fn decode_inter_block8( | ||
| 745 | 725 | let mut diffwtd_mask_y; |
| 746 | 726 | let mask_y: Option<&[u8]> = if let Some(mask_type) = diffwtd_mask_type { |
| 747 | 727 | diffwtd_mask_y = vec![0u8; SIDE * SIDE]; |
| 748 | - hit!(DIFFWTD_HITS); | |
| 749 | 728 | mc::diffwtd_mask( |
| 750 | 729 | &inter0_y, |
| 751 | 730 | &inter1_y, |
| @@ -1323,13 +1302,6 @@ pub(super) fn decode_inter_block8( | ||
| 1323 | 1302 | neighbours.above[leaf_mi.1 + cell][0] = state; |
| 1324 | 1303 | } |
| 1325 | 1304 | } |
| 1326 | - // lane-cdef r1: ... and the CDEF skip band too. `apply_cdef`'s | |
| 1327 | - // `is_8x8_block_skip` (libaom `cdef.c:29-38`) reads all four mi | |
| 1328 | - // cells of the 8x8; this leaf wrote none of them, so a 64x64 | |
| 1329 | - // whose bottom-right 16x16 is an all-skip 8x8-leaf group kept | |
| 1330 | - // the PREVIOUS frame's flags and got filtered where libaom's | |
| 1331 | - // dlist excludes it (3 luma samples on a 192x128 inter frame). | |
| 1332 | - hit!(INTER8_SKIP_BAND_HITS); | |
| 1333 | 1305 | neighbours.fill_skip_grid(leaf_mi, 2, skip); |
| 1334 | 1306 | // lane-sub8x4 r2: `split8` is this leaf's OWN var-tx split, so |
| 1335 | 1307 | // the deblock grid must publish the TX_4X4 leaves' width the |
| @@ -1418,8 +1390,6 @@ pub(super) fn decode_inter_block8( | ||
| 1418 | 1390 | } |
| 1419 | 1391 | |
| 1420 | 1392 | let not_new = dec.symbol(&mut cdfs.new_mv[stack.new_mv_ctx]) == 1; |
| 1421 | - if !not_new { | |
| 1422 | - } | |
| 1423 | 1393 | let mut is_globalmv = false; |
| 1424 | 1394 | let (mv, is_new_mv) = if !not_new { |
| 1425 | 1395 | // NEWMV (spec 5.11.24's `read_drl_idx`, `RefMvIdx` starting at 0): |
| @@ -1450,14 +1420,8 @@ pub(super) fn decode_inter_block8( | ||
| 1450 | 1420 | ) |
| 1451 | 1421 | } else { |
| 1452 | 1422 | let not_zero = dec.symbol(&mut cdfs.zero_mv[stack.zero_mv_ctx]) == 1; |
| 1453 | - if !not_zero { | |
| 1454 | - } | |
| 1455 | 1423 | is_globalmv = !not_zero; |
| 1456 | 1424 | let mv = if !not_zero { |
| 1457 | - // lane-gmaffine r1: GLOBALMV (spec 7.10.2.1) -- the same | |
| 1458 | - // `gm_get_motion_vector` value the 16x16+ leaf reads out of | |
| 1459 | - // its own `gm_table`, computed at this block's centre. | |
| 1460 | - hit!(GLOBALMV_HITS_8); | |
| 1461 | 1425 | gm_table[(ref_frame - LAST_FRAME) as usize] |
| 1462 | 1426 | } else { |
| 1463 | 1427 | let nearest = dec.symbol(&mut cdfs.ref_mv[stack.ref_mv_ctx]) == 0; |
| @@ -1496,7 +1460,6 @@ pub(super) fn decode_inter_block8( | ||
| 1496 | 1460 | // lane-wii r2: same adapting `wedge_index` symbol as the |
| 1497 | 1461 | // 16/32 leaf, fixed sign 0 -- see that site's comment. |
| 1498 | 1462 | let wedge_index = dec.symbol(&mut cdfs.wedge_idx[3]); |
| 1499 | - hit!(WII_HITS); | |
| 1500 | 1463 | wedge_mask = Some(( |
| 1501 | 1464 | crate::wedge::wedge_masks() |
| 1502 | 1465 | .codebook(SIDE, SIDE) |
| @@ -1504,7 +1467,6 @@ pub(super) fn decode_inter_block8( | ||
| 1504 | 1467 | SIDE, |
| 1505 | 1468 | )); |
| 1506 | 1469 | } else { |
| 1507 | - hit!(INTERINTRA_HITS); | |
| 1508 | 1470 | } |
| 1509 | 1471 | interintra_mode = Some(ii); |
| 1510 | 1472 | // The inter-intra predictor reads this block's neighbours as already |
| @@ -1587,12 +1549,6 @@ pub(super) fn decode_inter_block8( | ||
| 1587 | 1549 | proj_ok as u8, warp_eligible as u8, allow_warped_motion as u8 |
| 1588 | 1550 | ); |
| 1589 | 1551 | } |
| 1590 | - if allow_warped_motion && proj_ok && ref_is_scaled { | |
| 1591 | - hit!(SCALED_WARP_SUPPRESSED_HITS); | |
| 1592 | - } | |
| 1593 | - if allow_warped_motion && proj_ok && !ref_is_scaled && force_integer_mv { | |
| 1594 | - hit!(FIMV_ALPHABET_HITS); | |
| 1595 | - } | |
| 1596 | 1552 | if warp_eligible { |
| 1597 | 1553 | crate::msac::SymbolDecoder::set_symr_cdf("motion_mode"); |
| 1598 | 1554 | let mode = dec.symbol(&mut cdfs.motion_mode[0]); |
| @@ -1600,19 +1556,8 @@ pub(super) fn decode_inter_block8( | ||
| 1600 | 1556 | 0 => {} |
| 1601 | 1557 | 1 => { |
| 1602 | 1558 | obmc_selected = true; |
| 1603 | - hit!(OBMC_HITS); | |
| 1604 | - hit!(OBMC_HITS_8); | |
| 1605 | 1559 | } |
| 1606 | 1560 | _ => { |
| 1607 | - // lane-gmaffine r1: WARPED_CAUSAL at the 8x8 leaf -- | |
| 1608 | - // the same findSamples -> select_samples -> | |
| 1609 | - // av1_find_projection chain the 16x16+ leaf runs, | |
| 1610 | - // with BLOCK_8X8's own 8x8 model centre; an | |
| 1611 | - // unusable projection falls back to the block's | |
| 1612 | - // translational mv (libaom `av1_find_projection` | |
| 1613 | - // returning 1 leaves `wm_params` invalid and | |
| 1614 | - // `build_inter_predictors` skips the warp). | |
| 1615 | - hit!(WARP_SELECTED_HITS); | |
| 1616 | 1561 | let mut samples = find_samples( |
| 1617 | 1562 | grid, |
| 1618 | 1563 | mi_row, |
| @@ -1637,18 +1582,11 @@ pub(super) fn decode_inter_block8( | ||
| 1637 | 1582 | mi_col as i32, |
| 1638 | 1583 | ); |
| 1639 | 1584 | warped_selected = true; |
| 1640 | - if warp_params.is_some() { | |
| 1641 | - hit!(WARP_HITS_8); | |
| 1642 | - } | |
| 1643 | 1585 | } |
| 1644 | 1586 | } |
| 1645 | 1587 | } else { |
| 1646 | 1588 | // `default_obmc_cdf`'s own index: square bsize 8/16/32/64 -> 0/1/2/3. |
| 1647 | 1589 | obmc_selected = dec.symbol(&mut cdfs.obmc[0]) == 1; |
| 1648 | - if obmc_selected { | |
| 1649 | - hit!(OBMC_HITS); | |
| 1650 | - hit!(OBMC_HITS_8); | |
| 1651 | - } | |
| 1652 | 1590 | } |
| 1653 | 1591 | } |
| 1654 | 1592 | // lane-gmaffine r1: `read_mb_interp_filter` (spec 5.11.26) at the 8x8 |
| @@ -1710,9 +1648,6 @@ pub(super) fn decode_inter_block8( | ||
| 1710 | 1648 | // size predicate baked into `is_global_mv_block`. |
| 1711 | 1649 | if warp_params.is_none() && is_global_mv_block && !force_integer_mv && !gm_ref.invalid { |
| 1712 | 1650 | warp_params = crate::warp::global_warp_params(gm_ref.params); |
| 1713 | - if warp_params.is_some() && gm_ref.model == ec_av1_syntax::WarpModel::Affine { | |
| 1714 | - hit!(AFFINE_GM_HITS); | |
| 1715 | - } | |
| 1716 | 1651 | } |
| 1717 | 1652 | // lane-av112bitw: same lift as the 16x16+ leaf -- a local |
| 1718 | 1653 | // `WARPED_CAUSAL` projection or a global model both leave |
| @@ -1757,9 +1692,6 @@ pub(super) fn decode_inter_block8( | ||
| 1757 | 1692 | // (documented corner-cut above); under a scaled reference the same |
| 1758 | 1693 | // fixed kernel runs through spec 7.11.3.3's scaled walk instead. |
| 1759 | 1694 | let luma_scale = scale_of((ref_width, ref_height), frame_size); |
| 1760 | - if !luma_scale.is_unscaled() { | |
| 1761 | - hit!(SCALED_BLOCK8_HITS); | |
| 1762 | - } | |
| 1763 | 1695 | let obmc = if obmc_selected { |
| 1764 | 1696 | Some(obmc_plan( |
| 1765 | 1697 | grid, |
| @@ -2211,19 +2143,6 @@ pub(super) fn decode_inter_block8( | ||
| 2211 | 2143 | } else { |
| 2212 | 2144 | 0 |
| 2213 | 2145 | }; |
| 2214 | - if angle_delta_y != 0 { | |
| 2215 | - hit!(INTRA_IN_INTER_ANGLE_DELTA_Y_HITS); | |
| 2216 | - // lane-leaf8tx r1: `av1_use_angle_delta(BLOCK_8X8)` is true | |
| 2217 | - // (`bsize >= BLOCK_8X8`), so this leaf codes `angle_delta_y` off | |
| 2218 | - // `angle_delta_cdf[mode - V_PRED]` exactly as a key-frame block | |
| 2219 | - // does (libaom `read_intra_angle_info` inside | |
| 2220 | - // `read_intra_block_mode_info`, decodemv.c), and the delta feeds | |
| 2221 | - // the directional predictor + the edge filter/upsample decision | |
| 2222 | - // through the same `reconstruct` argument below. Counted | |
| 2223 | - // separately from the >=16x16 arm so the gate cannot be satisfied | |
| 2224 | - // by a bigger block. | |
| 2225 | - hit!(INTRA_IN_INTER8_ANGLE_DELTA_Y_HITS); | |
| 2226 | - } | |
| 2227 | 2146 | // lane-uv8 r1: the delta'd angle decides the intra edge filter, and a |
| 2228 | 2147 | // directional luma mode is already legal on this leaf -- the arm |
| 2229 | 2148 | // passed a hardcoded `false` where [`decode_leaf8`] reads the |
| @@ -2268,27 +2187,16 @@ pub(super) fn decode_inter_block8( | ||
| 2268 | 2187 | dec.debug_state().0 |
| 2269 | 2188 | ); |
| 2270 | 2189 | } |
| 2271 | - if (9..=12).contains(&uv_mode) { | |
| 2272 | - hit!(SMOOTH_UV_HITS); | |
| 2273 | - hit!(INTRA_IN_INTER8_UV_SMOOTH_HITS); | |
| 2274 | - } | |
| 2275 | 2190 | let alpha = if has_chroma && uv_mode == UV_CFL_PRED { |
| 2276 | - hit!(INTRA_IN_INTER8_UV_CFL_HITS); | |
| 2277 | 2191 | Some(read_cfl_alphas(dec, cdfs)) |
| 2278 | 2192 | } else { |
| 2279 | 2193 | None |
| 2280 | 2194 | }; |
| 2281 | 2195 | let angle_delta_uv = if (V_PRED..=D67_PRED).contains(&uv_mode) { |
| 2282 | - hit!(DIRECTIONAL_UV_HITS); | |
| 2283 | - hit!(INTRA_IN_INTER8_UV_DIR_HITS); | |
| 2284 | 2196 | read_angle_delta(dec, &mut cdfs.angle_delta[uv_mode - V_PRED]) |
| 2285 | 2197 | } else { |
| 2286 | 2198 | 0 |
| 2287 | 2199 | }; |
| 2288 | - if angle_delta_uv != 0 { | |
| 2289 | - hit!(UV_ANGLE_DELTA_HITS); | |
| 2290 | - hit!(INTRA_IN_INTER_ANGLE_DELTA_UV_HITS); | |
| 2291 | - } | |
| 2292 | 2200 | // `get_uv_mode` (spec 9.3): `UV_CFL_PRED` predicts as `DC_PRED`. |
| 2293 | 2201 | uv_predict_mode = if uv_mode == UV_CFL_PRED { |
| 2294 | 2202 | DC_PRED |
| @@ -2378,8 +2286,6 @@ pub(super) fn decode_inter_block8( | ||
| 2378 | 2286 | ); |
| 2379 | 2287 | } |
| 2380 | 2288 | if use_fi { |
| 2381 | - hit!(FILTER_INTRA_HITS); | |
| 2382 | - hit!(INTRA_IN_INTER_FILTER_INTRA_HITS); | |
| 2383 | 2289 | let fi = dec.symbol(&mut cdfs.filter_intra_mode); |
| 2384 | 2290 | if ec_istep8 { |
| 2385 | 2291 | eprintln!( |
| @@ -2404,15 +2310,6 @@ pub(super) fn decode_inter_block8( | ||
| 2404 | 2310 | palette_onscreen(rmi, cmi, SIDE, SIDE, fctx), |
| 2405 | 2311 | false, |
| 2406 | 2312 | ); |
| 2407 | - hit!(PALETTE_HITS); | |
| 2408 | - hit!(INTRA_IN_INTER_PALETTE_Y_HITS); | |
| 2409 | - hit_do! { | |
| 2410 | - INTER8_PALETTE_HITS.with(|c| { | |
| 2411 | - let mut v = c.get(); | |
| 2412 | - v.0 += 1; | |
| 2413 | - c.set(v); | |
| 2414 | - }); | |
| 2415 | - } | |
| 2416 | 2313 | PaletteY { |
| 2417 | 2314 | size: n, |
| 2418 | 2315 | colors, |
| @@ -2430,15 +2327,6 @@ pub(super) fn decode_inter_block8( | ||
| 2430 | 2327 | (ss_x(fctx), ss_y(fctx)), |
| 2431 | 2328 | ); |
| 2432 | 2329 | let map = decode_color_index_map_wh(dec, cdfs, n, chroma_w, chroma_h, on, true); |
| 2433 | - hit!(PALETTE_UV_HITS); | |
| 2434 | - hit!(INTRA_IN_INTER_PALETTE_UV_HITS); | |
| 2435 | - hit_do! { | |
| 2436 | - INTER8_PALETTE_HITS.with(|c| { | |
| 2437 | - let mut v = c.get(); | |
| 2438 | - v.1 += 1; | |
| 2439 | - c.set(v); | |
| 2440 | - }); | |
| 2441 | - } | |
| 2442 | 2330 | PaletteUv { |
| 2443 | 2331 | size: n, |
| 2444 | 2332 | u_colors, |
| @@ -2525,7 +2413,6 @@ pub(super) fn decode_inter_block8( | ||
| 2525 | 2413 | // (the whole-block buffer would be indexed at the wrong |
| 2526 | 2414 | // stride by the first unit). |
| 2527 | 2415 | if let Some(buf) = &palette_y_buf { |
| 2528 | - hit!(PALETTE_SPLIT_TX_HITS); | |
| 2529 | 2416 | let window: Vec<u16> = (0..tx_px) |
| 2530 | 2417 | .flat_map(|i| { |
| 2531 | 2418 | let base = (row * MI + i) * SIDE + col * MI; |
| @@ -2779,7 +2666,6 @@ pub(super) fn decode_inter_block8( | ||
| 2779 | 2666 | Grid::Own(vo) |
| 2780 | 2667 | }; |
| 2781 | 2668 | chroma_stamped_per_unit = true; |
| 2782 | - hit!(LLINTRA8_CHROMA_WALK_HITS); | |
| 2783 | 2669 | } else { |
| 2784 | 2670 | if let Some((ub, _)) = &palette_uv_bufs { |
| 2785 | 2671 | set_palette_pred(ub.clone(), fctx); |
| @@ -2986,18 +2872,6 @@ pub(super) fn decode_inter_block8( | ||
| 2986 | 2872 | neighbours.above[leaf_mi.1 + cell][0] = state; |
| 2987 | 2873 | } |
| 2988 | 2874 | } |
| 2989 | - // lane-gmaffine r2: the deblock grid's ref id is the leaf's OWN reference | |
| 2990 | - // (r1 taught this leaf non-LAST refs; the hardcoded LAST_FRAME made every | |
| 2991 | - // GOLDEN/ALTREF leaf read as LAST at the loop-filter's ref/mv edge test). | |
| 2992 | - // lane-cdef r1: the fall-through twin of the compound arm's skip-band | |
| 2993 | - // write above -- `skip` is one flag for the whole 8x8 leaf (read at | |
| 2994 | - // `decode.rs`'s `skip_ctx` site), `split8` only splits its transform. | |
| 2995 | - // lane-intersub8 r5: ... and it counts too. r1 incremented the counter in | |
| 2996 | - // the COMPOUND early-return arm only, so the gate's assert really read | |
| 2997 | - // "a COMPOUND 8x8 leaf wrote the band"; once main's inter16ab/r14 routing | |
| 2998 | - // landed, the 10-bit cq12 arm's leaves come through here instead and the | |
| 2999 | - // gate failed on an instrumentation gap, with the band written either way. | |
| 3000 | - hit!(INTER8_SKIP_BAND_HITS); | |
| 3001 | 2875 | neighbours.fill_skip_grid(leaf_mi, 2, skip); |
| 3002 | 2876 | neighbours.fill_lf_grid( |
| 3003 | 2877 | leaf_mi, |
crates/ec-av1/src/decode/inter_ctx.rsmodified+0 -51
| @@ -83,9 +83,6 @@ pub(super) fn resolve_interp_filter( | ||
| 83 | 83 | } else { |
| 84 | 84 | sym0 |
| 85 | 85 | }; |
| 86 | - if enable_dual_filter && sym0 != sym1 { | |
| 87 | - hit!(DUAL_FILTER_DIFF_HITS); | |
| 88 | - } | |
| 89 | 86 | if crate::envflags::env_flag!("EC_TRACE_MODE") { |
| 90 | 87 | eprintln!( |
| 91 | 88 | "EC_IF ctx0={ctx0} above={above:?} left={left:?} sym0={sym0} sym1={sym1} rng={}", |
| @@ -484,8 +481,6 @@ pub(super) fn read_inter_plane( | ||
| 484 | 481 | if plane_idx > 0 && mono(fctx) { |
| 485 | 482 | return Ok((Grid::Zero(side * side), TxType::DctDct)); |
| 486 | 483 | } |
| 487 | - // lane-av1readcensus: the units read from here on are this plane's. | |
| 488 | - set_census_plane(plane_idx); | |
| 489 | 484 | let skip_ctx = if plane_idx == 0 { |
| 490 | 485 | luma_skip_ctx.unwrap_or(0) |
| 491 | 486 | } else { |
| @@ -678,7 +673,6 @@ pub(super) fn read_intra_chroma_lossless( | ||
| 678 | 673 | plane_idx, |
| 679 | 674 | &cu_grid, |
| 680 | 675 | ); |
| 681 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 682 | 676 | let dst = mu_units( |
| 683 | 677 | if plane_idx == 1 { |
| 684 | 678 | &mut *u_out |
| @@ -737,9 +731,6 @@ pub(super) fn mu_chunk_order( | ||
| 737 | 731 | let mut order = identity.clone(); |
| 738 | 732 | order.sort_by_key(|&i| ((leaves[i].0 / 16) * nchunk + (leaves[i].1 / 16), i)); |
| 739 | 733 | let changed = order != identity; |
| 740 | - if changed { | |
| 741 | - hit!(MU_CHUNK_ORDER_HITS); | |
| 742 | - } | |
| 743 | 734 | (order, changed) |
| 744 | 735 | } |
| 745 | 736 | |
| @@ -788,9 +779,6 @@ pub(super) fn read_inter_chroma_lossless( | ||
| 788 | 779 | // libaom walks one 64x64 mu chunk at a time. Counted so a gate can pin |
| 789 | 780 | // the walk/unit totals exactly rather than as a floor on wrong output. |
| 790 | 781 | let counted_128 = blk_w > 64 || blk_h > 64; |
| 791 | - if counted_128 { | |
| 792 | - hit!(MU_CHUNK_WALKS); | |
| 793 | - } | |
| 794 | 782 | for plane_idx in 1..3 { |
| 795 | 783 | for rr in 0..reg_h / 4 { |
| 796 | 784 | for cc in 0..reg_w / 4 { |
| @@ -850,10 +838,6 @@ pub(super) fn read_inter_chroma_lossless( | ||
| 850 | 838 | plane_idx, |
| 851 | 839 | &cu_grid, |
| 852 | 840 | ); |
| 853 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 854 | - if counted_128 { | |
| 855 | - hit!(MU_CHUNK_WALK_UNITS); | |
| 856 | - } | |
| 857 | 841 | let dst = mu_units( |
| 858 | 842 | if plane_idx == 1 { |
| 859 | 843 | &mut *u_out |
| @@ -1018,17 +1002,6 @@ pub(super) fn read_single_ref( | ||
| 1018 | 1002 | } |
| 1019 | 1003 | }; |
| 1020 | 1004 | if ref_frame != LAST_FRAME { |
| 1021 | - hit!(NON_LAST_REF_HITS); | |
| 1022 | - let c = match ref_frame { | |
| 1023 | - LAST2_FRAME => &LAST2_HITS, | |
| 1024 | - LAST3_FRAME => &LAST3_HITS, | |
| 1025 | - GOLDEN_FRAME => &GOLDEN_HITS, | |
| 1026 | - BWDREF_FRAME => &BWDREF_HITS, | |
| 1027 | - ALTREF2_FRAME => &ALTREF2_HITS, | |
| 1028 | - ALTREF_FRAME => &ALTREF_HITS, | |
| 1029 | - _ => unreachable!("read_single_ref only ever returns LAST_FRAME..=ALTREF_FRAME"), | |
| 1030 | - }; | |
| 1031 | - hit_do! { c.with(|v| v.set(v.get() + 1)); } | |
| 1032 | 1005 | } |
| 1033 | 1006 | ref_frame |
| 1034 | 1007 | } |
| @@ -1405,9 +1378,6 @@ pub(super) fn overlappable_above( | ||
| 1405 | 1378 | if let Some(info) = nb |
| 1406 | 1379 | && info.is_inter |
| 1407 | 1380 | { |
| 1408 | - if src != col { | |
| 1409 | - hit!(OBMC_PAIR_FILTER_HITS); | |
| 1410 | - } | |
| 1411 | 1381 | // lane-t900 r14: libaom passes `AOMMIN(xd->width, mi_step)` |
| 1412 | 1382 | // as `op_mi_size` -- the block's OWN width, never the |
| 1413 | 1383 | // frame-edge clamp `end_col` carries. Clamping here shrank the |
| @@ -1472,9 +1442,6 @@ pub(super) fn overlappable_left( | ||
| 1472 | 1442 | if let Some(info) = nb |
| 1473 | 1443 | && info.is_inter |
| 1474 | 1444 | { |
| 1475 | - if src != row { | |
| 1476 | - hit!(OBMC_PAIR_FILTER_HITS); | |
| 1477 | - } | |
| 1478 | 1445 | // lane-t900 r14: `AOMMIN(xd->height, mi_step)` -- see |
| 1479 | 1446 | // `overlappable_above`. |
| 1480 | 1447 | out.push(( |
| @@ -1681,9 +1648,6 @@ pub(crate) fn find_samples( | ||
| 1681 | 1648 | // libaom reads the 2-symbol `obmc_cdf` (class |
| 1682 | 1649 | // wrong-alphabet-same-value). |
| 1683 | 1650 | let tr_reach = crate::mvstack::has_top_right(mi_row, mi_col, bw4, bh4, fctx); |
| 1684 | - if do_tr && bw4 != bh4 && tr_reach != has_top_right(mi_row, mi_col, bw4, fctx) { | |
| 1685 | - hit!(TR_REACH_LONGER_SIDE_HITS); | |
| 1686 | - } | |
| 1687 | 1651 | if do_tr && tr_reach { |
| 1688 | 1652 | let tr_col = mi_col + bw4; |
| 1689 | 1653 | if mi_row > 0 |
| @@ -1784,7 +1748,6 @@ pub(super) fn neighbour_filter( | ||
| 1784 | 1748 | "an OBMC neighbour whose switchable interp filter was never recorded", |
| 1785 | 1749 | )); |
| 1786 | 1750 | } |
| 1787 | - hit!(OBMC_FILTER_BAND_READS); | |
| 1788 | 1751 | Ok(( |
| 1789 | 1752 | mc::InterpFilterKind::from_switchable_symbol(sym[1] as usize), |
| 1790 | 1753 | mc::InterpFilterKind::from_switchable_symbol(sym[0] as usize), |
| @@ -2200,9 +2163,6 @@ pub(crate) fn obmc_plan( | ||
| 2200 | 2163 | // lane-inter4 r4: r3 refused OBMC on a 16x8/8x16 leaf; re-measured |
| 2201 | 2164 | // byte-exact against an instrumented aomdec, the refusal is gone and the |
| 2202 | 2165 | // counter below is what the gate's `--enable-obmc=1` arm reads. |
| 2203 | - if matches!((write_w, write_h), (16, 8) | (8, 16)) { | |
| 2204 | - hit!(OBMC_RECT_LEAF_HITS); | |
| 2205 | - } | |
| 2206 | 2166 | // lane-sb128c r1: libaom caps the overlap strip at a 64x64 block's own |
| 2207 | 2167 | // half (`reconinter.c` 860/899), inert below 128. |
| 2208 | 2168 | let overlap_above = write_h.min(64) / 2; |
| @@ -2250,9 +2210,6 @@ pub(crate) fn obmc_plan( | ||
| 2250 | 2210 | "above", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind, |
| 2251 | 2211 | ); |
| 2252 | 2212 | let nb_dims = ref_dims(nb.ref_frame, refpix)?; |
| 2253 | - if mi_col + off4 + span4 > mi_cols { | |
| 2254 | - hit!(OBMC_EDGE_SPAN_HITS); | |
| 2255 | - } | |
| 2256 | 2213 | above.push(ObmcNb { |
| 2257 | 2214 | off4, |
| 2258 | 2215 | span4, |
| @@ -2286,9 +2243,6 @@ pub(crate) fn obmc_plan( | ||
| 2286 | 2243 | "left", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind, |
| 2287 | 2244 | ); |
| 2288 | 2245 | let nb_dims = ref_dims(nb.ref_frame, refpix)?; |
| 2289 | - if mi_row + off4 + span4 > mi_rows { | |
| 2290 | - hit!(OBMC_EDGE_SPAN_HITS); | |
| 2291 | - } | |
| 2292 | 2246 | left.push(ObmcNb { |
| 2293 | 2247 | off4, |
| 2294 | 2248 | span4, |
| @@ -2722,9 +2676,6 @@ pub(super) fn read_comp_mode( | ||
| 2722 | 2676 | dec.debug_state().0 |
| 2723 | 2677 | ); |
| 2724 | 2678 | } |
| 2725 | - if compound { | |
| 2726 | - hit!(COMP_MODE_HITS); | |
| 2727 | - } | |
| 2728 | 2679 | compound |
| 2729 | 2680 | } |
| 2730 | 2681 | |
| @@ -2766,7 +2717,6 @@ pub(super) fn read_compound_ref_frames( | ||
| 2766 | 2717 | let type_ctx = comp_reference_type_ctx(above, left); |
| 2767 | 2718 | let unidir = dec.symbol(&mut cdfs.comp_ref_type[type_ctx]) == 0; |
| 2768 | 2719 | if unidir { |
| 2769 | - hit!(UNI_COMP_HITS); | |
| 2770 | 2720 | // uni_comp_ref (p0): forward vs. backward -- av1_get_pred_context_- |
| 2771 | 2721 | // uni_comp_ref_p is single_ref_p1's own forward/backward vote. |
| 2772 | 2722 | let bit = dec.symbol(&mut cdfs.uni_comp_ref[single_ref_p1_ctx(a, a1, l, l1)][0]); |
| @@ -2828,7 +2778,6 @@ pub(super) fn read_inter_compound_mode( | ||
| 2828 | 2778 | ref_mv_ctx: usize, |
| 2829 | 2779 | ) -> u8 { |
| 2830 | 2780 | let ctx = cdf::COMPOUND_MODE_CTX_MAP[ref_mv_ctx >> 1][new_mv_ctx.min(4)]; |
| 2831 | - hit!(COMPOUND_MODE_HITS); | |
| 2832 | 2781 | dec.symbol(&mut cdfs.inter_compound_mode[ctx]) as u8 |
| 2833 | 2782 | } |
| 2834 | 2783 |
crates/ec-av1/src/decode/inter_intra_arm.rsmodified+0 -34
| @@ -241,9 +241,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 241 | 241 | } else { |
| 242 | 242 | 0 |
| 243 | 243 | }; |
| 244 | - if angle_delta_y != 0 { | |
| 245 | - hit!(INTRA_IN_INTER_ANGLE_DELTA_Y_HITS); | |
| 246 | - } | |
| 247 | 244 | // The delta'd angle decides whether the intra edge filter runs at |
| 248 | 245 | // all, so this block needs the same luma edge-filter-type neighbour |
| 249 | 246 | // check a key-frame block does (`get_intra_edge_filter_type`, spec |
| @@ -263,9 +260,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 263 | 260 | // (libaom `decodemv.c:933`). |
| 264 | 261 | let has_chroma = !mono(fctx); |
| 265 | 262 | let cfl_allowed = has_chroma && cfl_allowed_px(write_w, write_h, fctx); |
| 266 | - if !cfl_allowed { | |
| 267 | - hit!(NOCFL_UV_MODE_HITS); | |
| 268 | - } | |
| 269 | 263 | let uv_mode = if !has_chroma { |
| 270 | 264 | DC_PRED |
| 271 | 265 | } else if cfl_allowed { |
| @@ -275,9 +269,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 275 | 269 | crate::msac::SymbolDecoder::set_symr_cdf("uv_mode"); |
| 276 | 270 | dec.symbol(&mut cdfs.uv_mode_no_cfl[mode]) |
| 277 | 271 | }; |
| 278 | - if (9..=12).contains(&uv_mode) { | |
| 279 | - hit!(SMOOTH_UV_HITS); | |
| 280 | - } | |
| 281 | 272 | let alpha = if cfl_allowed && uv_mode == UV_CFL_PRED { |
| 282 | 273 | Some(read_cfl_alphas(dec, cdfs)) |
| 283 | 274 | } else { |
| @@ -288,15 +279,10 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 288 | 279 | // -- `uv_mode` (13) already falls outside `V_PRED..=D67_PRED` so the |
| 289 | 280 | // `else` branch below is exact for it either way. |
| 290 | 281 | let angle_delta_uv = if (V_PRED..=D67_PRED).contains(&uv_mode) { |
| 291 | - hit!(DIRECTIONAL_UV_HITS); | |
| 292 | 282 | read_angle_delta(dec, &mut cdfs.angle_delta[uv_mode - V_PRED]) |
| 293 | 283 | } else { |
| 294 | 284 | 0 |
| 295 | 285 | }; |
| 296 | - if angle_delta_uv != 0 { | |
| 297 | - hit!(UV_ANGLE_DELTA_HITS); | |
| 298 | - hit!(INTRA_IN_INTER_ANGLE_DELTA_UV_HITS); | |
| 299 | - } | |
| 300 | 286 | uv_predict_mode = if uv_mode == UV_CFL_PRED { |
| 301 | 287 | DC_PRED |
| 302 | 288 | } else { |
| @@ -379,8 +365,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 379 | 365 | && let Some(class) = filter_intra_size_class_rect(write_w, write_h) |
| 380 | 366 | && dec.symbol(&mut cdfs.filter_intra[class]) != 0 |
| 381 | 367 | { |
| 382 | - hit!(FILTER_INTRA_HITS); | |
| 383 | - hit!(INTRA_IN_INTER_FILTER_INTRA_HITS); | |
| 384 | 368 | filter_intra = Some(dec.symbol(&mut cdfs.filter_intra_mode)); |
| 385 | 369 | } |
| 386 | 370 | // `av1_visit_palette`: the two colour-index maps, Y then the shared |
| @@ -395,8 +379,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 395 | 379 | palette_onscreen(rmi, cmi, write_w, write_h, fctx), |
| 396 | 380 | false, |
| 397 | 381 | ); |
| 398 | - hit!(PALETTE_HITS); | |
| 399 | - hit!(INTRA_IN_INTER_PALETTE_Y_HITS); | |
| 400 | 382 | PaletteY { |
| 401 | 383 | size: n, |
| 402 | 384 | colors, |
| @@ -419,8 +401,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 419 | 401 | (ss_x(fctx), ss_y(fctx)), |
| 420 | 402 | ); |
| 421 | 403 | let map = decode_color_index_map_wh(dec, cdfs, n, cw, ch, on, true); |
| 422 | - hit!(PALETTE_UV_HITS); | |
| 423 | - hit!(INTRA_IN_INTER_PALETTE_UV_HITS); | |
| 424 | 404 | PaletteUv { |
| 425 | 405 | size: n, |
| 426 | 406 | u_colors, |
| @@ -516,7 +496,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 516 | 496 | // (the whole-block buffer would be indexed at the wrong |
| 517 | 497 | // stride by the first unit). |
| 518 | 498 | if let Some(buf) = &palette_y_buf { |
| 519 | - hit!(PALETTE_SPLIT_TX_HITS); | |
| 520 | 499 | let window: Vec<u16> = (0..tx_px) |
| 521 | 500 | .flat_map(|i| { |
| 522 | 501 | let base = (row * MI + i) * side + col * MI; |
| @@ -588,7 +567,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 588 | 567 | continue; |
| 589 | 568 | } |
| 590 | 569 | let (cr, cc) = chunk; |
| 591 | - hit!(INTRA_128_IN_INTER_MU_CHROMA_HITS); | |
| 592 | 570 | // The unit's CHROMA size, its LUMA footprint, the |
| 593 | 571 | // CHUNK's chroma extent and the unit's ORIGIN inside the |
| 594 | 572 | // chunk are four different quantities; this arm had the |
| @@ -785,7 +763,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 785 | 763 | plane_idx, |
| 786 | 764 | &cu_grid, |
| 787 | 765 | ); |
| 788 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 789 | 766 | // lane-dpm1: the two INTER mu-chunk sites set |
| 790 | 767 | // this and this INTRA-in-inter one did not, so |
| 791 | 768 | // the whole-block chroma record below re-stamped |
| @@ -794,9 +771,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 794 | 771 | // libaom never selects (class |
| 795 | 772 | // `override-slot-on-one-arm`). |
| 796 | 773 | mu_chroma = true; |
| 797 | - // lane-av1muchunk422b: the allocation of the intra-in-inter | |
| 798 | - // mu-chunk walk (site 8), per TX_32X32 unit. | |
| 799 | - hit!(MU_CHUNK_INTRA_IN_INTER_UNITS); | |
| 800 | 774 | let dst = mu_units( |
| 801 | 775 | if plane_idx == 1 { |
| 802 | 776 | &mut u_units |
| @@ -846,7 +820,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 846 | 820 | } else { |
| 847 | 821 | Grid::Own(std::mem::take(&mut v_units)) |
| 848 | 822 | }; |
| 849 | - hit!(INTRA_128_IN_INTER_HITS); | |
| 850 | 823 | } else if skip { |
| 851 | 824 | if !split_luma { |
| 852 | 825 | if let Some(buf) = &palette_y_buf { |
| @@ -1072,7 +1045,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 1072 | 1045 | // coefficient context. |
| 1073 | 1046 | neighbours |
| 1074 | 1047 | .record_mi_chroma(cu_mi, chroma_tx, chroma_tx, plane_idx, &cu_grid); |
| 1075 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 1076 | 1048 | let acc = if plane_idx == 1 { |
| 1077 | 1049 | &mut u_acc |
| 1078 | 1050 | } else { |
| @@ -1181,7 +1153,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 1181 | 1153 | fctx, |
| 1182 | 1154 | ); |
| 1183 | 1155 | } |
| 1184 | - hit!(PALETTE_422_UNIT_WINDOW_HITS); | |
| 1185 | 1156 | let cu_grid = read_plane( |
| 1186 | 1157 | dec, |
| 1187 | 1158 | cdfs, |
| @@ -1210,8 +1181,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 1210 | 1181 | smooth_neighbor_uv, |
| 1211 | 1182 | fctx, |
| 1212 | 1183 | )?; |
| 1213 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 1214 | - hit!(CHROMA422_SQUARE_HITS); | |
| 1215 | 1184 | // Immediately, so the next unit of this plane reads this |
| 1216 | 1185 | // one's coefficient context; the whole-block record below |
| 1217 | 1186 | // re-stamps the block over these and the tail's |
| @@ -1322,7 +1291,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 1322 | 1291 | fctx, |
| 1323 | 1292 | ); |
| 1324 | 1293 | } |
| 1325 | - hit!(PALETTE_422_UNIT_WINDOW_HITS); | |
| 1326 | 1294 | let cu_grid = read_plane( |
| 1327 | 1295 | dec, |
| 1328 | 1296 | cdfs, |
| @@ -1348,8 +1316,6 @@ pub(super) fn decode_inter_block_intra_arm( | ||
| 1348 | 1316 | smooth_neighbor_uv, |
| 1349 | 1317 | fctx, |
| 1350 | 1318 | )?; |
| 1351 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 1352 | - hit!(CHROMA422_SQUARE_HITS); | |
| 1353 | 1319 | neighbours.record_mi_chroma(cu_mi, luma_span_x, luma_span_y, 2, &cu_grid); |
| 1354 | 1320 | for rr in 0..cu_h { |
| 1355 | 1321 | let start = (cu_row * cu_h + rr) * chroma_side; |
crates/ec-av1/src/decode/inter_shapes.rsmodified+0 -61
| @@ -107,9 +107,6 @@ pub(super) fn read_block_tx_size( | ||
| 107 | 107 | let overwrote = !fctx.intra_only.with(std::cell::Cell::get) |
| 108 | 108 | && (0..side_mi).any(|i| n.above_txfm.get(at_mi.1 + i) != Some(&pub_above)); |
| 109 | 109 | set_txfm_ctxs(n, at_mi, 4, side_mi, side_mi, skip && is_inter); |
| 110 | - if overwrote { | |
| 111 | - hit!(LOSSLESS_SQ_TXFM_BAND_OVERWRITE_HITS); | |
| 112 | - } | |
| 113 | 110 | return Ok((4, Some(leaves))); |
| 114 | 111 | } |
| 115 | 112 | if !fctx.tx_select_inter.with(std::cell::Cell::get) { |
| @@ -194,13 +191,6 @@ pub(super) fn read_block_tx_size( | ||
| 194 | 191 | leaves.push((row, col, tx, tx)); |
| 195 | 192 | } |
| 196 | 193 | } |
| 197 | - hit_do! { | |
| 198 | - INTRA_IN_INTER_SPLIT_TX_HITS.with(|c| { | |
| 199 | - let mut h = c.get(); | |
| 200 | - h[(side.trailing_zeros() as usize).saturating_sub(3).min(3)] += 1; | |
| 201 | - c.set(h); | |
| 202 | - }); | |
| 203 | - } | |
| 204 | 194 | return Ok((tx, Some(leaves))); |
| 205 | 195 | } |
| 206 | 196 | Ok((tx, None)) |
| @@ -674,7 +664,6 @@ pub(super) fn read_block_tx_size_rect( | ||
| 674 | 664 | // transform, and `set_txfm_ctxs` records exactly what |
| 675 | 665 | // `txfm_partition_update` would for that same unit. |
| 676 | 666 | txfm_partition_update_rect(n, at_mi, (tx_w, tx_h), (bw, bh)); |
| 677 | - hit!(RECT_INTER_TU_HITS); | |
| 678 | 667 | return Ok(None); |
| 679 | 668 | } |
| 680 | 669 | // lane-av1oddheightfork2: `above_px` / `left_px` are the two |
| @@ -686,7 +675,6 @@ pub(super) fn read_block_tx_size_rect( | ||
| 686 | 675 | let (above_px, left_px) = (n.above_txfm[at_mi.1], n.left_txfm[at_mi.0]); |
| 687 | 676 | let ctx = txfm_partition_ctx_rect(above_px, left_px, bw.max(bh), tx_w, tx_h); |
| 688 | 677 | let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1; |
| 689 | - hit!(TXFM_SPLIT_READS); | |
| 690 | 678 | if crate::envflags::env_flag!("EC_TRACE_MODE_STEP") { |
| 691 | 679 | let (rng, _) = dec.debug_state(); |
| 692 | 680 | eprintln!( |
| @@ -699,11 +687,8 @@ pub(super) fn read_block_tx_size_rect( | ||
| 699 | 687 | } |
| 700 | 688 | if !split { |
| 701 | 689 | txfm_partition_update_rect(n, at_mi, (tx_w, tx_h), (bw, bh)); |
| 702 | - hit!(RECT_INTER_TU_HITS); | |
| 703 | 690 | return Ok(None); |
| 704 | 691 | } |
| 705 | - hit!(TXFM_SPLIT_HITS); | |
| 706 | - hit!(RECT_INTER_TXSPLIT_HITS); | |
| 707 | 692 | // lane-r14 r3: `sub_tx_size_map` (libaom `common_data.c`) stays |
| 708 | 693 | // RECTANGULAR under a 1:4 strip -- `[TX_64X16] == TX_32X16`, |
| 709 | 694 | // `[TX_16X64] == TX_16X32` -- so the recursion below is the general |
| @@ -815,7 +800,6 @@ pub(super) fn read_inter_rect_chroma( | ||
| 815 | 800 | // replay (the c8 re-stamp, at the strip's own tiling). |
| 816 | 801 | let mut units: Vec<((usize, usize), usize, Grid, usize, usize)> = Vec::new(); |
| 817 | 802 | if multi { |
| 818 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 819 | 803 | assembled = [ |
| 820 | 804 | vec![0i32; chroma_side * assembled_h], |
| 821 | 805 | vec![0i32; chroma_side * assembled_h], |
| @@ -852,35 +836,8 @@ pub(super) fn read_inter_rect_chroma( | ||
| 852 | 836 | let cu_pred = src.offset(cu_row * uh * chroma_side + cu_col * uw); |
| 853 | 837 | let inherit_tx_type = |
| 854 | 838 | if let Some(t) = covering_leaf_tx_type(leaf_tx_types, unit_rel_mi) { |
| 855 | - hit!(CHROMA_RECT_LEAF_TX_HITS); | |
| 856 | - if Some(t) != Some(luma_tx_type) { | |
| 857 | - hit!(CHROMA_RECT_LEAF_TX_DIFF_HITS); | |
| 858 | - } | |
| 859 | 839 | Some(t) |
| 860 | 840 | } else { |
| 861 | - // lane-av1ichromatx: the ONE remaining site in | |
| 862 | - // `decode_inter_block` that can hand a chroma unit a | |
| 863 | - // BLOCK-level type on a split plane. `covering_leaf_tx_ | |
| 864 | - // type` found nothing, i.e. no luma leaf covers this | |
| 865 | - // unit's own MI cell -- which is exactly the shape a | |
| 866 | - // block that coded a SINGLE luma transform has (its | |
| 867 | - // leaf list is empty, so every lookup misses). For | |
| 868 | - // that block `luma_tx_type` IS the type of the one | |
| 869 | - // luma unit whose stamp covers the whole plane, so the | |
| 870 | - // fallback is correct there. | |
| 871 | - // | |
| 872 | - // What is NOT correct is a fallback on a plane with | |
| 873 | - // `leaves` NON-empty: then some luma leaf does exist, | |
| 874 | - // it simply does not cover this unit's cell, and the | |
| 875 | - // block-level value is a DIFFERENT leaf's type. The | |
| 876 | - // assertion below is what closes that shape, so the | |
| 877 | - // fallback can never again be a silent mistype: the | |
| 878 | - // class is "block-level where the unit's own cell | |
| 879 | - // says otherwise", and this is its last site. | |
| 880 | - hit!(CHROMA_RECT_BLOCK_TX_FALLBACK); | |
| 881 | - if multi { | |
| 882 | - hit!(CHROMA_RECT_BLOCK_TX_FALLBACK_MULTI); | |
| 883 | - } | |
| 884 | 841 | debug_assert!( |
| 885 | 842 | leaf_tx_types.is_empty(), |
| 886 | 843 | "lane-av1ichromatx: a multi-unit rect chroma plane fell back to the \ |
| @@ -911,9 +868,6 @@ pub(super) fn read_inter_rect_chroma( | ||
| 911 | 868 | fctx, |
| 912 | 869 | )? |
| 913 | 870 | .0; |
| 914 | - if invalid_ss_plane { | |
| 915 | - hit!(CHROMA422_CHUNK_HITS); | |
| 916 | - } | |
| 917 | 871 | if multi { |
| 918 | 872 | // Immediately, so the next unit of this block reads this |
| 919 | 873 | // one's coefficient context (libaom updates the chroma |
| @@ -975,8 +929,6 @@ pub(super) fn read_inter_plane_rect( | ||
| 975 | 929 | if plane_idx > 0 && mono(fctx) { |
| 976 | 930 | return Ok((Grid::Zero(w * h), TxType::DctDct)); |
| 977 | 931 | } |
| 978 | - // lane-av1readcensus: the units read from here on are this plane's. | |
| 979 | - set_census_plane(plane_idx); | |
| 980 | 932 | let skip_ctx = if plane_idx == 0 { |
| 981 | 933 | // `get_txb_ctx_general`: 0 only when this unit IS the whole plane |
| 982 | 934 | // block; a var-tx leaf passes its own neighbour-table context. |
| @@ -1020,18 +972,6 @@ pub(super) fn read_inter_plane_rect( | ||
| 1020 | 972 | // because `av1_nz_map_ctx_offset` is indexed by the real, un-adjusted |
| 1021 | 973 | // rectangular shape (lane-sbpart r8). |
| 1022 | 974 | let (cw, ch) = (w.min(32), h.min(32)); |
| 1023 | - if plane_idx == 0 && w.max(h) == 64 { | |
| 1024 | - hit!(RECT64_INTER_TU_HITS); | |
| 1025 | - } | |
| 1026 | - if plane_idx == 0 && (w, h) == (32, 8) || plane_idx == 0 && (w, h) == (8, 32) { | |
| 1027 | - hit_do! { | |
| 1028 | - RECT32X8_INTER_TU_HITS.with(|c| { | |
| 1029 | - let mut v = c.get(); | |
| 1030 | - v[usize::from(w == 8)] += 1; | |
| 1031 | - c.set(v); | |
| 1032 | - }); | |
| 1033 | - } | |
| 1034 | - } | |
| 1035 | 975 | let (corner, tx_type) = if (cw, ch) == (32, 32) { |
| 1036 | 976 | let scan32 = default_scan(TX32); |
| 1037 | 977 | read_coeffs( |
| @@ -1706,6 +1646,5 @@ pub(super) fn edge_params_body( | ||
| 1706 | 1646 | [4, 8, 14, 14, 14][dim] |
| 1707 | 1647 | }; |
| 1708 | 1648 | let level = if cur_level != 0 { cur_level } else { pv_level }; |
| 1709 | - hit!(DEBLOCK_HITS); | |
| 1710 | 1649 | Some((len, level)) |
| 1711 | 1650 | } |
crates/ec-av1/src/decode/key_tile.rsmodified+0 -75
| @@ -328,26 +328,17 @@ pub(super) fn read_sb128_root( | ||
| 328 | 328 | let ctx128 = neighbours.partition_ctx(at128, 128); |
| 329 | 329 | let (has_cols128, has_rows128) = (mi_c128 + SB_MI < mi_cols, mi_r128 + SB_MI < mi_rows); |
| 330 | 330 | let part128 = if has_cols128 && has_rows128 { |
| 331 | - hit!(PART128_SYMBOLS); | |
| 332 | 331 | let p = dec.symbol(&mut cdfs.partition_w128[ctx128]); |
| 333 | 332 | if crate::envflags::env_flag!("EC_AV1_TRACE") { |
| 334 | 333 | eprintln!("TRACE partition_w128 ctx={ctx128} value={p}"); |
| 335 | 334 | } |
| 336 | 335 | p |
| 337 | 336 | } else { |
| 338 | - // lane-sb128 r4: the gathered half-out-of-frame reads DECIDE the | |
| 339 | - // partition, they are not a forced split -- exactly the discarded-bit | |
| 340 | - // defect the 64 root carries a comment about at `partition_w64`'s | |
| 341 | - // gathered arm. Value 1 is SPLIT; 0 is HORZ (rows out of frame) or | |
| 342 | - // VERT (cols out of frame), which the refusal below then names | |
| 343 | - // instead of silently reconstructing a split. | |
| 344 | - hit!(PART128_GATHERED_SYMBOLS); | |
| 345 | 337 | match (has_cols128, has_rows128) { |
| 346 | 338 | (true, false) => { |
| 347 | 339 | if dec.symbol_fixed(&gather_of(&cdfs.partition_w128[ctx128], &VERT_ALIKE128)) == 1 { |
| 348 | 340 | PARTITION_SPLIT |
| 349 | 341 | } else { |
| 350 | - hit!(PART128_EDGE_HORZ_HITS); | |
| 351 | 342 | PARTITION_HORZ |
| 352 | 343 | } |
| 353 | 344 | } |
| @@ -355,7 +346,6 @@ pub(super) fn read_sb128_root( | ||
| 355 | 346 | if dec.symbol_fixed(&gather_of(&cdfs.partition_w128[ctx128], &HORZ_ALIKE128)) == 1 { |
| 356 | 347 | PARTITION_SPLIT |
| 357 | 348 | } else { |
| 358 | - hit!(PART128_EDGE_VERT_HITS); | |
| 359 | 349 | PARTITION_VERT |
| 360 | 350 | } |
| 361 | 351 | } |
| @@ -383,21 +373,10 @@ pub(super) fn read_sb128_root( | ||
| 383 | 373 | // decoding untouched. |
| 384 | 374 | refuse_invalid_subsize((128, 128), part128, fctx)?; |
| 385 | 375 | match part128 { |
| 386 | - PARTITION_SPLIT => hit!(PART128_SPLIT_HITS), | |
| 387 | - PARTITION_NONE => hit!(PART128_NONE_HITS), | |
| 388 | - PARTITION_HORZ => hit!(PART128_HORZ_HITS), | |
| 389 | - PARTITION_VERT => hit!(PART128_VERT_HITS), | |
| 390 | 376 | // lane-sb128c r9: the four AB shapes at the 128 root -- one |
| 391 | 377 | // 128x64/64x128 half plus two 64x64 quadrants, decoded by both tile |
| 392 | 378 | // paths below in libaom `decode_partition`'s own visit order. |
| 393 | 379 | p if (PARTITION_HORZ_A..=PARTITION_VERT_B).contains(&p) => { |
| 394 | - hit_do! { | |
| 395 | - PART128_AB_HITS.with(|c| { | |
| 396 | - let mut h = c.get(); | |
| 397 | - h[p - PARTITION_HORZ_A] += 1; | |
| 398 | - c.set(h); | |
| 399 | - }); | |
| 400 | - } | |
| 401 | 380 | } |
| 402 | 381 | _ => { |
| 403 | 382 | return Err(unsupported( |
| @@ -633,7 +612,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 633 | 612 | ((mi_col1 as usize * 4) >> ss_x(fctx)).min(v.width), |
| 634 | 613 | ((mi_row1 as usize * 4) >> ss_y(fctx)).min(v.height), |
| 635 | 614 | ); |
| 636 | - hit!(TILE_HITS); | |
| 637 | 615 | |
| 638 | 616 | // lane-sb128b r1: set when the 128 root resolved to `PARTITION_NONE` -- |
| 639 | 617 | // its one block covers all four 64x64 quadrants, so the remaining three |
| @@ -1327,9 +1305,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 1327 | 1305 | // `Reach::vert_ab_partition()` (lane-part32 r5, cherry-picked here). |
| 1328 | 1306 | let arm = part16 - PARTITION_HORZ_A; |
| 1329 | 1307 | bump_ab16(arm); |
| 1330 | - if part16 == PARTITION_VERT_B { | |
| 1331 | - hit!(VERT_B_INTRA_HITS); | |
| 1332 | - } | |
| 1333 | 1308 | let _vert_guard = if part16 == PARTITION_VERT_A |
| 1334 | 1309 | || part16 == PARTITION_VERT_B |
| 1335 | 1310 | { |
| @@ -1448,7 +1423,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 1448 | 1423 | continue; |
| 1449 | 1424 | } |
| 1450 | 1425 | if part16 == PARTITION_HORZ { |
| 1451 | - hit!(HORZ_VERT_INTRA_HITS); | |
| 1452 | 1426 | let (mi_row0, mi_col0) = |
| 1453 | 1427 | (sr as u32 * SUB_MI, sc as u32 * SUB_MI); |
| 1454 | 1428 | let top = (mi_row0 as usize, mi_col0 as usize); |
| @@ -1496,7 +1470,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 1496 | 1470 | continue; |
| 1497 | 1471 | } |
| 1498 | 1472 | if part16 == PARTITION_VERT { |
| 1499 | - hit!(HORZ_VERT_INTRA_HITS); | |
| 1500 | 1473 | let (mi_row0, mi_col0) = |
| 1501 | 1474 | (sr as u32 * SUB_MI, sc as u32 * SUB_MI); |
| 1502 | 1475 | let left = (mi_row0 as usize, mi_col0 as usize); |
| @@ -1815,19 +1788,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 1815 | 1788 | // non-SPLIT edge arm actually decoded. |
| 1816 | 1789 | bump_edge_part(if edge_split == 1 { 3 } else { 2 }); |
| 1817 | 1790 | if edge_split == 0 { |
| 1818 | - // lane-oddh r1: the strip IS decodable | |
| 1819 | - // -- libaom's `decode_partition` codes | |
| 1820 | - // only the FIRST half of an edge | |
| 1821 | - // HORZ/VERT (the second call is | |
| 1822 | - // guarded by the same has_rows/ | |
| 1823 | - // has_cols test that made the | |
| 1824 | - // partition non-square), so one | |
| 1825 | - // 16x8 (resp. 8x16) strip covers the | |
| 1826 | - // whole visible band of a frame whose | |
| 1827 | - // height (resp. width) is 8 mod 16 -- | |
| 1828 | - // the user's 3840x1608 film. | |
| 1829 | - hit!(HORZ_VERT_INTRA_HITS); | |
| 1830 | - hit!(EDGE_RECT_STRIP_HITS); | |
| 1831 | 1791 | // lane-av1subsizesweep: this arm is the ONE |
| 1832 | 1792 | // frame-edge partition read in the file that |
| 1833 | 1793 | // dispatches on its own symbol instead of |
| @@ -2131,11 +2091,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 2131 | 2091 | } |
| 2132 | 2092 | } |
| 2133 | 2093 | PARTITION_HORZ_A => { |
| 2134 | - // lane-part32 r1: two 16x16 squares on top + | |
| 2135 | - // a true 32x16 strip below (mirrors | |
| 2136 | - // decode_inter_block's cd6cb6d HORZ_A: TL, | |
| 2137 | - // TR, bottom strip). | |
| 2138 | - hit!(INTRA_HORZ_A_HITS); | |
| 2139 | 2094 | decode_block( |
| 2140 | 2095 | &mut dec, |
| 2141 | 2096 | &mut cdfs, |
| @@ -2209,11 +2164,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 2209 | 2164 | )?; |
| 2210 | 2165 | } |
| 2211 | 2166 | PARTITION_HORZ_B => { |
| 2212 | - // lane-part32 r1: a true 32x16 strip on top + | |
| 2213 | - // two 16x16 squares below (mirrors HORZ_A | |
| 2214 | - // with the strip/squares order flipped, same | |
| 2215 | - // shape as libaom decode_partition's HORZ_B). | |
| 2216 | - hit!(INTRA_HORZ_B_HITS); | |
| 2217 | 2167 | decode_block_rect( |
| 2218 | 2168 | &mut dec, |
| 2219 | 2169 | &mut cdfs, |
| @@ -2287,10 +2237,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 2287 | 2237 | )?; |
| 2288 | 2238 | } |
| 2289 | 2239 | PARTITION_VERT_A => { |
| 2290 | - // lane-part32 r1: mirror of HORZ_A with | |
| 2291 | - // width/height swapped (TL, BL, right 16x32 | |
| 2292 | - // strip). | |
| 2293 | - hit!(INTRA_VERT_A_HITS); | |
| 2294 | 2240 | let _vert_ab = crate::encode::Reach::vert_ab_partition(); |
| 2295 | 2241 | decode_block( |
| 2296 | 2242 | &mut dec, |
| @@ -2365,11 +2311,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 2365 | 2311 | )?; |
| 2366 | 2312 | } |
| 2367 | 2313 | PARTITION_VERT_B => { |
| 2368 | - // lane-part32 r1: a true 16x32 strip on the | |
| 2369 | - // left + two 16x16 squares on the right | |
| 2370 | - // (libaom decode_partition VERT_B: left | |
| 2371 | - // strip, TR, BR). | |
| 2372 | - hit!(INTRA_VERT_B_HITS); | |
| 2373 | 2314 | let _vert_ab = crate::encode::Reach::vert_ab_partition(); |
| 2374 | 2315 | decode_block_rect( |
| 2375 | 2316 | &mut dec, |
| @@ -2585,21 +2526,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 2585 | 2526 | } |
| 2586 | 2527 | } |
| 2587 | 2528 | PARTITION_HORZ_A | PARTITION_HORZ_B | PARTITION_VERT_A | PARTITION_VERT_B => { |
| 2588 | - // lane-part32 r4: the four superblock-level AB arms, each | |
| 2589 | - // two 32x32 squares plus one 64x32/32x64 strip, in | |
| 2590 | - // libaom's own `decode_partition` order (decodeframe.c: | |
| 2591 | - // HORZ_A = TL, TR, bottom strip; HORZ_B = top strip, BL, | |
| 2592 | - // BR; VERT_A = TL, BL, right strip; VERT_B = left strip, | |
| 2593 | - // TR, BR). The pieces are exactly the ones already proven | |
| 2594 | - // by the `PARTITION_NONE`-under-SPLIT (32x32 square) and | |
| 2595 | - // `PARTITION_HORZ`/`VERT` (rect64 strip) arms above. | |
| 2596 | - hit_do! { | |
| 2597 | - SB_AB_HITS.with(|c| { | |
| 2598 | - let mut h = c.get(); | |
| 2599 | - h[part - PARTITION_HORZ_A] += 1; | |
| 2600 | - c.set(h); | |
| 2601 | - }); | |
| 2602 | - } | |
| 2603 | 2529 | // lane-part32 r5: only the two VERTICAL arms reorder the |
| 2604 | 2530 | // square sub-blocks (TL, BL, TR, BR), so only they switch |
| 2605 | 2531 | // libaom's `has_tr`/`has_bl` tables. |
| @@ -2759,7 +2685,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 2759 | 2685 | PREFILT_PICTURE_IDX.load(std::sync::atomic::Ordering::SeqCst) |
| 2760 | 2686 | ); |
| 2761 | 2687 | } |
| 2762 | - census_unwritten(&y, &u, &v); | |
| 2763 | 2688 | // lane-av1fwd: the encoder's filter search re-decodes this same key |
| 2764 | 2689 | // frame tile per candidate -- capture it once (see [`FilterReplay`]), |
| 2765 | 2690 | // on the shape whose tail is the two filter calls and nothing else. |
crates/ec-av1/src/decode/leaf8.rsmodified+0 -68
| @@ -122,9 +122,6 @@ pub(super) fn decode_block_128rect( | ||
| 122 | 122 | uv_mode |
| 123 | 123 | }; |
| 124 | 124 | let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode); |
| 125 | - if smooth_neighbor { | |
| 126 | - hit!(SMOOTH_LUMA_HITS); | |
| 127 | - } | |
| 128 | 125 | let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c, fctx); |
| 129 | 126 | // spec 5.11.16 `read_tx_size`: read for every intra block, skipped or |
| 130 | 127 | // not. `bsize_to_tx_size_cat(BLOCK_128X64)` is 3 (see this fn's doc). |
| @@ -148,20 +145,7 @@ pub(super) fn decode_block_128rect( | ||
| 148 | 145 | } else { |
| 149 | 146 | 0 |
| 150 | 147 | }; |
| 151 | - if depth != 0 { | |
| 152 | - hit!(TX_DEPTH_HITS); | |
| 153 | - } | |
| 154 | - hit_do! { | |
| 155 | - INTRA_SB128_DEPTH_HITS.with(|c| { | |
| 156 | - let mut h = c.get(); | |
| 157 | - h[depth.min(2)] += 1; | |
| 158 | - c.set(h); | |
| 159 | - }); | |
| 160 | - } | |
| 161 | 148 | let logical_tx = if lossless_frame { 4 } else { 64 >> depth }; |
| 162 | - if lossless_frame { | |
| 163 | - hit!(INTRA128_LOSSLESS_HITS); | |
| 164 | - } | |
| 165 | 149 | // A 64-point transform codes nothing past its low 32 coefficients. |
| 166 | 150 | let coeff_tx_side = logical_tx.min(32); |
| 167 | 151 | let luma_set = if lossless_frame { |
| @@ -425,9 +409,6 @@ pub(super) fn decode_block_128rect( | ||
| 425 | 409 | } |
| 426 | 410 | } |
| 427 | 411 | } |
| 428 | - if !skip { | |
| 429 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 430 | - } | |
| 431 | 412 | } |
| 432 | 413 | } |
| 433 | 414 | if skip { |
| @@ -467,12 +448,8 @@ pub(super) fn decode_block_128rect( | ||
| 467 | 448 | // byte-exact against ffmpeg) -- that is the replay's own designed |
| 468 | 449 | // 4:2:2 case, not a defect signature. Nothing here asserts the |
| 469 | 450 | // mismatch is zero. |
| 470 | - if luma_span != luma_span_h { | |
| 471 | - hit!(SB128RECT_REPLAY_SPAN_MISMATCH_HITS); | |
| 472 | - } | |
| 473 | 451 | for (plane, cu_mi, grid) in &units { |
| 474 | 452 | neighbours.record_mi_chroma(*cu_mi, luma_span, luma_span_h, *plane, grid); |
| 475 | - hit!(SB128RECT_CHROMA_REPLAY_HITS); | |
| 476 | 453 | } |
| 477 | 454 | } |
| 478 | 455 | // No palette exists at this size; the unconditional stamp clears any |
| @@ -500,17 +477,8 @@ pub(super) fn decode_block_128rect( | ||
| 500 | 477 | txfm_partition_update_rect(neighbours, (mi_r, mi_c), (logical_tx, logical_tx), (bw, bh)); |
| 501 | 478 | } |
| 502 | 479 | if in_inter { |
| 503 | - hit_do! { | |
| 504 | - INTRA128_IN_INTER_HITS.with(|c| { | |
| 505 | - let mut h = c.get(); | |
| 506 | - h[usize::from(bw < bh)] += 1; | |
| 507 | - c.set(h); | |
| 508 | - }); | |
| 509 | - } | |
| 510 | 480 | } else if bw > bh { |
| 511 | - hit!(INTRA_SB128_HORZ_HITS); | |
| 512 | 481 | } else { |
| 513 | - hit!(INTRA_SB128_VERT_HITS); | |
| 514 | 482 | } |
| 515 | 483 | Ok(()) |
| 516 | 484 | } |
| @@ -603,9 +571,6 @@ pub(super) fn decode_leaf8( | ||
| 603 | 571 | // with the coarse [`SUB`] slot as the fallback when no block recorded |
| 604 | 572 | // that exact mi cell. |
| 605 | 573 | let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(leaf_mi.0, leaf_mi.1, r, c, fctx); |
| 606 | - if smooth_neighbor { | |
| 607 | - hit!(SMOOTH_LUMA_HITS); | |
| 608 | - } | |
| 609 | 574 | // An 8x8 leaf is well within `is_cfl_allowed`'s <=32x32 bound (spec |
| 610 | 575 | // 5.11.5), so it reads the CFL-allowed `uv_mode_cfl` CDF, like every other |
| 611 | 576 | // `decode_block` caller at 16x16 and up. |
| @@ -654,9 +619,6 @@ pub(super) fn decode_leaf8( | ||
| 654 | 619 | // next symbol (class `wrong-alphabet-same-value`). Everything below |
| 655 | 620 | // mirrors `decode_block`'s own intrabc handling at 16x16 and up. |
| 656 | 621 | let intrabc_dv = fctx.intrabc_dv.with(|c| c.take()); |
| 657 | - if intrabc_dv.is_some() { | |
| 658 | - hit!(LEAF8_INTRABC_HITS); | |
| 659 | - } | |
| 660 | 622 | // `av1_visit_palette`'s reconstruction (decodeframe.c:1135): the colour |
| 661 | 623 | // index map, mapped through the base colours, IS the block's prediction -- |
| 662 | 624 | // carried to the next `reconstruct`/`read_plane` through the same |
| @@ -676,9 +638,6 @@ pub(super) fn decode_leaf8( | ||
| 676 | 638 | let (pal_uv_size, pal_uv_colors) = palette_uv |
| 677 | 639 | .as_ref() |
| 678 | 640 | .map_or((0, [0u16; 8]), |p| (p.size, p.u_colors)); |
| 679 | - if palette_y.is_some() || palette_uv.is_some() { | |
| 680 | - hit!(PALETTE_LEAF8_HITS); | |
| 681 | - } | |
| 682 | 641 | let uv_predict_mode = if uv_mode == UV_CFL_PRED { |
| 683 | 642 | DC_PRED |
| 684 | 643 | } else { |
| @@ -722,7 +681,6 @@ pub(super) fn decode_leaf8( | ||
| 722 | 681 | 0, |
| 723 | 682 | &mut leaves, |
| 724 | 683 | ); |
| 725 | - hit!(INTRABC_VARTX_HITS); | |
| 726 | 684 | leaves.first().map_or(8, |l| l.2) |
| 727 | 685 | } else if tx_select && intrabc_dv.is_none() { |
| 728 | 686 | read_tx_size(dec, cdfs, neighbours, leaf_mi, 8, fctx) |
| @@ -846,7 +804,6 @@ pub(super) fn decode_leaf8( | ||
| 846 | 804 | // rule) -- so a palette leaf takes the single 8x8 reconstruct below |
| 847 | 805 | // even when `tx_depth` resolved to TX_4X4. |
| 848 | 806 | if resolved == 4 && palette_y_buf.is_none() { |
| 849 | - hit!(SKIP_SPLIT_TX_HITS); | |
| 850 | 807 | for tu_row in 0..2 { |
| 851 | 808 | for tu_col in 0..2 { |
| 852 | 809 | let (tu_px, tu_py) = (px + tu_col * 4, py + tu_row * 4); |
| @@ -1400,9 +1357,6 @@ pub(super) fn decode_leaf8( | ||
| 1400 | 1357 | let tu_px = px + tu_col * 4; |
| 1401 | 1358 | let tu_py = py + tu_row * 4; |
| 1402 | 1359 | let tu_around = neighbours.around_mi(tu_mi, 4)[0]; |
| 1403 | - if crate::encode::Reach::in_vert_ab() { | |
| 1404 | - hit!(VERT_AB_TX4_HITS); | |
| 1405 | - } | |
| 1406 | 1360 | let tu_reach = tu_reach( |
| 1407 | 1361 | 8, |
| 1408 | 1362 | 8, |
| @@ -1422,7 +1376,6 @@ pub(super) fn decode_leaf8( | ||
| 1422 | 1376 | // 16x16 and up) -- the whole-block buffer would be taken by |
| 1423 | 1377 | // the FIRST unit and indexed at the wrong stride. |
| 1424 | 1378 | if let Some(buf) = &palette_y_buf { |
| 1425 | - hit!(PALETTE_SPLIT_TX_HITS); | |
| 1426 | 1379 | let mut window = vec![0u16; 16]; |
| 1427 | 1380 | for row in 0..4 { |
| 1428 | 1381 | let src = (tu_row * 4 + row) * 8 + tu_col * 4; |
| @@ -1505,9 +1458,6 @@ pub(super) fn decode_leaf8( | ||
| 1505 | 1458 | // lane-av1intrapred: the non-vacuity counter -- armed slot consulted |
| 1506 | 1459 | // by this arm's chroma reads means the frame-copy + inherited-type |
| 1507 | 1460 | // route ran; zero at gate time means the fixture stopped reaching it. |
| 1508 | - if fctx.intrabc_chroma_tx.with(std::cell::Cell::get).is_some() { | |
| 1509 | - hit!(INTRABC_TX4_CHROMA_COPY_HITS); | |
| 1510 | - } | |
| 1511 | 1461 | if chroma_422 && !lossless(fctx) { |
| 1512 | 1462 | // lane-av1-422d: the chroma unit does NOT follow the luma var-tx |
| 1513 | 1463 | // split -- `uv_txsize` is `av1_get_max_uv_txsize` of the block, |
| @@ -1630,7 +1580,6 @@ pub(super) fn decode_leaf8( | ||
| 1630 | 1580 | } else { |
| 1631 | 1581 | Grid::Own(vo) |
| 1632 | 1582 | }; |
| 1633 | - hit!(CHROMA422_LOSSLESS_4X4_HITS); | |
| 1634 | 1583 | } else if chroma_444 && lossless(fctx) { |
| 1635 | 1584 | // 4:4:4 lossless: the leaf's chroma plane block is a 2x2 raster |
| 1636 | 1585 | // of TX_4X4 units per plane, PLANE-MAJOR (`av1_get_tx_size`: |
| @@ -1809,7 +1758,6 @@ pub(super) fn decode_leaf8( | ||
| 1809 | 1758 | neighbours.record_palette_y_rect(leaf_mi, 8, 8, pal_y_size, pal_y_colors); |
| 1810 | 1759 | neighbours.record_palette_uv_rect(leaf_mi, 8, 8, pal_uv_size, pal_uv_colors); |
| 1811 | 1760 | } |
| 1812 | - hit!(INTER8_SKIP_BAND_HITS); | |
| 1813 | 1761 | neighbours.fill_skip_grid(leaf_mi, 2, skip); |
| 1814 | 1762 | // lane-kf900 r1: the leaf's own RESOLVED transform size, never the literal |
| 1815 | 1763 | // block side. libaom calls `set_txfm_ctxs(mbmi->tx_size, ..., skip_txfm && |
| @@ -2067,15 +2015,6 @@ pub(super) fn read_intra_mode_sub8( | ||
| 2067 | 2015 | // `is_inter_block` counts an intrabc block), so the caller takes |
| 2068 | 2016 | // the frame-copy prediction + inter residual. |
| 2069 | 2017 | let dv = read_intrabc_dv(dec, cdfs, mi_r, mi_c, (seg_w_mi, seg_h_mi), fctx); |
| 2070 | - // lane-av1txr: the DV travels back in the RETURN value -- it is | |
| 2071 | - // NOT published through `FrameCtx::intrabc_dv`. That slot is the | |
| 2072 | - // SQUARE paths' handoff (`decode_block`/`decode_leaf8` arm it, | |
| 2073 | - // then `take()` it in the same call), so a sub-8x8 leaf that | |
| 2074 | - // armed it left the vector standing for the NEXT >=8x8 block: | |
| 2075 | - // `warped.obu`'s (38,60) 8x8 intra block took it as its own | |
| 2076 | - // intrabc and read an inter var-tx `txfm_split` where libaom read | |
| 2077 | - // an intra `tx_depth` (class `stale-slot-handoff`). | |
| 2078 | - hit!(INTRABC_HITS); | |
| 2079 | 2018 | return Ok((skip, DC_PRED, 0, None, None, Some(dv))); |
| 2080 | 2019 | } |
| 2081 | 2020 | } |
| @@ -2119,17 +2058,11 @@ pub(super) fn read_intra_mode_sub8( | ||
| 2119 | 2058 | dec.debug_state().0 |
| 2120 | 2059 | ); |
| 2121 | 2060 | } |
| 2122 | - if (9..=12).contains(&uv_mode) { | |
| 2123 | - hit!(SMOOTH_UV_HITS); | |
| 2124 | - } | |
| 2125 | 2061 | let alpha = if uv_mode == UV_CFL_PRED { |
| 2126 | 2062 | Some(read_cfl_alphas(dec, cdfs)) |
| 2127 | 2063 | } else { |
| 2128 | 2064 | None |
| 2129 | 2065 | }; |
| 2130 | - if (V_PRED..=D67_PRED).contains(&uv_mode) { | |
| 2131 | - hit!(DIRECTIONAL_UV_HITS); | |
| 2132 | - } | |
| 2133 | 2066 | // See the luma comment above: no angle delta below 8x8. |
| 2134 | 2067 | let angle_delta_uv = 0; |
| 2135 | 2068 | Some((uv_mode, angle_delta_uv, alpha)) |
| @@ -2146,7 +2079,6 @@ pub(super) fn read_intra_mode_sub8( | ||
| 2146 | 2079 | ); |
| 2147 | 2080 | } |
| 2148 | 2081 | if use_filter_intra { |
| 2149 | - hit!(FILTER_INTRA_HITS); | |
| 2150 | 2082 | let fi_mode = dec.symbol(&mut cdfs.filter_intra_mode); |
| 2151 | 2083 | filter_intra = Some(fi_mode); |
| 2152 | 2084 | } |
crates/ec-av1/src/decode/leaf_sub8.rsmodified+0 -59
| @@ -94,7 +94,6 @@ pub(super) fn sub8_leaf_chroma444( | ||
| 94 | 94 | &mut vb, |
| 95 | 95 | fctx, |
| 96 | 96 | ); |
| 97 | - hit!(SKIPPED_INTRABC_DV_COPY_HITS); | |
| 98 | 97 | let zeros = &ZERO_RESIDUAL[..bw * bh]; |
| 99 | 98 | if square { |
| 100 | 99 | set_palette_pred(ub, fctx); |
| @@ -173,10 +172,6 @@ pub(super) fn sub8_leaf_chroma444( | ||
| 173 | 172 | fctx, |
| 174 | 173 | ); |
| 175 | 174 | } |
| 176 | - // The same arm-without-clear route the 4:2:0 tails count: a skipped | |
| 177 | - // leaf reads no coefficient, so the inherited chroma `tx_type` is | |
| 178 | - // dropped unconsumed. | |
| 179 | - hit!(SKIPPED_INTRABC_CHROMA_ARM_HITS); | |
| 180 | 175 | fctx.intrabc_chroma_tx.with(|c| c.set(None)); |
| 181 | 176 | (Grid::Zero(bw * bh), Grid::Zero(bw * bh), 4, 4) |
| 182 | 177 | } else if skip { |
| @@ -257,7 +252,6 @@ pub(super) fn sub8_leaf_chroma444( | ||
| 257 | 252 | // The same arm-without-clear route the 4:2:0 tails count: a skipped |
| 258 | 253 | // leaf reads no coefficient, so an armed intrabc slot is dropped. |
| 259 | 254 | if fctx.intrabc_chroma_tx.with(std::cell::Cell::get).is_some() { |
| 260 | - hit!(SKIPPED_INTRABC_CHROMA_ARM_HITS); | |
| 261 | 255 | fctx.intrabc_chroma_tx.with(|c| c.set(None)); |
| 262 | 256 | } |
| 263 | 257 | (Grid::Zero(bw * bh), Grid::Zero(bw * bh), 4, 4) |
| @@ -350,9 +344,6 @@ pub(super) fn sub8_leaf_chroma444( | ||
| 350 | 344 | } else { |
| 351 | 345 | // lane-av1-ibc444rect: the unskipped lossless chroma walk this |
| 352 | 346 | // lane fixes (one rect unit -> per-4x4 Chroma4 units). |
| 353 | - if lossless(fctx) { | |
| 354 | - hit!(INTRABC_RECT8_LOSSLESS_CHROMA_HITS); | |
| 355 | - } | |
| 356 | 347 | if lossless(fctx) { |
| 357 | 348 | // lane-av1-ibc444rect: at lossless `read_tx_size` forces |
| 358 | 349 | // TX_4X4 on EVERY plane (`av1_get_tx_size`'s lossless |
| @@ -409,7 +400,6 @@ pub(super) fn sub8_leaf_chroma444( | ||
| 409 | 400 | if !square |
| 410 | 401 | && unit_reach != Reach::of(4, upx, upy, y.width, y.height, fctx) |
| 411 | 402 | { |
| 412 | - hit!(SUB8_CHROMA444_LOSSLESS_TU_REACH_HITS); | |
| 413 | 403 | } |
| 414 | 404 | let grid = read_plane( |
| 415 | 405 | dec, |
| @@ -607,7 +597,6 @@ pub(super) fn sub8_leaf_chroma444( | ||
| 607 | 597 | let unit_reach = Reach::of_tu(bw, bh, uc * 4, ur * 4, 4, 4, reach); |
| 608 | 598 | if !square && unit_reach != Reach::of(4, upx, upy, y.width, y.height, fctx) |
| 609 | 599 | { |
| 610 | - hit!(SUB8_CHROMA444_LOSSLESS_TU_REACH_HITS); | |
| 611 | 600 | } |
| 612 | 601 | let grid = read_plane( |
| 613 | 602 | dec, |
| @@ -988,7 +977,6 @@ pub(super) fn sub8_leaf_chroma422( | ||
| 988 | 977 | &mut ub, |
| 989 | 978 | fctx, |
| 990 | 979 | ); |
| 991 | - hit!(SKIPPED_INTRABC_DV_COPY_HITS); | |
| 992 | 980 | let zeros = &ZERO_RESIDUAL[..16]; |
| 993 | 981 | set_palette_pred(ub, fctx); |
| 994 | 982 | push_intra( |
| @@ -1044,17 +1032,12 @@ pub(super) fn sub8_leaf_chroma422( | ||
| 1044 | 1032 | // [`sub8_leaf_chroma444`] count: a skipped leaf reads no coefficient, |
| 1045 | 1033 | // so the inherited chroma `tx_type` is dropped unconsumed. |
| 1046 | 1034 | if fctx.intrabc_chroma_tx.with(std::cell::Cell::get).is_some() { |
| 1047 | - hit!(SKIPPED_INTRABC_CHROMA_ARM_HITS); | |
| 1048 | 1035 | fctx.intrabc_chroma_tx.with(|c| c.set(None)); |
| 1049 | 1036 | } |
| 1050 | 1037 | (Grid::Zero(16), Grid::Zero(16)) |
| 1051 | 1038 | } else if skip { |
| 1052 | 1039 | // A skipped chroma-reference leaf still predicts (the CfL contribution |
| 1053 | 1040 | // survives a skip); no coefficient symbol exists. |
| 1054 | - if alpha.is_some() { | |
| 1055 | - hit!(CHROMA_SKIP_CFL_HITS); | |
| 1056 | - hit!(SKIP_CFL_HITS); | |
| 1057 | - } | |
| 1058 | 1041 | push_intra( |
| 1059 | 1042 | y, |
| 1060 | 1043 | u, |
| @@ -1092,12 +1075,10 @@ pub(super) fn sub8_leaf_chroma422( | ||
| 1092 | 1075 | // The same arm-without-clear route the 4:2:0 tails count: a skipped |
| 1093 | 1076 | // leaf reads no coefficient, so an armed intrabc slot is dropped. |
| 1094 | 1077 | if fctx.intrabc_chroma_tx.with(std::cell::Cell::get).is_some() { |
| 1095 | - hit!(SKIPPED_INTRABC_CHROMA_ARM_HITS); | |
| 1096 | 1078 | fctx.intrabc_chroma_tx.with(|c| c.set(None)); |
| 1097 | 1079 | } |
| 1098 | 1080 | (Grid::Zero(16), Grid::Zero(16)) |
| 1099 | 1081 | } else if let Some(dv) = intrabc_dv { |
| 1100 | - hit!(CHROMA422_SUB8_HITS); | |
| 1101 | 1082 | // Frame copy at the DV; the residual still reads the ordinary chroma |
| 1102 | 1083 | // tables with the inherited luma `tx_type` (see the 4:2:0 tails). |
| 1103 | 1084 | let mut ub = vec![0u16; 16]; |
| @@ -1183,7 +1164,6 @@ pub(super) fn sub8_leaf_chroma422( | ||
| 1183 | 1164 | fctx.intrabc_chroma_tx.with(|c| c.set(None)); |
| 1184 | 1165 | (ug, vg) |
| 1185 | 1166 | } else { |
| 1186 | - hit!(CHROMA422_SUB8_HITS); | |
| 1187 | 1167 | let ug = read_plane( |
| 1188 | 1168 | dec, |
| 1189 | 1169 | cdfs, |
| @@ -1286,7 +1266,6 @@ pub(super) fn decode_leaf_split4( | ||
| 1286 | 1266 | // one a neighbour to its RIGHT sees (its top-right 4x4, mi(row, col-1))., fctx: &crate::decode::FrameCtx |
| 1287 | 1267 | fctx: &crate::decode::FrameCtx, |
| 1288 | 1268 | ) -> Result<(usize, usize)> { |
| 1289 | - hit!(SUB8_SPLIT_HITS); | |
| 1290 | 1269 | let (r, c) = outer_at; |
| 1291 | 1270 | let mut above_mode = neighbours.above_mode[c]; |
| 1292 | 1271 | let mut left_mode = neighbours.left_mode[r]; |
| @@ -1378,9 +1357,6 @@ pub(super) fn decode_leaf_split4( | ||
| 1378 | 1357 | // same value). |
| 1379 | 1358 | set_txfm_ctxs(neighbours, lmi, 4, 1, 1, false); |
| 1380 | 1359 | let smooth_neighbor = is_smooth_mode(leaf_above) || is_smooth_mode(leaf_left); |
| 1381 | - if smooth_neighbor { | |
| 1382 | - hit!(SMOOTH_LUMA_HITS); | |
| 1383 | - } | |
| 1384 | 1360 | let (px, py) = (lmi.1 * MI, lmi.0 * MI); |
| 1385 | 1361 | let reach = Reach::of(4, px, py, y.width, y.height, fctx); |
| 1386 | 1362 | if let Some(dv) = intrabc { |
| @@ -1695,10 +1671,6 @@ pub(super) fn decode_leaf_split4( | ||
| 1695 | 1671 | // merge keeps one fix and feeds both lanes' counters so neither of |
| 1696 | 1672 | // their gates goes vacuous. |
| 1697 | 1673 | let ac = alpha.map(|_| cfl_src(gpx, gpy, 8)); |
| 1698 | - if alpha.is_some() { | |
| 1699 | - hit!(CHROMA_SKIP_CFL_HITS); | |
| 1700 | - hit!(SKIP_CFL_HITS); | |
| 1701 | - } | |
| 1702 | 1674 | push_intra( |
| 1703 | 1675 | y, |
| 1704 | 1676 | u, |
| @@ -1742,7 +1714,6 @@ pub(super) fn decode_leaf_split4( | ||
| 1742 | 1714 | // arm-without-clear-on-a-skip-route). Counted so a gate can tell a |
| 1743 | 1715 | // stream that reaches this route from one that never does. |
| 1744 | 1716 | if fctx.intrabc_chroma_tx.with(std::cell::Cell::get).is_some() { |
| 1745 | - hit!(SKIPPED_INTRABC_CHROMA_ARM_HITS); | |
| 1746 | 1717 | fctx.intrabc_chroma_tx.with(|c| c.set(None)); |
| 1747 | 1718 | } |
| 1748 | 1719 | (Grid::Zero(16), Grid::Zero(16)) |
| @@ -2073,9 +2044,6 @@ pub(super) fn decode_leaf_rect8( | ||
| 2073 | 2044 | if let Some(dv) = intrabc { |
| 2074 | 2045 | // lane-av1-ibc444rect: the unskipped lossless luma walk this lane |
| 2075 | 2046 | // fixes (one rect unit -> per-4x4 inter units). |
| 2076 | - if !skip && lossless(fctx) { | |
| 2077 | - hit!(INTRABC_RECT8_LOSSLESS_LUMA_HITS); | |
| 2078 | - } | |
| 2079 | 2047 | // lane-av1txr: an intrabc `BLOCK_4X8`/`BLOCK_8X4` leaf. The |
| 2080 | 2048 | // prediction is a frame copy at the DV and the residual reads the |
| 2081 | 2049 | // INTER `LumaRect8x4` set -- but with `TxMode::Select` the leaf |
| @@ -2127,7 +2095,6 @@ pub(super) fn decode_leaf_rect8( | ||
| 2127 | 2095 | 0, |
| 2128 | 2096 | &mut luma_leaves, |
| 2129 | 2097 | ); |
| 2130 | - hit!(RECT_INTRABC_VARTX_HITS); | |
| 2131 | 2098 | publish = None; |
| 2132 | 2099 | } else if lossless(fctx) && !skip { |
| 2133 | 2100 | // lane-av1-ibc444rect: `read_tx_size`'s lossless first line |
| @@ -2452,15 +2419,6 @@ pub(super) fn decode_leaf_rect8( | ||
| 2452 | 2419 | } |
| 2453 | 2420 | continue; |
| 2454 | 2421 | } |
| 2455 | - if filter_intra.is_some() { | |
| 2456 | - // lane-fi8 r1: `predict_filter_intra` walks its 4x2 patches over | |
| 2457 | - // a true `bw`x`bh` block, so a 4x8/8x4 leaf predicts through the | |
| 2458 | - // same `reconstruct_rect`/`reconstruct` calls below -- and under | |
| 2459 | - // a split transform, per 4x4 unit with that unit's own edge, | |
| 2460 | - // which is exactly what the depth-1 loop already does. | |
| 2461 | - hit!(FILTER_INTRA_RECT_HITS); | |
| 2462 | - hit!(FILTER_INTRA_RECT_SUB8_HITS); | |
| 2463 | - } | |
| 2464 | 2422 | // `TxMode::Select`'s `tx_depth` (spec 5.11.16) exists at a 4x8/8x4 |
| 2465 | 2423 | // leaf too, and is read for every intra block, skipped or not. Its |
| 2466 | 2424 | // category is libaom's `bsize_to_tx_size_cat(BLOCK_4X8) == 0` -- |
| @@ -2485,13 +2443,6 @@ pub(super) fn decode_leaf_rect8( | ||
| 2485 | 2443 | } else { |
| 2486 | 2444 | 0 |
| 2487 | 2445 | }; |
| 2488 | - if depth != 0 { | |
| 2489 | - hit!(TX_DEPTH_HITS); | |
| 2490 | - hit!(RECT8_SPLIT_TX_HITS); | |
| 2491 | - } | |
| 2492 | - if smooth_neighbor { | |
| 2493 | - hit!(SMOOTH_LUMA_HITS); | |
| 2494 | - } | |
| 2495 | 2446 | let (px, py) = (lmi.1 * MI, lmi.0 * MI); |
| 2496 | 2447 | let reach = Reach::of_rect(bw, bh, px, py, y.width, y.height, fctx); |
| 2497 | 2448 | // `sub_tx_size_map[TX_4X8] == TX_4X4`: depth 1 splits the leaf into |
| @@ -2600,9 +2551,7 @@ pub(super) fn decode_leaf_rect8( | ||
| 2600 | 2551 | } |
| 2601 | 2552 | if done > 0 { |
| 2602 | 2553 | if vert { |
| 2603 | - hit!(TX4X8_CODED_HITS); | |
| 2604 | 2554 | } else { |
| 2605 | - hit!(TX8X4_CODED_HITS); | |
| 2606 | 2555 | } |
| 2607 | 2556 | } |
| 2608 | 2557 | neighbours.fill_skip_grid_rect(lmi, w_mi, h_mi, skip); |
| @@ -2716,9 +2665,7 @@ pub(super) fn decode_leaf_rect8( | ||
| 2716 | 2665 | )?; |
| 2717 | 2666 | if levels.iter().any(|&l| l != 0) { |
| 2718 | 2667 | if vert { |
| 2719 | - hit!(TX4X8_CODED_HITS); | |
| 2720 | 2668 | } else { |
| 2721 | - hit!(TX8X4_CODED_HITS); | |
| 2722 | 2669 | } |
| 2723 | 2670 | } |
| 2724 | 2671 | let residual = dequant_and_inverse_typed_wh( |
| @@ -2881,10 +2828,6 @@ pub(super) fn decode_leaf_rect8( | ||
| 2881 | 2828 | // merge keeps one fix and feeds both lanes' counters so neither of |
| 2882 | 2829 | // their gates goes vacuous. |
| 2883 | 2830 | let ac = alpha.map(|_| cfl_src(gpx, gpy, 8)); |
| 2884 | - if alpha.is_some() { | |
| 2885 | - hit!(CHROMA_SKIP_CFL_HITS); | |
| 2886 | - hit!(SKIP_CFL_HITS); | |
| 2887 | - } | |
| 2888 | 2831 | push_intra( |
| 2889 | 2832 | y, |
| 2890 | 2833 | u, |
| @@ -2928,7 +2871,6 @@ pub(super) fn decode_leaf_rect8( | ||
| 2928 | 2871 | // arm-without-clear-on-a-skip-route). Counted so a gate can tell a |
| 2929 | 2872 | // stream that reaches this route from one that never does. |
| 2930 | 2873 | if fctx.intrabc_chroma_tx.with(std::cell::Cell::get).is_some() { |
| 2931 | - hit!(SKIPPED_INTRABC_CHROMA_ARM_HITS); | |
| 2932 | 2874 | fctx.intrabc_chroma_tx.with(|c| c.set(None)); |
| 2933 | 2875 | } |
| 2934 | 2876 | (Grid::Zero(16), Grid::Zero(16)) |
| @@ -3005,7 +2947,6 @@ pub(super) fn decode_leaf_rect8( | ||
| 3005 | 2947 | &ZERO_RESIDUAL[..16], |
| 3006 | 2948 | fctx, |
| 3007 | 2949 | ); |
| 3008 | - hit!(SKIPPED_INTRABC_CHROMA_ARM_HITS); | |
| 3009 | 2950 | fctx.intrabc_chroma_tx.with(|c| c.set(None)); |
| 3010 | 2951 | (Grid::Zero(16), Grid::Zero(16)) |
| 3011 | 2952 | } else { |
crates/ec-av1/src/decode/mod.rsmodified+0 -74
| @@ -20,7 +20,6 @@ | ||
| 20 | 20 | //! inside one, forcing the gathered-CDF partial-superblock path, is round 2 |
| 21 | 21 | //! too). Anything outside that refuses with [`Error::unsupported`] rather than |
| 22 | 22 | //! silently miscoding. |
| 23 | -use crate::hits::{hit, hit_do}; | |
| 24 | 23 | |
| 25 | 24 | use ec_av1_syntax::{ |
| 26 | 25 | CdefParams, DeltaParams, LoopFilterParams, LoopRestorationParams, MAX_SEGMENTS, |
| @@ -41,8 +40,6 @@ use ec_core::{Error, Result}; | ||
| 41 | 40 | // itself was lifted by lane-av112bitc before that (the combines absorb the |
| 42 | 41 | // CONV_BUF gain drop, `INTER_POST_ROUND - delta`, see `mc::combine_compound`). |
| 43 | 42 | |
| 44 | -mod counters; | |
| 45 | -pub use counters::*; | |
| 46 | 43 | |
| 47 | 44 | mod frame_tile; |
| 48 | 45 | |
| @@ -670,7 +667,6 @@ pub(crate) fn warp_plane_allowed(w: usize, h: usize) -> bool { | ||
| 670 | 667 | if w >= 8 && h >= 8 { |
| 671 | 668 | return true; |
| 672 | 669 | } |
| 673 | - hit!(WARP_PLANE_SUPPRESS_HITS); | |
| 674 | 670 | false |
| 675 | 671 | } |
| 676 | 672 | |
| @@ -776,7 +772,6 @@ fn maybe_read_delta_q( | ||
| 776 | 772 | } |
| 777 | 773 | let sign_negative = if abs != 0 { dec.literal(1) != 0 } else { true }; |
| 778 | 774 | let reduced = if sign_negative { -abs } else { abs }; |
| 779 | - hit!(DELTA_Q_HITS); | |
| 780 | 775 | let res = fctx.delta_q_res.with(|c| c.get()); |
| 781 | 776 | fctx.current_q_idx |
| 782 | 777 | .with(|c| c.set((c.get() + reduced * res).clamp(1, 255))); |
| @@ -832,7 +827,6 @@ fn maybe_read_delta_lf( | ||
| 832 | 827 | let sign_negative = if abs != 0 { dec.literal(1) != 0 } else { true }; |
| 833 | 828 | let reduced = if sign_negative { -abs } else { abs }; |
| 834 | 829 | cur[i] = (cur[i] + reduced * res).clamp(-63, 63); |
| 835 | - hit!(DELTA_LF_HITS); | |
| 836 | 830 | } |
| 837 | 831 | fctx.current_delta_lf.with(|c| c.set(cur)); |
| 838 | 832 | } |
| @@ -860,7 +854,6 @@ fn maybe_read_cdef_idx( | ||
| 860 | 854 | } |
| 861 | 855 | let idx = dec.literal(u32::from(bits)) as u8; |
| 862 | 856 | fctx.cdef_transmitted.with(|c| c.set(true)); |
| 863 | - hit!(CDEF_IDX_HITS); | |
| 864 | 857 | let (sb_r, sb_c) = (mi_r / SB_MI as usize, mi_c / SB_MI as usize); |
| 865 | 858 | let sb_cols = fctx.cdef_sb_cols.with(|c| c.get()); |
| 866 | 859 | if sb_cols > 0 { |
| @@ -987,10 +980,6 @@ fn block_q_idx(fctx: &crate::decode::FrameCtx) -> i32 { | ||
| 987 | 980 | if crate::envflags::env_flag!("EC_DQCOEFF") { |
| 988 | 981 | eprintln!("OUR_Q base={base} seg={seg_id} q={q}"); |
| 989 | 982 | } |
| 990 | - hit_do!(BLOCK_Q_SPAN.with(|c| { | |
| 991 | - let (lo, hi) = c.get(); | |
| 992 | - c.set((lo.min(q), hi.max(q))); | |
| 993 | - });); | |
| 994 | 983 | q |
| 995 | 984 | } |
| 996 | 985 | |
| @@ -1160,7 +1149,6 @@ fn read_segment_id( | ||
| 1160 | 1149 | return pred as u8; |
| 1161 | 1150 | } |
| 1162 | 1151 | let coded = dec.symbol(&mut cdfs.segment_id[ctx]) as i32; |
| 1163 | - hit!(SEG_ID_HITS); | |
| 1164 | 1152 | let last_active = fctx.seg.with(|s| i32::from(s.borrow().last_active_seg_id)); |
| 1165 | 1153 | let id = neg_deinterleave(coded, pred, last_active + 1).clamp(0, last_active); |
| 1166 | 1154 | // Mirrors the oracle's own `EC_SEG mi_row=.. cdf=.. pred=.. coded=.. id=..` |
| @@ -1263,7 +1251,6 @@ fn inter_segment_id( | ||
| 1263 | 1251 | let id = if temporal_update { |
| 1264 | 1252 | let ctx = seg_pred_ctx(mi_r, mi_c, fctx); |
| 1265 | 1253 | let predicted = dec.symbol(&mut cdfs.segment_pred[ctx]) != 0; |
| 1266 | - hit!(SEG_PRED_HITS); | |
| 1267 | 1254 | stamp_seg_pred(mi_r, mi_c, w_mi, h_mi, u8::from(predicted), fctx); |
| 1268 | 1255 | if predicted { |
| 1269 | 1256 | predicted_segment_id(mi_r, mi_c, w_mi, h_mi, fctx) |
| @@ -1345,9 +1332,6 @@ fn tu_reach( | ||
| 1345 | 1332 | ) -> Reach { |
| 1346 | 1333 | let fixed = Reach::of_tu(bw, bh, col_off, row_off, tx, tx, block); |
| 1347 | 1334 | let standalone = Reach::of(tx, px + col_off, py + row_off, width, height, fctx); |
| 1348 | - if fixed != standalone { | |
| 1349 | - hit!(SPLIT_TU_REACH_FIX_HITS); | |
| 1350 | - } | |
| 1351 | 1335 | fixed |
| 1352 | 1336 | } |
| 1353 | 1337 | |
| @@ -1376,9 +1360,6 @@ fn tu_reach_rect( | ||
| 1376 | 1360 | let fixed = Reach::of_tu(bw, bh, col_off, row_off, tx_w, tx_h, block); |
| 1377 | 1361 | if tx_w == tx_h { |
| 1378 | 1362 | let standalone = Reach::of(tx_w, px + col_off, py + row_off, width, height, fctx); |
| 1379 | - if fixed != standalone { | |
| 1380 | - hit!(SPLIT_TU_REACH_FIX_HITS); | |
| 1381 | - } | |
| 1382 | 1363 | } |
| 1383 | 1364 | fixed |
| 1384 | 1365 | } |
| @@ -1390,7 +1371,6 @@ static PREFILT_PICTURE_IDX: std::sync::atomic::AtomicUsize = std::sync::atomic:: | ||
| 1390 | 1371 | |
| 1391 | 1372 | /// Records one decoded forward keyframe (see [`FWD_KF_HITS`]). |
| 1392 | 1373 | pub(crate) fn note_fwd_kf() { |
| 1393 | - hit!(FWD_KF_HITS); | |
| 1394 | 1374 | } |
| 1395 | 1375 | |
| 1396 | 1376 | thread_local! { |
| @@ -1420,34 +1400,13 @@ pub(crate) fn set_inter_tx_mode( | ||
| 1420 | 1400 | } |
| 1421 | 1401 | |
| 1422 | 1402 | fn bump_ab16(arm: usize) { |
| 1423 | - hit_do! { | |
| 1424 | - AB16_HITS.with(|c| { | |
| 1425 | - let mut v = c.get(); | |
| 1426 | - v[arm] += 1; | |
| 1427 | - c.set(v); | |
| 1428 | - }); | |
| 1429 | - } | |
| 1430 | 1403 | } |
| 1431 | 1404 | |
| 1432 | 1405 | /// Bumps one bucket of [`INTER_EDGE_STRIP_HITS`]. |
| 1433 | 1406 | pub(crate) fn bump_inter_edge_strip(idx: usize) { |
| 1434 | - hit_do! { | |
| 1435 | - INTER_EDGE_STRIP_HITS.with(|c| { | |
| 1436 | - let mut v = c.get(); | |
| 1437 | - v[idx] += 1; | |
| 1438 | - c.set(v); | |
| 1439 | - }); | |
| 1440 | - } | |
| 1441 | 1407 | } |
| 1442 | 1408 | |
| 1443 | 1409 | fn bump_edge_both_cut(level: usize) { |
| 1444 | - hit_do! { | |
| 1445 | - EDGE_BOTH_CUT_HITS.with(|c| { | |
| 1446 | - let mut v = c.get(); | |
| 1447 | - v[level] += 1; | |
| 1448 | - c.set(v); | |
| 1449 | - }); | |
| 1450 | - } | |
| 1451 | 1410 | } |
| 1452 | 1411 | |
| 1453 | 1412 | // lane-av1muchroma site 1: the total number of samples by which |
| @@ -1563,12 +1522,10 @@ pub(crate) fn frame_chroma_alloc_crop_shapes() -> usize { | ||
| 1563 | 1522 | /// numbers. A counter that recomputed `shape >> ss` beside the allocation |
| 1564 | 1523 | /// would have read the same value either way and proved nothing. |
| 1565 | 1524 | fn note_frame_chroma_alloc(shape: (usize, usize), alloc: (usize, usize), ss: (usize, usize)) { |
| 1566 | - hit!(FRAME_CHROMA_ALLOC_CALLS); | |
| 1567 | 1525 | let (need_w, need_h) = (round_ss(shape.0, ss.0), round_ss(shape.1, ss.1)); |
| 1568 | 1526 | // Decidability: the floor and the crop are the same number on this frame, |
| 1569 | 1527 | // so the shortfall below is the same number the two forms would have given. |
| 1570 | 1528 | if (need_w, need_h) != (shape.0 >> ss.0, shape.1 >> ss.1) { |
| 1571 | - hit!(FRAME_CHROMA_ALLOC_CROP_SHAPES); | |
| 1572 | 1529 | if crate::envflags::env_flag!("EC_AV1_CHROMA_ALLOC_SWEEP") { |
| 1573 | 1530 | eprintln!( |
| 1574 | 1531 | "CHROMA_ALLOC luma={}x{} ss={:?} floor={}x{} round_ss={}x{} alloc={}x{}", |
| @@ -1586,9 +1543,6 @@ fn note_frame_chroma_alloc(shape: (usize, usize), alloc: (usize, usize), ss: (us | ||
| 1586 | 1543 | } |
| 1587 | 1544 | let want = need_w * need_h; |
| 1588 | 1545 | let got = alloc.0 * alloc.1; |
| 1589 | - if want > got { | |
| 1590 | - hit_do!(FRAME_CHROMA_ALLOC_SHORT_SAMPLES.with(|c| c.set(c.get() + want - got))); | |
| 1591 | - } | |
| 1592 | 1546 | } |
| 1593 | 1547 | |
| 1594 | 1548 | /// lane-av1ibcfork: this decoder's half of the per-unit BIT INTERVAL -- the |
| @@ -2629,7 +2583,6 @@ fn record_intrabc_mi_rect( | ||
| 2629 | 2583 | /// Bump [`FIMV_FRAME_HITS`] -- called once per decoded frame header whose |
| 2630 | 2584 | /// `force_integer_mv` bit is set. |
| 2631 | 2585 | pub fn note_force_integer_mv_frame() { |
| 2632 | - hit!(FIMV_FRAME_HITS); | |
| 2633 | 2586 | } |
| 2634 | 2587 | |
| 2635 | 2588 | // lane-t900 r27: OBMC blends that actually READ a recorded switchable filter |
| @@ -2700,13 +2653,6 @@ thread_local! { | ||
| 2700 | 2653 | } |
| 2701 | 2654 | |
| 2702 | 2655 | fn bump_edge_part(slot: usize) { |
| 2703 | - hit_do! { | |
| 2704 | - EDGE_PART_HITS.with(|c| { | |
| 2705 | - let mut h = c.get(); | |
| 2706 | - h[slot] += 1; | |
| 2707 | - c.set(h); | |
| 2708 | - }); | |
| 2709 | - } | |
| 2710 | 2656 | } |
| 2711 | 2657 | |
| 2712 | 2658 | /// [`bump_edge32`] of `base + bit`, returning the bit -- the gathered edge |
| @@ -2717,13 +2663,6 @@ fn bump_edge32_bit(base: usize, bit: usize) -> usize { | ||
| 2717 | 2663 | } |
| 2718 | 2664 | |
| 2719 | 2665 | fn bump_edge32(slot: usize) { |
| 2720 | - hit_do! { | |
| 2721 | - EDGE32_HITS.with(|c| { | |
| 2722 | - let mut h = c.get(); | |
| 2723 | - h[slot] += 1; | |
| 2724 | - c.set(h) | |
| 2725 | - }); | |
| 2726 | - } | |
| 2727 | 2666 | } |
| 2728 | 2667 | |
| 2729 | 2668 | /// One 16x4 / 4x16 inter strip's chroma situation, handed to |
| @@ -2750,13 +2689,6 @@ pub(crate) struct InterStripChroma { | ||
| 2750 | 2689 | /// The single-reference MC parameters of the inter block that decoded |
| 2751 | 2690 | /// last -- read by the next 1:4 strip to build its pair's chroma. |
| 2752 | 2691 | fn bump_ab16_inter(arm: usize) { |
| 2753 | - hit_do! { | |
| 2754 | - AB16_INTER_HITS.with(|c| { | |
| 2755 | - let mut v = c.get(); | |
| 2756 | - v[arm] += 1; | |
| 2757 | - c.set(v); | |
| 2758 | - }); | |
| 2759 | - } | |
| 2760 | 2692 | } |
| 2761 | 2693 | |
| 2762 | 2694 | /// Everything [`decode_inter_block`] needs to fold temporal MV candidates |
| @@ -2939,17 +2871,11 @@ pub(crate) fn cdef_straddle_units() -> usize { | ||
| 2939 | 2871 | } |
| 2940 | 2872 | |
| 2941 | 2873 | fn note_sub8_chroma_tx(first_sub: TxType, chroma_ref: TxType, coeffs: bool) { |
| 2942 | - if coeffs && first_sub != chroma_ref { | |
| 2943 | - hit!(SUB8_CHROMA_TX_FROM_REF_HITS); | |
| 2944 | - } | |
| 2945 | 2874 | } |
| 2946 | 2875 | |
| 2947 | 2876 | /// Counts one [`CHROMA_EOB_CLASS1_HITS`] when `plane_idx`'s inherited |
| 2948 | 2877 | /// `tx_type` put this block's `eob_pt` on the class-1 row. |
| 2949 | 2878 | fn note_chroma_class1(plane_idx: usize, tx_type: TxType) { |
| 2950 | - if plane_idx > 0 && TxClass::of(tx_type) != TxClass::TwoD { | |
| 2951 | - hit!(CHROMA_EOB_CLASS1_HITS); | |
| 2952 | - } | |
| 2953 | 2879 | } |
| 2954 | 2880 | |
| 2955 | 2881 | // Which plane the in-flight INTRA reconstruction is writing (0=Y, 1=U, 2=V). |
crates/ec-av1/src/decode/post_filter.rsmodified+0 -1
| @@ -164,7 +164,6 @@ pub(super) fn apply_cdef( | ||
| 164 | 164 | if crate::envflags::env_flag!("EC_AV1_DEBUG_SKIP_CDEF") { |
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | - cdef_scan_counters(skip_grid); | |
| 168 | 167 | // `cdef.bits == 0` still means "no filtering at all" whenever the single |
| 169 | 168 | // (index 0) strength pair is all-zero -- the fast path every existing |
| 170 | 169 | // gate stream takes. A `bits > 0` frame can still be all-zero-strength |
crates/ec-av1/src/decode/rect.rsmodified+0 -207
| @@ -92,7 +92,6 @@ pub(super) fn read_intra_mode_rect( | ||
| 92 | 92 | // offer the 14-symbol CFL alphabet on a 64-axis block (class |
| 93 | 93 | // wrong-alphabet-same-value: same value, wrong interval, silent desync). |
| 94 | 94 | let cfl = if cfl && bw.max(bh) > 32 { |
| 95 | - hit!(NOCFL_UV_MODE_HITS); | |
| 96 | 95 | false |
| 97 | 96 | } else { |
| 98 | 97 | cfl |
| @@ -134,10 +133,8 @@ pub(super) fn read_intra_mode_rect( | ||
| 134 | 133 | // refused by name when it fires. |
| 135 | 134 | if allow_intrabc_frame(fctx) { |
| 136 | 135 | let use_intrabc = dec.symbol(&mut cdfs.intrabc) != 0; |
| 137 | - hit!(RECT_INTRABC_READS); | |
| 138 | 136 | istep!("intrabc", use_intrabc as i32); |
| 139 | 137 | if use_intrabc { |
| 140 | - hit!(INTRABC_HITS); | |
| 141 | 138 | // libaom `read_intrabc_info`: the DV read, then an immediate |
| 142 | 139 | // return out of the mode-info read -- no `y_mode`, no `uv_mode`, |
| 143 | 140 | // no angle deltas, no palette, no filter intra. The caller owns |
| @@ -200,19 +197,12 @@ pub(super) fn read_intra_mode_rect( | ||
| 200 | 197 | } else { |
| 201 | 198 | None |
| 202 | 199 | }; |
| 203 | - if has_chroma && (9..=12).contains(&uv_mode) { | |
| 204 | - hit!(SMOOTH_UV_HITS); | |
| 205 | - } | |
| 206 | 200 | let angle_delta_uv = if has_chroma && (V_PRED..=D67_PRED).contains(&uv_mode) { |
| 207 | - hit!(DIRECTIONAL_UV_HITS); | |
| 208 | 201 | read_angle_delta(dec, &mut cdfs.angle_delta[uv_mode - V_PRED]) |
| 209 | 202 | } else { |
| 210 | 203 | 0 |
| 211 | 204 | }; |
| 212 | 205 | istep!("angle_uv", angle_delta_uv); |
| 213 | - if angle_delta_uv != 0 { | |
| 214 | - hit!(UV_ANGLE_DELTA_HITS); | |
| 215 | - } | |
| 216 | 206 | // `read_palette_mode_info` (spec 5.11.13), rect-generalised |
| 217 | 207 | // (lane-palette2 r4): same bsize-ctx-gated read as [`read_intra_mode`], |
| 218 | 208 | // just keyed by [`palette_bsize_ctx_wh`] instead of the square-only |
| @@ -223,10 +213,6 @@ pub(super) fn read_intra_mode_rect( | ||
| 223 | 213 | let mut palette_y_pending: Option<(usize, [u16; 8])> = None; |
| 224 | 214 | let mut palette_uv_pending: Option<(usize, [u16; 8], [u16; 8])> = None; |
| 225 | 215 | if allow_screen_content_tools && let Some(bsize_ctx) = palette_bsize_ctx_wh(bw, bh) { |
| 226 | - // r6: this is the exact site the removed blanket refusal used to | |
| 227 | - // guard -- reached for EVERY rect strip in a screen-content frame, | |
| 228 | - // independent of whether the block ends up using a palette. | |
| 229 | - hit!(RECT_SCREEN_CONTENT_HITS); | |
| 230 | 216 | let (mode_ctx, cache) = palette.unwrap_or((0, &[])); |
| 231 | 217 | let use_palette_y = |
| 232 | 218 | mode == DC_PRED && dec.symbol(&mut cdfs.palette_y_mode[bsize_ctx][mode_ctx]) != 0; |
| @@ -269,7 +255,6 @@ pub(super) fn read_intra_mode_rect( | ||
| 269 | 255 | } |
| 270 | 256 | istep!("use_filter_intra", use_filter_intra as i32); |
| 271 | 257 | if use_filter_intra { |
| 272 | - hit!(FILTER_INTRA_HITS); | |
| 273 | 258 | let fi_mode = dec.symbol(&mut cdfs.filter_intra_mode); |
| 274 | 259 | istep!("filter_intra_mode", fi_mode as i32); |
| 275 | 260 | filter_intra = Some(fi_mode); |
| @@ -287,8 +272,6 @@ pub(super) fn read_intra_mode_rect( | ||
| 287 | 272 | palette_onscreen(mi_r, mi_c, bw, bh, fctx), |
| 288 | 273 | false, |
| 289 | 274 | ); |
| 290 | - hit!(PALETTE_HITS); | |
| 291 | - hit!(PALETTE_RECT_HITS); | |
| 292 | 275 | PaletteY { |
| 293 | 276 | size: n, |
| 294 | 277 | colors, |
| @@ -309,7 +292,6 @@ pub(super) fn read_intra_mode_rect( | ||
| 309 | 292 | (ss_x(fctx), ss_y(fctx)), |
| 310 | 293 | ); |
| 311 | 294 | let map = decode_color_index_map_wh(dec, cdfs, n, cw, ch, on, true); |
| 312 | - hit!(PALETTE_UV_HITS); | |
| 313 | 295 | PaletteUv { |
| 314 | 296 | size: n, |
| 315 | 297 | u_colors, |
| @@ -618,13 +600,6 @@ pub(super) fn decode_rect_split( | ||
| 618 | 600 | (4, 8) => Some(3), |
| 619 | 601 | _ => None, |
| 620 | 602 | } { |
| 621 | - hit_do! { | |
| 622 | - RECT_SPLIT_CHROMA_SHAPE_HITS.with(|c| { | |
| 623 | - let mut hits = c.get(); | |
| 624 | - hits[i] += 1; | |
| 625 | - c.set(hits); | |
| 626 | - }); | |
| 627 | - } | |
| 628 | 603 | } |
| 629 | 604 | if !m.skip && chroma.is_none() && !chroma_tiled { |
| 630 | 605 | // Diagnostic for the next caller that lands here (class |
| @@ -648,10 +623,6 @@ pub(super) fn decode_rect_split( | ||
| 648 | 623 | "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here", |
| 649 | 624 | )); |
| 650 | 625 | } |
| 651 | - hit!(RECT_SPLIT_TX_HITS); | |
| 652 | - if bw.max(bh) == 64 && bw / tx_w > 1 && bh / tx_h > 1 { | |
| 653 | - hit!(RECT_SPLIT_SB_INTERIOR_TU_HITS); | |
| 654 | - } | |
| 655 | 626 | // LUMA: `bw/tx` x `bh/tx` square transform units, raster order. |
| 656 | 627 | // A square unit reads through the ordinary square [`read_plane`]; a rect |
| 657 | 628 | // one (a 1:4 strip's first split) reads through [`read_coeffs_rect`] with |
| @@ -786,13 +757,6 @@ pub(super) fn decode_rect_split( | ||
| 786 | 757 | if crate::envflags::env_flag!("EC_RECT64TU") { |
| 787 | 758 | eprintln!("EC_RECT64TU mi={tu_mi:?} tx={tx_w}x{tx_h} mode={}", m.mode); |
| 788 | 759 | } |
| 789 | - hit_do! { | |
| 790 | - RECT64_CORNER_TU_HITS.with(|c| { | |
| 791 | - let mut v = c.get(); | |
| 792 | - v[usize::from(tx_h > tx_w)] += 1; | |
| 793 | - c.set(v); | |
| 794 | - }); | |
| 795 | - } | |
| 796 | 760 | let tu_around = neighbours.around_mi_rect(tu_mi, tx_w, tx_h)[0]; |
| 797 | 761 | let mut coding = cdfs.txb(TxbSet::Luma64, fi_tx_row(m.mode, m.filter_intra)); |
| 798 | 762 | let (corner, tu_tx_type) = read_coeffs( |
| @@ -1122,7 +1086,6 @@ pub(super) fn decode_rect_split( | ||
| 1122 | 1086 | // `REFUSED: unsupported: AV1 tile (a Golomb tail longer |
| 1123 | 1087 | // than this decoder reads)`. |
| 1124 | 1088 | if cpx + cu_col * 4 >= u.true_width || cpy + cu_row * 4 >= u.true_height { |
| 1125 | - hit!(RECT_SPLIT_LOSSLESS_CHROMA_OFFTILE_HITS); | |
| 1126 | 1089 | continue; |
| 1127 | 1090 | } |
| 1128 | 1091 | let cu_mi = (mi_r + cu_row * (span_y / MI), mi_c + cu_col * (span_x / MI)); |
| @@ -1195,9 +1158,6 @@ pub(super) fn decode_rect_split( | ||
| 1195 | 1158 | m.smooth_neighbor_uv, |
| 1196 | 1159 | fctx, |
| 1197 | 1160 | )?; |
| 1198 | - if span_x == 4 && span_y == 4 { | |
| 1199 | - hit!(RECT_SPLIT_LOSSLESS_CHROMA444_HITS); | |
| 1200 | - } | |
| 1201 | 1161 | neighbours.record_mi_chroma(cu_mi, span_x, span_y, plane_idx, &grid); |
| 1202 | 1162 | ll_chroma_units.push((cu_mi, plane_idx, grid.clone(), span_x, span_y)); |
| 1203 | 1163 | last[plane_idx - 1] = grid; |
| @@ -1229,12 +1189,6 @@ pub(super) fn decode_rect_split( | ||
| 1229 | 1189 | }; |
| 1230 | 1190 | // lane-av1-422: the witness counter, keyed to ss (1,0) so only a 4:2:2 |
| 1231 | 1191 | // frame's square chroma units count it. |
| 1232 | - if uw == uh && ss_x(fctx) == 1 && ss_y(fctx) == 0 { | |
| 1233 | - hit!(CHROMA422_SQUARE_HITS); | |
| 1234 | - } | |
| 1235 | - if chroma_422_pair_wide { | |
| 1236 | - hit!(CHROMA422_PAIR_WIDE_HITS); | |
| 1237 | - } | |
| 1238 | 1192 | let (nw, nh) = (chroma_block_w / uw, chroma_block_h / uh); |
| 1239 | 1193 | // lane-av1-422stripanchor: the pair's plane block is BLOCK_INVALID |
| 1240 | 1194 | // whatever the pair size (`num_pels_log2_lookup[255]` reads 0xff in |
| @@ -1363,14 +1317,6 @@ pub(super) fn decode_rect_split( | ||
| 1363 | 1317 | if cu_reach.above_right != reach.above_right |
| 1364 | 1318 | || cu_reach.below_left != reach.below_left |
| 1365 | 1319 | { |
| 1366 | - hit!(RECT_TILED_CHROMA_UNIT_REACH_HITS); | |
| 1367 | - } | |
| 1368 | - if nw * nh > 1 { | |
| 1369 | - match (nw, nh) { | |
| 1370 | - (2, 1) => hit!(RECT_TILED_CHROMA_2X1_HITS), | |
| 1371 | - (1, 2) => hit!(RECT_TILED_CHROMA_1X2_HITS), | |
| 1372 | - _ => hit!(RECT_TILED_CHROMA_NXN_HITS), | |
| 1373 | - } | |
| 1374 | 1320 | } |
| 1375 | 1321 | // 32x32 does not fit read_coeffs_rect's scratch (768). The |
| 1376 | 1322 | // square reader is the path every other 32x32 chroma unit uses. |
| @@ -1510,9 +1456,6 @@ pub(super) fn decode_rect_split( | ||
| 1510 | 1456 | // (lane-rectsplit r4: lifting the split-transform refusal moved |
| 1511 | 1457 | // superblock strips onto this path, so only counting there would |
| 1512 | 1458 | // leave the delta_q gate's counter silent for them). |
| 1513 | - if bw.max(bh) == 64 && fctx.current_q_idx.with(|c| c.get()) != i32::from(base_q_idx) { | |
| 1514 | - hit!(RECT64_QIDX_DRIFT_HITS); | |
| 1515 | - } | |
| 1516 | 1459 | let residual = dequant_and_inverse_typed_wh( |
| 1517 | 1460 | &levels, |
| 1518 | 1461 | chroma_w, |
| @@ -1985,14 +1928,6 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 1985 | 1928 | mi_r * MI |
| 1986 | 1929 | ); |
| 1987 | 1930 | } |
| 1988 | - hit_do! { | |
| 1989 | - INTRA16X4_IN_INTER_HITS.with(|h| { | |
| 1990 | - let mut v = h.get(); | |
| 1991 | - v[usize::from(!horz)] += 1; | |
| 1992 | - v[2] += usize::from(has_chroma); | |
| 1993 | - h.set(v); | |
| 1994 | - }); | |
| 1995 | - } | |
| 1996 | 1931 | return Ok(()); |
| 1997 | 1932 | } |
| 1998 | 1933 | // lane-inter128intra r1: the 128 superblock's PARTITION_HORZ/VERT half |
| @@ -2143,13 +2078,6 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 2143 | 2078 | (32, 8) => 2, |
| 2144 | 2079 | _ => 3, |
| 2145 | 2080 | }; |
| 2146 | - hit_do! { | |
| 2147 | - INTRA_RECT4_IN_INTER_HITS.with(|h| { | |
| 2148 | - let mut v = h.get(); | |
| 2149 | - v[shape] += 1; | |
| 2150 | - h.set(v); | |
| 2151 | - }); | |
| 2152 | - } | |
| 2153 | 2081 | return Ok(()); |
| 2154 | 2082 | } |
| 2155 | 2083 | crate::msac::SymbolDecoder::set_symr_cdf("y_mode"); |
| @@ -2177,9 +2105,6 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 2177 | 2105 | } else { |
| 2178 | 2106 | 0 |
| 2179 | 2107 | }; |
| 2180 | - if angle_delta_y != 0 { | |
| 2181 | - hit!(INTRA_IN_INTER_ANGLE_DELTA_Y_HITS); | |
| 2182 | - } | |
| 2183 | 2108 | // `is_cfl_allowed` (spec 5.11.5) caps CFL at 32x32, so the |
| 2184 | 2109 | // superblock-level strip reads the no-CFL alphabet -- the same split |
| 2185 | 2110 | // [`read_intra_mode_rect`] makes for [`decode_block_rect64`]. |
| @@ -2204,9 +2129,6 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 2204 | 2129 | dec.debug_state().0 |
| 2205 | 2130 | ); |
| 2206 | 2131 | } |
| 2207 | - if (9..=12).contains(&uv_mode) { | |
| 2208 | - hit!(SMOOTH_UV_HITS); | |
| 2209 | - } | |
| 2210 | 2132 | let alpha = if cfl_allowed && uv_mode == UV_CFL_PRED { |
| 2211 | 2133 | Some(read_cfl_alphas(dec, cdfs)) |
| 2212 | 2134 | } else { |
| @@ -2218,15 +2140,10 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 2218 | 2140 | uv_mode |
| 2219 | 2141 | }; |
| 2220 | 2142 | let angle_delta_uv = if (V_PRED..=D67_PRED).contains(&uv_mode) { |
| 2221 | - hit!(DIRECTIONAL_UV_HITS); | |
| 2222 | 2143 | read_angle_delta(dec, &mut cdfs.angle_delta[uv_mode - V_PRED]) |
| 2223 | 2144 | } else { |
| 2224 | 2145 | 0 |
| 2225 | 2146 | }; |
| 2226 | - if angle_delta_uv != 0 { | |
| 2227 | - hit!(UV_ANGLE_DELTA_HITS); | |
| 2228 | - hit!(INTRA_IN_INTER_ANGLE_DELTA_UV_HITS); | |
| 2229 | - } | |
| 2230 | 2147 | // `read_palette_mode_info` (spec 5.11.13), in the position |
| 2231 | 2148 | // `read_intra_block_mode_info` writes it: after the chroma mode and |
| 2232 | 2149 | // before `filter_intra`. lane-t900 r21: a `--tune-content=screen` inter |
| @@ -2242,7 +2159,6 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 2242 | 2159 | let mut palette_y_pending: Option<(usize, [u16; 8])> = None; |
| 2243 | 2160 | let mut palette_uv_pending: Option<(usize, [u16; 8], [u16; 8])> = None; |
| 2244 | 2161 | if allow_screen_content_tools && let Some(bsize_ctx) = palette_bsize_ctx_wh(bw, bh) { |
| 2245 | - hit!(INTRA_RECT_IN_INTER_SCREEN_HITS); | |
| 2246 | 2162 | let use_palette_y = |
| 2247 | 2163 | mode == DC_PRED && dec.symbol(&mut cdfs.palette_y_mode[bsize_ctx][palette_ctx]) != 0; |
| 2248 | 2164 | if use_palette_y { |
| @@ -2284,8 +2200,6 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 2284 | 2200 | && let Some(class) = filter_intra_size_class_rect(bw, bh) |
| 2285 | 2201 | && dec.symbol(&mut cdfs.filter_intra[class]) != 0 |
| 2286 | 2202 | { |
| 2287 | - hit!(FILTER_INTRA_HITS); | |
| 2288 | - hit!(INTRA_IN_INTER_FILTER_INTRA_HITS); | |
| 2289 | 2203 | filter_intra = Some(dec.symbol(&mut cdfs.filter_intra_mode)); |
| 2290 | 2204 | } |
| 2291 | 2205 | // `av1_visit_palette`: Y's colour-index map then the shared chroma one. |
| @@ -2299,9 +2213,6 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 2299 | 2213 | palette_onscreen(mi_r, mi_c, bw, bh, fctx), |
| 2300 | 2214 | false, |
| 2301 | 2215 | ); |
| 2302 | - hit!(PALETTE_HITS); | |
| 2303 | - hit!(PALETTE_RECT_HITS); | |
| 2304 | - hit!(INTRA_IN_INTER_PALETTE_Y_HITS); | |
| 2305 | 2216 | PaletteY { |
| 2306 | 2217 | size: n, |
| 2307 | 2218 | colors, |
| @@ -2317,8 +2228,6 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 2317 | 2228 | (ss_x(fctx), ss_y(fctx)), |
| 2318 | 2229 | ); |
| 2319 | 2230 | let map = decode_color_index_map_wh(dec, cdfs, n, cw, ch, on, true); |
| 2320 | - hit!(PALETTE_UV_HITS); | |
| 2321 | - hit!(INTRA_IN_INTER_PALETTE_UV_HITS); | |
| 2322 | 2231 | PaletteUv { |
| 2323 | 2232 | size: n, |
| 2324 | 2233 | u_colors, |
| @@ -2337,13 +2246,7 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 2337 | 2246 | // context-read-from-one-cell). |
| 2338 | 2247 | let coarse_pair = neighbours.modes_above_left(r, c); |
| 2339 | 2248 | let (nb_above_mode, nb_left_mode) = neighbours.modes_above_left_mi(mi_r, mi_c, coarse_pair); |
| 2340 | - if (nb_above_mode, nb_left_mode) != coarse_pair { | |
| 2341 | - hit!(EDGE_FILTER_MI_FIX_HITS); | |
| 2342 | - } | |
| 2343 | 2249 | let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode); |
| 2344 | - if smooth_neighbor { | |
| 2345 | - hit!(SMOOTH_LUMA_HITS); | |
| 2346 | - } | |
| 2347 | 2250 | let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c, fctx); |
| 2348 | 2251 | // lane-av1mixloss: the lossless-segment early return (`decodeframe.c:1203`) |
| 2349 | 2252 | // precedes `TX_MODE_SELECT`, so a lossless-segment intra-rect block inside |
| @@ -2367,19 +2270,6 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 2367 | 2270 | } else { |
| 2368 | 2271 | 0 |
| 2369 | 2272 | }; |
| 2370 | - if depth != 0 || lossless(fctx) { | |
| 2371 | - hit!(TX_DEPTH_HITS); | |
| 2372 | - // lane-intrasplit r1: a split intra strip in an inter frame walks the | |
| 2373 | - // key frame's own per-TU path ([`decode_rect_split`] below); what was | |
| 2374 | - // wrong when this refusal was written was the depth SYMBOL, not the walk. | |
| 2375 | - hit_do! { | |
| 2376 | - INTRA_RECT_IN_INTER_SPLIT_TX_HITS.with(|h| { | |
| 2377 | - let mut v = h.get(); | |
| 2378 | - v[depth.min(2)] += 1; | |
| 2379 | - h.set(v); | |
| 2380 | - }); | |
| 2381 | - } | |
| 2382 | - } | |
| 2383 | 2273 | // lane-intrasplit r3: print EVERY intra strip with its depth, not only the |
| 2384 | 2274 | // split ones -- a `depth=0`-only stream is a witness gap in the SOURCE, and |
| 2385 | 2275 | // the two are indistinguishable when the diagnostic fires on splits alone. |
| @@ -2467,13 +2357,6 @@ pub(super) fn decode_intra_rect_in_inter( | ||
| 2467 | 2357 | 32 => 1, |
| 2468 | 2358 | _ => 2, |
| 2469 | 2359 | }; |
| 2470 | - hit_do! { | |
| 2471 | - INTRA_RECT_IN_INTER_HITS.with(|h| { | |
| 2472 | - let mut v = h.get(); | |
| 2473 | - v[class] += 1; | |
| 2474 | - h.set(v); | |
| 2475 | - }); | |
| 2476 | - } | |
| 2477 | 2360 | Ok(()) |
| 2478 | 2361 | } |
| 2479 | 2362 | |
| @@ -2514,21 +2397,10 @@ pub(super) fn decode_intrabc_rect( | ||
| 2514 | 2397 | base_q_idx: u8, |
| 2515 | 2398 | fctx: &crate::decode::FrameCtx, |
| 2516 | 2399 | ) -> Result<()> { |
| 2517 | - hit!(INTRABC_RECT_HITS); | |
| 2518 | 2400 | // [horz, vert]: see `INTRABC_RECT_CODED_HITS` / `INTRABC_RECT_SKIPPED_HITS`. |
| 2519 | 2401 | let idx = usize::from(bh > bw); |
| 2520 | 2402 | if skip { |
| 2521 | - INTRABC_RECT_SKIPPED_HITS.with(|c| { | |
| 2522 | - let mut seen = c.get(); | |
| 2523 | - seen[idx] += 1; | |
| 2524 | - c.set(seen); | |
| 2525 | - }); | |
| 2526 | 2403 | } else { |
| 2527 | - INTRABC_RECT_CODED_HITS.with(|c| { | |
| 2528 | - let mut seen = c.get(); | |
| 2529 | - seen[idx] += 1; | |
| 2530 | - c.set(seen); | |
| 2531 | - }); | |
| 2532 | 2404 | } |
| 2533 | 2405 | let (px, py) = (mi_c * MI, mi_r * MI); |
| 2534 | 2406 | // lane-whtshape: a LOSSLESS block's chroma plane block is |
| @@ -2576,12 +2448,6 @@ pub(super) fn decode_intrabc_rect( | ||
| 2576 | 2448 | skip, |
| 2577 | 2449 | fctx, |
| 2578 | 2450 | )?; |
| 2579 | - if leaves.is_some() { | |
| 2580 | - hit!(INTRABC_RECT_VARTX_HITS); | |
| 2581 | - } | |
| 2582 | - if ss_x(fctx) == 0 && ss_y(fctx) == 0 { | |
| 2583 | - hit!(IBC_RECT_CHROMA_FOOTPRINT_444_HITS); | |
| 2584 | - } | |
| 2585 | 2451 | // lane-ibc444c: per-block geometry, for the chroma-tail attribution. |
| 2586 | 2452 | if crate::envflags::env_flag!("EC_IBCBLOCK") { |
| 2587 | 2453 | eprintln!( |
| @@ -2704,19 +2570,6 @@ pub(super) fn decode_intrabc_rect( | ||
| 2704 | 2570 | fctx, |
| 2705 | 2571 | ); |
| 2706 | 2572 | if let Some(ls) = leaves.as_ref() { |
| 2707 | - // lane-av1-loss64, merged: the same reset [`decode_intrabc_owned_rect`]'s | |
| 2708 | - // skip arm performs -- libaom `av1_reset_entropy_context` | |
| 2709 | - // (`if (mbmi->skip_txfm)`, decodeframe.c:1262 -> blockd.c:58): a | |
| 2710 | - // SKIPPED block zeroes its whole entropy-band footprint. This | |
| 2711 | - // helper serves `decode_block_rect4`'s 1:4 strips on this tree, | |
| 2712 | - // so a skipped lossless strip whose `leaves` resolved (every | |
| 2713 | - // lossless frame -- `read_block_tx_size_rect`'s lossless arm | |
| 2714 | - // returns the 4x4 grid before it looks at `skip`) left the | |
| 2715 | - // PREVIOUS occupant's luma bands standing and the NEXT block's | |
| 2716 | - // partition parse diverged from libaom's: the 320x242 lossless | |
| 2717 | - // sb128 gate read a phantom unskipped 8x32 intrabc strip at | |
| 2718 | - // mi(56,66) right after the skipped 8x16 one at mi(48,66). | |
| 2719 | - hit!(SKIP_LOSSLESS_BAND_RESET_HITS); | |
| 2720 | 2573 | for &(row, col, tw, th) in ls { |
| 2721 | 2574 | neighbours.record_mi_luma_rect( |
| 2722 | 2575 | (mi_r + row, mi_c + col), |
| @@ -2898,21 +2751,6 @@ pub(super) fn decode_intrabc_rect( | ||
| 2898 | 2751 | around[2] = c[2]; |
| 2899 | 2752 | } |
| 2900 | 2753 | if lossless(fctx) { |
| 2901 | - // lane-whtshape: at lossless libaom codes TX_4X4 on EVERY | |
| 2902 | - // plane of a block -- `read_tx_size` returns `TX_4X4` for a | |
| 2903 | - // lossless block before it looks at a tree, `read_tx_mode` | |
| 2904 | - // already forced `ONLY_4X4` for the frame, and | |
| 2905 | - // `get_vartx_max_txsize` returns `TX_4X4` for every plane | |
| 2906 | - // -- so this block's chroma plane block is a | |
| 2907 | - // `(cw/4) * (ch/4)` raster of 4x4 units, PLANE-MAJOR | |
| 2908 | - // (`decode_token_recon_block`: every U unit, then every V | |
| 2909 | - // unit), not the single rect unit the two | |
| 2910 | - // `read_inter_plane_rect` calls below read. That single | |
| 2911 | - // 8x4 unit is what reached the lossless WHT with the wrong | |
| 2912 | - // shape (the `debug_assert_eq!((w, h), (4, 4))` this lane | |
| 2913 | - // replaced). Same helper, same walk, as the inter 8x8 and | |
| 2914 | - // 128 paths. | |
| 2915 | - hit!(INTRABC_RECT_LOSSLESS_CHROMA4_HITS); | |
| 2916 | 2754 | let mut uo = vec![0i32; cside * cside]; |
| 2917 | 2755 | let mut vo = vec![0i32; cside * cside]; |
| 2918 | 2756 | read_inter_chroma_lossless( |
| @@ -3120,7 +2958,6 @@ pub(super) fn decode_intrabc_128rect( | ||
| 3120 | 2958 | base_q_idx: u8, |
| 3121 | 2959 | fctx: &crate::decode::FrameCtx, |
| 3122 | 2960 | ) -> Result<()> { |
| 3123 | - hit!(INTRABC_128RECT_HITS); | |
| 3124 | 2961 | if crate::envflags::env_flag!("EC_AV1_TRACE") { |
| 3125 | 2962 | let (rng, _) = dec.debug_state(); |
| 3126 | 2963 | eprintln!( |
| @@ -3272,12 +3109,6 @@ pub(super) fn decode_intrabc_128rect( | ||
| 3272 | 3109 | fctx, |
| 3273 | 3110 | ); |
| 3274 | 3111 | if let Some(ls) = leaves.as_ref() { |
| 3275 | - // A LOSSLESS frame's `read_block_tx_size_rect` resolves the TX_4X4 | |
| 3276 | - // grid before it looks at `skip`; the skipped block still zeroes | |
| 3277 | - // its entropy-band footprint over every unit (libaom | |
| 3278 | - // `av1_reset_entropy_context` under `if (mbmi->skip_txfm)`) -- | |
| 3279 | - // the same arm [`decode_intrabc_rect`]'s loss64 merge added. | |
| 3280 | - hit!(SKIP_LOSSLESS_BAND_RESET_HITS); | |
| 3281 | 3112 | for &(row, col, tw, th) in ls { |
| 3282 | 3113 | neighbours.record_mi_luma_rect( |
| 3283 | 3114 | (mi_r + row, mi_c + col), |
| @@ -3540,8 +3371,6 @@ pub(super) fn decode_intrabc_128rect( | ||
| 3540 | 3371 | st.dc, st.level |
| 3541 | 3372 | ); |
| 3542 | 3373 | } |
| 3543 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 3544 | - INTRABC_128RECT_CHROMA_CHUNK_HITS.with(|c| c.set(c.get() + 1)); | |
| 3545 | 3374 | // lane-av1-ibcrect: per-unit chroma context -- the |
| 3546 | 3375 | // end-of-block record's composed-grid re-stamp |
| 3547 | 3376 | // must not stand (replayed below). |
| @@ -3826,9 +3655,6 @@ pub(super) fn decode_block_rect( | ||
| 3826 | 3655 | ); |
| 3827 | 3656 | } |
| 3828 | 3657 | let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode); |
| 3829 | - if smooth_neighbor { | |
| 3830 | - hit!(SMOOTH_LUMA_HITS); | |
| 3831 | - } | |
| 3832 | 3658 | // lane-chroma r3: chroma's own edge-filter-strength neighbour check |
| 3833 | 3659 | // (spec `get_intra_edge_filter_type`) reads the CHROMA neighbour's |
| 3834 | 3660 | // `uv_mode`, not the luma one. |
| @@ -3839,9 +3665,6 @@ pub(super) fn decode_block_rect( | ||
| 3839 | 3665 | // rectangle just as happily), so a `use_filter_intra` strip at this level |
| 3840 | 3666 | // predicts instead of refusing. The below-16x16 leaf arm |
| 3841 | 3667 | // (`decode_leaf_rect`) keeps the refusal: it has no gate of its own. |
| 3842 | - if filter_intra.is_some() { | |
| 3843 | - hit!(FILTER_INTRA_RECT_HITS); | |
| 3844 | - } | |
| 3845 | 3668 | let uv_predict_mode = if uv_mode == UV_CFL_PRED { |
| 3846 | 3669 | DC_PRED |
| 3847 | 3670 | } else { |
| @@ -3889,7 +3712,6 @@ pub(super) fn decode_block_rect( | ||
| 3889 | 3712 | fctx, |
| 3890 | 3713 | ); |
| 3891 | 3714 | if depth != 0 || lossless(fctx) { |
| 3892 | - hit!(TX_DEPTH_HITS); | |
| 3893 | 3715 | // lane-rectsplit r1: a split transform is predicted and reconstructed |
| 3894 | 3716 | // per transform unit, each unit taking its edges from the previous |
| 3895 | 3717 | // unit's reconstruction inside this same strip (spec 5.11.36) -- |
| @@ -3922,9 +3744,6 @@ pub(super) fn decode_block_rect( | ||
| 3922 | 3744 | ) |
| 3923 | 3745 | }), |
| 3924 | 3746 | }; |
| 3925 | - if palette_y.is_some() || palette_uv.is_some() { | |
| 3926 | - hit!(PALETTE_SPLIT_TX_HITS); | |
| 3927 | - } | |
| 3928 | 3747 | decode_rect_split( |
| 3929 | 3748 | dec, |
| 3930 | 3749 | cdfs, |
| @@ -3957,7 +3776,6 @@ pub(super) fn decode_block_rect( | ||
| 3957 | 3776 | .as_ref() |
| 3958 | 3777 | .map_or((0, [0u16; 8]), |p| (p.size, p.u_colors)); |
| 3959 | 3778 | neighbours.record_palette_uv_rect((mi_r, mi_c), bw, bh, puv_size, puv_colors); |
| 3960 | - hit!(RECT_PARTITION_HITS); | |
| 3961 | 3779 | return Ok(()); |
| 3962 | 3780 | } |
| 3963 | 3781 | let (tx_w, tx_h) = (bw, bh); |
| @@ -4315,7 +4133,6 @@ pub(super) fn decode_block_rect( | ||
| 4315 | 4133 | uv_predict_mode, |
| 4316 | 4134 | &[&luma_levels[..], &u_levels[..], &v_levels[..]], |
| 4317 | 4135 | ); |
| 4318 | - hit!(RECT_COEFF_HITS); | |
| 4319 | 4136 | } |
| 4320 | 4137 | } |
| 4321 | 4138 | let (py_size, py_colors) = palette_y |
| @@ -4336,7 +4153,6 @@ pub(super) fn decode_block_rect( | ||
| 4336 | 4153 | 0, |
| 4337 | 4154 | fctx, |
| 4338 | 4155 | ); |
| 4339 | - hit!(RECT_PARTITION_HITS); | |
| 4340 | 4156 | if crate::envflags::env_flag!("EC_AV1_TRACE") { |
| 4341 | 4157 | eprintln!("TRACE_RECT32_END mi_row={mi_r} mi_col={mi_c} bw={bw} bh={bh}"); |
| 4342 | 4158 | } |
| @@ -4412,9 +4228,6 @@ pub(super) fn decode_leaf_rect( | ||
| 4412 | 4228 | let (above_mode, left_mode) = |
| 4413 | 4229 | neighbours.modes_above_left_mi(leaf_mi.0, leaf_mi.1, (above_mode, left_mode)); |
| 4414 | 4230 | let smooth_neighbor = is_smooth_mode(above_mode) || is_smooth_mode(left_mode); |
| 4415 | - if smooth_neighbor { | |
| 4416 | - hit!(SMOOTH_LUMA_HITS); | |
| 4417 | - } | |
| 4418 | 4231 | // The palette-Y mode CDF row is picked by the neighbours' palette use |
| 4419 | 4232 | // (`palette_ctx_and_cache`), so this sub-16x16 leaf must pass its own real |
| 4420 | 4233 | // ctx/cache -- reading `palette_y_mode` off row 0 when a neighbour did use |
| @@ -4478,9 +4291,6 @@ pub(super) fn decode_leaf_rect( | ||
| 4478 | 4291 | // lane-kf900 r4: palette prediction on this shape, the same colour-index |
| 4479 | 4292 | // map -> base colours buffer [`decode_block_rect`] hands each |
| 4480 | 4293 | // `reconstruct_rect` through [`set_palette_pred`]. |
| 4481 | - if palette_y.is_some() || palette_uv.is_some() { | |
| 4482 | - hit!(RECT4_PALETTE_HITS); | |
| 4483 | - } | |
| 4484 | 4294 | let palette_y_buf: Option<Vec<u16>> = palette_y |
| 4485 | 4295 | .as_ref() |
| 4486 | 4296 | .map(|p| p.map.iter().map(|&i| p.colors[i as usize]).collect()); |
| @@ -4499,14 +4309,6 @@ pub(super) fn decode_leaf_rect( | ||
| 4499 | 4309 | if crate::envflags::env_flag!("EC_AV1_RECTX_TRACE") { |
| 4500 | 4310 | eprintln!(" skip={skip} mode={mode} angle_delta_y={angle_delta_y} uv_mode={uv_mode}"); |
| 4501 | 4311 | } |
| 4502 | - if filter_intra.is_some() { | |
| 4503 | - // lane-fistrip r1: `predict_filter_intra` already walks its 4x2 | |
| 4504 | - // patches over a true `bw`x`bh` block (lane-rectsplit r1), so an | |
| 4505 | - // 8x16/16x8 strip predicts through the same call `reconstruct_rect` | |
| 4506 | - // below already makes; this refusal was square-only prose. | |
| 4507 | - hit!(FILTER_INTRA_RECT_HITS); | |
| 4508 | - hit!(FILTER_INTRA_RECT_SUB16_HITS); | |
| 4509 | - } | |
| 4510 | 4312 | let uv_predict_mode = if uv_mode == UV_CFL_PRED { |
| 4511 | 4313 | DC_PRED |
| 4512 | 4314 | } else { |
| @@ -4566,11 +4368,6 @@ pub(super) fn decode_leaf_rect( | ||
| 4566 | 4368 | fctx, |
| 4567 | 4369 | ); |
| 4568 | 4370 | if depth != 0 || lossless(fctx) { |
| 4569 | - // The same per-transform-unit walk the bigger strips take | |
| 4570 | - // (`depth_to_tx_wh`: TX_16X8 -> TX_8X8 at depth 1, -> TX_4X4 at | |
| 4571 | - // depth 2), addressed at this leaf's own mi position. | |
| 4572 | - hit!(TX_DEPTH_HITS); | |
| 4573 | - hit!(SUB16_SPLIT_HITS); | |
| 4574 | 4371 | let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx); |
| 4575 | 4372 | let modes = RectStripModes { |
| 4576 | 4373 | skip, |
| @@ -4588,9 +4385,6 @@ pub(super) fn decode_leaf_rect( | ||
| 4588 | 4385 | palette_y: palette_y_buf.clone(), |
| 4589 | 4386 | palette_uv: palette_uv_bufs.clone(), |
| 4590 | 4387 | }; |
| 4591 | - if palette_y.is_some() || palette_uv.is_some() { | |
| 4592 | - hit!(PALETTE_SPLIT_TX_HITS); | |
| 4593 | - } | |
| 4594 | 4388 | decode_rect_split( |
| 4595 | 4389 | dec, |
| 4596 | 4390 | cdfs, |
| @@ -4908,7 +4702,6 @@ pub(super) fn decode_leaf_rect( | ||
| 4908 | 4702 | smooth_neighbor_uv, |
| 4909 | 4703 | fctx, |
| 4910 | 4704 | ); |
| 4911 | - hit!(RECT_LEAF_COEFF_HITS); | |
| 4912 | 4705 | } |
| 4913 | 4706 | neighbours.record_mi_rect( |
| 4914 | 4707 | leaf_mi, |
crates/ec-av1/src/decode/rect4.rsmodified+0 -142
| @@ -117,9 +117,6 @@ pub(super) fn decode_block_rect4( | ||
| 117 | 117 | // [`decode_block_rect`] does one aspect ratio up -- the colour-index map |
| 118 | 118 | // mapped through the base colours IS the prediction (it reads no edge |
| 119 | 119 | // pixels), handed to each `reconstruct_rect` through [`set_palette_pred`]. |
| 120 | - if palette_y.is_some() || palette_uv.is_some() { | |
| 121 | - hit!(RECT4_PALETTE_HITS); | |
| 122 | - } | |
| 123 | 120 | let palette_y_buf: Option<Vec<u16>> = palette_y |
| 124 | 121 | .as_ref() |
| 125 | 122 | .map(|p| p.map.iter().map(|&i| p.colors[i as usize]).collect()); |
| @@ -136,9 +133,6 @@ pub(super) fn decode_block_rect4( | ||
| 136 | 133 | .as_ref() |
| 137 | 134 | .map_or((0, [0u16; 8]), |p| (p.size, p.u_colors)); |
| 138 | 135 | let smooth_neighbor = is_smooth_mode(above_mode) || is_smooth_mode(left_mode); |
| 139 | - if smooth_neighbor { | |
| 140 | - hit!(SMOOTH_LUMA_HITS); | |
| 141 | - } | |
| 142 | 136 | // lane-rectsplitx r2: this strip's REAL mi, not the [`SUB`] cell's |
| 143 | 137 | // top-left -- a 1:4 strip starts 8 px into a 16-px cell, so |
| 144 | 138 | // `r * (SUB / MI)` names a different mi column and the chroma |
| @@ -147,11 +141,8 @@ pub(super) fn decode_block_rect4( | ||
| 147 | 141 | // with luma bit-exact). |
| 148 | 142 | let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c, fctx); |
| 149 | 143 | if filter_intra.is_some() { |
| 150 | - hit!(FILTER_INTRA_RECT_HITS); | |
| 151 | 144 | if bw > bh { |
| 152 | - hit!(FILTER_INTRA_RECT4_HORZ_HITS); | |
| 153 | 145 | } else { |
| 154 | - hit!(FILTER_INTRA_RECT4_VERT_HITS); | |
| 155 | 146 | } |
| 156 | 147 | } |
| 157 | 148 | let uv_predict_mode = if uv_mode == UV_CFL_PRED { |
| @@ -192,24 +183,7 @@ pub(super) fn decode_block_rect4( | ||
| 192 | 183 | fctx, |
| 193 | 184 | ); |
| 194 | 185 | if depth != 0 || lossless(fctx) { |
| 195 | - // lane-rectsplitx r1: the per-transform-unit walk, at this strip's | |
| 196 | - // real mi position (strips 1 and 3 of a HORZ_4 start 8 px into a | |
| 197 | - // 16-px [`SUB`] cell). depth 1 is the RECT unit TX_16X8/TX_8X16 | |
| 198 | - // (`sub_tx_size_map[TX_32X8] == TX_16X8`), depth 2 the square TX_8X8; | |
| 199 | - // both interleave in every real stream. | |
| 200 | - hit!(TX_DEPTH_HITS); | |
| 201 | 186 | let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx); |
| 202 | - // lane-rectsplitx r2: both depths ship together, as the r1 handoff | |
| 203 | - // predicted -- depth 1 fires FIRST in every attempt that splits at | |
| 204 | - // all, so a depth-2-only lift could never be gated. The r1 mismatch | |
| 205 | - // was never the rect unit: it was the neighbour MODE the strip reads | |
| 206 | - // (see `modes_above_left_mi`). | |
| 207 | - let which = if depth == 1 { | |
| 208 | - &RECT4_SPLIT_DEPTH1_HITS | |
| 209 | - } else { | |
| 210 | - &RECT4_SPLIT_DEPTH2_HITS | |
| 211 | - }; | |
| 212 | - hit_do! { which.with(|c| c.set(c.get() + 1)); } | |
| 213 | 187 | let modes = RectStripModes { |
| 214 | 188 | skip, |
| 215 | 189 | mode, |
| @@ -223,9 +197,6 @@ pub(super) fn decode_block_rect4( | ||
| 223 | 197 | palette_y: palette_y_buf.clone(), |
| 224 | 198 | palette_uv: palette_uv_bufs.clone(), |
| 225 | 199 | }; |
| 226 | - if palette_y.is_some() || palette_uv.is_some() { | |
| 227 | - hit!(PALETTE_SPLIT_TX_HITS); | |
| 228 | - } | |
| 229 | 200 | decode_rect_split( |
| 230 | 201 | dec, |
| 231 | 202 | cdfs, |
| @@ -254,12 +225,7 @@ pub(super) fn decode_block_rect4( | ||
| 254 | 225 | pal_uv_colors, |
| 255 | 226 | ); |
| 256 | 227 | if bw > bh { |
| 257 | - hit!(RECT4_32_HORZ_HITS); | |
| 258 | 228 | } else { |
| 259 | - hit!(RECT4_32_VERT_HITS); | |
| 260 | - } | |
| 261 | - if !skip { | |
| 262 | - hit!(RECT4_COEFF_HITS); | |
| 263 | 229 | } |
| 264 | 230 | // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm, |
| 265 | 231 | // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter |
| @@ -369,7 +335,6 @@ pub(super) fn decode_block_rect4( | ||
| 369 | 335 | TxType::DctDct, |
| 370 | 336 | 0, |
| 371 | 337 | )?; |
| 372 | - hit!(RECT4_COEFF_HITS); | |
| 373 | 338 | let luma_residual = dequant_and_inverse_typed_wh( |
| 374 | 339 | &luma_levels, |
| 375 | 340 | bw, |
| @@ -499,9 +464,7 @@ pub(super) fn decode_block_rect4( | ||
| 499 | 464 | pal_uv_colors, |
| 500 | 465 | ); |
| 501 | 466 | if bw > bh { |
| 502 | - hit!(RECT4_32_HORZ_HITS); | |
| 503 | 467 | } else { |
| 504 | - hit!(RECT4_32_VERT_HITS); | |
| 505 | 468 | } |
| 506 | 469 | // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm, |
| 507 | 470 | // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter |
| @@ -568,7 +531,6 @@ pub(super) fn decode_block_rect4( | ||
| 568 | 531 | } |
| 569 | 532 | let (v_levels, v_tx_type) = planes.pop().expect("plane 2"); |
| 570 | 533 | let (u_levels, u_tx_type) = planes.pop().expect("plane 1"); |
| 571 | - hit!(RECT4_COEFF_HITS); | |
| 572 | 534 | let luma_residual = dequant_and_inverse_typed_wh( |
| 573 | 535 | &luma_levels, |
| 574 | 536 | bw, |
| @@ -658,9 +620,7 @@ pub(super) fn decode_block_rect4( | ||
| 658 | 620 | pal_uv_colors, |
| 659 | 621 | ); |
| 660 | 622 | if bw > bh { |
| 661 | - hit!(RECT4_32_HORZ_HITS); | |
| 662 | 623 | } else { |
| 663 | - hit!(RECT4_32_VERT_HITS); | |
| 664 | 624 | } |
| 665 | 625 | // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm, |
| 666 | 626 | // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter |
| @@ -805,9 +765,7 @@ pub(super) fn decode_block_rect4( | ||
| 805 | 765 | pal_uv_colors, |
| 806 | 766 | ); |
| 807 | 767 | if bw > bh { |
| 808 | - hit!(RECT4_32_HORZ_HITS); | |
| 809 | 768 | } else { |
| 810 | - hit!(RECT4_32_VERT_HITS); | |
| 811 | 769 | } |
| 812 | 770 | // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm, |
| 813 | 771 | // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter |
| @@ -982,9 +940,6 @@ pub(super) fn decode_intrabc_owned_rect( | ||
| 982 | 940 | let (cpx, cpy) = (px >> ss_x(fctx), py >> ss_y(fctx)); |
| 983 | 941 | let side = bw.max(bh); |
| 984 | 942 | let cside = cw.max(ch); |
| 985 | - if ss_x(fctx) == 0 && ss_y(fctx) == 0 { | |
| 986 | - hit!(IBC_OWNED_RECT_CHROMA_FOOTPRINT_444_HITS); | |
| 987 | - } | |
| 988 | 943 | let saved_reduced = fctx.reduced_tx_set_inter.with(std::cell::Cell::get); |
| 989 | 944 | let saved_tx = fctx.tx_select_inter.with(std::cell::Cell::get); |
| 990 | 945 | fctx.reduced_tx_set_inter.with(|c| c.set(reduced_tx_set)); |
| @@ -1063,20 +1018,6 @@ pub(super) fn decode_intrabc_owned_rect( | ||
| 1063 | 1018 | fctx, |
| 1064 | 1019 | ); |
| 1065 | 1020 | if let Some(ls) = leaves.as_ref() { |
| 1066 | - // libaom `av1_reset_entropy_context` (`if (mbmi->skip_txfm)`, | |
| 1067 | - // decodeframe.c:1262 -> blockd.c:58): a SKIPPED block zeroes its | |
| 1068 | - // whole entropy-band footprint. The non-skip arm below writes | |
| 1069 | - // those bands per transform unit and the tail's | |
| 1070 | - // `record_split_luma_rect_mi` writes chroma only, so without | |
| 1071 | - // this walk a skipped strip whose `leaves` resolved (every | |
| 1072 | - // lossless frame -- `read_block_tx_size_rect`'s lossless arm | |
| 1073 | - // returns the 4x4 grid before it looks at `skip`) leaked the | |
| 1074 | - // PREVIOUS occupant's luma bands into the next block's | |
| 1075 | - // `txb_skip`/coefficient contexts (lane-av1-loss64: the skipped | |
| 1076 | - // 8x16 intrabc strip at mi(48,66) of the 320x242 lossless sb128 | |
| 1077 | - // stream left a stale 7 in left[48] and mi(48,68)'s first | |
| 1078 | - // transform unit read `txb_skip_ctx` 3 where aomdec reads 1). | |
| 1079 | - hit!(SKIP_LOSSLESS_BAND_RESET_HITS); | |
| 1080 | 1021 | for &(row, col, tw, th) in ls { |
| 1081 | 1022 | neighbours.record_mi_luma_rect( |
| 1082 | 1023 | (mi_r + row, mi_c + col), |
| @@ -1195,7 +1136,6 @@ pub(super) fn decode_intrabc_owned_rect( | ||
| 1195 | 1136 | // `TX_MODE_LARGEST`); the routing here is identical, so a future |
| 1196 | 1137 | // witness takes the same code. |
| 1197 | 1138 | let around = if ss_x(fctx) == 1 && ss_y(fctx) == 0 { |
| 1198 | - hit!(IBC_OWNED_RECT_422_PAIR_HITS); | |
| 1199 | 1139 | neighbours.around_mi_422_chroma((mi_r, mi_c), bw, bh) |
| 1200 | 1140 | } else { |
| 1201 | 1141 | neighbours.around_mi_rect((mi_r, mi_c), bw, bh) |
| @@ -1295,7 +1235,6 @@ pub(super) fn decode_intrabc_owned_rect( | ||
| 1295 | 1235 | // agree -- `fixtures/ibc422_nonsplit_ctx.obu` is the stream where |
| 1296 | 1236 | // they do not). |
| 1297 | 1237 | let around_chroma = if ss_x(fctx) == 1 && ss_y(fctx) == 0 { |
| 1298 | - hit!(IBC_OWNED_RECT_422_PAIR_HITS); | |
| 1299 | 1238 | neighbours.around_mi_422_chroma((mi_r, mi_c), bw, bh) |
| 1300 | 1239 | } else { |
| 1301 | 1240 | around |
| @@ -1603,7 +1542,6 @@ pub(super) fn decode_rect4_16_intrabc( | ||
| 1603 | 1542 | fctx: &crate::decode::FrameCtx, |
| 1604 | 1543 | ) -> Result<(usize, Option<usize>, (usize, usize))> { |
| 1605 | 1544 | let _ = base_q_idx; |
| 1606 | - hit!(RECT4_16_INTRABC_HITS); | |
| 1607 | 1545 | let (bw, bh) = if horz { (16usize, 4usize) } else { (4, 16) }; |
| 1608 | 1546 | let (mi_w, mi_h) = (bw / MI, bh / MI); |
| 1609 | 1547 | let (px, py) = (lmi.1 * MI, lmi.0 * MI); |
| @@ -1670,15 +1608,9 @@ pub(super) fn decode_rect4_16_intrabc( | ||
| 1670 | 1608 | // [BLOCK_4X16][1][0]` is BLOCK_INVALID at 4:2:2, so only HORZ reaches it. |
| 1671 | 1609 | let own444 = ss_x(fctx) == 0 && ss_y(fctx) == 0; |
| 1672 | 1610 | let own422 = ss_x(fctx) == 1 && ss_y(fctx) == 0 && horz; |
| 1673 | - if own422 && has_chroma { | |
| 1674 | - hit!(INTRABC_RECT4_OWN_CHROMA422_HITS); | |
| 1675 | - } | |
| 1676 | 1611 | // One predicate for "this strip IS its own chroma reference": the strip's |
| 1677 | 1612 | // own mi position, its own luma extent, and per-axis subsampled sizes. |
| 1678 | 1613 | let own_chroma = own444 || own422; |
| 1679 | - if ss_x(fctx) == 0 && ss_y(fctx) == 0 && has_chroma { | |
| 1680 | - hit!(INTRABC_RECT4_OWN_CHROMA444_HITS); | |
| 1681 | - } | |
| 1682 | 1614 | let (pw, ph) = if own444 { |
| 1683 | 1615 | (bw, bh) |
| 1684 | 1616 | } else if horz { |
| @@ -2184,7 +2116,6 @@ pub(super) fn decode_rect4_16_intrabc( | ||
| 2184 | 2116 | } |
| 2185 | 2117 | let mut last_uv = None; |
| 2186 | 2118 | if has_chroma { |
| 2187 | - hit!(RECT4_16_CHROMA_HITS); | |
| 2188 | 2119 | // lane-av1422luma: the uv-mode publication and the left/above skip |
| 2189 | 2120 | // state below are the STRIP's own at 4:2:2 / 4:4:4 -- publishing the |
| 2190 | 2121 | // pair extent (one mi row off, `ph`/`pw`) is what the NEXT block's |
| @@ -2221,9 +2152,7 @@ pub(super) fn decode_rect4_16_intrabc( | ||
| 2221 | 2152 | last_uv = Some(DC_PRED); |
| 2222 | 2153 | } |
| 2223 | 2154 | if horz { |
| 2224 | - hit!(RECT4_16_HORZ_HITS); | |
| 2225 | 2155 | } else { |
| 2226 | - hit!(RECT4_16_VERT_HITS); | |
| 2227 | 2156 | } |
| 2228 | 2157 | record_strip_palette(neighbours, lmi, bw, bh, 0, [0u16; 8], 0, [0u16; 8]); |
| 2229 | 2158 | if leaves.is_none() { |
| @@ -2350,9 +2279,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2350 | 2279 | fctx, |
| 2351 | 2280 | ); |
| 2352 | 2281 | } |
| 2353 | - if palette_y.is_some() || palette_uv.is_some() { | |
| 2354 | - hit!(RECT4_PALETTE_HITS); | |
| 2355 | - } | |
| 2356 | 2282 | // The colour-index map through the base colours IS the prediction. |
| 2357 | 2283 | // Chroma's map is the PAIR's 8x4 (4x8) block, matching the one |
| 2358 | 2284 | // chroma transform this closing strip codes. |
| @@ -2366,12 +2292,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2366 | 2292 | ) |
| 2367 | 2293 | }); |
| 2368 | 2294 | let smooth_neighbor = is_smooth_mode(above_mode) || is_smooth_mode(left_mode); |
| 2369 | - if smooth_neighbor { | |
| 2370 | - hit!(SMOOTH_LUMA_HITS); | |
| 2371 | - } | |
| 2372 | - if filter_intra.is_some() { | |
| 2373 | - hit!(FILTER_INTRA_RECT_HITS); | |
| 2374 | - } | |
| 2375 | 2295 | // `bsize_to_tx_size_cat(BLOCK_16X4)`: `max_txsize_rect_lookup` is |
| 2376 | 2296 | // TX_16X4 and `sub_tx_size_map` reaches TX_4X4 in two steps, so the |
| 2377 | 2297 | // depth symbol is the 3-symbol `tx_size_cat1` -- not the 2-symbol |
| @@ -2397,10 +2317,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2397 | 2317 | } else { |
| 2398 | 2318 | 0 |
| 2399 | 2319 | }; |
| 2400 | - if depth != 0 { | |
| 2401 | - hit!(TX_DEPTH_HITS); | |
| 2402 | - hit!(RECT4_16_SPLIT_HITS); | |
| 2403 | - } | |
| 2404 | 2320 | let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx); |
| 2405 | 2321 | let (px, py) = (lmi.1 * MI, lmi.0 * MI); |
| 2406 | 2322 | let reach = Reach::of_rect(bw, bh, px, py, y.width, y.height, fctx); |
| @@ -2502,9 +2418,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2502 | 2418 | smooth_neighbor, |
| 2503 | 2419 | fctx, |
| 2504 | 2420 | ); |
| 2505 | - if tu_grid.iter().any(|&l| l != 0) { | |
| 2506 | - hit!(RECT4_16_COEFF_HITS); | |
| 2507 | - } | |
| 2508 | 2421 | neighbours.record_mi_luma_rect(tu_mi, tx_w, tx_h, &tu_grid); |
| 2509 | 2422 | } else { |
| 2510 | 2423 | let tu_around = neighbours.around_mi(tu_mi, tx_w)[0]; |
| @@ -2534,9 +2447,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2534 | 2447 | smooth_neighbor, |
| 2535 | 2448 | fctx, |
| 2536 | 2449 | )?; |
| 2537 | - if tu_grid.iter().any(|&l| l != 0) { | |
| 2538 | - hit!(RECT4_16_COEFF_HITS); | |
| 2539 | - } | |
| 2540 | 2450 | neighbours.record_mi_luma(tu_mi, tx_w, &tu_grid); |
| 2541 | 2451 | } |
| 2542 | 2452 | } |
| @@ -2620,7 +2530,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2620 | 2530 | smooth_neighbor, |
| 2621 | 2531 | fctx, |
| 2622 | 2532 | ); |
| 2623 | - hit!(RECT4_16_COEFF_HITS); | |
| 2624 | 2533 | levels |
| 2625 | 2534 | }; |
| 2626 | 2535 | neighbours.record_mi_luma_rect(lmi, bw, bh, &levels); |
| @@ -2641,7 +2550,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2641 | 2550 | } |
| 2642 | 2551 | } |
| 2643 | 2552 | if has_chroma { |
| 2644 | - hit!(RECT4_16_CHROMA_HITS); | |
| 2645 | 2553 | // lane-av1-444: at 4:4:4 there is no pair -- every strip is its |
| 2646 | 2554 | // own chroma reference and codes its own 16x4 / 4x16 chroma |
| 2647 | 2555 | // block. (`set_mi_offsets`'s chroma snap is the zero offset at |
| @@ -2687,9 +2595,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2687 | 2595 | } else { |
| 2688 | 2596 | uv_mode |
| 2689 | 2597 | }; |
| 2690 | - if (V_PRED..=D67_PRED).contains(&uv_predict_mode) { | |
| 2691 | - hit!(RECT4_16_CHROMA_DIR_HITS); | |
| 2692 | - } | |
| 2693 | 2598 | let pair_reach = Reach::of_rect(pw, ph, ppx, ppy, y.width, y.height, fctx); |
| 2694 | 2599 | // lane-kf1200 r1: the chroma edge-filter type reads the neighbours |
| 2695 | 2600 | // of the CHROMA block, which for a 16x4/4x16 pair is `pair_mi`'s |
| @@ -2728,7 +2633,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2728 | 2633 | false, |
| 2729 | 2634 | ) |
| 2730 | 2635 | { |
| 2731 | - hit!(RECT4_16_UV_PAIR_FILT_HITS); | |
| 2732 | 2636 | } |
| 2733 | 2637 | // lane-av1-rect14: a lossless frame forces TX_4X4 on every plane |
| 2734 | 2638 | // (`av1_get_tx_size`, blockd.h:1381). The pair's chroma block is |
| @@ -2739,7 +2643,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2739 | 2643 | // mi(1,20) uv_mode matched, the following skip did not). |
| 2740 | 2644 | let lossless_pair = lossless(fctx); |
| 2741 | 2645 | let (u_levels, v_levels) = if lossless_pair { |
| 2742 | - hit!(RECT4_16_LOSSLESS_CHROMA_HITS); | |
| 2743 | 2646 | if skip { |
| 2744 | 2647 | for plane in 1..3usize { |
| 2745 | 2648 | for rr in 0..ch / 4 { |
| @@ -2910,7 +2813,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2910 | 2813 | plane, |
| 2911 | 2814 | &cu_grid, |
| 2912 | 2815 | ); |
| 2913 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 2914 | 2816 | let dst = if plane == 1 { &mut uo } else { &mut vo }; |
| 2915 | 2817 | for row in 0..4 { |
| 2916 | 2818 | let start = (oy + row) * cw + ox; |
| @@ -2929,9 +2831,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 2929 | 2831 | // DC + alpha * luma-AC. Dropping the CfL term here left a |
| 2930 | 2832 | // chroma-only bounded box on ReelC's key frames. |
| 2931 | 2833 | let ac = alpha.map(|_| cfl_src_rect(ppx, ppy, pw, ph)); |
| 2932 | - if alpha.is_some() { | |
| 2933 | - hit!(CHROMA_SKIP_CFL_HITS); | |
| 2934 | - } | |
| 2935 | 2834 | for plane in [1usize, 2] { |
| 2936 | 2835 | if chroma422_pair16 { |
| 2937 | 2836 | // lane-av1-422o: two TX_4X8 units, each predicted on |
| @@ -3116,7 +3015,6 @@ pub(super) fn decode_rect4_16_strip( | ||
| 3116 | 3015 | // a restored `/2 chroma height` lands on (8,4) and the |
| 3117 | 3016 | // counter reads 0. |
| 3118 | 3017 | (8, 8) => { |
| 3119 | - hit!(CHROMA422_SQUARE_HITS); | |
| 3120 | 3018 | (TxbSet::Chroma8, default_scan(8)) |
| 3121 | 3019 | } |
| 3122 | 3020 | // lane-av1-422o: with the `chroma422_pair16` arm above, |
| @@ -3226,9 +3124,7 @@ pub(super) fn decode_rect4_16_strip( | ||
| 3226 | 3124 | last_uv_mode = Some(uv_predict_mode); |
| 3227 | 3125 | } |
| 3228 | 3126 | if horz { |
| 3229 | - hit!(RECT4_16_HORZ_HITS); | |
| 3230 | 3127 | } else { |
| 3231 | - hit!(RECT4_16_VERT_HITS); | |
| 3232 | 3128 | } |
| 3233 | 3129 | let (pal_y_size, pal_y_colors) = palette_y |
| 3234 | 3130 | .as_ref() |
| @@ -3354,17 +3250,7 @@ pub(super) fn decode_block_rect64( | ||
| 3354 | 3250 | fctx, |
| 3355 | 3251 | ); |
| 3356 | 3252 | } |
| 3357 | - if (palette_y.is_some() || palette_uv.is_some()) && !skip { | |
| 3358 | - // lane-t900 r34: a non-skip palette block on a superblock-level strip | |
| 3359 | - // -- counted so its gate cannot go vacuous (this was a refusal until | |
| 3360 | - // r34; see the gate `a_real_aomenc_palette_stream_with_8x8_leaves_ | |
| 3361 | - // decodes_pixel_exact`). | |
| 3362 | - hit!(PALETTE_SB_STRIP_HITS); | |
| 3363 | - } | |
| 3364 | 3253 | let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode); |
| 3365 | - if smooth_neighbor { | |
| 3366 | - hit!(SMOOTH_LUMA_HITS); | |
| 3367 | - } | |
| 3368 | 3254 | let smooth_neighbor_uv = |
| 3369 | 3255 | neighbours.smooth_uv_neighbour(r * (SUB / MI), c * (SUB / MI), r, c, fctx); |
| 3370 | 3256 | if filter_intra.is_some() { |
| @@ -3423,7 +3309,6 @@ pub(super) fn decode_block_rect64( | ||
| 3423 | 3309 | fctx, |
| 3424 | 3310 | ); |
| 3425 | 3311 | if depth != 0 || lossless(fctx) { |
| 3426 | - hit!(TX_DEPTH_HITS); | |
| 3427 | 3312 | // lane-rectsplit r1/r4: the superblock-level strip splits its |
| 3428 | 3313 | // transform through the very same per-unit path as its 32x32-level |
| 3429 | 3314 | // sibling; [`depth_to_tx_wh`] names the unit, which for a 64x16/16x64 |
| @@ -3431,12 +3316,6 @@ pub(super) fn decode_block_rect64( | ||
| 3431 | 3316 | // measured the old square formula mis-tiling exactly that strip). |
| 3432 | 3317 | let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx); |
| 3433 | 3318 | if bw.max(bh) / bw.min(bh) == 4 { |
| 3434 | - let which = if depth == 1 { | |
| 3435 | - &RECT4_SPLIT_DEPTH1_HITS | |
| 3436 | - } else { | |
| 3437 | - &RECT4_SPLIT_DEPTH2_HITS | |
| 3438 | - }; | |
| 3439 | - hit_do! { which.with(|c| c.set(c.get() + 1)); } | |
| 3440 | 3319 | } |
| 3441 | 3320 | if crate::envflags::env_flag!("EC_SBPART_DUMP64") { |
| 3442 | 3321 | eprintln!( |
| @@ -3465,9 +3344,6 @@ pub(super) fn decode_block_rect64( | ||
| 3465 | 3344 | ) |
| 3466 | 3345 | }), |
| 3467 | 3346 | }; |
| 3468 | - if palette_y.is_some() || palette_uv.is_some() { | |
| 3469 | - hit!(PALETTE_SPLIT_TX_HITS); | |
| 3470 | - } | |
| 3471 | 3347 | decode_rect_split( |
| 3472 | 3348 | dec, |
| 3473 | 3349 | cdfs, |
| @@ -3506,8 +3382,6 @@ pub(super) fn decode_block_rect64( | ||
| 3506 | 3382 | // mi(192,144) took `tx_size_cat3` row 2 where libaom takes row 1. The |
| 3507 | 3383 | // bands carry the SPLIT unit's size, not the block's. |
| 3508 | 3384 | txfm_partition_update_rect(neighbours, (mi_r, mi_c), (tx_w, tx_h), (bw, bh)); |
| 3509 | - hit!(RECT64_SPLIT_TXFM_PUBLISH_HITS); | |
| 3510 | - hit!(RECT_PARTITION_HITS); | |
| 3511 | 3385 | return Ok(()); |
| 3512 | 3386 | } |
| 3513 | 3387 | let (tx_w, tx_h) = (bw, bh); |
| @@ -3673,9 +3547,6 @@ pub(super) fn decode_block_rect64( | ||
| 3673 | 3547 | } |
| 3674 | 3548 | { |
| 3675 | 3549 | let cur = block_q_idx(fctx); |
| 3676 | - if cur != i32::from(base_q_idx) { | |
| 3677 | - hit!(RECT64_QIDX_DRIFT_HITS); | |
| 3678 | - } | |
| 3679 | 3550 | if crate::envflags::env_flag!("EC_AV1_TRACE") { |
| 3680 | 3551 | eprintln!( |
| 3681 | 3552 | "TRACE rect64_dequant plane=0 base_q_idx={base_q_idx} current_q_idx={cur}" |
| @@ -3813,9 +3684,6 @@ pub(super) fn decode_block_rect64( | ||
| 3813 | 3684 | // nothing. The `bigger` guard is what makes a hit PROOF |
| 3814 | 3685 | // that the tiled arm ran, rather than proof that some |
| 3815 | 3686 | // palette chroma block existed. |
| 3816 | - if bigger { | |
| 3817 | - hit!(CHROMA_PALETTE_WINDOW_HITS); | |
| 3818 | - } | |
| 3819 | 3687 | } |
| 3820 | 3688 | read_plane( |
| 3821 | 3689 | dec, |
| @@ -3883,9 +3751,6 @@ pub(super) fn decode_block_rect64( | ||
| 3883 | 3751 | // nothing. The `bigger` guard is what makes a hit PROOF |
| 3884 | 3752 | // that the tiled arm ran, rather than proof that some |
| 3885 | 3753 | // palette chroma block existed. |
| 3886 | - if bigger { | |
| 3887 | - hit!(CHROMA_PALETTE_WINDOW_HITS); | |
| 3888 | - } | |
| 3889 | 3754 | } |
| 3890 | 3755 | push_intra_rect( |
| 3891 | 3756 | y, |
| @@ -3949,7 +3814,6 @@ pub(super) fn decode_block_rect64( | ||
| 3949 | 3814 | for (cu_mi, plane, unit, span_w, span_h) in &tiled_chroma_units { |
| 3950 | 3815 | neighbours.record_mi_chroma(*cu_mi, *span_w, *span_h, *plane, unit); |
| 3951 | 3816 | } |
| 3952 | - hit!(RECT_COEFF_HITS); | |
| 3953 | 3817 | } |
| 3954 | 3818 | let (py_size, py_colors) = palette_y |
| 3955 | 3819 | .as_ref() |
| @@ -3980,12 +3844,6 @@ pub(super) fn decode_block_rect64( | ||
| 3980 | 3844 | // 3840x1608 10-bit stream's first silent wall, decode-order frame 33 at |
| 3981 | 3845 | // mi(16,480)). Same write as [`set_txfm_ctxs`], rect-aware. |
| 3982 | 3846 | txfm_partition_update_rect(neighbours, (mi_r, mi_c), (tx_w, tx_h), (bw, bh)); |
| 3983 | - hit!(SB_RECT_HITS); | |
| 3984 | - match (bw, bh) { | |
| 3985 | - (64, 16) => hit!(SB_RECT4_HORZ_HITS), | |
| 3986 | - (16, 64) => hit!(SB_RECT4_VERT_HITS), | |
| 3987 | - _ => {} | |
| 3988 | - } | |
| 3989 | 3847 | if crate::envflags::env_flag!("EC_AV1_TRACE") { |
| 3990 | 3848 | let (rng, _) = dec.debug_state(); |
| 3991 | 3849 | eprintln!("TRACE_RECT64_END mi_row={mi_r} mi_col={mi_c} bw={bw} bh={bh} rng={rng}"); |
crates/ec-av1/src/decode/replay.rsmodified+0 -4
| @@ -471,9 +471,6 @@ pub(super) fn cdef_band( | ||
| 471 | 471 | while mi_r < r_hi { |
| 472 | 472 | let mut mi_c = 0usize; |
| 473 | 473 | while mi_c < skip_grid.mi_cols { |
| 474 | - if skip_grid.is_skip_txfm(mi_r, mi_c) { | |
| 475 | - hit!(CDEF_SKIPPED_UNITS); | |
| 476 | - } | |
| 477 | 474 | if !skip_grid.is_skip_txfm(mi_r, mi_c) { |
| 478 | 475 | let sidx = strength_idx(mi_r, mi_c); |
| 479 | 476 | let (ox, oy) = (mi_c * 4, mi_r * 4); |
| @@ -524,7 +521,6 @@ pub(super) fn cdef_band( | ||
| 524 | 521 | || cdef.uv_pri_strength[sidx] != 0 |
| 525 | 522 | || cdef.uv_sec_strength[sidx] != 0) |
| 526 | 523 | { |
| 527 | - hit!(CDEF_STRADDLE_UNITS); | |
| 528 | 524 | } |
| 529 | 525 | if enable_primary || enable_secondary { |
| 530 | 526 | cdef_filter_block( |
crates/ec-av1/src/decode/sub8_inter.rsmodified+0 -92
| @@ -62,7 +62,6 @@ pub(super) fn decode_inter_sub8_split4( | ||
| 62 | 62 | ) -> Result<()> { |
| 63 | 63 | const LAST_FRAME: i8 = 1; |
| 64 | 64 | const B4: usize = 4; |
| 65 | - hit!(SUB8_INTER_SPLIT_HITS); | |
| 66 | 65 | let (gr, gc) = group_mi; |
| 67 | 66 | let (gpx, gpy) = (gc * MI, gr * MI); |
| 68 | 67 | let (cpx, cpy) = (gpx >> ss_x(fctx), gpy >> ss_y(fctx)); |
| @@ -143,17 +142,6 @@ pub(super) fn decode_inter_sub8_split4( | ||
| 143 | 142 | fctx.tx_select_inter.with(std::cell::Cell::get), |
| 144 | 143 | ); |
| 145 | 144 | } |
| 146 | - // lane-sub8x4 r2: the refusal and its `EC_SUB8INTRA_DECODE` bypass | |
| 147 | - // are gone -- `a_real_aomenc_inter_sequence_with_intra_sub8x8_ | |
| 148 | - // leaves_decodes_pixel_exact` (stream.rs) decodes 12 real aomenc | |
| 149 | - // streams carrying this arm pixel-exact vs ffmpeg. | |
| 150 | - hit_do! { | |
| 151 | - SUB8_INTRA_RECT_HITS.with(|h| { | |
| 152 | - let mut st = h.get(); | |
| 153 | - st[4] += 1; | |
| 154 | - h.set(st); | |
| 155 | - }); | |
| 156 | - } | |
| 157 | 145 | // lane-sub8intra: the `BLOCK_4X4` twin of the HORZ/VERT arm -- |
| 158 | 146 | // same [`decode_intra_sub8_leaf`], no tx-depth symbol, chroma on |
| 159 | 147 | // the chroma-reference sub-blocks (`is_chroma_reference`: the |
| @@ -209,9 +197,6 @@ pub(super) fn decode_inter_sub8_split4( | ||
| 209 | 197 | // each of the group's pieces (luma and its 2x2 chroma) carries its |
| 210 | 198 | // OWN factor because each can name a different `ref_frame`. |
| 211 | 199 | let luma_scale = scale_of((ref_width, ref_height), frame_size); |
| 212 | - if !luma_scale.is_unscaled() { | |
| 213 | - hit!(SCALED_SUB8_HITS); | |
| 214 | - } | |
| 215 | 200 | let gm_table = build_gm_mv_table( |
| 216 | 201 | global_motion, |
| 217 | 202 | rmi, |
| @@ -245,8 +230,6 @@ pub(super) fn decode_inter_sub8_split4( | ||
| 245 | 230 | tpl, |
| 246 | 231 | ); |
| 247 | 232 | let not_new = dec.symbol(&mut cdfs.new_mv[stack.new_mv_ctx]) == 1; |
| 248 | - if !not_new { | |
| 249 | - } | |
| 250 | 233 | let mut is_globalmv = false; |
| 251 | 234 | let (mv, is_new_mv) = if !not_new { |
| 252 | 235 | let mut idx = 0usize; |
| @@ -271,8 +254,6 @@ pub(super) fn decode_inter_sub8_split4( | ||
| 271 | 254 | ) |
| 272 | 255 | } else { |
| 273 | 256 | let not_zero = dec.symbol(&mut cdfs.zero_mv[stack.zero_mv_ctx]) == 1; |
| 274 | - if !not_zero { | |
| 275 | - } | |
| 276 | 257 | is_globalmv = !not_zero; |
| 277 | 258 | let mv = if !not_zero { |
| 278 | 259 | gm_table[(ref_frame - LAST_FRAME) as usize] |
| @@ -336,9 +317,6 @@ pub(super) fn decode_inter_sub8_split4( | ||
| 336 | 317 | // `is_nontrans_global_motion` returns 0 for |
| 337 | 318 | // `AOMMIN(mi_size_wide, mi_size_high) < 2` BEFORE testing any model -- |
| 338 | 319 | // so a GLOBALMV sub-block here always reads its interp filter. |
| 339 | - if is_globalmv && gm_ref.model != ec_av1_syntax::WarpModel::Translation { | |
| 340 | - hit!(GM_NONTRANS_SMALL_SIDE_HITS); | |
| 341 | - } | |
| 342 | 320 | let gm_nontrans = false; |
| 343 | 321 | let (h_filter, v_filter, resolved_filter) = resolve_interp_filter( |
| 344 | 322 | dec, |
| @@ -744,7 +722,6 @@ pub(super) fn decode_inter_sub8_split4( | ||
| 744 | 722 | neighbours.record_mi_chroma(ctx_mi, 8, 4, 1, &ZERO_RESIDUAL[..B4 * B4]); |
| 745 | 723 | neighbours.record_mi_chroma(ctx_mi, 8, 4, 2, &ZERO_RESIDUAL[..B4 * B4]); |
| 746 | 724 | } else { |
| 747 | - hit!(CHROMA422_INTER_SUB8_HITS); | |
| 748 | 725 | let (ug, _) = read_inter_plane( |
| 749 | 726 | dec, |
| 750 | 727 | cdfs, |
| @@ -857,15 +834,6 @@ pub(super) fn decode_inter_sub8_split4( | ||
| 857 | 834 | // mi of the group is intra: the group's 4x4 chroma is then predicted WHOLE |
| 858 | 835 | // from the chroma-reference (last) sub-block's own mv, not in 2x2 pieces. |
| 859 | 836 | let mixed = piece.iter().any(Option::is_none); |
| 860 | - if mixed { | |
| 861 | - hit_do! { | |
| 862 | - SUB8_INTRA_RECT_HITS.with(|h| { | |
| 863 | - let mut st = h.get(); | |
| 864 | - st[3] += 1; | |
| 865 | - h.set(st); | |
| 866 | - }); | |
| 867 | - } | |
| 868 | - } | |
| 869 | 837 | // lane-sub8group: the group's chroma pieces, built where they are |
| 870 | 838 | // written -- the pieces' refs/mvs/filters travel by value. |
| 871 | 839 | let build = move |_y: &mut PlaneBuf<'static>, |
| @@ -1127,17 +1095,11 @@ pub(super) fn decode_intra_sub8_leaf( | ||
| 1127 | 1095 | dec.debug_state().0 |
| 1128 | 1096 | ); |
| 1129 | 1097 | } |
| 1130 | - if (9..=12).contains(&uv_mode) { | |
| 1131 | - hit!(SMOOTH_UV_HITS); | |
| 1132 | - } | |
| 1133 | 1098 | let alpha = if uv_mode == UV_CFL_PRED { |
| 1134 | 1099 | Some(read_cfl_alphas(dec, cdfs)) |
| 1135 | 1100 | } else { |
| 1136 | 1101 | None |
| 1137 | 1102 | }; |
| 1138 | - if (V_PRED..=D67_PRED).contains(&uv_mode) { | |
| 1139 | - hit!(DIRECTIONAL_UV_HITS); | |
| 1140 | - } | |
| 1141 | 1103 | (uv_mode, alpha) |
| 1142 | 1104 | } else { |
| 1143 | 1105 | (DC_PRED, None) |
| @@ -1160,9 +1122,6 @@ pub(super) fn decode_intra_sub8_leaf( | ||
| 1160 | 1122 | ); |
| 1161 | 1123 | } |
| 1162 | 1124 | if use_fi != 0 { |
| 1163 | - hit!(FILTER_INTRA_HITS); | |
| 1164 | - hit!(FILTER_INTRA_RECT_HITS); | |
| 1165 | - hit!(FILTER_INTRA_RECT_SUB8_HITS); | |
| 1166 | 1125 | let fi = dec.symbol(&mut cdfs.filter_intra_mode); |
| 1167 | 1126 | if step { |
| 1168 | 1127 | eprintln!( |
| @@ -1201,10 +1160,6 @@ pub(super) fn decode_intra_sub8_leaf( | ||
| 1201 | 1160 | } else { |
| 1202 | 1161 | 0 |
| 1203 | 1162 | }; |
| 1204 | - if depth != 0 { | |
| 1205 | - hit!(TX_DEPTH_HITS); | |
| 1206 | - hit!(RECT8_SPLIT_TX_HITS); | |
| 1207 | - } | |
| 1208 | 1163 | let split = depth != 0 || (lossless(fctx) && bw != bh); |
| 1209 | 1164 | let (px, py) = (lmi.1 * MI, lmi.0 * MI); |
| 1210 | 1165 | let reach = if bw == bh { |
| @@ -1213,9 +1168,6 @@ pub(super) fn decode_intra_sub8_leaf( | ||
| 1213 | 1168 | Reach::of_rect(bw, bh, px, py, y.width, y.height, fctx) |
| 1214 | 1169 | }; |
| 1215 | 1170 | let smooth_neighbor = is_smooth_mode(leaf_above) || is_smooth_mode(leaf_left); |
| 1216 | - if smooth_neighbor { | |
| 1217 | - hit!(SMOOTH_LUMA_HITS); | |
| 1218 | - } | |
| 1219 | 1171 | neighbours.record_mode_mi(lmi.0, lmi.1, w_mi, h_mi, mode); |
| 1220 | 1172 | let scan: &[u16] = if vert { &SCAN_4X8 } else { &SCAN_8X4 }; |
| 1221 | 1173 | if split { |
| @@ -1481,14 +1433,6 @@ pub(super) fn decode_intra_sub8_leaf( | ||
| 1481 | 1433 | is_global_mv1: false, |
| 1482 | 1434 | }, |
| 1483 | 1435 | ); |
| 1484 | - hit_do! { | |
| 1485 | - SUB8_INTRA_RECT_HITS.with(|h| { | |
| 1486 | - let mut s = h.get(); | |
| 1487 | - s[usize::from(vert)] += 1; | |
| 1488 | - s[2] += usize::from(has_chroma); | |
| 1489 | - h.set(s); | |
| 1490 | - }); | |
| 1491 | - } | |
| 1492 | 1436 | // lane-t900 r23 (class [[new-map-ignores-tile-edge]]: a neighbour map |
| 1493 | 1437 | // needs EVERY writer): a sub-8x8 group published no palette state, so |
| 1494 | 1438 | // once an 8x8 leaf of the same row can BE a palette block, the group |
| @@ -1608,10 +1552,6 @@ pub(super) fn decode_intra_sub8_leaf( | ||
| 1608 | 1552 | }); |
| 1609 | 1553 | let mut chroma_stamped_per_unit = false; |
| 1610 | 1554 | let (u_grid, v_grid): (Grid, Grid) = if skip { |
| 1611 | - if alpha.is_some() { | |
| 1612 | - hit!(CHROMA_SKIP_CFL_HITS); | |
| 1613 | - hit!(SKIP_CFL_HITS); | |
| 1614 | - } | |
| 1615 | 1555 | if chroma_444 && bw != bh { |
| 1616 | 1556 | let zeros = Grid::Zero(bw * bh); |
| 1617 | 1557 | push_intra_rect( |
| @@ -1751,7 +1691,6 @@ pub(super) fn decode_intra_sub8_leaf( | ||
| 1751 | 1691 | // (`av1_set_contexts`); the tail's whole-leaf chroma |
| 1752 | 1692 | // stamp below is skipped for this shape. |
| 1753 | 1693 | neighbours.record_mi_chroma(tu_mi, 4, 4, plane_idx, &tu_grid); |
| 1754 | - hit!(CHROMA_SPLIT_TX_HITS); | |
| 1755 | 1694 | let dst = mu_units(if plane_idx == 1 { &mut uo } else { &mut vo }, bw * bh); |
| 1756 | 1695 | for row in 0..4 { |
| 1757 | 1696 | let start = (oy + row) * bw + ox; |
| @@ -1760,7 +1699,6 @@ pub(super) fn decode_intra_sub8_leaf( | ||
| 1760 | 1699 | } |
| 1761 | 1700 | } |
| 1762 | 1701 | chroma_stamped_per_unit = true; |
| 1763 | - hit!(LLSUB8RECT444_CHROMA_WALK_HITS); | |
| 1764 | 1702 | ( |
| 1765 | 1703 | if uo.is_empty() { |
| 1766 | 1704 | Grid::Zero(bw * bh) |
| @@ -2001,13 +1939,6 @@ pub(super) fn decode_inter_sub8_rect2( | ||
| 2001 | 1939 | (8usize, 4usize) |
| 2002 | 1940 | }; |
| 2003 | 1941 | let (w_mi, h_mi) = (bw / MI, bh / MI); |
| 2004 | - hit_do! { | |
| 2005 | - SUB8_INTER_RECT_HITS.with(|c| { | |
| 2006 | - let mut h = c.get(); | |
| 2007 | - h[usize::from(vert)] += 1; | |
| 2008 | - c.set(h); | |
| 2009 | - }); | |
| 2010 | - } | |
| 2011 | 1942 | let (gr, gc) = group_mi; |
| 2012 | 1943 | let (gpx, gpy) = (gc * MI, gr * MI); |
| 2013 | 1944 | let (cpx, cpy) = (gpx >> ss_x(fctx), gpy >> ss_y(fctx)); |
| @@ -2155,9 +2086,6 @@ pub(super) fn decode_inter_sub8_rect2( | ||
| 2155 | 2086 | let (ref_width, ref_height) = ref_dims(ref_frame, refpix)?; |
| 2156 | 2087 | // lane-t900 r28: refusal lifted -- see the split arm above. |
| 2157 | 2088 | let luma_scale = scale_of((ref_width, ref_height), frame_size); |
| 2158 | - if !luma_scale.is_unscaled() { | |
| 2159 | - hit!(SCALED_SUB8_HITS); | |
| 2160 | - } | |
| 2161 | 2089 | let gm_table = build_gm_mv_table( |
| 2162 | 2090 | global_motion, |
| 2163 | 2091 | rmi, |
| @@ -2191,8 +2119,6 @@ pub(super) fn decode_inter_sub8_rect2( | ||
| 2191 | 2119 | tpl, |
| 2192 | 2120 | ); |
| 2193 | 2121 | let not_new = dec.symbol(&mut cdfs.new_mv[stack.new_mv_ctx]) == 1; |
| 2194 | - if !not_new { | |
| 2195 | - } | |
| 2196 | 2122 | let mut is_globalmv = false; |
| 2197 | 2123 | let (mv, is_new_mv) = if !not_new { |
| 2198 | 2124 | let mut idx = 0usize; |
| @@ -2217,8 +2143,6 @@ pub(super) fn decode_inter_sub8_rect2( | ||
| 2217 | 2143 | ) |
| 2218 | 2144 | } else { |
| 2219 | 2145 | let not_zero = dec.symbol(&mut cdfs.zero_mv[stack.zero_mv_ctx]) == 1; |
| 2220 | - if !not_zero { | |
| 2221 | - } | |
| 2222 | 2146 | is_globalmv = !not_zero; |
| 2223 | 2147 | let mv = if !not_zero { |
| 2224 | 2148 | gm_table[(ref_frame - LAST_FRAME) as usize] |
| @@ -2266,9 +2190,6 @@ pub(super) fn decode_inter_sub8_rect2( | ||
| 2266 | 2190 | // `is_nontrans_global_motion` returns 0 for |
| 2267 | 2191 | // `AOMMIN(mi_size_wide, mi_size_high) < 2` BEFORE testing any model -- |
| 2268 | 2192 | // so a GLOBALMV sub-block here always reads its interp filter. |
| 2269 | - if is_globalmv && gm_ref.model != ec_av1_syntax::WarpModel::Translation { | |
| 2270 | - hit!(GM_NONTRANS_SMALL_SIDE_HITS); | |
| 2271 | - } | |
| 2272 | 2193 | let gm_nontrans = false; |
| 2273 | 2194 | let (h_filter, v_filter, resolved_filter) = resolve_interp_filter( |
| 2274 | 2195 | dec, |
| @@ -2315,9 +2236,6 @@ pub(super) fn decode_inter_sub8_rect2( | ||
| 2315 | 2236 | // exactly that population -- so an unconditional hit proves only |
| 2316 | 2237 | // "a lossless sub-8 leaf was walked", not "the conjunct suppressed |
| 2317 | 2238 | // a tree". Guard it on the same term the conjunct uses. |
| 2318 | - if fctx.tx_select_inter.with(std::cell::Cell::get) { | |
| 2319 | - hit!(SUB8_LOSSLESS_NO_VARTX); | |
| 2320 | - } | |
| 2321 | 2239 | // lane-lossless2: `read_block_tx_size` returns TX_4X4 before it |
| 2322 | 2240 | // ever looks at `max_txsize_rect_lookup`, so an 8x4/4x8 leaf is |
| 2323 | 2241 | // TWO 4x4 units, not one rect one. |
| @@ -2845,7 +2763,6 @@ pub(super) fn decode_inter_sub8_rect2( | ||
| 2845 | 2763 | neighbours.record_mi_chroma(ctx_mi, 8, 4, 1, &ZERO_RESIDUAL[..B4 * B4]); |
| 2846 | 2764 | neighbours.record_mi_chroma(ctx_mi, 8, 4, 2, &ZERO_RESIDUAL[..B4 * B4]); |
| 2847 | 2765 | } else { |
| 2848 | - hit!(CHROMA422_INTER_SUB8_HITS); | |
| 2849 | 2766 | let (ug, _) = read_inter_plane( |
| 2850 | 2767 | dec, |
| 2851 | 2768 | cdfs, |
| @@ -2950,15 +2867,6 @@ pub(super) fn decode_inter_sub8_rect2( | ||
| 2950 | 2867 | // chroma-reference block's own mv, at the group's chroma origin |
| 2951 | 2868 | // (`row_start`/`col_start` shift `pre_x`/`pre_y` there either way). |
| 2952 | 2869 | let mixed = piece[0].is_none(); |
| 2953 | - if mixed { | |
| 2954 | - hit_do! { | |
| 2955 | - SUB8_INTRA_RECT_HITS.with(|h| { | |
| 2956 | - let mut s = h.get(); | |
| 2957 | - s[3] += 1; | |
| 2958 | - h.set(s); | |
| 2959 | - }); | |
| 2960 | - } | |
| 2961 | - } | |
| 2962 | 2870 | let (piece_w, piece_h) = match (mixed, vert) { |
| 2963 | 2871 | (true, _) => (B4, B4), |
| 2964 | 2872 | (false, true) => (2usize, 4usize), |
crates/ec-av1/src/encoder/tests.rsmodified+0 -11
| @@ -1969,23 +1969,12 @@ | ||
| 1969 | 1969 | }; |
| 1970 | 1970 | let mut enc = Av1Encoder::new(config).unwrap(); |
| 1971 | 1971 | let mut stream = Vec::new(); |
| 1972 | - let _ = crate::tile::take_sb128_root_hits(); | |
| 1973 | 1972 | for packet in encode_all(&mut enc, &sources) { |
| 1974 | 1973 | stream.extend_from_slice(&packet.data); |
| 1975 | 1974 | } |
| 1976 | - let roots = crate::tile::take_sb128_root_hits(); | |
| 1977 | - assert!( | |
| 1978 | - roots >= 4, | |
| 1979 | - "a 128x128-superblock clip coded {roots} superblock roots, wanted at least 4" | |
| 1980 | - ); | |
| 1981 | - eprintln!("128x128 superblock roots: {roots}"); | |
| 1982 | 1975 | |
| 1983 | 1976 | let ours = crate::stream::decode_stream(&stream).expect("our decoder"); |
| 1984 | 1977 | assert_eq!(ours.len(), sources.len(), "our decoder's frames"); |
| 1985 | - assert!( | |
| 1986 | - crate::decode::part128_split_hits() >= 4, | |
| 1987 | - "our decoder read no 128x128 superblock root" | |
| 1988 | - ); | |
| 1989 | 1978 | let theirs = ffmpeg_decode_luma(&stream, width, height); |
| 1990 | 1979 | assert_eq!(theirs.len(), sources.len(), "ffmpeg's frames"); |
| 1991 | 1980 | for (i, (a, b)) in ours.iter().zip(&theirs).enumerate() { |
crates/ec-av1/src/film_grain.rsmodified+0 -16
| @@ -22,7 +22,6 @@ | ||
| 22 | 22 | //! the frame it pushes onto its output `Vec<Picture>`, after saving the |
| 23 | 23 | //! clean decode into the reference slot bank. |
| 24 | 24 | use archmage::SimdToken; |
| 25 | -use crate::hits::hit; | |
| 26 | 25 | |
| 27 | 26 | use crate::decode::WithRef; |
| 28 | 27 | use crate::encode::Picture; |
| @@ -1440,14 +1439,9 @@ pub(crate) fn apply_grain( | ||
| 1440 | 1439 | ) -> Picture { |
| 1441 | 1440 | if !fg.apply_grain { |
| 1442 | 1441 | let clean = picture.clone(); |
| 1443 | - // lane-av1graincensus: this exit censuses too, so "the picture | |
| 1444 | - // `apply_grain` hands back is censused in its final form" is a property | |
| 1445 | - // of the FUNCTION rather than of one branch. | |
| 1446 | - crate::decode::census_unwritten_grained(&clean.y, &clean.u, &clean.v); | |
| 1447 | 1442 | return clean; |
| 1448 | 1443 | } |
| 1449 | 1444 | fctx.grain_bit_depth.with(|c| c.set(bit_depth)); |
| 1450 | - hit!(GRAIN_HITS); | |
| 1451 | 1445 | // lane-av1422grain: the chroma geometry is per-axis. `FrameCtx` already |
| 1452 | 1446 | // carries the sequence header's pair (`decode::set_subsampling`), and |
| 1453 | 1447 | // `apply_grain` runs inside the same frame context, so the chroma |
| @@ -2142,16 +2136,6 @@ pub(crate) fn apply_grain( | ||
| 2142 | 2136 | }); |
| 2143 | 2137 | drop(parts); |
| 2144 | 2138 | |
| 2145 | - // lane-av1graincensus: the post-grain census, at the point the caller takes | |
| 2146 | - // the picture. `census_unwritten_final` runs in `stream.rs` BEFORE this | |
| 2147 | - // function, over the clean planes, and every filter writes in place into | |
| 2148 | - // that same buffer -- so the destination allocated above by `uninit_plane` | |
| 2149 | - // is the ONLY picture between that census and the caller that no census has | |
| 2150 | - // ever looked at. `lanes/unwritten-dep.report.md` §6/§8 declined to claim | |
| 2151 | - // anything about it; this measures it. `uninit_plane` poisons the buffer | |
| 2152 | - // under the same predicate, so the count is a measurement rather than a | |
| 2153 | - // coin flip on ambient garbage. | |
| 2154 | - crate::decode::census_unwritten_grained(&out.y, &out.u, &out.v); | |
| 2155 | 2139 | out |
| 2156 | 2140 | } |
| 2157 | 2141 |
crates/ec-av1/src/hits.rsdeleted+0 -47
| @@ -1,47 +0,0 @@ | ||
| 1 | -//! Gate-counter bumps, compiled out when the `gate-counters` feature is off. | |
| 2 | -//! | |
| 3 | -//! The ~550 `*_HITS` thread-locals in this crate exist only so the test gates | |
| 4 | -//! (and the probe's census print) can prove a coding path fired; every bump is | |
| 5 | -//! a TLS access plus a `Cell` read-modify-write on the parse thread. Routing | |
| 6 | -//! all of them through [`hit!`]/[`hit_do!`] lets a shipped decoder drop them | |
| 7 | -//! (`--no-default-features`) while the accessors keep compiling and returning | |
| 8 | -//! whatever the counters hold (0 when the feature is off), so no caller needs | |
| 9 | -//! a `cfg`. | |
| 10 | - | |
| 11 | -/// Bumps counter `$name` by one -- nothing at all without `gate-counters`. | |
| 12 | -/// Usable in expression position (it evaluates to `()`). | |
| 13 | -#[cfg(feature = "gate-counters")] | |
| 14 | -macro_rules! hit { | |
| 15 | - ($name:ident) => {{ | |
| 16 | - $name.with(|c| c.set(c.get() + 1)); | |
| 17 | - }}; | |
| 18 | -} | |
| 19 | - | |
| 20 | -#[cfg(not(feature = "gate-counters"))] | |
| 21 | -macro_rules! hit { | |
| 22 | - ($name:ident) => {{}}; | |
| 23 | -} | |
| 24 | - | |
| 25 | -/// Same, for a bump that is not a plain `+= 1` (array/tuple buckets, the | |
| 26 | -/// `inter_last_mc` stamp, the counter-only scan loops): the whole statement | |
| 27 | -/// list disappears without `gate-counters`. | |
| 28 | -#[cfg(feature = "gate-counters")] | |
| 29 | -macro_rules! hit_do { | |
| 30 | - ($($t:tt)*) => {{ | |
| 31 | - $($t)* | |
| 32 | - }}; | |
| 33 | -} | |
| 34 | - | |
| 35 | -// Without the feature the statements stay type-checked but unreachable, so the | |
| 36 | -// values they read (bucket indices, filter kinds) still count as used and the | |
| 37 | -// optimiser drops the whole branch. | |
| 38 | -#[cfg(not(feature = "gate-counters"))] | |
| 39 | -macro_rules! hit_do { | |
| 40 | - ($($t:tt)*) => {{ | |
| 41 | - if false { | |
| 42 | - $($t)* | |
| 43 | - } | |
| 44 | - }}; | |
| 45 | -} | |
| 46 | - | |
| 47 | -pub(crate) use {hit, hit_do}; |
crates/ec-av1/src/intra.rsmodified+0 -9
| @@ -7,7 +7,6 @@ | ||
| 7 | 7 | //! not this module's business -- the caller passes the samples it has, and the |
| 8 | 8 | //! edge is extended by repeating the last one, which is what the decoder does |
| 9 | 9 | //! with its own `BlockDecoded` bookkeeping (spec 7.11.2.2). |
| 10 | -use crate::hits::hit; | |
| 11 | 10 | |
| 12 | 11 | /// The average of the neighbours (spec 7.11.2.5). |
| 13 | 12 | pub const DC_PRED: u8 = 0; |
| @@ -283,13 +282,6 @@ pub(crate) fn predict( | ||
| 283 | 282 | dst: &mut [u16], fctx: &crate::decode::FrameCtx, |
| 284 | 283 | ) { |
| 285 | 284 | assert_eq!(dst.len(), bw * bh, "the destination is the block"); |
| 286 | - match mode { | |
| 287 | - SMOOTH_PRED | SMOOTH_V_PRED | SMOOTH_H_PRED => { | |
| 288 | - hit!(SMOOTH_PRED_HITS); | |
| 289 | - } | |
| 290 | - PAETH_PRED => hit!(PAETH_PRED_HITS), | |
| 291 | - _ => {} | |
| 292 | - } | |
| 293 | 285 | let edges = Edges::build(above, left, corner, bw, bh, fctx); |
| 294 | 286 | let is_directional = matches!( |
| 295 | 287 | mode, |
| @@ -484,7 +476,6 @@ fn filter_intra_edge(buf: &mut [i32], strength: i32) { | ||
| 484 | 476 | if strength == 0 { |
| 485 | 477 | return; |
| 486 | 478 | } |
| 487 | - hit!(EDGE_FILTER_HITS); | |
| 488 | 479 | const KERNEL: [[i32; 5]; 3] = [[0, 4, 8, 4, 0], [0, 5, 6, 5, 0], [2, 4, 4, 4, 2]]; |
| 489 | 480 | let filt = usize::try_from(strength - 1).expect("a filter strength is never negative"); |
| 490 | 481 | let sz = buf.len() as i32; |
crates/ec-av1/src/lib.rsmodified+0 -1
| @@ -35,7 +35,6 @@ mod film_grain; | ||
| 35 | 35 | pub use film_grain::apply_film_grain; |
| 36 | 36 | mod filter_search; |
| 37 | 37 | pub mod frame; |
| 38 | -mod hits; | |
| 39 | 38 | pub mod intra; |
| 40 | 39 | pub mod mc; |
| 41 | 40 | pub mod motion; |
crates/ec-av1/src/mc.rsmodified+0 -14
| @@ -9,7 +9,6 @@ | ||
| 9 | 9 | //! land on an even step; chroma vectors, once scaled for subsampling, can |
| 10 | 10 | //! land on any of the 16. |
| 11 | 11 | use archmage::SimdToken; |
| 12 | -use crate::hits::hit; | |
| 13 | 12 | |
| 14 | 13 | /// `Round2` (spec 4.7): halves round up. |
| 15 | 14 | fn round2(value: i32, shift: u32) -> i32 { |
| @@ -1473,7 +1472,6 @@ pub(crate) fn predict_with_filters_kern( | ||
| 1473 | 1472 | ) { |
| 1474 | 1473 | assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); |
| 1475 | 1474 | assert!(!reference.is_empty(), "a reference plane has samples"); |
| 1476 | - hit!(INTER_PRED_HITS); | |
| 1477 | 1475 | |
| 1478 | 1476 | #[cfg(test)] |
| 1479 | 1477 | let stage_t = crate::encode::stage_start(); |
| @@ -1569,9 +1567,6 @@ pub(crate) fn predict_with_filters_kern( | ||
| 1569 | 1567 | // clamped read. |
| 1570 | 1568 | if xfrac != 0 || yfrac == 0 { |
| 1571 | 1569 | // fall through to the two-pass path |
| 1572 | - if xfrac != 0 || yfrac != 0 { | |
| 1573 | - hit!(MC_SUBPEL_HITS); | |
| 1574 | - } | |
| 1575 | 1570 | } else { |
| 1576 | 1571 | let top = y0 - 3; |
| 1577 | 1572 | if top >= 0 |
| @@ -1761,9 +1756,6 @@ pub fn reset_rect_narrow_kern_hits() { | ||
| 1761 | 1756 | /// Bumps [`RECT_NARROW_KERN_HITS`] when the block's true dims pick a kernel |
| 1762 | 1757 | /// the destination buffer's dims would not have. |
| 1763 | 1758 | fn note_narrow_kern(block_w: usize, block_h: usize, kern_w: usize, kern_h: usize) { |
| 1764 | - if (kern_w <= 4) != (block_w <= 4) || (kern_h <= 4) != (block_h <= 4) { | |
| 1765 | - hit!(RECT_NARROW_KERN_HITS); | |
| 1766 | - } | |
| 1767 | 1759 | } |
| 1768 | 1760 | |
| 1769 | 1761 | /// Current value of [`INTER_PRED_HITS`]. |
| @@ -2052,8 +2044,6 @@ pub(crate) fn predict_scaled_kern( | ||
| 2052 | 2044 | ) { |
| 2053 | 2045 | assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); |
| 2054 | 2046 | assert!(!reference.is_empty(), "a reference plane has samples"); |
| 2055 | - hit!(INTER_PRED_HITS); | |
| 2056 | - hit!(PREDICT_SCALED_HITS); | |
| 2057 | 2047 | |
| 2058 | 2048 | let max = crate::decode::sample_max(fctx); |
| 2059 | 2049 | let (round0, round1) = round_pair(u32::from(crate::decode::bit_depth(fctx))); |
| @@ -2279,11 +2269,7 @@ pub(crate) fn predict_compound_intermediate_kern( | ||
| 2279 | 2269 | ) { |
| 2280 | 2270 | assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); |
| 2281 | 2271 | assert!(!reference.is_empty(), "a reference plane has samples"); |
| 2282 | - hit!(INTER_PRED_HITS); | |
| 2283 | 2272 | |
| 2284 | - if !scale.is_unscaled() { | |
| 2285 | - hit!(PREDICT_SCALED_HITS); | |
| 2286 | - } | |
| 2287 | 2273 | let x_scale_fp = scale.x; |
| 2288 | 2274 | if scale.y != REF_NO_SCALE { |
| 2289 | 2275 | let (round0, _) = round_pair(u32::from(crate::decode::bit_depth(fctx))); |
crates/ec-av1/src/motion_field.rsmodified+0 -7
| @@ -5,7 +5,6 @@ | ||
| 5 | 5 | //! (`av1/common/mvref_common.c`) and the projection math `add_tpl_ref_mv` |
| 6 | 6 | //! (same file) applies a second time, per query block, against the block's |
| 7 | 7 | //! own single reference frame. |
| 8 | -use crate::hits::hit; | |
| 9 | 8 | |
| 10 | 9 | use crate::mvstack::{ALTREF_FRAME, BWDREF_FRAME, GOLDEN_FRAME, LAST_FRAME, LAST2_FRAME}; |
| 11 | 10 | |
| @@ -428,12 +427,6 @@ pub fn setup_motion_field<M: std::borrow::Borrow<MotionField>>( | ||
| 428 | 427 | && slot_of(rf).is_some_and(|m| m.is_intra) |
| 429 | 428 | }) |
| 430 | 429 | .count(); |
| 431 | - if intra_forward_refs >= 1 { | |
| 432 | - hit!(REFSTAMP_INTRA_FRAMES); | |
| 433 | - } | |
| 434 | - if intra_forward_refs >= 2 { | |
| 435 | - hit!(REFSTAMP_INTRA2_FRAMES); | |
| 436 | - } | |
| 437 | 430 | |
| 438 | 431 | if let Some(last) = slot_of(LAST_FRAME) { |
| 439 | 432 | let alt_of_lst = last.ref_order_hints[(ALTREF_FRAME - LAST_FRAME) as usize]; |
crates/ec-av1/src/mvstack.rsmodified+0 -21
| @@ -77,7 +77,6 @@ | ||
| 77 | 77 | //! added by the row/col scan), and the "extra search" that pads a short |
| 78 | 78 | //! stack to two entries (spec 7.10.2.12) — this module's stack can be |
| 79 | 79 | //! shorter than two candidates where libaom's never is. |
| 80 | -use crate::hits::hit; | |
| 81 | 80 | |
| 82 | 81 | thread_local! { |
| 83 | 82 | /// How many query blocks [`find_mv_stack_with_sign_bias`] has folded at |
| @@ -693,7 +692,6 @@ fn add_candidate(candidates: &mut StackVec, mv: (i32, i32), weight: u32) { | ||
| 693 | 692 | if let Some(entry) = candidates.iter_mut().find(|e| e.mv == mv) { |
| 694 | 693 | entry.weight += weight; |
| 695 | 694 | } else if candidates.len() >= MAX_STACK_SIZE { |
| 696 | - hit!(STACK_FULL_DROPS); | |
| 697 | 695 | } else { |
| 698 | 696 | // libaom `add_ref_mv_candidate` (mvref_common.c:100) and |
| 699 | 697 | // `add_tpl_ref_mv` (:388) only push when |
| @@ -1174,9 +1172,6 @@ fn clamp_mv_ref( | ||
| 1174 | 1172 | let (row, col) = mv; |
| 1175 | 1173 | let clamped_row = row.clamp(to_top - bh8 - MV_BORDER, to_bottom + bh8 + MV_BORDER); |
| 1176 | 1174 | let clamped_col = col.clamp(to_left - bw8 - MV_BORDER, to_right + bw8 + MV_BORDER); |
| 1177 | - if clamped_row != row || clamped_col != col { | |
| 1178 | - hit!(MV_CLAMP_EDGE_OVERHANG_HITS); | |
| 1179 | - } | |
| 1180 | 1175 | } |
| 1181 | 1176 | |
| 1182 | 1177 | let (row, col) = mv; |
| @@ -1414,9 +1409,6 @@ pub fn find_mv_stack_with_sign_bias( | ||
| 1414 | 1409 | // (and so the stack ORDER) even though `MiGrid::get` already returns |
| 1415 | 1410 | // `None` for the cells outside the tile. |
| 1416 | 1411 | let (tile_row0, tile_col0) = grid.tile_origin(); |
| 1417 | - if tile_row0 > 0 || tile_col0 > 0 { | |
| 1418 | - hit!(TILE_REACH_CLIPS); | |
| 1419 | - } | |
| 1420 | 1412 | let max_row_offset: isize = if mi_row > tile_row0 { |
| 1421 | 1413 | let reach = if bh4 < 2 { -4 } else { -6 } + isize::from(row_adj); |
| 1422 | 1414 | reach.max(tile_row0 as isize - mi_row as isize) |
| @@ -1583,9 +1575,6 @@ pub fn find_mv_stack_with_sign_bias( | ||
| 1583 | 1575 | } |
| 1584 | 1576 | } |
| 1585 | 1577 | } |
| 1586 | - if any_hit { | |
| 1587 | - hit!(TMV_HITS); | |
| 1588 | - } | |
| 1589 | 1578 | zero_mv_ctx = usize::from(first_sample_missing || first_sample_far); |
| 1590 | 1579 | } |
| 1591 | 1580 | |
| @@ -1931,7 +1920,6 @@ fn add_compound_candidate( | ||
| 1931 | 1920 | if let Some(entry) = candidates.iter_mut().find(|e| e.mv0 == mv0 && e.mv1 == mv1) { |
| 1932 | 1921 | entry.weight += weight; |
| 1933 | 1922 | } else if candidates.len() >= MAX_STACK_SIZE { |
| 1934 | - hit!(STACK_FULL_DROPS); | |
| 1935 | 1923 | } else { |
| 1936 | 1924 | // Same insertion cap as [`add_candidate`]: libaom's compound branch |
| 1937 | 1925 | // of `add_ref_mv_candidate` (mvref_common.c:128) and `add_tpl_ref_mv` |
| @@ -2215,9 +2203,6 @@ fn combine_compound_candidates( | ||
| 2215 | 2203 | .collect(); |
| 2216 | 2204 | std::array::from_fn(|i| { |
| 2217 | 2205 | merged.get(i).copied().unwrap_or_else(|| { |
| 2218 | - if gm_mv_candidates[side] != (0, 0) { | |
| 2219 | - hit!(COMP_GM_FILL_HITS); | |
| 2220 | - } | |
| 2221 | 2206 | gm_mv_candidates[side] |
| 2222 | 2207 | }) |
| 2223 | 2208 | }) |
| @@ -2274,9 +2259,6 @@ pub fn find_mv_stack_compound( | ||
| 2274 | 2259 | // (and so the stack ORDER) even though `MiGrid::get` already returns |
| 2275 | 2260 | // `None` for the cells outside the tile. |
| 2276 | 2261 | let (tile_row0, tile_col0) = grid.tile_origin(); |
| 2277 | - if tile_row0 > 0 || tile_col0 > 0 { | |
| 2278 | - hit!(TILE_REACH_CLIPS); | |
| 2279 | - } | |
| 2280 | 2262 | let max_row_offset: isize = if mi_row > tile_row0 { |
| 2281 | 2263 | let reach = if bh4 < 2 { -4 } else { -6 } + isize::from(row_adj); |
| 2282 | 2264 | reach.max(tile_row0 as isize - mi_row as isize) |
| @@ -2441,9 +2423,6 @@ pub fn find_mv_stack_compound( | ||
| 2441 | 2423 | } |
| 2442 | 2424 | } |
| 2443 | 2425 | } |
| 2444 | - if any_hit { | |
| 2445 | - hit!(TMV_HITS); | |
| 2446 | - } | |
| 2447 | 2426 | zero_mv_ctx = usize::from(first_sample_missing || first_sample_far); |
| 2448 | 2427 | } |
| 2449 | 2428 |
crates/ec-av1/src/quant.rsmodified+0 -6
| @@ -216,7 +216,6 @@ pub fn dequant_coeff_wh( | ||
| 216 | 216 | dq2.clamp(-bound, bound - 1) as i32 |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | -use crate::hits::hit_do; | |
| 220 | 219 | |
| 221 | 220 | thread_local! { |
| 222 | 221 | /// lane-av1-qmatrix: transform units whose dequantisation actually |
| @@ -304,11 +303,6 @@ pub fn dequant_wh_into( | ||
| 304 | 303 | let dq2 = sign * ((dq.abs() & 0xFF_FFFF) / denom); |
| 305 | 304 | dq2.clamp(-bound, bound - 1) as i32 |
| 306 | 305 | }; |
| 307 | - hit_do! { | |
| 308 | - if qm.is_some() && levels.iter().any(|&l| l != 0) { | |
| 309 | - QM_SCALED_UNITS.with(|c| c.set(c.get() + 1)); | |
| 310 | - } | |
| 311 | - } | |
| 312 | 306 | out.clear(); |
| 313 | 307 | out.reserve(levels.len()); |
| 314 | 308 | out.extend( |
crates/ec-av1/src/restoration.rsmodified+0 -14
| @@ -4,7 +4,6 @@ | ||
| 4 | 4 | //! two pixel filters (Wiener, self-guided/SGR). See `lanes/lr.report.md` for |
| 5 | 5 | //! the full derivation (libaom `decodeframe.c`/`restoration.c` line refs). |
| 6 | 6 | use archmage::SimdToken; |
| 7 | -use crate::hits::hit; | |
| 8 | 7 | |
| 9 | 8 | use crate::msac::SymbolDecoder; |
| 10 | 9 | use ec_av1_syntax::obu::floor_log2; |
| @@ -648,23 +647,19 @@ fn read_lr_unit( | ||
| 648 | 647 | ) -> UnitFilter { |
| 649 | 648 | match ftype { |
| 650 | 649 | RestorationType::Switchable => { |
| 651 | - hit!(SWITCHABLE_HITS); | |
| 652 | 650 | let t = dec.symbol(&mut cdfs.restore_switchable); |
| 653 | 651 | match t { |
| 654 | 652 | 0 => UnitFilter::None, |
| 655 | 653 | 1 => { |
| 656 | - hit!(WIENER_HITS); | |
| 657 | 654 | UnitFilter::Wiener(read_wiener_filter(dec, chroma, &mut reference.0)) |
| 658 | 655 | } |
| 659 | 656 | _ => { |
| 660 | - hit!(SGRPROJ_HITS); | |
| 661 | 657 | UnitFilter::Sgrproj(read_sgrproj_filter(dec, &mut reference.1)) |
| 662 | 658 | } |
| 663 | 659 | } |
| 664 | 660 | } |
| 665 | 661 | RestorationType::Wiener => { |
| 666 | 662 | if dec.symbol(&mut cdfs.restore_wiener) != 0 { |
| 667 | - hit!(WIENER_HITS); | |
| 668 | 663 | UnitFilter::Wiener(read_wiener_filter(dec, chroma, &mut reference.0)) |
| 669 | 664 | } else { |
| 670 | 665 | UnitFilter::None |
| @@ -673,7 +668,6 @@ fn read_lr_unit( | ||
| 673 | 668 | RestorationType::Sgrproj => { |
| 674 | 669 | let bit = dec.symbol(&mut cdfs.restore_sgrproj); |
| 675 | 670 | if bit != 0 { |
| 676 | - hit!(SGRPROJ_HITS); | |
| 677 | 671 | UnitFilter::Sgrproj(read_sgrproj_filter(dec, &mut reference.1)) |
| 678 | 672 | } else { |
| 679 | 673 | UnitFilter::None |
| @@ -1508,14 +1502,6 @@ fn filter_restoration_unit( | ||
| 1508 | 1502 | let nominal_h = full_stripe_height - if frame_stripe == 0 { runit_offset } else { 0 }; |
| 1509 | 1503 | let h = nominal_h.min(unit_h - i); |
| 1510 | 1504 | let stripe_v_end = stripe_v_start + h; |
| 1511 | - if !matches!(filter, UnitFilter::None) { | |
| 1512 | - if stripe_v_start == 0 { | |
| 1513 | - hit!(LR_STRIPE0_HITS); | |
| 1514 | - } | |
| 1515 | - if stripe_v_end == plane_h && h < nominal_h { | |
| 1516 | - hit!(LR_LAST_STRIPE_HITS); | |
| 1517 | - } | |
| 1518 | - } | |
| 1519 | 1505 | match filter { |
| 1520 | 1506 | UnitFilter::Wiener(info) => apply_wiener_stripe( |
| 1521 | 1507 | out, |
crates/ec-av1/src/stream/mod.rsmodified+0 -380
| @@ -38,314 +38,6 @@ fn no_grain() -> bool { | ||
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | |
| 41 | -/// 32x32-level 1:4 strip counters, for `decode_probe`'s fixture search: | |
| 42 | -/// (HORZ_4 strips, VERT_4 strips, strips that read coefficients). | |
| 43 | -/// lane-inter4 r1: the INTER-frame partition counters this lane's gates | |
| 44 | -/// assert -- `(32x8, 8x32, 64x32, 32x64, 64x16, 16x64)` strips decoded. | |
| 45 | -pub fn inter_rect_counters() -> (usize, usize, usize, usize, usize, usize) { | |
| 46 | - ( | |
| 47 | - crate::decode::rect4_32_horz_inter_hits(), | |
| 48 | - crate::decode::rect4_32_vert_inter_hits(), | |
| 49 | - crate::decode::inter_sb_horz_hits(), | |
| 50 | - crate::decode::inter_sb_vert_hits(), | |
| 51 | - crate::decode::inter_sb_horz4_hits(), | |
| 52 | - crate::decode::inter_sb_vert4_hits(), | |
| 53 | - ) | |
| 54 | -} | |
| 55 | - | |
| 56 | -/// lane-r14 r2: luma transform units of an inter strip with a 64-px axis, | |
| 57 | -/// coded as the truncated low-32 coefficient corner. | |
| 58 | -pub fn rect64_inter_tu_hits() -> usize { | |
| 59 | - crate::decode::rect64_inter_tu_hits() | |
| 60 | -} | |
| 61 | - | |
| 62 | -/// lane-rectres r1: whole-block luma transform units of a 32x32-level 1:4 | |
| 63 | -/// inter strip (`TX_32X8`/`TX_8X32`), `[32x8, 8x32]`. | |
| 64 | -pub fn rect32x8_inter_tu_hits() -> [usize; 2] { | |
| 65 | - crate::decode::rect32x8_inter_tu_hits() | |
| 66 | -} | |
| 67 | - | |
| 68 | -/// lane-t900 r7: sub-8x8 inter groups whose one chroma unit inherited a | |
| 69 | -/// `tx_type` different from the group's FIRST sub-block, i.e. groups that can | |
| 70 | -/// only decode right under `av1_get_tx_type`'s chroma-reference rule. | |
| 71 | -pub fn sub8_chroma_tx_from_ref_hits() -> usize { | |
| 72 | - crate::decode::sub8_chroma_tx_from_ref_hits() | |
| 73 | -} | |
| 74 | - | |
| 75 | -/// lane-intra16x4: `(16x4, 4x16, chroma-reference)` INTRA strips decoded inside | |
| 76 | -/// an inter 16x16-level 1:4 partition. | |
| 77 | -pub fn intra16x4_in_inter_hits() -> (usize, usize, usize) { | |
| 78 | - crate::decode::intra16x4_in_inter_hits() | |
| 79 | -} | |
| 80 | - | |
| 81 | -/// lane-sub8intra: INTRA 8x4/4x8 leaves inside an inter frame's sub-8x8 | |
| 82 | -/// HORZ/VERT partition, `(8x4, 4x8, chroma-reference, mixed groups, split | |
| 83 | -/// 4x4 leaves)`. | |
| 84 | -pub fn sub8_intra_rect_hits() -> (usize, usize, usize, usize, usize) { | |
| 85 | - crate::decode::sub8_intra_rect_hits() | |
| 86 | -} | |
| 87 | - | |
| 88 | -/// lane-r14 r3: RECTANGULAR var-tx leaf transform units, `[32x16, 16x32]` -- | |
| 89 | -/// the leaves `sub_tx_size_map` produces when a 1:4 strip with a 64-px axis | |
| 90 | -/// splits its transform (`[TX_64X16] == TX_32X16`, `[TX_16X64] == TX_16X32`). | |
| 91 | -pub fn vartx_rect_leaf_hits() -> [usize; 2] { | |
| 92 | - crate::decode::vartx_rect_leaf_hits() | |
| 93 | -} | |
| 94 | - | |
| 95 | -/// How many rect intra strips read the `use_intrabc` symbol on the last decode. | |
| 96 | -pub fn rect_intrabc_reads() -> usize { | |
| 97 | - crate::decode::rect_intrabc_reads() | |
| 98 | -} | |
| 99 | - | |
| 100 | -/// lane-av1-ibc444rect: unskipped intrabc 8x4/4x8 leaves whose luma a lossless | |
| 101 | -/// frame walked as per-4x4 inter units. | |
| 102 | -pub fn intrabc_rect8_lossless_luma_hits() -> usize { | |
| 103 | - crate::decode::intrabc_rect8_lossless_luma_hits() | |
| 104 | -} | |
| 105 | - | |
| 106 | -/// lane-av1-ibc444rect: unskipped intrabc 8x4/4x8 leaves whose chroma a | |
| 107 | -/// lossless 4:4:4 frame walked as per-4x4 `Chroma4` units. | |
| 108 | -pub fn intrabc_rect8_lossless_chroma_hits() -> usize { | |
| 109 | - crate::decode::intrabc_rect8_lossless_chroma_hits() | |
| 110 | -} | |
| 111 | - | |
| 112 | -/// Gate-side reset for the lane-av1-ibc444rect counters above. | |
| 113 | -pub fn reset_ibc444rect_hits() { | |
| 114 | - crate::decode::reset_ibc444rect_hits() | |
| 115 | -} | |
| 116 | - | |
| 117 | -/// lane-av1chromarect: 128-root intra-BC HORZ/VERT strips whose chroma plane | |
| 118 | -/// block was sized `bw >> ss_x` by `bh >> ss_y` rather than the hardcoded | |
| 119 | -/// 4:2:0 halving -- i.e. the 4:4:4 (and 4:4:0) cells, where | |
| 120 | -/// `av1_get_max_uv_txsize` (`ss_size_lookup[bsize]`, blockd.h:1372) applies no | |
| 121 | -/// halving of its own. At 4:2:0 the two forms are the same arithmetic, so a | |
| 122 | -/// `>= 1` witness can only come from a stream that is not 4:2:0. EXCLUSIVE to | |
| 123 | -/// `decode_intrabc_owned_rect`: no other caller sizes a 128-root intra-BC | |
| 124 | -/// strip's chroma plane block. | |
| 125 | -pub fn ibc_owned_rect_chroma_footprint_444_hits() -> usize { | |
| 126 | - crate::decode::ibc_owned_rect_chroma_footprint_444_hits() | |
| 127 | -} | |
| 128 | - | |
| 129 | -/// Gate-side reset for the lane-av1chromarect counter above. | |
| 130 | -pub fn reset_ibc_owned_rect_chroma_footprint_444_hits() { | |
| 131 | - crate::decode::reset_ibc_owned_rect_chroma_footprint_444_hits() | |
| 132 | -} | |
| 133 | - | |
| 134 | -/// lane-av1chromadc: chroma units of a skipped block whose intra-BC / UV | |
| 135 | -/// palette override had to be windowed to the unit's own extent -- `cn_cols * | |
| 136 | -/// cn_rows > 1`, which at 4:2:0 never happens and at 4:4:4 is every block of | |
| 137 | -/// 64 and above. Counts UNITS. EXCLUSIVE to `decode_block`'s skipped square | |
| 138 | -/// block chroma walk. | |
| 139 | -pub fn skip_chroma_override_window_hits() -> usize { | |
| 140 | - crate::decode::skip_chroma_override_window_hits() | |
| 141 | -} | |
| 142 | - | |
| 143 | -/// Gate-side reset for the lane-av1chromadc counter above. | |
| 144 | -pub fn reset_skip_chroma_override_window_hits() { | |
| 145 | - crate::decode::reset_skip_chroma_override_window_hits() | |
| 146 | -} | |
| 147 | - | |
| 148 | -/// lane-av1rectreach: the `chroma_tiled` walk's per-unit reach and grid-shape | |
| 149 | -/// counters, as `(unit_reach_differs_from_block, 2x1 units, 1x2 units, other | |
| 150 | -/// multi-unit units)`. See [`crate::decode::rect_tiled_chroma_grid_hits`]. | |
| 151 | -pub fn rect_tiled_chroma_grid_hits() -> (usize, usize, usize, usize) { | |
| 152 | - crate::decode::rect_tiled_chroma_grid_hits() | |
| 153 | -} | |
| 154 | - | |
| 155 | -/// Gate-side reset for the lane-av1rectreach counters above. | |
| 156 | -pub fn reset_rect_tiled_chroma_grid_hits() { | |
| 157 | - crate::decode::reset_rect_tiled_chroma_grid_hits() | |
| 158 | -} | |
| 159 | - | |
| 160 | -/// `(y, uv)` palette blocks RECONSTRUCTED inside an inter frame (lane-t900 | |
| 161 | -/// r22) -- the counter a screen-content witness gate reads to prove it | |
| 162 | -/// exercises the inter-frame palette path, not the key frame's. | |
| 163 | -pub fn intra_in_inter_palette_hits() -> (usize, usize) { | |
| 164 | - crate::decode::intra_in_inter_palette_hits() | |
| 165 | -} | |
| 166 | - | |
| 167 | -/// `(y, uv)` palette blocks reconstructed on an 8x8 LEAF inside an inter | |
| 168 | -/// frame (lane-t900 r23) -- the site-specific half of | |
| 169 | -/// [`intra_in_inter_palette_hits`], which a >=16 block also moves. | |
| 170 | -pub fn inter8_palette_hits() -> (usize, usize) { | |
| 171 | - crate::decode::inter8_palette_hits() | |
| 172 | -} | |
| 173 | - | |
| 174 | -/// lane-rect64port r1: coded 64-level HORZ/VERT intra strips whose luma | |
| 175 | -/// transform unit is the un-split TX_64X32 (orient 0) / TX_32X64 (orient 1). | |
| 176 | -pub fn rect64_corner_tu_hits(orient: usize) -> usize { | |
| 177 | - crate::decode::rect64_corner_tu_hits(orient) | |
| 178 | -} | |
| 179 | - | |
| 180 | -/// lane-inter16ab r4: RECTANGULAR var-tx leaves with a 4-px axis, `[8x4, 4x8]` | |
| 181 | -/// -- what `sub_tx_size_map[TX_16X4] == TX_8X4` produces when a 16x16-level | |
| 182 | -/// 1:4 inter strip splits its transform. | |
| 183 | -pub fn vartx_rect_leaf4_hits() -> [usize; 2] { | |
| 184 | - crate::decode::vartx_rect_leaf4_hits() | |
| 185 | -} | |
| 186 | - | |
| 187 | -/// lane-inter16ab r5: COMPOUND_WEDGE / wedge-INTERINTRA blocks that used a | |
| 188 | -/// RECTANGULAR wedge codebook row, per shape (`RECT_WEDGE_SHAPES` order: | |
| 189 | -/// 8x16, 16x8, 16x32, 32x16, 8x32, 32x8). | |
| 190 | -pub fn rect_wedge_hits() -> [usize; 6] { | |
| 191 | - crate::decode::rect_wedge_hits() | |
| 192 | -} | |
| 193 | - | |
| 194 | -/// lane-inter16ab r5: the wedge-interintra half of [`rect_wedge_hits`]. | |
| 195 | -pub fn rect_wii_hits() -> [usize; 6] { | |
| 196 | - crate::decode::rect_wii_hits() | |
| 197 | -} | |
| 198 | - | |
| 199 | -/// lane-sb128c r7: the 128 root's rect arms -- (gathered edge HORZ, gathered | |
| 200 | -/// edge VERT, inter 128x64 blocks, inter 64x128 blocks). | |
| 201 | -pub fn sb128_rect_counters() -> (usize, usize, usize, usize) { | |
| 202 | - ( | |
| 203 | - crate::decode::part128_edge_horz_hits(), | |
| 204 | - crate::decode::part128_edge_vert_hits(), | |
| 205 | - crate::decode::inter_sb128_horz_hits(), | |
| 206 | - crate::decode::inter_sb128_vert_hits(), | |
| 207 | - ) | |
| 208 | -} | |
| 209 | - | |
| 210 | -/// lane-av1-ibcrect: the 128 root's interior partition arms plus the key-frame | |
| 211 | -/// intra 128-axis blocks -- (split, none, horz, vert, ab[4], intra_horz, | |
| 212 | -/// intra_vert). Non-zero horz/vert mean a stream carried real PARTITION_HORZ/ | |
| 213 | -/// VERT at the 128 root, so an intrabc-rect hunt can tell "the partition was | |
| 214 | -/// never chosen" from "chosen and decoded intra (or refused)". | |
| 215 | -pub fn part128_census() -> (usize, usize, usize, usize, [usize; 4], usize, usize) { | |
| 216 | - ( | |
| 217 | - crate::decode::part128_split_hits(), | |
| 218 | - crate::decode::part128_none_hits(), | |
| 219 | - crate::decode::part128_horz_hits(), | |
| 220 | - crate::decode::part128_vert_hits(), | |
| 221 | - crate::decode::part128_ab_hits(), | |
| 222 | - crate::decode::intra_sb128_hits().0, | |
| 223 | - crate::decode::intra_sb128_hits().1, | |
| 224 | - ) | |
| 225 | -} | |
| 226 | - | |
| 227 | -/// lane-av1-ibcrect: `use_intrabc` blocks on a 128-root HORZ/VERT strip whose | |
| 228 | -/// reconstruction ([`crate::decode::decode_intrabc_128rect`]) ran -- the | |
| 229 | -/// engagement counter the sb128 intrabc-rect gate asserts on. | |
| 230 | -pub fn intrabc_128rect_hits() -> usize { | |
| 231 | - crate::decode::intrabc_128rect_hits() | |
| 232 | -} | |
| 233 | - | |
| 234 | -/// lane-av1-ibc128chunk: chroma transform units the 128-root intrabc strip's | |
| 235 | -/// mu-chunk walk read, one per `read_inter_plane` chroma call. At 4:2:2 a | |
| 236 | -/// 64x64 mu chunk's chroma plane block is 32x64 and holds TWO STACKED | |
| 237 | -/// TX_32X32 units per plane; the square-cut walk this gate witnesses read | |
| 238 | -/// one. Measured on the pinned witness: 8 before, 48 after. | |
| 239 | -pub fn intrabc_128rect_chroma_chunk_hits() -> usize { | |
| 240 | - crate::decode::intrabc_128rect_chroma_chunk_hits() | |
| 241 | -} | |
| 242 | - | |
| 243 | -/// lane-av1-ibc128chunk: the 128-root intrabc strip's per-axis chroma chunk | |
| 244 | -/// extents as `(64 >> ss_x) << 8 | (64 >> ss_y)` on the last chunk walked -- | |
| 245 | -/// 32|32 at 4:2:0, 32|64 at 4:2:2, 64|64 at 4:4:4. | |
| 246 | -pub fn intrabc_128rect_chunk_shape() -> usize { | |
| 247 | - crate::decode::intrabc_128rect_chunk_shape() | |
| 248 | -} | |
| 249 | - | |
| 250 | -/// Blocks reconstructed with intra block copy at an 8x8 LEAF specifically | |
| 251 | -/// (lane-kf900 r7's shape); [`crate::decode::intrabc_hits`] counts every shape. | |
| 252 | -pub fn leaf8_intrabc_hits() -> usize { | |
| 253 | - crate::decode::leaf8_intrabc_hits() | |
| 254 | -} | |
| 255 | - | |
| 256 | -/// Blocks whose `use_intrabc` symbol came out 1 and took the DV path, at ANY | |
| 257 | -/// shape -- the engagement counter the intrabc gates assert on. It counts | |
| 258 | -/// "read a `use_intrabc` DV", not "reconstructed": a block the rect-strip | |
| 259 | -/// reader REFUSES for an unported shape bumps it too (the symbol and the DV | |
| 260 | -/// are parsed before the refusal). [`leaf8_intrabc_hits`] is its 8x8-leaf | |
| 261 | -/// subset. | |
| 262 | -pub fn intrabc_hits() -> usize { | |
| 263 | - crate::decode::intrabc_hits() | |
| 264 | -} | |
| 265 | - | |
| 266 | -/// lane-av1txbands: sub-8x8 group chroma-reference leaves that USED intrabc and | |
| 267 | -/// were SKIPPED -- the route that armed [`crate::decode::intrabc_hits`]'s chroma | |
| 268 | -/// transform slot and then read no chroma coefficient. A non-zero value is what | |
| 269 | -/// makes the disarm at that route load-bearing on a real stream. | |
| 270 | -pub fn skipped_intrabc_chroma_arm_hits() -> usize { | |
| 271 | - crate::decode::skipped_intrabc_chroma_arm_hits() | |
| 272 | -} | |
| 273 | - | |
| 274 | -/// lane-sb128c r8: the 128 root's INTRA (key-frame) rect arm -- (128x64 | |
| 275 | -/// blocks, 64x128 blocks, blocks per resolved intra `tx_depth` 0/1/2). | |
| 276 | -pub fn intra_sb128_counters() -> (usize, usize, [usize; 3]) { | |
| 277 | - crate::decode::intra_sb128_hits() | |
| 278 | -} | |
| 279 | - | |
| 280 | -/// lane-inter128intra r1: the 128 root's HORZ/VERT half coded INTRA inside an | |
| 281 | -/// INTER frame -- (128x64 blocks, 64x128 blocks). | |
| 282 | -pub fn intra128_in_inter_counters() -> [usize; 2] { | |
| 283 | - crate::decode::intra128_in_inter_hits() | |
| 284 | -} | |
| 285 | - | |
| 286 | -/// lane-lossless128: intra 128-axis blocks decoded on a LOSSLESS frame, where | |
| 287 | -/// every plane is a TX_4X4 unit. The engagement counter for | |
| 288 | -/// `a_lossless_sb128_rect_intra_block_decodes_sample_exact`. | |
| 289 | -pub fn intra128_lossless_counters() -> usize { | |
| 290 | - crate::decode::intra128_lossless_hits() | |
| 291 | -} | |
| 292 | - | |
| 293 | -/// lane-av1-128rectspan: chroma transform units re-stamped by | |
| 294 | -/// `decode_block_128rect`'s end-of-block replay, and how many of those | |
| 295 | -/// replays stamped a height that was not the unit's own. | |
| 296 | -/// lane-av1422lift: the second half was described as "the 4:2:2 signature -- | |
| 297 | -/// zero on every stream this decoder admits, since 4:2:2 is refused by name | |
| 298 | -/// at the sequence header", and that was TRUE. 4:2:2 is decoded now and the | |
| 299 | -/// mismatch is NOT zero: measured on this branch's tip, the two | |
| 300 | -/// `422_intrabc_sb128_strip*` pins each read `(72, 9)` while the other 19 | |
| 301 | -/// committed 4:2:2 cells read `(0, 0)`. Those two pins are byte-exact | |
| 302 | -/// against ffmpeg, so the non-zero half counts the arm's own designed case | |
| 303 | -/// and is not a defect. lane-av1422mismatch9: the predicate is | |
| 304 | -/// `luma_span != luma_span_h` (`chroma_tx << ss_x` vs `<< ss_y`), true by | |
| 305 | -/// CONSTRUCTION at ss (1,0), and the replay re-stamps with the same per-axis | |
| 306 | -/// pair the in-loop walk used, so the counter is a 4:2:2 shape test, not a | |
| 307 | -/// divergence test (`record_mi_chroma` writes only the left/above context | |
| 308 | -/// arrays, never a pixel). One 4:2:2 gate now reads the pair and asserts the | |
| 309 | -/// measured `(72, 9)`: | |
| 310 | -/// `the_422_block_128rect_chroma_chunk_gather_stays_per_axis`; the other | |
| 311 | -/// reader is on a 4:4:4 stream, where the mismatch half is structurally zero. | |
| 312 | -pub fn sb128rect_chroma_replay_counters() -> (usize, usize) { | |
| 313 | - crate::decode::sb128rect_chroma_replay_hits() | |
| 314 | -} | |
| 315 | - | |
| 316 | -/// lane-sb128c r9: the four AB shapes at the 128 root, in `PARTITION_HORZ_A`, | |
| 317 | -/// `_HORZ_B`, `_VERT_A`, `_VERT_B` order (key and inter tile paths share the | |
| 318 | -/// counter -- it is bumped where the root symbol resolves). | |
| 319 | -pub fn sb128_ab_counters() -> [usize; 4] { | |
| 320 | - crate::decode::part128_ab_hits() | |
| 321 | -} | |
| 322 | - | |
| 323 | -/// lane-obmcrec r1: OBMC neighbours taken from the second half of a 1:4-strip | |
| 324 | -/// chroma pair -- the shape whose filter record the r1 fix re-sourced. | |
| 325 | -pub fn obmc_pair_filter_hits() -> usize { | |
| 326 | - crate::decode::obmc_pair_filter_hits() | |
| 327 | -} | |
| 328 | - | |
| 329 | -/// Gate counters for the 4x32/32x4 rectangular strips: `(horz, vert, coeff)` hits. | |
| 330 | -pub fn rect4_32_counters() -> (usize, usize, usize) { | |
| 331 | - ( | |
| 332 | - crate::decode::rect4_32_horz_hits(), | |
| 333 | - crate::decode::rect4_32_vert_hits(), | |
| 334 | - crate::decode::rect4_coeff_hits(), | |
| 335 | - ) | |
| 336 | -} | |
| 337 | - | |
| 338 | -/// lane-inter4 r4: rectangular inter transform units coded whole, rect | |
| 339 | -/// var-tx trees that split, and OBMC blends run on a 16x8/8x16 leaf -- the | |
| 340 | -/// three counters a recipe sweep needs to see from outside the crate. | |
| 341 | -pub fn rect_inter_tu_counters() -> (usize, usize, usize) { | |
| 342 | - ( | |
| 343 | - crate::decode::rect_inter_tu_hits(), | |
| 344 | - crate::decode::rect_inter_txsplit_hits(), | |
| 345 | - crate::decode::obmc_rect_leaf_hits(), | |
| 346 | - ) | |
| 347 | -} | |
| 348 | - | |
| 349 | 41 | /// Decode every frame in a raw AV1 OBU stream, in coding order. |
| 350 | 42 | /// |
| 351 | 43 | /// A key frame becomes the reference for the inter frames that follow it, |
| @@ -2249,14 +1941,6 @@ fn decode_frame( | ||
| 2249 | 1941 | // 4:2:0 one never inherits the wrong plane count. |
| 2250 | 1942 | crate::decode::set_mono(seq.mono_chrome, fctx); |
| 2251 | 1943 | crate::decode::set_subsampling(seq.subsampling_x, seq.subsampling_y, fctx); |
| 2252 | - // lane-av1readcensus: the coefficient-unit census is armed here, off the | |
| 2253 | - // same sequence-header subsampling. lane-av1422census422 widened it from | |
| 2254 | - // 4:4:4-only to "any format with an unsubsampled luma axis", so a 4:2:2 | |
| 2255 | - // cell's per-plane unit counts are readable and a 4:2:2 gate can assert | |
| 2256 | - // a non-vacuous walk; 4:2:0 still reads zero, so the 4:2:0 control in | |
| 2257 | - // `a_pixel_exact_444_stream_walks_the_same_coefficient_units_the_oracle_does` | |
| 2258 | - // keeps asserting exactly that. | |
| 2259 | - crate::decode::set_census_nonsub(seq.subsampling_x, seq.subsampling_y); | |
| 2260 | 1944 | // lane-av1txr: spec 5.9.2 `disable_cdf_update` -- a frame that sets it |
| 2261 | 1945 | // codes every tile symbol against the CDFs it started with, so the tile |
| 2262 | 1946 | // readers must not adapt (libaom `decodeframe.c:2909`: |
| @@ -2503,46 +2187,6 @@ fn decode_frame( | ||
| 2503 | 2187 | // *initial* table into the slots it refreshes, not the adapted |
| 2504 | 2188 | // end-of-tile one. |
| 2505 | 2189 | let stored_cdfs = stored_cdfs_for(header, end_cdfs, started_from); |
| 2506 | - // lane-hidden r1: the frame exactly as it is about to be stored into | |
| 2507 | - // the reference slots -- after deblock/CDEF/LR/superres, in DECODE | |
| 2508 | - // order, hidden (`show_frame == 0`) alt-ref frames included, and | |
| 2509 | - // bit-depth correct (8-bit as u8, 10/12-bit as u16 LE) unlike the | |
| 2510 | - // u8-narrowing diagnostic dumps above. Matches the instrumented | |
| 2511 | - // aomdec's own `EC_AV1_FINAL_DUMP` rung byte for byte | |
| 2512 | - // (scripts/instrument-aom-oracle.sh rung 12), which is what makes a | |
| 2513 | - // hidden frame's pixels comparable at all. | |
| 2514 | - // lane-unwritten-dep: the census AT the output point, beside the dump that | |
| 2515 | - // defines "the output" -- the same bytes, so the claim is about the frame the | |
| 2516 | - // caller receives rather than about an intermediate stage. | |
| 2517 | - // | |
| 2518 | - // WHAT THIS IS FOR, corrected: an earlier revision of this comment said the | |
| 2519 | - // pre-deblock plane was byte-identical plain-vs-sentinel and that deblock | |
| 2520 | - // creates the dependence. That was wrong, and it was `dump_stage16`'s fault: | |
| 2521 | - // it cropped chroma as `(fw/2, fh/2)`, a 4:2:0 assumption, so on a 64x64 | |
| 2522 | - // 4:2:2 frame 2048 chroma samples appeared in no stage dump at all -- exactly | |
| 2523 | - // the region the difference lives in. With per-axis extents the corrected | |
| 2524 | - // measurement on `440_request_is_422` is that the PRE-DEBLOCK dump already | |
| 2525 | - // differs by 2158 bytes and an exact u16 census finds 224 unwritten samples | |
| 2526 | - // (U 112, V 112, rows 36..63) -- the same count `lanes/av1unwritten.report.md` | |
| 2527 | - // reports. The hole is present before any filter runs, and the pre-deblock | |
| 2528 | - // census SEES it. | |
| 2529 | - // | |
| 2530 | - // So this second census is not a patch for a blind pre-deblock scan. It is | |
| 2531 | - // the measurement taken where the reference-bank bytes are taken, which | |
| 2532 | - // covers the whole span from the tile walk to those bytes: every filter | |
| 2533 | - // writes IN PLACE into the very buffer this scans, so nothing a later | |
| 2534 | - // filter does can open a hole outside its extent. | |
| 2535 | - // | |
| 2536 | - // lane-av1graincensus, the scope correction this comment needed: "to the | |
| 2537 | - // caller's frame" was WRONG, and this call is not what makes it right. | |
| 2538 | - // `apply_grain` runs after this and ALLOCATES a fresh picture | |
| 2539 | - // (`film_grain::uninit_plane`, `with_capacity` + `set_len`, no fill), so | |
| 2540 | - // that destination never passes through here. The claim over the PRE-GRAIN | |
| 2541 | - // planes -- the bytes the reference bank stores and every later frame | |
| 2542 | - // predicts from -- is what this line supports; the grained picture the | |
| 2543 | - // caller receives is censused by `decode::census_unwritten_grained`, at | |
| 2544 | - // `apply_grain`'s own return, over its own counters. | |
| 2545 | - decode::census_unwritten_final(&picture.y, &picture.u, &picture.v); | |
| 2546 | 2190 | if let Some(why) = fctx.corrupt.get() { |
| 2547 | 2191 | return Err(Error::corrupt(format!("AV1 frame {decode_idx}: {why}"))); |
| 2548 | 2192 | } |
| @@ -2554,29 +2198,5 @@ fn decode_frame( | ||
| 2554 | 2198 | }) |
| 2555 | 2199 | } |
| 2556 | 2200 | |
| 2557 | -/// lane-intra14 r1: INTRA-coded 1:4 strips decoded on the INTER block path | |
| 2558 | -/// (64x16, 16x64, 32x8, 8x32) -- the counters a recipe sweep needs from | |
| 2559 | -/// outside the crate. | |
| 2560 | -pub fn intra_rect4_in_inter_counters() -> (usize, usize, usize, usize) { | |
| 2561 | - ( | |
| 2562 | - crate::decode::intra_rect4_strip_in_inter_hits(0), | |
| 2563 | - crate::decode::intra_rect4_strip_in_inter_hits(1), | |
| 2564 | - crate::decode::intra_rect4_strip_in_inter_hits(2), | |
| 2565 | - crate::decode::intra_rect4_strip_in_inter_hits(3), | |
| 2566 | - ) | |
| 2567 | -} | |
| 2568 | - | |
| 2569 | -/// lane-av1recipehunt: the recipe sweep's view of the `delta_q` story from | |
| 2570 | -/// OUTSIDE the crate -- `(delta_q symbol groups read, rect64 dequant calls that | |
| 2571 | -/// saw `CURRENT_Q_IDX != base_q_idx`)`. A recipe that reads delta_q but never | |
| 2572 | -/// lands one inside a rect64 root is a different failure from one that reads | |
| 2573 | -/// neither, and the gate can only tell them apart with both numbers. | |
| 2574 | -pub fn rect64_qidx_drift_counters() -> (usize, usize) { | |
| 2575 | - ( | |
| 2576 | - crate::decode::delta_q_hits(), | |
| 2577 | - crate::decode::rect64_qidx_drift_hits(), | |
| 2578 | - ) | |
| 2579 | -} | |
| 2580 | - | |
| 2581 | 2201 | #[cfg(test)] |
| 2582 | 2202 | pub(crate) mod tests; |
crates/ec-av1/src/superres.rsmodified+0 -2
| @@ -10,7 +10,6 @@ | ||
| 10 | 10 | //! Every constant and the 64x8 `av1_resize_filter_normative` coefficient |
| 11 | 11 | //! table below is copied verbatim from libaom `aom_dsp/aom_filter.h` and |
| 12 | 12 | //! `av1/common/resize.c` (`AOM_VERSION=v3.13.3`, `~/.cache/aom-oracle`). |
| 13 | -use crate::hits::hit; | |
| 14 | 13 | |
| 15 | 14 | /// `RS_SUBPEL_BITS`. |
| 16 | 15 | const RS_SUBPEL_BITS: u32 = 6; |
| @@ -185,7 +184,6 @@ pub(crate) fn superres_hits() -> usize { | ||
| 185 | 184 | |
| 186 | 185 | /// Counts one whole upscaled picture (all three planes) for [`SUPERRES_HITS`]. |
| 187 | 186 | pub(crate) fn note_upscaled_picture() { |
| 188 | - hit!(SUPERRES_HITS); | |
| 189 | 187 | } |
| 190 | 188 | |
| 191 | 189 | #[cfg(test)] |