Read DNG 1.6 semantic masks (SemanticName, SemanticInstanceID, MaskSubArea; any coding the tile/strip reader decodes, e.g. ProRAW's lossy-JPEG matte) with lightcraft_raw::semantic_masks, map them onto the developed image, and carry Apple's sky / portrait / skin / hair / teeth / glasses mattes in SourceInfo::mattes (SourceInfo is no longer Copy). Sky, Subject, Background and People components sample them through orientation, warp (Warp::frame, as geometry.rs) and crop like the image, so preview = export, instead of the heuristics; files without mattes render as before. Malformed mask IFDs are skipped, and only the first MAX_MASKS mask IFDs are decoded, so a file full of them costs bounded work. The render cache version is bumped once, in the white-balance commit. The corpus test reads corpus/raw/dng-apple-iphone12pro-proraw.dng, the name `cargo xtask corpus` downloads it under. Co-Authored-By: Claude Opus 5.5 <[email protected]>
lightcraft-tiff (L0)
TIFF / IFD reader and writer. Used by lightcraft-raw (DNG, CR2, NEF, ARW…), lightcraft-meta (Exif) and
later the TIFF/DNG exporters.
Features
- Classic TIFF and BigTIFF, little- and big-endian (
II/MM). Also accepts the TIFF-like magic numbers of some raw formats (ORFIIRO/IIRS, RW2IIU) whenParseOptions::accept_raw_magicis set (default). - Every field type: BYTE, ASCII, SHORT, LONG, RATIONAL, SBYTE, UNDEFINED, SSHORT, SLONG, SRATIONAL, FLOAT, DOUBLE, IFD, LONG8, SLONG8, IFD8.
- IFD chain +
SubIFDs(330) + Exif (34665) / GPS (34853) / Interoperability (40965) pointer IFDs, resolved into a tree (Ifd::sub_ifds,exif,gps,interop).Entry::offsetrecords the absolute position of each value (needed for maker notes and embedded blobs). parse_ifd_at(data, offset, order, base, bigtiff, opts)parses an IFD whose offsets are relative to an arbitrary base;makernote::parse_makernoteknows the header / byte-order / offset-base conventions of Canon, Nikon (types 1 and 3), Sony, Fujifilm, Olympus (old and new), Panasonic and Pentax notes.image::ImageInfo— width/height, bits, samples, compression, photometric, planar config, predictor, sample format and the strip or tile chunk list (chunks(),chunk_bytes()); missing byte counts are inferred.TiffWriterwrites IFD chains with strips or tiles,SubIFDsand pointer IFDs, in either byte order, classic or BigTIFF;writer::rational/srationalapproximate floats as rationals.
Robustness
The reader never panics on malformed input (proptests feed random and mutated files): offsets are
bounds-checked; out-of-range or unknown-type entries are skipped; IFD loops are detected; IFD count,
nesting depth and entries per IFD are limited; the total bytes of decoded values are capped at
8 × input + 1 MiB so a file cannot make us allocate far more than its own size.
Sources
Public specifications only: TIFF 6.0 (Adobe, 1992), the TIFF 6.0 supplements (IFD type, SubIFDs), the BigTIFF format description (AWare Systems), Adobe DNG Specification 1.7 (tag numbers), CIPA DC-008 Exif 2.32, and the ExifTool tag-name documentation (maker-note header conventions, prose only). No third-party code was consulted.