forge
Explore
Log in

Don't you dare go Hollow

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 commit

9c0a4a27bac71eb3fffbd1b272c55df6beebec90Ahmet Kaan GümüşParent: 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
Show full message
fix(av1): 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
crates/ec-av1/src/decode.rsmodified+29 -6
@@ -34443,6 +34443,10 @@ pub(crate) fn decode_inter_frame_tile(
3444334443 interp_fixed: Option<mc::InterpFilterKind>,
3444434444 enable_dual_filter: bool,
3444534445 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,
3444634450 // This frame header's `tx_mode == TxMode::Select`: `Encoded::tx_select`.
3444734451 // Hard-coding `false` here desynced at the first `tx_depth` symbol once
3444834452 // inter frames coded Select by default (class: test asserts against a
@@ -34463,7 +34467,7 @@ pub(crate) fn decode_inter_frame_tile(
3446334467 decode_inter_frame_tile_lr(
3446434468 data, mi_cols, mi_rows, base_q_idx, frame_width, frame_height, refpix, cdef,
3446534469 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,
3446734471 &LoopRestorationParams::default(), initial_cdfs, NO_SIGN_BIAS, false,
3446834472 // `enable_filter_intra`: as the `false`s beside it, this convenience
3446934473 // entry names a stream written without the sequence bit (lane-fintra).
@@ -34489,6 +34493,15 @@ pub(crate) fn decode_inter_frame_tile_lr(
3448934493 interp_fixed: Option<mc::InterpFilterKind>,
3449034494 enable_dual_filter: bool,
3449134495 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,
3449234505 tx_select: bool,
3449334506 lr: &LoopRestorationParams,
3449434507 initial_cdfs: Option<Cdfs>,
@@ -34546,9 +34559,9 @@ pub(crate) fn decode_inter_frame_tile_lr(
3454634559 interp_fixed,
3454734560 enable_dual_filter,
3454834561 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,
3455234565 tx_select,
3455334566 lr,
3455434567 initial_cdfs,
@@ -38784,6 +38797,9 @@ mod tests {
3878438797 Some(mc::InterpFilterKind::Regular),
3878538798 false,
3878638799 false,
38800+ // The fixture's own implied header codes the reduced sets (the
38801+ // wrapper's old hardcoded value).
38802+ true,
3878738803 false,
3878838804 None,
3878938805 false,
@@ -39277,6 +39293,12 @@ mod tests {
3927739293 // `false` (stale-header class -- a `reference_select` stream
3927839294 // reads a `comp_mode` symbol this decode would skip).
3927939295 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,
3928039302 frame.tx_select,
3928139303 &frame.loop_restoration,
3928239304 Some(frame.start_cdfs.0.clone()),
@@ -39619,9 +39641,10 @@ mod tests {
3961939641 // The encoder's own `reference_select` (spec 5.9.22): these
3962039642 // GOP round trips decode a tile the ENCODER wrote, so the
3962139643 // 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).
3962439644 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,
3962539648 frame.tx_select,
3962639649 &frame.loop_restoration,
3962739650 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
17971797 tx_select: encoded.tx_select,
17981798 switchable_motion_mode: encoded.switchable_motion_mode,
17991799 screen: encoded.screen,
1800+ reduced_tx_set: encoded.reduced_tx_set,
18001801 start_cdfs: encoded.start_cdfs.clone(),
18011802 next_cdfs: encoded.next_cdfs.clone(),
18021803 loop_filter: encoded.loop_filter,
@@ -1883,6 +1884,14 @@ pub struct Encoded {
18831884 /// palette-mode symbols under it, so a raw tile decode that guessed
18841885 /// `false` would desync at the first block (same class as `tx_select`).
18851886 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,
18861895 /// This frame header's chosen loop restoration parameters, threaded for
18871896 /// the same reason as `loop_filter` -- and doubly so: the per-unit
18881897 /// filters themselves are coded in `tile`, so a decode of it under a
@@ -8873,6 +8882,7 @@ pub(crate) fn encode_key_frame_inner(
88738882 // A key frame codes no inter block, so no motion_mode symbol.
88748883 switchable_motion_mode: false,
88758884 screen,
8885+ reduced_tx_set: header.reduced_tx_set,
88768886 next_cdfs: start_cdfs.clone(),
88778887 start_cdfs,
88788888 loop_filter: header.loop_filter,
@@ -12609,7 +12619,7 @@ pub(crate) fn encode_inter_frame(
1260912619 // `Cdfs` then reads for every luma `tx_type` symbol.
1261012620 header.reduced_tx_set = !wide_tx_set(screen);
1261112621 // 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
1261312623 // `recode_inter_chroma`, and every inter decode helper the search's own
1261412624 // trial decode shares) must carry THIS frame's bit, not whatever the
1261512625 // previous frame's trial decode last left in the shared cell -- a stale
@@ -14110,6 +14120,7 @@ pub(crate) fn encode_inter_frame(
1411014120 tx_select,
1411114121 switchable_motion_mode,
1411214122 screen,
14123+ reduced_tx_set: header.reduced_tx_set,
1411314124 start_cdfs,
1411414125 next_cdfs,
1411514126 loop_filter: header.loop_filter,
crates/ec-av1/src/stream.rsmodified+5 -2
@@ -3035,8 +3035,11 @@ pub(crate) mod tests {
30353035 &encoded.cdef,
30363036 &encoded.loop_filter,
30373037 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,
30403043 // `allow_screen_content_tools` off the frame the encoder
30413044 // actually wrote: a screen-content picture codes two palette
30423045 // symbols per intra block, and a raw tile decode that guessed
lanes/intertx.report.mdmodified+66 -2
@@ -1,7 +1,7 @@
11 # lane-intertx — the inter tx-type search on film (chroma inheritance made honest)
22
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**
55 (`crate::speed::TX_TYPE_SEARCH_INTER` keeps `Screen` at presets 0-6; the keep
66 rule's deciding column fails at best -0.1 against the required -0.5), but the
77 lane's correctness work is real and committed: the chroma inheritance desync
@@ -192,3 +192,67 @@ ok, both pins byte-identical.
192192 + tests compile warning-free; the three tx witnesses; the pin test) and
193193 project-wide validation stays with the main agent. `FLIPADST` family and
194194 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.