mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-28 12:08:10 -06:00
`probe_info` (every file an import adds) ran the whole Nikon Huffman decode on a compressed NEF because `nef::decode` had no header mode and the masked-trailing-column test wanted the samples: 386 ms per 24 MP file, the full decode time, where every other format probes in < 1 ms. The header has no source for those columns (the D5100 and D7000 write 8 masked columns at value 0, compressed and uncompressed alike, with no CropArea or other maker-note tag), so the probe cannot skip the test. Instead both modes now judge the active width from the first 128 rows (`nef::MASK_ROWS`) against the nominal white level: the header probe decodes only those rows (`nefc::decode_rows`, the stream is sequential; uncompressed files read only the strips holding them) and the full decode uses the same rule, so `probe_info == RawImage::info` still holds. On every corpus NEF/NRW the answer is the same for 8 to 512 rows as for the whole frame. The whole-image size and truncation checks still apply in both modes; the "lossy after split" end-of-strip rule is only checked when the whole strip is decoded. Release, same files: probe 66 -> 3.4 ms (D5100 lossless), 72 -> 3.2 ms (D7000 lossy 12), 88 -> 3.1 ms (D7500 lossless 12), 92 -> 3.7 ms (Z f lossless), 23 -> 1.5 ms (D5100 uncompressed), 54 -> 2.7 ms (B700 NRW). Tests: a synthetic lossless NEF whose stream is cut off after two thirds of the rows probes to the same info as the whole file while the full decode reports the truncation; synthetic uncompressed NEFs with masked columns in the top rows, lower rows, all or none give the same active area in both modes. Both failed before the fix. Docs: the `probe_info` doc comment, docs/parity.md (LR-IMP-FORMATS), docs/gpu-pipeline.md.