Commits
Commits on
c672fef55dba8e20dc5de0efbba75f0b0bda07c92026-08-27
fix(av1): clear apply_deblock for the GOLDEN residue, isolate to MCAhmet Kaan Gümüş · c672fef
fix(av1): clear apply_deblock for the GOLDEN residue, isolate to MC Bisected the pinned 3-pixel GOLDEN-live residue against a patched aomdec's pre/post-loop-filter frame dumps: our own decoder's luma is already wrong at those exact 3 pixels before apply_deblock runs, byte- identical to the loop filter's post-filter mismatch -- the wide deblock kernel (round 6's suspect) is cleared. All 3 pixels sit inside one skip=1 32x32 GOLDEN_FRAME NEWMV block, mv=(-7,-7) 1/8-pel (both axes fraction 2/16), REGULAR/REGULAR resolved filter -- pure MC output, no residual. The golden reference bytes that block reads are already proven bit-exact (frames 0-2 match ffmpeg), so the defect is inside mc::predict_with_filters's 2D convolution or filter-symbol resolution for this exact combination, not yet isolated further this round. Re-masked with an updated round-7 comment recording the bisect.
Merge branch 'lane-av1golden4': the GOLDEN residue pinned to 3 pixels of deblockAhmet Kaan Gümüş · 5dc880bBrowse files
fix(av1): re-derive the GOLDEN_FRAME loop-filter residue, re-mask with a pinAhmet Kaan Gümüş · d02f017
fix(av1): re-derive the GOLDEN_FRAME loop-filter residue, re-mask with a pin Un-masked decode_inter_block's GOLDEN_FRAME arm this round and re-ran the forwarding + golden-reference gates: two real aomenc streams mismatched (30-run forwarding gate: 4/30 real failures, all a real aomenc GOLDEN stream, not the documented flake). Pinned one (seed 43, frame 3 luma) as stream::tests::pinned_golden4_stream_decodes_pixel_exact (#[ignore]d) and traced it: 3 of 4096 luma pixels off by exactly +-1, all inside the loop filter's edge window at a GOLDEN_FRAME/LAST_FRAME block boundary. Hand- checked lf_level's ref_deltas/mode_deltas arithmetic against spec 7.14.4 at that edge -- it matches the default table exactly, so the residue is still open: a narrow deblock-kernel rounding defect, or a golden-side pixel one filter tap upstream. Re-narrowed the mask (decode_inter_block's GOLDEN_FRAME arm refuses by name again) and reverted a_hand_built_golden_reference_refuses_by_name to its refusal-asserting form -- no fix proven this round, but the pinned fixture and the narrowed-down suspect (deblock edge, not lf_level's own math) carry forward.
Merge branch 'lane-av1golden3': loop-filter levels stop forwarding across framesAhmet Kaan Gümüş · d86dccbBrowse files
fix(av1): loop filter level must not forward from the primary ref frameAhmet Kaan Gümüş · 3024af4
fix(av1): loop filter level must not forward from the primary ref frame read_loop_filter_params only re-reads loop_filter_level[2]/[3] (chroma) when a luma level is nonzero (spec 5.9.11); the whole LoopFilterParams struct -- including level/sharpness -- was being seeded from the primary reference frame's saved params before that read, so a frame whose own luma levels are both 0 kept the PREVIOUS frame's nonzero chroma level instead of the spec's implicit 0. Spec 7.20's load_previous only forwards ref_deltas/mode_deltas, never level/sharpness. Isolated with a pinned mismatching stream (seed 47, frame 1 chroma vs ffmpeg): bisected pre/post-deblock dumps to prove the loop filter kernel itself untouched by the bug, then a level sweep on the exact failing pixel's 6-tap window showed a threshold flip precisely between level<=2 (matches ffmpeg) and level>=3 (our observed wrong output) -- our decoder computed level=8 (carried from frame 0's key frame header) where the true value is 0. Adds an env-gated EC_AV1_GATE_DUMP pin to the forwarding gate test plus an #[ignore]d fast-reproduce test reading that pinned stream.
Merge branch 'lane-av1golden2': the GLOBALMV mode delta, and GOLDEN masked againAhmet Kaan Gümüş · a0f4d37Browse files
fix(av1): GLOBALMV loop-filter mode delta; mask GOLDEN behind its stacked defectAhmet Kaan Gümüş · ef03524
fix(av1): GLOBALMV loop-filter mode delta; mask GOLDEN behind its stacked defect lane-av1golden2 round 5. The round-4 GOLDEN flip's hand-built fixture proved the symbol path and a whole-pel skip copy -- the first real aomenc GOLDEN streams through the live arm mismatched. Symbol-trace vs a patched aomdec isolated one cause on the LAST_FRAME-reachable side: lf_level applied mode_deltas[1] to every inter block, but spec 7.14.4's mode_lf_lut maps GLOBALMV to mode_deltas[0]. Fixed by packing the GLOBALMV bit into ref_grid's sign; that moved the forwarding gate's failure from seed 42 frame 1 to seed 48 frame 3 -- at least one more stacked defect on the GOLDEN-live path, so the GOLDEN arm narrows back to a named refusal (threading kept, unread) and the hand-built fixture now asserts the mask by name instead of pixel exactness. A rare (~1/10..1/30) all-LAST mismatch on the forwarding gate remains reachable even with the mask -- present with semantics identical to the previously pushed baseline -- pinned as this lane's next round.
Merge branch 'lane-av1golden': GOLDEN references, proven by a hand-built streamAhmet Kaan Gümüş · 181baf7
Merge branch 'lane-av1golden': GOLDEN references, proven by a hand-built stream A test-only fixture hand-encodes tile bytes with the crate's own SymbolEncoder -- key frame, slot-splitting inter frame, then a block whose single_ref tree walks out to GOLDEN and copies the keyframe -- and ffmpeg decodes the same wire bytes as the truth. The refusal flips narrowly (GOLDEN only; the golden plane params turn out to have been dead code under a doc comment that claimed otherwise), and the real aomenc golden gate now passes on its own.
feat(av1): flip the GOLDEN_FRAME refusal, proven by a hand-built OBU fixtureAhmet Kaan Gümüş · 5fb6ee3
feat(av1): flip the GOLDEN_FRAME refusal, proven by a hand-built OBU fixture 120+ real aomenc attempts never produced a decodable stream that fired GOLDEN_FRAME before hitting an unrelated refusal first. A hand-built 3-frame stream (real key frame; a hand-coded intra "different content" frame refreshing LAST_FRAME's slot; a hand-coded frame whose lone block codes single_ref out to GOLDEN_FRAME and a skip zero-MV NEARESTMV) drives decode_stream directly and is cross-checked against ffmpeg's own decode of the identical wire bytes, 4 consecutive runs. decode_inter_block now threads GOLDEN_FRAME to the golden_y/u/v planes already passed to it instead of refusing every non-LAST_FRAME reference; LAST2/LAST3/BWDREF/ ALTREF2/ALTREF still refuse, unproven. intra_inter_ctx made pub(crate) so the fixture can compute the exact context the decoder does.
Merge branch 'lane-aacperf': the rate loop stops calling powfAhmet Kaan Gümüş · ec41fcd
Merge branch 'lane-aacperf': the rate loop stops calling powf 82% of encode time was libm powf inside the scalefactor search: a lookup table for q^(4/3), sqrt-composed x^0.75, and bisection over the already-monotonic noise walk take the bench row from 3.5x to 37.8x realtime with every quality test green. Also fixes the oracle test's esds parser, which scanned for a literal tag byte instead of walking the descriptor tree and false-positived on shifted bitrate bytes.
perf(aac): kill the rate loop's powf hot pathAhmet Kaan Gümüş · d08a7f7
perf(aac): kill the rate loop's powf hot path Profiling encode_frame (perf record --call-graph dwarf on a 10s real-PCM loop) showed 82% of wall time in libm's powf_fma, all reached through write_frame's cost closure -> quantise -> band_noise/quantise_one: band_noise's per-band scalefactor search called band_noise (two powf calls per coefficient) up to ~255 times per band, linearly walking every candidate level. - quantise_one's x^0.75 -> sqrt(x)*sqrt(sqrt(x)): two sqrtf beat one powf. - band_noise's q^(4/3) -> a precomputed lookup table over q's bounded (MAX_QUANT) integer range, since q is always an integer there. - the scalefactor search itself -> bisection, since the algorithm already assumed monotonic noise-vs-level to break on first overage; that's exactly what a binary search needs, and it drops ~255 candidate levels to ~8 per band. ec-bench's aac encode row: 3.54x -> 37.83x realtime (10.9x on a standalone 10s-PCM loop, matching the profiling harness). All ec-aac tests green. Also fixes crates/ec-aac/tests/oracle.rs's esds_asc helper, which scanned raw bytes for a literal 0x05 instead of walking the MPEG-4 descriptor tree by tag+length: a legitimate byte in the DecoderConfigDescriptor's avgBitrate field (which shifted with the quantiser's new floating-point path) could and did false-positive as the DecSpecificInfoTag.
Merge branch 'lane-h265prune': the depth-pruning rejection, on the recordAhmet Kaan Gümüş · 3115219
Merge branch 'lane-h265prune': the depth-pruning rejection, on the record The full threshold-sweep table and the reason no global threshold can serve both content classes live in the lane report; the code ships nothing beyond r1's early-out.
docs(h265): close lane-h265prune — depth-pruning lever rejectedAhmet Kaan Gümüş · 53b6d97
docs(h265): close lane-h265prune — depth-pruning lever rejected Round 2's SATD-proxy split pruning cleared film (<=0.02 dB) only at thresholds where screen capture still lost 0.658-0.274 dB, decaying too slowly to reach the bar before instructions win vanishes; a content-gated variant was probed with a p99/mean gradient-ratio classifier but its distributions overlap on real film/screen frames, so no threshold could be shipped without an unbuilt real-clip verification pass. Reverted to r1's merged all-zero-CBF early-out; full sweep table and reasoning in the lane report.
Merge branch 'lane-h265prune': the RQT all-zero-CBF early outAhmet Kaan Gümüş · d16dd57
Merge branch 'lane-h265prune': the RQT all-zero-CBF early out Bit-safe by construction, BD-verified flat-to-positive on the real film and screen library files; roughly one percent of instructions -- kept as a correctness-preserving simplification, honestly not a speedup. The re-pinned encode hashes reflect the intentional output change.
feat(h265): all-zero-CBF early out for the RQT split trialAhmet Kaan Gümüş · 4275e27
feat(h265): all-zero-CBF early out for the RQT split trial Mirror the CU-quadtree's existing last_cu_empty skip one level down at the transform tree: when a coding unit's luma and both chroma planes already quantised to nothing, commit it as one leaf transform unit without running the four-child split trial (which can only add split_transform_flag and mode-signalling bits on top of an SSD floor that split cannot beat). Measured neutral-to-positive, not a double-digit speedup: -0.02% instructions on a synthetic 1080p gradient/texture profile clip (the CU-level early out already catches most flat regions before this code path is reached), BD-PSNR vs x265 +0.003 dB luma / +0.004 dB YUV on a 1080p film clip and flat / +0.025 dB YUV on a 2560x1440 screen capture (both real library files, no regression on either). Kept because it's exactly the lever the charter named and is bit-safe-by-construction, not because it clears the lane's own >10%-instructions bar — flagged honestly in the report. Re-pins rdoq_cache_hash_is_pinned: this intentionally changes output on any content where the RQT trial used to flip a leaf to split.
Merge branch 'lane-av1refs': single non-LAST references, guardedAhmet Kaan Gümüş · 24a3573
Merge branch 'lane-av1refs': single non-LAST references, guarded The implementation is complete and suite-proven; the live decode stays refused until a firing stream exists -- the deblock ref-delta correction (every inter block was getting LAST's delta) rides along.
guard(av1): GOLDEN decode stays refused until a stream proves it liveAhmet Kaan Gümüş · ed5f4c7
guard(av1): GOLDEN decode stays refused until a stream proves it live The full single-non-LAST implementation stays (reference tree, MC threading, mvstack filter, deblock ref deltas), but decode_stream refuses GOLDEN narrowly again: 120 recipe attempts never produced a decodable stream that actually fires the path, and an accepted-but- unproven decode is the silent-miscode shape this repo does not ship. The gate documents the refusal and the firing hunt continues.
feat(av1): decode a single non-LAST_FRAME reference (GOLDEN_FRAME)Ahmet Kaan Gümüş · 8a443b2
feat(av1): decode a single non-LAST_FRAME reference (GOLDEN_FRAME) Round 2 continuation: read_single_ref threads the full single_ref_p1..p6 spec tree (context from the block's real above/left reference via Neighbours::above_ref/left_ref, not a bare is_inter bool), decode_inter_block threads a GOLDEN_FRAME picture down to motion compensation when the frame header's ref_frame_idx[3] names a live DPB slot, and the deblock filter's ref_frame_for_lf now indexes loop_filter_ref_deltas by the block's actual reference instead of assuming LAST_FRAME for every inter block. decode_stream widens its global-motion IDENTITY refusal to cover both LAST_FRAME and GOLDEN_FRAME's own entries, and adds a reference_select refusal (comp_mode/compound prediction stays out of scope; skip_mode is a spec-guaranteed consequence of that same refusal, not a separate check). mvstack's find_mv_stack candidate filtering and decode_inter_block8's straddling-8x8 leaf path were already ref_frame-generic/LAST-only respectively and needed no changes. Gate: a_real_aomenc_inter_sequence_with_a_golden_reference_decodes_pixel_exact (stream.rs) -- an 8-frame real-aomenc sequence with order-hint left on (the one flag the sibling CDF-forwarding test disables specifically to suppress GOLDEN_FRAME), asserting pixel-exact decode against ffmpeg whenever decode::non_last_ref_hits() actually advances. Across the attempt budgets tried this round, aomenc's RD never produced a stream that both fully decoded under this crate's existing round-2 refusals AND picked GOLDEN_FRAME -- the test SKIPs loudly rather than claim untested coverage, same pattern as its cdf-forwarding sibling. cargo test -p ec-av1 --release: 177 passed, 0 failed, 12 ignored.
Merge branch 'lane-benchr2': audio-encode, TrueHD and demux bench rowsAhmet Kaan Gümüş · c71fe36
Merge branch 'lane-benchr2': audio-encode, TrueHD and demux bench rows Seventeen new rows over real media through the crates' own decoders; also fixes ffprobe's literal N/A string silently zeroing a duration fallback chain. The slowest audio encoder on the board is now visible: aac at 3.5x realtime.
feat(bench): audio encode, container demux and TrueHD rows in ec-benchAhmet Kaan Gümüş · 4ef277a
feat(bench): audio encode, container demux and TrueHD rows in ec-bench Extends the standing perf harness with the rows the ledger owed: encode rows for opus/vorbis/aac/mp3/flac/alac/ac3 driven off real decoded PCM (a WAV fixture through ec-probe's own AudioDecoder path), a TrueHD encode+own-stream-decode round trip (no fixture exists yet for the generic decode loop to pick up), and whole-file demux throughput rows for ec-matroska/ec-mp4 via ec-probe's Reader. Also fixes a duration fallback bug: ffprobe's own "N/A" string was short-circuiting the format-duration fallback via Option::or_else.
Merge branch 'lane-av1mvweight': the real MV-stack weightsAhmet Kaan Gümüş · 7050253
Merge branch 'lane-av1mvweight': the real MV-stack weights libaom's scan weights (len * max(2, inc), threaded processed rows and columns, corner probes at 4) replace the flat per-cell approximation that was only ever right for our encoder's fixed 8-mi blocks. This closes the historic forwarding-gate flake for good -- it was candidate ordering, never aomenc nondeterminism: the pinned stream decodes 4/4 frames pixel-exact and the gate ran 20/20 clean.
fix(av1): port libaom's real MV-stack weight formula for variable block sizesAhmet Kaan Gümüş · 34a0447
fix(av1): port libaom's real MV-stack weight formula for variable block sizes decode.rs's real streams query find_mv_stack with block sizes other than tile.rs's fixed 8-mi case, where the crate's flat IMMEDIATE_WEIGHT=2 approximation silently diverged from libaom's real len*max(2,inc) row/col weight and 2*mi_size_wide[BLOCK_8X8] corner/top-right weight — producing a wrong stack order that the (already-correct) DRL index then read from, mismatching the pinned av1resid seed-44 stream at frame 3 and causing the forwarding gate's historic ~17% flake (never aomenc RD nondeterminism). Ported scan_row/scan_col into libaom's real per-block-run weight accumulation (threading processed_rows/processed_cols across the immediate and extended-offset scans the way mvref_common.c's single ints do), and fixed scan_top_right/scan_corner to libaom's fixed weight 4. tile.rs's own fixed-8 encoder path keeps its unit tests green: the REF_CAT_LEVEL threshold and scan-order effects are unchanged even though raw weight numbers now differ from the old flat approximation. Pin (av1resid-pin.obu, seed 44) now decodes 4/4 frames pixel-exact. Forwarding gate (a_real_aomenc_inter_sequence_with_cdf_forwarding_decodes_pixel_exact) ran 20 consecutive times, 0 failures. Full ec-av1 suite: 176 passed, 0 failed, 12 pre-existing ignored.
fix(av1): use the drl-selected stack entry as NEWMV's base predictorAhmet Kaan Gümüş · f5ee53b
fix(av1): use the drl-selected stack entry as NEWMV's base predictor
decode_inter_block's NEWMV arm read the drl_mode bit (when the stack has
more than one entry) but discarded it and always based the predicted MV
on stack.entries[0] -- spec 5.11.24's read_drl_idx picks RefMvIdx via up
to two drl_mode reads, and 7.10.2.10's assign_mv bases NEWMV's PredMv on
entries[RefMvIdx], not always entry 0. Ported the same idx-selection loop
NEARMV already had (mirrored in both NEWMV arms: decode_inter_block and
the leaf8 decoder). Confirmed against a patched aomdec (read_drl_idx
trace) that libaom reads the identical number of drl bits per NEWMV
stack size -- the desync was purely which entry we fed to read_mv.
Verified against the round's pinned 4-frame stream (seed 44): frames 0-2
now decode pixel-exact against ffmpeg/aomdec (frame idx2 was the
decisive divergent case -- mi_row=4,mi_col=8 NEWMV column now matches).
Frame 3 (and the pre-existing a_real_aomenc_inter_sequence_with_cdf_
forwarding flake) still mismatches -- traced to a second, real defect:
mvstack.rs's IMMEDIATE_WEIGHT=2-per-cell approximation is only tied
between above/left neighbours for the fixed bw4==bh4==8 caller the
module doc assumes (tile.rs); decode.rs calls find_mv_stack with the
leaf's real (smaller/mixed) block size, where libaom's real weight
formula (`len * max(2, inc)`, scan_row_mbmi/scan_col_mbmi,
mvref_common.c) is *not* tied -- confirmed live against a patched
libaom at mi_row=4,mi_col=8/frame 3: real weights 660 vs 668 (raw 20 vs
28), ours ties both at 8, giving the wrong stack order and hence the
wrong DRL-selected entry despite an identical drl_mode bit value. This
is the module doc's own predicted gap ("A caller with mixed block sizes
would need the real weight formula; none exists today") now confirmed
reachable and needs a dedicated port of the real weight formula --
follow-up lane, not attempted here (budget).Merge branch 'lane-av1dirchroma': directional chroma, angle deltas, the intra edge filterAhmet Kaan Gümüş · 821ba2f
Merge branch 'lane-av1dirchroma': directional chroma, angle deltas, the intra edge filter Eight rounds: the uv_mode/angle_delta reads, chroma directional prediction, the chroma tx_type derivation from Intra_Mode_To_Tx_Type, the spec-7.11.2.7-2.9 intra edge filter and upsampling, and the real fix under the final mismatch -- twenty call sites passing an empty neighbour reach into prediction. Directional-chroma gate fires and passes 4/4 pixel-exact on real aomenc bytes.
fix(av1): give intra prediction its real neighbour reach, twenty call sitesAhmet Kaan Gümüş · 0c4687e
fix(av1): give intra prediction its real neighbour reach, twenty call sites Twenty decode call sites passed Reach::none() where the block's actual top-right/bottom-left availability belonged, so directional prediction fell back to replicated corner samples wherever the true neighbours existed. Found by three-checkpoint bisect (pre-deblock/between-passes/ post-deblock) against an instrumented aomdec: the deblock-corner hypothesis died there -- the divergence entered with prediction's edge array after all. The directional-chroma gate now fires and passes 4/4; the full suite is green. The rare cross-frame chroma ±1 flake remains (1/10 runs) -- a separate open defect, not masked here.
feat(av1): implement the intra edge filter/upsample (spec 7.11.2.7-2.9)Ahmet Kaan Gümüş · 645882d
feat(av1): implement the intra edge filter/upsample (spec 7.11.2.7-2.9) r5 left directional()'s edge filter/upsample as an unimplemented corner-cut and left the two new predict() bool params half-plumbed (encode.rs call sites done, stream.rs/decode.rs test-module sites missing). This round: - finished the plumbing: decode.rs threads the sequence header's enable_intra_edge_filter through a thread-local (ENABLE_EDGE_FILTER, set once per decode_key_frame_tile_with_cdfs call, not per-block -- documented why a thread-local beats touching two dozen call sites) down to PlaneBuf::reconstruct's predict() call; stream.rs sets it from the parsed seq header; encode.rs sites already passed false (our encoder never turns it on, so round-trips stay bit-green regardless). - filter_intra_edge (5-tap kernel, 3 strength buckets via intra_edge_filter_strength's two smooth/non-smooth threshold tables), the filter_corner blend, and upsample_intra_edge (av1_upsample_intra_edge_c) were transcribed against libaom's reconintra.c and wired into directional()'s z1/z2/z3 walk (base/shift math doubled for the upsampled-density case). All present, none stubbed. - flipped the gate's --enable-intra-edge-filter=0 to =1 so a_real_aomenc_stream_with_directional_chroma_decodes_pixel_exact actually exercises the new path instead of the disabled one. The gate still fails, but NOT from this filter: patched-aomdec cross-checks (EC_UDUMP dqcoeff/pred/recon dumps, /tmp/libaom-src's decodeframe.c, not committed) prove the failing TU (chroma cpx=0/cpy=0, DC_PRED, tx_type DctDct, skip=1 both sides) reconstructs bit-identically pre-loop-filter in both decoders -- flat 128 either way, edge filter inapplicable there (no real neighbours, corner-filter's 2n>=24 gate doesn't fire at n=8). A PREDEBLOCK/POSTDEBLOCK trace (also not committed) localizes the actual divergence to apply_deblock: our decoder introduces a value our own pre-filter data does not justify at the row6-9/col6-9 TU-corner intersection, where both a horizontal and a vertical deblock edge are filtered back to back. r4/r5's "intra edge filter gap" and "tx_type path" suspects are both now falsified for this failure; the next round's target is deblock_plane's edge-intersection order/read-back (vertical-then-horizontal at a corner where an already-filtered vertical sample feeds the horizontal filter's taps). Suite: 174 passed, 1 failed (the known gate above) -- no regression from r5's own checkpoint of the same numbers; the cdffwd flake did not fire this run.
wip(av1): chroma tx_type derivation from Intra_Mode_To_Tx_Type, wires default_tx_typeAhmet Kaan Gümüş · 637d48a
wip(av1): chroma tx_type derivation from Intra_Mode_To_Tx_Type, wires default_tx_type read_coeffs already carried a default_tx_type parameter from a prior round; both call sites (read_plane's intra path and read_inter_plane's inter path) didn't pass it yet, so the tree didn't compile. Wires them: - read_plane (intra): plane_idx==0 or side>=32 -> DctDct (av1_get_tx_type, blockd.h: 64-and-up is unconditional, 32x32 chroma survives intra_mode_to_tx_type only to be re-forced by EXT_TX_SET_DCTONLY gating in av1_get_ext_tx_set_type); otherwise chroma takes default_intra_tx_type(predict_mode), a from-libaom transcription of intra_mode_to_tx_type's static table (D45_PRED is DCT_DCT, not an ADST mode -- transcribed exactly, no set-membership fallback needed since every entry the table can produce (DCT_DCT/ADST_DCT/DCT_ADST/ADST_ADST) is already inside both TX_SET_INTRA_1 and _2). - read_inter_plane: always DctDct -- Intra_Mode_To_Tx_Type only applies to an intra block's chroma plane per av1_get_tx_type's own is_inter branch. Cross-checked against a live patched aomdec (EC_CHROMA_TXTYPE trace in /tmp/libaom-src/av1/decoder/decodetxb.c, not committed here) on the lane's own seed-42 aomenc fixture: every uv_mode -> tx_type pair libaom picked for this stream's chroma matches default_intra_tx_type exactly. Suite: 174 passed, 1 failed (the new a_real_aomenc_stream_with_directional_chroma_decodes_pixel_exact) -- NOT the pre-existing cdffwd flake. Confirmed the failure predates and survives this fix: reverting default_tx_type to always-DctDct made the mismatch start at pixel row 0 (whole-plane wrong); with this fix it starts at row 6 and grows outward in a triangular fan, meaning the tx_type choice is not itself wrong (matches libaom's own choice byte-for-byte) but something downstream of it -- reconstruction/ directional-prediction propagation -- still diverges. Left failing, not silenced or adjusted, for the next round to chase with the two named suspects (intra edge filter gap, this tx_type path) now narrowed to one.
Merge branch 'lane-av1tx4': TX4 luma decode and the 1D transform classesAhmet Kaan Gümüş · 843a5a8
Merge branch 'lane-av1tx4': TX4 luma decode and the 1D transform classes Seven rounds: TX4 coefficient tables (transcription cross-verified), V_DCT/H_DCT scan orders and the class-split eob_pt CDF, the leaf8 scan-table fix, and a gate that fires the class-1 path on real aomenc bytes and decodes pixel-exact. The tx-class lesson: a transform class is a cross-cutting dimension -- scan, eob table, and context each carry it.
feat(av1): gate the V_DCT/H_DCT class-1 path on real aomenc bytesAhmet Kaan Gümüş · 5147651
feat(av1): gate the V_DCT/H_DCT class-1 path on real aomenc bytes The sub-8 refusal verdict, the fixture recipe, and a tx_class1_hits counter: a min/max-partition-8 horizontal-stripe stream fires H_DCT through the class-split eob path and decodes full-frame pixel-exact vs ffmpeg, 4/4 runs.
fix(av1): TX4/TX8 eob_pt CDF is class-split (V_DCT/H_DCT vs 2D)Ahmet Kaan Gümüş · ea55462
fix(av1): TX4/TX8 eob_pt CDF is class-split (V_DCT/H_DCT vs 2D)
libaom's av1_default_eob_multi{16,64}_cdfs carry a [2] dimension this
decoder never read: TX_CLASS_2D vs TX_CLASS_HORIZ/VERT. Read order
(all_zero -> tx_type -> eob) verified against decodetxb.c's
read_coeffs_txb; the class-1 tables transcribed from token_cdfs.h and
checked value-for-value. Wired only where TX_SET_INTRA_1 (the 7-type
set carrying V_DCT/H_DCT) is reachable: Luma4/Luma4Set1/Luma8/Luma8Set1.
Verified: full ec-av1 suite green (172 passed), and a synthetic
8x8-partition intra stream now exercises H_DCT (tx_type=3) through
read_eob's class1 branch without desyncing before an unrelated,
pre-existing refusal later in the same frame (small-partition support
is a separate gap, not this one).
Removed the scratch probe_tx4.rs example used to drive this check.fix(av1): V_DCT/H_DCT coefficient scan order + TX4 leaf8 scan table mixupAhmet Kaan Gümüş · 700543b
fix(av1): V_DCT/H_DCT coefficient scan order + TX4 leaf8 scan table mixup Two real desync causes past r3's tx-class context-derivation fix: 1. read_coeffs always read coefficients in the default zigzag scan regardless of tx_type. libaom's V_DCT/H_DCT classes use Mrow_Scan/ Mcol_Scan instead (scan.c av1_scan_orders index 10/11) -- decoded here as class_scan_table: V_DCT's class-scan is our grid's own natural row-major order (0..N), H_DCT's is that walk transposed. base_ctx/br_ctx's row/col-offset formulas (r3's fix) were already correct; only the scan order feeding position/row/col into them was wrong. 2. decode_leaf8's TX4 split loop (an 8x8 leaf's tx_depth=1 case) read its four 4x4 luma transform units with `scans.0` -- the leaf's own *8x8* scan table (64 entries) -- instead of `scans.1` (the 4x4 table), so `pos` values up to 63 got written into a 16-cell grid. Pre-existing bug, only reachable/visible once (1) stopped eating the stream earlier. 5-scale probe (examples/probe_tx4.rs, /tmp/tx4work/s*.obu) moved past every prior refusal point to new, later ones (scale 1.5 now refuses on "a directional chroma mode (round 2)" instead of an angle_delta/partition desync) -- real progress, not yet clean; next round needs the same trace-correlation to chase the remaining divergence(s). Suite green 172/172.
Merge branch 'lane-av1flake': the missing interpolation-filter familiesAhmet Kaan Gümüş · f581c0dBrowse files
feat(av1): interpolation filters beyond REGULAR, incl. per-block SWITCHABLEAhmet Kaan Gümüş · 10f24e6
feat(av1): interpolation filters beyond REGULAR, incl. per-block SWITCHABLE The ~13% decodes-but-wrong inter flake was a whole missing filter family: motion compensation always used the REGULAR subpel tables, while real encoders pick SMOOTH/SHARP per frame -- or SWITCHABLE, reading a per-block filter symbol pair this decoder never read (the silently-unread class again; our own encoder writes one fixed filter). All four table sets land in mc.rs with an aomdec-pinned unit test, the switchable_interp CDFs and neighbour context follow libaom's read_mb_interp_filter, and the filter threads from the frame header through both inter block paths. The forwarding gate ran 10/10 with zero pixel mismatches and no vacuous skips.
diag(av1): report worst pixel delta in the pinned-mismatch scratch probeAhmet Kaan Gümüş · ddd8c16
diag(av1): report worst pixel delta in the pinned-mismatch scratch probe Re-measured the cdf-forwarding gate's flake on HEAD (4/30, ~13%, matches the prior ~17% sample -- not stale). Pinned a failing stream and used scratch_isolate_pinned_mismatch to triage it: frame 2 is small (+-1, MC-rounding shape); frame 3's much larger mismatch is downstream propagation through frame 3's own inter reference to frame 2's already-wrong pixels, not a second independent defect. Added worst-delta to the probe's report so this triage doesn't need a manual pass next time. Root cause not fixed this round -- see ledger for the numeric reproduction (a 16x16 chroma block, mv=(7,15) eighth-pel, subpel xfrac=15/yfrac=7) that lands outside the previously-fixed leaf8 4-tap case, still open.
Merge branch 'lane-av1txsel': TxMode::Select intra decode, proven firingAhmet Kaan Gümüş · 0c92312
Merge branch 'lane-av1txsel': TxMode::Select intra decode, proven firing Nine rounds: tx_depth read (spec 5.11.16) with per-TU luma loops, the 7-context txb_skip rewire, the seven-type TX_SET_INTRA_1 tx_type row with V_DCT/H_DCT, and a gate that provably splits transforms on real aomenc bytes and decodes pixel-exact. Select stays refused on inter frames; resolved 4x4 luma is a named refusal.
feat(av1): the seven-type TX_SET_INTRA_1 tx_type row, V_DCT/H_DCT, gate firesAhmet Kaan Gümüş · 2411791
feat(av1): the seven-type TX_SET_INTRA_1 tx_type row, V_DCT/H_DCT, gate fires A reduced_tx_set=0 frame's 8x8-and-under intra transforms read tx_type from the seven-symbol TX_SET_INTRA_1, not the five-symbol reduced row our tables carried (the row-held-constant class, on the tx-set dimension -- our own encoder always writes reduced_tx_set=1, the same writer-never-needs-it trap as mv_hp). New set-1 CDF row, the set-1 symbol order from av1_ext_tx_inv, and the V_DCT/H_DCT inverse transforms (one-axis DCT, identity on the other). The tx-select gate now actually FIRES: mandelbrot content at min-partition 16 splits 16x16 blocks into TX8 TUs that read the set-1 rows and decode pixel-exact vs ffmpeg, 4/4 runs, no skips. Resolved 4x4 luma stays a named refusal (no TX4 coefficient tables yet).
wip(av1): finish the txb_skip 7-context rewire; find TX16 tx_type mismatchAhmet Kaan Gümüş · dcf1147
wip(av1): finish the txb_skip 7-context rewire; find TX16 tx_type mismatch Adds the luma_skip_ctx debug trace and a partition_w16 trace print (both gated behind EC_AV1_TRACE) used to bisect the pinned mb.obu stream against a fprintf-instrumented aomdec build. The 7-context txb_skip rewire itself (cdf.rs/cdf_state.rs/decode.rs, prior round) compiles and the whole ec-av1 suite is green, but the pinned stream still desyncs: tracing symbol-by- symbol against real aomdec's EC_TXBCTX/EC_TXBSKIP/EC_TXTYPE_VAL output shows the two decoders already disagree on a NON-split 16x16 block's own tx_type (mi_row=4,mi_col=0 in the second superblock quadrant: real reads tx_type=3 off a reduced 5-symbol intra set, txs_ctx=2/tx_set_type=2/eset=2; ours reads tx_type=2) -- upstream of the txb_skip multi-TU logic this round targeted, and not fixed by it. tx_size_context/get_txb_ctx_general/ SKIP_CONTEXTS were all checked byte-for-byte against libaom's av1/common/txb_common.h and match. The gate (a_real_aomenc_intra_stream_with_tx_select_decodes_pixel_exact, stream.rs) is not wired to this recipe: it still passes today only via its own soft-skip path (every attempt either refuses or never resolves a split tx_depth), so wiring it now would just turn a silent skip into the same real failure traced above. Left unwired until the tx_type mismatch is fixed.
feat(av1): read tx_depth under TxMode::Select on key framesAhmet Kaan Gümüş · ab94637
feat(av1): read tx_depth under TxMode::Select on key frames Threads a tx_select flag through decode_key_frame_tile's block walk so an intra frame using TxMode::Select reads the tx_depth symbol (cat0..3 CDFs, tx_size_context) instead of assuming TxMode::Largest, resolving to a per-TU split-luma decode path when the block's transform is smaller than its own side. A resolved 4x4 luma transform still refuses by name (no 4x4 coefficient tables yet). Narrows the old whole-stream TxMode::Select refusal to inter frames only, since decode_inter_frame's block loop does not thread tx_select yet. Adds tx_depth_hits() (before/after counter, same pattern as filter_intra_hits/deblock_hits) and a real-aomenc gate test proving a split transform actually decodes pixel-exact against ffmpeg -- currently SKIPs (no fixture recipe found in this session reliably lands a stream that both avoids this decoder's other named round-2 gaps and resolves a tx_depth split without exhausting to 4x4); it never fails, so the suite stays green while that fixture search continues. Investigated a reported suite regression on this branch first: it does not reproduce against this diff -- the cdf-forwarding inter-sequence gate (a_real_aomenc_inter_sequence_with_cdf_forwarding_decodes_pixel_exact) fails at the same ~17% rate with this diff fully reverted, confirmed over 30 stashed runs on HEAD. Pre-existing flake, not a regression.
wip(av1): Neighbours groundwork for TxMode::Select's per-TU luma contextAhmet Kaan Gümüş · 1ee1fd3
wip(av1): Neighbours groundwork for TxMode::Select's per-TU luma context record_mi_luma/record_split_luma split the existing whole-block record()/ record_mi() into a per-transform-unit luma coefficient-context write plus a once-per-block mode/side/chroma write, which a depth-selected luma transform (smaller than its own coded block) needs and the current always-full-size path does not yet exercise. Unused for now (dead_code warnings, same as the pre-existing skip_at) -- the tx_size symbol read, CDF tables, decode_block/decode_leaf8 wiring, and the stream.rs refusal narrowing are still open; see HANDOFF in the ledger.
Merge branch 'lane-av1cdffwd': cross-frame CDF forwarding, and the two bugs behind itAhmet Kaan Gümüş · ce44f72
Merge branch 'lane-av1cdffwd': cross-frame CDF forwarding, and the two bugs behind it Real inter streams (primary_ref_frame set) now decode: forwarded CDF state per reference slot with spec 7.20's counter reset, the mv_hp bits real hp streams carry (dropped as dead because our own writer never sets the flag -- the silently-unread-symbol class again), and reference pictures addressed by ref_frame_idx slot instead of a last-decode global. Gate: real aomenc inter sequences decode pixel-exact with default CDF behavior, 6/6 runs.
fix(av1): predict from the slot ref_frame_idx names, not the last decodeAhmet Kaan Gümüş · 8f9acc8
fix(av1): predict from the slot ref_frame_idx names, not the last decode The reference picture was a single global overwritten every frame; LAST_FRAME names a slot via ref_frame_idx[0], and a frame whose predecessor refreshed a different slot must keep predicting from what is still stored there. Bit-exact motion vectors into the wrong picture made a luma-only small-magnitude residue that looked like rounding. Pictures now live in the same 8-slot array discipline the CDF states already use, both stored under refresh_frame_flags. The pinned forwarding stream decodes 4/4 frames pixel-exact on every plane; the live gate ran 6/6 green with no skips.
feat(av1): read the mv_hp/class0_hp bits real hp streams carryAhmet Kaan Gümüş · e192a62
feat(av1): read the mv_hp/class0_hp bits real hp streams carry The dropped-as-dead half-pel MV CDFs (our own writer never sets allow_high_precision_mv) were silently unread on foreign streams whose headers set the flag -- every later symbol shifted one bit, the same silently-unread-symbol shape as use_filter_intra. Tables restored, reads gated on the frame header's flag, plumbed through the inter tile path. On the pinned forwarding stream frame 3's desync drops from 2618 wrong luma pixels (worst 35) to 541 (all within 1, chroma exact) -- entropy now aligned, a luma-only reconstruction residue remains.
debug(av1): env-gated dump of frame-2 saved CDF tables, decisive negative resultAhmet Kaan Gümüş · a45ccae
debug(av1): env-gated dump of frame-2 saved CDF tables, decisive negative result EC_AV1_DUMP_TABLES dumps the reference-slot CDF tables a frame saves (partition_w64/w32/w16, skip, new_mv, zero_mv, ref_mv, mv_joint) in the spec's cumulative-probability orientation. Cross-checked against a matching libaom decodeframe.c dump (converting its inverted icdf storage back to the same orientation) on the pinned cdffwd stream: frame 2's saved tables are byte-identical between the two decoders across every table sampled. This falsifies the CDF-forwarding hypothesis (stale/never-adapted forwarded table, specifically the gathered-partition-never-adapted theory) for the frame-3 partition_w32[ctx=8] divergence — the bug is elsewhere (context computation entering frame 3, an untabled CDF, or an actual bitstream desync inside frame 3 itself). Also confirmed by libaom source (bitreader.h aom_read_symbol_ vs aom_read_cdf_) that libaom's own gathered partition reads never call update_cdf on the full table either, matching our symbol_fixed's behavior -- the gathered-adaptation theory was wrong on both sides independently.
test(av1): trace inter-block mv/skip; restructure the cdf-forwarding gate as a seed loopAhmet Kaan Gümüş · 82a96d2
test(av1): trace inter-block mv/skip; restructure the cdf-forwarding gate as a seed loop decode_inter_block now prints its skip/mv/is_new_mv decision under EC_AV1_TRACE, matching the key-frame path's existing tracing -- needed to diff against an instrumented aomdec when chasing the cdf-forwarding mismatch (still open: pinned streams show frame N+1's second same-context partition_w32 read choosing a different split than aomdec once frame N's forwarded, count-reset table has adapted through one prior read at that context, implying the forwarded state itself already differs going into the frame -- root cause not yet found). The cdf-forwarding gate now retries several aomenc seeds (RD is non-deterministic run to run) and requires the first stream that decodes to be pixel-exact, rather than depending on one fixed seed's RD choice.
fix(av1): reset every CDF's symbol counter before saving it forwardAhmet Kaan Gümüş · 6404564
fix(av1): reset every CDF's symbol counter before saving it forward Spec 7.20 save_cdfs (libaom av1_reset_cdf_symbol_counters, entropy.c) zeroes each table's adaptation-rate counter before storing the tile's end-of-tile state into a reference slot for cross-frame forwarding -- the probabilities carry forward, the counts do not. This decoder was forwarding the raw counts, so every table an inter frame resumed from adapted faster than the real decoder's for the rest of that frame: too small a drift to flip a symbol after one hop, but compounding across two into a genuine desync (a pinned aomenc stream showed frame 0/1 pixel-exact, then ~60% of frame 2's luma wrong by +-1 once the drift caught up). crates/ec-av1/src/cdf_state.rs adds Cdfs::reset_counts (and the MvComponentCdfs half it delegates to), zeroing the last entry of every adapting array without touching its probabilities. crates/ec-av1/src/stream.rs calls it on the saved (non- disable_frame_end_update_cdf) branch only, matching libaom's REFRESH_ FRAME_CONTEXT_BACKWARD path; the disable_frame_end_update_cdf branch already stores the untouched loaded state, which needs no reset. The forwarding-gate test is still flaky, but no longer on this bug: a 20-run sample after the fix shows zero pixel-mismatch failures (the class this commit targets); every failure left is a variant of the same pre-existing, already-documented round-2 refusal (aomenc's RD search occasionally choosing a reference other than LAST_FRAME or a partition/tx-type this decoder does not model), unaffected by CDF state. Full `cargo test -p ec-av1 --release` here: 170 passed, 1 failed (that same refusal), 12 ignored.
feat(truehd): a lossless stereo encoder, foreign-decoder verifiedAhmet Kaan Gümüş · c3703cb
feat(truehd): a lossless stereo encoder, foreign-decoder verified Adds TrueHdEncoder: single-substream stereo, one restart header per access unit, no matrixing or FIR/IIR prediction — every sample is a raw 24-bit offset-binary residual, which the crate's own decoder reconstructs exactly. Round-trips bit-exact through both this crate's own decoder and, decisively, ffmpeg's independent TrueHD/MLP decoder (the major sync's CRC-16 and the AU-header/directory parity nibble, neither validated by our own decoder, had to be derived from ffmpeg's mlp.c/mlp_parse.c/mlpdec.c source to satisfy a foreign decoder).
Merge branch 'lane-av1interpart': GLOBALMV, and the inter gap namedAhmet Kaan Gümüş · ca633b0Browse files
feat(av1): GLOBALMV under identity warp; the real inter gap was CDF forwardingAhmet Kaan Gümüş · 74ed1bd
feat(av1): GLOBALMV under identity warp; the real inter gap was CDF forwarding The 'partition type' refusal on real inter streams was misattributed: the tile's first partition symbol came back out-of-alphabet because a real encoder's inter frame loads its initial CDF state from the previous frame's adapted tables (primary_ref_frame + load_cdfs, spec 7.20) and this decoder starts every frame from the spec defaults. The deblocked inter-sequence gate now encodes with error-resilient frames (primary_ref_frame = NONE, a shape real low-latency encodes use) and decodes pixel-exact. GLOBALMV decodes as the zero vector under the IDENTITY warp model, with a named refusal for any other model.