3 ms·
What would be a good approach to compress not just a steam of arbitrary bytes, but a stream of 4-byte numbers which are similar to each other (like some sensor
by vbezhenar 5y ago
What would be a good approach to compress not just a steam of arbitrary bytes, but a stream of 4-byte numbers which are similar to each other (like some sensor output)?
- nitrogen 5y agoYou could start by encoding the deltas using variable length encoding, so a 0 delta could be as little as 1 bit. But anything off-the-shelf should be able to compress this type of data well.
- formerly_proven 5y agoLook into time-series compression. Delta-encoding, mentioned by sibling, is a very old but effective technique also known as differential PCM. You can also delta-encode delta-encoded values, which works especially well for values whose delta is constant (classic example: timestamped data). The advantage of these over general purpose compressors is that they require basically no resources to implement. TFA is "low memory usage (as low as 50 bytes)", but delta encoding needs just one register.