mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
cargo fmt on raf.rs and rafc.rs
This commit is contained in:
1 parent
d6024423db
commit
7000e76156
2 files changed
+3
-3
No files matched your search
@@ -200,7 +200,8 @@ fn header_model(bytes: &[u8]) -> Option<String> {
|
||||
|
||||
/// A strip shorter than the samples it holds: Fujifilm's striped compression (`rafc`).
|
||||
fn decode_compressed(bytes: &[u8], src: &[u8], width: usize, height: usize, bits: u32, cfa: &Cfa) -> Result<Vec<u16>> {
|
||||
let flag = rafc::stream_flag(src).ok_or_else(|| RawError::unsupported("Fujifilm RAF with an unknown sample storage (short strip without the IS signature)"))?;
|
||||
let flag =
|
||||
rafc::stream_flag(src).ok_or_else(|| RawError::unsupported("Fujifilm RAF with an unknown sample storage (short strip without the IS signature)"))?;
|
||||
// The header's compression mode (0 uncompressed, 2 lossless, 3 lossy) must agree with the stream.
|
||||
match be32(bytes, COMPRESSION) {
|
||||
Some(2) if flag == 1 => {}
|
||||
|
||||
@@ -405,8 +405,7 @@ pub(crate) fn zero_stream(bits: u32, xtrans: bool, groups: usize, quantizers: Op
|
||||
}
|
||||
}
|
||||
}
|
||||
let stream: Vec<u8> =
|
||||
bitstream.chunks(8).map(|chunk| chunk.iter().enumerate().fold(0, |b, (i, bit)| b | (u8::from(*bit) << (7 - i)))).collect();
|
||||
let stream: Vec<u8> = bitstream.chunks(8).map(|chunk| chunk.iter().enumerate().fold(0, |b, (i, bit)| b | (u8::from(*bit) << (7 - i)))).collect();
|
||||
// Two stripes; the second is mostly padding, which must never enter the output.
|
||||
let mut out = b"IS".to_vec();
|
||||
out.extend_from_slice(&[u8::from(quantizers.is_none()), if xtrans { 16 } else { 0 }, bits as u8]);
|
||||
|
||||
Reference in new issue
Block a user