-
Notifications
You must be signed in to change notification settings - Fork 11
/
RLL.py
79 lines (75 loc) · 1.39 KB
/
RLL.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python
# Author Dario Clavijo 2017
# GPLv3
# source https://en.wikipedia.org/wiki/Run-length_limited
# static tables
RLL={FM01:{0b0:0b10,0b1:0b11}, #FM(0,1) Manchester coding
GCR02:{0b0000:0b11001, # RLL(0,2) IBM group coded recording
0b0001:0b11011,
0b0010:0b10010,
0b0011:0b10011,
0b0100:0b11101,
0b0101:0b10101,
0b0110:0b10110,
0b0111:0b10111,
0b1000:0b11010,
0b1001:0b01001,
0b1010:0b01010,
0b1011:0b01011,
0b1100:0b11110,
0b1101:0b01101,
0b1110:0b01110,
0b1111:0b01111
},
RLL17:{0b00:0b101, # RLL(1,7)
0b01:0b100,
0b10:0b001,
0b11:0b010,
0b0000:0b101000,
0b0001:0b100000,
0b1000:0b001000,
0b1001:0b010000
),
RLL27:{0b11,0b1000, # RLL[2,7] Western Digital WD5010A, WD5011A, WD50C12
0b10:0b0100,
0b000:0b100100,
0b010:0b000100,
0b011:0b001000,
0b0011:0b00001000,
0b0010:0b00100100
},
ST11R:{0b11:0b1000, # RLL(2,7) ST11R Seagate
0b10:0b0100,
0b000:0b000100,
0b010:0b100100,
0b011:0b001000,
0b0011:0b00001000,
0b0010:0b00100100
},
HH113:{0b00:0b010, # IBM HHH(1,13)
0b01:0b001,
0b10:0b100,
0b11:0b101,
0b0110:0b001000,
0b0111:0b010000,
0b1110:0b101000,
0b1111:0b100000,
0b001100:0b010000000,
0b001101:0b001000000,
0b101100:0b100000000,
0b101101:0b101000000,
0b00111011:0b010000000000,
0b10111011:0b100000000000
}
#dynamic tables
# MFM1,3
# DCFree(1,7)
#WIP
def encode(func,bitstream):
bit_table = RLL[func]
#WIP
return bitstream
def decode(func,bitstream):
bit_table = RLL[func]
#WIP
return bitstream