From a3c4b18d1d49a34596afb5458dbe256c0fab901f Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 31 Jul 2025 21:38:20 +0100 Subject: [PATCH] [Specification] Add Claunia Subchannel Transform appendix --- docs/spec/appendixes/cst.adoc | 19 +++++++++++++++++++ docs/spec/spec.adoc | 6 +++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 docs/spec/appendixes/cst.adoc diff --git a/docs/spec/appendixes/cst.adoc b/docs/spec/appendixes/cst.adoc new file mode 100644 index 0000000..43339a1 --- /dev/null +++ b/docs/spec/appendixes/cst.adoc @@ -0,0 +1,19 @@ +[appendix] +== Claunia Subchannel Transform + +The subchannel structure in CompactDisc media—and compatible formats—consists of eight interleaved components: `P`, `Q`, `R`, `S`, `T`, `U`, `V`, `W`. + +In their raw form, each byte read from the disc contains a single bit from each of these elements, resulting in a highly interleaved data stream. +This structure, while efficient for playback, poses challenges for compression algorithms such as LZMA, which struggle with apparent randomness and achieve poor compression ratios (typically less than 2%). + +To address this, the **Claunia Subchannel Transform** is applied: + +- All bits are **de-interleaved** so that each subchannel (`P` through `W`) is formed into distinct byte streams. +- All `P` bytes from all sectors are written sequentially, followed by all `Q` bytes, then `R`, and so on up to `W`. + +While this transform temporarily increases memory usage (approximately 32MiB additional), the benefits are substantial: + +- Compression speed improves up to **10× faster** +- Compression gains reach approximately **96%**, particularly on media lacking `R`–`W` subchannel data—as is the case with ~99% of discs. + +NOTE: For implementation specifics or updates to this method, refer to the authoritative `libaaruformat` source. diff --git a/docs/spec/spec.adoc b/docs/spec/spec.adoc index 403445c..1c18560 100644 --- a/docs/spec/spec.adoc +++ b/docs/spec/spec.adoc @@ -130,4 +130,8 @@ include::appendixes/data_types.adoc[] <<< -include::appendixes/compression.adoc[] \ No newline at end of file +include::appendixes/compression.adoc[] + +<<< + +include::appendixes/cst.adoc[] \ No newline at end of file