lane-av1mixloss: lossless-segment rect leaves code no tx-depth symbol (decodeframe.c:1203 precedes TX_MODE_SELECT) — 6 tx-depth readers gated, mix.obu byte-exact vs oracle
Browse files at this commit49ee9bd472e7904ff6576dc4ca072fa07ab5eae0Parent: a2a84c72 changed files +59 -6
- crates/ec-av1/src/decode.rs +31 -6
- lanes/av1mix.report.md +28 -0
crates/ec-av1/src/decode.rsmodified+31 -6
| @@ -10997,7 +10997,11 @@ fn decode_intra_rect_in_inter( | |||
| 10997 | hit!(SMOOTH_LUMA_HITS); | 10997 | hit!(SMOOTH_LUMA_HITS); |
| 10998 | } | 10998 | } |
| 10999 | let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c); | 10999 | let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c); |
| 11000 | - let depth = if fctx.tx_select_inter.with(std::cell::Cell::get) { | 11000 | + // lane-av1mixloss: the lossless-segment early return (`decodeframe.c:1203`) |
| 11001 | + // precedes `TX_MODE_SELECT`, so a lossless-segment intra-rect block inside | ||
| 11002 | + // an inter frame codes no depth symbol either (`xd->lossless` is per | ||
| 11003 | + // segment regardless of frame type; class sweep of the sub8 leaf's fix). | ||
| 11004 | + let depth = if fctx.tx_select_inter.with(std::cell::Cell::get) && !lossless(fctx) { | ||
| 11001 | // The frame's own `TXFM_CONTEXT` bands -- [`tx_size_context_txfm_rect`]. | 11005 | // The frame's own `TXFM_CONTEXT` bands -- [`tx_size_context_txfm_rect`]. |
| 11002 | let ctx = tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw.min(64), bh.min(64), fctx); | 11006 | let ctx = tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw.min(64), bh.min(64), fctx); |
| 11003 | let d = match tx_cat { | 11007 | let d = match tx_cat { |
| @@ -11585,7 +11589,11 @@ fn decode_block_rect( | |||
| 11585 | // desynced the tile from that point on. That is why both strips of the | 11589 | // desynced the tile from that point on. That is why both strips of the |
| 11586 | // pinned HORZ quadrant were wrong from their very first pixel, and why our | 11590 | // pinned HORZ quadrant were wrong from their very first pixel, and why our |
| 11587 | // range after the read equalled the oracle's range for the whole block. | 11591 | // range after the read equalled the oracle's range for the whole block. |
| 11588 | - let depth = if tx_select { | 11592 | + // lane-av1mixloss: the lossless-segment early return |
| 11593 | + // (`decodeframe.c:1203`) precedes `TX_MODE_SELECT`, so a lossless-segment | ||
| 11594 | + // rect block codes no depth symbol here either (class sweep of the sub8 | ||
| 11595 | + // leaf's fix). | ||
| 11596 | + let depth = if tx_select && !lossless(fctx) { | ||
| 11589 | // lane-av1txbands: EVERY frame now reads the real `TXFM_CONTEXT` | 11597 | // lane-av1txbands: EVERY frame now reads the real `TXFM_CONTEXT` |
| 11590 | // bands (`get_tx_size_context`, libaom `pred_common.h:342`) -- an | 11598 | // bands (`get_tx_size_context`, libaom `pred_common.h:342`) -- an |
| 11591 | // intra-only frame publishes them from every block too | 11599 | // intra-only frame publishes them from every block too |
| @@ -12101,9 +12109,16 @@ fn decode_leaf_rect( | |||
| 12101 | // filter type is the NEIGHBOUR's `uv_mode` (libaom `get_filt_type`), not | 12109 | // filter type is the NEIGHBOUR's `uv_mode` (libaom `get_filt_type`), not |
| 12102 | // a constant `false`. | 12110 | // a constant `false`. |
| 12103 | let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(leaf_mi.0, leaf_mi.1, r, c); | 12111 | let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(leaf_mi.0, leaf_mi.1, r, c); |
| 12104 | - let depth = if tx_select { | 12112 | + let depth = if tx_select && !lossless(fctx) { |
| 12105 | // lane-t900 r2 (sibling sweep): the in-inter `TXFM_CONTEXT` band read | 12113 | // lane-t900 r2 (sibling sweep): the in-inter `TXFM_CONTEXT` band read |
| 12106 | // every other rect reader now does -- a no-op on a key frame. | 12114 | // every other rect reader now does -- a no-op on a key frame. |
| 12115 | + // lane-av1mixloss: libaom `read_tx_size`'s first line | ||
| 12116 | + // (`decodeframe.c:1203`, `if (xd->lossless[segment_id]) return | ||
| 12117 | + // TX_4X4;`) precedes the `TX_MODE_SELECT` test, so a lossless-segment | ||
| 12118 | + // rect leaf codes NO depth symbol (`depth_to_tx_wh` clamps to 4x4). | ||
| 12119 | + // The mixed frame's 16x8 leaf at mi(10,0) forked exactly here: ours | ||
| 12120 | + // read `tx_size_cat1` (rng 55700->49918) where the oracle's next | ||
| 12121 | + // read was the leaf's own txb_skip. | ||
| 12107 | let ctx = tx_size_context_txfm_rect(neighbours, leaf_mi, bw, bh, fctx); | 12122 | let ctx = tx_size_context_txfm_rect(neighbours, leaf_mi, bw, bh, fctx); |
| 12108 | // lane-rectsplitx r1: `bsize_to_tx_size_cat` (libaom `blockd.h`, | 12123 | // lane-rectsplitx r1: `bsize_to_tx_size_cat` (libaom `blockd.h`, |
| 12109 | // `bsize_to_tx_size_depth_table`) is 2 for BLOCK_16X8/BLOCK_8X16, so | 12124 | // `bsize_to_tx_size_depth_table`) is 2 for BLOCK_16X8/BLOCK_8X16, so |
| @@ -12455,7 +12470,10 @@ fn decode_block_rect4( | |||
| 12455 | } else { | 12470 | } else { |
| 12456 | uv_mode | 12471 | uv_mode |
| 12457 | }; | 12472 | }; |
| 12458 | - let depth = if tx_select { | 12473 | + // lane-av1mixloss: the lossless-segment early return (`decodeframe.c:1203`) |
| 12474 | + // precedes `TX_MODE_SELECT`, so a lossless-segment rect4 block codes no | ||
| 12475 | + // depth symbol here either (class sweep of the sub8 leaf's fix). | ||
| 12476 | + let depth = if tx_select && !lossless(fctx) { | ||
| 12459 | // lane-av1txbands: EVERY frame now reads the real `TXFM_CONTEXT` | 12477 | // lane-av1txbands: EVERY frame now reads the real `TXFM_CONTEXT` |
| 12460 | // bands (`get_tx_size_context`, libaom `pred_common.h:342`) -- an | 12478 | // bands (`get_tx_size_context`, libaom `pred_common.h:342`) -- an |
| 12461 | // intra-only frame publishes them from every block too | 12479 | // intra-only frame publishes them from every block too |
| @@ -13523,7 +13541,11 @@ fn decode_rect4_16_strip( | |||
| 13523 | // TX_16X4 and `sub_tx_size_map` reaches TX_4X4 in two steps, so the | 13541 | // TX_16X4 and `sub_tx_size_map` reaches TX_4X4 in two steps, so the |
| 13524 | // depth symbol is the 3-symbol `tx_size_cat1` -- not the 2-symbol | 13542 | // depth symbol is the 3-symbol `tx_size_cat1` -- not the 2-symbol |
| 13525 | // `cat0` a 4x8 leaf reads nor the `cat2` a 32x8 strip does. | 13543 | // `cat0` a 4x8 leaf reads nor the `cat2` a 32x8 strip does. |
| 13526 | - let depth = if tx_select { | 13544 | + // lane-av1mixloss: the lossless-segment early return |
| 13545 | + // (`decodeframe.c:1203`) precedes `TX_MODE_SELECT`, so a | ||
| 13546 | + // lossless-segment strip codes no depth symbol here either (class | ||
| 13547 | + // sweep of the sub8 leaf's fix). | ||
| 13548 | + let depth = if tx_select && !lossless(fctx) { | ||
| 13527 | // lane-av1txbands: every frame reads the real `TXFM_CONTEXT` bands | 13549 | // lane-av1txbands: every frame reads the real `TXFM_CONTEXT` bands |
| 13528 | // (`get_tx_size_context`, libaom `pred_common.h:342`). | 13550 | // (`get_tx_size_context`, libaom `pred_common.h:342`). |
| 13529 | let ctx = tx_size_context_txfm_rect(neighbours, lmi, bw, bh, fctx); | 13551 | let ctx = tx_size_context_txfm_rect(neighbours, lmi, bw, bh, fctx); |
| @@ -14095,7 +14117,10 @@ fn decode_block_rect64( | |||
| 14095 | uv_mode | 14117 | uv_mode |
| 14096 | }; | 14118 | }; |
| 14097 | let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI)); | 14119 | let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI)); |
| 14098 | - let depth = if tx_select { | 14120 | + // lane-av1mixloss: the lossless-segment early return (`decodeframe.c:1203`) |
| 14121 | + // precedes `TX_MODE_SELECT`, so a lossless-segment 64-axis rect block codes | ||
| 14122 | + // no depth symbol here either (class sweep of the sub8 leaf's fix). | ||
| 14123 | + let depth = if tx_select && !lossless(fctx) { | ||
| 14099 | // lane-av1txbands: EVERY frame now reads the real `TXFM_CONTEXT` | 14124 | // lane-av1txbands: EVERY frame now reads the real `TXFM_CONTEXT` |
| 14100 | // bands (`get_tx_size_context`, libaom `pred_common.h:342`) -- an | 14125 | // bands (`get_tx_size_context`, libaom `pred_common.h:342`) -- an |
| 14101 | // intra-only frame publishes them from every block too | 14126 | // intra-only frame publishes them from every block too |
lanes/av1mix.report.mdmodified+28 -0
| @@ -62,3 +62,31 @@ | |||
| 62 | - `fix-now | deferred(lane suivante) | accepted` : le fix du drift CDF lui-même. | 62 | - `fix-now | deferred(lane suivante) | accepted` : le fix du drift CDF lui-même. |
| 63 | Unbloqué par : re-diff de l'historique d'adaptation du CDF (les valeurs des TUs 0-18 sont | 63 | Unbloqué par : re-diff de l'historique d'adaptation du CDF (les valeurs des TUs 0-18 sont |
| 64 | archivées dans les traces), puis comparaison de l'ordre d'application des updates CDF vs l'oracle. | 64 | archivées dans les traces), puis comparaison de l'ordre d'application des updates CDF vs l'oracle. |
| 65 | + | ||
| 66 | +## Diagnostic de la divergence (session r2, 24-09-2026, session Agent26-2) | ||
| 67 | + | ||
| 68 | +- Le « fork CDF » de r1 (TU#19, cdf0 23340 vs 10886) et le « mi(6,0) br=1 ctx=1 non | ||
| 69 | + adapté » du r1-bis sont tous deux des **artefacts de convention d'impression** : | ||
| 70 | + notre `EC_COEFF_STEP tag=all_zero side=` imprime la ligne `txb_skip` **pré**-adaptation | ||
| 71 | + (copie `dbg_txbskip` avant `dec.symbol`, decode.rs), l'oracle instrumenté imprime | ||
| 72 | + **post**-adaptation. 25197 = 26876 - (26876>>4) : une adaptation du même défaut neuf | ||
| 73 | + `AOM_CDF2(5892)` (32768-5892=26876). **Aucune mise à jour CDF manquante.** | ||
| 74 | +- Vrai fork : entre la lecture #151 (chroma) et le txb luma de mi(10,0), nous | ||
| 75 | + consommons **9 bits** contre **7 chez l'oracle** — un symbole `tx_size_cat1` | ||
| 76 | + en trop (rng 55700->49918, s=1) lu par `decode_leaf_rect` pour une feuille | ||
| 77 | + rect **16x8 d'un segment lossless** : le `read_tx_size` de libaom rend TX_4X4 | ||
| 78 | + AVANT le test `TX_MODE_SELECT` (decodeframe.c:1203), donc l'oracle ne code | ||
| 79 | + aucun symbole de profondeur ici. | ||
| 80 | +- Balayage de la classe : `&& !lossless(fctx)` ajouté aux lectures de profondeur | ||
| 81 | + de `decode_leaf_rect`, `decode_block_rect`, `decode_block_rect4`, | ||
| 82 | + `decode_rect4_16_strip`, `decode_block_rect64`, `decode_intra_rect_in_inter` | ||
| 83 | + (`decode_intra_sub8_leaf`, `decode_leaf_rect8`, le lecteur 128-root et | ||
| 84 | + `read_tx_size` l'avaient déjà). | ||
| 85 | +- Preuve : mix.obu (cache, non ré-encodé) — chaîne rng EC identique à l'oracle | ||
| 86 | + (9565 all_zero, 2982 eob, valeurs identiques) et **4 frames byte-exact** vs | ||
| 87 | + l'aomdec instrumenté (294912 octets, `cmp` implicite par comparaison de | ||
| 88 | + tableaux). Porte témoin `a_real_aomenc_mixed_lossless_segment_frame_decodes_ | ||
| 89 | + sample_exact` verte (3 arms, sample-exact vs ffmpeg, unités WHT comptées). | ||
| 90 | +- Instrument de session : sonde `EC_SYMR` ajoutée à | ||
| 91 | + `~/.cache/aom-oracle/src/aom_dsp/bitreader.h` (aom_read_symbol_) — arbre | ||
| 92 | + scratch hors repo. | ||