Commit Graph
6 Commits
Author SHA1 Message Date
FredApps 250fc97fa8 raw: opcode_params reads areas as the shared opcodes::Area and clamps them (Area::clamp); document how it differs from the typed opcodes model 2026-11-16 08:36:26 +01:00
Dylan M. Taylor 4374003c36 raw: reject zero-pitch public opcode area iterators 2026-11-15 23:26:23 -05:00
Dylan M. Taylor b00cb4533a raw: use fixed-size opcode record chunks 2026-11-15 21:49:46 -05:00
Dylan M. Taylor fab94c80fe raw: bound opcode area count validation 2026-11-15 21:49:46 -05:00
Dylan M. Taylor 75cff558e5 raw: parse DNG opcode parameters into typed values 2026-11-15 21:49:46 -05:00
vangel76andClaude Opus 5.5 cb3f76848b #1065: DNG opcode lists (OpcodeList1/2/3)
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>
2026-11-15 21:49:46 -05:00