The present invention is a method and apparatus for compressing and decompressing data. In particular, the present invention provides for (de-)compressing naturalistic color-image and moving-image data, including high-precision and high-definition formats, with zero
information loss, one-sample latency and in faster than real time on common computing platforms, resulting in doubled transmission, storage, and playback speed and doubled
transmission bandwidth and storage capacity, and hence in doubled
throughput for non-CPU-bound image-editing tasks in comparison with uncompressed formats. The present invention uses a nearly symmetrical compression-decompression scheme that provides temporal, spatial, and
spectral compression, using a reversible condensing / decondensing filter, context
reducer, and
encoder / decoder. In the preferred embodiment of the invention, the compression filter is implemented as a
cascade of quasilinear feedforward filters, with temporal, multidimensional spatial, and spectral stages, where appropriate, in that order, whose support consists of adjacent causal samples of the respective image. The decompressor cascades quasilinear feedback inverse filters in the
reverse order. The filters can be implemented with mere integer addition, subtraction, and either one-dimensional table lookup or constant multiplication and binary shifting, depending on the computing environment Tables permit the data precision to be constrained throughout to that of the image samples. The
encoder uses a table of prefix codes roughly inversely proportional in length to their probability, while the decoder uses chunked decode tables for accelerated lookup. In the fastest and simplest mode, the code tables are context-independent. For greater power, at the cost of a reduction in speed, the code tables are based on the temporal, multidimensional spatial, and spectral adjacent causal residue samples, where contexts with similar probability distributions are incoherently collapsed by a context
reducer using one-dimensional lookup tables followed by implicitly multidimensional lookup tables, to minimize the overall table size. The invention's minimal resource requirements makes it ideal for implementation in either hardware or
software.