ecmlib 1.0.0

A simple CD-ROM error code modeler (ECM), used to save some space storing backups.
Documentation

Error Code Modeling

git maintenance

The Error Code Modeling is a encoder that allows to remove some duplicated or replicable data from a CD-ROM image. This can reduce their size up to 12% and help to improve their compression ratio. The reduction method is lossless (if correctly used), and can reach even higher ratios depending of the sectors type (for example GAPs).

This encoder works by removing this data:

  • Sync: Always a fixed data (0x00FFFFFFFFFFFFFFFFFFFF00). 12 bytes per sector.
  • ADDR: Replicable sector address (minute, second, frame/sector). 3 bytes per sector. *1
  • MODE: Sector mode (1 or 2). 1 byte per sector. *2
  • FLAGS: Mode 2 XA sector redundant flags. 8 bytes per sector: allows to save 4 bytes.
  • EDC: Error detection code. 4 bytes per sector.
  • ECC: Error correctino code. 276 bytes per sector.

Some data cannot be replicated so it must be stored correctly to be able to recover it:

*1: The Address can be easily determined knowing the sector number. The first sector starts at the address 00:02:00.

*2: The Mode cannot be determined with the sector data, so must be provided at decoding time. The encoder allows to remove it because it can be stored in some ways that allows to save a little space. For example, if all the sectors on a 700MB disk are using the same type (360.000 sectors), you can store the mode into a single byte and save 359.999 bytes in the encoded stream.

The removed data depends of the sector type, for example a CDDA sector is raw and no data can be removed, and other sectors doesn't have ECC, FLAGS, etc.

For more information and examples, please refer to the crate documentation.