Expand description
DNG opcode lists (OpcodeList1/2/3, DNG spec 1.3+ chapter 7).
Opcode lists carry processing steps the camera maker specifies: bad-pixel repair, lens-shading gain maps (ubiquitous in smartphone DNGs), linearisation tables and polynomials, per-row/column offsets and scales, and geometric corrections.
FlashRaw parses all lists and applies the pixel-value opcodes to f32 planes (the high-level API does so by default, each list in its own domain; lists of tables and bad-pixel repairs on stored integers run on the u16 samples directly, with the same result); geometric opcodes (WarpRectilinear, WarpFisheye, TrimBounds) are parsed and reported but not applied.
Structs§
- Opcode
Entry - One opcode of a list with its header fields.
- Plane
Image - A mutable image the opcodes operate on: a
width x heightwindow (rowsstridepixels apart,planesinterleaved samples per pixel) placed at(x0, y0)in the coordinate system of the whole image the list describes, which isfull_width x full_height(GainMap positions are relative to it). - Region
- Area/plane selector shared by most pixel opcodes.
- RowOps
- A list of row-local opcodes prepared for one window geometry, applied a row at a time
(e.g. by a streaming pipeline that produces the rows band by band). For every row this
gives exactly what
applygives on the whole window.
Enums§
- Opcode
- A parsed opcode.
Traits§
- Sample
- Sample types the opcodes run on: f32 for every opcode, u16 (stored integer values)
for the lists
apply_u16accepts.
Functions§
- apply
- Apply pixel opcodes to
img, whose samples are in the units the list expects (OpcodeList1: stored values; OpcodeList2: linear reference values in[0, 1]; OpcodeList3: demosaiced values).cfa_periodis the CFA repeat (2 for Bayer) used by the bad-pixel opcodes;value_scalemaps sample values to the 16-bit table/constant domain (1 for stored values, 65535 for normalised ones). Returns the names of opcodes that were not applied (geometric and unknown ones). - apply_
u16 applyon stored integer samples (value scale 1), for lists made of tables and bad-pixel repairs: no f32 copy of the image is needed and the result is identical to the f32 pass rounded back to u16. ReturnsNone(leavingimguntouched) for lists it does not cover.- parse
- Parse an opcode list (always big-endian, per the DNG spec).
- parse_
entries parsekeeping each opcode’s id and flags.- u16_
exact - Whether
apply_u16gives exactly whatapplygives on the same values converted to f32 (value scale 1) and rounded back: tables look up rounded values and repairs produce means that only a final rounding (or a table) reads afterwards.