Files
lightcraft/crates/raw/examples/rawdump.rs
T
Andrew FrahnandClaude Opus 5.5 fb097d61be Rename crates to neutral dac-* codename and binaries to app/app-cli
Mechanical rename right after the fork so upstream merges map cleanly.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 09:43:50 +11:00

15 lines
740 B
Rust
Raw 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.
//! Debug helper: `rawdump IN OUT` writes the decoded sensor data as `u32 width, u32 height` (little-endian)
//! followed by `width × height × cpp` little-endian `u16` samples, for analysis in external tools.
fn main() {
let a: Vec<String> = std::env::args().skip(1).collect();
let r = dac_raw::decode(&std::fs::read(&a[0]).expect("read")).expect("decode");
let dac_raw::RawData::U16(d) = &r.data else { panic!("float data") };
let mut out = Vec::with_capacity(8 + d.len() * 2);
out.extend_from_slice(&(r.width as u32).to_le_bytes());
out.extend_from_slice(&(r.height as u32).to_le_bytes());
for v in d {
out.extend_from_slice(&v.to_le_bytes());
}
std::fs::write(&a[1], out).expect("write");
}