-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdequantize.pl
More file actions
61 lines (55 loc) · 3.02 KB
/
dequantize.pl
File metadata and controls
61 lines (55 loc) · 3.02 KB
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
#!/usr/bin/perl
my @tab = (
-1.88095, -1.70947, -1.60246, -1.52302, -1.45913,
-1.40532, -1.3586, -1.31715, -1.27979, -1.24569, -1.21426, -1.18507,
-1.15776, -1.13208, -1.10782, -1.08479, -1.06285, -1.0419, -1.02182,
-1.00253, -0.983966, -0.966052, -0.948738, -0.931974, -0.915719,
-0.899934, -0.884585, -0.869641, -0.855077, -0.840866, -0.826987,
-0.81342, -0.800145, -0.787147, -0.77441, -0.761919, -0.749661, -0.737624,
-0.725798, -0.714171, -0.702734, -0.691478, -0.680395, -0.669476,
-0.658714, -0.648103, -0.637636, -0.627307, -0.61711, -0.60704, -0.597092,
-0.58726, -0.57754, -0.567929, -0.558421, -0.549013, -0.539701, -0.530482,
-0.521353, -0.512309, -0.503348, -0.494468, -0.485665, -0.476936,
-0.46828, -0.459693, -0.451173, -0.442719, -0.434327, -0.425996,
-0.417724, -0.409508, -0.401348, -0.39324, -0.385184, -0.377178,
-0.369219, -0.361307, -0.35344, -0.345617, -0.337836, -0.330095,
-0.322394, -0.314731, -0.307104, -0.299514, -0.291957, -0.284434,
-0.276943, -0.269482, -0.262052, -0.25465, -0.247277, -0.23993, -0.232608,
-0.225312, -0.21804, -0.21079, -0.203563, -0.196357, -0.189171, -0.182005,
-0.174857, -0.167727, -0.160614, -0.153518, -0.146437, -0.13937,
-0.132317, -0.125278, -0.118251, -0.111235, -0.104231, -0.0972367,
-0.0902519, -0.0832759, -0.076308, -0.0693475, -0.0623937, -0.0554459,
-0.0485035, -0.0415658, -0.0346321, -0.0277017, -0.0207739, -0.0138482,
-0.00692376, 0., 0.00692376, 0.0138482, 0.0207739, 0.0277017, 0.0346321,
0.0415658, 0.0485035, 0.0554459, 0.0623937, 0.0693475, 0.076308,
0.0832759, 0.0902519, 0.0972367, 0.104231, 0.111235, 0.118251, 0.125278,
0.132317, 0.13937, 0.146437, 0.153518, 0.160614, 0.167727, 0.174857,
0.182005, 0.189171, 0.196357, 0.203563, 0.21079, 0.21804, 0.225312,
0.232608, 0.23993, 0.247277, 0.25465, 0.262052, 0.269482, 0.276943,
0.284434, 0.291957, 0.299514, 0.307104, 0.314731, 0.322394, 0.330095,
0.337836, 0.345617, 0.35344, 0.361307, 0.369219, 0.377178, 0.385184,
0.39324, 0.401348, 0.409508, 0.417724, 0.425996, 0.434327, 0.442719,
0.451173, 0.459693, 0.46828, 0.476936, 0.485665, 0.494468, 0.503348,
0.512309, 0.521353, 0.530482, 0.539701, 0.549013, 0.558421, 0.567929,
0.57754, 0.58726, 0.597092, 0.60704, 0.61711, 0.627307, 0.637636,
0.648103, 0.658714, 0.669476, 0.680395, 0.691478, 0.702734, 0.714171,
0.725798, 0.737624, 0.749661, 0.761919, 0.77441, 0.787147, 0.800145,
0.81342, 0.826987, 0.840866, 0.855077, 0.869641, 0.884585, 0.899934,
0.915719, 0.931974, 0.948738, 0.966052, 0.983966, 1.00253, 1.02182,
1.0419, 1.06285, 1.08479, 1.10782, 1.13208, 1.15776, 1.18507, 1.21426,
1.24569, 1.27979, 1.31715, 1.3586, 1.40532, 1.45913, 1.52302, 1.60246,
1.70947, 1.88095
);
@tab == 255 or die;
sub fnd {
my $x = shift;
my $i = 0;
++$i while $i < @tab && $tab[$i] <= $x;
$i
}
select(STDOUT);
$| = 1;
local $/ = \1024;
while (my $chunk = <>) {
print pack('C*', map fnd($_), unpack 'd*', $chunk);
}