Files
lightcraft/crates/raw/examples/rawdump.rs
T
Brandon ThomasandClaude Opus 5.5 d752f0e8db M11.3: Panasonic RW2 decoding (packed 12/14-bit)
Black-box derived layout: 0x4000-byte chunks stored rotated by 0x1ff8,
16-byte LE blocks read LSB-first (10x12-bit or 9x14-bit samples).
Sensor borders, CFA code, per-channel black, linearity limit, WB levels,
ISO; JpgFromRaw preview via a generic undefined-tag JPEG candidate.
The quantised raw format 4 reports Unsupported (documented gap).
Adds a rawdump debug example.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 00:11:34 -04:00

15 lines
754 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 = lightcraft_raw::decode(&std::fs::read(&a[0]).expect("read")).expect("decode");
let lightcraft_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");
}