Next: Primitive Storage Form
Up: ARRAY COMPONENT STORAGE FORM AND COMPRESSION
Previous: Scaled Storage Form
Delta compressed Storage Form
In this form of storage, the values stored internally within an NDF's array
component are a compressed form of the external values of interest to
application code. Delta form provides a lossless compression scheme designed
for arrays of integers in which there is at least one pixel axis along which
the array value changes only slowly. It uses two methods to achieve
compression:
- Differences between adjacent data values are stored, rather than
the full data values themselves. For many forms of astronomical data, the
differences between adjacent data values have a much smaller range than
the data values themselves. This means that they can be represented in
fewer bits. For instance, if the data values are _INTEGER, then the
differences between adjacent values may fit into the range of a _WORD
(-32767 to +32767) or even a _BYTE (-127 to +127). This use of a shorter
data type usually provides the majority of the compression. However, it is not
necessary for all differences to be small - if the difference between two
adjacent data values is too large for the compressed data type, the
second of the two data values will be stored explicitly using the full data
type of the original uncompressed data. Obviously, the more values that
need to be stored in full in this way, the lower will be the compression.
In the above description, the term ``adjacent'' means ``adjacent along a
specified pixel axis''. The pixel axis along which differences are taken
is referred to as the ``compression axis''. It may be specified
explicitly by the calling application when NDF_ZDELT is called, or it
may be left unspecified in which case NDF_ZDELT will choose the axis that
gives the best compression.
- If the uncompressed array contains runs of more than three identical
values along the compression axis, then the run of identical values is
replaced by a single value (stored in full, not as a difference) and a
repetition count.
Support for delta arrays is currently limited, since it is anticipated
that they will only be of interest as an archive format. The following
details should be noted:
- Delta arrays are ``read-only''. An error will be reported if an
attempt is made to map a delta array for WRITE or UPDATE access. When
mapped for READ access, the pointer returned by NDF_MAP provides access
to the original uncompressed data values.
- The result of copying a delta array (for instance, using
NDF_PROP, etc.) will be an equivalent simple array.
- Delta arrays cannot be created directly. To create an NDF with
delta compressed arrays, first create an NDF with simple arrays, and then
copy it using NDF_ZDELT. The output NDF created by NDF_ZDELT is a copy
of the input NDF, but stored with delta storage form.
- Delta form can only be used to store integer data values, but
NDFs with floating point data values may be compressed indirectly, by
first storing the floating point values in a scaled NDF, and then using
NDF_ZDELT to create a delta compressed copy of the scaled NDF. Note, the
scaled NDF must use an integer data type to store the internal (i.e.
scaled) values. The use of the scaled NDF means that the compression is
not lossless, since some information will have been lost in scaling the
floating point values into integers.
- The NDF_GTDLT routine will return details of the compression
applied to a delta compressed NDF array component.
- Delta arrays cannot have complex data types. An error will be
reported if an attempt is made to to import an HDS structure describing a
complex delta array.
- When applied to a delta array, the NDF_TYPE and NDF_FTYPE routines
return information about the data type of the original uncompressed data
values.
Next: Primitive Storage Form
Up: ARRAY COMPONENT STORAGE FORM AND COMPRESSION
Previous: Scaled Storage Form
NDF [1ex
Starlink User Note 33
R.F. Warren-Smith & D.S. Berry
16th July 2012
E-mail:starlink@jiscmail.ac.uk
Copyright © 2013 Science and Technology Facilities Council