Skip to main content

Module kodak

Module kodak 

Source
Expand description

Kodak entropy coders and pixel transforms.

  • 65000 (DCR, DCS Pro / 7x0 series): rows are split into blocks of up to 256 samples; each block starts with 4-bit difference lengths (two per byte) followed by the differences, read LSB-first from big-endian 16-bit words. Predictors reset per block (one per column parity). A length nibble above 12 marks a block stored as raw 12-bit samples instead. Because a block’s byte length follows from its length nibbles alone, scan_65000_rows locates every row cheaply so rows decode in parallel.
  • RADC (DC40/DC50): adaptive Huffman-coded predictive scheme on 4-row bands.
  • DC120: 8-bit rows stored with a per-row rotation.
  • YCbCr 4:2:x to RGB transforms of the C330/C603 compact cameras.

Constants§

BLOCK_65000
Samples per 65000 block.

Functions§

block_len_65000
Byte length of one 65000 block of len samples starting at data[pos..], and whether it is a raw (uncompressed 12-bit) block. None if the header is truncated.
c330_row
C330: one output row of width RGB pixels from a 2 * raw_width-byte YUYV-like row.
c603_row
C603: one output row from a 3 * width-byte record holding two luma rows and one chroma row (odd selects the second luma row).
dc120_row
DC120: unrotate one 848-byte row.
decode_65000_row
Decode one CFA row of 65000 data starting at data[pos..], mapping values through curve (out-of-range predictions leave the sample at zero). Returns where the next row starts.
decode_block_65000
Decode one 65000 block of len samples at data[pos..] into out (at least (len + 3) & !3 rounded up to 8 entries). Returns true for a raw block (values are absolute samples rather than differences).
decode_block_65000_at
decode_block_65000, also returning the position just past the block (the next block’s start, as block_len_65000 gives it).
decode_radc
RADC (Kodak DC40/DC50): decode height x width samples (both at most 512 x 768) into out (row stride width). cbpp is the EXIF CompressedBitsPerPixel numerator, which selects the quantisation of the literal-value tree.
gamma_curve
Inverse transfer table (power pwr with a linear toe of slope ts, BT.709-style) over 0..=imax, used for Kodak compact cameras without a stored curve.
scan_65000_rows
Locate the start of every row of a 65000 CFA payload of width x height samples starting at start (sequential header scan, no entropy decoding).