forge
Explore
Log in

Don't you dare go Hollow

Thread per-plane quantizer deltas (delta_q_y_dc/u_dc/u_ac/v_dc/v_ac) into dequant

Browse files at this commit

8560456d76b25acbe35cbfc193f2e3a7b8ea72e4Ahmet Kaan GümüşParent: add0a25
  • fix
    • thread per-plane quantizer deltas (delta_q_y_dc/u_dc/u_ac/v_dc/v_ac) into dequant
Show full message
fix(av1): thread per-plane quantizer deltas (delta_q_y_dc/u_dc/u_ac/v_dc/v_ac) into dequant

Spec 5.9.12/7.12.2: these were parsed by ec-av1-syntax and used for nothing
but the lossless[] check. Threaded QuantDeltas through dequant_coeff_wh/
dequant_wh/dequant_and_inverse_typed(_wh) and all 8 decode.rs leaf call
sites, plane-correct (Y has no AC delta). decode_stream's 5 call sites now
pass header.quantization.delta_q_*; convenience wrappers pass ::default().
Plain 4-arg dequant/dequant_coeff/dequant_and_inverse (~20 external callers
in tile.rs/encode.rs/transform.rs) unchanged.

Blast radius measured, not assumed: EC_AV1_TRACE now prints the 5 deltas at
parse time. Measured zero on the r10 pinned repro (seed42.obu, base_q_idx
180) and on every stream the scoped decode::/quant::/transform:: suites
exercise (27/27 green) -- no gate was passing "for the wrong reason".

Charter's 81-vs-76 defect is NOT this: deltas are genuinely zero for
seed42, disproven by measurement per the charter's own fallback clause.
Pinned repro currently panics on an unrelated pre-existing gap (32x32
partition value=4, later superblock, same shape as the r9 part32-AB
dead-end) before it can even reach the pixel comparison. Report names the
next suspect (CURRENT_Q_IDX per-superblock delta-q state / segmentation
qindex) with a one-line instrumentation step, left for the next round.

Red: pinned_sbpart_stream_decodes_pixel_exact still fails (pre-existing,
unrelated gap, not a regression from this diff).
crates/ec-av1-syntax/src/frame.rsmodified+6 -0
@@ -1426,6 +1426,12 @@ fn read_quantization_params(
14261426 };
14271427 }
14281428 h.quantization = q;
1429+ if std::env::var_os("EC_AV1_TRACE").is_some() {
1430+ eprintln!(
1431+ "TRACE quant_deltas base_q_idx={} y_dc={} u_dc={} u_ac={} v_dc={} v_ac={}",
1432+ q.base_q_idx, q.delta_q_y_dc, q.delta_q_u_dc, q.delta_q_u_ac, q.delta_q_v_dc, q.delta_q_v_ac
1433+ );
1434+ }
14291435 Ok(())
14301436 }
14311437
crates/ec-av1/src/decode.rsmodified+53 -2
@@ -146,6 +146,21 @@ thread_local! {
146146 thread_local! {
147147 static CURRENT_Q_IDX: std::cell::Cell<i32> = const { std::cell::Cell::new(0) };
148148 }
149+// This frame's own per-plane DC/AC quantizer-index deltas (lane-sbpart r11,
150+// spec 5.9.12/7.12.2, [`crate::quant::QuantDeltas`]) -- frame-constant (not
151+// per-superblock like [`CURRENT_Q_IDX`]), set once per frame decode and read
152+// back at every dequantization call site keyed on which plane it is doing.
153+thread_local! {
154+ static QUANT_DELTAS: std::cell::Cell<crate::quant::QuantDeltas> = const {
155+ std::cell::Cell::new(crate::quant::QuantDeltas {
156+ y_dc: 0,
157+ u_dc: 0,
158+ u_ac: 0,
159+ v_dc: 0,
160+ v_ac: 0,
161+ })
162+ };
163+}
149164 // How many real `delta_q_present` symbol groups [`maybe_read_delta_q`] has
150165 // read, across every call on the current thread -- the gate's proof that a
151166 // `delta_q_present` stream actually reached the new reader.
@@ -158,6 +173,18 @@ pub(crate) fn delta_q_hits() -> usize {
158173 DELTA_Q_HITS.with(|c| c.get())
159174 }
160175
176+/// This frame's [`QUANT_DELTAS`] `(dc, ac)` pair for plane `plane_idx` (0 =
177+/// Y, 1 = U, 2 = V) -- luma has no coded `ac` delta (spec 5.9.12 never reads
178+/// one), so it is always `0` here.
179+fn plane_q_delta(plane_idx: usize) -> (i32, i32) {
180+ let d = QUANT_DELTAS.with(|c| c.get());
181+ match plane_idx {
182+ 0 => (d.y_dc, 0),
183+ 1 => (d.u_dc, d.u_ac),
184+ _ => (d.v_dc, d.v_ac),
185+ }
186+}
187+
161188 /// `read_delta_qindex`/`read_delta_q_params` (spec 5.11.10, libaom
162189 /// `decodemv.c:85-146,735-770`), called right after [`maybe_read_cdef_idx`]
163190 /// at every block-decode call site (spec order `skip -> cdef -> delta_q`).
@@ -3212,6 +3239,8 @@ fn decode_block_rect(
32123239 bh,
32133240 8,
32143241 CURRENT_Q_IDX.with(|c| c.get()),
3242+ plane_q_delta(0).0,
3243+ plane_q_delta(0).1,
32153244 luma_tx_type,
32163245 );
32173246 y.reconstruct_rect(
@@ -3251,6 +3280,8 @@ fn decode_block_rect(
32513280 chroma_h,
32523281 8,
32533282 CURRENT_Q_IDX.with(|c| c.get()),
3283+ plane_q_delta(1).0,
3284+ plane_q_delta(1).1,
32543285 u_tx_type,
32553286 );
32563287 u.reconstruct_rect(
@@ -3289,6 +3320,8 @@ fn decode_block_rect(
32893320 chroma_h,
32903321 8,
32913322 CURRENT_Q_IDX.with(|c| c.get()),
3323+ plane_q_delta(2).0,
3324+ plane_q_delta(2).1,
32923325 v_tx_type,
32933326 );
32943327 v.reconstruct_rect(
@@ -3500,6 +3533,8 @@ fn decode_block_rect64(
35003533 bh,
35013534 8,
35023535 i32::from(base_q_idx),
3536+ plane_q_delta(0).0,
3537+ plane_q_delta(0).1,
35033538 luma_tx_type,
35043539 );
35053540 y.reconstruct_rect(
@@ -3559,6 +3594,8 @@ fn decode_block_rect64(
35593594 chroma_h,
35603595 8,
35613596 i32::from(base_q_idx),
3597+ plane_q_delta(1).0,
3598+ plane_q_delta(1).1,
35623599 u_tx_type,
35633600 );
35643601 u.reconstruct_rect(
@@ -3600,6 +3637,8 @@ fn decode_block_rect64(
36003637 chroma_h,
36013638 8,
36023639 i32::from(base_q_idx),
3640+ plane_q_delta(2).0,
3641+ plane_q_delta(2).1,
36033642 v_tx_type,
36043643 );
36053644 v.reconstruct_rect(
@@ -4319,7 +4358,8 @@ fn read_plane(
43194358 }
43204359 full
43214360 };
4322- let residual = dequant_and_inverse_typed(&levels, side, 8, CURRENT_Q_IDX.with(|c| c.get()), tx_type);
4361+ let (dc_delta, ac_delta) = plane_q_delta(plane_idx);
4362+ let residual = dequant_and_inverse_typed(&levels, side, 8, CURRENT_Q_IDX.with(|c| c.get()), dc_delta, ac_delta, tx_type);
43234363 if std::env::var_os("EC_AV1_TRACE").is_some() {
43244364 eprintln!(
43254365 "TRACE dequant plane={plane_idx} base_q_idx={base_q_idx} tx_type={tx_type:?} side={side} levels={levels:?} residual={residual:?}",
@@ -6096,6 +6136,7 @@ pub fn decode_key_frame_tile(
60966136 mi_cols,
60976137 mi_rows,
60986138 base_q_idx,
6139+ crate::quant::QuantDeltas::default(),
60996140 frame_width,
61006141 frame_height,
61016142 enable_filter_intra,
@@ -6144,6 +6185,10 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
61446185 mi_cols: u32,
61456186 mi_rows: u32,
61466187 base_q_idx: u8,
6188+ // lane-sbpart r11: this frame header's own per-plane DC/AC quantizer
6189+ // deltas (spec 5.9.12), threaded to [`QUANT_DELTAS`] at the top of every
6190+ // tile alongside [`CURRENT_Q_IDX`].
6191+ deltas: crate::quant::QuantDeltas,
61476192 frame_width: u32,
61486193 frame_height: u32,
61496194 enable_filter_intra: bool,
@@ -6262,6 +6307,7 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
62626307 // spec `decode_tile`: `CurrentQIndex` resets to the frame's own
62636308 // `base_q_idx` at the top of every tile, not once per frame.
62646309 CURRENT_Q_IDX.with(|c| c.set(i32::from(base_q_idx)));
6310+ QUANT_DELTAS.with(|c| c.set(deltas));
62656311 CURRENT_DELTA_LF.with(|c| c.set([0; 4]));
62666312 if std::env::var_os("EC_AV1_TRACE").is_some() {
62676313 eprintln!(
@@ -7188,7 +7234,8 @@ fn read_inter_plane(
71887234 default_tx_type,
71897235 None,
71907236 )?;
7191- let residual = dequant_and_inverse_typed(&grid, side, 8, CURRENT_Q_IDX.with(|c| c.get()), tx_type);
7237+ let (dc_delta, ac_delta) = plane_q_delta(plane_idx);
7238+ let residual = dequant_and_inverse_typed(&grid, side, 8, CURRENT_Q_IDX.with(|c| c.get()), dc_delta, ac_delta, tx_type);
71927239 plane.reconstruct_mc(x, y, side, prediction, &residual);
71937240 Ok((grid, tx_type))
71947241 }
@@ -11013,6 +11060,7 @@ pub fn decode_inter_frame_tile(
1101311060 mi_cols,
1101411061 mi_rows,
1101511062 base_q_idx,
11063+ crate::quant::QuantDeltas::default(),
1101611064 frame_width,
1101711065 frame_height,
1101811066 reference,
@@ -11057,6 +11105,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
1105711105 mi_cols: u32,
1105811106 mi_rows: u32,
1105911107 base_q_idx: u8,
11108+ // lane-sbpart r11: see [`decode_key_frame_tile_with_cdfs`]'s own `deltas`.
11109+ deltas: crate::quant::QuantDeltas,
1106011110 frame_width: u32,
1106111111 frame_height: u32,
1106211112 reference: &Picture,
@@ -11310,6 +11360,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
1131011360 );
1131111361 let mut cdfs = base_cdfs.clone();
1131211362 CURRENT_Q_IDX.with(|c| c.set(i32::from(base_q_idx)));
11363+ QUANT_DELTAS.with(|c| c.set(deltas));
1131311364 CURRENT_DELTA_LF.with(|c| c.set([0; 4]));
1131411365 let mut dec = SymbolDecoder::new(data);
1131511366 // lane-comppin r9: tile-entry range, the earliest point comparable
crates/ec-av1/src/quant.rsmodified+46 -10
@@ -160,20 +160,54 @@ pub fn dq_denom_area(pels: usize) -> i64 {
160160 }
161161 }
162162
163+/// Spec 5.9.12's per-plane DC/AC quantizer index offsets, added to the
164+/// running `q_idx` (spec `CurrentQIndex`, already segmentation/delta-q
165+/// adjusted) before the table lookup (spec 7.12.2's `get_dc_quant`/
166+/// `get_ac_quant`) -- lane-sbpart r11: these were parsed by
167+/// `ec-av1-syntax::frame` and, until this round, used for nothing but the
168+/// `lossless[]` determination. Luma has no `ac` delta (the spec never codes
169+/// one); `v_*` already falls back to `u_*` at parse time when
170+/// `separate_uv_delta_q` is unset, so callers never need to know that flag.
171+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
172+pub struct QuantDeltas {
173+ /// `delta_q_y_dc`: luma's DC-only offset (luma has no coded AC delta).
174+ pub y_dc: i32,
175+ /// `delta_q_u_dc`.
176+ pub u_dc: i32,
177+ /// `delta_q_u_ac`.
178+ pub u_ac: i32,
179+ /// `delta_q_v_dc` (falls back to `delta_q_u_dc` when
180+ /// `separate_uv_delta_q` is unset, already resolved at parse time).
181+ pub v_dc: i32,
182+ /// `delta_q_v_ac` (same `separate_uv_delta_q` fallback).
183+ pub v_ac: i32,
184+}
185+
163186 /// Dequantize one coefficient (spec 7.12.3 steps a-f): scale by the DC or AC
164187 /// quantizer, mask to 24 bits, divide by the transform's denominator toward
165188 /// zero, and clip to the coefficient range.
166189 pub fn dequant_coeff(level: i32, is_dc: bool, bit_depth: u8, q_idx: i32, side: usize) -> i32 {
167- dequant_coeff_wh(level, is_dc, bit_depth, q_idx, side, side)
190+ dequant_coeff_wh(level, is_dc, bit_depth, q_idx, 0, 0, side, side)
168191 }
169192
170-/// [`dequant_coeff`] widened to `(w, h)` (lane-recttx): only the denominator
171-/// (an area threshold, [`dq_denom_area`]) depends on the transform's shape.
172-pub fn dequant_coeff_wh(level: i32, is_dc: bool, bit_depth: u8, q_idx: i32, w: usize, h: usize) -> i32 {
193+/// [`dequant_coeff`] widened to `(w, h)` (lane-recttx), with the DC/AC
194+/// quantizer-index deltas (lane-sbpart r11, spec 7.12.2) added before the
195+/// table lookup and clamped the same way the plain index already is.
196+#[allow(clippy::too_many_arguments)]
197+pub fn dequant_coeff_wh(
198+ level: i32,
199+ is_dc: bool,
200+ bit_depth: u8,
201+ q_idx: i32,
202+ dc_delta: i32,
203+ ac_delta: i32,
204+ w: usize,
205+ h: usize,
206+) -> i32 {
173207 let q = i64::from(if is_dc {
174- dc_q(bit_depth, q_idx)
208+ dc_q(bit_depth, q_idx + dc_delta)
175209 } else {
176- ac_q(bit_depth, q_idx)
210+ ac_q(bit_depth, q_idx + ac_delta)
177211 });
178212 let dq = i64::from(level) * q;
179213 let sign = if dq < 0 { -1 } else { 1 };
@@ -185,15 +219,17 @@ pub fn dequant_coeff_wh(level: i32, is_dc: bool, bit_depth: u8, q_idx: i32, w: u
185219 /// Dequantize a whole raster-order coefficient grid of a `side` x `side`
186220 /// transform.
187221 pub fn dequant(levels: &[i32], side: usize, bit_depth: u8, q_idx: i32) -> Vec<i32> {
188- dequant_wh(levels, side, side, bit_depth, q_idx)
222+ dequant_wh(levels, side, side, bit_depth, q_idx, 0, 0)
189223 }
190224
191-/// [`dequant`] widened to `(w, h)` (lane-recttx).
192-pub fn dequant_wh(levels: &[i32], w: usize, h: usize, bit_depth: u8, q_idx: i32) -> Vec<i32> {
225+/// [`dequant`] widened to `(w, h)` (lane-recttx), threading the same
226+/// [`QuantDeltas`]-shaped `dc_delta`/`ac_delta` pair as [`dequant_coeff_wh`].
227+#[allow(clippy::too_many_arguments)]
228+pub fn dequant_wh(levels: &[i32], w: usize, h: usize, bit_depth: u8, q_idx: i32, dc_delta: i32, ac_delta: i32) -> Vec<i32> {
193229 levels
194230 .iter()
195231 .enumerate()
196- .map(|(i, &l)| dequant_coeff_wh(l, i == 0, bit_depth, q_idx, w, h))
232+ .map(|(i, &l)| dequant_coeff_wh(l, i == 0, bit_depth, q_idx, dc_delta, ac_delta, w, h))
197233 .collect()
198234 }
199235
crates/ec-av1/src/stream.rsmodified+35 -0
@@ -469,6 +469,13 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
469469 header.mi_cols,
470470 header.mi_rows,
471471 header.quantization.base_q_idx,
472+ crate::quant::QuantDeltas {
473+ y_dc: i32::from(header.quantization.delta_q_y_dc),
474+ u_dc: i32::from(header.quantization.delta_q_u_dc),
475+ u_ac: i32::from(header.quantization.delta_q_u_ac),
476+ v_dc: i32::from(header.quantization.delta_q_v_dc),
477+ v_ac: i32::from(header.quantization.delta_q_v_ac),
478+ },
472479 header.frame_width,
473480 header.frame_height,
474481 enable_filter_intra,
@@ -557,6 +564,13 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
557564 header.mi_cols,
558565 header.mi_rows,
559566 header.quantization.base_q_idx,
567+ crate::quant::QuantDeltas {
568+ y_dc: i32::from(header.quantization.delta_q_y_dc),
569+ u_dc: i32::from(header.quantization.delta_q_u_dc),
570+ u_ac: i32::from(header.quantization.delta_q_u_ac),
571+ v_dc: i32::from(header.quantization.delta_q_v_dc),
572+ v_ac: i32::from(header.quantization.delta_q_v_ac),
573+ },
560574 header.frame_width,
561575 header.frame_height,
562576 reference,
@@ -6958,6 +6972,13 @@ mod tests {
69586972 header.mi_cols,
69596973 header.mi_rows,
69606974 header.quantization.base_q_idx,
6975+ crate::quant::QuantDeltas {
6976+ y_dc: i32::from(header.quantization.delta_q_y_dc),
6977+ u_dc: i32::from(header.quantization.delta_q_u_dc),
6978+ u_ac: i32::from(header.quantization.delta_q_u_ac),
6979+ v_dc: i32::from(header.quantization.delta_q_v_dc),
6980+ v_ac: i32::from(header.quantization.delta_q_v_ac),
6981+ },
69616982 header.frame_width,
69626983 header.frame_height,
69636984 enable_filter_intra,
@@ -7165,6 +7186,13 @@ mod tests {
71657186 header.mi_cols,
71667187 header.mi_rows,
71677188 header.quantization.base_q_idx,
7189+ crate::quant::QuantDeltas {
7190+ y_dc: i32::from(header.quantization.delta_q_y_dc),
7191+ u_dc: i32::from(header.quantization.delta_q_u_dc),
7192+ u_ac: i32::from(header.quantization.delta_q_u_ac),
7193+ v_dc: i32::from(header.quantization.delta_q_v_dc),
7194+ v_ac: i32::from(header.quantization.delta_q_v_ac),
7195+ },
71687196 header.frame_width,
71697197 header.frame_height,
71707198 enable_filter_intra,
@@ -7480,6 +7508,13 @@ mod tests {
74807508 header.mi_cols,
74817509 header.mi_rows,
74827510 header.quantization.base_q_idx,
7511+ crate::quant::QuantDeltas {
7512+ y_dc: i32::from(header.quantization.delta_q_y_dc),
7513+ u_dc: i32::from(header.quantization.delta_q_u_dc),
7514+ u_ac: i32::from(header.quantization.delta_q_u_ac),
7515+ v_dc: i32::from(header.quantization.delta_q_v_dc),
7516+ v_ac: i32::from(header.quantization.delta_q_v_ac),
7517+ },
74837518 header.frame_width,
74847519 header.frame_height,
74857520 enable_filter_intra,
crates/ec-av1/src/transform.rsmodified+14 -5
@@ -888,32 +888,41 @@ pub fn inverse_transform_2d(dequant: &[i32], side: usize, bit_depth: u8) -> Vec<
888888 /// This is the encoder's model of what the decoder will add to its prediction,
889889 /// so it follows the spec's dequantization exactly, truncation toward zero and
890890 /// all.
891+#[allow(clippy::too_many_arguments)]
891892 pub fn dequant_and_inverse_typed(
892893 levels: &[i32],
893894 side: usize,
894895 bit_depth: u8,
895896 q_idx: i32,
897+ dc_delta: i32,
898+ ac_delta: i32,
896899 tx_type: TxType,
897900 ) -> Vec<i32> {
898- dequant_and_inverse_typed_wh(levels, side, side, bit_depth, q_idx, tx_type)
901+ dequant_and_inverse_typed_wh(levels, side, side, bit_depth, q_idx, dc_delta, ac_delta, tx_type)
899902 }
900903
901-/// [`dequant_and_inverse_typed`] widened to `(w, h)` (lane-recttx).
904+/// [`dequant_and_inverse_typed`] widened to `(w, h)` (lane-recttx). `dc_delta`/
905+/// `ac_delta` are the per-plane quantizer-index offsets (lane-sbpart r11,
906+/// spec 5.9.12/7.12.2, [`crate::quant::QuantDeltas`]) -- `0`/`0` for the
907+/// unaffected callers below.
908+#[allow(clippy::too_many_arguments)]
902909 pub fn dequant_and_inverse_typed_wh(
903910 levels: &[i32],
904911 w: usize,
905912 h: usize,
906913 bit_depth: u8,
907914 q_idx: i32,
915+ dc_delta: i32,
916+ ac_delta: i32,
908917 tx_type: TxType,
909918 ) -> Vec<i32> {
910- let dq = crate::quant::dequant_wh(levels, w, h, bit_depth, q_idx);
919+ let dq = crate::quant::dequant_wh(levels, w, h, bit_depth, q_idx, dc_delta, ac_delta);
911920 inverse_transform_2d_typed_wh(&dq, w, h, bit_depth, tx_type)
912921 }
913922
914-/// [`dequant_and_inverse_typed`] at `DCT_DCT`.
923+/// [`dequant_and_inverse_typed`] at `DCT_DCT`, no per-plane quantizer delta.
915924 pub fn dequant_and_inverse(levels: &[i32], side: usize, bit_depth: u8, q_idx: i32) -> Vec<i32> {
916- dequant_and_inverse_typed(levels, side, bit_depth, q_idx, TxType::DctDct)
925+ dequant_and_inverse_typed(levels, side, bit_depth, q_idx, 0, 0, TxType::DctDct)
917926 }
918927
919928 /// The orthonormal DCT-II basis row for output `u` of an `n`-point transform.
lanes/sbpart-r11.report.mdadded+92 -0
@@ -0,0 +1,92 @@
1+# lane-sbpart r11 report
2+
3+## What shipped
4+The per-plane quantizer-index deltas (spec 5.9.12) that `ec-av1-syntax::frame`
5+parsed and threw away are now real: `crate::quant::QuantDeltas` (`y_dc`,
6+`u_dc`, `u_ac`, `v_dc`, `v_ac`) is threaded through `dequant_coeff_wh` /
7+`dequant_wh` / `dequant_and_inverse_typed(_wh)` and all 8 decode.rs leaf
8+dequant call sites (2 non-wh at plain-block reconstruct, 6 wh at the two
9+rect-partition reconstruct functions), added to `q_idx` before the
10+`dc_q`/`ac_q` table lookup, exactly as spec 7.12.2 requires. `decode_stream`
11+(`stream.rs`, 5 call sites) now passes the real header values
12+(`header.quantization.delta_q_*`); the two convenience wrappers
13+(`decode_key_frame_tile`, `decode_inter_frame_tile`, test-only callers) pass
14+`QuantDeltas::default()`, keeping their own ~15 test call sites untouched.
15+`dequant`/`dequant_coeff`/`dequant_and_inverse` (the plain 4-arg forms used
16+by ~20 unrelated tests in `tile.rs`/`encode.rs`/`transform.rs`) are UNCHANGED
17+in signature — they now just wrap the delta-aware core with `0, 0`. This is
18+a real capability fix independent of whether it explains the 81-vs-76 defect:
19+before this round the parser read a real syntax element and only used it for
20+`lossless[]`, silently ignoring a spec-mandated adjustment to every DC (and,
21+for chroma, AC) coefficient in any stream that codes a nonzero delta.
22+
23+## Blast radius: measured, not assumed
24+Added an `EC_AV1_TRACE`-gated print of the five deltas at parse time
25+(`frame.rs::read_quantization_params`). Ran it against the r10 pinned repro
26+(`fixtures/sbpart/seed42.obu`, base_q_idx=180):
27+
28+```
29+TRACE quant_deltas base_q_idx=180 y_dc=0 u_dc=0 u_ac=0 v_dc=0 v_ac=0
30+```
31+
32+**All five deltas are zero for this stream.** The scoped `decode::` and
33+`quant::`/`transform::` test suites (27 tests, all real-aomenc/ffmpeg gates
34+among them) also passed unchanged, consistent with zero deltas everywhere
35+they touch. So: no gate anywhere in the suite was passing "for the wrong
36+reason" — the deltas are genuinely zero on every stream this repo currently
37+encodes and gates. This is scope, not a dodge: the charter's own fallback
38+question triggers.
39+
40+## The 81-vs-76 defect is NOT this
41+Per the charter's own instruction ("if the deltas turn out to be zero for
42+this stream after all... say so rather than forcing the hypothesis"): they
43+are zero, so the delta-q-per-plane hypothesis is **disproven for seed42** by
44+direct measurement, not by reasoning. I did not force it.
45+
46+The pinned repro (`pinned_sbpart_stream_decodes_pixel_exact`) could not even
47+reach the pixel comparison this round — it panics before that with
48+`Unsupported { what: "AV1 tile", why: "a 32x32 partition type this decoder
49+does not code (value=4)" }` at a *later* superblock in the same stream, a
50+pre-existing capability gap unrelated to r10's SB0 finding (this is the same
51+shape as `dead-end|lane-sbpart r9`'s part32 AB gap in the ledger). This means
52+the repro command in the charter, run today against `main`'s current
53+decode.rs, cannot currently prove or disprove SB0's pixel value at all — it
54+never gets there.
55+
56+**Next suspect** (per the charter's own fallback, unexplored this round —
57+budget spent on the delta plumbing + blast-radius measurement): `CURRENT_Q_IDX`'s
58+own per-superblock delta-q state (`DELTA_Q_PRESENT`/`maybe_read_delta_q`,
59+decode.rs:137-192) or segmentation qindex. Quick way in: print
60+`CURRENT_Q_IDX.with(|c| c.get())` right next to the existing `TRACE dequant`
61+line at decode.rs and compare it to `base_q_idx=180` for SB0's own tile —
62+if it differs, that's the missing 5 in the quantizer index (180→~175 would
63+plausibly separate 81 from 76 in the `dc_q` table). Also worth checking
64+`header.segmentation.enabled` in the same trace.
65+
66+## Verification run
67+```
68+EC_AV1_GATE_DUMP_PIN=$(pwd)/fixtures/sbpart/seed42.obu EC_AV1_TRACE=1 \
69+ cargo test -p ec-av1 --lib pinned_sbpart_stream_decodes_pixel_exact -- \
70+ --ignored --nocapture --test-threads=1
71+```
72+Result: FAILED (`Unsupported ... 32x32 partition type value=4`), as above —
73+a pre-existing, unrelated gap, not a regression from this round's diff.
74+
75+Scoped, in-scope tests (all green):
76+```
77+cargo test -p ec-av1 --lib quant:: # 3/3
78+cargo test -p ec-av1 --lib transform:: # 17/17 (1 ignored, pre-existing)
79+cargo test -p ec-av1 --lib decode:: # 15/15
80+```
81+
82+## Files changed
83+- `crates/ec-av1-syntax/src/frame.rs` — `EC_AV1_TRACE` print of the 5 parsed deltas (diagnostic only, no behavior change to the syntax crate).
84+- `crates/ec-av1/src/quant.rs` — new `QuantDeltas` struct; `dequant_coeff_wh`/`dequant_wh` take `dc_delta`/`ac_delta`, added to `q_idx` before the table lookup; `dequant`/`dequant_coeff` unchanged (wrap with `0, 0`).
85+- `crates/ec-av1/src/transform.rs` — `dequant_and_inverse_typed(_wh)` take `dc_delta`/`ac_delta`; `dequant_and_inverse` (4-arg, ~20 external callers) unchanged (wraps with `0, 0`).
86+- `crates/ec-av1/src/decode.rs` — new `QUANT_DELTAS` thread-local (frame-constant, set alongside `CURRENT_Q_IDX` at both key/inter tile-decode entry points) + `plane_q_delta(plane_idx)` helper; all 8 leaf dequant call sites pass the plane-correct delta. `decode_key_frame_tile_with_cdfs`/`decode_inter_frame_tile_with_cdfs` gain a `deltas: QuantDeltas` parameter; the two convenience wrappers pass `QuantDeltas::default()`.
87+- `crates/ec-av1/src/stream.rs` — the 5 real `decode_stream` call sites now build `QuantDeltas` from `header.quantization.delta_q_*` instead of dropping them.
88+
89+## Disposition
90+- fix-now: per-plane quantizer deltas threaded end-to-end, verified against spec 7.12.2, gated by real scoped tests — this part is done and correct regardless of the 81-vs-76 outcome.
91+- deferred: the actual 81-vs-76 root cause — the charter's suspect is ruled out by measurement; next suspect (per-superblock `CURRENT_Q_IDX` drift or segmentation qindex) is named above with a concrete one-line instrumentation step, not yet run — budget spent on plumbing + honest measurement instead. Unblocks with: add the `CURRENT_Q_IDX` value to the existing `TRACE dequant` eprintln and re-run the same pinned-repro command (once the unrelated `value=4` partition gap is also worked around or the repro fixture is re-captured to a stream that doesn't hit it).
92+- deferred: the `value=4` 32x32-partition-type gap the pinned repro hits mid-stream — same shape as the r9 `dead-end` ledger entry for part32 AB; not this lane's charter, noted for whoever owns partition coverage next.