cd_read_side.jpg (8K)

Chip's CD Media Resource Center:
CD-DA (Digital Audio) 9

Image from Disctronics

Frames, Blocks and Subcodes

We've come this far, so I may as well explain what happens to the subcode bits. Recall that there are 8 subcode bits in each frame. These bits each have names: P, Q, R, S, T, U and V. Each bit corresponds to a particular subcode channel of the same name. You may well ask, "what good is one bit?" But that's one bit per channel per frame and there are 7350 frames in a single second of audio.

Frames are collected into subcode blocks or just blocks of 98 frames (98/7350 = 1/75 second). There are thus 98 bits for each subcode channel in a subcode block. Special SYNC 0 and SYNC 1 values of the subcode byte are used to delineate the start of a subcode block.

subcodebytes.gif (7K)
From the ECMA-130 CD-ROM spec.
Note that the subcode bytes are called control bytes in that spec.

Since there is one bit for each subcode in each frame, there are thus 98 bits for each subcode channel in a block. These are collected into 98-bit data structures, one for each channel. Since the first two bits are always defined by the SYNC 0 and SYNC 1 values, they are ignored in some descriptions, and the remainder of the subcode channel is treated as a 96-bit structure.

Only the P and Q channels are used for standard audio CDs, the other channels are ignored. Note that these channels have nothing whatsover to do with the P and Q parity bits.

Various uses have cropped up for the other subcode channels, including low-resolution graphics (CD+G discs), Karaoke and CD-TEXT. [CDDA FAQ #31] [Disctronics]

Aside: I've also seen subcode blocks called frames by those who use the term CD block for what we've been calling frames. I.e. frame = CD block, and subcode block = frame. As best as I've been able to determine, however, my usage is correct and widely used. I've also seen these subcode blocks called sectors, which seems to be incorrect. A sector is a CD-ROM concept which is very similar to a subcode block (it also contains 98 frames). But ECMA-130 uses the term section to describe a subcode block on a CD-ROM and clearly distinguishes it from a sector. More on this in the next part of this document.

The P Channel

The P channel contains very simple codes called Flags that denote the start of user data tracks and the end of the disc. It was designed for very simple CD players that were not sophisticated enough to use the Q channel. The P channel indicates the start of a track by at least 2 seconds (150 blocks) of all 1's, and the last block containing 1's should be the first block containing user data for the new track. If there is a Pause longer than 2 seconds before the audio track, then the P channel is set to 1's throughout the Pause. During the track, the P channel consists of all 0's. At the end of the last audio track, the P channel contains one more Flag of 2-3 sec, followed by 2 sec of 0's, and then alternating 1's and 0's at 2Hz to indicates that the Lead-out area has been reached. The P channel bits of a subcode block always have the same value, 1 or 0.

kuhn-pchannel.gif (4K)
P Channel Usage
Diagram from Kuhn EE498 lecture notes
The Q Channel

The Q channel is much more interesting. It is used to contain table of contents and program timing information, and can even be used to contain disc catalog numbers and track indentification codes. It has 3 different modes. The general format for all of the Q channel modes is shown below.

qchannel.gif (3K)
From the ECMA-130 CD-ROM spec.
Note that the two sync bits do not appear in the diagram, but are included in the bit numbering.

Of the four control bits (bits 2 through 5), each has a particular meaning. Bit 2 controls the number of audio channels (0 for 2 channels, 1 for 4 channels) and is almost never used. Bit 3 is unassigned for CD-DA, but is defined in the CD-ROM spec to denote that the user data is digital data (not digital audio). Bit 4 is for copy protection (0 means "may not be copied", 1 means "may be copied"). Bit 5 denotes whether or not a digital audio track has been recorded with pre-emphasis.

The 16-bit CRC field contains a Cyclical Redundancy Check computed over the 82 (or possibly 80) preceding bits of the structure.

The 4-bit "q-Mode" field is an integer which determines how the following "q-Data" is to be interpreted. There are three modes defined for CD-DA, and Mode 1 has two different interpretations depending on whether it appears in the Lead-in area or in the Progra area.

Mode 1 (Lead-in Area)
In the Lead-in area, successive q-Data fields contain the table of contents of the disc. Each q subcode block contains the data for a single track, and the data for each track is repeated in three successive blocks before going on to the next one. The structure of the 72-bit q-Data field in this case looks like this:
qdata-01leadin.gif (3K)
From the ECMA-130 CD-ROM spec.

Each of the nine subfields is 8 bits wide, and most of them contain two-digit BCD (binary-coded decimal) numbers (each digit takes 4 bits).

TNO -- The TNO, or Track Number field is set to 0 during the lead-in.

POINTER, P-MIN, P-SEC and P-FRAC -- When the POINTER field is set to BCD values 01 to 99, then its value is taken to be a track number (legal track numbers are 1 to 99). In that case, "the P-MIN, P-SEC and P-FRAC fields specify in absolute time the position of the first Section with Index = 01" of that track. [ECMA-130, 22.3.4.2].
If POINTER is set to hex A0, then "the P-MIN field specifies the Track Number of the first Information Track in the User Data area and all bits of the P-SEC and P-FRAC fields are set to 0.
"If set to (A1), the P-MIN field specifies the Track Number of the last Information Track in the User Data area and all bits of the P-SEC and P-FRAC fields are set to 0.
"If set to (A2) the P-MIN, P-SEC and P-FRAC fields specify the beginning of the Lead-out Track, thus the address of the first Section of the Lead-out Track." [ECMA-130 22.3.4.2]

ZERO -- All 8 bits of the ZERO field are set to 0.

MIN, SEC and FRAC --In the Program area, these fields give the relative time within the track, counting up to the end of the track. Here in the Lead-in area, they just count up from some arbitrary starting number. The FRAC field contains a number 00 to 74, denoting the number of 75ths of a second (recall that each block corresponds to 1/75 second).

Mode 1 (Program Area)
In the Program area (and the Lead-out area), the q-Data field contains timing information for the current track. Each of the nine subfields in the diagram below is 8 bits wide. They largely consist of two-digit BCD (binary-coded decimal) numbers (each digit takes 4 bits).
qdata-01program.gif (4K)
From the ECMA-130 CD-ROM spec [22.3.3]

TNO -- The Track Number field gives the number of the current track, i.e. the track to which this block belongs.

INDEX -- The INDEX field is used to define subdivisions of the current track. Value 00 means that the current section is a Pause. Values 01 to 99 may be used consecutively to denote the current subdivision within the current track. It's not yet clear to me how these subdivisions are used.

ZERO -- All 8 bits of the ZERO field are set to 0.

MIN, SEC and FRAC --These fields give the relative time within the track of the current block, starting at zero and counting up to the end of the track, except during a Pause, when it counts down to zero at the end of the Pause. The FRAC field contains a number 00 to 74, denoting the number of 75ths of a second.

A-MIN, A-SEC and A-FRAC --Specify the absolute elapsed time of the current block since the start of the Program area. The absolute time starts at zero in the first block of the first track at the start of the Program area, and counts up continuously until the end of the Lead-out area.

Mode 2
In Mode 2, the q-Data field contains a disc Catalog Number.
qdata-02.gif (3K)
From the ECMA-130 CD-ROM spec [22.3.5]

N1 - N13 -- The Catalog field. Thirteen BCD digits (4 bits each) occupying 52 bits, "forming an identification number according to the article numbering standard ENA/UPC of the International Article Numbering Association EAN." [ECMA-130 22.3.5.1]

ZERO -- All 8 bits of the ZERO field are set to 0.

A-FRAC -- Continuation of the fraction portion of the absolute time from the preceding section.

Mode 3
Mode 3 allows one to tag each track with identifying ISRC codes (International Standard Recording Codes). Kuhn says that these can be used for automatic copyright logging. Disctronics has a good description of ISRC. They claim that the ISRC is required, which is inconsistent with what I've heard elsewhere. Mode 3 is not defined for CD-ROM; it is only used (if used at all) with CD-DA. One has the impression that it has been deprecated.
qdata-03.gif (4K)
Q Channel Mode 3
Diagram from Kuhn EE498 lecture notes



Last Updated Monday October 15, 2001 17:58:15 PDT