# Data Compression¶

This section describes data compression algorithms of the oneDTL library.
All data compression algorithms can be divided into two large groups: `lossless`

and `lossy`

compression.
See the main differences between these two approaches below.

## Lossless Compression¶

Lossless compression is a data compression algorithm that allows user to recover original data from a compressed array. This behavior makes lossless compression convenient in cases where it is important that the original and the decompressed data be identical, or where deviations from the original data would be unfavorable. Typical examples are executable programs, text documents or source code.

By operation of the pigeonhole principle, no lossless compression algorithm can efficiently compress all possible data. For this reason, many different algorithms exist that are designed either with a specific type of input data.

## Lossy Compression¶

Lossy compression is the type of data encoding methods that uses inexact approximations and partial data discarding to represent the content. In return for accepting this distortion in the reconstruction, implementation may generally obtain much higher compression ratios than it is possible with lossless compression.

In many applications, the lack of exact reconstruction is not a problem. This algorithm behavior is especially true for processing media data. For example, a person cannot hear all sound frequencies; accordingly, these frequencies can be eliminated without losing the quality of sound.

See lossy data compression algorithm supported in oneDTL: