New compression/decompression algorithm.
Merged changes from Branimir for 16bit indices and 2008 support.