edith_codecs
Clone
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
lane-kf1200 r1 — the 16x4/4x16 chroma pair read its edge-filter type from the wrong mi
Defect (census4 premise, re-measured on this branch)
ReelB -ss 1200 key frame (1 frame, 3840x1608 yuv420p10le), our
EC_PROBE_OUT16 vs ffmpeg -pix_fmt yuv420p10le: 12 U samples at ±1, Y and V exact.
Stage bisect (EC_AV1_PREFILT_DUMP16 ours vs aomdec's): 13 U samples already wrong
before the loop filter — a reconstruction defect, not deblock/CDEF/LR/film grain, and
not an entropy desync (lane-kf900's shape).
Root cause
Block: chroma (x=352, y=356), 8x4, uv_mode = H_PRED, angle_delta_uv = -2
(p_angle = 174), the chroma half of a 16x8 PARTITION_HORZ_4 pair at
luma mi (178,176), strip mi (179,176).
Its prediction differed from aomdec's by 4 samples of the last row
(OUR_PRED sum=16208 vs EC_PREDOUT sum=16212); row 0 and column 0 identical.
decode.rs:7683 asked for the chroma edge-filter type at the strip's own mi
(lmi = (179,176)). libaom builds chroma_above_mbmi/chroma_left_mbmi from
mi[-((mi_row & ss_y) * mi_stride + (mi_col & ss_x))] (set_mi_offsets,
av1/common/blockd.h), i.e. from the pair's base mi (178,176), and
get_intra_edge_filter_type (av1/common/reconintra.c:974) reads that block's
uv_mode. The mi directly above the strip, (178,176), is a non-chroma-reference
4-row block whose uv_mode is UV_DC_PRED; the mi above the PAIR, (177,176),
coded uv_mode = SMOOTH (aomdec EC_IMODE_VAL mi_row=177 mi_col=176 uv_mode=9).
So we computed filt_type = 0 where libaom has 1 (aomdec EC_PRED ... ft=1).
With filt_type = 0, av1_use_intra_edge_upsample(4, 8, -6, 0) is TRUE
(blk_wh = 12 <= 16) instead of false — the left edge was upsampled before the
z2 walk, moving 4 samples by 1. The strength/upsample/z2 code itself is correct:
recomputing z2 by hand from the (identical) neighbour pixels reproduces aomdec's
row exactly (scratchpad/kf1200, brute force over dy/offsets).
Change
crates/ec-av1/src/decode.rs:7683—smooth_uv_neighbour(pair_mi.0, pair_mi.1, ...)instead of(lmi.0, lmi.1, ...), with the libaom citation.crates/ec-av1/src/decode.rs:2196— newRECT4_16_UV_PAIR_FILT_HITScounter +rect4_16_uv_pair_filt_hits(): pairs where the pair-base answer DIFFERS from the strip-mi answer, i.e. the blocks the fix changes.crates/ec-av1/src/stream.rsgatea_real_aomenc_stream_with_a_16_level_1to4_partition_decodes_pixel_exact— the odd attempts now use a chroma-carrying source (smoothcb/crgradients); the gray source left both chroma planes constant, so everyuv_modewas DC and the shape was unreachable. New hard assert:pair_filt_proved > 0per bit-depth arm.
No refusal lifted, so refusal_inventory.rs/gate_coverage.rs are unchanged.
EVIDENCE
EVIDENCE: /tmp/.../scratchpad/kf1200/{ours16,ref.yuv} | ffmpeg -ss 1200 -t 0.4 -c:v copy -f obu, trunc.py to 1 frame (sha256 b4b92873d0329964 twice), decode_probe EC_PROBE_OUT16 vs ffmpeg yuv420p10le | U samples differing 12 -> 0, Y/V 0 (Y 0, U 0, V 0 after fix)
EVIDENCE: /tmp/.../scratchpad/kf1200/{pre.f0,apre.f0} | EC_AV1_PREFILT_DUMP16 ours vs aomdec on the same 1-frame stream | 13 U samples differ pre-loop-filter => reconstruction, not filters/grain
EVIDENCE: /tmp/.../scratchpad/kf1200/{opred.txt,apred.txt} | EC_PRED=1 on both decoders | block (352,356) 8x4 mode=2 ad=-2: ours sum=16208 vs EC_PREDOUT sum=16212, oracle EC_PRED ft=1
EVIDENCE: gate run cargo test -p ec-av1 --lib a_real_aomenc_stream_with_a_16_level_1to4_partition_decodes_pixel_exact -- --nocapture | real aomenc, 8-bit and 10-bit arms | 8-bit: 16 compared attempts, 232 16x4 / 244 4x16, 238 chroma pairs, 13 pair-base filt-type flips, PASS; 10-bit: 15 attempts, 198 pairs, 8 flips, PASS
EVIDENCE: same gate with the fix reverted (pair_mi -> lmi) | one-line revert, rebuild, rerun | FAILED "frame 0 U vs ffmpeg (8-bit, seed 43)" -- the gate is decisive, not vacuous
EVIDENCE: $HOME/.cache/kf1200-census.log | 24 HG key frames, 1-frame truncation, EC_PROBE_OUT16 vs ffmpeg, each stream sha256'd twice (identical) | see table
24 key-frame census (bytes differing, 1 frame each)
| -ss | before (census4) | after |
|---|---|---|
| 0 | 0 | 0 |
| 300 | 463 | 463 |
| 600 | 48771 | 48771 |
| 900 | 14057195 | 14057191 |
| 1200 | 14 | 0 |
| 1500 | 16649701 | 16649650 |
| 1800 | 248 | 0 |
| 2100 | 15147518 | 15147782 |
| 2400 | 42343 | 42343 |
| 2700 | 7726287 | 7726287 |
| 3000 | 0 | 0 |
| 3300 | 44500 | 39971 |
| 3600 | 1 | 0 |
| 3900 | 7554020 | 7554023 |
| 4200 | 0 | 0 |
| 4500 | 0 | 0 |
| 4800 | 2348 | 2348 |
| 5100 | 0 | 0 |
| 5400 | 0 | 0 |
| 5700 | 16375 | 16375 |
| 6000 | 15450360 | 15449720 |
| 6300 | 15410936 | 15410864 |
| 6600 | 15181681 | 15181688 |
| 6900 | 0 | 0 |
(The census4 numbers were taken with the same recipe; note census4 measured frame 0 of a segment that then refused later frames, and this run truncates to 1 frame identically. The multi-million counts are lane-kf900's entropy-desync territory, unchanged here.)
Residue
- deferred:
-ss 300(463 bytes) — a DIFFERENT shape, also chroma-only and also pre-loop-filter, but block-constant offsets of +1/+2 over a ~16x16 chroma region at chroma (412,384) (EC_AV1_PREFILT_DUMP16diff, this branch) — reads like CfL alpha or a chroma DC/dequant defect, not an edge-filter type. Unblocked by: localising that block'suv_mode/CfL alpha the same way (EC_IMODE_VAL + EC_PRED at mi (206,192)). - deferred:
-ss 600 / 2400 / 4800 / 5700 / 3300(48771 / 42343 / 2348 / 16375 / 39971) — larger residuals, not triaged in this round. - accepted: the multi-million-byte segments are entropy desyncs owned by lane-kf900.
Suite
cargo test -p ec-av1 --lib (systemd unit, EC_AV1_REQUIRE_AOMENC=1, log $HOME/.cache/kf1200-suite-r1.log):
370 passed / 0 failed / 32 ignored, 1546 s.