Files
QFT/TEST_REPORT.md
2026-08-12 14:48:09 +08:00

205 lines
7.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# QFT v0.4.16 test report
Date: 2026-08-12
This report separates **tests actually executed in the current environment** from **physical hardware acceptance that cannot be simulated here**.
## What this release changes
The v0.4.16 optical path is deliberately simpler than v0.3:
- 2×2 / 4-channel QR removed;
- one large QR only;
- QFT2 + Base45 text layer;
- 450-byte DATA payload;
- Android 640×480 analysis;
- centered acquisition → finder-point ROI lock → progressive expansion → reacquire;
- reusable Y-plane buffer;
- GlobalHistogram fast hot path with sparse Hybrid fallback;
- duplicate displayed frames suppressed before the file assembler;
- dynamic lock overlay and movement-triggered AF/AE;
- Windows draggable split pane / focus-QR mode.
Android→Windows QFTPAIR2/discovery/parallel upload remains and is regression-tested.
The release also adds immediate gateway/subnet probing after dedicated Wi-Fi association,
crash-safe Android queue reordering, and a completed PC receive state without stale ETA text.
## Executed and passed
### 1. QFT2 optical loss recovery — PASS
Command:
```text
python scripts/protocol_selftest.py
```
Representative result from the final source:
```text
PASS QFT2/Base45 single-QR: 1200123 bytes, 2667 chunks,
22% frame loss, recovered in 6 rounds; QR-L v15 vs legacy Base64 v18,
12px/module@1024, text=722 chars, theoretical payload=26.4 KiB/s
```
Verified:
- Base45 known vectors;
- QFT2 magic/version/header;
- CRC32;
- 450 B DATA chunks;
- continuous replay after 22% synthetic whole-frame loss;
- exact file reconstruction;
- final SHA-256 equality;
- representative QFT2 QR density below the old QFT1/Base64 comparison.
Theoretical payload is `450 × 60 = 27,000 B/s`; it is not a claim of physical camera throughput.
### 2. Synthetic camera-frame decode and ROI — PASS
Command:
```text
python scripts/optical_image_decode_selftest.py
```
The test renders a 722-character QFT2/Base45 QR-L v15, places it into a 640×480 grayscale camera-like frame, applies 3° rotation and light Gaussian blur, then decodes both the full frame and a representative locked crop.
Typical final runs were approximately:
```text
full frame ≈ 4.2–4.7 ms/decode
locked ROI ≈ 2.8–2.9 ms/decode
ROI area ≈ 45–46% of frame
```
Both paths returned the exact QFT2 text. Timing varies by host and decoder cache state; this is a host-side directional benchmark, **not Android CameraX FPS**.
### 3. Single-channel / Android static guards — PASS
Commands:
```text
python scripts/android_compat_selftest.py
python scripts/single_channel_guard_selftest.py
```
Verified in the final source:
- `minSdk = 24`;
- no 2×2/4-lane Windows optical sender path;
- no four-reader Android optical decoder path;
- one large QFT2/Base45 QR;
- 450 B default DATA payload;
- 640×480 ImageAnalysis;
- `STRATEGY_KEEP_ONLY_LATEST`;
- Camera2Interop AE FPS request + no-explicit-FPS fallback when OEM binding rejects it;
- `QRCodeReader` only;
- ROI-only locked Y copy;
- grow-only reusable luma scratch buffer;
- lock smoothing / dynamic overlay / lock-centered refocus;
- QFT2/Base45 parsing + QFT1 legacy parsing;
- Android 7~9 and Android 10+ Wi-Fi branches;
- no `java.util.Base64` dependency in app source.
### 4. Host Kotlin QFT2/ROI runtime — PASS
`kotlin_host_smoke.py` compiled and executed the actual final:
- `Base45.kt`;
- `Base64Url.kt`;
- `Protocol.kt`;
- `LockRect.kt`.
Result:
```text
PASS Kotlin QFT2/Base45 protocol + ROI lock smoothing
```
This test caught and fixed an earlier Kotlin expression-body compile error in `QftProtocol.parseText()` before packaging.
### 5. Host Kotlin QrAnalyzer compile smoke — PASS
The same test compiles the final `QrAnalyzer.kt`, `GrayFrame.kt`, `LockRect.kt` and `ScannerLockState.kt` against minimal CameraX/ZXing-shaped JVM stubs.
Result:
```text
PASS Kotlin QrAnalyzer compile smoke with CameraX/ZXing-shaped stubs
```
This checks Kotlin type/signature consistency of the ROI scanner without claiming it replaces a real Android SDK build.
### 6. Android→Windows regression tests — PASS
`run_all_selftests.py` also passed:
- QFTPAIR2: 207 chars vs old 368-char test payload, QR-M v10 in the model;
- UDP discovery request/response token + port round trip;
- 8-worker parallel reconstruction of ~64 MiB;
- 8 MiB chunks / 1 MiB worker I/O;
- loopback UDP discovery + authenticated HTTP + out-of-order chunk upload;
- ~40 MiB final reconstruction with identical SHA-256.
### 7. Memory budget model — PASS
The guard models the Windows single-QR 1024×1024 RGBA pre-render queue:
```text
192 frames × ~4 MiB = 768 MiB managed cache
+ 96 MiB transient allowance
< 1100 MiB design ceiling
```
This is a design-budget check, not an OS-enforced RSS hard cap. GPU/runtime allocators can add platform-specific memory.
## Important implementation decisions validated during v0.4.16
### QFT2 uses Result.text, not ZXing rawBytes
The active path is Base45 text. Android reconstructs the QFT binary frame from `Result.text`. The code does not depend on ZXing `Result.rawBytes` representing the original byte-mode payload.
### Duplicate camera hits are not duplicate assembler work
At 45/60 display FPS, a camera can observe the same displayed QR in multiple exposures. v0.4.16 still counts every successful decode in diagnostics, but only a changed QFT2 text fingerprint is delivered to `SessionAssembler`.
### AF/AE does not run on a fixed periodic timer
The scanner performs initial focus/metering, then re-meters after first lock or material ROI movement. A stationary locked QR does not force AF/AE every few seconds, reducing focus-pumping risk.
## Not executable in this environment
The current generation environment does not contain the Windows MSVC Rust toolchain, Android SDK, a physical Android camera, a Windows display or a Windows Wi-Fi Direct adapter. The Windows GNU target `cargo check`, native desktop release build and 71 Rust tests passed, but the following are **not claimed as passed here**:
1. Linking and running the final Windows `.exe` on a real Windows host.
2. Android Gradle `:app:testDebugUnitTest :app:assembleDebug` against the real Android SDK.
3. Actual 30/45/60 displayed FPS → CameraX/ZXing effective new-frame throughput.
4. Lock acquisition/reacquisition timing on Android 7 and different phone camera pipelines.
5. PreviewView overlay mapping on every OEM sensor/crop/rotation combination.
6. Real Windows QFT Direct adapter / driver / firewall behavior.
The source is sealed as **v0.4.16**. The Windows executable and Android APK still require the physical acceptance below before public binary distribution.
## Required physical acceptance
Run:
```powershell
.\VERIFY_WINDOWS_HOST.ps1
```
Then use a small optical file and record Android's UI values at Windows 30, 45 and 60 FPS:
- camera FPS;
- successful decode/s;
- distinct new-frame/s;
- average decode ms;
- lock area percentage;
- time to first lock;
- time to reacquire after a small phone movement.
Keep the Windows FPS setting that produces the highest **distinct new-frame/s**, not necessarily the highest display FPS.
For file correctness, verify 100 KiB, 1 MiB and 10 MiB optical transfers by final SHA-256. For Android→Windows, repeat first-time Direct pairing, second pairing, Wi-Fi reconnect and LAN fallback.