Skip to main content

Module olympus

Module olympus 

Source
Expand description

Olympus / OM System ORF lossless compression.

A single MSB-first bit stream codes every sample of the frame as an adaptive Golomb-like residual. Even and odd columns form two interleaved channels: each channel keeps its own adaptation state (previous code magnitude, a run counter of small codes and a smoothed residual), and predicts from same-colour neighbours two pixels to the left (W), above (N) and diagonal (NW).

Per sample:

  1. sign bit, then low_bits (usually 2) literal low bits, then extra_bits (usually 0) bits appended below the reconstructed value;
  2. a unary-coded “high” part (number of zeros before a one, escape after max_high zeros to a fixed-width field), then wbits “low” bits, where wbits adapts to the magnitude of the previous same-channel code;
  3. the code is combined with the smoothed residual and added to the edge-sensitive median prediction.

The camera describes the coder with tags 0x640..0x653 of the makernote ImageProcessing directory (OlympusParams); every body to date uses the same values, which are also the defaults. The stream is inherently sequential.

Structs§

OlympusParams
Coder parameters (makernote ImageProcessing tags 0x640..0x653).

Functions§

decode
Decode a full width x height frame into out (row-major, width stride). data starts at the stream header. Returns an error on malformed parameters or a stream that runs out of data.
decode_with
decode, optionally overlapping entropy decoding and prediction on two threads.
stream_start
Offset of the bit stream after the header, checking the header contents.