• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

README.interfaceH A D23-Nov-20061.9 KiB7659

README.paranoiaH A D18-Aug-20063.8 KiB8465

cdda_paranoia.hH A D12-Oct-20063.7 KiB10960

gap.cH A D08-Dec-20065.8 KiB245172

gap.hH A D12-Oct-20061.6 KiB4723

isort.cH A D08-Dec-20063.5 KiB160102

isort.hH A D12-Oct-20061.8 KiB7033

overlap.cH A D08-Dec-20065.1 KiB229145

overlap.hH A D12-Oct-20061.1 KiB3410

p_block.cH A D08-Dec-20069.9 KiB475350

p_block.hH A D12-Oct-20065.3 KiB211127

paranoia.cH A D28-Jan-200741.4 KiB1,7421,112

pmalloc.cH A D08-Dec-20062 KiB9047

pmalloc.hH A D12-Oct-20061.4 KiB437

README.interface

1/*
2 * Exports (libparanoia) cdda_paranoia.h
3 */
4cdrom_paranoia	*paranoia_init	__PR((void * d, int nsectors));
5void		paranoia_modeset __PR((cdrom_paranoia * p, int mode));
6long		paranoia_seek	__PR((cdrom_paranoia * p, long seek, int mode));
7Int16_t		*paranoia_read	__PR((cdrom_paranoia * p, void (*callback) (long, int)));
8Int16_t		*paranoia_read_limited __PR((cdrom_paranoia * p, void (*callback) (long, int), int maxretries));
9void		paranoia_free	__PR((cdrom_paranoia * p));
10void		paranoia_overlapset __PR((cdrom_paranoia * p, long overlap));
11
12/*
13 * Exports ?? (libparanoia) overlap.h
14 */
15extern	void	paranoia_resetall	__PR((cdrom_paranoia * p));
16extern	void	paranoia_resetcache	__PR((cdrom_paranoia * p));
17
18Supported:
19
20PARANOIA_MODE_VERIFY
21PARANOIA_MODE_OVERLAP
22PARANOIA_MODE_NEVERSKIP
23
24Unsupported:
25
26PARANOIA_MODE_FRAGMENT
27PARANOIA_MODE_SCRATCH
28PARANOIA_MODE_REPAIR
29
30
31
32/*
33 * Imports (global Code)
34 */
35cdda_disc_firstsector	(cdrom_drive *d)		-> long sector
36cdda_disc_lastsector	(cdrom_drive *d)		-> long sector
37cdda_read		(cdrom_drive *d, void *buffer, long beginsector, long sectors)	-> long sectors
38cdda_sector_gettrack	(cdrom_drive *d,long sector)	-> int trackno
39cdda_track_audiop	(cdrom_drive *d,int track)	-> int ???  /* Is audiotrack */
40cdda_track_firstsector	(cdrom_drive *d,int track)	-> long sector
41cdda_track_lastsector	(cdrom_drive *d,int track)	-> long sector
42cdda_tracks		(cdrom_drive *d)		-> int tracks
43
44callback		(long inpos, int function)
45
46/*
47 * Imports (libc)
48 */
49calloc
50free
51malloc
52realloc
53
54memcmp
55memcpy
56memmove
57memset
58
59qsort
60
61/*--------------------------------------------------------------------------*/
62usalp = usal_open();
63bufsize = usal_bufsize(usalp, CDR_BUF_SIZE);
64nsecs = bufsize / SEC_SIZE;
65
66cdp = paranoia_init(usalp, nsecs);
67# paranoia_modeset(cdp, mode);
68# paranoia_overlapset(cdp, overlap);
69
70while (not ready) {
71	bp = paranoia_read(cdp, NULL);
72	write(f, bp, SEC_SISE);
73}
74
75paranoia_free(cdp);
76

README.paranoia

1# @(#)README.paranoia	1.1 97/04/04 J. Schilling from Monty (xiphmont@mit.edu)
2README.paranoia
3
4Paranoia II:
5(c) Monty
6xiphmont@mit.edu
7
8Hi there.
9
10All CDROM drives are not created equal.  You're probably using this
11patch because yours is a little less equal than others-- or maybe you
12just keep your CD collection in a box of full of gravel.  Jewel cases
13are for wimps; you know what I'm talking about.
14
15This patch adds extra-robust interframe syncronization, code to detect
16scratches (and hold sync across the scratch) and finally routines to
17filter out scratches as best possible.  These are all handled
18automatically by fairly modular code.
19
201) extra interframe syncronization -------------------------------------
21
22Some CD drives can read audio data from an exact starting point to an
23exact ending point flawlessly; these are rare.  A larger number of
24drives read from only an approximately correct starting point, but do
25manage to get all the data in-tact from wherever they manage to begin
26the read.  Stock cdda2wav is coded with this in mind.
27
28More drives, especially IDE-like and recent ATAPI drives, suffer from
29framing misalignments within atomic multi-sector read operations.
30Cdda2wav is also set, by default, to read 75 sectors at a time from
31ATAPI drives, which Linux's IDE driver breaks into multiple 8 sector
32reads to conserve kernel memory.  Both of these things will break
33cdda2wav; the symptoms include cracks or pops within the read sample.
34
35The "Paranoia" patch will verify the alignment of *every* byte read by
36cdda2wav.  The goal is data integrity, not performance: a minimum 50%
37speed hit will result from the patch, likely more if your CDROM
38suffers from the framing bugs the patch corrects.
39
402) scratch detection and tolerance ------------------------------------
41
42Because overlap syncronization requires matching exact, perfect sample
43sections, scratched CDs typically cause normal cdda2wav to bail when
44overlap syncronization is turned on.  The second part of the
45"Paranoia" patch ignores scratches in the read bitstream and
46syncronizes using the data that can still be "trusted".  This step
47also collects first-pass scratch detection information used by the
48third section of the patch.
49
50Expect performance to drop through the floor on a badly scratched CD;
51the code can no longer use a simple case of exact matching for speedy
52correlation.  Maintaining solid sync across a scratch is processor
53bound; later I'll add speedier algorithms for correlation than the
54brute force method currently used.  Scratch detection imposes little
55additional overhead on a non-scratched CD.
56
573) scratch repair -----------------------------------------------------
58
59Scratches are an irrevocable loss of data.  Still, it's usually
60possible to reconstruct a sample closer to the original data than the
61raw hissing, fluttering and crackling that severe scratches in the CD
62surface produce.
63
64Scratch filtering is the 'hard part' of this patch.  It needs to do
65two things; first, find the 'pops' that escaped detection in section 2
66of the patch and secondly fill in the gaps.  Both are acheived using
67delta (slew) averaging and forward and backward linear predictive
68interpolation (with IIR filters) to fill in known gaps as well as look
69for 'problem values' in stretches of sample known to be scratched.
70
71THE SCRATCH DETECTION IS NOT PERFECT.  Nor is the repair perfect,
72although it is easier than detecting scratches reliably.  Both are
73cases of coming arbitrarily close to perfection; Paranoia is designed
74with light to moderate damage in mind, but will still recover a
75listenable sample from heavy damage.
76
77Paranoia still has quite a bit of room for improvement in the scratch
78repair code... If cdda2wav + Paranoia is not doing an acceptable job
79on CDs that you just gotta have, drop me a line; I didn't want to sink
80months into a project I wasn't certain anyone would ever use :-)
81
82Monty
83
84