The raw-tile inter decode wrapper takes the frame's own reduced_tx_set instead of guessing true -- the widened inter search made the bit chroma-relevant (a screen GOP's inter luma takes V_DCT and the chroma inheritance reduces against this exact bit, so the GOP round-trip tests desynced and surfaced the empty-ref-slot refusal), Encoded carries the bit and the GOP and key-frame tile tests pass it
Browse files at this commit9c0a4a27bac71eb3fffbd1b272c55df6beebec90Parent: 333651f- fix
- the raw-tile inter decode wrapper takes the frame's own reduced_tx_set instead of guessing true -- the widened inter search made the bit chroma-relevant (a screen GOP's inter luma takes V_DCT and the chroma inheritance reduces against this exact bit, so the GOP round-trip tests desynced and surfaced the empty-ref-slot refusal), Encoded carries the bit and the GOP and key-frame tile tests pass it
- encoder output is byte-identical (witnesses re-run at 8143/8211 bytes), the three tests plus pins are green and the full three-lane suite reads 592 passed / 0 failed
4 changed files +112 -11
- crates/ec-av1/src/decode.rs +29 -6
- crates/ec-av1/src/encode.rs +12 -1
- crates/ec-av1/src/stream.rs +5 -2
- lanes/intertx.report.md +66 -2
crates/ec-av1/src/decode.rsmodified+29 -6
| @@ -34443,6 +34443,10 @@ pub(crate) fn decode_inter_frame_tile( | ||
| 34443 | 34443 | interp_fixed: Option<mc::InterpFilterKind>, |
| 34444 | 34444 | enable_dual_filter: bool, |
| 34445 | 34445 | reference_select: bool, |
| 34446 | + // lane-intertx: this frame header's own `reduced_tx_set` (spec 5.9.2) -- | |
| 34447 | + // see [`decode_inter_frame_tile_lr`]'s parameter. Same stale-header | |
| 34448 | + // class as `tx_select` below. | |
| 34449 | + reduced_tx_set: bool, | |
| 34446 | 34450 | // This frame header's `tx_mode == TxMode::Select`: `Encoded::tx_select`. |
| 34447 | 34451 | // Hard-coding `false` here desynced at the first `tx_depth` symbol once |
| 34448 | 34452 | // inter frames coded Select by default (class: test asserts against a |
| @@ -34463,7 +34467,7 @@ pub(crate) fn decode_inter_frame_tile( | ||
| 34463 | 34467 | decode_inter_frame_tile_lr( |
| 34464 | 34468 | data, mi_cols, mi_rows, base_q_idx, frame_width, frame_height, refpix, cdef, |
| 34465 | 34469 | loop_filter, allow_high_precision_mv, force_integer_mv, interp_fixed, |
| 34466 | - enable_dual_filter, reference_select, tx_select, | |
| 34470 | + enable_dual_filter, reference_select, reduced_tx_set, tx_select, | |
| 34467 | 34471 | &LoopRestorationParams::default(), initial_cdfs, NO_SIGN_BIAS, false, |
| 34468 | 34472 | // `enable_filter_intra`: as the `false`s beside it, this convenience |
| 34469 | 34473 | // entry names a stream written without the sequence bit (lane-fintra). |
| @@ -34489,6 +34493,15 @@ pub(crate) fn decode_inter_frame_tile_lr( | ||
| 34489 | 34493 | interp_fixed: Option<mc::InterpFilterKind>, |
| 34490 | 34494 | enable_dual_filter: bool, |
| 34491 | 34495 | reference_select: bool, |
| 34496 | + // lane-intertx: this frame header's own `reduced_tx_set` (spec 5.9.2). | |
| 34497 | + // The wrapper used to hard-code `true` ("the tests all code the reduced | |
| 34498 | + // sets") -- true until the widened inter search put 1-D/DTT types on | |
| 34499 | + // `reduced_tx_set = 0` frames' inter luma, whose CHROMA then inherits | |
| 34500 | + // the type against this very bit | |
| 34501 | + // ([`reduce_inherited_chroma_tx_type`]): guessing `true` mis-derives | |
| 34502 | + // every inherited chroma type and desyncs the tile (class: test asserts | |
| 34503 | + // against a stale header, next instance). | |
| 34504 | + reduced_tx_set: bool, | |
| 34492 | 34505 | tx_select: bool, |
| 34493 | 34506 | lr: &LoopRestorationParams, |
| 34494 | 34507 | initial_cdfs: Option<Cdfs>, |
| @@ -34546,9 +34559,9 @@ pub(crate) fn decode_inter_frame_tile_lr( | ||
| 34546 | 34559 | interp_fixed, |
| 34547 | 34560 | enable_dual_filter, |
| 34548 | 34561 | reference_select, |
| 34549 | - // lane-txi: this wrapper's callers are the decoder's own tests, which | |
| 34550 | - // all code the reduced sets. | |
| 34551 | - true, | |
| 34562 | + // lane-intertx: this frame's own bit, not the hardcoded `true` -- | |
| 34563 | + // see the parameter's note above. | |
| 34564 | + reduced_tx_set, | |
| 34552 | 34565 | tx_select, |
| 34553 | 34566 | lr, |
| 34554 | 34567 | initial_cdfs, |
| @@ -38784,6 +38797,9 @@ mod tests { | ||
| 38784 | 38797 | Some(mc::InterpFilterKind::Regular), |
| 38785 | 38798 | false, |
| 38786 | 38799 | false, |
| 38800 | + // The fixture's own implied header codes the reduced sets (the | |
| 38801 | + // wrapper's old hardcoded value). | |
| 38802 | + true, | |
| 38787 | 38803 | false, |
| 38788 | 38804 | None, |
| 38789 | 38805 | false, |
| @@ -39277,6 +39293,12 @@ mod tests { | ||
| 39277 | 39293 | // `false` (stale-header class -- a `reference_select` stream |
| 39278 | 39294 | // reads a `comp_mode` symbol this decode would skip). |
| 39279 | 39295 | crate::encode::reference_select(), |
| 39296 | + // lane-intertx: this frame's own `reduced_tx_set` -- the | |
| 39297 | + // bit the chroma inheritance reduces against. The wrapper | |
| 39298 | + // used to guess `true`, which mis-derived every inherited | |
| 39299 | + // chroma type on a screen frame's widened inter blocks | |
| 39300 | + // (stale-header class). | |
| 39301 | + frame.reduced_tx_set, | |
| 39280 | 39302 | frame.tx_select, |
| 39281 | 39303 | &frame.loop_restoration, |
| 39282 | 39304 | Some(frame.start_cdfs.0.clone()), |
| @@ -39619,9 +39641,10 @@ mod tests { | ||
| 39619 | 39641 | // The encoder's own `reference_select` (spec 5.9.22): these |
| 39620 | 39642 | // GOP round trips decode a tile the ENCODER wrote, so the |
| 39621 | 39643 | // header bit must be the one it wrote, not a hard-coded |
| 39622 | - // `false` (stale-header class -- a `reference_select` stream | |
| 39623 | - // reads a `comp_mode` symbol this decode would skip). | |
| 39624 | 39644 | crate::encode::reference_select(), |
| 39645 | + // lane-intertx: the frame's own `reduced_tx_set` -- see the | |
| 39646 | + // first GOP round trip's note. | |
| 39647 | + frame.reduced_tx_set, | |
| 39625 | 39648 | frame.tx_select, |
| 39626 | 39649 | &frame.loop_restoration, |
| 39627 | 39650 | Some(frame.start_cdfs.0.clone()), |
crates/ec-av1/src/encode.rsmodified+12 -1
| @@ -1797,6 +1797,7 @@ pub(crate) fn crop_encoded(encoded: &Encoded, width: usize, height: usize) -> En | ||
| 1797 | 1797 | tx_select: encoded.tx_select, |
| 1798 | 1798 | switchable_motion_mode: encoded.switchable_motion_mode, |
| 1799 | 1799 | screen: encoded.screen, |
| 1800 | + reduced_tx_set: encoded.reduced_tx_set, | |
| 1800 | 1801 | start_cdfs: encoded.start_cdfs.clone(), |
| 1801 | 1802 | next_cdfs: encoded.next_cdfs.clone(), |
| 1802 | 1803 | loop_filter: encoded.loop_filter, |
| @@ -1883,6 +1884,14 @@ pub struct Encoded { | ||
| 1883 | 1884 | /// palette-mode symbols under it, so a raw tile decode that guessed |
| 1884 | 1885 | /// `false` would desync at the first block (same class as `tx_select`). |
| 1885 | 1886 | pub(crate) screen: bool, |
| 1887 | + /// This frame header's own `reduced_tx_set` (spec 5.9.2) -- the bit that | |
| 1888 | + /// picks the inter `tx_type` alphabets AND, on an inter block, the | |
| 1889 | + /// allowance the chroma transform's inherited type reduces against | |
| 1890 | + /// ([`crate::decode::reduce_inherited_chroma_tx_type`]). A raw tile | |
| 1891 | + /// decode that guesses `true` here mis-derives every inherited chroma | |
| 1892 | + /// type on a `reduced_tx_set = 0` frame (lane-intertx; same class as | |
| 1893 | + /// `tx_select`/`screen` above). | |
| 1894 | + pub(crate) reduced_tx_set: bool, | |
| 1886 | 1895 | /// This frame header's chosen loop restoration parameters, threaded for |
| 1887 | 1896 | /// the same reason as `loop_filter` -- and doubly so: the per-unit |
| 1888 | 1897 | /// filters themselves are coded in `tile`, so a decode of it under a |
| @@ -8873,6 +8882,7 @@ pub(crate) fn encode_key_frame_inner( | ||
| 8873 | 8882 | // A key frame codes no inter block, so no motion_mode symbol. |
| 8874 | 8883 | switchable_motion_mode: false, |
| 8875 | 8884 | screen, |
| 8885 | + reduced_tx_set: header.reduced_tx_set, | |
| 8876 | 8886 | next_cdfs: start_cdfs.clone(), |
| 8877 | 8887 | start_cdfs, |
| 8878 | 8888 | loop_filter: header.loop_filter, |
| @@ -12609,7 +12619,7 @@ pub(crate) fn encode_inter_frame( | ||
| 12609 | 12619 | // `Cdfs` then reads for every luma `tx_type` symbol. |
| 12610 | 12620 | header.reduced_tx_set = !wide_tx_set(screen); |
| 12611 | 12621 | // lane-intertx, desync (a): the frame context this value is read back |
| 12612 | - // through ( [`decode::reduce_inherited_chroma_tx_type`] inside | |
| 12622 | + // through ([`decode::reduce_inherited_chroma_tx_type`] inside | |
| 12613 | 12623 | // `recode_inter_chroma`, and every inter decode helper the search's own |
| 12614 | 12624 | // trial decode shares) must carry THIS frame's bit, not whatever the |
| 12615 | 12625 | // previous frame's trial decode last left in the shared cell -- a stale |
| @@ -14110,6 +14120,7 @@ pub(crate) fn encode_inter_frame( | ||
| 14110 | 14120 | tx_select, |
| 14111 | 14121 | switchable_motion_mode, |
| 14112 | 14122 | screen, |
| 14123 | + reduced_tx_set: header.reduced_tx_set, | |
| 14113 | 14124 | start_cdfs, |
| 14114 | 14125 | next_cdfs, |
| 14115 | 14126 | loop_filter: header.loop_filter, |
crates/ec-av1/src/stream.rsmodified+5 -2
| @@ -3035,8 +3035,11 @@ pub(crate) mod tests { | ||
| 3035 | 3035 | &encoded.cdef, |
| 3036 | 3036 | &encoded.loop_filter, |
| 3037 | 3037 | encoded.tx_select, |
| 3038 | - // Our own encoder always writes `reduced_tx_set: true`. | |
| 3039 | - true, | |
| 3038 | + // lane-intertx: the frame's own `reduced_tx_set` -- a screen | |
| 3039 | + // key frame at preset 0 codes the wider intra alphabets, so | |
| 3040 | + // the old hardcoded `true` (ours "always" wrote true) is a | |
| 3041 | + // stale-header bug waiting for the first screen fixture. | |
| 3042 | + encoded.reduced_tx_set, | |
| 3040 | 3043 | // `allow_screen_content_tools` off the frame the encoder |
| 3041 | 3044 | // actually wrote: a screen-content picture codes two palette |
| 3042 | 3045 | // symbols per intra block, and a raw tile decode that guessed |
lanes/intertx.report.mdmodified+66 -2
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | # lane-intertx — the inter tx-type search on film (chroma inheritance made honest) |
| 2 | 2 | |
| 3 | -Base: `810d8972` (charter). Fix commit: `9af60b4d`. Report commit: this one. | |
| 4 | -Disposition: **stays-off** — the `InterTxSearch::All` lever does NOT ship | |
| 3 | +Base: `810d8972` (charter). Fix commit: `9af60b4d`. Regression fix + report | |
| 4 | +commit: this one. Disposition: **stays-off** | |
| 5 | 5 | (`crate::speed::TX_TYPE_SEARCH_INTER` keeps `Screen` at presets 0-6; the keep |
| 6 | 6 | rule's deciding column fails at best -0.1 against the required -0.5), but the |
| 7 | 7 | lane's correctness work is real and committed: the chroma inheritance desync |
| @@ -192,3 +192,67 @@ ok, both pins byte-identical. | ||
| 192 | 192 | + tests compile warning-free; the three tx witnesses; the pin test) and |
| 193 | 193 | project-wide validation stays with the main agent. `FLIPADST` family and |
| 194 | 194 | the 1-D ADSTs remain unoffered (the standing lane-txi deferral). |
| 195 | + | |
| 196 | +## 7. Regression caught by the merge tier: the raw-tile decode wrapper's | |
| 197 | +## stale `reduced_tx_set` | |
| 198 | + | |
| 199 | +Main's regression tier caught three `decode::tests` failures on the lane | |
| 200 | +HEAD (`a_gop_round_trips_bit_exact_against_the_encoder_reconstruction`, | |
| 201 | +`an_odd_size_gop_round_trips_bit_exact_against_the_encoder_reconstruction`, | |
| 202 | +`ffmpeg_and_this_decoder_agree_on_a_gop`), all refusing with "a reference | |
| 203 | +frame selected with no picture at this frame's own ref_frame_idx slot". | |
| 204 | + | |
| 205 | +Root cause (class: **test asserts against a stale header** -- the wrapper's | |
| 206 | +own parameter docs document five prior instances of exactly this class): | |
| 207 | +`decode::decode_inter_frame_tile_lr`, the raw-tile decode helper the GOP | |
| 208 | +round-trip tests use, hard-coded `reduced_tx_set: true` | |
| 209 | +(`decode.rs:34552` at the fix commit's parent) with the comment "this | |
| 210 | +wrapper's callers are the decoder's own tests, which all code the reduced | |
| 211 | +sets". True until this lane: no inter block ever inherited a non-`DCT_DCT` | |
| 212 | +chroma type. With the widened inter search live, a screen-detected GOP at | |
| 213 | +the default preset codes `reduced_tx_set = 0` frames whose inter luma takes | |
| 214 | +`V_DCT` (the traces show the first inter block at (0,0) 16x16 winning | |
| 215 | +exactly that), and the chroma inheritance reduces the inherited type | |
| 216 | +against the very bit the wrapper guessed: the test's decode derived | |
| 217 | +`DCT_DCT` from `inh=Some(V_DCT)` at chroma 8x8 where the writer coded | |
| 218 | +`V_DCT`, desynced, and the garbage symbols eventually read a ref_frame_idx | |
| 219 | +that names an empty slot -- the named refusal is downstream noise, the | |
| 220 | +first divergence is the chroma type. | |
| 221 | + | |
| 222 | +Fix (this commit): the wrapper takes the frame's own | |
| 223 | +`reduced_tx_set: bool` (placed before `tx_select`, mirroring the plural | |
| 224 | +fn), `Encoded` carries the bit (`encode.rs`, the `screen`/`tx_select` | |
| 225 | +pattern), the GOP tests and the key-frame tile test (`stream.rs`, whose | |
| 226 | +"our own encoder always writes `reduced_tx_set: true`" comment had the | |
| 227 | +same latent stale-header bug) pass the honest value. | |
| 228 | + | |
| 229 | +Why the gates and witnesses did not see it: every production decode path | |
| 230 | +(`stream.rs`'s parser, `decode_stream`, ffmpeg) reads the bit off the wire | |
| 231 | +honestly -- the gates' three-way exactness and all witnesses ride those. | |
| 232 | +Only the raw-tile test helper guessed. | |
| 233 | + | |
| 234 | +Encoder output is UNCHANGED by the fix: the diff touches the `Encoded` | |
| 235 | +metadata struct, the test-facing decode wrappers and one test call -- no | |
| 236 | +writer or search code (tile.rs is not in the fix diff at all), and the | |
| 237 | +three witnesses code byte-identical streams after it (8143 / 8211 bytes, | |
| 238 | +same census). The server-1 BD tables in sections 2-4 remain valid; no gate | |
| 239 | +re-run needed. | |
| 240 | + | |
| 241 | +EVIDENCE: ~/.cache/intertx/regression-repro.log | the three tests on the | |
| 242 | +unfixed lane HEAD | 3 failed, all with the named refusal. | |
| 243 | +EVIDENCE: ~/.cache/intertx/regression-fix.log | the three tests + the pin | |
| 244 | +test after the fix | 4 passed. | |
| 245 | +EVIDENCE: ~/.cache/intertx/witness-rerun.log | all three tx witnesses | |
| 246 | +re-run after the fix | byte-identical streams (8143 / 8211 bytes), ok. | |
| 247 | + | |
| 248 | +## 8. Full suite and workspace check (post-fix) | |
| 249 | + | |
| 250 | +Three-lane lib suite LOCALLY on the fix commit, `--release --lib`: | |
| 251 | +`--skip stream::` 348 passed / 0 failed; `stream:: --skip 10bit` 202 | |
| 252 | +passed / 0 failed; `10bit` 42 passed / 0 failed -- **592 passed, 0 | |
| 253 | +failed**. `timeout 900 cargo check --workspace --all-targets -j4`: 0 | |
| 254 | +ec-av1 warnings (the 25 workspace warnings are ec-opus's, pre-existing). | |
| 255 | + | |
| 256 | +EVIDENCE: ~/.cache/intertx/suite-lane1.log | --skip stream:: | 348 passed. | |
| 257 | +EVIDENCE: ~/.cache/intertx/suite-lane2.log | stream:: --skip 10bit | 202 passed. | |
| 258 | +EVIDENCE: ~/.cache/intertx/suite-lane3.log | 10bit | 42 passed. |