happycube / ld-decode

Software defined LaserDisc decoder
GNU General Public License v3.0
312 stars 83 forks source link

ld-process-efm: try to correct errors in the Q channel #862

Closed atsampson closed 1 year ago

atsampson commented 1 year ago

Since the error rate needs to be fairly low in order to make it worth decoding EFM at all, the most likely type of error here is a single bit being flipped. So when a CRC error is detected, try flipping each bit in turn and checking the CRC again.

The improvement from this is very small because ld-process-efm already guesses the timestamp when the CRC fails based on the previous frame (so it's only improving the cases where the guessed timestamp is wrong, which I guess might happen after a long dropout?). It'll still fall back to this behaviour if correction doesn't work.

Without this (slightly rotten EE 1035 side 4 with EFM capture):

Info:        Audio samples: 163019874
Info:      Corrupt samples: 0
Info:      Missing samples: 412776
Info:    Concealed samples: 146598
Info:        Total samples: 163579248

With this, 95% of the Q-channel CRC errors are corrected, and we get a little more valid audio out:

Info:        Audio samples: 163023294
Info:      Corrupt samples: 0
Info:      Missing samples: 412776
Info:    Concealed samples: 143178
Info:        Total samples: 163579248