Merge branch 'lane-sb128c' (103b66f): the 128 partition root's intra rect arm and per-mu-chunk contexts
Browse files at this commit4 changed files +692 -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 +115 -0
crates/ec-av1/src/decode.rsmodified+399 -8
| @@ -9988,7 +9988,16 @@ impl PlaneBuf { | |||
| 9988 | ); | 9988 | ); |
| 9989 | } | 9989 | } |
| 9990 | for row in 0..bh { | 9990 | for row in 0..bh { |
| 9991 | + // Same bottom/right frame-edge clip as [`Self::reconstruct`]'s | ||
| 9992 | + // (lane-sb128c r8) -- a 64x128 block at the right edge of a frame | ||
| 9993 | + // whose padded width is not superblock aligned hangs past it. | ||
| 9994 | + if y + row >= self.height { | ||
| 9995 | + break; | ||
| 9996 | + } | ||
| 9991 | for col in 0..bw { | 9997 | for col in 0..bw { |
| 9998 | + if x + col >= self.width { | ||
| 9999 | + break; | ||
| 10000 | + } | ||
| 9992 | let idx = row * bw + col; | 10001 | let idx = row * bw + col; |
| 9993 | let mut base = i32::from(prediction[idx]); | 10002 | let mut base = i32::from(prediction[idx]); |
| 9994 | if let Some((alpha_q3, ac_q3)) = cfl { | 10003 | if let Some((alpha_q3, ac_q3)) = cfl { |
| @@ -10081,7 +10090,21 @@ impl PlaneBuf { | |||
| 10081 | ); | 10090 | ); |
| 10082 | } | 10091 | } |
| 10083 | for row in 0..side { | 10092 | for row in 0..side { |
| 10093 | + // lane-sb128c r8: libaom's frame buffer is superblock | ||
| 10094 | + // aligned; ours is padded to 32 (`block_grid`), so a 64x64 | ||
| 10095 | + // transform unit of a 128x64 block at the BOTTOM frame edge | ||
| 10096 | + // can hang past the last padded row (1920x792: a unit at | ||
| 10097 | + // y=768 wants 832 rows of an 800-row buffer, which panicked | ||
| 10098 | + // the film's key frames). Those samples are outside the | ||
| 10099 | + // frame: never output, and no block below ever references | ||
| 10100 | + // them. | ||
| 10101 | + if y + row >= self.height { | ||
| 10102 | + break; | ||
| 10103 | + } | ||
| 10084 | for col in 0..side { | 10104 | for col in 0..side { |
| 10105 | + if x + col >= self.width { | ||
| 10106 | + break; | ||
| 10107 | + } | ||
| 10085 | let idx = row * side + col; | 10108 | let idx = row * side + col; |
| 10086 | let mut base = i32::from(prediction[idx]); | 10109 | let mut base = i32::from(prediction[idx]); |
| 10087 | if let Some((alpha_q3, ac_q3)) = cfl { | 10110 | if let Some((alpha_q3, ac_q3)) = cfl { |
| @@ -10859,6 +10882,307 @@ fn decode_block( | |||
| 10859 | Ok(()) | 10882 | Ok(()) |
| 10860 | } | 10883 | } |
| 10861 | 10884 | ||
| 10885 | +thread_local! { | ||
| 10886 | + /// lane-sb128c r8: INTRA (key-frame) 128x64 blocks decoded at the 128 | ||
| 10887 | + /// root's HORZ arm, and 64x128 ones at its VERT arm. | ||
| 10888 | + pub(crate) static INTRA_SB128_HORZ_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 10889 | + pub(crate) static INTRA_SB128_VERT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 10890 | + /// Those blocks by resolved intra `tx_depth` (0 = TX_64X64 units, | ||
| 10891 | + /// 1 = TX_32X32, 2 = TX_16X16) -- proof the depth symbol is really read. | ||
| 10892 | + pub(crate) static INTRA_SB128_DEPTH_HITS: std::cell::Cell<[usize; 3]> = const { std::cell::Cell::new([0; 3]) }; | ||
| 10893 | +} | ||
| 10894 | + | ||
| 10895 | +/// [`INTRA_SB128_HORZ_HITS`] / [`INTRA_SB128_VERT_HITS`] / | ||
| 10896 | +/// [`INTRA_SB128_DEPTH_HITS`], for a gate's own before/after delta. | ||
| 10897 | +pub(crate) fn intra_sb128_hits() -> (usize, usize, [usize; 3]) { | ||
| 10898 | + ( | ||
| 10899 | + INTRA_SB128_HORZ_HITS.with(std::cell::Cell::get), | ||
| 10900 | + INTRA_SB128_VERT_HITS.with(std::cell::Cell::get), | ||
| 10901 | + INTRA_SB128_DEPTH_HITS.with(std::cell::Cell::get), | ||
| 10902 | + ) | ||
| 10903 | +} | ||
| 10904 | + | ||
| 10905 | +/// The 128 root's HORZ/VERT arm on an INTRA frame: ONE 128x64 (HORZ) or | ||
| 10906 | +/// 64x128 (VERT) intra block (lane-sb128c r8; the inter twin is | ||
| 10907 | +/// `decode_inter_block`'s own rect path). | ||
| 10908 | +/// | ||
| 10909 | +/// libaom `decode_block` -> `predict_and_reconstruct_intra_block` per | ||
| 10910 | +/// transform unit, with the 128-specific geometry: | ||
| 10911 | +/// * `max_txsize_rect_lookup[BLOCK_128X64]` is TX_64X64, so every luma unit | ||
| 10912 | +/// is SQUARE and there are at least two of them -- depth 0: 64x64 x2, | ||
| 10913 | +/// depth 1: 32x32 x8, depth 2: 16x16 x32 (`bsize_to_tx_size_cat` counts | ||
| 10914 | +/// the `sub_tx_size_map` chain TX_64X64->32->16->8->4, i.e. cat 3, the | ||
| 10915 | +/// same CDF a 64x64 square block reads). | ||
| 10916 | +/// * `av1_get_max_uv_txsize` = `av1_get_adjusted_tx_size( | ||
| 10917 | +/// max_txsize_rect_lookup[BLOCK_64X32])` caps at TX_32X32, so the block's | ||
| 10918 | +/// 64x32 uv plane block is TWO 32x32 chroma units per plane -- one per | ||
| 10919 | +/// 64x64 luma "mu" chunk, and `decode_token_recon_block` codes Y, U, V of | ||
| 10920 | +/// a chunk before moving to the next (the interleave lane-sb128b r3 | ||
| 10921 | +/// measured at the 128x128 NONE root). | ||
| 10922 | +/// * `get_txb_ctx`: the uv plane block is bigger than the uv transform, so | ||
| 10923 | +/// chroma `txb_skip_ctx` takes the offset-10 rows (7 + 3). | ||
| 10924 | +/// No CfL, no filter intra (both cap at 32x32) and no palette | ||
| 10925 | +/// (`av1_allow_palette` caps at 64x64) exist at this size -- the mode | ||
| 10926 | +/// reader's own size gates already say so, and the guard below is defensive. | ||
| 10927 | +#[allow(clippy::too_many_arguments)] | ||
| 10928 | +fn decode_block_128rect( | ||
| 10929 | + dec: &mut SymbolDecoder, | ||
| 10930 | + cdfs: &mut Cdfs, | ||
| 10931 | + neighbours: &mut Neighbours, | ||
| 10932 | + at: (usize, usize), | ||
| 10933 | + bw: usize, | ||
| 10934 | + bh: usize, | ||
| 10935 | + y: &mut PlaneBuf, | ||
| 10936 | + u: &mut PlaneBuf, | ||
| 10937 | + v: &mut PlaneBuf, | ||
| 10938 | + base_q_idx: u8, | ||
| 10939 | + enable_filter_intra: bool, | ||
| 10940 | + allow_screen_content_tools: bool, | ||
| 10941 | + tx_select: bool, | ||
| 10942 | + reduced_tx_set: bool, | ||
| 10943 | +) -> Result<()> { | ||
| 10944 | + let (r, c) = at; | ||
| 10945 | + let (px, py) = (c * SUB, r * SUB); | ||
| 10946 | + let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI)); | ||
| 10947 | + let (nb_above_mode, nb_left_mode) = neighbours.modes_above_left(r, c); | ||
| 10948 | + let (palette_ctx, palette_cache) = neighbours.palette_ctx_and_cache(at); | ||
| 10949 | + let palette_uv_cache = neighbours.palette_uv_cache(at); | ||
| 10950 | + let (skip, mode, angle_delta_y, uv_mode, angle_delta_uv, alpha, filter_intra, palette_y, palette_uv) = | ||
| 10951 | + read_intra_mode_rect( | ||
| 10952 | + dec, | ||
| 10953 | + cdfs, | ||
| 10954 | + nb_above_mode, | ||
| 10955 | + nb_left_mode, | ||
| 10956 | + // `is_cfl_allowed` caps CFL at 32x32: `uv_mode` comes off the | ||
| 10957 | + // 13-symbol no-CFL CDF here, never the 14-symbol one. | ||
| 10958 | + false, | ||
| 10959 | + true, | ||
| 10960 | + bw, | ||
| 10961 | + bh, | ||
| 10962 | + enable_filter_intra, | ||
| 10963 | + neighbours.skip_txfm_ctx(mi_r, mi_c), | ||
| 10964 | + allow_screen_content_tools, | ||
| 10965 | + Some((palette_ctx, &palette_cache)), | ||
| 10966 | + &palette_uv_cache, | ||
| 10967 | + mi_r, | ||
| 10968 | + mi_c, | ||
| 10969 | + )?; | ||
| 10970 | + if alpha.is_some() || filter_intra.is_some() || palette_y.is_some() || palette_uv.is_some() { | ||
| 10971 | + return Err(unsupported( | ||
| 10972 | + "CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (every one of \ | ||
| 10973 | + their size gates caps at 64x64 or below, so none of these symbols exists there)", | ||
| 10974 | + )); | ||
| 10975 | + } | ||
| 10976 | + let uv_predict_mode = if uv_mode == UV_CFL_PRED { DC_PRED } else { uv_mode }; | ||
| 10977 | + let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode); | ||
| 10978 | + if smooth_neighbor { | ||
| 10979 | + SMOOTH_LUMA_HITS.with(|c| c.set(c.get() + 1)); | ||
| 10980 | + } | ||
| 10981 | + let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c); | ||
| 10982 | + // spec 5.11.16 `read_tx_size`: read for every intra block, skipped or | ||
| 10983 | + // not. `bsize_to_tx_size_cat(BLOCK_128X64)` is 3 (see this fn's doc). | ||
| 10984 | + let depth = if tx_select { | ||
| 10985 | + let ctx = tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh); | ||
| 10986 | + dec.symbol(&mut cdfs.tx_size_cat3[ctx]) | ||
| 10987 | + } else { | ||
| 10988 | + 0 | ||
| 10989 | + }; | ||
| 10990 | + if depth != 0 { | ||
| 10991 | + TX_DEPTH_HITS.with(|c| c.set(c.get() + 1)); | ||
| 10992 | + } | ||
| 10993 | + INTRA_SB128_DEPTH_HITS.with(|c| { | ||
| 10994 | + let mut h = c.get(); | ||
| 10995 | + h[depth.min(2)] += 1; | ||
| 10996 | + c.set(h); | ||
| 10997 | + }); | ||
| 10998 | + let logical_tx = 64 >> depth; | ||
| 10999 | + // A 64-point transform codes nothing past its low 32 coefficients. | ||
| 11000 | + let coeff_tx_side = logical_tx.min(32); | ||
| 11001 | + let luma_set = txbset_for(logical_tx, reduced_tx_set); | ||
| 11002 | + let luma_scan = default_scan(coeff_tx_side); | ||
| 11003 | + let chroma_tx = 32; | ||
| 11004 | + let chroma_scan = default_scan(chroma_tx); | ||
| 11005 | + let (cpx, cpy) = (px / 2, py / 2); | ||
| 11006 | + let (chroma_w, chroma_h) = (bw / 2, bh / 2); | ||
| 11007 | + let reach = Reach::of_rect(bw, bh, px, py, y.width, y.height); | ||
| 11008 | + let (nch_x, nch_y) = (bw / 64, bh / 64); | ||
| 11009 | + // One 32x32 chroma unit per mu chunk, per plane. | ||
| 11010 | + debug_assert_eq!((chroma_w / chroma_tx, chroma_h / chroma_tx), (nch_x, nch_y)); | ||
| 11011 | + let tpc = 64 / logical_tx; | ||
| 11012 | + let zero_tu = vec![0i32; logical_tx * logical_tx]; | ||
| 11013 | + let zero_cu = vec![0i32; chroma_tx * chroma_tx]; | ||
| 11014 | + let mut last_grids = [Vec::new(), Vec::new()]; | ||
| 11015 | + let mut units: Vec<((usize, usize), Vec<i32>, Vec<i32>)> = Vec::new(); | ||
| 11016 | + for ch_row in 0..nch_y { | ||
| 11017 | + for ch_col in 0..nch_x { | ||
| 11018 | + for tu_row in ch_row * tpc..(ch_row + 1) * tpc { | ||
| 11019 | + for tu_col in ch_col * tpc..(ch_col + 1) * tpc { | ||
| 11020 | + let tu_mi = ( | ||
| 11021 | + mi_r + tu_row * (logical_tx / MI), | ||
| 11022 | + mi_c + tu_col * (logical_tx / MI), | ||
| 11023 | + ); | ||
| 11024 | + let (tu_px, tu_py) = (px + tu_col * logical_tx, py + tu_row * logical_tx); | ||
| 11025 | + // libaom clips the transform loop to | ||
| 11026 | + // `max_blocks_wide/high`: a unit whose top-left sample is | ||
| 11027 | + // outside the frame is never coded. | ||
| 11028 | + if tu_px >= y.true_width || tu_py >= y.true_height { | ||
| 11029 | + continue; | ||
| 11030 | + } | ||
| 11031 | + // Edge availability of a unit INSIDE a block, with the | ||
| 11032 | + // 128 geometry -- `has_top_right` is false for a block | ||
| 11033 | + // whose largest side is > 64, which [`Reach::of_rect`] | ||
| 11034 | + // already answered for the block and [`tu_reach`] carries | ||
| 11035 | + // down to the units on its own top row. | ||
| 11036 | + let tu_r = tu_reach( | ||
| 11037 | + bw, | ||
| 11038 | + bh, | ||
| 11039 | + tu_col * logical_tx, | ||
| 11040 | + tu_row * logical_tx, | ||
| 11041 | + logical_tx, | ||
| 11042 | + reach, | ||
| 11043 | + px, | ||
| 11044 | + py, | ||
| 11045 | + y.width, | ||
| 11046 | + y.height, | ||
| 11047 | + ); | ||
| 11048 | + if skip { | ||
| 11049 | + y.reconstruct( | ||
| 11050 | + tu_px, tu_py, logical_tx, mode, angle_delta_y, tu_r, &zero_tu, None, | ||
| 11051 | + None, smooth_neighbor, | ||
| 11052 | + ); | ||
| 11053 | + neighbours.record_mi_luma(tu_mi, logical_tx, &zero_tu); | ||
| 11054 | + continue; | ||
| 11055 | + } | ||
| 11056 | + // The unit is smaller than its block, so `txb_skip_ctx` | ||
| 11057 | + // is the neighbour-magnitude table, never the lone-TU 0. | ||
| 11058 | + let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, logical_tx / MI); | ||
| 11059 | + let tu_around = neighbours.around_mi(tu_mi, logical_tx)[0]; | ||
| 11060 | + let tu_grid = read_plane( | ||
| 11061 | + dec, | ||
| 11062 | + cdfs, | ||
| 11063 | + luma_set, | ||
| 11064 | + &luma_scan, | ||
| 11065 | + 0, | ||
| 11066 | + tu_around, | ||
| 11067 | + mode, | ||
| 11068 | + mode, | ||
| 11069 | + angle_delta_y, | ||
| 11070 | + tu_r, | ||
| 11071 | + y, | ||
| 11072 | + tu_px, | ||
| 11073 | + tu_py, | ||
| 11074 | + logical_tx, | ||
| 11075 | + coeff_tx_side, | ||
| 11076 | + base_q_idx, | ||
| 11077 | + None, | ||
| 11078 | + None, | ||
| 11079 | + Some(tu_skip_ctx), | ||
| 11080 | + smooth_neighbor, | ||
| 11081 | + )?; | ||
| 11082 | + neighbours.record_mi_luma(tu_mi, logical_tx, &tu_grid); | ||
| 11083 | + } | ||
| 11084 | + } | ||
| 11085 | + // The chroma context arrays are indexed in LUMA mi, so this | ||
| 11086 | + // unit's anchor is its own 64x64 mu chunk. | ||
| 11087 | + let luma_span = chroma_tx * 2; | ||
| 11088 | + let cu_mi = ( | ||
| 11089 | + mi_r + ch_row * (luma_span / MI), | ||
| 11090 | + mi_c + ch_col * (luma_span / MI), | ||
| 11091 | + ); | ||
| 11092 | + let cu_r = tu_reach( | ||
| 11093 | + bw, | ||
| 11094 | + bh, | ||
| 11095 | + ch_col * luma_span, | ||
| 11096 | + ch_row * luma_span, | ||
| 11097 | + luma_span, | ||
| 11098 | + reach, | ||
| 11099 | + px, | ||
| 11100 | + py, | ||
| 11101 | + y.width, | ||
| 11102 | + y.height, | ||
| 11103 | + ); | ||
| 11104 | + let (cu_x, cu_y) = (cpx + ch_col * chroma_tx, cpy + ch_row * chroma_tx); | ||
| 11105 | + if skip { | ||
| 11106 | + u.reconstruct( | ||
| 11107 | + cu_x, cu_y, chroma_tx, uv_predict_mode, angle_delta_uv, cu_r, &zero_cu, None, | ||
| 11108 | + None, smooth_neighbor_uv, | ||
| 11109 | + ); | ||
| 11110 | + v.reconstruct( | ||
| 11111 | + cu_x, cu_y, chroma_tx, uv_predict_mode, angle_delta_uv, cu_r, &zero_cu, None, | ||
| 11112 | + None, smooth_neighbor_uv, | ||
| 11113 | + ); | ||
| 11114 | + continue; | ||
| 11115 | + } | ||
| 11116 | + let cu_around = neighbours.around_mi(cu_mi, luma_span); | ||
| 11117 | + let u_grid = read_plane( | ||
| 11118 | + dec, cdfs, TxbSet::Chroma32, &chroma_scan, 1, cu_around[1], mode, uv_predict_mode, | ||
| 11119 | + angle_delta_uv, cu_r, u, cu_x, cu_y, chroma_tx, chroma_tx, base_q_idx, None, None, | ||
| 11120 | + Some(3), smooth_neighbor_uv, | ||
| 11121 | + )?; | ||
| 11122 | + let v_grid = read_plane( | ||
| 11123 | + dec, cdfs, TxbSet::Chroma32, &chroma_scan, 2, cu_around[2], mode, uv_predict_mode, | ||
| 11124 | + angle_delta_uv, cu_r, v, cu_x, cu_y, chroma_tx, chroma_tx, base_q_idx, None, None, | ||
| 11125 | + Some(3), smooth_neighbor_uv, | ||
| 11126 | + )?; | ||
| 11127 | + CHROMA_SPLIT_TX_HITS.with(|c| c.set(c.get() + 1)); | ||
| 11128 | + // Immediately, so the NEXT unit of this same block reads this | ||
| 11129 | + // one's coefficient context; replayed after `record_split_luma_rect` | ||
| 11130 | + // below, which would otherwise clobber them whole-block. | ||
| 11131 | + neighbours.record_mi_chroma(cu_mi, luma_span, luma_span, 1, &u_grid); | ||
| 11132 | + neighbours.record_mi_chroma(cu_mi, luma_span, luma_span, 2, &v_grid); | ||
| 11133 | + units.push((cu_mi, u_grid.clone(), v_grid.clone())); | ||
| 11134 | + last_grids = [u_grid, v_grid]; | ||
| 11135 | + } | ||
| 11136 | + } | ||
| 11137 | + if skip { | ||
| 11138 | + neighbours.record_rect( | ||
| 11139 | + at, | ||
| 11140 | + bw, | ||
| 11141 | + bh, | ||
| 11142 | + mode, | ||
| 11143 | + uv_predict_mode, | ||
| 11144 | + &[ | ||
| 11145 | + vec![0i32; bw * bh], | ||
| 11146 | + vec![0i32; chroma_w * chroma_h], | ||
| 11147 | + vec![0i32; chroma_w * chroma_h], | ||
| 11148 | + ], | ||
| 11149 | + ); | ||
| 11150 | + } else { | ||
| 11151 | + neighbours.record_split_luma_rect( | ||
| 11152 | + at, | ||
| 11153 | + bw, | ||
| 11154 | + bh, | ||
| 11155 | + mode, | ||
| 11156 | + uv_predict_mode, | ||
| 11157 | + [&last_grids[0], &last_grids[1]], | ||
| 11158 | + ); | ||
| 11159 | + for (cu_mi, u_grid, v_grid) in &units { | ||
| 11160 | + neighbours.record_mi_chroma(*cu_mi, 64, 64, 1, u_grid); | ||
| 11161 | + neighbours.record_mi_chroma(*cu_mi, 64, 64, 2, v_grid); | ||
| 11162 | + } | ||
| 11163 | + } | ||
| 11164 | + // No palette exists at this size; the unconditional stamp clears any | ||
| 11165 | + // stale neighbour palette state, as every other block path does. | ||
| 11166 | + neighbours.record_palette_y_rect(at, bw, bh, 0, [0u16; 8]); | ||
| 11167 | + neighbours.record_palette_uv_rect(at, bw, bh, 0, [0u16; 8]); | ||
| 11168 | + neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, skip); | ||
| 11169 | + neighbours.fill_lf_grid_rect( | ||
| 11170 | + (mi_r, mi_c), | ||
| 11171 | + bw / MI, | ||
| 11172 | + bh / MI, | ||
| 11173 | + logical_tx as u8, | ||
| 11174 | + logical_tx as u8, | ||
| 11175 | + 0, | ||
| 11176 | + ); | ||
| 11177 | + if bw > bh { | ||
| 11178 | + INTRA_SB128_HORZ_HITS.with(|c| c.set(c.get() + 1)); | ||
| 11179 | + } else { | ||
| 11180 | + INTRA_SB128_VERT_HITS.with(|c| c.set(c.get() + 1)); | ||
| 11181 | + } | ||
| 11182 | + Ok(()) | ||
| 11183 | +} | ||
| 11184 | + | ||
| 11185 | + | ||
| 10862 | /// Decodes one 8x8 leaf of a straddling 16x16 block (lane-av1-rect), mirroring | 11186 | /// Decodes one 8x8 leaf of a straddling 16x16 block (lane-av1-rect), mirroring |
| 10863 | /// [`crate::tile::write_leaf8`]: its intra-mode context comes from the | 11187 | /// [`crate::tile::write_leaf8`]: its intra-mode context comes from the |
| 10864 | /// *enclosing* 16x16 slot's `above_mode`/`left_mode` (`outer_at`, [`SUB`]-grid), | 11188 | /// *enclosing* 16x16 slot's `above_mode`/`left_mode` (`outer_at`, [`SUB`]-grid), |
| @@ -14628,14 +14952,81 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 14628 | mi_rows, | 14952 | mi_rows, |
| 14629 | )?; | 14953 | )?; |
| 14630 | if matches!(part128, PARTITION_HORZ | PARTITION_VERT) { | 14954 | if matches!(part128, PARTITION_HORZ | PARTITION_VERT) { |
| 14631 | - // lane-sb128c r7: the INTER path decodes these (two 128x64 | 14955 | + // lane-sb128c r8: libaom `decode_partition` |
| 14632 | - // / two 64x128 blocks, the film's own bottom-edge shape); | 14956 | + // (decodeframe.c:1554) codes PARTITION_HORZ at the 128 |
| 14633 | - // the key path's `decode_block` is square-only, so an | 14957 | + // root as `subsize = BLOCK_128X64` at (mi_row, mi_col) |
| 14634 | - // intra 128x64 would silently decode as four 64x64 | 14958 | + // plus a second one at (mi_row + hbs, mi_col) only |
| 14635 | - // quadrants. Refuse by name instead of corrupting. | 14959 | + // `if (mi_row + hbs < mi_rows)`; PARTITION_VERT mirrors it |
| 14636 | - return Err(unsupported( | 14960 | + // on the column. `hbs` is `mi_size_high[BLOCK_128X128]/2` |
| 14637 | - "a 128x128 superblock HORZ/VERT partition on an intra frame (the inter path decodes it; the intra one is square-block only)", | 14961 | + // = 16 mi. Both halves together cover the whole root, so |
| 14638 | - )); | 14962 | + // the remaining three 64x64 quadrant visits code nothing |
| 14963 | + // (same flag the NONE arm sets). | ||
| 14964 | + sb128_none = true; | ||
| 14965 | + let horz = part128 == PARTITION_HORZ; | ||
| 14966 | + let at128 = ((sb_r & !1) as usize * 4, (sb_c & !1) as usize * 4); | ||
| 14967 | + let (bw, bh) = if horz { (128usize, 64usize) } else { (64, 128) }; | ||
| 14968 | + for i in 0..2 { | ||
| 14969 | + let at = if horz { | ||
| 14970 | + (at128.0 + i * 4, at128.1) | ||
| 14971 | + } else { | ||
| 14972 | + (at128.0, at128.1 + i * 4) | ||
| 14973 | + }; | ||
| 14974 | + let (blk_mi_r, blk_mi_c) = (at.0 * (SUB / MI), at.1 * (SUB / MI)); | ||
| 14975 | + if i > 0 | ||
| 14976 | + && (blk_mi_r >= mi_rows as usize || blk_mi_c >= mi_cols as usize) | ||
| 14977 | + { | ||
| 14978 | + break; | ||
| 14979 | + } | ||
| 14980 | + // Each half reads its OWN `cdef_idx` literal | ||
| 14981 | + // (libaom `read_cdef` keys the `-1` test on the | ||
| 14982 | + // block's own `MB_MODE_INFO`, and the two halves have | ||
| 14983 | + // different ones). | ||
| 14984 | + CDEF_TRANSMITTED.with(|c| c.set(false)); | ||
| 14985 | + decode_block_128rect( | ||
| 14986 | + &mut dec, | ||
| 14987 | + &mut cdfs, | ||
| 14988 | + &mut neighbours, | ||
| 14989 | + at, | ||
| 14990 | + bw, | ||
| 14991 | + bh, | ||
| 14992 | + &mut y, | ||
| 14993 | + &mut u, | ||
| 14994 | + &mut v, | ||
| 14995 | + base_q_idx, | ||
| 14996 | + enable_filter_intra, | ||
| 14997 | + allow_screen_content_tools, | ||
| 14998 | + tx_select, | ||
| 14999 | + reduced_tx_set, | ||
| 15000 | + )?; | ||
| 15001 | + } | ||
| 15002 | + // One `cdef_idx` per BLOCK, copied to every 64x64 CDEF | ||
| 15003 | + // unit it covers (the inter path's own fan-out). | ||
| 15004 | + let (q_r, q_c) = ((sb_r & !1) as usize, (sb_c & !1) as usize); | ||
| 15005 | + CDEF_IDX_GRID.with(|g| { | ||
| 15006 | + let mut g = g.borrow_mut(); | ||
| 15007 | + let cols = CDEF_SB_COLS.with(|c| c.get()); | ||
| 15008 | + if cols == 0 { | ||
| 15009 | + return; | ||
| 15010 | + } | ||
| 15011 | + for (src, dst) in if horz { | ||
| 15012 | + [((0, 0), (0, 1)), ((1, 0), (1, 1))] | ||
| 15013 | + } else { | ||
| 15014 | + [((0, 0), (1, 0)), ((0, 1), (1, 1))] | ||
| 15015 | + } { | ||
| 15016 | + let (si, di) = ( | ||
| 15017 | + (q_r + src.0) * cols + q_c + src.1, | ||
| 15018 | + (q_r + dst.0) * cols + q_c + dst.1, | ||
| 15019 | + ); | ||
| 15020 | + if q_c + src.1 < cols | ||
| 15021 | + && q_c + dst.1 < cols | ||
| 15022 | + && si < g.len() | ||
| 15023 | + && di < g.len() | ||
| 15024 | + { | ||
| 15025 | + g[di] = g[si]; | ||
| 15026 | + } | ||
| 15027 | + } | ||
| 15028 | + }); | ||
| 15029 | + continue; | ||
| 14639 | } | 15030 | } |
| 14640 | if part128 == PARTITION_NONE { | 15031 | if part128 == PARTITION_NONE { |
| 14641 | // One 128x128 intra block: four TX_64X64 luma units and a | 15032 | // One 128x128 intra block: four TX_64X64 luma units and a |
crates/ec-av1/src/refusal_inventory.rsmodified+1 -1
| @@ -46,7 +46,7 @@ const REFUSALS: &[&str] = &[ | |||
| 46 | "a superblock-level partition value outside PARTITION_NONE..PARTITION_VERT_4", | 46 | "a superblock-level partition value outside PARTITION_NONE..PARTITION_VERT_4", |
| 47 | "a 128x128 superblock AB partition (HORZ_A/HORZ_B/VERT_A/VERT_B at the 128 root)", | 47 | "a 128x128 superblock AB partition (HORZ_A/HORZ_B/VERT_A/VERT_B at the 128 root)", |
| 48 | "an inter var-tx tree with a leaf transform larger than 64x64", | 48 | "an inter var-tx tree with a leaf transform larger than 64x64", |
| 49 | - "a 128x128 superblock HORZ/VERT partition on an intra frame (the inter path decodes it; the intra one is square-block only)", | 49 | + "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)", |
| 50 | "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 | "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)", |
| 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)", |
| 52 | "a block that actually uses a palette (UV) -- reconstruction is out of scope", | 52 | "a block that actually uses a palette (UV) -- reconstruction is out of scope", |
crates/ec-av1/src/stream.rsmodified+177 -0
| @@ -122,6 +122,12 @@ pub fn leaf8_intrabc_hits() -> usize { | |||
| 122 | crate::decode::leaf8_intrabc_hits() | 122 | crate::decode::leaf8_intrabc_hits() |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | +/// lane-sb128c r8: the 128 root's INTRA (key-frame) rect arm -- (128x64 | ||
| 126 | +/// blocks, 64x128 blocks, blocks per resolved intra `tx_depth` 0/1/2). | ||
| 127 | +pub fn intra_sb128_counters() -> (usize, usize, [usize; 3]) { | ||
| 128 | + crate::decode::intra_sb128_hits() | ||
| 129 | +} | ||
| 130 | + | ||
| 125 | pub fn rect4_32_counters() -> (usize, usize, usize) { | 131 | pub fn rect4_32_counters() -> (usize, usize, usize) { |
| 126 | ( | 132 | ( |
| 127 | crate::decode::rect4_32_horz_hits(), | 133 | crate::decode::rect4_32_horz_hits(), |
| @@ -22349,6 +22355,177 @@ mod tests { | |||
| 22349 | ); | 22355 | ); |
| 22350 | } | 22356 | } |
| 22351 | 22357 | ||
| 22358 | + /// lane-sb128c r8: the 128 root's HORZ/VERT arm on a KEY frame -- one | ||
| 22359 | + /// 128x64 (or 64x128) INTRA block, the shape r7 still refused by name. | ||
| 22360 | + /// A smooth `gradients` source makes the key frame itself take the arm | ||
| 22361 | + /// (`mandelbrot`'s key frames always split), at sizes whose last | ||
| 22362 | + /// superblock row/column is a partial 64 so the gathered frame-edge bit | ||
| 22363 | + /// decides the root. `--enable-tx-size-search=1` on half the arms is what | ||
| 22364 | + /// makes the intra `tx_depth` symbol real (depth 1 = 32x32 units, | ||
| 22365 | + /// depth 2 = 16x16). Every decode-order frame (hidden alt-refs included) | ||
| 22366 | + /// is compared against the instrumented aomdec, and the per-depth | ||
| 22367 | + /// counters are printed for every compared attempt. | ||
| 22368 | + #[test] | ||
| 22369 | + fn a_real_aomenc_sb128_intra_rect_block_decodes_pixel_exact() { | ||
| 22370 | + const NAME: &str = "a_real_aomenc_sb128_intra_rect_block_decodes_pixel_exact"; | ||
| 22371 | + let _gate_lock = lock_gate_counters(); | ||
| 22372 | + if !have_ffmpeg() { | ||
| 22373 | + eprintln!("SKIP {NAME}: no ffmpeg"); | ||
| 22374 | + return; | ||
| 22375 | + } | ||
| 22376 | + if !have_aomenc() { | ||
| 22377 | + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); | ||
| 22378 | + return; | ||
| 22379 | + } | ||
| 22380 | + // (tag, cq, width, height, 10-bit, vertical twin, tx-size-search) | ||
| 22381 | + let arms: Vec<(u32, &str, usize, usize, bool, bool, bool)> = vec![ | ||
| 22382 | + (42, "--cq-level=55", 384, 320, false, false, false), | ||
| 22383 | + (43, "--cq-level=32", 384, 320, true, false, true), | ||
| 22384 | + (44, "--cq-level=8", 256, 192, false, false, true), | ||
| 22385 | + (46, "--cq-level=55", 192, 256, false, true, false), | ||
| 22386 | + (45, "--cq-level=45", 192, 256, true, true, true), | ||
| 22387 | + ]; | ||
| 22388 | + let (mut matched, mut named_refusals, mut out_of_scope) = (0u32, 0u32, 0u32); | ||
| 22389 | + let (mut horz_arms, mut vert_arms) = (0u32, 0u32); | ||
| 22390 | + let mut depth_seen = [0usize; 3]; | ||
| 22391 | + for (tag, cq, width, height, ten_bit, vert, tx_search) in arms { | ||
| 22392 | + let pix = if ten_bit { "yuv420p10le" } else { "yuv420p" }; | ||
| 22393 | + let y4m = Command::new("ffmpeg") | ||
| 22394 | + .args([ | ||
| 22395 | + "-v", "error", "-f", "lavfi", "-i", | ||
| 22396 | + // DETERMINISTIC smooth source: lavfi `gradients` ignores | ||
| 22397 | + // its seed and gives a different picture every run (a | ||
| 22398 | + // whole round was spent on a "flake" that was really this), | ||
| 22399 | + // so the smoothness comes from long-period sinusoids | ||
| 22400 | + // through `geq` instead -- same effect on the encoder's | ||
| 22401 | + // partition choice, byte-identical across runs. | ||
| 22402 | + &format!( | ||
| 22403 | + "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)'" | ||
| 22404 | + ), | ||
| 22405 | + "-pix_fmt", pix, "-strict", "-1", "-t", "0.2", | ||
| 22406 | + "-f", "yuv4mpegpipe", "-", | ||
| 22407 | + ]) | ||
| 22408 | + .stdin(Stdio::null()) | ||
| 22409 | + .stdout(Stdio::piped()) | ||
| 22410 | + .stderr(Stdio::piped()) | ||
| 22411 | + .output() | ||
| 22412 | + .expect("ffmpeg failed to run"); | ||
| 22413 | + assert!( | ||
| 22414 | + y4m.status.success(), | ||
| 22415 | + "{NAME}: ffmpeg fixture: {}", | ||
| 22416 | + String::from_utf8_lossy(&y4m.stderr) | ||
| 22417 | + ); | ||
| 22418 | + let mut args: Vec<&str> = vec![ | ||
| 22419 | + "--codec=av1", "--passes=1", "--end-usage=q", cq, | ||
| 22420 | + "--cpu-used=0", "--threads=1", "--row-mt=0", | ||
| 22421 | + "--sb-size=128", "--min-partition-size=64", | ||
| 22422 | + "--enable-rect-partitions=1", "--enable-ab-partitions=0", | ||
| 22423 | + "--enable-1to4-partitions=0", "--enable-palette=0", | ||
| 22424 | + "--enable-intrabc=0", "--deltaq-mode=0", "--limit=5", | ||
| 22425 | + // EVERY frame a key frame: this gate exists for the INTRA | ||
| 22426 | + // 128x64/64x128 block, and a mixed stream lands on other | ||
| 22427 | + // lanes' inter gaps (sub-8 leaves, rect inter residual) | ||
| 22428 | + // before it ever gets there. The inter twin of this same | ||
| 22429 | + // 128-root arm has its own gate | ||
| 22430 | + // (`..._sb128_gathered_edge_horz_partition_decodes_pixel_exact`). | ||
| 22431 | + "--kf-max-dist=1", | ||
| 22432 | + ]; | ||
| 22433 | + // AOMENC FLAG PRECEDENCE: the LAST occurrence wins, so this | ||
| 22434 | + // per-arm override goes after the base recipe. | ||
| 22435 | + args.push(if tx_search { | ||
| 22436 | + "--enable-tx-size-search=1" | ||
| 22437 | + } else { | ||
| 22438 | + "--enable-tx-size-search=0" | ||
| 22439 | + }); | ||
| 22440 | + if ten_bit { | ||
| 22441 | + args.extend_from_slice(&["--input-bit-depth=10", "--bit-depth=10"]); | ||
| 22442 | + } | ||
| 22443 | + args.extend_from_slice(&["--obu", "-o", "-", "-"]); | ||
| 22444 | + let mut child = Command::new(aomenc_path()) | ||
| 22445 | + .args(&args) | ||
| 22446 | + .stdin(Stdio::piped()) | ||
| 22447 | + .stdout(Stdio::piped()) | ||
| 22448 | + .stderr(Stdio::piped()) | ||
| 22449 | + .spawn() | ||
| 22450 | + .expect("aomenc failed to start"); | ||
| 22451 | + child | ||
| 22452 | + .stdin | ||
| 22453 | + .take() | ||
| 22454 | + .expect("aomenc stdin") | ||
| 22455 | + .write_all(&y4m.stdout) | ||
| 22456 | + .expect("writing y4m to aomenc"); | ||
| 22457 | + let out = child.wait_with_output().expect("aomenc failed to run"); | ||
| 22458 | + assert!( | ||
| 22459 | + out.status.success(), | ||
| 22460 | + "{NAME}: aomenc refused the fixture: {}", | ||
| 22461 | + String::from_utf8_lossy(&out.stderr) | ||
| 22462 | + ); | ||
| 22463 | + let stream = out.stdout; | ||
| 22464 | + let before = intra_sb128_counters(); | ||
| 22465 | + if let Err(e) = decode_stream(&stream) { | ||
| 22466 | + let msg = e.to_string(); | ||
| 22467 | + assert!( | ||
| 22468 | + msg.contains("unsupported"), | ||
| 22469 | + "{NAME} failed outright, not a named refusal \ | ||
| 22470 | + (arm {tag} {width}x{height}): {msg}" | ||
| 22471 | + ); | ||
| 22472 | + named_refusals += 1; | ||
| 22473 | + eprintln!("{NAME}: arm {tag} {width}x{height} refusal: {msg}"); | ||
| 22474 | + continue; | ||
| 22475 | + } | ||
| 22476 | + let (frames, hidden) = decode_all_frames_vs_oracle( | ||
| 22477 | + &stream, | ||
| 22478 | + &format!("sb128c-intra-{tag}-{width}x{height}"), | ||
| 22479 | + ); | ||
| 22480 | + assert!(frames > 0, "{NAME}: no frames decoded at {width}x{height}"); | ||
| 22481 | + let after = intra_sb128_counters(); | ||
| 22482 | + let (horz, vert_hits) = (after.0 - before.0, after.1 - before.1); | ||
| 22483 | + let depth: Vec<usize> = | ||
| 22484 | + (0..3).map(|i| after.2[i] - before.2[i]).collect(); | ||
| 22485 | + eprintln!( | ||
| 22486 | + "{NAME}: arm {tag} cq {cq} {width}x{height} {}bit {} txsearch={}: \ | ||
| 22487 | + {frames} frames pixel-exact ({hidden} hidden), \ | ||
| 22488 | + intra_128x64 +{horz} intra_64x128 +{vert_hits} \ | ||
| 22489 | + depth[64/32/16] {depth:?}", | ||
| 22490 | + if ten_bit { 10 } else { 8 }, | ||
| 22491 | + if vert { "VERT" } else { "HORZ" }, | ||
| 22492 | + u8::from(tx_search), | ||
| 22493 | + ); | ||
| 22494 | + if horz == 0 && vert_hits == 0 { | ||
| 22495 | + out_of_scope += 1; | ||
| 22496 | + } | ||
| 22497 | + if horz > 0 { | ||
| 22498 | + horz_arms += 1; | ||
| 22499 | + } | ||
| 22500 | + if vert_hits > 0 { | ||
| 22501 | + vert_arms += 1; | ||
| 22502 | + } | ||
| 22503 | + for i in 0..3 { | ||
| 22504 | + depth_seen[i] += depth[i]; | ||
| 22505 | + } | ||
| 22506 | + matched += 1; | ||
| 22507 | + } | ||
| 22508 | + assert!( | ||
| 22509 | + matched > 0, | ||
| 22510 | + "{NAME}: every attempt refused ({named_refusals}); the gate never \ | ||
| 22511 | + decoded a stream" | ||
| 22512 | + ); | ||
| 22513 | + assert!( | ||
| 22514 | + horz_arms > 0, | ||
| 22515 | + "{NAME}: {matched} stream(s) decoded pixel-exact ({out_of_scope} carried \ | ||
| 22516 | + no 128-root rect intra block at all) but NOT ONE key-frame 128x64 \ | ||
| 22517 | + block fired -- the shape this gate exists for" | ||
| 22518 | + ); | ||
| 22519 | + assert!( | ||
| 22520 | + vert_arms > 0, | ||
| 22521 | + "{NAME}: the VERT twin never produced a key-frame 64x128 block" | ||
| 22522 | + ); | ||
| 22523 | + assert!( | ||
| 22524 | + depth_seen[0] > 0, | ||
| 22525 | + "{NAME}: no depth-0 (TX_64X64) intra 128-rect block: {depth_seen:?}" | ||
| 22526 | + ); | ||
| 22527 | + } | ||
| 22528 | + | ||
| 22352 | #[test] | 22529 | #[test] |
| 22353 | #[ignore = "lane-sb128 r2 diagnostic: is the frame-6 mismatch sb128-specific?"] | 22530 | #[ignore = "lane-sb128 r2 diagnostic: is the frame-6 mismatch sb128-specific?"] |
| 22354 | fn sb128_r2_control_sb64() { | 22531 | fn sb128_r2_control_sb64() { |
lanes/sb128c-r8.report.mdadded+115 -0
| @@ -0,0 +1,115 @@ | |||
| 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 | +**387 passed; 0 failed; 35 ignored** in 1216 s -- | ||
| 98 | +`$HOME/.cache/sb128c-suite-r8.log` (r7 was 386/0/35; +1 is this round's gate). | ||
| 99 | + | ||
| 100 | +## Residue | ||
| 101 | + | ||
| 102 | +- deferred: the four AB shapes at the 128 root (key and inter) -- MEASURED to | ||
| 103 | + be reachable (above). Unblocked by this round's `decode_block_128rect` (the | ||
| 104 | + 128x64/64x128 piece each AB shape needs) plus the libaom visit order in | ||
| 105 | + `lanes/sb128c-r6.handoff.md`; the sweep script pins the recipe that | ||
| 106 | + produces one. | ||
| 107 | +- deferred: intra `tx_depth` > 0 at the 128 root (32x32 / 16x16 units) is | ||
| 108 | + implemented but UNEXERCISED -- every arm, including cq 8 with | ||
| 109 | + `--enable-tx-size-search=1`, resolved depth 0. Unblocked by finding an | ||
| 110 | + encoder setting that splits a 128x64's transform; the gate prints the | ||
| 111 | + per-depth counters so the round that finds one sees it immediately. | ||
| 112 | +- accepted: an inter frame of the 192x256 smooth source mismatches at frame 1 | ||
| 113 | + (`$HOME/.cache/sb128c-r8/vert46.obu`, byte 12033, 36073 bytes differ). It is | ||
| 114 | + NOT this lane's shape: the key frames of that same stream are exact, and the | ||
| 115 | + r7 inter gate is green on its own source. Left pinned for a hunter. | ||