2

What is the fastest algorithm for compressing RGBA 32 bit image data? I am working in C, but am happy for examples in other programming languages.

Right now I am using LZ4 but I am considering run length / delta encoding.

Lossless encoding, a mix of real life images and computer generated / clipart images. Alpha channel always exists, but is usually constant.

jjxtra
  • 20,415
  • 16
  • 100
  • 140

3 Answers3

3

I ended up just using LZ4. Nothing else was even close to as fast and LZ4 usually got at least 50% size reduction.

jjxtra
  • 20,415
  • 16
  • 100
  • 140
1

Lossy or lossless?
"Real" images or computer graphics?
Do you actually have an alpha channel?

If you need lossless (or semi=lossless) then converting into YUV and compressing that will probably reduce by about 1/2 (after already having it in going to 2bytes/pixel) try Huffyuv

If you have real images then H264 can do very high compression and there are optomised libraries and HW support so it can be very fast.

If you have computer graphics type images with few colours but need to preserve edges, or you actually have an A channel then run length might be good - try splitting the image into per-colour frames first.

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
  • No but it achieves reasonable compression! If you have a slow HD and HW H264 support it could be quicker than writing uncompressed video – Martin Beckett Oct 07 '12 at 02:30
  • Yeah, sure but looking at the complicated names. How many lines do you need? Is this patent free? – Micromega Oct 07 '12 at 02:33
0

LZ4 is LZ77 family which is a few lines of code but I never did it myself but I guess you are right run length or delta code is the fastest and also good for images. There is also snappy algorithm. Recently I tried the exdupe utility to compress my virtual machines. This thing is also incredible fast: http://www.exdupe.com. exdupe seems to use a rzip thing: http://encode.ru/threads/1354-Data-deduplication.

Micromega
  • 12,486
  • 7
  • 35
  • 72
  • Does exdupe run on the ARM processor? – jjxtra Oct 07 '12 at 23:45
  • It runs on Linux. Should compile for arms with a correct toolchain? Better ask in encode.ru: http://encode.ru/threads/1354-Data-deduplication. Author is also there!? – Micromega Oct 08 '12 at 00:49