Commit 168786c
fix(simple,marker): honour the buff/pixel_format contract (#103)
Closes the symptom from issue #103 (cf ~= 0.0965 on hiro template).
The library extraction was already correct (cf ~= 0.89 in the PR-A
diagnostic on the same path); the bug was that simple.rs declared
ar_pixel_format = MONO but fed an RGBA buffer into AR2VideoBufferT.buff,
violating the contract documented at artoolkit5/video2.c:682:
when pixel_format == MONO, buff IS the luma data.
Fixes:
- simple.rs now feeds the luma buffer into both buff and buff_luma
(matching pixfmt = MONO), with a comment pointing at the upstream
contract.
- ar_detect_marker now validates that frame.buff.len() matches
xsize * ysize * pixel_size (and buff_luma matches xsize * ysize),
emitting arlog_e! and returning Err on mismatch — turns silent
contract violations into loud, immediate failures.
- ar_detect_marker doc comment grew a "Frame buffer contract" section
documenting the rule and linking issue #103.
After this change, the simple example reports cf=0.8925 and id=0
on benchmarks/data/img.jpg (was cf=0.0965, id=-1 before).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 5c36a3b commit 168786c
2 files changed
Lines changed: 57 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
222 | 221 | | |
223 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
224 | 227 | | |
225 | | - | |
226 | | - | |
| 228 | + | |
| 229 | + | |
227 | 230 | | |
228 | 231 | | |
229 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
85 | 98 | | |
86 | 99 | | |
87 | 100 | | |
| |||
131 | 144 | | |
132 | 145 | | |
133 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
134 | 184 | | |
135 | 185 | | |
136 | 186 | | |
| |||
0 commit comments