Skip to content

Commit e057ffc

Browse files
kalwaltclaude
andcommitted
docs(issue-103): correct findings — Rust/C cf close but not byte-equal
Updates the §9 finding and §10 follow-ups to reflect the actual diagnostic outcome: Rust dump_patt reports cf ≈ 0.89, C dump_patt reports cf ≈ 0.85 on the same hiro input. Both are above the 0.7 acceptance bar (so the Rust port is functionally correct on this path), but the patches are not byte-equal — there is residual arithmetic drift between the two implementations. Captured as a follow-up rather than a PR-B blocker, since the dominant symptom in #103 is the simple.rs frame-setup bug, not the extraction drift. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9b6e4b0 commit e057ffc

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

docs/issue-103-fix-plan.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,20 @@ Classify divergence:
154154
| R-B3 | Rust/C floating-point rounding diverges sub-LSB | `u8` integer division after extraction absorbs FP noise; cf parity to `1e-6` is stretch, not blocker |
155155
| R-B4 | Hidden coupling with `pattern_match` (extraction fix exposes a dormant matcher bug) | Decision #9 already in place — judge by diagnostic + size, decide fold-in vs PR-C |
156156

157-
## 9. Findings — PR-A smoke run (2026-05-02)
157+
## 9. Findings — PR-A diagnostic runs (2026-05-02 / 2026-05-03)
158158

159-
The Rust-side `dump_patt` was run end-to-end against `benchmarks/data/img.jpg`
160-
+ `patt.hiro`. **It produced `cf = 0.892460`, `id = 0`, `dir = 1`** — well above
161-
the 0.7 acceptance bar — using the same library code path as `simple.rs`.
159+
Both dumpers were run end-to-end against `benchmarks/data/img.jpg`
160+
+ `patt.hiro`:
161+
162+
- `dump_patt` (Rust) → `cf ≈ 0.892460`, `id = 0`, `dir = 1`
163+
- `dump_patt` (C) → `cf ≈ 0.85`, `id = 0` on the same inputs
164+
165+
Both are well above the 0.7 acceptance bar, so the Rust port is *functionally*
166+
correct on this path. The two confidence values are however **not** identical,
167+
and `diff_patt` reports the patches are not byte-equal either. There is some
168+
sub-LSB / arithmetic drift between the Rust port and the C reference. That
169+
residual divergence is recorded as a follow-up (§10) — it does not block the
170+
fix for #103's reported symptom.
162171

163172
The only difference between `dump_patt.rs` and `simple.rs` is the
164173
`AR2VideoBufferT` setup:
@@ -225,6 +234,7 @@ violates that contract.
225234
- Issue #103 point 3 — `patt_ratio` correctness vs. the value used by `mk_patt`. Separate brainstorm.
226235
- Issue #103 point 4 — `patt.hiro` / `ar_patt_load` byte-order, header parsing, channel ordering. Separate brainstorm.
227236
- Auto-thresholding (BRACKETING / ADAPTIVE / MEDIAN / OTSU) — pre-existing TODO at `crates/core/src/ar/marker.rs:124`. Unrelated.
228-
- Eventual full pixel-format coverage in `ar_patt_get_image` (BGR, BGRA, ABGR, ARGB, RGB565, 2vuy, yuvs) — incremental, post-PR-B. Now lower priority since the active path is verified correct.
237+
- Eventual full pixel-format coverage in `ar_patt_get_image` (BGR, BGRA, ABGR, ARGB, RGB565, 2vuy, yuvs) — incremental, post-PR-B. Now lower priority since the active path is functionally verified.
238+
- **Strict byte-equality between Rust and C `ext_patt`** (i.e. cf parity within `1e-6`). PR-A ran the diagnostic end-to-end and found Rust `cf ≈ 0.89` vs C `cf ≈ 0.85` on hiro — same id, both above cutoff, but not bit-identical. Likely candidates for the drift: averaging arithmetic (luma weighting / `total_div` rounding) or sub-LSB perspective rounding. Worth a focused follow-up once PR-B closes the immediate symptom.
229239
- Eventual CI parity test (Approach 2 from the brainstorm) — adds ARToolKit5 build deps to CI; defer until parity is locally trusted.
230240
- PR-B (revised): fix `simple.rs` frame contract + add `ar_detect_marker` sanity check + doc-comment the contract referencing `video2.c:682`.

0 commit comments

Comments
 (0)