Intra 128x64/64x128 at the 128 superblock root -- rect intra block with per-TU prediction, mu-chunk chroma, and a frame-edge write clip
Browse files at this commit603f865f3931efd4659b90268efe1271c7cd2116Parent: ce0a01c- feat
- intra 128x64/64x128 at the 128 superblock root -- rect intra block with per-TU prediction, mu-chunk chroma, and a frame-edge write clip
4 changed files +691 -9
- crates/ec-av1/src/decode.rs +399 -8
- crates/ec-av1/src/refusal_inventory.rs +1 -1
- crates/ec-av1/src/stream.rs +177 -0
- lanes/sb128c-r8.report.md +114 -0
crates/ec-av1/src/decode.rsmodified+399 -8
| @@ -9245,7 +9245,16 @@ impl PlaneBuf { | |||
| 9245 | ); | 9245 | ); |
| 9246 | } | 9246 | } |
| 9247 | for row in 0..bh { | 9247 | for row in 0..bh { |
| 9248 | + // Same bottom/right frame-edge clip as [`Self::reconstruct`]'s | ||
| 9249 | + // (lane-sb128c r8) -- a 64x128 block at the right edge of a frame | ||
| 9250 | + // whose padded width is not superblock aligned hangs past it. | ||
| 9251 | + if y + row >= self.height { | ||
| 9252 | + break; | ||
| 9253 | + } | ||
| 9248 | for col in 0..bw { | 9254 | for col in 0..bw { |
| 9255 | + if x + col >= self.width { | ||
| 9256 | + break; | ||
| 9257 | + } | ||
| 9249 | let idx = row * bw + col; | 9258 | let idx = row * bw + col; |
| 9250 | let mut base = i32::from(prediction[idx]); | 9259 | let mut base = i32::from(prediction[idx]); |
| 9251 | if let Some((alpha_q3, ac_q3)) = cfl { | 9260 | if let Some((alpha_q3, ac_q3)) = cfl { |
| @@ -9338,7 +9347,21 @@ impl PlaneBuf { | |||
| 9338 | ); | 9347 | ); |
| 9339 | } | 9348 | } |
| 9340 | for row in 0..side { | 9349 | for row in 0..side { |
| 9350 | + // lane-sb128c r8: libaom's frame buffer is superblock | ||
| 9351 | + // aligned; ours is padded to 32 (`block_grid`), so a 64x64 | ||
| 9352 | + // transform unit of a 128x64 block at the BOTTOM frame edge | ||
| 9353 | + // can hang past the last padded row (1920x792: a unit at | ||
| 9354 | + // y=768 wants 832 rows of an 800-row buffer, which panicked | ||
| 9355 | + // the film's key frames). Those samples are outside the | ||
| 9356 | + // frame: never output, and no block below ever references | ||
| 9357 | + // them. | ||
| 9358 | + if y + row >= self.height { | ||
| 9359 | + break; | ||
| 9360 | + } | ||
| 9341 | for col in 0..side { | 9361 | for col in 0..side { |
| 9362 | + if x + col >= self.width { | ||
| 9363 | + break; | ||
| 9364 | + } | ||
| 9342 | let idx = row * side + col; | 9365 | let idx = row * side + col; |
| 9343 | let mut base = i32::from(prediction[idx]); | 9366 | let mut base = i32::from(prediction[idx]); |
| 9344 | if let Some((alpha_q3, ac_q3)) = cfl { | 9367 | if let Some((alpha_q3, ac_q3)) = cfl { |
| @@ -10099,6 +10122,307 @@ fn decode_block( | |||
| 10099 | Ok(()) | 10122 | Ok(()) |
| 10100 | } | 10123 | } |
| 10101 | 10124 | ||
| 10125 | +thread_local! { | ||
| 10126 | + /// lane-sb128c r8: INTRA (key-frame) 128x64 blocks decoded at the 128 | ||
| 10127 | + /// root's HORZ arm, and 64x128 ones at its VERT arm. | ||
| 10128 | + pub(crate) static INTRA_SB128_HORZ_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 10129 | + pub(crate) static INTRA_SB128_VERT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 10130 | + /// Those blocks by resolved intra `tx_depth` (0 = TX_64X64 units, | ||
| 10131 | + /// 1 = TX_32X32, 2 = TX_16X16) -- proof the depth symbol is really read. | ||
| 10132 | + pub(crate) static INTRA_SB128_DEPTH_HITS: std::cell::Cell<[usize; 3]> = const { std::cell::Cell::new([0; 3]) }; | ||
| 10133 | +} | ||
| 10134 | + | ||
| 10135 | +/// [`INTRA_SB128_HORZ_HITS`] / [`INTRA_SB128_VERT_HITS`] / | ||
| 10136 | +/// [`INTRA_SB128_DEPTH_HITS`], for a gate's own before/after delta. | ||
| 10137 | +pub(crate) fn intra_sb128_hits() -> (usize, usize, [usize; 3]) { | ||
| 10138 | + ( | ||
| 10139 | + INTRA_SB128_HORZ_HITS.with(std::cell::Cell::get), | ||
| 10140 | + INTRA_SB128_VERT_HITS.with(std::cell::Cell::get), | ||
| 10141 | + INTRA_SB128_DEPTH_HITS.with(std::cell::Cell::get), | ||
| 10142 | + ) | ||
| 10143 | +} | ||
| 10144 | + | ||
| 10145 | +/// The 128 root's HORZ/VERT arm on an INTRA frame: ONE 128x64 (HORZ) or | ||
| 10146 | +/// 64x128 (VERT) intra block (lane-sb128c r8; the inter twin is | ||
| 10147 | +/// `decode_inter_block`'s own rect path). | ||
| 10148 | +/// | ||
| 10149 | +/// libaom `decode_block` -> `predict_and_reconstruct_intra_block` per | ||
| 10150 | +/// transform unit, with the 128-specific geometry: | ||
| 10151 | +/// * `max_txsize_rect_lookup[BLOCK_128X64]` is TX_64X64, so every luma unit | ||
| 10152 | +/// is SQUARE and there are at least two of them -- depth 0: 64x64 x2, | ||
| 10153 | +/// depth 1: 32x32 x8, depth 2: 16x16 x32 (`bsize_to_tx_size_cat` counts | ||
| 10154 | +/// the `sub_tx_size_map` chain TX_64X64->32->16->8->4, i.e. cat 3, the | ||
| 10155 | +/// same CDF a 64x64 square block reads). | ||
| 10156 | +/// * `av1_get_max_uv_txsize` = `av1_get_adjusted_tx_size( | ||
| 10157 | +/// max_txsize_rect_lookup[BLOCK_64X32])` caps at TX_32X32, so the block's | ||
| 10158 | +/// 64x32 uv plane block is TWO 32x32 chroma units per plane -- one per | ||
| 10159 | +/// 64x64 luma "mu" chunk, and `decode_token_recon_block` codes Y, U, V of | ||
| 10160 | +/// a chunk before moving to the next (the interleave lane-sb128b r3 | ||
| 10161 | +/// measured at the 128x128 NONE root). | ||
| 10162 | +/// * `get_txb_ctx`: the uv plane block is bigger than the uv transform, so | ||
| 10163 | +/// chroma `txb_skip_ctx` takes the offset-10 rows (7 + 3). | ||
| 10164 | +/// No CfL, no filter intra (both cap at 32x32) and no palette | ||
| 10165 | +/// (`av1_allow_palette` caps at 64x64) exist at this size -- the mode | ||
| 10166 | +/// reader's own size gates already say so, and the guard below is defensive. | ||
| 10167 | +#[allow(clippy::too_many_arguments)] | ||
| 10168 | +fn decode_block_128rect( | ||
| 10169 | + dec: &mut SymbolDecoder, | ||
| 10170 | + cdfs: &mut Cdfs, | ||
| 10171 | + neighbours: &mut Neighbours, | ||
| 10172 | + at: (usize, usize), | ||
| 10173 | + bw: usize, | ||
| 10174 | + bh: usize, | ||
| 10175 | + y: &mut PlaneBuf, | ||
| 10176 | + u: &mut PlaneBuf, | ||
| 10177 | + v: &mut PlaneBuf, | ||
| 10178 | + base_q_idx: u8, | ||
| 10179 | + enable_filter_intra: bool, | ||
| 10180 | + allow_screen_content_tools: bool, | ||
| 10181 | + tx_select: bool, | ||
| 10182 | + reduced_tx_set: bool, | ||
| 10183 | +) -> Result<()> { | ||
| 10184 | + let (r, c) = at; | ||
| 10185 | + let (px, py) = (c * SUB, r * SUB); | ||
| 10186 | + let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI)); | ||
| 10187 | + let (nb_above_mode, nb_left_mode) = neighbours.modes_above_left(r, c); | ||
| 10188 | + let (palette_ctx, palette_cache) = neighbours.palette_ctx_and_cache(at); | ||
| 10189 | + let palette_uv_cache = neighbours.palette_uv_cache(at); | ||
| 10190 | + let (skip, mode, angle_delta_y, uv_mode, angle_delta_uv, alpha, filter_intra, palette_y, palette_uv) = | ||
| 10191 | + read_intra_mode_rect( | ||
| 10192 | + dec, | ||
| 10193 | + cdfs, | ||
| 10194 | + nb_above_mode, | ||
| 10195 | + nb_left_mode, | ||
| 10196 | + // `is_cfl_allowed` caps CFL at 32x32: `uv_mode` comes off the | ||
| 10197 | + // 13-symbol no-CFL CDF here, never the 14-symbol one. | ||
| 10198 | + false, | ||
| 10199 | + true, | ||
| 10200 | + bw, | ||
| 10201 | + bh, | ||
| 10202 | + enable_filter_intra, | ||
| 10203 | + neighbours.skip_txfm_ctx(mi_r, mi_c), | ||
| 10204 | + allow_screen_content_tools, | ||
| 10205 | + Some((palette_ctx, &palette_cache)), | ||
| 10206 | + &palette_uv_cache, | ||
| 10207 | + mi_r, | ||
| 10208 | + mi_c, | ||
| 10209 | + )?; | ||
| 10210 | + if alpha.is_some() || filter_intra.is_some() || palette_y.is_some() || palette_uv.is_some() { | ||
| 10211 | + return Err(unsupported( | ||
| 10212 | + "CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (every one of \ | ||
| 10213 | + their size gates caps at 64x64 or below, so none of these symbols exists there)", | ||
| 10214 | + )); | ||
| 10215 | + } | ||
| 10216 | + let uv_predict_mode = if uv_mode == UV_CFL_PRED { DC_PRED } else { uv_mode }; | ||
| 10217 | + let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode); | ||
| 10218 | + if smooth_neighbor { | ||
| 10219 | + SMOOTH_LUMA_HITS.with(|c| c.set(c.get() + 1)); | ||
| 10220 | + } | ||
| 10221 | + let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c); | ||
| 10222 | + // spec 5.11.16 `read_tx_size`: read for every intra block, skipped or | ||
| 10223 | + // not. `bsize_to_tx_size_cat(BLOCK_128X64)` is 3 (see this fn's doc). | ||
| 10224 | + let depth = if tx_select { | ||
| 10225 | + let ctx = tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh); | ||
| 10226 | + dec.symbol(&mut cdfs.tx_size_cat3[ctx]) | ||
| 10227 | + } else { | ||
| 10228 | + 0 | ||
| 10229 | + }; | ||
| 10230 | + if depth != 0 { | ||
| 10231 | + TX_DEPTH_HITS.with(|c| c.set(c.get() + 1)); | ||
| 10232 | + } | ||
| 10233 | + INTRA_SB128_DEPTH_HITS.with(|c| { | ||
| 10234 | + let mut h = c.get(); | ||
| 10235 | + h[depth.min(2)] += 1; | ||
| 10236 | + c.set(h); | ||
| 10237 | + }); | ||
| 10238 | + let logical_tx = 64 >> depth; | ||
| 10239 | + // A 64-point transform codes nothing past its low 32 coefficients. | ||
| 10240 | + let coeff_tx_side = logical_tx.min(32); | ||
| 10241 | + let luma_set = txbset_for(logical_tx, reduced_tx_set); | ||
| 10242 | + let luma_scan = default_scan(coeff_tx_side); | ||
| 10243 | + let chroma_tx = 32; | ||
| 10244 | + let chroma_scan = default_scan(chroma_tx); | ||
| 10245 | + let (cpx, cpy) = (px / 2, py / 2); | ||
| 10246 | + let (chroma_w, chroma_h) = (bw / 2, bh / 2); | ||
| 10247 | + let reach = Reach::of_rect(bw, bh, px, py, y.width, y.height); | ||
| 10248 | + let (nch_x, nch_y) = (bw / 64, bh / 64); | ||
| 10249 | + // One 32x32 chroma unit per mu chunk, per plane. | ||
| 10250 | + debug_assert_eq!((chroma_w / chroma_tx, chroma_h / chroma_tx), (nch_x, nch_y)); | ||
| 10251 | + let tpc = 64 / logical_tx; | ||
| 10252 | + let zero_tu = vec![0i32; logical_tx * logical_tx]; | ||
| 10253 | + let zero_cu = vec![0i32; chroma_tx * chroma_tx]; | ||
| 10254 | + let mut last_grids = [Vec::new(), Vec::new()]; | ||
| 10255 | + let mut units: Vec<((usize, usize), Vec<i32>, Vec<i32>)> = Vec::new(); | ||
| 10256 | + for ch_row in 0..nch_y { | ||
| 10257 | + for ch_col in 0..nch_x { | ||
| 10258 | + for tu_row in ch_row * tpc..(ch_row + 1) * tpc { | ||
| 10259 | + for tu_col in ch_col * tpc..(ch_col + 1) * tpc { | ||
| 10260 | + let tu_mi = ( | ||
| 10261 | + mi_r + tu_row * (logical_tx / MI), | ||
| 10262 | + mi_c + tu_col * (logical_tx / MI), | ||
| 10263 | + ); | ||
| 10264 | + let (tu_px, tu_py) = (px + tu_col * logical_tx, py + tu_row * logical_tx); | ||
| 10265 | + // libaom clips the transform loop to | ||
| 10266 | + // `max_blocks_wide/high`: a unit whose top-left sample is | ||
| 10267 | + // outside the frame is never coded. | ||
| 10268 | + if tu_px >= y.true_width || tu_py >= y.true_height { | ||
| 10269 | + continue; | ||
| 10270 | + } | ||
| 10271 | + // Edge availability of a unit INSIDE a block, with the | ||
| 10272 | + // 128 geometry -- `has_top_right` is false for a block | ||
| 10273 | + // whose largest side is > 64, which [`Reach::of_rect`] | ||
| 10274 | + // already answered for the block and [`tu_reach`] carries | ||
| 10275 | + // down to the units on its own top row. | ||
| 10276 | + let tu_r = tu_reach( | ||
| 10277 | + bw, | ||
| 10278 | + bh, | ||
| 10279 | + tu_col * logical_tx, | ||
| 10280 | + tu_row * logical_tx, | ||
| 10281 | + logical_tx, | ||
| 10282 | + reach, | ||
| 10283 | + px, | ||
| 10284 | + py, | ||
| 10285 | + y.width, | ||
| 10286 | + y.height, | ||
| 10287 | + ); | ||
| 10288 | + if skip { | ||
| 10289 | + y.reconstruct( | ||
| 10290 | + tu_px, tu_py, logical_tx, mode, angle_delta_y, tu_r, &zero_tu, None, | ||
| 10291 | + None, smooth_neighbor, | ||
| 10292 | + ); | ||
| 10293 | + neighbours.record_mi_luma(tu_mi, logical_tx, &zero_tu); | ||
| 10294 | + continue; | ||
| 10295 | + } | ||
| 10296 | + // The unit is smaller than its block, so `txb_skip_ctx` | ||
| 10297 | + // is the neighbour-magnitude table, never the lone-TU 0. | ||
| 10298 | + let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, logical_tx / MI); | ||
| 10299 | + let tu_around = neighbours.around_mi(tu_mi, logical_tx)[0]; | ||
| 10300 | + let tu_grid = read_plane( | ||
| 10301 | + dec, | ||
| 10302 | + cdfs, | ||
| 10303 | + luma_set, | ||
| 10304 | + &luma_scan, | ||
| 10305 | + 0, | ||
| 10306 | + tu_around, | ||
| 10307 | + mode, | ||
| 10308 | + mode, | ||
| 10309 | + angle_delta_y, | ||
| 10310 | + tu_r, | ||
| 10311 | + y, | ||
| 10312 | + tu_px, | ||
| 10313 | + tu_py, | ||
| 10314 | + logical_tx, | ||
| 10315 | + coeff_tx_side, | ||
| 10316 | + base_q_idx, | ||
| 10317 | + None, | ||
| 10318 | + None, | ||
| 10319 | + Some(tu_skip_ctx), | ||
| 10320 | + smooth_neighbor, | ||
| 10321 | + )?; | ||
| 10322 | + neighbours.record_mi_luma(tu_mi, logical_tx, &tu_grid); | ||
| 10323 | + } | ||
| 10324 | + } | ||
| 10325 | + // The chroma context arrays are indexed in LUMA mi, so this | ||
| 10326 | + // unit's anchor is its own 64x64 mu chunk. | ||
| 10327 | + let luma_span = chroma_tx * 2; | ||
| 10328 | + let cu_mi = ( | ||
| 10329 | + mi_r + ch_row * (luma_span / MI), | ||
| 10330 | + mi_c + ch_col * (luma_span / MI), | ||
| 10331 | + ); | ||
| 10332 | + let cu_r = tu_reach( | ||
| 10333 | + bw, | ||
| 10334 | + bh, | ||
| 10335 | + ch_col * luma_span, | ||
| 10336 | + ch_row * luma_span, | ||
| 10337 | + luma_span, | ||
| 10338 | + reach, | ||
| 10339 | + px, | ||
| 10340 | + py, | ||
| 10341 | + y.width, | ||
| 10342 | + y.height, | ||
| 10343 | + ); | ||
| 10344 | + let (cu_x, cu_y) = (cpx + ch_col * chroma_tx, cpy + ch_row * chroma_tx); | ||
| 10345 | + if skip { | ||
| 10346 | + u.reconstruct( | ||
| 10347 | + cu_x, cu_y, chroma_tx, uv_predict_mode, angle_delta_uv, cu_r, &zero_cu, None, | ||
| 10348 | + None, smooth_neighbor_uv, | ||
| 10349 | + ); | ||
| 10350 | + v.reconstruct( | ||
| 10351 | + cu_x, cu_y, chroma_tx, uv_predict_mode, angle_delta_uv, cu_r, &zero_cu, None, | ||
| 10352 | + None, smooth_neighbor_uv, | ||
| 10353 | + ); | ||
| 10354 | + continue; | ||
| 10355 | + } | ||
| 10356 | + let cu_around = neighbours.around_mi(cu_mi, luma_span); | ||
| 10357 | + let u_grid = read_plane( | ||
| 10358 | + dec, cdfs, TxbSet::Chroma32, &chroma_scan, 1, cu_around[1], mode, uv_predict_mode, | ||
| 10359 | + angle_delta_uv, cu_r, u, cu_x, cu_y, chroma_tx, chroma_tx, base_q_idx, None, None, | ||
| 10360 | + Some(3), smooth_neighbor_uv, | ||
| 10361 | + )?; | ||
| 10362 | + let v_grid = read_plane( | ||
| 10363 | + dec, cdfs, TxbSet::Chroma32, &chroma_scan, 2, cu_around[2], mode, uv_predict_mode, | ||
| 10364 | + angle_delta_uv, cu_r, v, cu_x, cu_y, chroma_tx, chroma_tx, base_q_idx, None, None, | ||
| 10365 | + Some(3), smooth_neighbor_uv, | ||
| 10366 | + )?; | ||
| 10367 | + CHROMA_SPLIT_TX_HITS.with(|c| c.set(c.get() + 1)); | ||
| 10368 | + // Immediately, so the NEXT unit of this same block reads this | ||
| 10369 | + // one's coefficient context; replayed after `record_split_luma_rect` | ||
| 10370 | + // below, which would otherwise clobber them whole-block. | ||
| 10371 | + neighbours.record_mi_chroma(cu_mi, luma_span, luma_span, 1, &u_grid); | ||
| 10372 | + neighbours.record_mi_chroma(cu_mi, luma_span, luma_span, 2, &v_grid); | ||
| 10373 | + units.push((cu_mi, u_grid.clone(), v_grid.clone())); | ||
| 10374 | + last_grids = [u_grid, v_grid]; | ||
| 10375 | + } | ||
| 10376 | + } | ||
| 10377 | + if skip { | ||
| 10378 | + neighbours.record_rect( | ||
| 10379 | + at, | ||
| 10380 | + bw, | ||
| 10381 | + bh, | ||
| 10382 | + mode, | ||
| 10383 | + uv_predict_mode, | ||
| 10384 | + &[ | ||
| 10385 | + vec![0i32; bw * bh], | ||
| 10386 | + vec![0i32; chroma_w * chroma_h], | ||
| 10387 | + vec![0i32; chroma_w * chroma_h], | ||
| 10388 | + ], | ||
| 10389 | + ); | ||
| 10390 | + } else { | ||
| 10391 | + neighbours.record_split_luma_rect( | ||
| 10392 | + at, | ||
| 10393 | + bw, | ||
| 10394 | + bh, | ||
| 10395 | + mode, | ||
| 10396 | + uv_predict_mode, | ||
| 10397 | + [&last_grids[0], &last_grids[1]], | ||
| 10398 | + ); | ||
| 10399 | + for (cu_mi, u_grid, v_grid) in &units { | ||
| 10400 | + neighbours.record_mi_chroma(*cu_mi, 64, 64, 1, u_grid); | ||
| 10401 | + neighbours.record_mi_chroma(*cu_mi, 64, 64, 2, v_grid); | ||
| 10402 | + } | ||
| 10403 | + } | ||
| 10404 | + // No palette exists at this size; the unconditional stamp clears any | ||
| 10405 | + // stale neighbour palette state, as every other block path does. | ||
| 10406 | + neighbours.record_palette_y_rect(at, bw, bh, 0, [0u16; 8]); | ||
| 10407 | + neighbours.record_palette_uv_rect(at, bw, bh, 0, [0u16; 8]); | ||
| 10408 | + neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, skip); | ||
| 10409 | + neighbours.fill_lf_grid_rect( | ||
| 10410 | + (mi_r, mi_c), | ||
| 10411 | + bw / MI, | ||
| 10412 | + bh / MI, | ||
| 10413 | + logical_tx as u8, | ||
| 10414 | + logical_tx as u8, | ||
| 10415 | + 0, | ||
| 10416 | + ); | ||
| 10417 | + if bw > bh { | ||
| 10418 | + INTRA_SB128_HORZ_HITS.with(|c| c.set(c.get() + 1)); | ||
| 10419 | + } else { | ||
| 10420 | + INTRA_SB128_VERT_HITS.with(|c| c.set(c.get() + 1)); | ||
| 10421 | + } | ||
| 10422 | + Ok(()) | ||
| 10423 | +} | ||
| 10424 | + | ||
| 10425 | + | ||
| 10102 | /// Decodes one 8x8 leaf of a straddling 16x16 block (lane-av1-rect), mirroring | 10426 | /// Decodes one 8x8 leaf of a straddling 16x16 block (lane-av1-rect), mirroring |
| 10103 | /// [`crate::tile::write_leaf8`]: its intra-mode context comes from the | 10427 | /// [`crate::tile::write_leaf8`]: its intra-mode context comes from the |
| 10104 | /// *enclosing* 16x16 slot's `above_mode`/`left_mode` (`outer_at`, [`SUB`]-grid), | 10428 | /// *enclosing* 16x16 slot's `above_mode`/`left_mode` (`outer_at`, [`SUB`]-grid), |
| @@ -13698,14 +14022,81 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 13698 | mi_rows, | 14022 | mi_rows, |
| 13699 | )?; | 14023 | )?; |
| 13700 | if matches!(part128, PARTITION_HORZ | PARTITION_VERT) { | 14024 | if matches!(part128, PARTITION_HORZ | PARTITION_VERT) { |
| 13701 | - // lane-sb128c r7: the INTER path decodes these (two 128x64 | 14025 | + // lane-sb128c r8: libaom `decode_partition` |
| 13702 | - // / two 64x128 blocks, the film's own bottom-edge shape); | 14026 | + // (decodeframe.c:1554) codes PARTITION_HORZ at the 128 |
| 13703 | - // the key path's `decode_block` is square-only, so an | 14027 | + // root as `subsize = BLOCK_128X64` at (mi_row, mi_col) |
| 13704 | - // intra 128x64 would silently decode as four 64x64 | 14028 | + // plus a second one at (mi_row + hbs, mi_col) only |
| 13705 | - // quadrants. Refuse by name instead of corrupting. | 14029 | + // `if (mi_row + hbs < mi_rows)`; PARTITION_VERT mirrors it |
| 13706 | - return Err(unsupported( | 14030 | + // on the column. `hbs` is `mi_size_high[BLOCK_128X128]/2` |
| 13707 | - "a 128x128 superblock HORZ/VERT partition on an intra frame (the inter path decodes it; the intra one is square-block only)", | 14031 | + // = 16 mi. Both halves together cover the whole root, so |
| 13708 | - )); | 14032 | + // the remaining three 64x64 quadrant visits code nothing |
| 14033 | + // (same flag the NONE arm sets). | ||
| 14034 | + sb128_none = true; | ||
| 14035 | + let horz = part128 == PARTITION_HORZ; | ||
| 14036 | + let at128 = ((sb_r & !1) as usize * 4, (sb_c & !1) as usize * 4); | ||
| 14037 | + let (bw, bh) = if horz { (128usize, 64usize) } else { (64, 128) }; | ||
| 14038 | + for i in 0..2 { | ||
| 14039 | + let at = if horz { | ||
| 14040 | + (at128.0 + i * 4, at128.1) | ||
| 14041 | + } else { | ||
| 14042 | + (at128.0, at128.1 + i * 4) | ||
| 14043 | + }; | ||
| 14044 | + let (blk_mi_r, blk_mi_c) = (at.0 * (SUB / MI), at.1 * (SUB / MI)); | ||
| 14045 | + if i > 0 | ||
| 14046 | + && (blk_mi_r >= mi_rows as usize || blk_mi_c >= mi_cols as usize) | ||
| 14047 | + { | ||
| 14048 | + break; | ||
| 14049 | + } | ||
| 14050 | + // Each half reads its OWN `cdef_idx` literal | ||
| 14051 | + // (libaom `read_cdef` keys the `-1` test on the | ||
| 14052 | + // block's own `MB_MODE_INFO`, and the two halves have | ||
| 14053 | + // different ones). | ||
| 14054 | + CDEF_TRANSMITTED.with(|c| c.set(false)); | ||
| 14055 | + decode_block_128rect( | ||
| 14056 | + &mut dec, | ||
| 14057 | + &mut cdfs, | ||
| 14058 | + &mut neighbours, | ||
| 14059 | + at, | ||
| 14060 | + bw, | ||
| 14061 | + bh, | ||
| 14062 | + &mut y, | ||
| 14063 | + &mut u, | ||
| 14064 | + &mut v, | ||
| 14065 | + base_q_idx, | ||
| 14066 | + enable_filter_intra, | ||
| 14067 | + allow_screen_content_tools, | ||
| 14068 | + tx_select, | ||
| 14069 | + reduced_tx_set, | ||
| 14070 | + )?; | ||
| 14071 | + } | ||
| 14072 | + // One `cdef_idx` per BLOCK, copied to every 64x64 CDEF | ||
| 14073 | + // unit it covers (the inter path's own fan-out). | ||
| 14074 | + let (q_r, q_c) = ((sb_r & !1) as usize, (sb_c & !1) as usize); | ||
| 14075 | + CDEF_IDX_GRID.with(|g| { | ||
| 14076 | + let mut g = g.borrow_mut(); | ||
| 14077 | + let cols = CDEF_SB_COLS.with(|c| c.get()); | ||
| 14078 | + if cols == 0 { | ||
| 14079 | + return; | ||
| 14080 | + } | ||
| 14081 | + for (src, dst) in if horz { | ||
| 14082 | + [((0, 0), (0, 1)), ((1, 0), (1, 1))] | ||
| 14083 | + } else { | ||
| 14084 | + [((0, 0), (1, 0)), ((0, 1), (1, 1))] | ||
| 14085 | + } { | ||
| 14086 | + let (si, di) = ( | ||
| 14087 | + (q_r + src.0) * cols + q_c + src.1, | ||
| 14088 | + (q_r + dst.0) * cols + q_c + dst.1, | ||
| 14089 | + ); | ||
| 14090 | + if q_c + src.1 < cols | ||
| 14091 | + && q_c + dst.1 < cols | ||
| 14092 | + && si < g.len() | ||
| 14093 | + && di < g.len() | ||
| 14094 | + { | ||
| 14095 | + g[di] = g[si]; | ||
| 14096 | + } | ||
| 14097 | + } | ||
| 14098 | + }); | ||
| 14099 | + continue; | ||
| 13709 | } | 14100 | } |
| 13710 | if part128 == PARTITION_NONE { | 14101 | if part128 == PARTITION_NONE { |
| 13711 | // One 128x128 intra block: four TX_64X64 luma units and a | 14102 | // One 128x128 intra block: four TX_64X64 luma units and a |
crates/ec-av1/src/refusal_inventory.rsmodified+1 -1
| @@ -45,7 +45,7 @@ const REFUSALS: &[&str] = &[ | |||
| 45 | "a superblock-level partition value outside PARTITION_NONE..PARTITION_VERT_4", | 45 | "a superblock-level partition value outside PARTITION_NONE..PARTITION_VERT_4", |
| 46 | "a 128x128 superblock AB partition (HORZ_A/HORZ_B/VERT_A/VERT_B at the 128 root)", | 46 | "a 128x128 superblock AB partition (HORZ_A/HORZ_B/VERT_A/VERT_B at the 128 root)", |
| 47 | "an inter var-tx tree with a leaf transform larger than 64x64", | 47 | "an inter var-tx tree with a leaf transform larger than 64x64", |
| 48 | - "a 128x128 superblock HORZ/VERT partition on an intra frame (the inter path decodes it; the intra one is square-block only)", | 48 | + "CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (every one of their size gates caps at 64x64 or below, so none of these symbols exists there)", |
| 49 | "intrabc under a 128x128 superblock (libaom's av1_is_dv_valid derives the block-vector delay from sb_size, which this decoder hardcodes to 64)", | 49 | "intrabc under a 128x128 superblock (libaom's av1_is_dv_valid derives the block-vector delay from sb_size, which this decoder hardcodes to 64)", |
| 50 | "a palette block on a HORZ/VERT intra strip below 16x16 (reconstruction not ported)", | 50 | "a palette block on a HORZ/VERT intra strip below 16x16 (reconstruction not ported)", |
| 51 | "a palette block with a real transform on a superblock-level HORZ/VERT strip (corner-cropped luma coefficients not ported for palette)", | 51 | "a palette block with a real transform on a superblock-level HORZ/VERT strip (corner-cropped luma coefficients not ported for palette)", |
crates/ec-av1/src/stream.rsmodified+177 -0
| @@ -92,6 +92,12 @@ pub fn sb128_rect_counters() -> (usize, usize, usize, usize) { | |||
| 92 | ) | 92 | ) |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | +/// lane-sb128c r8: the 128 root's INTRA (key-frame) rect arm -- (128x64 | ||
| 96 | +/// blocks, 64x128 blocks, blocks per resolved intra `tx_depth` 0/1/2). | ||
| 97 | +pub fn intra_sb128_counters() -> (usize, usize, [usize; 3]) { | ||
| 98 | + crate::decode::intra_sb128_hits() | ||
| 99 | +} | ||
| 100 | + | ||
| 95 | pub fn rect4_32_counters() -> (usize, usize, usize) { | 101 | pub fn rect4_32_counters() -> (usize, usize, usize) { |
| 96 | ( | 102 | ( |
| 97 | crate::decode::rect4_32_horz_hits(), | 103 | crate::decode::rect4_32_horz_hits(), |
| @@ -19131,6 +19137,177 @@ mod tests { | |||
| 19131 | ); | 19137 | ); |
| 19132 | } | 19138 | } |
| 19133 | 19139 | ||
| 19140 | + /// lane-sb128c r8: the 128 root's HORZ/VERT arm on a KEY frame -- one | ||
| 19141 | + /// 128x64 (or 64x128) INTRA block, the shape r7 still refused by name. | ||
| 19142 | + /// A smooth `gradients` source makes the key frame itself take the arm | ||
| 19143 | + /// (`mandelbrot`'s key frames always split), at sizes whose last | ||
| 19144 | + /// superblock row/column is a partial 64 so the gathered frame-edge bit | ||
| 19145 | + /// decides the root. `--enable-tx-size-search=1` on half the arms is what | ||
| 19146 | + /// makes the intra `tx_depth` symbol real (depth 1 = 32x32 units, | ||
| 19147 | + /// depth 2 = 16x16). Every decode-order frame (hidden alt-refs included) | ||
| 19148 | + /// is compared against the instrumented aomdec, and the per-depth | ||
| 19149 | + /// counters are printed for every compared attempt. | ||
| 19150 | + #[test] | ||
| 19151 | + fn a_real_aomenc_sb128_intra_rect_block_decodes_pixel_exact() { | ||
| 19152 | + const NAME: &str = "a_real_aomenc_sb128_intra_rect_block_decodes_pixel_exact"; | ||
| 19153 | + let _gate_lock = lock_gate_counters(); | ||
| 19154 | + if !have_ffmpeg() { | ||
| 19155 | + eprintln!("SKIP {NAME}: no ffmpeg"); | ||
| 19156 | + return; | ||
| 19157 | + } | ||
| 19158 | + if !have_aomenc() { | ||
| 19159 | + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); | ||
| 19160 | + return; | ||
| 19161 | + } | ||
| 19162 | + // (tag, cq, width, height, 10-bit, vertical twin, tx-size-search) | ||
| 19163 | + let arms: Vec<(u32, &str, usize, usize, bool, bool, bool)> = vec![ | ||
| 19164 | + (42, "--cq-level=55", 384, 320, false, false, false), | ||
| 19165 | + (43, "--cq-level=32", 384, 320, true, false, true), | ||
| 19166 | + (44, "--cq-level=8", 256, 192, false, false, true), | ||
| 19167 | + (46, "--cq-level=55", 192, 256, false, true, false), | ||
| 19168 | + (45, "--cq-level=45", 192, 256, true, true, true), | ||
| 19169 | + ]; | ||
| 19170 | + let (mut matched, mut named_refusals, mut out_of_scope) = (0u32, 0u32, 0u32); | ||
| 19171 | + let (mut horz_arms, mut vert_arms) = (0u32, 0u32); | ||
| 19172 | + let mut depth_seen = [0usize; 3]; | ||
| 19173 | + for (tag, cq, width, height, ten_bit, vert, tx_search) in arms { | ||
| 19174 | + let pix = if ten_bit { "yuv420p10le" } else { "yuv420p" }; | ||
| 19175 | + let y4m = Command::new("ffmpeg") | ||
| 19176 | + .args([ | ||
| 19177 | + "-v", "error", "-f", "lavfi", "-i", | ||
| 19178 | + // DETERMINISTIC smooth source: lavfi `gradients` ignores | ||
| 19179 | + // its seed and gives a different picture every run (a | ||
| 19180 | + // whole round was spent on a "flake" that was really this), | ||
| 19181 | + // so the smoothness comes from long-period sinusoids | ||
| 19182 | + // through `geq` instead -- same effect on the encoder's | ||
| 19183 | + // partition choice, byte-identical across runs. | ||
| 19184 | + &format!( | ||
| 19185 | + "nullsrc=size={width}x{height}:rate=25,format=yuv420p, geq=lum='128+90*sin((X+2*N)/37)+30*sin(Y/29)': cb='128+30*sin(X/23)':cr='128+30*sin((Y+N)/19)'" | ||
| 19186 | + ), | ||
| 19187 | + "-pix_fmt", pix, "-strict", "-1", "-t", "0.2", | ||
| 19188 | + "-f", "yuv4mpegpipe", "-", | ||
| 19189 | + ]) | ||
| 19190 | + .stdin(Stdio::null()) | ||
| 19191 | + .stdout(Stdio::piped()) | ||
| 19192 | + .stderr(Stdio::piped()) | ||
| 19193 | + .output() | ||
| 19194 | + .expect("ffmpeg failed to run"); | ||
| 19195 | + assert!( | ||
| 19196 | + y4m.status.success(), | ||
| 19197 | + "{NAME}: ffmpeg fixture: {}", | ||
| 19198 | + String::from_utf8_lossy(&y4m.stderr) | ||
| 19199 | + ); | ||
| 19200 | + let mut args: Vec<&str> = vec![ | ||
| 19201 | + "--codec=av1", "--passes=1", "--end-usage=q", cq, | ||
| 19202 | + "--cpu-used=0", "--threads=1", "--row-mt=0", | ||
| 19203 | + "--sb-size=128", "--min-partition-size=64", | ||
| 19204 | + "--enable-rect-partitions=1", "--enable-ab-partitions=0", | ||
| 19205 | + "--enable-1to4-partitions=0", "--enable-palette=0", | ||
| 19206 | + "--enable-intrabc=0", "--deltaq-mode=0", "--limit=5", | ||
| 19207 | + // EVERY frame a key frame: this gate exists for the INTRA | ||
| 19208 | + // 128x64/64x128 block, and a mixed stream lands on other | ||
| 19209 | + // lanes' inter gaps (sub-8 leaves, rect inter residual) | ||
| 19210 | + // before it ever gets there. The inter twin of this same | ||
| 19211 | + // 128-root arm has its own gate | ||
| 19212 | + // (`..._sb128_gathered_edge_horz_partition_decodes_pixel_exact`). | ||
| 19213 | + "--kf-max-dist=1", | ||
| 19214 | + ]; | ||
| 19215 | + // AOMENC FLAG PRECEDENCE: the LAST occurrence wins, so this | ||
| 19216 | + // per-arm override goes after the base recipe. | ||
| 19217 | + args.push(if tx_search { | ||
| 19218 | + "--enable-tx-size-search=1" | ||
| 19219 | + } else { | ||
| 19220 | + "--enable-tx-size-search=0" | ||
| 19221 | + }); | ||
| 19222 | + if ten_bit { | ||
| 19223 | + args.extend_from_slice(&["--input-bit-depth=10", "--bit-depth=10"]); | ||
| 19224 | + } | ||
| 19225 | + args.extend_from_slice(&["--obu", "-o", "-", "-"]); | ||
| 19226 | + let mut child = Command::new(aomenc_path()) | ||
| 19227 | + .args(&args) | ||
| 19228 | + .stdin(Stdio::piped()) | ||
| 19229 | + .stdout(Stdio::piped()) | ||
| 19230 | + .stderr(Stdio::piped()) | ||
| 19231 | + .spawn() | ||
| 19232 | + .expect("aomenc failed to start"); | ||
| 19233 | + child | ||
| 19234 | + .stdin | ||
| 19235 | + .take() | ||
| 19236 | + .expect("aomenc stdin") | ||
| 19237 | + .write_all(&y4m.stdout) | ||
| 19238 | + .expect("writing y4m to aomenc"); | ||
| 19239 | + let out = child.wait_with_output().expect("aomenc failed to run"); | ||
| 19240 | + assert!( | ||
| 19241 | + out.status.success(), | ||
| 19242 | + "{NAME}: aomenc refused the fixture: {}", | ||
| 19243 | + String::from_utf8_lossy(&out.stderr) | ||
| 19244 | + ); | ||
| 19245 | + let stream = out.stdout; | ||
| 19246 | + let before = intra_sb128_counters(); | ||
| 19247 | + if let Err(e) = decode_stream(&stream) { | ||
| 19248 | + let msg = e.to_string(); | ||
| 19249 | + assert!( | ||
| 19250 | + msg.contains("unsupported"), | ||
| 19251 | + "{NAME} failed outright, not a named refusal \ | ||
| 19252 | + (arm {tag} {width}x{height}): {msg}" | ||
| 19253 | + ); | ||
| 19254 | + named_refusals += 1; | ||
| 19255 | + eprintln!("{NAME}: arm {tag} {width}x{height} refusal: {msg}"); | ||
| 19256 | + continue; | ||
| 19257 | + } | ||
| 19258 | + let (frames, hidden) = decode_all_frames_vs_oracle( | ||
| 19259 | + &stream, | ||
| 19260 | + &format!("sb128c-intra-{tag}-{width}x{height}"), | ||
| 19261 | + ); | ||
| 19262 | + assert!(frames > 0, "{NAME}: no frames decoded at {width}x{height}"); | ||
| 19263 | + let after = intra_sb128_counters(); | ||
| 19264 | + let (horz, vert_hits) = (after.0 - before.0, after.1 - before.1); | ||
| 19265 | + let depth: Vec<usize> = | ||
| 19266 | + (0..3).map(|i| after.2[i] - before.2[i]).collect(); | ||
| 19267 | + eprintln!( | ||
| 19268 | + "{NAME}: arm {tag} cq {cq} {width}x{height} {}bit {} txsearch={}: \ | ||
| 19269 | + {frames} frames pixel-exact ({hidden} hidden), \ | ||
| 19270 | + intra_128x64 +{horz} intra_64x128 +{vert_hits} \ | ||
| 19271 | + depth[64/32/16] {depth:?}", | ||
| 19272 | + if ten_bit { 10 } else { 8 }, | ||
| 19273 | + if vert { "VERT" } else { "HORZ" }, | ||
| 19274 | + u8::from(tx_search), | ||
| 19275 | + ); | ||
| 19276 | + if horz == 0 && vert_hits == 0 { | ||
| 19277 | + out_of_scope += 1; | ||
| 19278 | + } | ||
| 19279 | + if horz > 0 { | ||
| 19280 | + horz_arms += 1; | ||
| 19281 | + } | ||
| 19282 | + if vert_hits > 0 { | ||
| 19283 | + vert_arms += 1; | ||
| 19284 | + } | ||
| 19285 | + for i in 0..3 { | ||
| 19286 | + depth_seen[i] += depth[i]; | ||
| 19287 | + } | ||
| 19288 | + matched += 1; | ||
| 19289 | + } | ||
| 19290 | + assert!( | ||
| 19291 | + matched > 0, | ||
| 19292 | + "{NAME}: every attempt refused ({named_refusals}); the gate never \ | ||
| 19293 | + decoded a stream" | ||
| 19294 | + ); | ||
| 19295 | + assert!( | ||
| 19296 | + horz_arms > 0, | ||
| 19297 | + "{NAME}: {matched} stream(s) decoded pixel-exact ({out_of_scope} carried \ | ||
| 19298 | + no 128-root rect intra block at all) but NOT ONE key-frame 128x64 \ | ||
| 19299 | + block fired -- the shape this gate exists for" | ||
| 19300 | + ); | ||
| 19301 | + assert!( | ||
| 19302 | + vert_arms > 0, | ||
| 19303 | + "{NAME}: the VERT twin never produced a key-frame 64x128 block" | ||
| 19304 | + ); | ||
| 19305 | + assert!( | ||
| 19306 | + depth_seen[0] > 0, | ||
| 19307 | + "{NAME}: no depth-0 (TX_64X64) intra 128-rect block: {depth_seen:?}" | ||
| 19308 | + ); | ||
| 19309 | + } | ||
| 19310 | + | ||
| 19134 | #[test] | 19311 | #[test] |
| 19135 | #[ignore = "lane-sb128 r2 diagnostic: is the frame-6 mismatch sb128-specific?"] | 19312 | #[ignore = "lane-sb128 r2 diagnostic: is the frame-6 mismatch sb128-specific?"] |
| 19136 | fn sb128_r2_control_sb64() { | 19313 | fn sb128_r2_control_sb64() { |
lanes/sb128c-r8.report.mdadded+114 -0
| @@ -0,0 +1,114 @@ | |||
| 1 | +# lane-sb128c r8 -- the INTRA (key-frame) 128x64 / 64x128 block | ||
| 2 | + | ||
| 3 | +Branch `lane-sb128c`, worktree `edith_codecs-sb128c`, | ||
| 4 | +`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sb128c`. | ||
| 5 | + | ||
| 6 | +## What changed | ||
| 7 | + | ||
| 8 | +- `crates/ec-av1/src/decode.rs:10101` `decode_block_128rect` (NEW): a rect | ||
| 9 | + intra block at the 128 root. libaom `decode_block` -> | ||
| 10 | + `predict_and_reconstruct_intra_block` per transform unit, with the 128 | ||
| 11 | + geometry: `max_txsize_rect_lookup[BLOCK_128X64] == TX_64X64` so every luma | ||
| 12 | + unit is SQUARE and there are >= two (depth 0: 64x64 x2, 1: 32x32 x8, | ||
| 13 | + 2: 16x16 x32 -- `bsize_to_tx_size_cat` counts the `sub_tx_size_map` chain | ||
| 14 | + TX_64X64->32->16->8->4, i.e. cat 3, the CDF a 64x64 square block reads); | ||
| 15 | + `av1_get_max_uv_txsize` = `av1_get_adjusted_tx_size( | ||
| 16 | + max_txsize_rect_lookup[BLOCK_64X32])` caps at TX_32X32, so the 64x32 uv | ||
| 17 | + plane block is TWO 32x32 chroma units per plane, one per 64x64 "mu" chunk, | ||
| 18 | + Y then U then V inside each chunk (`decode_token_recon_block`); | ||
| 19 | + `get_txb_ctx` puts chroma on the offset-10 rows (uv plane block > uv tx). | ||
| 20 | + Mode info goes through `read_intra_mode_rect` with `cfl = false` | ||
| 21 | + (`is_cfl_allowed` caps at 32x32); filter intra and palette do not exist at | ||
| 22 | + this size (`av1_filter_intra_allowed_bsize` 32x32, | ||
| 23 | + `palette_bsize_ctx_wh` returns `None` above 64) and are refused by name if | ||
| 24 | + one ever appears. Per-TU edge availability through `tu_reach` | ||
| 25 | + (`has_top_right` false for a block whose long side is > 64, via | ||
| 26 | + `Reach::of_rect`); lf/skip grids stamped with the resolved unit size. | ||
| 27 | +- `crates/ec-av1/src/decode.rs:14027` key-frame path: the 128 root's | ||
| 28 | + HORZ/VERT arm is no longer refused. It decodes `BLOCK_128X64` at | ||
| 29 | + (mi_row, mi_col) plus a second at (mi_row + 16, mi_col) only | ||
| 30 | + `if (mi_row + hbs < mi_rows)` (VERT mirrors it on the column, libaom | ||
| 31 | + `decode_partition` decodeframe.c:1554), each half reading its OWN | ||
| 32 | + `cdef_idx` literal, fanned out over the 64x64 CDEF units it covers. | ||
| 33 | +- `crates/ec-av1/src/decode.rs:9346` / `:9247` `PlaneBuf::reconstruct` + | ||
| 34 | + `reconstruct_rect`: bottom/right frame-edge CLIP. ROOT CAUSE of two | ||
| 35 | + `index out of bounds` panics on the 1080p film's key frames (len 1536000, | ||
| 36 | + index 1536000/1536384): our frame buffer is padded to 32 (`block_grid`) | ||
| 37 | + while libaom's is superblock aligned, so a 64x64 unit of a 128x64 block at | ||
| 38 | + y=768 of a 792-row frame wants 832 rows of an 800-row buffer. Those samples | ||
| 39 | + are outside the frame -- never output, never referenced. | ||
| 40 | +- `crates/ec-av1/src/stream.rs:95` `intra_sb128_counters()`, | ||
| 41 | + `crates/ec-av1/src/decode.rs:10101` `INTRA_SB128_{HORZ,VERT,DEPTH}_HITS`. | ||
| 42 | +- `crates/ec-av1/src/refusal_inventory.rs:48`: the intra-128x64 refusal is | ||
| 43 | + REPLACED by the defensive CfL/filter-intra/palette one. | ||
| 44 | + | ||
| 45 | +## Gate (GREEN) | ||
| 46 | + | ||
| 47 | +`cargo test -p ec-av1 --lib intra_rect_block -- --nocapture` | ||
| 48 | +(`a_real_aomenc_sb128_intra_rect_block_decodes_pixel_exact`): 5 real aomenc | ||
| 49 | +streams, `--sb-size=128 --cpu-used=0 --min-partition-size=64 | ||
| 50 | +--enable-rect-partitions=1 --kf-max-dist=1`, every decode-order frame compared | ||
| 51 | +against the instrumented aomdec, hard asserts on the HORZ counter, the VERT | ||
| 52 | +counter and depth[0]. | ||
| 53 | + | ||
| 54 | + arm 42 cq55 384x320 8bit HORZ txsearch=0: 5 frames exact, 128x64 +28 depth [28,0,0] | ||
| 55 | + arm 43 cq32 384x320 10bit HORZ txsearch=1: 5 frames exact, 128x64 +30 depth [30,0,0] | ||
| 56 | + arm 44 cq8 256x192 8bit HORZ txsearch=1: 5 frames exact, 128x64 +14 depth [14,0,0] | ||
| 57 | + arm 46 cq55 192x256 8bit VERT txsearch=0: 5 frames exact, 64x128 +10 depth [10,0,0] | ||
| 58 | + arm 45 cq45 192x256 10bit VERT txsearch=1: 5 frames exact, 64x128 +10 depth [10,0,0] | ||
| 59 | + test result: ok. 1 passed; 0 failed | ||
| 60 | + | ||
| 61 | +Sources are `geq` long-period sinusoids, NOT lavfi `gradients`: gradients | ||
| 62 | +ignores its seed and gave a different picture every run (one arm passed and | ||
| 63 | +then failed with an unchanged decoder -- the flake was the fixture). | ||
| 64 | + | ||
| 65 | +EVIDENCE: $HOME/.cache/sb128c-gate-r8.log | cargo test -p ec-av1 --lib intra_rect_block --nocapture | 5/5 arms 5 frames each pixel-exact vs aomdec, 96 intra 128-rect blocks, 0 out of scope | ||
| 66 | + | ||
| 67 | +Sibling gate re-run GREEN (COMMON's SIBLING GATES rule): | ||
| 68 | +`gathered_edge_horz` 4/4 arms pixel-exact, edge +2/+24/+2/+2. | ||
| 69 | + | ||
| 70 | +## Film (1080p 10-bit AV1, 4 extracts) | ||
| 71 | + | ||
| 72 | +| extract | r7 | r8 | edge_horz | inter_128x64 | | ||
| 73 | +|---|---|---|---|---| | ||
| 74 | +| 2 s head (1920x792) | OK 48/48 | **OK, 49/49 dumps bit-exact vs aomdec** | 720 | 720 | | ||
| 75 | +| `~/.cache/reelc-head.obu` | OK 48/48 | OK, decodes to completion | 720 | 720 | | ||
| 76 | +| `-ss 8100` 2 s | stopped: split intra strip TU 32x64 | PANICKED with the arm live, now stops at "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding" | 1 | 0 | | ||
| 77 | +| `-ss 9000` 2 s | stopped: non-skip rect strip | now stops DEEPER, at "an inter SB-level AB partition" | 12 | 0 | | ||
| 78 | + | ||
| 79 | +EVIDENCE: $HOME/.cache/sb128c-r8/d2 vs $HOME/.cache/sb128c-r7/o2 | EC_AV1_FINAL_DUMP decode_probe head2s.obu, cmp per frame | dumps_compared=49 frames_differing=0 | ||
| 80 | + | ||
| 81 | +The two panics the r8 arm exposed on the film are the frame-edge clip above; | ||
| 82 | +without it this round would have shipped a crash on his own film. | ||
| 83 | + | ||
| 84 | +## AB shapes at the 128 root -- MEASURED, still refused | ||
| 85 | + | ||
| 86 | +16-attempt sweep (512x512 and 384x320 geq sinusoids x cq 18/32/45/55 x 8+10 | ||
| 87 | +bit, `--sb-size=128 --min-partition-size=64 --enable-ab-partitions=1`, | ||
| 88 | +`$HOME/.cache/sb128c-r8/ab.sh`): **aomenc DOES pick them** -- 2 of 16 attempts | ||
| 89 | +refuse with "a 128x128 superblock AB partition" (512x512 cq18 and cq45, | ||
| 90 | +8-bit), and one more with the inter SB-level AB refusal. So the r7 residue | ||
| 91 | +"whether aomenc ever picks them is unmeasured" is now answered YES; they | ||
| 92 | +cannot be closed by measurement and need the implementation. | ||
| 93 | + | ||
| 94 | +## Suite | ||
| 95 | + | ||
| 96 | +`cargo test -p ec-av1 --lib` under a systemd unit (MemoryMax=10G), | ||
| 97 | +log `$HOME/.cache/sb128c-suite-r8.log` -- see the round's closing note. | ||
| 98 | + | ||
| 99 | +## Residue | ||
| 100 | + | ||
| 101 | +- deferred: the four AB shapes at the 128 root (key and inter) -- MEASURED to | ||
| 102 | + be reachable (above). Unblocked by this round's `decode_block_128rect` (the | ||
| 103 | + 128x64/64x128 piece each AB shape needs) plus the libaom visit order in | ||
| 104 | + `lanes/sb128c-r6.handoff.md`; the sweep script pins the recipe that | ||
| 105 | + produces one. | ||
| 106 | +- deferred: intra `tx_depth` > 0 at the 128 root (32x32 / 16x16 units) is | ||
| 107 | + implemented but UNEXERCISED -- every arm, including cq 8 with | ||
| 108 | + `--enable-tx-size-search=1`, resolved depth 0. Unblocked by finding an | ||
| 109 | + encoder setting that splits a 128x64's transform; the gate prints the | ||
| 110 | + per-depth counters so the round that finds one sees it immediately. | ||
| 111 | +- accepted: an inter frame of the 192x256 smooth source mismatches at frame 1 | ||
| 112 | + (`$HOME/.cache/sb128c-r8/vert46.obu`, byte 12033, 36073 bytes differ). It is | ||
| 113 | + NOT this lane's shape: the key frames of that same stream are exact, and the | ||
| 114 | + r7 inter gate is green on its own source. Left pinned for a hunter. | ||