mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 20:25:06 +00:00
Problem: DNG opcode lists were ignored, so lens shading gain maps (phones and many cameras), bad pixel maps, vignette and distortion corrections and trims that a file asks for were silently left out, and an opcode a reader must apply could not be refused. Fix (DNG 1.7.1.0 chapter 7): a big-endian opcode list parser (at most 256 opcodes, every count checked against the parameter bytes before allocating) and the opcodes WarpRectilinear, WarpFisheye, WarpRectilinear2 (with the skip rule), FixVignetteRadial, FixBadPixelsConstant / List, TrimBounds, MapTable, MapPolynomial, GainMap, DeltaPerRow / Column and ScalePerRow / Column. OpcodeList1 runs on the stored samples (0-65535), OpcodeList2 on the linear values before white balance (the fused normalise splits only then), OpcodeList3 on the demosaiced camera values; values are clipped after each opcode. Unknown opcodes or ones newer than 1.7.1.0 are skipped when optional and an error naming them when mandatory; preview-only opcodes are skipped on the reduced-resolution path, and a mandatory OpcodeList3 keeps full resolution. Interpretations where the spec leaves room are recorded in the README. Files without opcode lists develop exactly as before. Tests: unit tests per opcode with known results (tables, polynomials, deltas, scales, gain map interpolation and edge replication, vignette, warps reproducing a ramp, fisheye, the skip rule, bad pixels, trim, hostile parameters) and whole-file tests of each list's stage, the optional flag, the preview path, and 3000 mutations under catch_unwind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>