fix: 解码器3个bug修复 — 编码→解码往返恢复 + 新增往返测试

1. detect.rs: remove()索引bug — 元素前移后索引未更新,改用每次remove(0)
2. detect.rs: 版本估算公式修正 — (dist-14)/4 → (dist-10)/4,符合ZXing公式
3. extract.rs: 移除显式col 6跳过 — read_module已自动跳过保留区,显式skip导致列配对错位/行序反转

新增 test_roundtrip_png: 矩阵往返 + PNG往返双验证
This commit is contained in:
2026-06-27 14:53:48 +08:00
parent 309c9429ea
commit ce9c8b1b6e
3 changed files with 31 additions and 9 deletions
+2 -5
View File
@@ -32,11 +32,8 @@ fn extract_bits(matrix: &Matrix, total_codewords: usize) -> Vec<bool> {
}
col -= 2;
going_up = !going_up;
// 跳过垂直时序图案列(col 6
if col == 6 {
col -= 1;
}
// 垂直时序图案列(col 6)由 read_module 自动跳过保留区,
// 无需显式 skip,否则会导致列配对错位、行序反转
}
bits.truncate(target_bits);