a1800_codec 1.0.0

A clean room implementation of the GeneralPlus A1800 audio codec
Documentation
  • Coverage
  • 63.7%
    93 out of 146 items documented0 out of 56 items with examples
  • Size
  • Source code size: 427.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 9.25 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • John-K/a1800_codec
    4 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • John-K

a1800_codec

A Rust encoder and decoder for the GeneralPlus A1800 audio codec, reverse-engineered from A1800.DLL.

The A1800 is a fixed-point subband audio codec that splits 320-sample frames (20 ms at 16 kHz) into 32 subbands using a 5-stage butterfly filterbank. It supports bitrates from 4800 to 32000 bps in steps of 800. All arithmetic uses ITU-T G.729-style saturating i16/i32 operations.

See Codec.md for the full technical reference, including the decode/encode pipelines, constant tables, DLL function map, and known differences between this implementation and the original DLL.

Authoring

This code was co-developed with Claude Opus 4.6 and made use of Ghidra 12.0.2 and ghidra-mcp v2.0.0

Building

cargo build --release

No external dependencies.

Usage

# Decode .a18 to WAV
a1800_codec decode input.a18 output.wav [--sample-rate 16000]

# Encode WAV to .a18
a1800_codec encode input.wav output.a18 [--bitrate 16000]

Input WAV files must be mono 16-bit PCM. The default sample rate is 16000 Hz and the default bitrate is 16000 bps.

.a18 File Format

Offset Size Type Description
0x00 4 LE u32 Byte count of frame data
0x04 2 LE u16 Bitrate
0x06 ... bytes Frames, each (bitrate/800) x 2 bytes

Round-trip Quality

At 16 kHz / 16 kbps:

  • Overall correlation: ~0.60
  • RMS ratio (output/input): ~1.02
  • 1 kHz sine SNR: ~15 dB

Bitrates 4800-24000 bps are supported for encoding. Decoding works at all bitrates.

Tests

See Testing.md for more information about non-synthetic tests.

cargo test

52 tests cover fixed-point arithmetic, bitstream I/O, encoder/decoder round-trips at multiple bitrates, filterbank invertibility, and a 5-second WAV round-trip.

License

This is an independent clean-room reimplementation based on static analysis of the original DLL. No original source code or proprietary headers were used.