home *** CD-ROM | disk | FTP | other *** search
/ ftp.cdrom.com/pub/cdrom/ / cdrom.tar / cdrom / textinfo / cd_intro.txt < prev    next >
Text File  |  1993-02-10  |  24KB  |  497 lines

  1. Article 3273 in alt.cd-rom:
  2. From: harvey@CED.BERKELEY.EDU (Harvey Grosser)
  3. Subject: Here's the format of data on CDs and CD-ROMs
  4. Message-ID: <9206040752.AA00961@ced.berkeley.edu>
  5. Date: 4 Jun 92 08:03:24 GMT
  6. Sender: CD-ROM <CDROM-L@uccvma.ucop.edu>
  7. Reply-To: Harvey Grosser <harvey@CED.BERKELEY.EDU>
  8. Distribution: alt
  9. Organization: FUNET-NGW
  10. Lines: 478
  11.  
  12. The following document is available on Apple's FTP site ftp.apple.com
  13. as "pub/cd-rom/cd-rom.summary".  I think you'll find it very interesting.
  14.  
  15.                 Harvey Grosser
  16.                 harvey@ced.berkeley.edu
  17. --------------------------------------------
  18. The following is part 1 of a nice intro to CD technology written
  19. by Andy Poggio in 1988.  It appears here in its original form.
  20.  
  21. CD Summary Introduction
  22.  
  23. As requested by many people, I will post this CD Summary over the next
  24. several days in five parts of which this is the first.  I received
  25. requests from rec.audio, comp.ivideodisc, and comp.graphics -- so I will
  26. post it to all these groups.  I'm not sure that it is appropriate for
  27. comp.graphics but I DID receive multiple requests to post it there.
  28.  
  29. The summary is somewhat technical but more important it is factual: I
  30. wrote it after reading the original CD standards documents available from
  31. Sony or Philips to CD licensees.  If you are interested in the standards
  32. documents, you need to contact them directly -- sorry, I don't have a
  33. specific contact or phone number.
  34.  
  35. I do work for Apple but this summary contains a minimum of Apple
  36. references.  I hope everyone agrees that the result is in keeping with net
  37. policy on the matter.
  38.  
  39. --andy
  40.  
  41. CD Summary Part 1
  42.  
  43. CD-ROM Technical Summary
  44. >From Plastic Pits to "Fantasia"
  45.  
  46.  
  47.                                                Andy Poggio
  48.                                                March, 1988
  49.  
  50.  
  51. Abstract
  52.  
  53. This summary describes how information is encoded on Compact Disc (CD)
  54. beginning with the physical pits and going up through higher levels of
  55. data encoding to the structured multimedia information that is possible
  56. with programs like HyperCard.  This discussion is much broader than any
  57. single standards document, e.g. the CD-Audio Red Book, while omitting much
  58. of the detail needed only by drive manufacturers.
  59.  
  60. Salient Characteristics
  61.  
  62. 1.  High information density -- With the density achievable using optical
  63. encoding, the CD can contain some 540 megabytes of data on a disc less
  64. than five inches in diameter.
  65.  
  66. 2.  Low unit cost -- Because CDs are manufactured by a well-developed
  67. process similar to that used to stamp out LP records, unit cost in large
  68. quantities is less than two dollars.
  69.  
  70. 3.  Read only medium -- CD-ROM is read only; it cannot be written on or
  71. erased.  It is an electronic publishing, distribution, and access medium;
  72. it cannot replace magnetic disks.
  73.  
  74. 4.  Modest random access performance -- Due to optical read head mass and
  75. data encoding methods, random access ("seek time") performance of CD is
  76. better than floppies but not as good as magnetic hard disks.
  77.  
  78. 5.  Robust, removable medium -- The CD itself is comprised mostly of, and
  79. completely coated by, durable plastic.  This fact and the data encoding
  80. method allow the CD to be resistant to scratches and other handling
  81. damage.  Media lifetime is expected to be long, well beyond that of
  82. magnetic media such as tape.  In addition, the optical servo scanning
  83. mechanism allows CDs to be removed from their drives.
  84.  
  85. 6.  Multimedia storage -- Because all CD data is stored digitally, it is
  86. inherently multimedia in that it can store text, images, graphics, sound,
  87. and any other information expressed in digital form.  Its only limit in
  88. this area is the rate at which data can be read from the disc, currently
  89. about 150 KBytes/second.  This is sufficient for all but uncompressed,
  90. full motion color video.
  91. CD Summary Part 2
  92.  
  93. CD  Data  Hierarchy
  94.  
  95. Storing data on a CD may be thought of as occurring through a data
  96. encoding hierarchy with each level built upon the previous one.  At the
  97. lowest level, data is physically stored as pits on the disc.  It is
  98. actually encoded by several low-level mechanisms to provide high storage
  99. density and reliable data recovery.  At the next level, it organized into
  100. tracks which may be digital audio or CD-ROM.  The High Sierra
  101. specification then defines a file system built on CD-ROM tracks.  Finally,
  102. applications like HyperCard specify a content format for files.
  103.  
  104. The Physical Medium
  105.  
  106. The Compact Disc itself is a thin plastic disk some 12 cm. in diameter.
  107. Information is encoded in a plastic-encased spiral track contained on the
  108. top of the disk.  The spiral track is read optically by a noncontact head
  109. which scans approximately radially as the disk spins just above it.  The
  110. spiral is scanned at a constant linear velocity thus assuring a constant
  111. data rate.  This requires the disc to rotate at a decreasing rate as the
  112. spiral is scanned from its beginning near the center of the disc to its
  113. end near the disc circumference.
  114.  
  115. The spiral track contains shallow depressions, called pits, in a
  116. reflective layer.  Binary information is encoded by the lengths of these
  117. pits and the lengths of the areas between them, called land.  During
  118. reading, a low power laser beam from the optical head is focused on the
  119. spiral layer and is reflected back into the head.  Due to the optical
  120. characteristics of the plastic disc and  the wavelength of light used, the
  121. quantity of reflected light varies depending on whether the beam is on
  122. land or on a pit.  The modulated, reflected light is converted to a radio
  123. frequency, raw data signal by a photodetector in the optical head.
  124.  
  125. Low-level Data Encoding
  126.  
  127. To ensure accurate recovery, the disc data must be encoded to optimize the
  128. analog-to-digital conversion process that  the radio frequency signal must
  129. undergo.  Goals of the low level data encoding include:
  130.  
  131. 1.  High information density.  This requires encoding that makes the best
  132. possible use of the high, but limited, resolution of the laser beam and
  133. read head optics.
  134.  
  135. 2.  Minimum intersymbol interference.  This requires making the minimum
  136. run length, i.e. the minimum number of consecutive zero bits or one bits,
  137. as large as possible.
  138.  
  139. 3.  Self-clocking.  To avoid a separate timing track, the data should be
  140. encoded so as to allow the clock signal to be regenerated from the data
  141. signal.  This requires limiting the maximum run length of the data so that
  142. data transitions will regenerate the clock.
  143.  
  144. 4.  Low digital sum value (the number of one bits minus the number of zero
  145. bits).  This minimizes the low frequency and DC content of the data signal
  146. which permits optimal servo system operation.
  147.  
  148. A straightforward encoding would be to simply to encode zero bits as land
  149. and one bits as pits.  However, this does not meet goal (1) as well as the
  150. encoding scheme actually used.  The current CD scheme encodes one bits as
  151. transitions from pit to land or land to pit and zero bits as constant pit
  152. or constant land.
  153.  
  154. To meet goals (2) to (4), it is not possible to encode arbitrary binary
  155. data.  For example, the integer 0 expressed as thirty-two bits of zero
  156. would have too long a run length to satisfy goal (3).  To accommodate
  157. these goals, each eight-bit byte of actual data is encoded as fourteen
  158. bits of channel data.  There are many more combinations of fourteen bits
  159. (16,384) than there are of eight bits (256).  To encode the eight-bit
  160. combinations, 256 combinations of fourteen bits are chosen that meet the
  161. goals.  This encoding is referred to as Eight-to-Fourteen Modulation (EFM)
  162. coding.
  163.  
  164. If fourteen channel bits were concatenated with another set of fourteen
  165. channel bits, once again the above goals may not be met.  To avoid this
  166. possibility, three merging bits are included between each set of fourteen
  167. channel bits.  These merging bits carry no information but are chosen to
  168. limit run length, keep data signal DC content low, etc.  Thus, an eight
  169. bit byte of actual data is encoded into a total of seventeen channel bits:
  170.  fourteen EFM bits and three merging bits.
  171.  
  172. To achieve a reliable self-clocking system, periodic synchronization is
  173. necessary.  Thus, data is broken up into individual frames each beginning
  174. with a synchronization pattern.  Each frame also contains twenty-four data
  175. bytes, eight error correction bytes, a control and display byte (carrying
  176. the subcoding channels), and merging bits separating them all.  Each frame
  177. is arranged as follows:
  178.  
  179. Sync Pattern24 + 3channel bits
  180. Control and Display byte14 + 3
  181. Data bytes12 * (14 + 3)
  182. Error Correction bytes 4 * (14 + 3)
  183. Data bytes12 * (14 + 3)
  184. Error Correction bytes 4 * (14 + 3)
  185.  
  186. TOTAL588channel bits
  187.  
  188. Thus, 192 actual data bits (24 bytes) are encoded as 588 channel bits.
  189.  
  190. Editorial:  A CD physically has a single spiral track about 3 miles long.
  191. CDs spin at about 500 RPM when reading near the center down to about 250
  192. RPM when reading near the circumference.
  193.  
  194. Disc with a 'c' or disk with a 'k'?  A usage has emerged for these terms:
  195. disk is used for eraseable disks (e.g. magnetic disks) while disc is used
  196. for read-only (e.g. CD-ROM discs).  One would presumably call a frisbee a
  197. disc.
  198.  
  199. --andy
  200. CD Summary Part 3
  201.  
  202. First Level Error Correction
  203.  
  204. Data errors can arise from production defects in the disk itself, defects
  205. arising from subsequent damage to the disk, or jarring during reading.  A
  206. significant characteristic of  these errors is that they often occur in
  207. long bursts.  This could be due, for example, to a relatively wide mark on
  208. the disc that is opaque to the laser beam used to read the disc.  A system
  209. with two logical components called the Cross Interleave Reed-Solomon
  210. Coding (CIRC) is employed for error correction.  The cross interleave
  211. component breaks up the long error bursts into many short errors; the
  212. Reed-Solomon component provides the error correction.
  213.  
  214. As each frame is read from the disc, it is first decoded from fourteen
  215. channel bits (the three merging bits are ignored) into eight-bit data
  216. bytes.  Then, the bytes from each frame (twenty-four data bytes and eight
  217. error correction bytes) are passed to the first Reed-Solomon decoder which
  218. uses four of the error correction bytes and is able to correct one byte in
  219. error out of the 32.  If there are no uncorrectable errors, the data is
  220. simply passed along.  If there are errors, the data is marked as being in
  221. error at this stage of decoding.
  222.  
  223. The twenty-four data bytes and four remaining error correction bytes are
  224. then passed through unequal delays before going through another
  225. Reed-Solomon decoder.  These unequal delays result in an interleaving of
  226. the data that spreads long error bursts among many different passes
  227. through the second decoder.  The delays are such that error bursts up to
  228. 450 bytes long can be completely corrected.  The second Reed-Solomon
  229. decoder uses the last four error correction bytes to correct any remaining
  230. errors in the twenty-four data bytes.  At this point, the data goes
  231. through a de-interleaving process to restore the correct byte order.
  232.  
  233. Subcoding Channels and Blocks
  234.  
  235. The eight-bit control and display byte in each frame carries the subcoding
  236. channels.  A subcoding block consists of 98 subcoding bytes, and thus 98
  237. of the 588-bit frames.  A block then can contain 2352 bytes of data.
  238. Seventy-five blocks are read each second.  With this information, it is
  239. now straightforward to calculate that the CD data rate is in fact correct
  240. for CD digital audio (CD-DA):
  241.  
  242. Required CD digital audio data rate:  44.1 K samples per second * 16 bits
  243. per sample * 2 channels = 1,411,200 bits/sec.
  244.  
  245. CD data rate:  8 bits per byte * 24 bytes per frame * 98 frames per
  246. subcoding block * 75 subcoding blocks per second = 1,411,200 bits/sec.
  247.  
  248. The eight subcoding channels are labeled P through W and are encoded one
  249. bit for each channel in a control and display byte.  Channel P is used as
  250. a simple music track separator.  Channel Q is used for control purposes
  251. and encodes information like track number, track type, and location
  252. (minute, second, and frame number).  During the lead-in track of the disc,
  253. channel Q encodes a table of contents for the disk giving track number and
  254. starting location.  Standards have been proposed that would use the
  255. remaining channels for line graphics and ASCII character strings, but
  256. these are seldom used.
  257.  
  258. Track Types
  259.  
  260. Tracks can have two types as specified in the control bit field of
  261. subchannel Q.  The first type is CD digital audio (CD-DA) tracks.  The
  262. two-channel audio is sampled at 44.1 Khz with sixteen bit linear sampling
  263. encoded as twos complement numbers.  The sixteen bit samples are separated
  264. into two eight-bit bytes; the bytes from each channel alternate on the
  265. disc.   Variations for audio tracks include pre-emphasis and four track
  266. recording.
  267.  
  268. The other type of track specified by the subchannel Q control bit field is
  269. the data track.  These must conform to the CD-ROM standard described
  270. below.  In general, a disc can have a mix of CD digital audio tracks and a
  271. CD-ROM track, but the CD-ROM track must come first.
  272.  
  273. Editorial:  This first level error correction (the only type used for CD
  274. Audio data) is extremely powerful.  The CD specification allows for discs
  275. to have up to 220 raw errors per second.  Every one of these errors is
  276. (almost always) perfectly corrected by the CIRC scheme for a net error
  277. rate of zero.  For example, our tests using Apple's CD-ROM drive (which
  278. also plays audio) show that raw error rates are around 50-100 per second
  279. these days.  Of course, these are perfectly corrected, meaning that the
  280. original data is perfectly recovered.  We have tested flawed discs with
  281. raw rates up to 300 per second.  Net errors on all of these discs?  Zero!
  282. I would expect a typical audio CD player to perform similarly.  Thus I
  283. expect this raw error rate to have no audible consequences.
  284.  
  285. So why did I say "almost always" corrected above?  Because a sufficiently
  286. bad flaw may produce uncorrectable errors.  These very unusual errors are
  287. "concealed" by the player rather than corrected.  Note that this
  288. concealment is likely to be less noticeable than even a single scratch on
  289. an LP.  Such a flaw might be a really opaque finger smudge; CDs do merit
  290. careful handling.  On the two (and only two) occasions I have found these,
  291. I simply sprayed on a little Windex glass cleaner and wiped it off using
  292. radial strokes.  This restored the CDs to zero net errors.
  293.  
  294. One can argue about the quality of the process of conversion of analog
  295. music to and from digital representation, but in the digital domain CDs
  296. are really very, very good.
  297.  
  298. CD Summary Part 4
  299.  
  300. CD-ROM Data Tracks
  301.  
  302. Each CD-ROM data track is divided into individually addressable blocks of
  303. 2352 data bytes, i.e. one subcoding block or 98 frames.  A header in each
  304. block contains the block address and the mode of the block.  The block
  305. address is identical to the encoding of minute, second, and frame number
  306. in subcode channel Q.  The modes defined in the CD-ROM specification are:
  307.  
  308. Mode 0 -- all data bytes are zero.
  309.  
  310. Mode 1 -- (CD-ROM Data):
  311. Sync Field - 12 bytes
  312. Header Field - 4
  313. User Data Field - 2048
  314. Error Detection Code - 4
  315. Reserved - 8
  316. Error Correction - 276
  317.  
  318. Mode 2 -- (CD Audio or Other Data):
  319. Sync Field - 12 bytes
  320. Header Field - 4
  321. User Data Field - 2048
  322. Auxiliary Data Field - 288
  323.  
  324. Thus, mode 1 defines separately addressable, physical 2K byte data blocks
  325. making CD-ROM look at this level very similar to other digital mass
  326. storage devices.
  327.  
  328. Second Level Error Correction
  329.  
  330. An uncorrected error in audio data typically results in a brief, often
  331. inaudible click during listening at worst.  An uncorrected error in other
  332. kinds of data, for example program code, may render a CD unusable.  For
  333. this reason, CD-ROM defines a second level of error detection and error
  334. correction (EDC/ECC) for mode 1 data.  The information for the EDC/ECC
  335. occupies most of the auxiliary data field.
  336.  
  337. The error detection code is a cyclic redundancy check (CRC) on the sync,
  338. header, and user data.  It occupies the first four bytes of the auxiliary
  339. data field and provides a very high probability that uncorrected errors
  340. will be detected.  The error correction code is essentially the same as
  341. the first level error correction in that interleaving and Reed-Solomon
  342. coding are used.  It occupies the final 276 bytes of the auxiliary data
  343. field.
  344.  
  345. Editorial:  This extra level of error correction for CD-ROM blocks is one
  346. of the many reasons that CD-ROM drives are much more expensive than
  347. consumer audio players.  To perform this error correction quickly requires
  348. substantial extra computing power (sometimes a dedicated microprocessor)
  349. in the drive.
  350.  
  351. This is also one reason that consumer players like the Magnavoxes which
  352. claim to be CD-ROM compatible (with their digital output jack on the back)
  353. are useless for that purpose.  They have no way of dealing with the CD-ROM
  354. error correction.  They also have no way for a computer to tell them where
  355. to seek.
  356.  
  357. Another reason that CD-ROM drives are more expensive is that they are
  358. built to be a computer peripheral rather than a consumer device, i.e. like
  359. a combination race car/truck rather than a family sedan.  One story,
  360. probably apocryphal but not far from the truth, has it that a major
  361. Japanese manufacturer tested some consumer audio players to simulate
  362. computer use:  they made them seek (move the optical head) from the inside
  363. of the CD to the outside and back again.  These are called maximum seeks.
  364. The story says they managed to do this for about 24 hours before they
  365. broke down.  A CD-ROM drive needs to be several orders of magnitude more
  366. robust.  Fast and strong don't come cheap.
  367. CD Summary Part 5
  368.  
  369. The High Sierra File System Standard
  370.  
  371. Built on top of the addressable 2K blocks that the CD-ROM specification
  372. defines, the next higher level of data encoding is a file system that
  373. permits logical organization of the data on the CD.  This can be a native
  374. file system like the Macintosh Hierarchical File System (HFS).  Another
  375. alternative is the High Sierra (also known as the ISO 9660) file standard,
  376. recently approved by the National Information Standards Organization
  377. (NISO) and the International Standards Organization (ISO), which defines a
  378. file system carefully tuned to CD characteristics.  In particular:
  379.  
  380. 1.  CDs have modest seek time and high capacity.  As a result, the High
  381. Sierra standard makes tradeoffs that reduce the number of seeks needed to
  382. read a file at the expense of space efficiency.
  383.  
  384. 2.  CDs are read-only.  Thus, concerns like space allocation, file
  385. deletion, and the like are not addressed in the specification.
  386.  
  387. For High Sierra file systems, each individual CD is a volume.  Several CDs
  388. may be grouped together in a volume set and there is a mechanism for
  389. subsequent volumes in a set to update preceding ones.  Volumes can contain
  390. standard file structures, coded character set file structures for
  391. character encoding other than ASCII, or boot records.  Boot records can
  392. contain either data or program code that may be needed by systems or
  393. applications.
  394.  
  395. High Sierra Directories and Files
  396.  
  397. The file system is a hierarchical one in which directories may contain
  398. files or other directories.  Each volume has a root directory which serves
  399. as an ancestor to all other directories or files in the volume.  This
  400. dictates an overall tree structure for the volume.
  401.  
  402. A typical disadvantage in hierarchical systems is that to read a file
  403. (which must be a leaf of the hierarchy tree) given its full path name, it
  404. is necessary to begin at the root directory and search through each of its
  405. ancestral directories until the entry for the file is found.  For example,
  406. given the path name "Wine Regions:America:California:Mendocino", three
  407. directories (the first three components of the path name) would need to be
  408. searched.  Typically, a separate seek would be required for each
  409. directory.  This would result in relatively poor performance.
  410.  
  411. To avoid this, High Sierra specifies that each volume contain a path table
  412. in addition to its directories and files.  The path table describes the
  413. directory hierarchy in a compact form that may be cached in computer
  414. memory for optimum performance.  The path table contains entries for the
  415. volume's directories in a breadth-first order; directories with a common
  416. parent are listed in lexicographic order.  Each entry contains only the
  417. location of the directory it describes, its name, and the location in the
  418. path table of its parent.  This mechanism allows any directory to be
  419. accessed with only a single CD seek.
  420.  
  421. Directories contain more detailed information than the path table.  Each
  422. directory entry contains:
  423.  
  424. Directory or file location.
  425. File length.
  426. Date and time of creation.
  427. Name of the file.
  428. Flags:
  429. Whether the entry is for a file or a directory.
  430. Whether or not it is an associated file.
  431. Whether or not it has records.
  432. Whether or not it has read protection.
  433. Whether or not it has subsequent extents.
  434. Interleave structure of the file.
  435.  
  436. Interleaving may be used, for example, to meet realtime requirements for
  437. multiple files whose contents must be presented simultaneously.  This
  438. would happen if a file containing graphic images were interleaved with a
  439. file containing compressed sound that describes the images.
  440.  
  441. Files themselves are recorded in contiguous (or interleaved) blocks on the
  442. disc.  The read-only nature of CD permits this contiguous recording in a
  443. straightforward manner.  A file may also be recorded in a series of
  444. noncontiguous extents with a directory entry for each extent.
  445.  
  446. The specification does not favor any particular computer architecture.  In
  447. particular all significant, multibyte numbers are recorded twice, once
  448. with the most significant byte first and once with the least significant
  449. byte first.
  450.  
  451. Multimedia Information
  452.  
  453. Using the file system are applications that create and portray multimedia
  454. information.  While it is true that a CD can store anything that a
  455. magnetic disk can store (and usually much more of it), CDs will be used
  456. more for storing information than for storing programs.  It is the very
  457. large storage capacity of CDs coupled with their low cost that opens up
  458. the possibilities for interactive, multimedia information to be used in a
  459. multitude of ways.
  460.  
  461. Programs like HyperCard, with it's ease of authoring and broad
  462. extensibility, are very useful for this purpose.  Hypercard stacks, with
  463. related information such as color images and sound, can be easily and
  464. inexpensively stored on CDs despite their possibly very large size.
  465.  
  466. Editorial:  The High Sierra file system gets its name from the location of
  467. the first meeting on it:  the High Sierra Hotel at Lake Tahoe.  It is much
  468. more commonly referred to as ISO 9660, though the two specifications are
  469. slightly different.
  470.  
  471. It has gotten very easy and inexpensive to make a CD-ROM disc (or audio
  472. CD).  For example, you can now take a Macintosh hard disk and send it with
  473. $1500 to one of several CD pressers.  They will send you back your hard
  474. disk and 100 CDs with exactly the same content as what's on your disk.
  475. This is the easy way to make CDs with capacity up to the size of your hard
  476. disk (Apple's go up to 160 megabytes).  True, this is not a full CD but
  477. CDs don't need to be full.  If you have just 10 megabytes and need 100
  478. copies, CDs may be the best way to go.
  479.  
  480. If you are buying a CD-ROM drive, there are several factors you might
  481. consider in making your choice.  Two factors NOT to consider are capacity
  482. and data rate.  The capacity of all CD-ROM drives is determined solely by
  483. the CD they are reading.  Though you will see a range of numbers in
  484. manufacturers' specs (e.g. 540, 550, 600, and 650 Mbytes), any drive can
  485. read any disc and so they are all fundamentally the same.  All CD-ROM
  486. drives read data at a net 150 Kbytes/sec for CD-ROM data.  Other data
  487. rates you may see may include error correction data (not included in the
  488. net rate) or may be a mode 2 data rate (faster than mode 1).  All drives
  489. will be the same in all of these specs.
  490.  
  491. [ Editorial:  The last paragraph is wrong on both points.  This may have
  492. been true in 1988, when this article was written, but is no longer true
  493. today (in 1992).  A few drives cannot read CDROMs with more than about
  494. 620 megabytes on them.  There is a huge variation in speed.  Today only
  495. the slowest drives read at 150 kb/sec.  Most read at least 300 and at
  496. least one (the Pioneer DRM-600X) reads at 600 kb/sec. ]
  497.