CD Error Checking

Hello, I am new to this forum and relatively new to this topic. What particularly fascinates me is the error checking on a cd-rom drive. I have done some research but I still have a few questions.

1)Lets say the cd-reader encounters a bad sector on a data disk, now is the data “repaired” in the cd-rom hardware or by the software reading the cd-rom. In the same manner is the EFM encoding done in the cd-burner hardware or software

2)What happens if the error-checking is unable to repair a certain sector.

3)Is there a way to copy damaged data off of a cd while simply leaving the damaged sections out.

4)When a damaged sector is found how exactly does a cd-reader “repair” that sector.

I know some of these questions may sound simple but I would appreciate any answers someone could give me. Thanks.

It is a fascinating topic!

1)Lets say the cd-reader encounters a bad sector on a data disk, now is the data “repaired” in the cd-rom hardware or by the software reading the cd-rom. In the same manner is the EFM encoding done in the cd-burner hardware or software

The first levels of processing (including EFM decoding, de-interleaving, and C1/C2 Reed-Solomon error-correction stuff) happen transparantly to your computer; it is normally done by a chip within the CDR player housing.

The computer then receives sectors of 2352 bytes of data. If your playing an audio CD, that’s it: these represent raw audio samples.

However, if the CD is a CD-ROM, we’re not done yet. In this case, another layer of error de-interleaving correction is performed that results in 2048 bytes per sectors of useful data. Although I am not an expert on how this “higher” level works, I am quite sure that this work is usually done by the operating system on the computer (specifically, the CD-ROM driver).

2)What happens if the error-checking is unable to repair a certain sector.

On the low level (the stuff that happens in the CDR player), the data is interpolated or (if the error is too bad) zeroed.

On the high level (2352->2048 bytes step), the problems are detected and will result in an ‘error’ result code from the driver to the application program.

3)Is there a way to copy damaged data off of a cd while simply leaving the damaged sections out.

There are ways to read the “raw” contents of CDs and CD-ROMs (including the errors). So the answer is yes.

There are some types of errors (very bad scratches) that make this impossible though. The laser can lose track of the signal track, in which case it has to re-synchronize. This can lead to gaps, of course.

4)When a damaged sector is found how exactly does a cd-reader “repair” that sector.

If you want to know it exactly you should consult the relevant standard (ECMA-130). This will presume you know quite a bit about the relevant mathematics concerning Reed-Solomon codes…

I know some of these questions may sound simple but I would appreciate any answers someone could give me. Thanks.

Hope this helps.

Thank you very much for the answers they were a great help but a few questions still remain.

On the high level (2352->2048 bytes step), the problems are detected and will result in an ‘error’ result code from the driver to the application program.

Is it possible to catch this error in a programming language and have the cd continue reading anyways?

On the low level (the stuff that happens in the CDR player), the data is interpolated or (if the error is too bad) zeroed.

Can the results of the interpolation be predicted. What I mean is if I have some data and I know what sectors are damage would I be able to predict exactly what the error correction would “hand” to the computer.

Again thanks for all the help.

I believe the “higher” level of error correction that you are talking about is the “C3/C4” level of error correction. There is no specification for it and it is implemented in optical drive firmware per the manufacturers design. If you are doing “cooked” scsi reads you will receive the data after this level, if you are doing raw then before.

If you want to see what errors sectors are giving you.

  1. Issue a scsi read command on the sector
  2. Look at the sense data returned back to you after the command has completed