1 This describes the program as shipped with cdrkit, a spinoff from the
2 cdrtools project. However, the cdrtools developers are no longer
3 involved in the development of this spinoff and therefore shall not
4 be made responsible for any problem caused by it. Do not try to get
5 support for this program by contacting the original authors.
7 This is a small description for the Reed-Solomon library intended for
11 It is assumed that you have a basic knowledge of cd sector formats.
13 The library can handle three types of sector data:
16 sub channel r-w sectors
18 Currently only encoding is implemented. Decoding and optionally
19 error correction is planned for later.
23 The process of sector formatting has several stages. Beginning with
24 a data sector (2048, 2324, or 2336 bytes) a sector of 2352 bytes is
25 built. This format can be read raw by SCSI MMC-2 and ATAPI drives and
26 is accepted by cd burners. The additions are an optionally 32 bit CRC
27 checksum and two layers of Reed-Solomon codes (called Reed-Solomon
29 This sector is then scrambled (exor'ed with a bitstream).
30 The result is called F1 frames. Afterwards even and odd bytes are
31 swapped, this is called F2 frames. The result is equivalent to an
32 audio sector and is treated as such by the cd burner.
33 So, if we wrote a series of sectors (F2 frames) into a CDR file and
34 later burned them as 'audio', they would turn up as perfect data sectors.
36 So, now we are at the level of audio sectors. Audio sectors get their
37 own error correction data (called CIRC). Sector size goes up to
38 3136 bytes (that is 4/3 times 2352 bytes). Furthermore different
39 words get delayed differently and swap positions. The result is ready
40 to be fed into the so-called EightFourteenModulator (when subchannels
43 Now, only sub channels are missing. While the p and q sub
44 channels have to be generated elsewhere, any supplied r-w subchannel
45 user data is protected by two levels of error correction
46 codes. This format is read by cd burners when burning cd+graphics.
47 The cdimage is a sequence of sectors, each containing audio data and
48 after that subchannel data.
49 Similar to audio sectors delaying and permutation of words
50 takes place. After that the cd burner would mix sub channel data with
51 the formatted audio sectors to feed the EFModulator.
53 NOTE: Most of the described stages need not to be done in order to
54 prepare sectors for burning, since all cd burners do at least CIRC,
55 delaying and swaps. For data sectors they also do scrambling and f2
61 int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);
63 encodes data sectors. The returned data is __unscrambled__ and not in
67 inout pointer to an array of at least 2352 bytes.
68 sectortype One of the MODE_* constants from ecc.h. This defines
69 how to format the sector.
70 address The logical address to be used in the header
73 NOTE: the data portion has be to aligned properly for performance
74 reasons (see ecc.h for details). So, no moves are necessary here.
76 Generating f2 frames to be used like audio sectors
77 int scramble_L2(unsigned char *inout)
79 generates f2 frames in place from sectors generated by do_encode_L2().
82 inout pointer to an array of at least 2352 bytes.
87 int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
88 unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*
89 PACKETS_PER_SUBCHANNELFRAME],
90 int delay1, int permute);
92 repack user data and add error correction data. P and q subchannels
93 should be added later, since all bytes are in place then.
96 in pointer to an array of at least 72 bytes. It contains
97 the user data for one frame.
98 out pointer to an array of at least 96 bytes. Here is
99 output frame is placed.
100 delay1 do low level delaying, when set to 1.
101 permute do low level permutations, when set to 1.
103 NOTE: Probably both options need either to be set on (1) or off (0) together.
105 There is more, but that is seldomly used.
108 The library is accompanied by small verify programs, that compare real
109 raw sectors with the formatted results. They are also intended as demo
110 applications (how to use the library). In order to be able to feed
111 real raw sectors into them, the package read2448 is recommended/needed.
112 You can only verify sector streams of one sector type, currently no mix.
114 For more information have a look into ecc.h
116 recommended Documents:
117 Yellow Book or ISO 10149
121 Source: libedc/README from cdrtools package
122 Edited for cdrkit by Christian Fromme <kaner@strace.org>
.