DTM Image Format
Fast encoder/decoder for the DTM image format.
The DTM image format is a 16-bit lossless image format supporting one to four channels. Its purpose is to serve as a (5x - 10x) faster png alternative with comparable compression.
This format was developed to compress large terrain heightmaps also known as digital terrain models, hence the name.
Example
use DTM;
Format
The DTM format is inspired by the QOI format and utilizes four simple compression ideas. Additionally, the paeth filter is used to achieve better local reuse.
Note: This format is in now way stable or formally specified. I might extend it to support 8 and 32 bit images as well.
uncompressed | 11111111 | byte1 | byte2 |
mru cache | 00 | index | cache-size: 64
single dif | 01 | dif | 6 bit dif: [-32, 31]
double dif | 10 | dif1 | dif2 | 3 bit dif: [ -4, 3]
run lenght | 11 | run | run-length: [ 1, 63]
License
DTM Image Format is dual-licensed under either
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option.