MythTV  master
vbilut.cpp
Go to the documentation of this file.
1 #include <vbilut.h>
2 
3 extern "C" {
4 const unsigned char lang_chars[1+8+8][16] =
5 {
6  { 0, 0x23,0x24,0x40,0x5b,0x5c,0x5d,0x5e,0x5f,0x60,0x7b,0x7c,0x7d,0x7e },
7 
8  // for latin-1 font
9  // English (100%)
10  { 0, 0xa3,0x24,0x40,0xab,0xbd,0xbb,0xac,0x23,0xad,0xbc,0xa6,0xbe,0xf7 }, // £$@«½»¬#­¼¦¾÷
11  // German (100%)
12  { 0, 0x23,0x24,0xa7,0xc4,0xd6,0xdc,0x5e,0x5f,0xb0,0xe4,0xf6,0xfc,0xdf }, // #$§ÄÖÜ^_°äöüß
13  // Swedish/Finnish/Hungarian (100%)
14  { 0, 0x23,0xa4,0xc9,0xc4,0xd6,0xc5,0xdc,0x5f,0xe9,0xe4,0xf6,0xe5,0xfc }, // #¤ÉÄÖÅÜ_éäöåü
15  // Italian (100%)
16  { 0, 0xa3,0x24,0xe9,0xb0,0xe7,0xbb,0xac,0x23,0xf9,0xe0,0xf2,0xe8,0xec }, // £$é°ç»¬#ùàòèì
17  // French (100%)
18  { 0, 0xe9,0xef,0xe0,0xeb,0xea,0xf9,0xee,0x23,0xe8,0xe2,0xf4,0xfb,0xe7 }, // éïàëêùî#èâôûç
19  // Portuguese/Spanish (100%)
20  { 0, 0xe7,0x24,0xa1,0xe1,0xe9,0xed,0xf3,0xfa,0xbf,0xfc,0xf1,0xe8,0xe0 }, // ç$¡áéíóú¿üñèà
21  // Czech/Slovak (60%)
22  { 0, 0x23,0x75,0x63,0x74,0x7a,0xfd,0xed,0x72,0xe9,0xe1,0x65,0xfa,0x73 }, // #uctzýíréáeús
23  // reserved (English mapping)
24  { 0, 0xa3,0x24,0x40,0xab,0xbd,0xbb,0xac,0x23,0xad,0xbc,0xa6,0xbe,0xf7 }, // £$@«½»¬#­¼¦¾÷
25 
26  // for latin-2 font
27  // Polish (100%)
28  { 0, 0x23,0xf1,0xb1,0xaf,0xa6,0xa3,0xe6,0xf3,0xea,0xbf,0xb6,0xb3,0xbc }, // #ñ±¯¦£æó꿶³¼
29  // German (100%)
30  { 0, 0x23,0x24,0xa7,0xc4,0xd6,0xdc,0x5e,0x5f,0xb0,0xe4,0xf6,0xfc,0xdf }, // #$§ÄÖÜ^_°äöüß
31  // Estonian (100%)
32  { 0, 0x23,0xf5,0xa9,0xc4,0xd6,0xae,0xdc,0xd5,0xb9,0xe4,0xf6,0xbe,0xfc }, // #õ©ÄÖ®ÜÕ¹äö¾ü
33  // Lettish/Lithuanian (90%)
34  { 0, 0x23,0x24,0xa9,0xeb,0xea,0xae,0xe8,0xfc,0xb9,0xb1,0x75,0xbe,0x69 }, // #$©ëê®èü¹±u¾i
35  // French (90%)
36  { 0, 0xe9,0x69,0x61,0xeb,0xec,0x75,0xee,0x23,0x65,0xe2,0xf4,0x75,0xe7 }, // éiaëìuî#eâôuç
37  // Serbian/Croation/Slovenian (100%)
38  { 0, 0x23,0xcb,0xc8,0xc6,0xae,0xd0,0xa9,0xeb,0xe8,0xe6,0xae,0xf0,0xb9 }, // #ËÈƮЩëèæ®ð¹
39  // Czech/Slovak (100%)
40  { 0, 0x23,0xf9,0xe8,0xbb,0xbe,0xfd,0xed,0xf8,0xe9,0xe1,0xec,0xfa,0xb9 }, // #ù軾ýíøéáìú¹
41  // Rumanian (95%)
42  { 0, 0x23,0xa2,0xde,0xc2,0xaa,0xc3,0xce,0x69,0xfe,0xe2,0xba,0xe3,0xee }, // #¢ÞªÃÎiþâºãî
43 };
44 }
45 
46 // TODO - Add the rest...page 107
47 const unsigned char chartab_original[13] =
48 {
49  0x23,0xa4,0x40,0x5b,0x5c,0x5d,0x5e,0x5f,0x27,0x7b,0x7c,0x7d,0x7e // #¤@[\\]^_\'{|}~
50 };
51 
52 const unsigned short hammtab[256] =
53 {
54  0x0101, 0x100f, 0x0001, 0x0101, 0x100f, 0x0100, 0x0101, 0x100f,
55  0x100f, 0x0102, 0x0101, 0x100f, 0x010a, 0x100f, 0x100f, 0x0107,
56  0x100f, 0x0100, 0x0101, 0x100f, 0x0100, 0x0000, 0x100f, 0x0100,
57  0x0106, 0x100f, 0x100f, 0x010b, 0x100f, 0x0100, 0x0103, 0x100f,
58  0x100f, 0x010c, 0x0101, 0x100f, 0x0104, 0x100f, 0x100f, 0x0107,
59  0x0106, 0x100f, 0x100f, 0x0107, 0x100f, 0x0107, 0x0107, 0x0007,
60  0x0106, 0x100f, 0x100f, 0x0105, 0x100f, 0x0100, 0x010d, 0x100f,
61  0x0006, 0x0106, 0x0106, 0x100f, 0x0106, 0x100f, 0x100f, 0x0107,
62  0x100f, 0x0102, 0x0101, 0x100f, 0x0104, 0x100f, 0x100f, 0x0109,
63  0x0102, 0x0002, 0x100f, 0x0102, 0x100f, 0x0102, 0x0103, 0x100f,
64  0x0108, 0x100f, 0x100f, 0x0105, 0x100f, 0x0100, 0x0103, 0x100f,
65  0x100f, 0x0102, 0x0103, 0x100f, 0x0103, 0x100f, 0x0003, 0x0103,
66  0x0104, 0x100f, 0x100f, 0x0105, 0x0004, 0x0104, 0x0104, 0x100f,
67  0x100f, 0x0102, 0x010f, 0x100f, 0x0104, 0x100f, 0x100f, 0x0107,
68  0x100f, 0x0105, 0x0105, 0x0005, 0x0104, 0x100f, 0x100f, 0x0105,
69  0x0106, 0x100f, 0x100f, 0x0105, 0x100f, 0x010e, 0x0103, 0x100f,
70  0x100f, 0x010c, 0x0101, 0x100f, 0x010a, 0x100f, 0x100f, 0x0109,
71  0x010a, 0x100f, 0x100f, 0x010b, 0x000a, 0x010a, 0x010a, 0x100f,
72  0x0108, 0x100f, 0x100f, 0x010b, 0x100f, 0x0100, 0x010d, 0x100f,
73  0x100f, 0x010b, 0x010b, 0x000b, 0x010a, 0x100f, 0x100f, 0x010b,
74  0x010c, 0x000c, 0x100f, 0x010c, 0x100f, 0x010c, 0x010d, 0x100f,
75  0x100f, 0x010c, 0x010f, 0x100f, 0x010a, 0x100f, 0x100f, 0x0107,
76  0x100f, 0x010c, 0x010d, 0x100f, 0x010d, 0x100f, 0x000d, 0x010d,
77  0x0106, 0x100f, 0x100f, 0x010b, 0x100f, 0x010e, 0x010d, 0x100f,
78  0x0108, 0x100f, 0x100f, 0x0109, 0x100f, 0x0109, 0x0109, 0x0009,
79  0x100f, 0x0102, 0x010f, 0x100f, 0x010a, 0x100f, 0x100f, 0x0109,
80  0x0008, 0x0108, 0x0108, 0x100f, 0x0108, 0x100f, 0x100f, 0x0109,
81  0x0108, 0x100f, 0x100f, 0x010b, 0x100f, 0x010e, 0x0103, 0x100f,
82  0x100f, 0x010c, 0x010f, 0x100f, 0x0104, 0x100f, 0x100f, 0x0109,
83  0x010f, 0x100f, 0x000f, 0x010f, 0x100f, 0x010e, 0x010f, 0x100f,
84  0x0108, 0x100f, 0x100f, 0x0105, 0x100f, 0x010e, 0x010d, 0x100f,
85  0x100f, 0x010e, 0x010f, 0x100f, 0x010e, 0x000e, 0x100f, 0x010e,
86 };
87 
88 const uint8_t hamm84tab[256] =
89 {
90  255,255,255,255,255,255,255,255,255, 0, // 0 - 9
91  255, 8,255,255,255,255,255,255,255,255, // 10 - 19
92  255,255,255,255,255,255,255,255, 6,255, // 20 - 29
93  14,255,255,255,255,255, 12,255, 4,255, // 30 - 39
94  255,255,255,255,255,255,255,255,255, 10, // 40 - 49
95  255, 2,255,255,255,255,255,255,255,255, // 50 - 59
96  255,255,255,255, 1,255, 9,255,255,255, // 60 - 69
97  255,255,255,255,255,255,255,255,255,255, // 70 - 79
98  255,255,255,255,255, 7,255, 15,255,255, // 80 - 89
99  255,255,255,255,255,255,255,255,255,255, // 90 - 99
100  255,255,255,255,255,255,255,255,255, 13, // 100 - 109
101  255, 5,255,255,255,255,255,255,255,255, // 110 - 119
102  11,255, 3,255,255,255,255,255,255,255, // 120 - 129
103  255,255,255, 12,255, 4,255,255,255,255, // 130 - 139
104  255,255,255,255, 10,255, 2,255,255,255, // 140 - 149
105  255,255,255,255,255,255,255,255,255,255, // 150 - 159
106  255,255,255,255,255,255,255,255, 0,255, // 160 - 169
107  8,255,255,255,255,255,255,255,255,255, // 170 - 179
108  255,255,255,255,255,255,255,255,255, 6, // 180 - 189
109  255, 14,255,255,255,255,255,255,255,255, // 190 - 199
110  255,255,255,255, 13,255, 5,255,255,255, // 200 - 209
111  255,255,255,255,255,255,255, 11,255, 3, // 210 - 219
112  255,255,255,255,255, 1,255, 9,255,255, // 220 - 229
113  255,255,255,255,255,255,255,255,255,255, // 230 - 239
114  255,255,255,255, 7,255, 15,255,255,255, // 240 - 249
115  255,255,255,255,255,255 }; // 250 - 255
116 
117 
118 const uint8_t unham84tab[256] =
119 {
120  0x01, 0xff, 0x81, 0x01, 0xff, 0x00, 0x01, 0xff, // 0x
121  0xff, 0x02, 0x01, 0xff, 0x0a, 0xff, 0xff, 0x07,
122  0xff, 0x00, 0x01, 0xff, 0x00, 0x80, 0xff, 0x00, // 1x
123  0x06, 0xff, 0xff, 0x0b, 0xff, 0x00, 0x03, 0xff,
124  0xff, 0x0c, 0x01, 0xff, 0x04, 0xff, 0xff, 0x07, // 2x
125  0x06, 0xff, 0xff, 0x07, 0xff, 0x07, 0x07, 0x87,
126  0x06, 0xff, 0xff, 0x05, 0xff, 0x00, 0x0d, 0xff,
127  0x86, 0x06, 0x06, 0xff, 0x06, 0xff, 0xff, 0x07,
128  0xff, 0x02, 0x01, 0xff, 0x04, 0xff, 0xff, 0x09,
129  0x02, 0x82, 0xff, 0x02, 0xff, 0x02, 0x03, 0xff,
130  0x08, 0xff, 0xff, 0x05, 0xff, 0x00, 0x03, 0xff,
131  0xff, 0x02, 0x03, 0xff, 0x03, 0xff, 0x83, 0x03,
132  0x04, 0xff, 0xff, 0x05, 0x84, 0x04, 0x04, 0xff,
133  0xff, 0x02, 0x0f, 0xff, 0x04, 0xff, 0xff, 0x07,
134  0xff, 0x05, 0x05, 0x85, 0x04, 0xff, 0xff, 0x05,
135  0x06, 0xff, 0xff, 0x05, 0xff, 0x0e, 0x03, 0xff,
136  0xff, 0x0c, 0x01, 0xff, 0x0a, 0xff, 0xff, 0x09,
137  0x0a, 0xff, 0xff, 0x0b, 0x8a, 0x0a, 0x0a, 0xff,
138  0x08, 0xff, 0xff, 0x0b, 0xff, 0x00, 0x0d, 0xff,
139  0xff, 0x0b, 0x0b, 0x8b, 0x0a, 0xff, 0xff, 0x0b,
140  0x0c, 0x8c, 0xff, 0x0c, 0xff, 0x0c, 0x0d, 0xff,
141  0xff, 0x0c, 0x0f, 0xff, 0x0a, 0xff, 0xff, 0x07,
142  0xff, 0x0c, 0x0d, 0xff, 0x0d, 0xff, 0x8d, 0x0d,
143  0x06, 0xff, 0xff, 0x0b, 0xff, 0x0e, 0x0d, 0xff,
144  0x08, 0xff, 0xff, 0x09, 0xff, 0x09, 0x09, 0x89,
145  0xff, 0x02, 0x0f, 0xff, 0x0a, 0xff, 0xff, 0x09,
146  0x88, 0x08, 0x08, 0xff, 0x08, 0xff, 0xff, 0x09,
147  0x08, 0xff, 0xff, 0x0b, 0xff, 0x0e, 0x03, 0xff,
148  0xff, 0x0c, 0x0f, 0xff, 0x04, 0xff, 0xff, 0x09,
149  0x0f, 0xff, 0x8f, 0x0f, 0xff, 0x0e, 0x0f, 0xff,
150  0x08, 0xff, 0xff, 0x05, 0xff, 0x0e, 0x0d, 0xff,
151  0xff, 0x0e, 0x0f, 0xff, 0x0e, 0x8e, 0xff, 0x0e,
152 };
153 
154 const uint8_t vbi_bit_reverse[256] =
155 {
156  0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
157  0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
158  0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
159  0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
160  0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
161  0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
162  0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
163  0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
164  0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
165  0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
166  0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
167  0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
168  0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
169  0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
170  0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
171  0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
172  0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
173  0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
174  0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
175  0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
176  0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
177  0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
178  0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
179  0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
180  0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
181  0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
182  0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
183  0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
184  0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
185  0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
186  0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
187  0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
188 };
189 
190 const char *formats[8] =
191 {
192  "Full format 4:3, 576 lines",
193  "Letterbox 14:9 centre, 504 lines",
194  "Letterbox 14:9 top, 504 lines",
195  "Letterbox 16:9 centre, 430 lines",
196  "Letterbox 16:9 top, 430 lines",
197  "Letterbox > 16:9 centre",
198  "Full format 14:9 centre, 576 lines",
199  "Anamorphic 16:9, 576 lines"
200 };
201 
202 const char *subtitles[4] =
203 {
204  "none",
205  "in active image area",
206  "out of active image area",
207  "?"
208 };
209 
214 const char hamm24par[3][256] =
215 {
216  { // parities of first byte
217  0, 33, 34, 3, 35, 2, 1, 32, 36, 5, 6, 39, 7, 38, 37, 4,
218  37, 4, 7, 38, 6, 39, 36, 5, 1, 32, 35, 2, 34, 3, 0, 33,
219  38, 7, 4, 37, 5, 36, 39, 6, 2, 35, 32, 1, 33, 0, 3, 34,
220  3, 34, 33, 0, 32, 1, 2, 35, 39, 6, 5, 36, 4, 37, 38, 7,
221  39, 6, 5, 36, 4, 37, 38, 7, 3, 34, 33, 0, 32, 1, 2, 35,
222  2, 35, 32, 1, 33, 0, 3, 34, 38, 7, 4, 37, 5, 36, 39, 6,
223  1, 32, 35, 2, 34, 3, 0, 33, 37, 4, 7, 38, 6, 39, 36, 5,
224  36, 5, 6, 39, 7, 38, 37, 4, 0, 33, 34, 3, 35, 2, 1, 32,
225  40, 9, 10, 43, 11, 42, 41, 8, 12, 45, 46, 15, 47, 14, 13, 44,
226  13, 44, 47, 14, 46, 15, 12, 45, 41, 8, 11, 42, 10, 43, 40, 9,
227  14, 47, 44, 13, 45, 12, 15, 46, 42, 11, 8, 41, 9, 40, 43, 10,
228  43, 10, 9, 40, 8, 41, 42, 11, 15, 46, 45, 12, 44, 13, 14, 47,
229  15, 46, 45, 12, 44, 13, 14, 47, 43, 10, 9, 40, 8, 41, 42, 11,
230  42, 11, 8, 41, 9, 40, 43, 10, 14, 47, 44, 13, 45, 12, 15, 46,
231  41, 8, 11, 42, 10, 43, 40, 9, 13, 44, 47, 14, 46, 15, 12, 45,
232  12, 45, 46, 15, 47, 14, 13, 44, 40, 9, 10, 43, 11, 42, 41, 8
233  },
234  { // parities of second byte
235  0, 41, 42, 3, 43, 2, 1, 40, 44, 5, 6, 47, 7, 46, 45, 4,
236  45, 4, 7, 46, 6, 47, 44, 5, 1, 40, 43, 2, 42, 3, 0, 41,
237  46, 7, 4, 45, 5, 44, 47, 6, 2, 43, 40, 1, 41, 0, 3, 42,
238  3, 42, 41, 0, 40, 1, 2, 43, 47, 6, 5, 44, 4, 45, 46, 7,
239  47, 6, 5, 44, 4, 45, 46, 7, 3, 42, 41, 0, 40, 1, 2, 43,
240  2, 43, 40, 1, 41, 0, 3, 42, 46, 7, 4, 45, 5, 44, 47, 6,
241  1, 40, 43, 2, 42, 3, 0, 41, 45, 4, 7, 46, 6, 47, 44, 5,
242  44, 5, 6, 47, 7, 46, 45, 4, 0, 41, 42, 3, 43, 2, 1, 40,
243  48, 25, 26, 51, 27, 50, 49, 24, 28, 53, 54, 31, 55, 30, 29, 52,
244  29, 52, 55, 30, 54, 31, 28, 53, 49, 24, 27, 50, 26, 51, 48, 25,
245  30, 55, 52, 29, 53, 28, 31, 54, 50, 27, 24, 49, 25, 48, 51, 26,
246  51, 26, 25, 48, 24, 49, 50, 27, 31, 54, 53, 28, 52, 29, 30, 55,
247  31, 54, 53, 28, 52, 29, 30, 55, 51, 26, 25, 48, 24, 49, 50, 27,
248  50, 27, 24, 49, 25, 48, 51, 26, 30, 55, 52, 29, 53, 28, 31, 54,
249  49, 24, 27, 50, 26, 51, 48, 25, 29, 52, 55, 30, 54, 31, 28, 53,
250  28, 53, 54, 31, 55, 30, 29, 52, 48, 25, 26, 51, 27, 50, 49, 24
251  },
252  { // parities of third byte
253  63, 14, 13, 60, 12, 61, 62, 15, 11, 58, 57, 8, 56, 9, 10, 59,
254  10, 59, 56, 9, 57, 8, 11, 58, 62, 15, 12, 61, 13, 60, 63, 14,
255  9, 56, 59, 10, 58, 11, 8, 57, 61, 12, 15, 62, 14, 63, 60, 13,
256  60, 13, 14, 63, 15, 62, 61, 12, 8, 57, 58, 11, 59, 10, 9, 56,
257  8, 57, 58, 11, 59, 10, 9, 56, 60, 13, 14, 63, 15, 62, 61, 12,
258  61, 12, 15, 62, 14, 63, 60, 13, 9, 56, 59, 10, 58, 11, 8, 57,
259  62, 15, 12, 61, 13, 60, 63, 14, 10, 59, 56, 9, 57, 8, 11, 58,
260  11, 58, 57, 8, 56, 9, 10, 59, 63, 14, 13, 60, 12, 61, 62, 15,
261  31, 46, 45, 28, 44, 29, 30, 47, 43, 26, 25, 40, 24, 41, 42, 27,
262  42, 27, 24, 41, 25, 40, 43, 26, 30, 47, 44, 29, 45, 28, 31, 46,
263  41, 24, 27, 42, 26, 43, 40, 25, 29, 44, 47, 30, 46, 31, 28, 45,
264  28, 45, 46, 31, 47, 30, 29, 44, 40, 25, 26, 43, 27, 42, 41, 24,
265  40, 25, 26, 43, 27, 42, 41, 24, 28, 45, 46, 31, 47, 30, 29, 44,
266  29, 44, 47, 30, 46, 31, 28, 45, 41, 24, 27, 42, 26, 43, 40, 25,
267  30, 47, 44, 29, 45, 28, 31, 46, 42, 27, 24, 41, 25, 40, 43, 26,
268  43, 26, 25, 40, 24, 41, 42, 27, 31, 46, 45, 28, 44, 29, 30, 47
269  }
270 };
271 
272 
274 const char hamm24val[256] =
275 {
276  0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
277  2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3,
278  4, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5,
279  6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7,
280  8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 9, 9,
281  10, 10, 10, 10, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11, 11, 11,
282  12, 12, 12, 12, 13, 13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13,
283  14, 14, 14, 14, 15, 15, 15, 15, 14, 14, 14, 14, 15, 15, 15, 15,
284  0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
285  2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3,
286  4, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5,
287  6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7,
288  8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 9, 9,
289  10, 10, 10, 10, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11, 11, 11,
290  12, 12, 12, 12, 13, 13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13,
291  14, 14, 14, 14, 15, 15, 15, 15, 14, 14, 14, 14, 15, 15, 15, 15
292 };
293 
294 
295 
300 const short hamm24err[64] =
301 {
302  0x0000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
303  0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
304  0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
305  0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
306  0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
307  0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
308  0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
309  0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
310 };
311 
312 
316 const int hamm24cor[64] =
317 {
318  0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
319  0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
320  0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
321  0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
322  0x00000, 0x00000, 0x00000, 0x00001, 0x00000, 0x00002, 0x00004, 0x00008,
323  0x00000, 0x00010, 0x00020, 0x00040, 0x00080, 0x00100, 0x00200, 0x00400,
324  0x00000, 0x00800, 0x01000, 0x02000, 0x04000, 0x08000, 0x10000, 0x20000,
325  0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
326 };
327 
328 int hamm8(const uint8_t *p, int *err)
329 {
330  int a = hammtab[p[0]];
331  *err += a;
332  return a & 15;
333 }
334 
335 int hamm84(const uint8_t *p, int *err)
336 {
337  int a = hamm84tab[p[0]];
338 
339  if (a == 255)
340  *err = 1;
341 
342  return a;
343 }
344 
345 int hamm16(const uint8_t *p, int *err)
346 {
347  int a = hammtab[p[0]];
348  int b = hammtab[p[1]];
349  *err += a;
350  *err += b;
351  return (a & 15) | (b & 15) * 16;
352 }
const uint8_t unham84tab[256]
Definition: vbilut.cpp:118
const char hamm24val[256]
Table to extract the lower 4 bit from hamm24/18 encoded bytes.
Definition: vbilut.cpp:274
const unsigned char chartab_original[13]
Definition: vbilut.cpp:47
const unsigned short hammtab[256]
Definition: vbilut.cpp:52
int hamm84(const uint8_t *p, int *err)
Definition: vbilut.cpp:335
const char * subtitles[4]
Definition: vbilut.cpp:202
const short hamm24err[64]
Mapping from parity checks made by table hamm24par to error results return by hamm24.
Definition: vbilut.cpp:300
const char * formats[8]
Definition: vbilut.cpp:190
unsigned char b
Definition: ParseText.cpp:329
int hamm8(const uint8_t *p, int *err)
Definition: vbilut.cpp:328
const int hamm24cor[64]
Mapping from parity checks made by table hamm24par to faulty bit in the decoded 18 bit word.
Definition: vbilut.cpp:316
const unsigned char lang_chars[1+8+8][16]
Definition: vbilut.cpp:4
const uint8_t vbi_bit_reverse[256]
Definition: vbilut.cpp:154
int hamm16(const uint8_t *p, int *err)
Definition: vbilut.cpp:345
const uint8_t hamm84tab[256]
Definition: vbilut.cpp:88
const char hamm24par[3][256]
This table generates the parity checks for hamm24/18 decoding.
Definition: vbilut.cpp:214