Patent attributes
A method applied to an optical disc drive for calculating an error detection code corresponding to a data sector is disclosed. The data sector includes a plurality of bytes arranged in a matrix having N lines along a first direction and M lines along a second direction perpendicular to the first direction. The method includes: along the first direction, calculating error detection codes corresponding to M bytes located at each of the N lines, wherein for each of the N lines, only bytes having error bits affect an error detection code for the line; adjusting an error detection code of each of the N lines according to a displacement between each of the N lines and a last line of the N lines; and then determining the error detection code of the data sector by summing up the displacement-adjusted error detection code of each of the N lines.