[fitsbits] Description of FITS Rice compression algorithm {External}

Barrett, Paul pebarrett at email.gwu.edu
Fri Aug 15 17:03:57 EDT 2025


In reference to the cfitsio Rice algorithm, that algorithm sets defaults
for: (1) the number of remainder bits for Int8, Int16, and Int32 of 3, 4,
and 5, resp.; and (2) the maximum number of remainder bits of 6, 14, and
25, resp.. Because that algorithm does not have an Int64 version, there are
no such defaults.

It would be nice to know what those defaults are for anyone that wants to
implement an Int64 version of the algorithm. I for one would like to know
as I am currently implementing a Julia version of the algorithm for the
FITSFiles.jl package and want to make it fully compliant with version 4 of
the specification.

Any help in this matter would be greatly appreciated.

 -- Paul


On Thu, Aug 14, 2025 at 12:59 PM Barrett, Paul via fitsbits <
fitsbits at listmgr.nrao.edu> wrote:

> Is anyone aware of a description of the Rice compression algorithm that is
> used by FITS?
>
> The only pseudo-description that I can find is the ricecomp.c code in the
> cfitsio repository. It would be nice to have a
> language agnostic description. Note that it is a non-standard algorithm,
> because it divides the data into subarrays and performs some preprocessing
> of the subarrays before compressing the data. The standard Rice compression
> algorithm does not perform preprocessing.
>
> I should also note that cfitsio does not have an algorithm for Int64
> types; only Int8, Int16, and Int32. The FITS specification permits all four
> integer types. I guess no one does Int64 compression.
>
>  -- Paul
>
>
> --
> Paul Barrett, PhD
> Department of Physics
> The George Washington University
> Washington, DC 20052
>
> _______________________________________________
> fitsbits mailing list
> fitsbits at listmgr.nrao.edu
> https://listmgr.nrao.edu/mailman/listinfo/fitsbits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listmgr.nrao.edu/pipermail/fitsbits/attachments/20250815/3330ffb9/attachment.html>


More information about the fitsbits mailing list