Codebase list aribb24 / a7f9417
New upstream version 1.0.3 Sebastian Ramacher 6 years ago
23 changed file(s) with 5709 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 *.la
1 *.lo
2 *.o
3 .deps
4 .dirstamp
5 .libs
6 /*.tar.gz
7 /Makefile
8 /Makefile.in
9 /aclocal.m4
10 /aribb24-*/
11 /autom4te.cache
12 /compile
13 /config.guess
14 /config.h
15 /config.h.in
16 /config.log
17 /config.status
18 /config.sub
19 /configure
20 /depcomp
21 /install-sh
22 /libtool
23 /ltmain.sh
24 /m4/
25 /missing
26 /src/aribb24.pc
27 /stamp-h1
0 GNU GENERAL PUBLIC LICENSE
1 Version 3, 29 June 2007
2
3 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
4 Everyone is permitted to copy and distribute verbatim copies
5 of this license document, but changing it is not allowed.
6
7 Preamble
8
9 The GNU General Public License is a free, copyleft license for
10 software and other kinds of works.
11
12 The licenses for most software and other practical works are designed
13 to take away your freedom to share and change the works. By contrast,
14 the GNU General Public License is intended to guarantee your freedom to
15 share and change all versions of a program--to make sure it remains free
16 software for all its users. We, the Free Software Foundation, use the
17 GNU General Public License for most of our software; it applies also to
18 any other work released this way by its authors. You can apply it to
19 your programs, too.
20
21 When we speak of free software, we are referring to freedom, not
22 price. Our General Public Licenses are designed to make sure that you
23 have the freedom to distribute copies of free software (and charge for
24 them if you wish), that you receive source code or can get it if you
25 want it, that you can change the software or use pieces of it in new
26 free programs, and that you know you can do these things.
27
28 To protect your rights, we need to prevent others from denying you
29 these rights or asking you to surrender the rights. Therefore, you have
30 certain responsibilities if you distribute copies of the software, or if
31 you modify it: responsibilities to respect the freedom of others.
32
33 For example, if you distribute copies of such a program, whether
34 gratis or for a fee, you must pass on to the recipients the same
35 freedoms that you received. You must make sure that they, too, receive
36 or can get the source code. And you must show them these terms so they
37 know their rights.
38
39 Developers that use the GNU GPL protect your rights with two steps:
40 (1) assert copyright on the software, and (2) offer you this License
41 giving you legal permission to copy, distribute and/or modify it.
42
43 For the developers' and authors' protection, the GPL clearly explains
44 that there is no warranty for this free software. For both users' and
45 authors' sake, the GPL requires that modified versions be marked as
46 changed, so that their problems will not be attributed erroneously to
47 authors of previous versions.
48
49 Some devices are designed to deny users access to install or run
50 modified versions of the software inside them, although the manufacturer
51 can do so. This is fundamentally incompatible with the aim of
52 protecting users' freedom to change the software. The systematic
53 pattern of such abuse occurs in the area of products for individuals to
54 use, which is precisely where it is most unacceptable. Therefore, we
55 have designed this version of the GPL to prohibit the practice for those
56 products. If such problems arise substantially in other domains, we
57 stand ready to extend this provision to those domains in future versions
58 of the GPL, as needed to protect the freedom of users.
59
60 Finally, every program is threatened constantly by software patents.
61 States should not allow patents to restrict development and use of
62 software on general-purpose computers, but in those that do, we wish to
63 avoid the special danger that patents applied to a free program could
64 make it effectively proprietary. To prevent this, the GPL assures that
65 patents cannot be used to render the program non-free.
66
67 The precise terms and conditions for copying, distribution and
68 modification follow.
69
70 TERMS AND CONDITIONS
71
72 0. Definitions.
73
74 "This License" refers to version 3 of the GNU General Public License.
75
76 "Copyright" also means copyright-like laws that apply to other kinds of
77 works, such as semiconductor masks.
78
79 "The Program" refers to any copyrightable work licensed under this
80 License. Each licensee is addressed as "you". "Licensees" and
81 "recipients" may be individuals or organizations.
82
83 To "modify" a work means to copy from or adapt all or part of the work
84 in a fashion requiring copyright permission, other than the making of an
85 exact copy. The resulting work is called a "modified version" of the
86 earlier work or a work "based on" the earlier work.
87
88 A "covered work" means either the unmodified Program or a work based
89 on the Program.
90
91 To "propagate" a work means to do anything with it that, without
92 permission, would make you directly or secondarily liable for
93 infringement under applicable copyright law, except executing it on a
94 computer or modifying a private copy. Propagation includes copying,
95 distribution (with or without modification), making available to the
96 public, and in some countries other activities as well.
97
98 To "convey" a work means any kind of propagation that enables other
99 parties to make or receive copies. Mere interaction with a user through
100 a computer network, with no transfer of a copy, is not conveying.
101
102 An interactive user interface displays "Appropriate Legal Notices"
103 to the extent that it includes a convenient and prominently visible
104 feature that (1) displays an appropriate copyright notice, and (2)
105 tells the user that there is no warranty for the work (except to the
106 extent that warranties are provided), that licensees may convey the
107 work under this License, and how to view a copy of this License. If
108 the interface presents a list of user commands or options, such as a
109 menu, a prominent item in the list meets this criterion.
110
111 1. Source Code.
112
113 The "source code" for a work means the preferred form of the work
114 for making modifications to it. "Object code" means any non-source
115 form of a work.
116
117 A "Standard Interface" means an interface that either is an official
118 standard defined by a recognized standards body, or, in the case of
119 interfaces specified for a particular programming language, one that
120 is widely used among developers working in that language.
121
122 The "System Libraries" of an executable work include anything, other
123 than the work as a whole, that (a) is included in the normal form of
124 packaging a Major Component, but which is not part of that Major
125 Component, and (b) serves only to enable use of the work with that
126 Major Component, or to implement a Standard Interface for which an
127 implementation is available to the public in source code form. A
128 "Major Component", in this context, means a major essential component
129 (kernel, window system, and so on) of the specific operating system
130 (if any) on which the executable work runs, or a compiler used to
131 produce the work, or an object code interpreter used to run it.
132
133 The "Corresponding Source" for a work in object code form means all
134 the source code needed to generate, install, and (for an executable
135 work) run the object code and to modify the work, including scripts to
136 control those activities. However, it does not include the work's
137 System Libraries, or general-purpose tools or generally available free
138 programs which are used unmodified in performing those activities but
139 which are not part of the work. For example, Corresponding Source
140 includes interface definition files associated with source files for
141 the work, and the source code for shared libraries and dynamically
142 linked subprograms that the work is specifically designed to require,
143 such as by intimate data communication or control flow between those
144 subprograms and other parts of the work.
145
146 The Corresponding Source need not include anything that users
147 can regenerate automatically from other parts of the Corresponding
148 Source.
149
150 The Corresponding Source for a work in source code form is that
151 same work.
152
153 2. Basic Permissions.
154
155 All rights granted under this License are granted for the term of
156 copyright on the Program, and are irrevocable provided the stated
157 conditions are met. This License explicitly affirms your unlimited
158 permission to run the unmodified Program. The output from running a
159 covered work is covered by this License only if the output, given its
160 content, constitutes a covered work. This License acknowledges your
161 rights of fair use or other equivalent, as provided by copyright law.
162
163 You may make, run and propagate covered works that you do not
164 convey, without conditions so long as your license otherwise remains
165 in force. You may convey covered works to others for the sole purpose
166 of having them make modifications exclusively for you, or provide you
167 with facilities for running those works, provided that you comply with
168 the terms of this License in conveying all material for which you do
169 not control copyright. Those thus making or running the covered works
170 for you must do so exclusively on your behalf, under your direction
171 and control, on terms that prohibit them from making any copies of
172 your copyrighted material outside their relationship with you.
173
174 Conveying under any other circumstances is permitted solely under
175 the conditions stated below. Sublicensing is not allowed; section 10
176 makes it unnecessary.
177
178 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
179
180 No covered work shall be deemed part of an effective technological
181 measure under any applicable law fulfilling obligations under article
182 11 of the WIPO copyright treaty adopted on 20 December 1996, or
183 similar laws prohibiting or restricting circumvention of such
184 measures.
185
186 When you convey a covered work, you waive any legal power to forbid
187 circumvention of technological measures to the extent such circumvention
188 is effected by exercising rights under this License with respect to
189 the covered work, and you disclaim any intention to limit operation or
190 modification of the work as a means of enforcing, against the work's
191 users, your or third parties' legal rights to forbid circumvention of
192 technological measures.
193
194 4. Conveying Verbatim Copies.
195
196 You may convey verbatim copies of the Program's source code as you
197 receive it, in any medium, provided that you conspicuously and
198 appropriately publish on each copy an appropriate copyright notice;
199 keep intact all notices stating that this License and any
200 non-permissive terms added in accord with section 7 apply to the code;
201 keep intact all notices of the absence of any warranty; and give all
202 recipients a copy of this License along with the Program.
203
204 You may charge any price or no price for each copy that you convey,
205 and you may offer support or warranty protection for a fee.
206
207 5. Conveying Modified Source Versions.
208
209 You may convey a work based on the Program, or the modifications to
210 produce it from the Program, in the form of source code under the
211 terms of section 4, provided that you also meet all of these conditions:
212
213 a) The work must carry prominent notices stating that you modified
214 it, and giving a relevant date.
215
216 b) The work must carry prominent notices stating that it is
217 released under this License and any conditions added under section
218 7. This requirement modifies the requirement in section 4 to
219 "keep intact all notices".
220
221 c) You must license the entire work, as a whole, under this
222 License to anyone who comes into possession of a copy. This
223 License will therefore apply, along with any applicable section 7
224 additional terms, to the whole of the work, and all its parts,
225 regardless of how they are packaged. This License gives no
226 permission to license the work in any other way, but it does not
227 invalidate such permission if you have separately received it.
228
229 d) If the work has interactive user interfaces, each must display
230 Appropriate Legal Notices; however, if the Program has interactive
231 interfaces that do not display Appropriate Legal Notices, your
232 work need not make them do so.
233
234 A compilation of a covered work with other separate and independent
235 works, which are not by their nature extensions of the covered work,
236 and which are not combined with it such as to form a larger program,
237 in or on a volume of a storage or distribution medium, is called an
238 "aggregate" if the compilation and its resulting copyright are not
239 used to limit the access or legal rights of the compilation's users
240 beyond what the individual works permit. Inclusion of a covered work
241 in an aggregate does not cause this License to apply to the other
242 parts of the aggregate.
243
244 6. Conveying Non-Source Forms.
245
246 You may convey a covered work in object code form under the terms
247 of sections 4 and 5, provided that you also convey the
248 machine-readable Corresponding Source under the terms of this License,
249 in one of these ways:
250
251 a) Convey the object code in, or embodied in, a physical product
252 (including a physical distribution medium), accompanied by the
253 Corresponding Source fixed on a durable physical medium
254 customarily used for software interchange.
255
256 b) Convey the object code in, or embodied in, a physical product
257 (including a physical distribution medium), accompanied by a
258 written offer, valid for at least three years and valid for as
259 long as you offer spare parts or customer support for that product
260 model, to give anyone who possesses the object code either (1) a
261 copy of the Corresponding Source for all the software in the
262 product that is covered by this License, on a durable physical
263 medium customarily used for software interchange, for a price no
264 more than your reasonable cost of physically performing this
265 conveying of source, or (2) access to copy the
266 Corresponding Source from a network server at no charge.
267
268 c) Convey individual copies of the object code with a copy of the
269 written offer to provide the Corresponding Source. This
270 alternative is allowed only occasionally and noncommercially, and
271 only if you received the object code with such an offer, in accord
272 with subsection 6b.
273
274 d) Convey the object code by offering access from a designated
275 place (gratis or for a charge), and offer equivalent access to the
276 Corresponding Source in the same way through the same place at no
277 further charge. You need not require recipients to copy the
278 Corresponding Source along with the object code. If the place to
279 copy the object code is a network server, the Corresponding Source
280 may be on a different server (operated by you or a third party)
281 that supports equivalent copying facilities, provided you maintain
282 clear directions next to the object code saying where to find the
283 Corresponding Source. Regardless of what server hosts the
284 Corresponding Source, you remain obligated to ensure that it is
285 available for as long as needed to satisfy these requirements.
286
287 e) Convey the object code using peer-to-peer transmission, provided
288 you inform other peers where the object code and Corresponding
289 Source of the work are being offered to the general public at no
290 charge under subsection 6d.
291
292 A separable portion of the object code, whose source code is excluded
293 from the Corresponding Source as a System Library, need not be
294 included in conveying the object code work.
295
296 A "User Product" is either (1) a "consumer product", which means any
297 tangible personal property which is normally used for personal, family,
298 or household purposes, or (2) anything designed or sold for incorporation
299 into a dwelling. In determining whether a product is a consumer product,
300 doubtful cases shall be resolved in favor of coverage. For a particular
301 product received by a particular user, "normally used" refers to a
302 typical or common use of that class of product, regardless of the status
303 of the particular user or of the way in which the particular user
304 actually uses, or expects or is expected to use, the product. A product
305 is a consumer product regardless of whether the product has substantial
306 commercial, industrial or non-consumer uses, unless such uses represent
307 the only significant mode of use of the product.
308
309 "Installation Information" for a User Product means any methods,
310 procedures, authorization keys, or other information required to install
311 and execute modified versions of a covered work in that User Product from
312 a modified version of its Corresponding Source. The information must
313 suffice to ensure that the continued functioning of the modified object
314 code is in no case prevented or interfered with solely because
315 modification has been made.
316
317 If you convey an object code work under this section in, or with, or
318 specifically for use in, a User Product, and the conveying occurs as
319 part of a transaction in which the right of possession and use of the
320 User Product is transferred to the recipient in perpetuity or for a
321 fixed term (regardless of how the transaction is characterized), the
322 Corresponding Source conveyed under this section must be accompanied
323 by the Installation Information. But this requirement does not apply
324 if neither you nor any third party retains the ability to install
325 modified object code on the User Product (for example, the work has
326 been installed in ROM).
327
328 The requirement to provide Installation Information does not include a
329 requirement to continue to provide support service, warranty, or updates
330 for a work that has been modified or installed by the recipient, or for
331 the User Product in which it has been modified or installed. Access to a
332 network may be denied when the modification itself materially and
333 adversely affects the operation of the network or violates the rules and
334 protocols for communication across the network.
335
336 Corresponding Source conveyed, and Installation Information provided,
337 in accord with this section must be in a format that is publicly
338 documented (and with an implementation available to the public in
339 source code form), and must require no special password or key for
340 unpacking, reading or copying.
341
342 7. Additional Terms.
343
344 "Additional permissions" are terms that supplement the terms of this
345 License by making exceptions from one or more of its conditions.
346 Additional permissions that are applicable to the entire Program shall
347 be treated as though they were included in this License, to the extent
348 that they are valid under applicable law. If additional permissions
349 apply only to part of the Program, that part may be used separately
350 under those permissions, but the entire Program remains governed by
351 this License without regard to the additional permissions.
352
353 When you convey a copy of a covered work, you may at your option
354 remove any additional permissions from that copy, or from any part of
355 it. (Additional permissions may be written to require their own
356 removal in certain cases when you modify the work.) You may place
357 additional permissions on material, added by you to a covered work,
358 for which you have or can give appropriate copyright permission.
359
360 Notwithstanding any other provision of this License, for material you
361 add to a covered work, you may (if authorized by the copyright holders of
362 that material) supplement the terms of this License with terms:
363
364 a) Disclaiming warranty or limiting liability differently from the
365 terms of sections 15 and 16 of this License; or
366
367 b) Requiring preservation of specified reasonable legal notices or
368 author attributions in that material or in the Appropriate Legal
369 Notices displayed by works containing it; or
370
371 c) Prohibiting misrepresentation of the origin of that material, or
372 requiring that modified versions of such material be marked in
373 reasonable ways as different from the original version; or
374
375 d) Limiting the use for publicity purposes of names of licensors or
376 authors of the material; or
377
378 e) Declining to grant rights under trademark law for use of some
379 trade names, trademarks, or service marks; or
380
381 f) Requiring indemnification of licensors and authors of that
382 material by anyone who conveys the material (or modified versions of
383 it) with contractual assumptions of liability to the recipient, for
384 any liability that these contractual assumptions directly impose on
385 those licensors and authors.
386
387 All other non-permissive additional terms are considered "further
388 restrictions" within the meaning of section 10. If the Program as you
389 received it, or any part of it, contains a notice stating that it is
390 governed by this License along with a term that is a further
391 restriction, you may remove that term. If a license document contains
392 a further restriction but permits relicensing or conveying under this
393 License, you may add to a covered work material governed by the terms
394 of that license document, provided that the further restriction does
395 not survive such relicensing or conveying.
396
397 If you add terms to a covered work in accord with this section, you
398 must place, in the relevant source files, a statement of the
399 additional terms that apply to those files, or a notice indicating
400 where to find the applicable terms.
401
402 Additional terms, permissive or non-permissive, may be stated in the
403 form of a separately written license, or stated as exceptions;
404 the above requirements apply either way.
405
406 8. Termination.
407
408 You may not propagate or modify a covered work except as expressly
409 provided under this License. Any attempt otherwise to propagate or
410 modify it is void, and will automatically terminate your rights under
411 this License (including any patent licenses granted under the third
412 paragraph of section 11).
413
414 However, if you cease all violation of this License, then your
415 license from a particular copyright holder is reinstated (a)
416 provisionally, unless and until the copyright holder explicitly and
417 finally terminates your license, and (b) permanently, if the copyright
418 holder fails to notify you of the violation by some reasonable means
419 prior to 60 days after the cessation.
420
421 Moreover, your license from a particular copyright holder is
422 reinstated permanently if the copyright holder notifies you of the
423 violation by some reasonable means, this is the first time you have
424 received notice of violation of this License (for any work) from that
425 copyright holder, and you cure the violation prior to 30 days after
426 your receipt of the notice.
427
428 Termination of your rights under this section does not terminate the
429 licenses of parties who have received copies or rights from you under
430 this License. If your rights have been terminated and not permanently
431 reinstated, you do not qualify to receive new licenses for the same
432 material under section 10.
433
434 9. Acceptance Not Required for Having Copies.
435
436 You are not required to accept this License in order to receive or
437 run a copy of the Program. Ancillary propagation of a covered work
438 occurring solely as a consequence of using peer-to-peer transmission
439 to receive a copy likewise does not require acceptance. However,
440 nothing other than this License grants you permission to propagate or
441 modify any covered work. These actions infringe copyright if you do
442 not accept this License. Therefore, by modifying or propagating a
443 covered work, you indicate your acceptance of this License to do so.
444
445 10. Automatic Licensing of Downstream Recipients.
446
447 Each time you convey a covered work, the recipient automatically
448 receives a license from the original licensors, to run, modify and
449 propagate that work, subject to this License. You are not responsible
450 for enforcing compliance by third parties with this License.
451
452 An "entity transaction" is a transaction transferring control of an
453 organization, or substantially all assets of one, or subdividing an
454 organization, or merging organizations. If propagation of a covered
455 work results from an entity transaction, each party to that
456 transaction who receives a copy of the work also receives whatever
457 licenses to the work the party's predecessor in interest had or could
458 give under the previous paragraph, plus a right to possession of the
459 Corresponding Source of the work from the predecessor in interest, if
460 the predecessor has it or can get it with reasonable efforts.
461
462 You may not impose any further restrictions on the exercise of the
463 rights granted or affirmed under this License. For example, you may
464 not impose a license fee, royalty, or other charge for exercise of
465 rights granted under this License, and you may not initiate litigation
466 (including a cross-claim or counterclaim in a lawsuit) alleging that
467 any patent claim is infringed by making, using, selling, offering for
468 sale, or importing the Program or any portion of it.
469
470 11. Patents.
471
472 A "contributor" is a copyright holder who authorizes use under this
473 License of the Program or a work on which the Program is based. The
474 work thus licensed is called the contributor's "contributor version".
475
476 A contributor's "essential patent claims" are all patent claims
477 owned or controlled by the contributor, whether already acquired or
478 hereafter acquired, that would be infringed by some manner, permitted
479 by this License, of making, using, or selling its contributor version,
480 but do not include claims that would be infringed only as a
481 consequence of further modification of the contributor version. For
482 purposes of this definition, "control" includes the right to grant
483 patent sublicenses in a manner consistent with the requirements of
484 this License.
485
486 Each contributor grants you a non-exclusive, worldwide, royalty-free
487 patent license under the contributor's essential patent claims, to
488 make, use, sell, offer for sale, import and otherwise run, modify and
489 propagate the contents of its contributor version.
490
491 In the following three paragraphs, a "patent license" is any express
492 agreement or commitment, however denominated, not to enforce a patent
493 (such as an express permission to practice a patent or covenant not to
494 sue for patent infringement). To "grant" such a patent license to a
495 party means to make such an agreement or commitment not to enforce a
496 patent against the party.
497
498 If you convey a covered work, knowingly relying on a patent license,
499 and the Corresponding Source of the work is not available for anyone
500 to copy, free of charge and under the terms of this License, through a
501 publicly available network server or other readily accessible means,
502 then you must either (1) cause the Corresponding Source to be so
503 available, or (2) arrange to deprive yourself of the benefit of the
504 patent license for this particular work, or (3) arrange, in a manner
505 consistent with the requirements of this License, to extend the patent
506 license to downstream recipients. "Knowingly relying" means you have
507 actual knowledge that, but for the patent license, your conveying the
508 covered work in a country, or your recipient's use of the covered work
509 in a country, would infringe one or more identifiable patents in that
510 country that you have reason to believe are valid.
511
512 If, pursuant to or in connection with a single transaction or
513 arrangement, you convey, or propagate by procuring conveyance of, a
514 covered work, and grant a patent license to some of the parties
515 receiving the covered work authorizing them to use, propagate, modify
516 or convey a specific copy of the covered work, then the patent license
517 you grant is automatically extended to all recipients of the covered
518 work and works based on it.
519
520 A patent license is "discriminatory" if it does not include within
521 the scope of its coverage, prohibits the exercise of, or is
522 conditioned on the non-exercise of one or more of the rights that are
523 specifically granted under this License. You may not convey a covered
524 work if you are a party to an arrangement with a third party that is
525 in the business of distributing software, under which you make payment
526 to the third party based on the extent of your activity of conveying
527 the work, and under which the third party grants, to any of the
528 parties who would receive the covered work from you, a discriminatory
529 patent license (a) in connection with copies of the covered work
530 conveyed by you (or copies made from those copies), or (b) primarily
531 for and in connection with specific products or compilations that
532 contain the covered work, unless you entered into that arrangement,
533 or that patent license was granted, prior to 28 March 2007.
534
535 Nothing in this License shall be construed as excluding or limiting
536 any implied license or other defenses to infringement that may
537 otherwise be available to you under applicable patent law.
538
539 12. No Surrender of Others' Freedom.
540
541 If conditions are imposed on you (whether by court order, agreement or
542 otherwise) that contradict the conditions of this License, they do not
543 excuse you from the conditions of this License. If you cannot convey a
544 covered work so as to satisfy simultaneously your obligations under this
545 License and any other pertinent obligations, then as a consequence you may
546 not convey it at all. For example, if you agree to terms that obligate you
547 to collect a royalty for further conveying from those to whom you convey
548 the Program, the only way you could satisfy both those terms and this
549 License would be to refrain entirely from conveying the Program.
550
551 13. Use with the GNU Affero General Public License.
552
553 Notwithstanding any other provision of this License, you have
554 permission to link or combine any covered work with a work licensed
555 under version 3 of the GNU Affero General Public License into a single
556 combined work, and to convey the resulting work. The terms of this
557 License will continue to apply to the part which is the covered work,
558 but the special requirements of the GNU Affero General Public License,
559 section 13, concerning interaction through a network will apply to the
560 combination as such.
561
562 14. Revised Versions of this License.
563
564 The Free Software Foundation may publish revised and/or new versions of
565 the GNU General Public License from time to time. Such new versions will
566 be similar in spirit to the present version, but may differ in detail to
567 address new problems or concerns.
568
569 Each version is given a distinguishing version number. If the
570 Program specifies that a certain numbered version of the GNU General
571 Public License "or any later version" applies to it, you have the
572 option of following the terms and conditions either of that numbered
573 version or of any later version published by the Free Software
574 Foundation. If the Program does not specify a version number of the
575 GNU General Public License, you may choose any version ever published
576 by the Free Software Foundation.
577
578 If the Program specifies that a proxy can decide which future
579 versions of the GNU General Public License can be used, that proxy's
580 public statement of acceptance of a version permanently authorizes you
581 to choose that version for the Program.
582
583 Later license versions may give you additional or different
584 permissions. However, no additional obligations are imposed on any
585 author or copyright holder as a result of your choosing to follow a
586 later version.
587
588 15. Disclaimer of Warranty.
589
590 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
591 APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
592 HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
593 OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
594 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
595 PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
596 IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
597 ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
598
599 16. Limitation of Liability.
600
601 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
602 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
603 THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
604 GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
605 USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
606 DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
607 PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
608 EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
609 SUCH DAMAGES.
610
611 17. Interpretation of Sections 15 and 16.
612
613 If the disclaimer of warranty and limitation of liability provided
614 above cannot be given local legal effect according to their terms,
615 reviewing courts shall apply local law that most closely approximates
616 an absolute waiver of all civil liability in connection with the
617 Program, unless a warranty or assumption of liability accompanies a
618 copy of the Program in return for a fee.
619
620 END OF TERMS AND CONDITIONS
621
622 How to Apply These Terms to Your New Programs
623
624 If you develop a new program, and you want it to be of the greatest
625 possible use to the public, the best way to achieve this is to make it
626 free software which everyone can redistribute and change under these terms.
627
628 To do so, attach the following notices to the program. It is safest
629 to attach them to the start of each source file to most effectively
630 state the exclusion of warranty; and each file should have at least
631 the "copyright" line and a pointer to where the full notice is found.
632
633 <one line to give the program's name and a brief idea of what it does.>
634 Copyright (C) <year> <name of author>
635
636 This program is free software: you can redistribute it and/or modify
637 it under the terms of the GNU General Public License as published by
638 the Free Software Foundation, either version 3 of the License, or
639 (at your option) any later version.
640
641 This program is distributed in the hope that it will be useful,
642 but WITHOUT ANY WARRANTY; without even the implied warranty of
643 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
644 GNU General Public License for more details.
645
646 You should have received a copy of the GNU General Public License
647 along with this program. If not, see <http://www.gnu.org/licenses/>.
648
649 Also add information on how to contact you by electronic and paper mail.
650
651 If the program does terminal interaction, make it output a short
652 notice like this when it starts in an interactive mode:
653
654 <program> Copyright (C) <year> <name of author>
655 This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
656 This is free software, and you are welcome to redistribute it
657 under certain conditions; type `show c' for details.
658
659 The hypothetical commands `show w' and `show c' should show the appropriate
660 parts of the General Public License. Of course, your program's commands
661 might be different; for a GUI interface, you would use an "about box".
662
663 You should also get your employer (if you work as a programmer) or school,
664 if any, to sign a "copyright disclaimer" for the program, if necessary.
665 For more information on this, and how to apply and follow the GNU GPL, see
666 <http://www.gnu.org/licenses/>.
667
668 The GNU General Public License does not permit incorporating your program
669 into proprietary programs. If your program is a subroutine library, you
670 may consider it more useful to permit linking proprietary applications with
671 the library. If this is what you want to do, use the GNU Lesser General
672 Public License instead of this License. But first, please read
673 <http://www.gnu.org/philosophy/why-not-lgpl.html>.
0 ACLOCAL_AMFLAGS = -I m4
1
2 lib_LTLIBRARIES = libaribb24.la
3 libaribb24_la_SOURCES = src/aribb24.c src/aribb24_private.h \
4 src/decoder.c src/decoder_private.h src/parser.c \
5 src/parser_private.h src/md5.c src/md5.h src/drcs.c \
6 src/drcs.h src/convtable.h \
7 src/decoder_macro.h
8 libaribb24_la_LIBADD = $(PNG_LIBS)
9 libaribb24_la_CFLAGS = -Wall -fvisibility=hidden
10
11 pkginclude_HEADERS = src/aribb24/decoder.h src/aribb24/parser.h \
12 src/aribb24/bits.h src/aribb24/aribb24.h
13
14 pkgconfigdir = $(libdir)/pkgconfig
15 pkgconfig_DATA = src/aribb24.pc
16
17 dist_doc_DATA = README.md COPYING
0 aribb24
1 =======
2
3 A library for ARIB STD-B24, decoding JIS 8 bit characters and parsing MPEG-TS stream.
0 #!/bin/sh
1 set -e
2 autoreconf --install
0 AC_PREREQ([2.69])
1 AC_INIT([aribb24], [1.0.3], [nkoriyama@gmail.com])
2 AM_INIT_AUTOMAKE([foreign subdir-objects])
3 AC_CONFIG_MACRO_DIR([m4])
4
5 AC_USE_SYSTEM_EXTENSIONS
6
7 AC_PROG_CC
8 AC_PROG_CC_STDC
9 AC_PROG_INSTALL
10 AC_PROG_LN_S
11 AC_PROG_MAKE_SET
12 LT_INIT
13
14 # Checks for libraries.
15 pkg_requires=""
16 PKG_CHECK_MODULES(PNG, "libpng", [
17 AC_DEFINE(HAVE_PNG, 1, "have libpng")
18 pkg_requires="libpng"
19 ], [])
20
21 AC_SUBST([PKG_REQUIRES], [$(test x$enable_shared = xno && echo ${pkg_requires})])
22
23 AC_CHECK_FUNCS([vasprintf])
24
25 AC_CONFIG_FILES([Makefile src/aribb24.pc])
26 AC_OUTPUT
0 /*****************************************************************************
1 * aribb24.h : ARIB STD-B24 JIS 8bit character code decoder
2 *****************************************************************************
3 * Copyright (C) 2014 François Cartegnie
4 *
5 * Authors: François Cartegnie <fcvlcdev@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #ifndef ARIBB24_MAIN_H
23 #define ARIBB24_MAIN_H 1
24
25 #include <stdbool.h>
26
27 /* If building or using aribb24 as a DLL, define ARIBB24_DLL.
28 */
29 /* TODO: define ARIBB24_BUILD_DLL when building this library as DLL.
30 */
31 #if defined _WIN32 || defined __CYGWIN__
32 #ifdef ARIBB24_DLL
33 #ifdef ARIBB24_BUILD_DLL
34 #ifdef __GNUC__
35 #define ARIB_API __attribute__ ((dllexport))
36 #else
37 #define ARIB_API __declspec(dllexport)
38 #endif
39 #else
40 #ifdef __GNUC__
41 #define ARIB_API __attribute__ ((dllimport))
42 #else
43 #define ARIB_API __declspec(dllimport)
44 #endif
45 #endif
46 #else
47 #if __GNUC__ >= 4
48 #define ARIB_API __attribute__ ((visibility ("default")))
49 #else
50 #define ARIB_API
51 #endif
52 #endif
53 #define DLL_LOCAL
54 #else
55 #if __GNUC__ >= 4
56 #define ARIB_API __attribute__ ((visibility ("default")))
57 #else
58 #define ARIB_API
59 #endif
60 #endif
61
62 typedef struct arib_instance_private_t arib_instance_private_t;
63 typedef struct arib_instance_t
64 {
65 bool b_generate_drcs;
66 bool b_use_private_conv;
67 bool b_replace_ellipsis;
68 arib_instance_private_t *p;
69 } arib_instance_t;
70 typedef struct arib_parser_t arib_parser_t;
71 typedef struct arib_decoder_t arib_decoder_t;
72 typedef void(* arib_messages_callback_t)(void *, const char *);
73
74 ARIB_API arib_instance_t * arib_instance_new( void * );
75 ARIB_API void arib_instance_destroy( arib_instance_t * );
76
77 ARIB_API void arib_set_base_path( arib_instance_t *, const char * );
78
79 ARIB_API arib_parser_t * arib_get_parser( arib_instance_t * );
80 ARIB_API arib_decoder_t * arib_get_decoder( arib_instance_t * );
81
82 ARIB_API void arib_register_messages_callback( arib_instance_t *,
83 arib_messages_callback_t );
84
85 #endif
0 /*****************************************************************************
1 * vlc_bits.h : Bit handling helpers
2 *****************************************************************************
3 * Copyright (C) 2003 VLC authors and VideoLAN
4 * $Id: 6c2915138c768d9c49b6646dde6c711acf6eabef $
5 *
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
22
23 #ifndef VLC_BITS_H
24 #define VLC_BITS_H 1
25
26 #include <unistd.h>
27 /**
28 * \file
29 * This file defines functions, structures for handling streams of bits in vlc
30 */
31
32 typedef struct bs_s
33 {
34 uint8_t *p_start;
35 uint8_t *p;
36 uint8_t *p_end;
37
38 ssize_t i_left; /* i_count number of available bits */
39 } bs_t;
40
41 static inline void bs_init( bs_t *s, const void *p_data, size_t i_data )
42 {
43 s->p_start = (void *)p_data;
44 s->p = s->p_start;
45 s->p_end = s->p_start + i_data;
46 s->i_left = 8;
47 }
48
49 static inline int bs_pos( const bs_t *s )
50 {
51 return( 8 * ( s->p - s->p_start ) + 8 - s->i_left );
52 }
53
54 static inline int bs_eof( const bs_t *s )
55 {
56 return( s->p >= s->p_end ? 1: 0 );
57 }
58
59 static inline uint32_t bs_read( bs_t *s, int i_count )
60 {
61 static const uint32_t i_mask[33] =
62 { 0x00,
63 0x01, 0x03, 0x07, 0x0f,
64 0x1f, 0x3f, 0x7f, 0xff,
65 0x1ff, 0x3ff, 0x7ff, 0xfff,
66 0x1fff, 0x3fff, 0x7fff, 0xffff,
67 0x1ffff, 0x3ffff, 0x7ffff, 0xfffff,
68 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff,
69 0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff,
70 0x1fffffff,0x3fffffff,0x7fffffff,0xffffffff};
71 int i_shr;
72 uint32_t i_result = 0;
73
74 while( i_count > 0 )
75 {
76 if( s->p >= s->p_end )
77 {
78 break;
79 }
80
81 if( ( i_shr = s->i_left - i_count ) >= 0 )
82 {
83 /* more in the buffer than requested */
84 i_result |= ( *s->p >> i_shr )&i_mask[i_count];
85 s->i_left -= i_count;
86 if( s->i_left == 0 )
87 {
88 s->p++;
89 s->i_left = 8;
90 }
91 return( i_result );
92 }
93 else
94 {
95 /* less in the buffer than requested */
96 i_result |= (*s->p&i_mask[s->i_left]) << -i_shr;
97 i_count -= s->i_left;
98 s->p++;
99 s->i_left = 8;
100 }
101 }
102
103 return( i_result );
104 }
105
106 static inline uint32_t bs_read1( bs_t *s )
107 {
108 if( s->p < s->p_end )
109 {
110 unsigned int i_result;
111
112 s->i_left--;
113 i_result = ( *s->p >> s->i_left )&0x01;
114 if( s->i_left == 0 )
115 {
116 s->p++;
117 s->i_left = 8;
118 }
119 return i_result;
120 }
121
122 return 0;
123 }
124
125 static inline uint32_t bs_show( bs_t *s, int i_count )
126 {
127 bs_t s_tmp = *s;
128 return bs_read( &s_tmp, i_count );
129 }
130
131 static inline void bs_skip( bs_t *s, ssize_t i_count )
132 {
133 s->i_left -= i_count;
134
135 if( s->i_left <= 0 )
136 {
137 const int i_bytes = ( -s->i_left + 8 ) / 8;
138
139 s->p += i_bytes;
140 s->i_left += 8 * i_bytes;
141 }
142 }
143
144 static inline void bs_write( bs_t *s, int i_count, uint32_t i_bits )
145 {
146 while( i_count > 0 )
147 {
148 if( s->p >= s->p_end )
149 {
150 break;
151 }
152
153 i_count--;
154
155 if( ( i_bits >> i_count )&0x01 )
156 {
157 *s->p |= 1 << ( s->i_left - 1 );
158 }
159 else
160 {
161 *s->p &= ~( 1 << ( s->i_left - 1 ) );
162 }
163 s->i_left--;
164 if( s->i_left == 0 )
165 {
166 s->p++;
167 s->i_left = 8;
168 }
169 }
170 }
171
172 static inline void bs_align( bs_t *s )
173 {
174 if( s->i_left != 8 )
175 {
176 s->i_left = 8;
177 s->p++;
178 }
179 }
180
181 static inline void bs_align_0( bs_t *s )
182 {
183 if( s->i_left != 8 )
184 {
185 bs_write( s, s->i_left, 0 );
186 }
187 }
188
189 static inline void bs_align_1( bs_t *s )
190 {
191 while( s->i_left != 8 )
192 {
193 bs_write( s, 1, 1 );
194 }
195 }
196
197 #endif
0 /*****************************************************************************
1 * decorder.h : ARIB STD-B24 JIS 8bit character code decoder
2 *****************************************************************************
3 * Copyright (C) 2014 Naohiro KORIYAMA
4 *
5 * Authors: Naohiro KORIYAMA <nkoriyama@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #ifndef ARIBB24_DECODER_H
23 #define ARIBB24_DECODER_H 1
24
25 #include "aribb24.h"
26
27 #include <stdint.h>
28 #include <time.h>
29
30 typedef struct arib_buf_region_s
31 {
32 char *p_start;
33 char *p_end;
34
35 int i_foreground_color;
36 int i_background_color;
37
38 int i_foreground_alpha;
39 int i_background_alpha;
40
41 int i_planewidth;
42 int i_planeheight;
43
44 int i_width;
45 int i_height;
46
47 int i_fontwidth;
48 int i_fontheight;
49
50 int i_verint;
51 int i_horint;
52
53 int i_charleft;
54 int i_charbottom;
55
56 int i_veradj;
57 int i_horadj;
58
59 struct arib_buf_region_s *p_next;
60 } arib_buf_region_t;
61
62 ARIB_API void arib_initialize_decoder( arib_decoder_t* decoder );
63
64 ARIB_API void arib_initialize_decoder_a_profile( arib_decoder_t* decoder );
65
66 ARIB_API void arib_initialize_decoder_c_profile( arib_decoder_t* decoder );
67
68 ARIB_API void arib_finalize_decoder( arib_decoder_t* decoder );
69
70 ARIB_API size_t arib_decode_buffer( arib_decoder_t* decoder,
71 const unsigned char *buf, size_t count,
72 char *ubuf, size_t ucount );
73
74 ARIB_API time_t arib_decoder_get_time( arib_decoder_t *decoder );
75
76 ARIB_API const arib_buf_region_t * arib_decoder_get_regions( arib_decoder_t * );
77
78 #endif
0 /*****************************************************************************
1 * parser.h : ARIB STD-B24 bitstream parser
2 *****************************************************************************
3 * Copyright (C) 2014 Naohiro KORIYAMA
4 *
5 * Authors: Naohiro KORIYAMA <nkoriyama@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #ifndef ARIBB24_PARSER_H
23 #define ARIBB24_PARSER_H 1
24
25 #include "aribb24.h"
26
27 #define DEBUG_ARIBSUB 1
28
29 /****************************************************************************
30 * Local structures
31 ****************************************************************************/
32
33 ARIB_API void arib_parse_pes( arib_parser_t *, const void *p_data, size_t i_data );
34 ARIB_API const unsigned char * arib_parser_get_data( arib_parser_t *, size_t * );
35
36
37 #endif
0 /*****************************************************************************
1 * aribb24.c : ARIB STD-B24 JIS 8bit character code decoder
2 *****************************************************************************
3 * Copyright (C) 2014 François Cartegnie
4 *
5 * Authors: François Cartegnie <fcvlcdev@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #ifndef ARIBB24_MAIN_C
23 #define ARIBB24_MAIN_C 1
24
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdarg.h>
29
30 #include "aribb24/aribb24.h"
31 #include "aribb24_private.h"
32
33 #include "parser_private.h"
34 #include "aribb24/decoder.h"
35 #include "decoder_private.h"
36
37 void arib_log( arib_instance_t *p_instance, const char *psz_format, ... )
38 {
39 #ifdef HAVE_VASPRINTF
40 va_list args;
41 free( p_instance->p->psz_last_error );
42 va_start( args, psz_format );
43 if ( vasprintf( &p_instance->p->psz_last_error, psz_format, args ) < 0 )
44 {
45 p_instance->p->psz_last_error = NULL;
46 return;
47 }
48
49 if ( p_instance->p->pf_messages )
50 {
51 p_instance->p->pf_messages( p_instance->p->p_opaque,
52 p_instance->p->psz_last_error );
53 }
54 else
55 {
56 // vprintf ?
57 }
58 va_end( args );
59 #endif
60 }
61
62 arib_instance_t * arib_instance_new( void *p_opaque )
63 {
64 arib_instance_t *p_instance = calloc( 1, sizeof(*p_instance) );
65 if ( !p_instance )
66 return NULL;
67 p_instance->p = calloc( 1, sizeof(*(p_instance->p)) );
68 if (!p_instance->p)
69 {
70 free( p_instance );
71 return NULL;
72 }
73 p_instance->p->p_opaque = p_opaque;
74 p_instance->b_use_private_conv = true;
75 return p_instance;
76 }
77
78 void arib_instance_destroy( arib_instance_t *p_instance )
79 {
80 if ( p_instance->p->p_decoder )
81 arib_decoder_free( p_instance->p->p_decoder );
82 if ( p_instance->p->p_parser )
83 arib_parser_free( p_instance->p->p_parser );
84 free( p_instance->p->psz_base_path );
85 free( p_instance->p->psz_last_error );
86
87 drcs_conversion_t *p_drcs_conv, *p_next;
88 for( p_drcs_conv = p_instance->p->p_drcs_conv; p_drcs_conv; p_drcs_conv = p_next )
89 {
90 p_next = p_drcs_conv->p_next;
91 free( p_drcs_conv );
92 }
93
94 free( p_instance->p );
95 free( p_instance );
96 }
97
98 void arib_register_messages_callback( arib_instance_t *p_arib_instance,
99 arib_messages_callback_t pf_callback )
100 {
101 p_arib_instance->p->pf_messages = pf_callback;
102 }
103
104 void arib_set_base_path( arib_instance_t *p_instance, const char *psz_path )
105 {
106 if ( p_instance->p->psz_base_path )
107 free( p_instance->p->psz_base_path );
108 p_instance->p->psz_base_path = psz_path ? strdup( psz_path ): NULL;
109 }
110
111 arib_parser_t * arib_get_parser( arib_instance_t *p_instance )
112 {
113 if ( !p_instance->p->p_parser )
114 p_instance->p->p_parser = arib_parser_new( p_instance );
115 return p_instance->p->p_parser;
116 }
117
118 arib_decoder_t * arib_get_decoder( arib_instance_t *p_instance )
119 {
120 if ( !p_instance->p->p_decoder )
121 p_instance->p->p_decoder = arib_decoder_new( p_instance );
122 return p_instance->p->p_decoder;
123 }
124
125 #endif
0 prefix=@prefix@
1 exec_prefix=@exec_prefix@
2 includedir=@includedir@
3 datarootdir=@datarootdir@
4 libdir=@libdir@
5 datadir=@datadir@
6 pkgincludedir=@includedir@/@PACKAGE@
7 pkgdatadir=${datadir}/@PACKAGE@
8 pkglibdir=${libdir}/@PACKAGE@
9 pluginsdir=${pkglibdir}/plugins
10
11 Name: ARIB B24 Library
12 Description: ARIB B24 Captions decoder
13 Version: @VERSION@
14 Requires: @PKG_REQUIRES@
15 Cflags: -I${includedir}
16 Libs: -L${libdir} -laribb24
0 /*****************************************************************************
1 * aribb24_private.h : ARIB STD-B24 JIS 8bit character code decoder
2 *****************************************************************************
3 * Copyright (C) 2014 François Cartegnie
4 *
5 * Authors: François Cartegnie <fcvlcdev@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #ifndef ARIBB24_PRIVATE_H
23 #define ARIBB24_PRIVATE_H 1
24
25 #include "drcs.h"
26
27 struct arib_instance_private_t
28 {
29 void *p_opaque;
30 arib_messages_callback_t pf_messages;
31 arib_decoder_t *p_decoder;
32 arib_parser_t *p_parser;
33 char *psz_base_path;
34 char *psz_last_error;
35
36 drcs_conversion_t *p_drcs_conv;
37 int i_drcs_num;
38 unsigned int drcs_conv_table[188];
39 char drcs_hash_table[188][32 + 1];
40 };
41
42 void arib_log( arib_instance_t *, const char *, ... );
43
44 #endif
0 /*****************************************************************************
1 * convtable.h : table for converting ARIB STD-B24 JIS 8bit character code
2 *****************************************************************************
3 * Copyright (C) 2014 Naohiro KORIYAMA
4 *
5 * Authors: Naohiro KORIYAMA <nkoriyama@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #ifndef ARIBB24_CONVTABLE_H
23 #define ARIBB24_CONVTABLE_H 1
24
25 static const unsigned int decoder_alnum_table[] = {
26 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028,
27 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030,
28 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038,
29 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040,
30 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048,
31 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050,
32 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058,
33 0x0059, 0x005a, 0x005b, 0x00a5, 0x005d, 0x005e, 0x005f, 0x0060,
34 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068,
35 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070,
36 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078,
37 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x203e,
38 };
39
40 static const unsigned int decoder_hiragana_table[] = {
41 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048,
42 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050,
43 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058,
44 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060,
45 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068,
46 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070,
47 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078,
48 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080,
49 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088,
50 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090,
51 0x3091, 0x3092, 0x3093, 0x3000, 0x3000, 0x3000, 0x309d, 0x309e,
52 0x30fc, 0x3002, 0x300c, 0x300d, 0x3001, 0x30fb,
53 };
54
55 static const unsigned int decoder_katakana_table[] = {
56 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8,
57 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0,
58 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8,
59 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0,
60 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8,
61 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0,
62 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8,
63 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0,
64 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8,
65 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0,
66 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0x30fd, 0x30fe,
67 0x30fc, 0x3002, 0x300c, 0x300d, 0x3001, 0x30fb,
68 };
69
70 static const unsigned int decoder_kanji_table[][94] = {
71 {
72 0x3000, 0x3001, 0x3002, 0xff0c, 0xff0e, 0x30fb, 0xff1a, 0xff1b,
73 0xff1f, 0xff01, 0x309b, 0x309c, 0x00b4, 0xff40, 0x00a8, 0xff3e,
74 0xffe3, 0xff3f, 0x30fd, 0x30fe, 0x309d, 0x309e, 0x3003, 0x4edd,
75 0x3005, 0x3006, 0x3007, 0x30fc, 0x2015, 0x2010, 0xff0f, 0x005c,
76 0x301c, 0x2016, 0xff5c, 0x2026, 0x2025, 0x2018, 0x2019, 0x201c,
77 0x201d, 0xff08, 0xff09, 0x3014, 0x3015, 0xff3b, 0xff3d, 0xff5b,
78 0xff5d, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, 0x300d, 0x300e,
79 0x300f, 0x3010, 0x3011, 0xff0b, 0xff0d, 0x00b1, 0x00d7, 0x00f7,
80 0xff1d, 0x2260, 0xff1c, 0xff1e, 0x2266, 0x2267, 0x221e, 0x2234,
81 0x2642, 0x2640, 0x00b0, 0x2032, 0x2033, 0x2103, 0xffe5, 0xff04,
82 0x00a2, 0x00a3, 0xff05, 0xff03, 0xff06, 0xff0a, 0xff20, 0x00a7,
83 0x2606, 0x2605, 0x25cb, 0x25cf, 0x25ce, 0x25c7,
84 },
85 {
86 0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, 0x25bd, 0x25bc, 0x203b,
87 0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0x0000, 0x0000,
88 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
89 0x0000, 0x2208, 0x220b, 0x2286, 0x2287, 0x2282, 0x2283, 0x222a,
90 0x2229, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
91 0x0000, 0x2227, 0x2228, 0x00ac, 0x21d2, 0x21d4, 0x2200, 0x2203,
92 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
93 0x0000, 0x0000, 0x0000, 0x2220, 0x22a5, 0x2312, 0x2202, 0x2207,
94 0x2261, 0x2252, 0x226a, 0x226b, 0x221a, 0x223d, 0x221d, 0x2235,
95 0x222b, 0x222c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
96 0x0000, 0x212b, 0x2030, 0x266f, 0x266d, 0x266a, 0x2020, 0x2021,
97 0x00b6, 0x0000, 0x0000, 0x0000, 0x0000, 0x25ef,
98 },
99 {
100 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
101 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xff10,
102 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18,
103 0xff19, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
104 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28,
105 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30,
106 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38,
107 0xff39, 0xff3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
108 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48,
109 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50,
110 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58,
111 0xff59, 0xff5a,
112 },
113 {
114 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048,
115 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050,
116 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058,
117 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060,
118 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068,
119 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070,
120 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078,
121 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080,
122 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088,
123 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090,
124 0x3091, 0x3092, 0x3093,
125 },
126 {
127 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8,
128 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0,
129 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8,
130 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0,
131 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8,
132 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0,
133 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8,
134 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0,
135 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8,
136 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0,
137 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6,
138 },
139 {
140 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398,
141 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0,
142 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9,
143 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
144 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8,
145 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0,
146 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9,
147 },
148 {
149 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416,
150 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e,
151 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426,
152 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e,
153 0x042f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
154 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
155 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436,
156 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e,
157 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446,
158 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e,
159 0x044f,
160 },
161 {
162 0x2500, 0x2502, 0x250c, 0x2510, 0x2518, 0x2514, 0x251c, 0x252c,
163 0x2524, 0x2534, 0x253c, 0x2501, 0x2503, 0x250f, 0x2513, 0x251b,
164 0x2517, 0x2523, 0x2533, 0x252b, 0x253b, 0x254b, 0x2520, 0x252f,
165 0x2528, 0x2537, 0x253f, 0x251d, 0x2530, 0x2525, 0x2538, 0x2542,
166 },
167 {
168 },
169 {
170 },
171 {
172 },
173 {
174 },
175 {
176 },
177 {
178 },
179 {
180 },
181 {
182 0x4e9c, 0x5516, 0x5a03, 0x963f, 0x54c0, 0x611b, 0x6328, 0x59f6,
183 0x9022, 0x8475, 0x831c, 0x7a50, 0x60aa, 0x63e1, 0x6e25, 0x65ed,
184 0x8466, 0x82a6, 0x9bf5, 0x6893, 0x5727, 0x65a1, 0x6271, 0x5b9b,
185 0x59d0, 0x867b, 0x98f4, 0x7d62, 0x7dbe, 0x9b8e, 0x6216, 0x7c9f,
186 0x88b7, 0x5b89, 0x5eb5, 0x6309, 0x6697, 0x6848, 0x95c7, 0x978d,
187 0x674f, 0x4ee5, 0x4f0a, 0x4f4d, 0x4f9d, 0x5049, 0x56f2, 0x5937,
188 0x59d4, 0x5a01, 0x5c09, 0x60df, 0x610f, 0x6170, 0x6613, 0x6905,
189 0x70ba, 0x754f, 0x7570, 0x79fb, 0x7dad, 0x7def, 0x80c3, 0x840e,
190 0x8863, 0x8b02, 0x9055, 0x907a, 0x533b, 0x4e95, 0x4ea5, 0x57df,
191 0x80b2, 0x90c1, 0x78ef, 0x4e00, 0x58f1, 0x6ea2, 0x9038, 0x7a32,
192 0x8328, 0x828b, 0x9c2f, 0x5141, 0x5370, 0x54bd, 0x54e1, 0x56e0,
193 0x59fb, 0x5f15, 0x98f2, 0x6deb, 0x80e4, 0x852d,
194 },
195 {
196 0x9662, 0x9670, 0x96a0, 0x97fb, 0x540b, 0x53f3, 0x5b87, 0x70cf,
197 0x7fbd, 0x8fc2, 0x96e8, 0x536f, 0x9d5c, 0x7aba, 0x4e11, 0x7893,
198 0x81fc, 0x6e26, 0x5618, 0x5504, 0x6b1d, 0x851a, 0x9c3b, 0x59e5,
199 0x53a9, 0x6d66, 0x74dc, 0x958f, 0x5642, 0x4e91, 0x904b, 0x96f2,
200 0x834f, 0x990c, 0x53e1, 0x55b6, 0x5b30, 0x5f71, 0x6620, 0x66f3,
201 0x6804, 0x6c38, 0x6cf3, 0x6d29, 0x745b, 0x76c8, 0x7a4e, 0x9834,
202 0x82f1, 0x885b, 0x8a60, 0x92ed, 0x6db2, 0x75ab, 0x76ca, 0x99c5,
203 0x60a6, 0x8b01, 0x8d8a, 0x95b2, 0x698e, 0x53ad, 0x5186, 0x5712,
204 0x5830, 0x5944, 0x5bb4, 0x5ef6, 0x6028, 0x63a9, 0x63f4, 0x6cbf,
205 0x6f14, 0x708e, 0x7114, 0x7159, 0x71d5, 0x733f, 0x7e01, 0x8276,
206 0x82d1, 0x8597, 0x9060, 0x925b, 0x9d1b, 0x5869, 0x65bc, 0x6c5a,
207 0x7525, 0x51f9, 0x592e, 0x5965, 0x5f80, 0x5fdc,
208 },
209 {
210 0x62bc, 0x65fa, 0x6a2a, 0x6b27, 0x6bb4, 0x738b, 0x7fc1, 0x8956,
211 0x9d2c, 0x9d0e, 0x9ec4, 0x5ca1, 0x6c96, 0x837b, 0x5104, 0x5c4b,
212 0x61b6, 0x81c6, 0x6876, 0x7261, 0x4e59, 0x4ffa, 0x5378, 0x6069,
213 0x6e29, 0x7a4f, 0x97f3, 0x4e0b, 0x5316, 0x4eee, 0x4f55, 0x4f3d,
214 0x4fa1, 0x4f73, 0x52a0, 0x53ef, 0x5609, 0x590f, 0x5ac1, 0x5bb6,
215 0x5be1, 0x79d1, 0x6687, 0x679c, 0x67b6, 0x6b4c, 0x6cb3, 0x706b,
216 0x73c2, 0x798d, 0x79be, 0x7a3c, 0x7b87, 0x82b1, 0x82db, 0x8304,
217 0x8377, 0x83ef, 0x83d3, 0x8766, 0x8ab2, 0x5629, 0x8ca8, 0x8fe6,
218 0x904e, 0x971e, 0x868a, 0x4fc4, 0x5ce8, 0x6211, 0x7259, 0x753b,
219 0x81e5, 0x82bd, 0x86fe, 0x8cc0, 0x96c5, 0x9913, 0x99d5, 0x4ecb,
220 0x4f1a, 0x89e3, 0x56de, 0x584a, 0x58ca, 0x5efb, 0x5feb, 0x602a,
221 0x6094, 0x6062, 0x61d0, 0x6212, 0x62d0, 0x6539,
222 },
223 {
224 0x9b41, 0x6666, 0x68b0, 0x6d77, 0x7070, 0x754c, 0x7686, 0x7d75,
225 0x82a5, 0x87f9, 0x958b, 0x968e, 0x8c9d, 0x51f1, 0x52be, 0x5916,
226 0x54b3, 0x5bb3, 0x5d16, 0x6168, 0x6982, 0x6daf, 0x788d, 0x84cb,
227 0x8857, 0x8a72, 0x93a7, 0x9ab8, 0x6d6c, 0x99a8, 0x86d9, 0x57a3,
228 0x67ff, 0x86ce, 0x920e, 0x5283, 0x5687, 0x5404, 0x5ed3, 0x62e1,
229 0x64b9, 0x683c, 0x6838, 0x6bbb, 0x7372, 0x78ba, 0x7a6b, 0x899a,
230 0x89d2, 0x8d6b, 0x8f03, 0x90ed, 0x95a3, 0x9694, 0x9769, 0x5b66,
231 0x5cb3, 0x697d, 0x984d, 0x984e, 0x639b, 0x7b20, 0x6a2b, 0x6a7f,
232 0x68b6, 0x9c0d, 0x6f5f, 0x5272, 0x559d, 0x6070, 0x62ec, 0x6d3b,
233 0x6e07, 0x6ed1, 0x845b, 0x8910, 0x8f44, 0x4e14, 0x9c39, 0x53f6,
234 0x691b, 0x6a3a, 0x9784, 0x682a, 0x515c, 0x7ac3, 0x84b2, 0x91dc,
235 0x938c, 0x565b, 0x9d28, 0x6822, 0x8305, 0x8431,
236 },
237 {
238 0x7ca5, 0x5208, 0x82c5, 0x74e6, 0x4e7e, 0x4f83, 0x51a0, 0x5bd2,
239 0x520a, 0x52d8, 0x52e7, 0x5dfb, 0x559a, 0x582a, 0x59e6, 0x5b8c,
240 0x5b98, 0x5bdb, 0x5e72, 0x5e79, 0x60a3, 0x611f, 0x6163, 0x61be,
241 0x63db, 0x6562, 0x67d1, 0x6853, 0x68fa, 0x6b3e, 0x6b53, 0x6c57,
242 0x6f22, 0x6f97, 0x6f45, 0x74b0, 0x7518, 0x76e3, 0x770b, 0x7aff,
243 0x7ba1, 0x7c21, 0x7de9, 0x7f36, 0x7ff0, 0x809d, 0x8266, 0x839e,
244 0x89b3, 0x8acc, 0x8cab, 0x9084, 0x9451, 0x9593, 0x9591, 0x95a2,
245 0x9665, 0x97d3, 0x9928, 0x8218, 0x4e38, 0x542b, 0x5cb8, 0x5dcc,
246 0x73a9, 0x764c, 0x773c, 0x5ca9, 0x7feb, 0x8d0b, 0x96c1, 0x9811,
247 0x9854, 0x9858, 0x4f01, 0x4f0e, 0x5371, 0x559c, 0x5668, 0x57fa,
248 0x5947, 0x5b09, 0x5bc4, 0x5c90, 0x5e0c, 0x5e7e, 0x5fcc, 0x63ee,
249 0x673a, 0x65d7, 0x65e2, 0x671f, 0x68cb, 0x68c4,
250 },
251 {
252 0x6a5f, 0x5e30, 0x6bc5, 0x6c17, 0x6c7d, 0x757f, 0x7948, 0x5b63,
253 0x7a00, 0x7d00, 0x5fbd, 0x898f, 0x8a18, 0x8cb4, 0x8d77, 0x8ecc,
254 0x8f1d, 0x98e2, 0x9a0e, 0x9b3c, 0x4e80, 0x507d, 0x5100, 0x5993,
255 0x5b9c, 0x622f, 0x6280, 0x64ec, 0x6b3a, 0x72a0, 0x7591, 0x7947,
256 0x7fa9, 0x87fb, 0x8abc, 0x8b70, 0x63ac, 0x83ca, 0x97a0, 0x5409,
257 0x5403, 0x55ab, 0x6854, 0x6a58, 0x8a70, 0x7827, 0x6775, 0x9ecd,
258 0x5374, 0x5ba2, 0x811a, 0x8650, 0x9006, 0x4e18, 0x4e45, 0x4ec7,
259 0x4f11, 0x53ca, 0x5438, 0x5bae, 0x5f13, 0x6025, 0x6551, 0x673d,
260 0x6c42, 0x6c72, 0x6ce3, 0x7078, 0x7403, 0x7a76, 0x7aae, 0x7b08,
261 0x7d1a, 0x7cfe, 0x7d66, 0x65e7, 0x725b, 0x53bb, 0x5c45, 0x5de8,
262 0x62d2, 0x62e0, 0x6319, 0x6e20, 0x865a, 0x8a31, 0x8ddd, 0x92f8,
263 0x6f01, 0x79a6, 0x9b5a, 0x4ea8, 0x4eab, 0x4eac,
264 },
265 {
266 0x4f9b, 0x4fa0, 0x50d1, 0x5147, 0x7af6, 0x5171, 0x51f6, 0x5354,
267 0x5321, 0x537f, 0x53eb, 0x55ac, 0x5883, 0x5ce1, 0x5f37, 0x5f4a,
268 0x602f, 0x6050, 0x606d, 0x631f, 0x6559, 0x6a4b, 0x6cc1, 0x72c2,
269 0x72ed, 0x77ef, 0x80f8, 0x8105, 0x8208, 0x854e, 0x90f7, 0x93e1,
270 0x97ff, 0x9957, 0x9a5a, 0x4ef0, 0x51dd, 0x5c2d, 0x6681, 0x696d,
271 0x5c40, 0x66f2, 0x6975, 0x7389, 0x6850, 0x7c81, 0x50c5, 0x52e4,
272 0x5747, 0x5dfe, 0x9326, 0x65a4, 0x6b23, 0x6b3d, 0x7434, 0x7981,
273 0x79bd, 0x7b4b, 0x7dca, 0x82b9, 0x83cc, 0x887f, 0x895f, 0x8b39,
274 0x8fd1, 0x91d1, 0x541f, 0x9280, 0x4e5d, 0x5036, 0x53e5, 0x533a,
275 0x72d7, 0x7396, 0x77e9, 0x82e6, 0x8eaf, 0x99c6, 0x99c8, 0x99d2,
276 0x5177, 0x611a, 0x865e, 0x55b0, 0x7a7a, 0x5076, 0x5bd3, 0x9047,
277 0x9685, 0x4e32, 0x6adb, 0x91e7, 0x5c51, 0x5c48,
278 },
279 {
280 0x6398, 0x7a9f, 0x6c93, 0x9774, 0x8f61, 0x7aaa, 0x718a, 0x9688,
281 0x7c82, 0x6817, 0x7e70, 0x6851, 0x936c, 0x52f2, 0x541b, 0x85ab,
282 0x8a13, 0x7fa4, 0x8ecd, 0x90e1, 0x5366, 0x8888, 0x7941, 0x4fc2,
283 0x50be, 0x5211, 0x5144, 0x5553, 0x572d, 0x73ea, 0x578b, 0x5951,
284 0x5f62, 0x5f84, 0x6075, 0x6176, 0x6167, 0x61a9, 0x63b2, 0x643a,
285 0x656c, 0x666f, 0x6842, 0x6e13, 0x7566, 0x7a3d, 0x7cfb, 0x7d4c,
286 0x7d99, 0x7e4b, 0x7f6b, 0x830e, 0x834a, 0x86cd, 0x8a08, 0x8a63,
287 0x8b66, 0x8efd, 0x981a, 0x9d8f, 0x82b8, 0x8fce, 0x9be8, 0x5287,
288 0x621f, 0x6483, 0x6fc0, 0x9699, 0x6841, 0x5091, 0x6b20, 0x6c7a,
289 0x6f54, 0x7a74, 0x7d50, 0x8840, 0x8a23, 0x6708, 0x4ef6, 0x5039,
290 0x5026, 0x5065, 0x517c, 0x5238, 0x5263, 0x55a7, 0x570f, 0x5805,
291 0x5acc, 0x5efa, 0x61b2, 0x61f8, 0x62f3, 0x6372,
292 },
293 {
294 0x691c, 0x6a29, 0x727d, 0x72ac, 0x732e, 0x7814, 0x786f, 0x7d79,
295 0x770c, 0x80a9, 0x898b, 0x8b19, 0x8ce2, 0x8ed2, 0x9063, 0x9375,
296 0x967a, 0x9855, 0x9a13, 0x9e78, 0x5143, 0x539f, 0x53b3, 0x5e7b,
297 0x5f26, 0x6e1b, 0x6e90, 0x7384, 0x73fe, 0x7d43, 0x8237, 0x8a00,
298 0x8afa, 0x9650, 0x4e4e, 0x500b, 0x53e4, 0x547c, 0x56fa, 0x59d1,
299 0x5b64, 0x5df1, 0x5eab, 0x5f27, 0x6238, 0x6545, 0x67af, 0x6e56,
300 0x72d0, 0x7cca, 0x88b4, 0x80a1, 0x80e1, 0x83f0, 0x864e, 0x8a87,
301 0x8de8, 0x9237, 0x96c7, 0x9867, 0x9f13, 0x4e94, 0x4e92, 0x4f0d,
302 0x5348, 0x5449, 0x543e, 0x5a2f, 0x5f8c, 0x5fa1, 0x609f, 0x68a7,
303 0x6a8e, 0x745a, 0x7881, 0x8a9e, 0x8aa4, 0x8b77, 0x9190, 0x4e5e,
304 0x9bc9, 0x4ea4, 0x4f7c, 0x4faf, 0x5019, 0x5016, 0x5149, 0x516c,
305 0x529f, 0x52b9, 0x52fe, 0x539a, 0x53e3, 0x5411,
306 },
307 {
308 0x540e, 0x5589, 0x5751, 0x57a2, 0x597d, 0x5b54, 0x5b5d, 0x5b8f,
309 0x5de5, 0x5de7, 0x5df7, 0x5e78, 0x5e83, 0x5e9a, 0x5eb7, 0x5f18,
310 0x6052, 0x614c, 0x6297, 0x62d8, 0x63a7, 0x653b, 0x6602, 0x6643,
311 0x66f4, 0x676d, 0x6821, 0x6897, 0x69cb, 0x6c5f, 0x6d2a, 0x6d69,
312 0x6e2f, 0x6e9d, 0x7532, 0x7687, 0x786c, 0x7a3f, 0x7ce0, 0x7d05,
313 0x7d18, 0x7d5e, 0x7db1, 0x8015, 0x8003, 0x80af, 0x80b1, 0x8154,
314 0x818f, 0x822a, 0x8352, 0x884c, 0x8861, 0x8b1b, 0x8ca2, 0x8cfc,
315 0x90ca, 0x9175, 0x9271, 0x783f, 0x92fc, 0x95a4, 0x964d, 0x9805,
316 0x9999, 0x9ad8, 0x9d3b, 0x525b, 0x52ab, 0x53f7, 0x5408, 0x58d5,
317 0x62f7, 0x6fe0, 0x8c6a, 0x8f5f, 0x9eb9, 0x514b, 0x523b, 0x544a,
318 0x56fd, 0x7a40, 0x9177, 0x9d60, 0x9ed2, 0x7344, 0x6f09, 0x8170,
319 0x7511, 0x5ffd, 0x60da, 0x9aa8, 0x72db, 0x8fbc,
320 },
321 {
322 0x6b64, 0x9803, 0x4eca, 0x56f0, 0x5764, 0x58be, 0x5a5a, 0x6068,
323 0x61c7, 0x660f, 0x6606, 0x6839, 0x68b1, 0x6df7, 0x75d5, 0x7d3a,
324 0x826e, 0x9b42, 0x4e9b, 0x4f50, 0x53c9, 0x5506, 0x5d6f, 0x5de6,
325 0x5dee, 0x67fb, 0x6c99, 0x7473, 0x7802, 0x8a50, 0x9396, 0x88df,
326 0x5750, 0x5ea7, 0x632b, 0x50b5, 0x50ac, 0x518d, 0x6700, 0x54c9,
327 0x585e, 0x59bb, 0x5bb0, 0x5f69, 0x624d, 0x63a1, 0x683d, 0x6b73,
328 0x6e08, 0x707d, 0x91c7, 0x7280, 0x7815, 0x7826, 0x796d, 0x658e,
329 0x7d30, 0x83dc, 0x88c1, 0x8f09, 0x969b, 0x5264, 0x5728, 0x6750,
330 0x7f6a, 0x8ca1, 0x51b4, 0x5742, 0x962a, 0x583a, 0x698a, 0x80b4,
331 0x54b2, 0x5d0e, 0x57fc, 0x7895, 0x9dfa, 0x4f5c, 0x524a, 0x548b,
332 0x643e, 0x6628, 0x6714, 0x67f5, 0x7a84, 0x7b56, 0x7d22, 0x932f,
333 0x685c, 0x9bad, 0x7b39, 0x5319, 0x518a, 0x5237,
334 },
335 {
336 0x5bdf, 0x62f6, 0x64ae, 0x64e6, 0x672d, 0x6bba, 0x85a9, 0x96d1,
337 0x7690, 0x9bd6, 0x634c, 0x9306, 0x9bab, 0x76bf, 0x6652, 0x4e09,
338 0x5098, 0x53c2, 0x5c71, 0x60e8, 0x6492, 0x6563, 0x685f, 0x71e6,
339 0x73ca, 0x7523, 0x7b97, 0x7e82, 0x8695, 0x8b83, 0x8cdb, 0x9178,
340 0x9910, 0x65ac, 0x66ab, 0x6b8b, 0x4ed5, 0x4ed4, 0x4f3a, 0x4f7f,
341 0x523a, 0x53f8, 0x53f2, 0x55e3, 0x56db, 0x58eb, 0x59cb, 0x59c9,
342 0x59ff, 0x5b50, 0x5c4d, 0x5e02, 0x5e2b, 0x5fd7, 0x601d, 0x6307,
343 0x652f, 0x5b5c, 0x65af, 0x65bd, 0x65e8, 0x679d, 0x6b62, 0x6b7b,
344 0x6c0f, 0x7345, 0x7949, 0x79c1, 0x7cf8, 0x7d19, 0x7d2b, 0x80a2,
345 0x8102, 0x81f3, 0x8996, 0x8a5e, 0x8a69, 0x8a66, 0x8a8c, 0x8aee,
346 0x8cc7, 0x8cdc, 0x96cc, 0x98fc, 0x6b6f, 0x4e8b, 0x4f3c, 0x4f8d,
347 0x5150, 0x5b57, 0x5bfa, 0x6148, 0x6301, 0x6642,
348 },
349 {
350 0x6b21, 0x6ecb, 0x6cbb, 0x723e, 0x74bd, 0x75d4, 0x78c1, 0x793a,
351 0x800c, 0x8033, 0x81ea, 0x8494, 0x8f9e, 0x6c50, 0x9e7f, 0x5f0f,
352 0x8b58, 0x9d2b, 0x7afa, 0x8ef8, 0x5b8d, 0x96eb, 0x4e03, 0x53f1,
353 0x57f7, 0x5931, 0x5ac9, 0x5ba4, 0x6089, 0x6e7f, 0x6f06, 0x75be,
354 0x8cea, 0x5b9f, 0x8500, 0x7be0, 0x5072, 0x67f4, 0x829d, 0x5c61,
355 0x854a, 0x7e1e, 0x820e, 0x5199, 0x5c04, 0x6368, 0x8d66, 0x659c,
356 0x716e, 0x793e, 0x7d17, 0x8005, 0x8b1d, 0x8eca, 0x906e, 0x86c7,
357 0x90aa, 0x501f, 0x52fa, 0x5c3a, 0x6753, 0x707c, 0x7235, 0x914c,
358 0x91c8, 0x932b, 0x82e5, 0x5bc2, 0x5f31, 0x60f9, 0x4e3b, 0x53d6,
359 0x5b88, 0x624b, 0x6731, 0x6b8a, 0x72e9, 0x73e0, 0x7a2e, 0x816b,
360 0x8da3, 0x9152, 0x9996, 0x5112, 0x53d7, 0x546a, 0x5bff, 0x6388,
361 0x6a39, 0x7dac, 0x9700, 0x56da, 0x53ce, 0x5468,
362 },
363 {
364 0x5b97, 0x5c31, 0x5dde, 0x4fee, 0x6101, 0x62fe, 0x6d32, 0x79c0,
365 0x79cb, 0x7d42, 0x7e4d, 0x7fd2, 0x81ed, 0x821f, 0x8490, 0x8846,
366 0x8972, 0x8b90, 0x8e74, 0x8f2f, 0x9031, 0x914b, 0x916c, 0x96c6,
367 0x919c, 0x4ec0, 0x4f4f, 0x5145, 0x5341, 0x5f93, 0x620e, 0x67d4,
368 0x6c41, 0x6e0b, 0x7363, 0x7e26, 0x91cd, 0x9283, 0x53d4, 0x5919,
369 0x5bbf, 0x6dd1, 0x795d, 0x7e2e, 0x7c9b, 0x587e, 0x719f, 0x51fa,
370 0x8853, 0x8ff0, 0x4fca, 0x5cfb, 0x6625, 0x77ac, 0x7ae3, 0x821c,
371 0x99ff, 0x51c6, 0x5faa, 0x65ec, 0x696f, 0x6b89, 0x6df3, 0x6e96,
372 0x6f64, 0x76fe, 0x7d14, 0x5de1, 0x9075, 0x9187, 0x9806, 0x51e6,
373 0x521d, 0x6240, 0x6691, 0x66d9, 0x6e1a, 0x5eb6, 0x7dd2, 0x7f72,
374 0x66f8, 0x85af, 0x85f7, 0x8af8, 0x52a9, 0x53d9, 0x5973, 0x5e8f,
375 0x5f90, 0x6055, 0x92e4, 0x9664, 0x50b7, 0x511f,
376 },
377 {
378 0x52dd, 0x5320, 0x5347, 0x53ec, 0x54e8, 0x5546, 0x5531, 0x5617,
379 0x5968, 0x59be, 0x5a3c, 0x5bb5, 0x5c06, 0x5c0f, 0x5c11, 0x5c1a,
380 0x5e84, 0x5e8a, 0x5ee0, 0x5f70, 0x627f, 0x6284, 0x62db, 0x638c,
381 0x6377, 0x6607, 0x660c, 0x662d, 0x6676, 0x677e, 0x68a2, 0x6a1f,
382 0x6a35, 0x6cbc, 0x6d88, 0x6e09, 0x6e58, 0x713c, 0x7126, 0x7167,
383 0x75c7, 0x7701, 0x785d, 0x7901, 0x7965, 0x79f0, 0x7ae0, 0x7b11,
384 0x7ca7, 0x7d39, 0x8096, 0x83d6, 0x848b, 0x8549, 0x885d, 0x88f3,
385 0x8a1f, 0x8a3c, 0x8a54, 0x8a73, 0x8c61, 0x8cde, 0x91a4, 0x9266,
386 0x937e, 0x9418, 0x969c, 0x9798, 0x4e0a, 0x4e08, 0x4e1e, 0x4e57,
387 0x5197, 0x5270, 0x57ce, 0x5834, 0x58cc, 0x5b22, 0x5e38, 0x60c5,
388 0x64fe, 0x6761, 0x6756, 0x6d44, 0x72b6, 0x7573, 0x7a63, 0x84b8,
389 0x8b72, 0x91b8, 0x9320, 0x5631, 0x57f4, 0x98fe,
390 },
391 {
392 0x62ed, 0x690d, 0x6b96, 0x71ed, 0x7e54, 0x8077, 0x8272, 0x89e6,
393 0x98df, 0x8755, 0x8fb1, 0x5c3b, 0x4f38, 0x4fe1, 0x4fb5, 0x5507,
394 0x5a20, 0x5bdd, 0x5be9, 0x5fc3, 0x614e, 0x632f, 0x65b0, 0x664b,
395 0x68ee, 0x699b, 0x6d78, 0x6df1, 0x7533, 0x75b9, 0x771f, 0x795e,
396 0x79e6, 0x7d33, 0x81e3, 0x82af, 0x85aa, 0x89aa, 0x8a3a, 0x8eab,
397 0x8f9b, 0x9032, 0x91dd, 0x9707, 0x4eba, 0x4ec1, 0x5203, 0x5875,
398 0x58ec, 0x5c0b, 0x751a, 0x5c3d, 0x814e, 0x8a0a, 0x8fc5, 0x9663,
399 0x976d, 0x7b25, 0x8acf, 0x9808, 0x9162, 0x56f3, 0x53a8, 0x9017,
400 0x5439, 0x5782, 0x5e25, 0x63a8, 0x6c34, 0x708a, 0x7761, 0x7c8b,
401 0x7fe0, 0x8870, 0x9042, 0x9154, 0x9310, 0x9318, 0x968f, 0x745e,
402 0x9ac4, 0x5d07, 0x5d69, 0x6570, 0x67a2, 0x8da8, 0x96db, 0x636e,
403 0x6749, 0x6919, 0x83c5, 0x9817, 0x96c0, 0x88fe,
404 },
405 {
406 0x6f84, 0x647a, 0x5bf8, 0x4e16, 0x702c, 0x755d, 0x662f, 0x51c4,
407 0x5236, 0x52e2, 0x59d3, 0x5f81, 0x6027, 0x6210, 0x653f, 0x6574,
408 0x661f, 0x6674, 0x68f2, 0x6816, 0x6b63, 0x6e05, 0x7272, 0x751f,
409 0x76db, 0x7cbe, 0x8056, 0x58f0, 0x88fd, 0x897f, 0x8aa0, 0x8a93,
410 0x8acb, 0x901d, 0x9192, 0x9752, 0x9759, 0x6589, 0x7a0e, 0x8106,
411 0x96bb, 0x5e2d, 0x60dc, 0x621a, 0x65a5, 0x6614, 0x6790, 0x77f3,
412 0x7a4d, 0x7c4d, 0x7e3e, 0x810a, 0x8cac, 0x8d64, 0x8de1, 0x8e5f,
413 0x78a9, 0x5207, 0x62d9, 0x63a5, 0x6442, 0x6298, 0x8a2d, 0x7a83,
414 0x7bc0, 0x8aac, 0x96ea, 0x7d76, 0x820c, 0x8749, 0x4ed9, 0x5148,
415 0x5343, 0x5360, 0x5ba3, 0x5c02, 0x5c16, 0x5ddd, 0x6226, 0x6247,
416 0x64b0, 0x6813, 0x6834, 0x6cc9, 0x6d45, 0x6d17, 0x67d3, 0x6f5c,
417 0x714e, 0x717d, 0x65cb, 0x7a7f, 0x7bad, 0x7dda,
418 },
419 {
420 0x7e4a, 0x7fa8, 0x817a, 0x821b, 0x8239, 0x85a6, 0x8a6e, 0x8cce,
421 0x8df5, 0x9078, 0x9077, 0x92ad, 0x9291, 0x9583, 0x9bae, 0x524d,
422 0x5584, 0x6f38, 0x7136, 0x5168, 0x7985, 0x7e55, 0x81b3, 0x7cce,
423 0x564c, 0x5851, 0x5ca8, 0x63aa, 0x66fe, 0x66fd, 0x695a, 0x72d9,
424 0x758f, 0x758e, 0x790e, 0x7956, 0x79df, 0x7c97, 0x7d20, 0x7d44,
425 0x8607, 0x8a34, 0x963b, 0x9061, 0x9f20, 0x50e7, 0x5275, 0x53cc,
426 0x53e2, 0x5009, 0x55aa, 0x58ee, 0x594f, 0x723d, 0x5b8b, 0x5c64,
427 0x531d, 0x60e3, 0x60f3, 0x635c, 0x6383, 0x633f, 0x63bb, 0x64cd,
428 0x65e9, 0x66f9, 0x5de3, 0x69cd, 0x69fd, 0x6f15, 0x71e5, 0x4e89,
429 0x75e9, 0x76f8, 0x7a93, 0x7cdf, 0x7dcf, 0x7d9c, 0x8061, 0x8349,
430 0x8358, 0x846c, 0x84bc, 0x85fb, 0x88c5, 0x8d70, 0x9001, 0x906d,
431 0x9397, 0x971c, 0x9a12, 0x50cf, 0x5897, 0x618e,
432 },
433 {
434 0x81d3, 0x8535, 0x8d08, 0x9020, 0x4fc3, 0x5074, 0x5247, 0x5373,
435 0x606f, 0x6349, 0x675f, 0x6e2c, 0x8db3, 0x901f, 0x4fd7, 0x5c5e,
436 0x8cca, 0x65cf, 0x7d9a, 0x5352, 0x8896, 0x5176, 0x63c3, 0x5b58,
437 0x5b6b, 0x5c0a, 0x640d, 0x6751, 0x905c, 0x4ed6, 0x591a, 0x592a,
438 0x6c70, 0x8a51, 0x553e, 0x5815, 0x59a5, 0x60f0, 0x6253, 0x67c1,
439 0x8235, 0x6955, 0x9640, 0x99c4, 0x9a28, 0x4f53, 0x5806, 0x5bfe,
440 0x8010, 0x5cb1, 0x5e2f, 0x5f85, 0x6020, 0x614b, 0x6234, 0x66ff,
441 0x6cf0, 0x6ede, 0x80ce, 0x817f, 0x82d4, 0x888b, 0x8cb8, 0x9000,
442 0x902e, 0x968a, 0x9edb, 0x9bdb, 0x4ee3, 0x53f0, 0x5927, 0x7b2c,
443 0x918d, 0x984c, 0x9df9, 0x6edd, 0x7027, 0x5353, 0x5544, 0x5b85,
444 0x6258, 0x629e, 0x62d3, 0x6ca2, 0x6fef, 0x7422, 0x8a17, 0x9438,
445 0x6fc1, 0x8afe, 0x8338, 0x51e7, 0x86f8, 0x53ea,
446 },
447 {
448 0x53e9, 0x4f46, 0x9054, 0x8fb0, 0x596a, 0x8131, 0x5dfd, 0x7aea,
449 0x8fbf, 0x68da, 0x8c37, 0x72f8, 0x9c48, 0x6a3d, 0x8ab0, 0x4e39,
450 0x5358, 0x5606, 0x5766, 0x62c5, 0x63a2, 0x65e6, 0x6b4e, 0x6de1,
451 0x6e5b, 0x70ad, 0x77ed, 0x7aef, 0x7baa, 0x7dbb, 0x803d, 0x80c6,
452 0x86cb, 0x8a95, 0x935b, 0x56e3, 0x58c7, 0x5f3e, 0x65ad, 0x6696,
453 0x6a80, 0x6bb5, 0x7537, 0x8ac7, 0x5024, 0x77e5, 0x5730, 0x5f1b,
454 0x6065, 0x667a, 0x6c60, 0x75f4, 0x7a1a, 0x7f6e, 0x81f4, 0x8718,
455 0x9045, 0x99b3, 0x7bc9, 0x755c, 0x7af9, 0x7b51, 0x84c4, 0x9010,
456 0x79e9, 0x7a92, 0x8336, 0x5ae1, 0x7740, 0x4e2d, 0x4ef2, 0x5b99,
457 0x5fe0, 0x62bd, 0x663c, 0x67f1, 0x6ce8, 0x866b, 0x8877, 0x8a3b,
458 0x914e, 0x92f3, 0x99d0, 0x6a17, 0x7026, 0x732a, 0x82e7, 0x8457,
459 0x8caf, 0x4e01, 0x5146, 0x51cb, 0x558b, 0x5bf5,
460 },
461 {
462 0x5e16, 0x5e33, 0x5e81, 0x5f14, 0x5f35, 0x5f6b, 0x5fb4, 0x61f2,
463 0x6311, 0x66a2, 0x671d, 0x6f6e, 0x7252, 0x753a, 0x773a, 0x8074,
464 0x8139, 0x8178, 0x8776, 0x8abf, 0x8adc, 0x8d85, 0x8df3, 0x929a,
465 0x9577, 0x9802, 0x9ce5, 0x52c5, 0x6357, 0x76f4, 0x6715, 0x6c88,
466 0x73cd, 0x8cc3, 0x93ae, 0x9673, 0x6d25, 0x589c, 0x690e, 0x69cc,
467 0x8ffd, 0x939a, 0x75db, 0x901a, 0x585a, 0x6802, 0x63b4, 0x69fb,
468 0x4f43, 0x6f2c, 0x67d8, 0x8fbb, 0x8526, 0x7db4, 0x9354, 0x693f,
469 0x6f70, 0x576a, 0x58f7, 0x5b2c, 0x7d2c, 0x722a, 0x540a, 0x91e3,
470 0x9db4, 0x4ead, 0x4f4e, 0x505c, 0x5075, 0x5243, 0x8c9e, 0x5448,
471 0x5824, 0x5b9a, 0x5e1d, 0x5e95, 0x5ead, 0x5ef7, 0x5f1f, 0x608c,
472 0x62b5, 0x633a, 0x63d0, 0x68af, 0x6c40, 0x7887, 0x798e, 0x7a0b,
473 0x7de0, 0x8247, 0x8a02, 0x8ae6, 0x8e44, 0x9013,
474 },
475 {
476 0x90b8, 0x912d, 0x91d8, 0x9f0e, 0x6ce5, 0x6458, 0x64e2, 0x6575,
477 0x6ef4, 0x7684, 0x7b1b, 0x9069, 0x93d1, 0x6eba, 0x54f2, 0x5fb9,
478 0x64a4, 0x8f4d, 0x8fed, 0x9244, 0x5178, 0x586b, 0x5929, 0x5c55,
479 0x5e97, 0x6dfb, 0x7e8f, 0x751c, 0x8cbc, 0x8ee2, 0x985b, 0x70b9,
480 0x4f1d, 0x6bbf, 0x6fb1, 0x7530, 0x96fb, 0x514e, 0x5410, 0x5835,
481 0x5857, 0x59ac, 0x5c60, 0x5f92, 0x6597, 0x675c, 0x6e21, 0x767b,
482 0x83df, 0x8ced, 0x9014, 0x90fd, 0x934d, 0x7825, 0x783a, 0x52aa,
483 0x5ea6, 0x571f, 0x5974, 0x6012, 0x5012, 0x515a, 0x51ac, 0x51cd,
484 0x5200, 0x5510, 0x5854, 0x5858, 0x5957, 0x5b95, 0x5cf6, 0x5d8b,
485 0x60bc, 0x6295, 0x642d, 0x6771, 0x6843, 0x68bc, 0x68df, 0x76d7,
486 0x6dd8, 0x6e6f, 0x6d9b, 0x706f, 0x71c8, 0x5f53, 0x75d8, 0x7977,
487 0x7b49, 0x7b54, 0x7b52, 0x7cd6, 0x7d71, 0x5230,
488 },
489 {
490 0x8463, 0x8569, 0x85e4, 0x8a0e, 0x8b04, 0x8c46, 0x8e0f, 0x9003,
491 0x900f, 0x9419, 0x9676, 0x982d, 0x9a30, 0x95d8, 0x50cd, 0x52d5,
492 0x540c, 0x5802, 0x5c0e, 0x61a7, 0x649e, 0x6d1e, 0x77b3, 0x7ae5,
493 0x80f4, 0x8404, 0x9053, 0x9285, 0x5ce0, 0x9d07, 0x533f, 0x5f97,
494 0x5fb3, 0x6d9c, 0x7279, 0x7763, 0x79bf, 0x7be4, 0x6bd2, 0x72ec,
495 0x8aad, 0x6803, 0x6a61, 0x51f8, 0x7a81, 0x6934, 0x5c4a, 0x9cf6,
496 0x82eb, 0x5bc5, 0x9149, 0x701e, 0x5678, 0x5c6f, 0x60c7, 0x6566,
497 0x6c8c, 0x8c5a, 0x9041, 0x9813, 0x5451, 0x66c7, 0x920d, 0x5948,
498 0x90a3, 0x5185, 0x4e4d, 0x51ea, 0x8599, 0x8b0e, 0x7058, 0x637a,
499 0x934b, 0x6962, 0x99b4, 0x7e04, 0x7577, 0x5357, 0x6960, 0x8edf,
500 0x96e3, 0x6c5d, 0x4e8c, 0x5c3c, 0x5f10, 0x8fe9, 0x5302, 0x8cd1,
501 0x8089, 0x8679, 0x5eff, 0x65e5, 0x4e73, 0x5165,
502 },
503 {
504 0x5982, 0x5c3f, 0x97ee, 0x4efb, 0x598a, 0x5fcd, 0x8a8d, 0x6fe1,
505 0x79b0, 0x7962, 0x5be7, 0x8471, 0x732b, 0x71b1, 0x5e74, 0x5ff5,
506 0x637b, 0x649a, 0x71c3, 0x7c98, 0x4e43, 0x5efc, 0x4e4b, 0x57dc,
507 0x56a2, 0x60a9, 0x6fc3, 0x7d0d, 0x80fd, 0x8133, 0x81bf, 0x8fb2,
508 0x8997, 0x86a4, 0x5df4, 0x628a, 0x64ad, 0x8987, 0x6777, 0x6ce2,
509 0x6d3e, 0x7436, 0x7834, 0x5a46, 0x7f75, 0x82ad, 0x99ac, 0x4ff3,
510 0x5ec3, 0x62dd, 0x6392, 0x6557, 0x676f, 0x76c3, 0x724c, 0x80cc,
511 0x80ba, 0x8f29, 0x914d, 0x500d, 0x57f9, 0x5a92, 0x6885, 0x6973,
512 0x7164, 0x72fd, 0x8cb7, 0x58f2, 0x8ce0, 0x966a, 0x9019, 0x877f,
513 0x79e4, 0x77e7, 0x8429, 0x4f2f, 0x5265, 0x535a, 0x62cd, 0x67cf,
514 0x6cca, 0x767d, 0x7b94, 0x7c95, 0x8236, 0x8584, 0x8feb, 0x66dd,
515 0x6f20, 0x7206, 0x7e1b, 0x83ab, 0x99c1, 0x9ea6,
516 },
517 {
518 0x51fd, 0x7bb1, 0x7872, 0x7bb8, 0x8087, 0x7b48, 0x6ae8, 0x5e61,
519 0x808c, 0x7551, 0x7560, 0x516b, 0x9262, 0x6e8c, 0x767a, 0x9197,
520 0x9aea, 0x4f10, 0x7f70, 0x629c, 0x7b4f, 0x95a5, 0x9ce9, 0x567a,
521 0x5859, 0x86e4, 0x96bc, 0x4f34, 0x5224, 0x534a, 0x53cd, 0x53db,
522 0x5e06, 0x642c, 0x6591, 0x677f, 0x6c3e, 0x6c4e, 0x7248, 0x72af,
523 0x73ed, 0x7554, 0x7e41, 0x822c, 0x85e9, 0x8ca9, 0x7bc4, 0x91c6,
524 0x7169, 0x9812, 0x98ef, 0x633d, 0x6669, 0x756a, 0x76e4, 0x78d0,
525 0x8543, 0x86ee, 0x532a, 0x5351, 0x5426, 0x5983, 0x5e87, 0x5f7c,
526 0x60b2, 0x6249, 0x6279, 0x62ab, 0x6590, 0x6bd4, 0x6ccc, 0x75b2,
527 0x76ae, 0x7891, 0x79d8, 0x7dcb, 0x7f77, 0x80a5, 0x88ab, 0x8ab9,
528 0x8cbb, 0x907f, 0x975e, 0x98db, 0x6a0b, 0x7c38, 0x5099, 0x5c3e,
529 0x5fae, 0x6787, 0x6bd8, 0x7435, 0x7709, 0x7f8e,
530 },
531 {
532 0x9f3b, 0x67ca, 0x7a17, 0x5339, 0x758b, 0x9aed, 0x5f66, 0x819d,
533 0x83f1, 0x8098, 0x5f3c, 0x5fc5, 0x7562, 0x7b46, 0x903c, 0x6867,
534 0x59eb, 0x5a9b, 0x7d10, 0x767e, 0x8b2c, 0x4ff5, 0x5f6a, 0x6a19,
535 0x6c37, 0x6f02, 0x74e2, 0x7968, 0x8868, 0x8a55, 0x8c79, 0x5edf,
536 0x63cf, 0x75c5, 0x79d2, 0x82d7, 0x9328, 0x92f2, 0x849c, 0x86ed,
537 0x9c2d, 0x54c1, 0x5f6c, 0x658c, 0x6d5c, 0x7015, 0x8ca7, 0x8cd3,
538 0x983b, 0x654f, 0x74f6, 0x4e0d, 0x4ed8, 0x57e0, 0x592b, 0x5a66,
539 0x5bcc, 0x51a8, 0x5e03, 0x5e9c, 0x6016, 0x6276, 0x6577, 0x65a7,
540 0x666e, 0x6d6e, 0x7236, 0x7b26, 0x8150, 0x819a, 0x8299, 0x8b5c,
541 0x8ca0, 0x8ce6, 0x8d74, 0x961c, 0x9644, 0x4fae, 0x64ab, 0x6b66,
542 0x821e, 0x8461, 0x856a, 0x90e8, 0x5c01, 0x6953, 0x98a8, 0x847a,
543 0x8557, 0x4f0f, 0x526f, 0x5fa9, 0x5e45, 0x670d,
544 },
545 {
546 0x798f, 0x8179, 0x8907, 0x8986, 0x6df5, 0x5f17, 0x6255, 0x6cb8,
547 0x4ecf, 0x7269, 0x9b92, 0x5206, 0x543b, 0x5674, 0x58b3, 0x61a4,
548 0x626e, 0x711a, 0x596e, 0x7c89, 0x7cde, 0x7d1b, 0x96f0, 0x6587,
549 0x805e, 0x4e19, 0x4f75, 0x5175, 0x5840, 0x5e63, 0x5e73, 0x5f0a,
550 0x67c4, 0x4e26, 0x853d, 0x9589, 0x965b, 0x7c73, 0x9801, 0x50fb,
551 0x58c1, 0x7656, 0x78a7, 0x5225, 0x77a5, 0x8511, 0x7b86, 0x504f,
552 0x5909, 0x7247, 0x7bc7, 0x7de8, 0x8fba, 0x8fd4, 0x904d, 0x4fbf,
553 0x52c9, 0x5a29, 0x5f01, 0x97ad, 0x4fdd, 0x8217, 0x92ea, 0x5703,
554 0x6355, 0x6b69, 0x752b, 0x88dc, 0x8f14, 0x7a42, 0x52df, 0x5893,
555 0x6155, 0x620a, 0x66ae, 0x6bcd, 0x7c3f, 0x83e9, 0x5023, 0x4ff8,
556 0x5305, 0x5446, 0x5831, 0x5949, 0x5b9d, 0x5cf0, 0x5cef, 0x5d29,
557 0x5e96, 0x62b1, 0x6367, 0x653e, 0x65b9, 0x670b,
558 },
559 {
560 0x6cd5, 0x6ce1, 0x70f9, 0x7832, 0x7e2b, 0x80de, 0x82b3, 0x840c,
561 0x84ec, 0x8702, 0x8912, 0x8a2a, 0x8c4a, 0x90a6, 0x92d2, 0x98fd,
562 0x9cf3, 0x9d6c, 0x4e4f, 0x4ea1, 0x508d, 0x5256, 0x574a, 0x59a8,
563 0x5e3d, 0x5fd8, 0x5fd9, 0x623f, 0x66b4, 0x671b, 0x67d0, 0x68d2,
564 0x5192, 0x7d21, 0x80aa, 0x81a8, 0x8b00, 0x8c8c, 0x8cbf, 0x927e,
565 0x9632, 0x5420, 0x982c, 0x5317, 0x50d5, 0x535c, 0x58a8, 0x64b2,
566 0x6734, 0x7267, 0x7766, 0x7a46, 0x91e6, 0x52c3, 0x6ca1, 0x6b86,
567 0x5800, 0x5e4c, 0x5954, 0x672c, 0x7ffb, 0x51e1, 0x76c6, 0x6469,
568 0x78e8, 0x9b54, 0x9ebb, 0x57cb, 0x59b9, 0x6627, 0x679a, 0x6bce,
569 0x54e9, 0x69d9, 0x5e55, 0x819c, 0x6795, 0x9baa, 0x67fe, 0x9c52,
570 0x685d, 0x4ea6, 0x4fe3, 0x53c8, 0x62b9, 0x672b, 0x6cab, 0x8fc4,
571 0x4fad, 0x7e6d, 0x9ebf, 0x4e07, 0x6162, 0x6e80,
572 },
573 {
574 0x6f2b, 0x8513, 0x5473, 0x672a, 0x9b45, 0x5df3, 0x7b95, 0x5cac,
575 0x5bc6, 0x871c, 0x6e4a, 0x84d1, 0x7a14, 0x8108, 0x5999, 0x7c8d,
576 0x6c11, 0x7720, 0x52d9, 0x5922, 0x7121, 0x725f, 0x77db, 0x9727,
577 0x9d61, 0x690b, 0x5a7f, 0x5a18, 0x51a5, 0x540d, 0x547d, 0x660e,
578 0x76df, 0x8ff7, 0x9298, 0x9cf4, 0x59ea, 0x725d, 0x6ec5, 0x514d,
579 0x68c9, 0x7dbf, 0x7dec, 0x9762, 0x9eba, 0x6478, 0x6a21, 0x8302,
580 0x5984, 0x5b5f, 0x6bdb, 0x731b, 0x76f2, 0x7db2, 0x8017, 0x8499,
581 0x5132, 0x6728, 0x9ed9, 0x76ee, 0x6762, 0x52ff, 0x9905, 0x5c24,
582 0x623b, 0x7c7e, 0x8cb0, 0x554f, 0x60b6, 0x7d0b, 0x9580, 0x5301,
583 0x4e5f, 0x51b6, 0x591c, 0x723a, 0x8036, 0x91ce, 0x5f25, 0x77e2,
584 0x5384, 0x5f79, 0x7d04, 0x85ac, 0x8a33, 0x8e8d, 0x9756, 0x67f3,
585 0x85ae, 0x9453, 0x6109, 0x6108, 0x6cb9, 0x7652,
586 },
587 {
588 0x8aed, 0x8f38, 0x552f, 0x4f51, 0x512a, 0x52c7, 0x53cb, 0x5ba5,
589 0x5e7d, 0x60a0, 0x6182, 0x63d6, 0x6709, 0x67da, 0x6e67, 0x6d8c,
590 0x7336, 0x7337, 0x7531, 0x7950, 0x88d5, 0x8a98, 0x904a, 0x9091,
591 0x90f5, 0x96c4, 0x878d, 0x5915, 0x4e88, 0x4f59, 0x4e0e, 0x8a89,
592 0x8f3f, 0x9810, 0x50ad, 0x5e7c, 0x5996, 0x5bb9, 0x5eb8, 0x63da,
593 0x63fa, 0x64c1, 0x66dc, 0x694a, 0x69d8, 0x6d0b, 0x6eb6, 0x7194,
594 0x7528, 0x7aaf, 0x7f8a, 0x8000, 0x8449, 0x84c9, 0x8981, 0x8b21,
595 0x8e0a, 0x9065, 0x967d, 0x990a, 0x617e, 0x6291, 0x6b32, 0x6c83,
596 0x6d74, 0x7fcc, 0x7ffc, 0x6dc0, 0x7f85, 0x87ba, 0x88f8, 0x6765,
597 0x83b1, 0x983c, 0x96f7, 0x6d1b, 0x7d61, 0x843d, 0x916a, 0x4e71,
598 0x5375, 0x5d50, 0x6b04, 0x6feb, 0x85cd, 0x862d, 0x89a7, 0x5229,
599 0x540f, 0x5c65, 0x674e, 0x68a8, 0x7406, 0x7483,
600 },
601 {
602 0x75e2, 0x88cf, 0x88e1, 0x91cc, 0x96e2, 0x9678, 0x5f8b, 0x7387,
603 0x7acb, 0x844e, 0x63a0, 0x7565, 0x5289, 0x6d41, 0x6e9c, 0x7409,
604 0x7559, 0x786b, 0x7c92, 0x9686, 0x7adc, 0x9f8d, 0x4fb6, 0x616e,
605 0x65c5, 0x865c, 0x4e86, 0x4eae, 0x50da, 0x4e21, 0x51cc, 0x5bee,
606 0x6599, 0x6881, 0x6dbc, 0x731f, 0x7642, 0x77ad, 0x7a1c, 0x7ce7,
607 0x826f, 0x8ad2, 0x907c, 0x91cf, 0x9675, 0x9818, 0x529b, 0x7dd1,
608 0x502b, 0x5398, 0x6797, 0x6dcb, 0x71d0, 0x7433, 0x81e8, 0x8f2a,
609 0x96a3, 0x9c57, 0x9e9f, 0x7460, 0x5841, 0x6d99, 0x7d2f, 0x985e,
610 0x4ee4, 0x4f36, 0x4f8b, 0x51b7, 0x52b1, 0x5dba, 0x601c, 0x73b2,
611 0x793c, 0x82d3, 0x9234, 0x96b7, 0x96f6, 0x970a, 0x9e97, 0x9f62,
612 0x66a6, 0x6b74, 0x5217, 0x52a3, 0x70c8, 0x88c2, 0x5ec9, 0x604b,
613 0x6190, 0x6f23, 0x7149, 0x7c3e, 0x7df4, 0x806f,
614 },
615 {
616 0x84ee, 0x9023, 0x932c, 0x5442, 0x9b6f, 0x6ad3, 0x7089, 0x8cc2,
617 0x8def, 0x9732, 0x52b4, 0x5a41, 0x5eca, 0x5f04, 0x6717, 0x697c,
618 0x6994, 0x6d6a, 0x6f0f, 0x7262, 0x72fc, 0x7bed, 0x8001, 0x807e,
619 0x874b, 0x90ce, 0x516d, 0x9e93, 0x7984, 0x808b, 0x9332, 0x8ad6,
620 0x502d, 0x548c, 0x8a71, 0x6b6a, 0x8cc4, 0x8107, 0x60d1, 0x67a0,
621 0x9df2, 0x4e99, 0x4e98, 0x9c10, 0x8a6b, 0x85c1, 0x8568, 0x6900,
622 0x6e7e, 0x7897, 0x8155,
623 },
624 {
625 0x5f0c, 0x4e10, 0x4e15, 0x4e2a, 0x4e31, 0x4e36, 0x4e3c, 0x4e3f,
626 0x4e42, 0x4e56, 0x4e58, 0x4e82, 0x4e85, 0x8c6b, 0x4e8a, 0x8212,
627 0x5f0d, 0x4e8e, 0x4e9e, 0x4e9f, 0x4ea0, 0x4ea2, 0x4eb0, 0x4eb3,
628 0x4eb6, 0x4ece, 0x4ecd, 0x4ec4, 0x4ec6, 0x4ec2, 0x4ed7, 0x4ede,
629 0x4eed, 0x4edf, 0x4ef7, 0x4f09, 0x4f5a, 0x4f30, 0x4f5b, 0x4f5d,
630 0x4f57, 0x4f47, 0x4f76, 0x4f88, 0x4f8f, 0x4f98, 0x4f7b, 0x4f69,
631 0x4f70, 0x4f91, 0x4f6f, 0x4f86, 0x4f96, 0x5118, 0x4fd4, 0x4fdf,
632 0x4fce, 0x4fd8, 0x4fdb, 0x4fd1, 0x4fda, 0x4fd0, 0x4fe4, 0x4fe5,
633 0x501a, 0x5028, 0x5014, 0x502a, 0x5025, 0x5005, 0x4f1c, 0x4ff6,
634 0x5021, 0x5029, 0x502c, 0x4ffe, 0x4fef, 0x5011, 0x5006, 0x5043,
635 0x5047, 0x6703, 0x5055, 0x5050, 0x5048, 0x505a, 0x5056, 0x506c,
636 0x5078, 0x5080, 0x509a, 0x5085, 0x50b4, 0x50b2,
637 },
638 {
639 0x50c9, 0x50ca, 0x50b3, 0x50c2, 0x50d6, 0x50de, 0x50e5, 0x50ed,
640 0x50e3, 0x50ee, 0x50f9, 0x50f5, 0x5109, 0x5101, 0x5102, 0x5116,
641 0x5115, 0x5114, 0x511a, 0x5121, 0x513a, 0x5137, 0x513c, 0x513b,
642 0x513f, 0x5140, 0x5152, 0x514c, 0x5154, 0x5162, 0x7af8, 0x5169,
643 0x516a, 0x516e, 0x5180, 0x5182, 0x56d8, 0x518c, 0x5189, 0x518f,
644 0x5191, 0x5193, 0x5195, 0x5196, 0x51a4, 0x51a6, 0x51a2, 0x51a9,
645 0x51aa, 0x51ab, 0x51b3, 0x51b1, 0x51b2, 0x51b0, 0x51b5, 0x51bd,
646 0x51c5, 0x51c9, 0x51db, 0x51e0, 0x8655, 0x51e9, 0x51ed, 0x51f0,
647 0x51f5, 0x51fe, 0x5204, 0x520b, 0x5214, 0x520e, 0x5227, 0x522a,
648 0x522e, 0x5233, 0x5239, 0x524f, 0x5244, 0x524b, 0x524c, 0x525e,
649 0x5254, 0x526a, 0x5274, 0x5269, 0x5273, 0x527f, 0x527d, 0x528d,
650 0x5294, 0x5292, 0x5271, 0x5288, 0x5291, 0x8fa8,
651 },
652 {
653 0x8fa7, 0x52ac, 0x52ad, 0x52bc, 0x52b5, 0x52c1, 0x52cd, 0x52d7,
654 0x52de, 0x52e3, 0x52e6, 0x98ed, 0x52e0, 0x52f3, 0x52f5, 0x52f8,
655 0x52f9, 0x5306, 0x5308, 0x7538, 0x530d, 0x5310, 0x530f, 0x5315,
656 0x531a, 0x5323, 0x532f, 0x5331, 0x5333, 0x5338, 0x5340, 0x5346,
657 0x5345, 0x4e17, 0x5349, 0x534d, 0x51d6, 0x535e, 0x5369, 0x536e,
658 0x5918, 0x537b, 0x5377, 0x5382, 0x5396, 0x53a0, 0x53a6, 0x53a5,
659 0x53ae, 0x53b0, 0x53b6, 0x53c3, 0x7c12, 0x96d9, 0x53df, 0x66fc,
660 0x71ee, 0x53ee, 0x53e8, 0x53ed, 0x53fa, 0x5401, 0x543d, 0x5440,
661 0x542c, 0x542d, 0x543c, 0x542e, 0x5436, 0x5429, 0x541d, 0x544e,
662 0x548f, 0x5475, 0x548e, 0x545f, 0x5471, 0x5477, 0x5470, 0x5492,
663 0x547b, 0x5480, 0x5476, 0x5484, 0x5490, 0x5486, 0x54c7, 0x54a2,
664 0x54b8, 0x54a5, 0x54ac, 0x54c4, 0x54c8, 0x54a8,
665 },
666 {
667 0x54ab, 0x54c2, 0x54a4, 0x54be, 0x54bc, 0x54d8, 0x54e5, 0x54e6,
668 0x550f, 0x5514, 0x54fd, 0x54ee, 0x54ed, 0x54fa, 0x54e2, 0x5539,
669 0x5540, 0x5563, 0x554c, 0x552e, 0x555c, 0x5545, 0x5556, 0x5557,
670 0x5538, 0x5533, 0x555d, 0x5599, 0x5580, 0x54af, 0x558a, 0x559f,
671 0x557b, 0x557e, 0x5598, 0x559e, 0x55ae, 0x557c, 0x5583, 0x55a9,
672 0x5587, 0x55a8, 0x55da, 0x55c5, 0x55df, 0x55c4, 0x55dc, 0x55e4,
673 0x55d4, 0x5614, 0x55f7, 0x5616, 0x55fe, 0x55fd, 0x561b, 0x55f9,
674 0x564e, 0x5650, 0x71df, 0x5634, 0x5636, 0x5632, 0x5638, 0x566b,
675 0x5664, 0x562f, 0x566c, 0x566a, 0x5686, 0x5680, 0x568a, 0x56a0,
676 0x5694, 0x568f, 0x56a5, 0x56ae, 0x56b6, 0x56b4, 0x56c2, 0x56bc,
677 0x56c1, 0x56c3, 0x56c0, 0x56c8, 0x56ce, 0x56d1, 0x56d3, 0x56d7,
678 0x56ee, 0x56f9, 0x5700, 0x56ff, 0x5704, 0x5709,
679 },
680 {
681 0x5708, 0x570b, 0x570d, 0x5713, 0x5718, 0x5716, 0x55c7, 0x571c,
682 0x5726, 0x5737, 0x5738, 0x574e, 0x573b, 0x5740, 0x574f, 0x5769,
683 0x57c0, 0x5788, 0x5761, 0x577f, 0x5789, 0x5793, 0x57a0, 0x57b3,
684 0x57a4, 0x57aa, 0x57b0, 0x57c3, 0x57c6, 0x57d4, 0x57d2, 0x57d3,
685 0x580a, 0x57d6, 0x57e3, 0x580b, 0x5819, 0x581d, 0x5872, 0x5821,
686 0x5862, 0x584b, 0x5870, 0x6bc0, 0x5852, 0x583d, 0x5879, 0x5885,
687 0x58b9, 0x589f, 0x58ab, 0x58ba, 0x58de, 0x58bb, 0x58b8, 0x58ae,
688 0x58c5, 0x58d3, 0x58d1, 0x58d7, 0x58d9, 0x58d8, 0x58e5, 0x58dc,
689 0x58e4, 0x58df, 0x58ef, 0x58fa, 0x58f9, 0x58fb, 0x58fc, 0x58fd,
690 0x5902, 0x590a, 0x5910, 0x591b, 0x68a6, 0x5925, 0x592c, 0x592d,
691 0x5932, 0x5938, 0x593e, 0x7ad2, 0x5955, 0x5950, 0x594e, 0x595a,
692 0x5958, 0x5962, 0x5960, 0x5967, 0x596c, 0x5969,
693 },
694 {
695 0x5978, 0x5981, 0x599d, 0x4f5e, 0x4fab, 0x59a3, 0x59b2, 0x59c6,
696 0x59e8, 0x59dc, 0x598d, 0x59d9, 0x59da, 0x5a25, 0x5a1f, 0x5a11,
697 0x5a1c, 0x5a09, 0x5a1a, 0x5a40, 0x5a6c, 0x5a49, 0x5a35, 0x5a36,
698 0x5a62, 0x5a6a, 0x5a9a, 0x5abc, 0x5abe, 0x5acb, 0x5ac2, 0x5abd,
699 0x5ae3, 0x5ad7, 0x5ae6, 0x5ae9, 0x5ad6, 0x5afa, 0x5afb, 0x5b0c,
700 0x5b0b, 0x5b16, 0x5b32, 0x5ad0, 0x5b2a, 0x5b36, 0x5b3e, 0x5b43,
701 0x5b45, 0x5b40, 0x5b51, 0x5b55, 0x5b5a, 0x5b5b, 0x5b65, 0x5b69,
702 0x5b70, 0x5b73, 0x5b75, 0x5b78, 0x6588, 0x5b7a, 0x5b80, 0x5b83,
703 0x5ba6, 0x5bb8, 0x5bc3, 0x5bc7, 0x5bc9, 0x5bd4, 0x5bd0, 0x5be4,
704 0x5be6, 0x5be2, 0x5bde, 0x5be5, 0x5beb, 0x5bf0, 0x5bf6, 0x5bf3,
705 0x5c05, 0x5c07, 0x5c08, 0x5c0d, 0x5c13, 0x5c20, 0x5c22, 0x5c28,
706 0x5c38, 0x5c39, 0x5c41, 0x5c46, 0x5c4e, 0x5c53,
707 },
708 {
709 0x5c50, 0x5c4f, 0x5b71, 0x5c6c, 0x5c6e, 0x4e62, 0x5c76, 0x5c79,
710 0x5c8c, 0x5c91, 0x5c94, 0x599b, 0x5cab, 0x5cbb, 0x5cb6, 0x5cbc,
711 0x5cb7, 0x5cc5, 0x5cbe, 0x5cc7, 0x5cd9, 0x5ce9, 0x5cfd, 0x5cfa,
712 0x5ced, 0x5d8c, 0x5cea, 0x5d0b, 0x5d15, 0x5d17, 0x5d5c, 0x5d1f,
713 0x5d1b, 0x5d11, 0x5d14, 0x5d22, 0x5d1a, 0x5d19, 0x5d18, 0x5d4c,
714 0x5d52, 0x5d4e, 0x5d4b, 0x5d6c, 0x5d73, 0x5d76, 0x5d87, 0x5d84,
715 0x5d82, 0x5da2, 0x5d9d, 0x5dac, 0x5dae, 0x5dbd, 0x5d90, 0x5db7,
716 0x5dbc, 0x5dc9, 0x5dcd, 0x5dd3, 0x5dd2, 0x5dd6, 0x5ddb, 0x5deb,
717 0x5df2, 0x5df5, 0x5e0b, 0x5e1a, 0x5e19, 0x5e11, 0x5e1b, 0x5e36,
718 0x5e37, 0x5e44, 0x5e43, 0x5e40, 0x5e4e, 0x5e57, 0x5e54, 0x5e5f,
719 0x5e62, 0x5e64, 0x5e47, 0x5e75, 0x5e76, 0x5e7a, 0x9ebc, 0x5e7f,
720 0x5ea0, 0x5ec1, 0x5ec2, 0x5ec8, 0x5ed0, 0x5ecf,
721 },
722 {
723 0x5ed6, 0x5ee3, 0x5edd, 0x5eda, 0x5edb, 0x5ee2, 0x5ee1, 0x5ee8,
724 0x5ee9, 0x5eec, 0x5ef1, 0x5ef3, 0x5ef0, 0x5ef4, 0x5ef8, 0x5efe,
725 0x5f03, 0x5f09, 0x5f5d, 0x5f5c, 0x5f0b, 0x5f11, 0x5f16, 0x5f29,
726 0x5f2d, 0x5f38, 0x5f41, 0x5f48, 0x5f4c, 0x5f4e, 0x5f2f, 0x5f51,
727 0x5f56, 0x5f57, 0x5f59, 0x5f61, 0x5f6d, 0x5f73, 0x5f77, 0x5f83,
728 0x5f82, 0x5f7f, 0x5f8a, 0x5f88, 0x5f91, 0x5f87, 0x5f9e, 0x5f99,
729 0x5f98, 0x5fa0, 0x5fa8, 0x5fad, 0x5fbc, 0x5fd6, 0x5ffb, 0x5fe4,
730 0x5ff8, 0x5ff1, 0x5fdd, 0x60b3, 0x5fff, 0x6021, 0x6060, 0x6019,
731 0x6010, 0x6029, 0x600e, 0x6031, 0x601b, 0x6015, 0x602b, 0x6026,
732 0x600f, 0x603a, 0x605a, 0x6041, 0x606a, 0x6077, 0x605f, 0x604a,
733 0x6046, 0x604d, 0x6063, 0x6043, 0x6064, 0x6042, 0x606c, 0x606b,
734 0x6059, 0x6081, 0x608d, 0x60e7, 0x6083, 0x609a,
735 },
736 {
737 0x6084, 0x609b, 0x6096, 0x6097, 0x6092, 0x60a7, 0x608b, 0x60e1,
738 0x60b8, 0x60e0, 0x60d3, 0x60b4, 0x5ff0, 0x60bd, 0x60c6, 0x60b5,
739 0x60d8, 0x614d, 0x6115, 0x6106, 0x60f6, 0x60f7, 0x6100, 0x60f4,
740 0x60fa, 0x6103, 0x6121, 0x60fb, 0x60f1, 0x610d, 0x610e, 0x6147,
741 0x613e, 0x6128, 0x6127, 0x614a, 0x613f, 0x613c, 0x612c, 0x6134,
742 0x613d, 0x6142, 0x6144, 0x6173, 0x6177, 0x6158, 0x6159, 0x615a,
743 0x616b, 0x6174, 0x616f, 0x6165, 0x6171, 0x615f, 0x615d, 0x6153,
744 0x6175, 0x6199, 0x6196, 0x6187, 0x61ac, 0x6194, 0x619a, 0x618a,
745 0x6191, 0x61ab, 0x61ae, 0x61cc, 0x61ca, 0x61c9, 0x61f7, 0x61c8,
746 0x61c3, 0x61c6, 0x61ba, 0x61cb, 0x7f79, 0x61cd, 0x61e6, 0x61e3,
747 0x61f6, 0x61fa, 0x61f4, 0x61ff, 0x61fd, 0x61fc, 0x61fe, 0x6200,
748 0x6208, 0x6209, 0x620d, 0x620c, 0x6214, 0x621b,
749 },
750 {
751 0x621e, 0x6221, 0x622a, 0x622e, 0x6230, 0x6232, 0x6233, 0x6241,
752 0x624e, 0x625e, 0x6263, 0x625b, 0x6260, 0x6268, 0x627c, 0x6282,
753 0x6289, 0x627e, 0x6292, 0x6293, 0x6296, 0x62d4, 0x6283, 0x6294,
754 0x62d7, 0x62d1, 0x62bb, 0x62cf, 0x62ff, 0x62c6, 0x64d4, 0x62c8,
755 0x62dc, 0x62cc, 0x62ca, 0x62c2, 0x62c7, 0x629b, 0x62c9, 0x630c,
756 0x62ee, 0x62f1, 0x6327, 0x6302, 0x6308, 0x62ef, 0x62f5, 0x6350,
757 0x633e, 0x634d, 0x641c, 0x634f, 0x6396, 0x638e, 0x6380, 0x63ab,
758 0x6376, 0x63a3, 0x638f, 0x6389, 0x639f, 0x63b5, 0x636b, 0x6369,
759 0x63be, 0x63e9, 0x63c0, 0x63c6, 0x63e3, 0x63c9, 0x63d2, 0x63f6,
760 0x63c4, 0x6416, 0x6434, 0x6406, 0x6413, 0x6426, 0x6436, 0x651d,
761 0x6417, 0x6428, 0x640f, 0x6467, 0x646f, 0x6476, 0x644e, 0x652a,
762 0x6495, 0x6493, 0x64a5, 0x64a9, 0x6488, 0x64bc,
763 },
764 {
765 0x64da, 0x64d2, 0x64c5, 0x64c7, 0x64bb, 0x64d8, 0x64c2, 0x64f1,
766 0x64e7, 0x8209, 0x64e0, 0x64e1, 0x62ac, 0x64e3, 0x64ef, 0x652c,
767 0x64f6, 0x64f4, 0x64f2, 0x64fa, 0x6500, 0x64fd, 0x6518, 0x651c,
768 0x6505, 0x6524, 0x6523, 0x652b, 0x6534, 0x6535, 0x6537, 0x6536,
769 0x6538, 0x754b, 0x6548, 0x6556, 0x6555, 0x654d, 0x6558, 0x655e,
770 0x655d, 0x6572, 0x6578, 0x6582, 0x6583, 0x8b8a, 0x659b, 0x659f,
771 0x65ab, 0x65b7, 0x65c3, 0x65c6, 0x65c1, 0x65c4, 0x65cc, 0x65d2,
772 0x65db, 0x65d9, 0x65e0, 0x65e1, 0x65f1, 0x6772, 0x660a, 0x6603,
773 0x65fb, 0x6773, 0x6635, 0x6636, 0x6634, 0x661c, 0x664f, 0x6644,
774 0x6649, 0x6641, 0x665e, 0x665d, 0x6664, 0x6667, 0x6668, 0x665f,
775 0x6662, 0x6670, 0x6683, 0x6688, 0x668e, 0x6689, 0x6684, 0x6698,
776 0x669d, 0x66c1, 0x66b9, 0x66c9, 0x66be, 0x66bc,
777 },
778 {
779 0x66c4, 0x66b8, 0x66d6, 0x66da, 0x66e0, 0x663f, 0x66e6, 0x66e9,
780 0x66f0, 0x66f5, 0x66f7, 0x670f, 0x6716, 0x671e, 0x6726, 0x6727,
781 0x9738, 0x672e, 0x673f, 0x6736, 0x6741, 0x6738, 0x6737, 0x6746,
782 0x675e, 0x6760, 0x6759, 0x6763, 0x6764, 0x6789, 0x6770, 0x67a9,
783 0x677c, 0x676a, 0x678c, 0x678b, 0x67a6, 0x67a1, 0x6785, 0x67b7,
784 0x67ef, 0x67b4, 0x67ec, 0x67b3, 0x67e9, 0x67b8, 0x67e4, 0x67de,
785 0x67dd, 0x67e2, 0x67ee, 0x67b9, 0x67ce, 0x67c6, 0x67e7, 0x6a9c,
786 0x681e, 0x6846, 0x6829, 0x6840, 0x684d, 0x6832, 0x684e, 0x68b3,
787 0x682b, 0x6859, 0x6863, 0x6877, 0x687f, 0x689f, 0x688f, 0x68ad,
788 0x6894, 0x689d, 0x689b, 0x6883, 0x6aae, 0x68b9, 0x6874, 0x68b5,
789 0x68a0, 0x68ba, 0x690f, 0x688d, 0x687e, 0x6901, 0x68ca, 0x6908,
790 0x68d8, 0x6922, 0x6926, 0x68e1, 0x690c, 0x68cd,
791 },
792 {
793 0x68d4, 0x68e7, 0x68d5, 0x6936, 0x6912, 0x6904, 0x68d7, 0x68e3,
794 0x6925, 0x68f9, 0x68e0, 0x68ef, 0x6928, 0x692a, 0x691a, 0x6923,
795 0x6921, 0x68c6, 0x6979, 0x6977, 0x695c, 0x6978, 0x696b, 0x6954,
796 0x697e, 0x696e, 0x6939, 0x6974, 0x693d, 0x6959, 0x6930, 0x6961,
797 0x695e, 0x695d, 0x6981, 0x696a, 0x69b2, 0x69ae, 0x69d0, 0x69bf,
798 0x69c1, 0x69d3, 0x69be, 0x69ce, 0x5be8, 0x69ca, 0x69dd, 0x69bb,
799 0x69c3, 0x69a7, 0x6a2e, 0x6991, 0x69a0, 0x699c, 0x6995, 0x69b4,
800 0x69de, 0x69e8, 0x6a02, 0x6a1b, 0x69ff, 0x6b0a, 0x69f9, 0x69f2,
801 0x69e7, 0x6a05, 0x69b1, 0x6a1e, 0x69ed, 0x6a14, 0x69eb, 0x6a0a,
802 0x6a12, 0x6ac1, 0x6a23, 0x6a13, 0x6a44, 0x6a0c, 0x6a72, 0x6a36,
803 0x6a78, 0x6a47, 0x6a62, 0x6a59, 0x6a66, 0x6a48, 0x6a38, 0x6a22,
804 0x6a90, 0x6a8d, 0x6aa0, 0x6a84, 0x6aa2, 0x6aa3,
805 },
806 {
807 0x6a97, 0x8617, 0x6abb, 0x6ac3, 0x6ac2, 0x6ab8, 0x6ab3, 0x6aac,
808 0x6ade, 0x6ad1, 0x6adf, 0x6aaa, 0x6ada, 0x6aea, 0x6afb, 0x6b05,
809 0x8616, 0x6afa, 0x6b12, 0x6b16, 0x9b31, 0x6b1f, 0x6b38, 0x6b37,
810 0x76dc, 0x6b39, 0x98ee, 0x6b47, 0x6b43, 0x6b49, 0x6b50, 0x6b59,
811 0x6b54, 0x6b5b, 0x6b5f, 0x6b61, 0x6b78, 0x6b79, 0x6b7f, 0x6b80,
812 0x6b84, 0x6b83, 0x6b8d, 0x6b98, 0x6b95, 0x6b9e, 0x6ba4, 0x6baa,
813 0x6bab, 0x6baf, 0x6bb2, 0x6bb1, 0x6bb3, 0x6bb7, 0x6bbc, 0x6bc6,
814 0x6bcb, 0x6bd3, 0x6bdf, 0x6bec, 0x6beb, 0x6bf3, 0x6bef, 0x9ebe,
815 0x6c08, 0x6c13, 0x6c14, 0x6c1b, 0x6c24, 0x6c23, 0x6c5e, 0x6c55,
816 0x6c62, 0x6c6a, 0x6c82, 0x6c8d, 0x6c9a, 0x6c81, 0x6c9b, 0x6c7e,
817 0x6c68, 0x6c73, 0x6c92, 0x6c90, 0x6cc4, 0x6cf1, 0x6cd3, 0x6cbd,
818 0x6cd7, 0x6cc5, 0x6cdd, 0x6cae, 0x6cb1, 0x6cbe,
819 },
820 {
821 0x6cba, 0x6cdb, 0x6cef, 0x6cd9, 0x6cea, 0x6d1f, 0x884d, 0x6d36,
822 0x6d2b, 0x6d3d, 0x6d38, 0x6d19, 0x6d35, 0x6d33, 0x6d12, 0x6d0c,
823 0x6d63, 0x6d93, 0x6d64, 0x6d5a, 0x6d79, 0x6d59, 0x6d8e, 0x6d95,
824 0x6fe4, 0x6d85, 0x6df9, 0x6e15, 0x6e0a, 0x6db5, 0x6dc7, 0x6de6,
825 0x6db8, 0x6dc6, 0x6dec, 0x6dde, 0x6dcc, 0x6de8, 0x6dd2, 0x6dc5,
826 0x6dfa, 0x6dd9, 0x6de4, 0x6dd5, 0x6dea, 0x6dee, 0x6e2d, 0x6e6e,
827 0x6e2e, 0x6e19, 0x6e72, 0x6e5f, 0x6e3e, 0x6e23, 0x6e6b, 0x6e2b,
828 0x6e76, 0x6e4d, 0x6e1f, 0x6e43, 0x6e3a, 0x6e4e, 0x6e24, 0x6eff,
829 0x6e1d, 0x6e38, 0x6e82, 0x6eaa, 0x6e98, 0x6ec9, 0x6eb7, 0x6ed3,
830 0x6ebd, 0x6eaf, 0x6ec4, 0x6eb2, 0x6ed4, 0x6ed5, 0x6e8f, 0x6ea5,
831 0x6ec2, 0x6e9f, 0x6f41, 0x6f11, 0x704c, 0x6eec, 0x6ef8, 0x6efe,
832 0x6f3f, 0x6ef2, 0x6f31, 0x6eef, 0x6f32, 0x6ecc,
833 },
834 {
835 0x6f3e, 0x6f13, 0x6ef7, 0x6f86, 0x6f7a, 0x6f78, 0x6f81, 0x6f80,
836 0x6f6f, 0x6f5b, 0x6ff3, 0x6f6d, 0x6f82, 0x6f7c, 0x6f58, 0x6f8e,
837 0x6f91, 0x6fc2, 0x6f66, 0x6fb3, 0x6fa3, 0x6fa1, 0x6fa4, 0x6fb9,
838 0x6fc6, 0x6faa, 0x6fdf, 0x6fd5, 0x6fec, 0x6fd4, 0x6fd8, 0x6ff1,
839 0x6fee, 0x6fdb, 0x7009, 0x700b, 0x6ffa, 0x7011, 0x7001, 0x700f,
840 0x6ffe, 0x701b, 0x701a, 0x6f74, 0x701d, 0x7018, 0x701f, 0x7030,
841 0x703e, 0x7032, 0x7051, 0x7063, 0x7099, 0x7092, 0x70af, 0x70f1,
842 0x70ac, 0x70b8, 0x70b3, 0x70ae, 0x70df, 0x70cb, 0x70dd, 0x70d9,
843 0x7109, 0x70fd, 0x711c, 0x7119, 0x7165, 0x7155, 0x7188, 0x7166,
844 0x7162, 0x714c, 0x7156, 0x716c, 0x718f, 0x71fb, 0x7184, 0x7195,
845 0x71a8, 0x71ac, 0x71d7, 0x71b9, 0x71be, 0x71d2, 0x71c9, 0x71d4,
846 0x71ce, 0x71e0, 0x71ec, 0x71e7, 0x71f5, 0x71fc,
847 },
848 {
849 0x71f9, 0x71ff, 0x720d, 0x7210, 0x721b, 0x7228, 0x722d, 0x722c,
850 0x7230, 0x7232, 0x723b, 0x723c, 0x723f, 0x7240, 0x7246, 0x724b,
851 0x7258, 0x7274, 0x727e, 0x7282, 0x7281, 0x7287, 0x7292, 0x7296,
852 0x72a2, 0x72a7, 0x72b9, 0x72b2, 0x72c3, 0x72c6, 0x72c4, 0x72ce,
853 0x72d2, 0x72e2, 0x72e0, 0x72e1, 0x72f9, 0x72f7, 0x500f, 0x7317,
854 0x730a, 0x731c, 0x7316, 0x731d, 0x7334, 0x732f, 0x7329, 0x7325,
855 0x733e, 0x734e, 0x734f, 0x9ed8, 0x7357, 0x736a, 0x7368, 0x7370,
856 0x7378, 0x7375, 0x737b, 0x737a, 0x73c8, 0x73b3, 0x73ce, 0x73bb,
857 0x73c0, 0x73e5, 0x73ee, 0x73de, 0x74a2, 0x7405, 0x746f, 0x7425,
858 0x73f8, 0x7432, 0x743a, 0x7455, 0x743f, 0x745f, 0x7459, 0x7441,
859 0x745c, 0x7469, 0x7470, 0x7463, 0x746a, 0x7476, 0x747e, 0x748b,
860 0x749e, 0x74a7, 0x74ca, 0x74cf, 0x74d4, 0x73f1,
861 },
862 {
863 0x74e0, 0x74e3, 0x74e7, 0x74e9, 0x74ee, 0x74f2, 0x74f0, 0x74f1,
864 0x74f8, 0x74f7, 0x7504, 0x7503, 0x7505, 0x750c, 0x750e, 0x750d,
865 0x7515, 0x7513, 0x751e, 0x7526, 0x752c, 0x753c, 0x7544, 0x754d,
866 0x754a, 0x7549, 0x755b, 0x7546, 0x755a, 0x7569, 0x7564, 0x7567,
867 0x756b, 0x756d, 0x7578, 0x7576, 0x7586, 0x7587, 0x7574, 0x758a,
868 0x7589, 0x7582, 0x7594, 0x759a, 0x759d, 0x75a5, 0x75a3, 0x75c2,
869 0x75b3, 0x75c3, 0x75b5, 0x75bd, 0x75b8, 0x75bc, 0x75b1, 0x75cd,
870 0x75ca, 0x75d2, 0x75d9, 0x75e3, 0x75de, 0x75fe, 0x75ff, 0x75fc,
871 0x7601, 0x75f0, 0x75fa, 0x75f2, 0x75f3, 0x760b, 0x760d, 0x7609,
872 0x761f, 0x7627, 0x7620, 0x7621, 0x7622, 0x7624, 0x7634, 0x7630,
873 0x763b, 0x7647, 0x7648, 0x7646, 0x765c, 0x7658, 0x7661, 0x7662,
874 0x7668, 0x7669, 0x766a, 0x7667, 0x766c, 0x7670,
875 },
876 {
877 0x7672, 0x7676, 0x7678, 0x767c, 0x7680, 0x7683, 0x7688, 0x768b,
878 0x768e, 0x7696, 0x7693, 0x7699, 0x769a, 0x76b0, 0x76b4, 0x76b8,
879 0x76b9, 0x76ba, 0x76c2, 0x76cd, 0x76d6, 0x76d2, 0x76de, 0x76e1,
880 0x76e5, 0x76e7, 0x76ea, 0x862f, 0x76fb, 0x7708, 0x7707, 0x7704,
881 0x7729, 0x7724, 0x771e, 0x7725, 0x7726, 0x771b, 0x7737, 0x7738,
882 0x7747, 0x775a, 0x7768, 0x776b, 0x775b, 0x7765, 0x777f, 0x777e,
883 0x7779, 0x778e, 0x778b, 0x7791, 0x77a0, 0x779e, 0x77b0, 0x77b6,
884 0x77b9, 0x77bf, 0x77bc, 0x77bd, 0x77bb, 0x77c7, 0x77cd, 0x77d7,
885 0x77da, 0x77dc, 0x77e3, 0x77ee, 0x77fc, 0x780c, 0x7812, 0x7926,
886 0x7820, 0x792a, 0x7845, 0x788e, 0x7874, 0x7886, 0x787c, 0x789a,
887 0x788c, 0x78a3, 0x78b5, 0x78aa, 0x78af, 0x78d1, 0x78c6, 0x78cb,
888 0x78d4, 0x78be, 0x78bc, 0x78c5, 0x78ca, 0x78ec,
889 },
890 {
891 0x78e7, 0x78da, 0x78fd, 0x78f4, 0x7907, 0x7912, 0x7911, 0x7919,
892 0x792c, 0x792b, 0x7940, 0x7960, 0x7957, 0x795f, 0x795a, 0x7955,
893 0x7953, 0x797a, 0x797f, 0x798a, 0x799d, 0x79a7, 0x9f4b, 0x79aa,
894 0x79ae, 0x79b3, 0x79b9, 0x79ba, 0x79c9, 0x79d5, 0x79e7, 0x79ec,
895 0x79e1, 0x79e3, 0x7a08, 0x7a0d, 0x7a18, 0x7a19, 0x7a20, 0x7a1f,
896 0x7980, 0x7a31, 0x7a3b, 0x7a3e, 0x7a37, 0x7a43, 0x7a57, 0x7a49,
897 0x7a61, 0x7a62, 0x7a69, 0x9f9d, 0x7a70, 0x7a79, 0x7a7d, 0x7a88,
898 0x7a97, 0x7a95, 0x7a98, 0x7a96, 0x7aa9, 0x7ac8, 0x7ab0, 0x7ab6,
899 0x7ac5, 0x7ac4, 0x7abf, 0x9083, 0x7ac7, 0x7aca, 0x7acd, 0x7acf,
900 0x7ad5, 0x7ad3, 0x7ad9, 0x7ada, 0x7add, 0x7ae1, 0x7ae2, 0x7ae6,
901 0x7aed, 0x7af0, 0x7b02, 0x7b0f, 0x7b0a, 0x7b06, 0x7b33, 0x7b18,
902 0x7b19, 0x7b1e, 0x7b35, 0x7b28, 0x7b36, 0x7b50,
903 },
904 {
905 0x7b7a, 0x7b04, 0x7b4d, 0x7b0b, 0x7b4c, 0x7b45, 0x7b75, 0x7b65,
906 0x7b74, 0x7b67, 0x7b70, 0x7b71, 0x7b6c, 0x7b6e, 0x7b9d, 0x7b98,
907 0x7b9f, 0x7b8d, 0x7b9c, 0x7b9a, 0x7b8b, 0x7b92, 0x7b8f, 0x7b5d,
908 0x7b99, 0x7bcb, 0x7bc1, 0x7bcc, 0x7bcf, 0x7bb4, 0x7bc6, 0x7bdd,
909 0x7be9, 0x7c11, 0x7c14, 0x7be6, 0x7be5, 0x7c60, 0x7c00, 0x7c07,
910 0x7c13, 0x7bf3, 0x7bf7, 0x7c17, 0x7c0d, 0x7bf6, 0x7c23, 0x7c27,
911 0x7c2a, 0x7c1f, 0x7c37, 0x7c2b, 0x7c3d, 0x7c4c, 0x7c43, 0x7c54,
912 0x7c4f, 0x7c40, 0x7c50, 0x7c58, 0x7c5f, 0x7c64, 0x7c56, 0x7c65,
913 0x7c6c, 0x7c75, 0x7c83, 0x7c90, 0x7ca4, 0x7cad, 0x7ca2, 0x7cab,
914 0x7ca1, 0x7ca8, 0x7cb3, 0x7cb2, 0x7cb1, 0x7cae, 0x7cb9, 0x7cbd,
915 0x7cc0, 0x7cc5, 0x7cc2, 0x7cd8, 0x7cd2, 0x7cdc, 0x7ce2, 0x9b3b,
916 0x7cef, 0x7cf2, 0x7cf4, 0x7cf6, 0x7cfa, 0x7d06,
917 },
918 {
919 0x7d02, 0x7d1c, 0x7d15, 0x7d0a, 0x7d45, 0x7d4b, 0x7d2e, 0x7d32,
920 0x7d3f, 0x7d35, 0x7d46, 0x7d73, 0x7d56, 0x7d4e, 0x7d72, 0x7d68,
921 0x7d6e, 0x7d4f, 0x7d63, 0x7d93, 0x7d89, 0x7d5b, 0x7d8f, 0x7d7d,
922 0x7d9b, 0x7dba, 0x7dae, 0x7da3, 0x7db5, 0x7dc7, 0x7dbd, 0x7dab,
923 0x7e3d, 0x7da2, 0x7daf, 0x7ddc, 0x7db8, 0x7d9f, 0x7db0, 0x7dd8,
924 0x7ddd, 0x7de4, 0x7dde, 0x7dfb, 0x7df2, 0x7de1, 0x7e05, 0x7e0a,
925 0x7e23, 0x7e21, 0x7e12, 0x7e31, 0x7e1f, 0x7e09, 0x7e0b, 0x7e22,
926 0x7e46, 0x7e66, 0x7e3b, 0x7e35, 0x7e39, 0x7e43, 0x7e37, 0x7e32,
927 0x7e3a, 0x7e67, 0x7e5d, 0x7e56, 0x7e5e, 0x7e59, 0x7e5a, 0x7e79,
928 0x7e6a, 0x7e69, 0x7e7c, 0x7e7b, 0x7e83, 0x7dd5, 0x7e7d, 0x8fae,
929 0x7e7f, 0x7e88, 0x7e89, 0x7e8c, 0x7e92, 0x7e90, 0x7e93, 0x7e94,
930 0x7e96, 0x7e8e, 0x7e9b, 0x7e9c, 0x7f38, 0x7f3a,
931 },
932 {
933 0x7f45, 0x7f4c, 0x7f4d, 0x7f4e, 0x7f50, 0x7f51, 0x7f55, 0x7f54,
934 0x7f58, 0x7f5f, 0x7f60, 0x7f68, 0x7f69, 0x7f67, 0x7f78, 0x7f82,
935 0x7f86, 0x7f83, 0x7f88, 0x7f87, 0x7f8c, 0x7f94, 0x7f9e, 0x7f9d,
936 0x7f9a, 0x7fa3, 0x7faf, 0x7fb2, 0x7fb9, 0x7fae, 0x7fb6, 0x7fb8,
937 0x8b71, 0x7fc5, 0x7fc6, 0x7fca, 0x7fd5, 0x7fd4, 0x7fe1, 0x7fe6,
938 0x7fe9, 0x7ff3, 0x7ff9, 0x98dc, 0x8006, 0x8004, 0x800b, 0x8012,
939 0x8018, 0x8019, 0x801c, 0x8021, 0x8028, 0x803f, 0x803b, 0x804a,
940 0x8046, 0x8052, 0x8058, 0x805a, 0x805f, 0x8062, 0x8068, 0x8073,
941 0x8072, 0x8070, 0x8076, 0x8079, 0x807d, 0x807f, 0x8084, 0x8086,
942 0x8085, 0x809b, 0x8093, 0x809a, 0x80ad, 0x5190, 0x80ac, 0x80db,
943 0x80e5, 0x80d9, 0x80dd, 0x80c4, 0x80da, 0x80d6, 0x8109, 0x80ef,
944 0x80f1, 0x811b, 0x8129, 0x8123, 0x812f, 0x814b,
945 },
946 {
947 0x968b, 0x8146, 0x813e, 0x8153, 0x8151, 0x80fc, 0x8171, 0x816e,
948 0x8165, 0x8166, 0x8174, 0x8183, 0x8188, 0x818a, 0x8180, 0x8182,
949 0x81a0, 0x8195, 0x81a4, 0x81a3, 0x815f, 0x8193, 0x81a9, 0x81b0,
950 0x81b5, 0x81be, 0x81b8, 0x81bd, 0x81c0, 0x81c2, 0x81ba, 0x81c9,
951 0x81cd, 0x81d1, 0x81d9, 0x81d8, 0x81c8, 0x81da, 0x81df, 0x81e0,
952 0x81e7, 0x81fa, 0x81fb, 0x81fe, 0x8201, 0x8202, 0x8205, 0x8207,
953 0x820a, 0x820d, 0x8210, 0x8216, 0x8229, 0x822b, 0x8238, 0x8233,
954 0x8240, 0x8259, 0x8258, 0x825d, 0x825a, 0x825f, 0x8264, 0x8262,
955 0x8268, 0x826a, 0x826b, 0x822e, 0x8271, 0x8277, 0x8278, 0x827e,
956 0x828d, 0x8292, 0x82ab, 0x829f, 0x82bb, 0x82ac, 0x82e1, 0x82e3,
957 0x82df, 0x82d2, 0x82f4, 0x82f3, 0x82fa, 0x8393, 0x8303, 0x82fb,
958 0x82f9, 0x82de, 0x8306, 0x82dc, 0x8309, 0x82d9,
959 },
960 {
961 0x8335, 0x8334, 0x8316, 0x8332, 0x8331, 0x8340, 0x8339, 0x8350,
962 0x8345, 0x832f, 0x832b, 0x8317, 0x8318, 0x8385, 0x839a, 0x83aa,
963 0x839f, 0x83a2, 0x8396, 0x8323, 0x838e, 0x8387, 0x838a, 0x837c,
964 0x83b5, 0x8373, 0x8375, 0x83a0, 0x8389, 0x83a8, 0x83f4, 0x8413,
965 0x83eb, 0x83ce, 0x83fd, 0x8403, 0x83d8, 0x840b, 0x83c1, 0x83f7,
966 0x8407, 0x83e0, 0x83f2, 0x840d, 0x8422, 0x8420, 0x83bd, 0x8438,
967 0x8506, 0x83fb, 0x846d, 0x842a, 0x843c, 0x855a, 0x8484, 0x8477,
968 0x846b, 0x84ad, 0x846e, 0x8482, 0x8469, 0x8446, 0x842c, 0x846f,
969 0x8479, 0x8435, 0x84ca, 0x8462, 0x84b9, 0x84bf, 0x849f, 0x84d9,
970 0x84cd, 0x84bb, 0x84da, 0x84d0, 0x84c1, 0x84c6, 0x84d6, 0x84a1,
971 0x8521, 0x84ff, 0x84f4, 0x8517, 0x8518, 0x852c, 0x851f, 0x8515,
972 0x8514, 0x84fc, 0x8540, 0x8563, 0x8558, 0x8548,
973 },
974 {
975 0x8541, 0x8602, 0x854b, 0x8555, 0x8580, 0x85a4, 0x8588, 0x8591,
976 0x858a, 0x85a8, 0x856d, 0x8594, 0x859b, 0x85ea, 0x8587, 0x859c,
977 0x8577, 0x857e, 0x8590, 0x85c9, 0x85ba, 0x85cf, 0x85b9, 0x85d0,
978 0x85d5, 0x85dd, 0x85e5, 0x85dc, 0x85f9, 0x860a, 0x8613, 0x860b,
979 0x85fe, 0x85fa, 0x8606, 0x8622, 0x861a, 0x8630, 0x863f, 0x864d,
980 0x4e55, 0x8654, 0x865f, 0x8667, 0x8671, 0x8693, 0x86a3, 0x86a9,
981 0x86aa, 0x868b, 0x868c, 0x86b6, 0x86af, 0x86c4, 0x86c6, 0x86b0,
982 0x86c9, 0x8823, 0x86ab, 0x86d4, 0x86de, 0x86e9, 0x86ec, 0x86df,
983 0x86db, 0x86ef, 0x8712, 0x8706, 0x8708, 0x8700, 0x8703, 0x86fb,
984 0x8711, 0x8709, 0x870d, 0x86f9, 0x870a, 0x8734, 0x873f, 0x8737,
985 0x873b, 0x8725, 0x8729, 0x871a, 0x8760, 0x875f, 0x8778, 0x874c,
986 0x874e, 0x8774, 0x8757, 0x8768, 0x876e, 0x8759,
987 },
988 {
989 0x8753, 0x8763, 0x876a, 0x8805, 0x87a2, 0x879f, 0x8782, 0x87af,
990 0x87cb, 0x87bd, 0x87c0, 0x87d0, 0x96d6, 0x87ab, 0x87c4, 0x87b3,
991 0x87c7, 0x87c6, 0x87bb, 0x87ef, 0x87f2, 0x87e0, 0x880f, 0x880d,
992 0x87fe, 0x87f6, 0x87f7, 0x880e, 0x87d2, 0x8811, 0x8816, 0x8815,
993 0x8822, 0x8821, 0x8831, 0x8836, 0x8839, 0x8827, 0x883b, 0x8844,
994 0x8842, 0x8852, 0x8859, 0x885e, 0x8862, 0x886b, 0x8881, 0x887e,
995 0x889e, 0x8875, 0x887d, 0x88b5, 0x8872, 0x8882, 0x8897, 0x8892,
996 0x88ae, 0x8899, 0x88a2, 0x888d, 0x88a4, 0x88b0, 0x88bf, 0x88b1,
997 0x88c3, 0x88c4, 0x88d4, 0x88d8, 0x88d9, 0x88dd, 0x88f9, 0x8902,
998 0x88fc, 0x88f4, 0x88e8, 0x88f2, 0x8904, 0x890c, 0x890a, 0x8913,
999 0x8943, 0x891e, 0x8925, 0x892a, 0x892b, 0x8941, 0x8944, 0x893b,
1000 0x8936, 0x8938, 0x894c, 0x891d, 0x8960, 0x895e,
1001 },
1002 {
1003 0x8966, 0x8964, 0x896d, 0x896a, 0x896f, 0x8974, 0x8977, 0x897e,
1004 0x8983, 0x8988, 0x898a, 0x8993, 0x8998, 0x89a1, 0x89a9, 0x89a6,
1005 0x89ac, 0x89af, 0x89b2, 0x89ba, 0x89bd, 0x89bf, 0x89c0, 0x89da,
1006 0x89dc, 0x89dd, 0x89e7, 0x89f4, 0x89f8, 0x8a03, 0x8a16, 0x8a10,
1007 0x8a0c, 0x8a1b, 0x8a1d, 0x8a25, 0x8a36, 0x8a41, 0x8a5b, 0x8a52,
1008 0x8a46, 0x8a48, 0x8a7c, 0x8a6d, 0x8a6c, 0x8a62, 0x8a85, 0x8a82,
1009 0x8a84, 0x8aa8, 0x8aa1, 0x8a91, 0x8aa5, 0x8aa6, 0x8a9a, 0x8aa3,
1010 0x8ac4, 0x8acd, 0x8ac2, 0x8ada, 0x8aeb, 0x8af3, 0x8ae7, 0x8ae4,
1011 0x8af1, 0x8b14, 0x8ae0, 0x8ae2, 0x8af7, 0x8ade, 0x8adb, 0x8b0c,
1012 0x8b07, 0x8b1a, 0x8ae1, 0x8b16, 0x8b10, 0x8b17, 0x8b20, 0x8b33,
1013 0x97ab, 0x8b26, 0x8b2b, 0x8b3e, 0x8b28, 0x8b41, 0x8b4c, 0x8b4f,
1014 0x8b4e, 0x8b49, 0x8b56, 0x8b5b, 0x8b5a, 0x8b6b,
1015 },
1016 {
1017 0x8b5f, 0x8b6c, 0x8b6f, 0x8b74, 0x8b7d, 0x8b80, 0x8b8c, 0x8b8e,
1018 0x8b92, 0x8b93, 0x8b96, 0x8b99, 0x8b9a, 0x8c3a, 0x8c41, 0x8c3f,
1019 0x8c48, 0x8c4c, 0x8c4e, 0x8c50, 0x8c55, 0x8c62, 0x8c6c, 0x8c78,
1020 0x8c7a, 0x8c82, 0x8c89, 0x8c85, 0x8c8a, 0x8c8d, 0x8c8e, 0x8c94,
1021 0x8c7c, 0x8c98, 0x621d, 0x8cad, 0x8caa, 0x8cbd, 0x8cb2, 0x8cb3,
1022 0x8cae, 0x8cb6, 0x8cc8, 0x8cc1, 0x8ce4, 0x8ce3, 0x8cda, 0x8cfd,
1023 0x8cfa, 0x8cfb, 0x8d04, 0x8d05, 0x8d0a, 0x8d07, 0x8d0f, 0x8d0d,
1024 0x8d10, 0x9f4e, 0x8d13, 0x8ccd, 0x8d14, 0x8d16, 0x8d67, 0x8d6d,
1025 0x8d71, 0x8d73, 0x8d81, 0x8d99, 0x8dc2, 0x8dbe, 0x8dba, 0x8dcf,
1026 0x8dda, 0x8dd6, 0x8dcc, 0x8ddb, 0x8dcb, 0x8dea, 0x8deb, 0x8ddf,
1027 0x8de3, 0x8dfc, 0x8e08, 0x8e09, 0x8dff, 0x8e1d, 0x8e1e, 0x8e10,
1028 0x8e1f, 0x8e42, 0x8e35, 0x8e30, 0x8e34, 0x8e4a,
1029 },
1030 {
1031 0x8e47, 0x8e49, 0x8e4c, 0x8e50, 0x8e48, 0x8e59, 0x8e64, 0x8e60,
1032 0x8e2a, 0x8e63, 0x8e55, 0x8e76, 0x8e72, 0x8e7c, 0x8e81, 0x8e87,
1033 0x8e85, 0x8e84, 0x8e8b, 0x8e8a, 0x8e93, 0x8e91, 0x8e94, 0x8e99,
1034 0x8eaa, 0x8ea1, 0x8eac, 0x8eb0, 0x8ec6, 0x8eb1, 0x8ebe, 0x8ec5,
1035 0x8ec8, 0x8ecb, 0x8edb, 0x8ee3, 0x8efc, 0x8efb, 0x8eeb, 0x8efe,
1036 0x8f0a, 0x8f05, 0x8f15, 0x8f12, 0x8f19, 0x8f13, 0x8f1c, 0x8f1f,
1037 0x8f1b, 0x8f0c, 0x8f26, 0x8f33, 0x8f3b, 0x8f39, 0x8f45, 0x8f42,
1038 0x8f3e, 0x8f4c, 0x8f49, 0x8f46, 0x8f4e, 0x8f57, 0x8f5c, 0x8f62,
1039 0x8f63, 0x8f64, 0x8f9c, 0x8f9f, 0x8fa3, 0x8fad, 0x8faf, 0x8fb7,
1040 0x8fda, 0x8fe5, 0x8fe2, 0x8fea, 0x8fef, 0x9087, 0x8ff4, 0x9005,
1041 0x8ff9, 0x8ffa, 0x9011, 0x9015, 0x9021, 0x900d, 0x901e, 0x9016,
1042 0x900b, 0x9027, 0x9036, 0x9035, 0x9039, 0x8ff8,
1043 },
1044 {
1045 0x904f, 0x9050, 0x9051, 0x9052, 0x900e, 0x9049, 0x903e, 0x9056,
1046 0x9058, 0x905e, 0x9068, 0x906f, 0x9076, 0x96a8, 0x9072, 0x9082,
1047 0x907d, 0x9081, 0x9080, 0x908a, 0x9089, 0x908f, 0x90a8, 0x90af,
1048 0x90b1, 0x90b5, 0x90e2, 0x90e4, 0x6248, 0x90db, 0x9102, 0x9112,
1049 0x9119, 0x9132, 0x9130, 0x914a, 0x9156, 0x9158, 0x9163, 0x9165,
1050 0x9169, 0x9173, 0x9172, 0x918b, 0x9189, 0x9182, 0x91a2, 0x91ab,
1051 0x91af, 0x91aa, 0x91b5, 0x91b4, 0x91ba, 0x91c0, 0x91c1, 0x91c9,
1052 0x91cb, 0x91d0, 0x91d6, 0x91df, 0x91e1, 0x91db, 0x91fc, 0x91f5,
1053 0x91f6, 0x921e, 0x91ff, 0x9214, 0x922c, 0x9215, 0x9211, 0x925e,
1054 0x9257, 0x9245, 0x9249, 0x9264, 0x9248, 0x9295, 0x923f, 0x924b,
1055 0x9250, 0x929c, 0x9296, 0x9293, 0x929b, 0x925a, 0x92cf, 0x92b9,
1056 0x92b7, 0x92e9, 0x930f, 0x92fa, 0x9344, 0x932e,
1057 },
1058 {
1059 0x9319, 0x9322, 0x931a, 0x9323, 0x933a, 0x9335, 0x933b, 0x935c,
1060 0x9360, 0x937c, 0x936e, 0x9356, 0x93b0, 0x93ac, 0x93ad, 0x9394,
1061 0x93b9, 0x93d6, 0x93d7, 0x93e8, 0x93e5, 0x93d8, 0x93c3, 0x93dd,
1062 0x93d0, 0x93c8, 0x93e4, 0x941a, 0x9414, 0x9413, 0x9403, 0x9407,
1063 0x9410, 0x9436, 0x942b, 0x9435, 0x9421, 0x943a, 0x9441, 0x9452,
1064 0x9444, 0x945b, 0x9460, 0x9462, 0x945e, 0x946a, 0x9229, 0x9470,
1065 0x9475, 0x9477, 0x947d, 0x945a, 0x947c, 0x947e, 0x9481, 0x947f,
1066 0x9582, 0x9587, 0x958a, 0x9594, 0x9596, 0x9598, 0x9599, 0x95a0,
1067 0x95a8, 0x95a7, 0x95ad, 0x95bc, 0x95bb, 0x95b9, 0x95be, 0x95ca,
1068 0x6ff6, 0x95c3, 0x95cd, 0x95cc, 0x95d5, 0x95d4, 0x95d6, 0x95dc,
1069 0x95e1, 0x95e5, 0x95e2, 0x9621, 0x9628, 0x962e, 0x962f, 0x9642,
1070 0x964c, 0x964f, 0x964b, 0x9677, 0x965c, 0x965e,
1071 },
1072 {
1073 0x965d, 0x965f, 0x9666, 0x9672, 0x966c, 0x968d, 0x9698, 0x9695,
1074 0x9697, 0x96aa, 0x96a7, 0x96b1, 0x96b2, 0x96b0, 0x96b4, 0x96b6,
1075 0x96b8, 0x96b9, 0x96ce, 0x96cb, 0x96c9, 0x96cd, 0x894d, 0x96dc,
1076 0x970d, 0x96d5, 0x96f9, 0x9704, 0x9706, 0x9708, 0x9713, 0x970e,
1077 0x9711, 0x970f, 0x9716, 0x9719, 0x9724, 0x972a, 0x9730, 0x9739,
1078 0x973d, 0x973e, 0x9744, 0x9746, 0x9748, 0x9742, 0x9749, 0x975c,
1079 0x9760, 0x9764, 0x9766, 0x9768, 0x52d2, 0x976b, 0x9771, 0x9779,
1080 0x9785, 0x977c, 0x9781, 0x977a, 0x9786, 0x978b, 0x978f, 0x9790,
1081 0x979c, 0x97a8, 0x97a6, 0x97a3, 0x97b3, 0x97b4, 0x97c3, 0x97c6,
1082 0x97c8, 0x97cb, 0x97dc, 0x97ed, 0x9f4f, 0x97f2, 0x7adf, 0x97f6,
1083 0x97f5, 0x980f, 0x980c, 0x9838, 0x9824, 0x9821, 0x9837, 0x983d,
1084 0x9846, 0x984f, 0x984b, 0x986b, 0x986f, 0x9870,
1085 },
1086 {
1087 0x9871, 0x9874, 0x9873, 0x98aa, 0x98af, 0x98b1, 0x98b6, 0x98c4,
1088 0x98c3, 0x98c6, 0x98e9, 0x98eb, 0x9903, 0x9909, 0x9912, 0x9914,
1089 0x9918, 0x9921, 0x991d, 0x991e, 0x9924, 0x9920, 0x992c, 0x992e,
1090 0x993d, 0x993e, 0x9942, 0x9949, 0x9945, 0x9950, 0x994b, 0x9951,
1091 0x9952, 0x994c, 0x9955, 0x9997, 0x9998, 0x99a5, 0x99ad, 0x99ae,
1092 0x99bc, 0x99df, 0x99db, 0x99dd, 0x99d8, 0x99d1, 0x99ed, 0x99ee,
1093 0x99f1, 0x99f2, 0x99fb, 0x99f8, 0x9a01, 0x9a0f, 0x9a05, 0x99e2,
1094 0x9a19, 0x9a2b, 0x9a37, 0x9a45, 0x9a42, 0x9a40, 0x9a43, 0x9a3e,
1095 0x9a55, 0x9a4d, 0x9a5b, 0x9a57, 0x9a5f, 0x9a62, 0x9a65, 0x9a64,
1096 0x9a69, 0x9a6b, 0x9a6a, 0x9aad, 0x9ab0, 0x9abc, 0x9ac0, 0x9acf,
1097 0x9ad1, 0x9ad3, 0x9ad4, 0x9ade, 0x9adf, 0x9ae2, 0x9ae3, 0x9ae6,
1098 0x9aef, 0x9aeb, 0x9aee, 0x9af4, 0x9af1, 0x9af7,
1099 },
1100 {
1101 0x9afb, 0x9b06, 0x9b18, 0x9b1a, 0x9b1f, 0x9b22, 0x9b23, 0x9b25,
1102 0x9b27, 0x9b28, 0x9b29, 0x9b2a, 0x9b2e, 0x9b2f, 0x9b32, 0x9b44,
1103 0x9b43, 0x9b4f, 0x9b4d, 0x9b4e, 0x9b51, 0x9b58, 0x9b74, 0x9b93,
1104 0x9b83, 0x9b91, 0x9b96, 0x9b97, 0x9b9f, 0x9ba0, 0x9ba8, 0x9bb4,
1105 0x9bc0, 0x9bca, 0x9bb9, 0x9bc6, 0x9bcf, 0x9bd1, 0x9bd2, 0x9be3,
1106 0x9be2, 0x9be4, 0x9bd4, 0x9be1, 0x9c3a, 0x9bf2, 0x9bf1, 0x9bf0,
1107 0x9c15, 0x9c14, 0x9c09, 0x9c13, 0x9c0c, 0x9c06, 0x9c08, 0x9c12,
1108 0x9c0a, 0x9c04, 0x9c2e, 0x9c1b, 0x9c25, 0x9c24, 0x9c21, 0x9c30,
1109 0x9c47, 0x9c32, 0x9c46, 0x9c3e, 0x9c5a, 0x9c60, 0x9c67, 0x9c76,
1110 0x9c78, 0x9ce7, 0x9cec, 0x9cf0, 0x9d09, 0x9d08, 0x9ceb, 0x9d03,
1111 0x9d06, 0x9d2a, 0x9d26, 0x9daf, 0x9d23, 0x9d1f, 0x9d44, 0x9d15,
1112 0x9d12, 0x9d41, 0x9d3f, 0x9d3e, 0x9d46, 0x9d48,
1113 },
1114 {
1115 0x9d5d, 0x9d5e, 0x9d64, 0x9d51, 0x9d50, 0x9d59, 0x9d72, 0x9d89,
1116 0x9d87, 0x9dab, 0x9d6f, 0x9d7a, 0x9d9a, 0x9da4, 0x9da9, 0x9db2,
1117 0x9dc4, 0x9dc1, 0x9dbb, 0x9db8, 0x9dba, 0x9dc6, 0x9dcf, 0x9dc2,
1118 0x9dd9, 0x9dd3, 0x9df8, 0x9de6, 0x9ded, 0x9def, 0x9dfd, 0x9e1a,
1119 0x9e1b, 0x9e1e, 0x9e75, 0x9e79, 0x9e7d, 0x9e81, 0x9e88, 0x9e8b,
1120 0x9e8c, 0x9e92, 0x9e95, 0x9e91, 0x9e9d, 0x9ea5, 0x9ea9, 0x9eb8,
1121 0x9eaa, 0x9ead, 0x9761, 0x9ecc, 0x9ece, 0x9ecf, 0x9ed0, 0x9ed4,
1122 0x9edc, 0x9ede, 0x9edd, 0x9ee0, 0x9ee5, 0x9ee8, 0x9eef, 0x9ef4,
1123 0x9ef6, 0x9ef7, 0x9ef9, 0x9efb, 0x9efc, 0x9efd, 0x9f07, 0x9f08,
1124 0x76b7, 0x9f15, 0x9f21, 0x9f2c, 0x9f3e, 0x9f4a, 0x9f52, 0x9f54,
1125 0x9f63, 0x9f5f, 0x9f60, 0x9f61, 0x9f66, 0x9f67, 0x9f6c, 0x9f6a,
1126 0x9f77, 0x9f72, 0x9f76, 0x9f95, 0x9f9c, 0x9fa0,
1127 },
1128 {
1129 0x582f, 0x69c7, 0x9059, 0x7464, 0x51dc, 0x7199,
1130 },
1131 {
1132 0x3402, 0x20158,0x4efd, 0x4eff, 0x4f9a, 0x4fc9, 0x509c, 0x511e,
1133 0x51bc, 0x351f, 0x5307, 0x5361, 0x536c, 0x8a79, 0x20bb7,0x544d,
1134 0x5496, 0x549c, 0x54a9, 0x550e, 0x554a, 0x5672, 0x56e4, 0x5733,
1135 0x5734, 0xfa10, 0x5880, 0x59e4, 0x5a23, 0x5a55, 0x5bec, 0xfa11,
1136 0x37e2, 0x5eac, 0x5f34, 0x5f45, 0x57b7, 0x6017, 0xfa6b, 0x6130,
1137 0x6624, 0x66c8, 0x66d9, 0x66fa, 0x66fb, 0x6852, 0x9fc4, 0x6911,
1138 0x693b, 0x6a45, 0x6a91, 0x6adb, 0x233cc,0x233fe,0x235c4,0x6bf1,
1139 0x6ce0, 0x6d2e, 0xfa45, 0x6dbf, 0x6dca, 0x6df8, 0xfa46, 0x6f5e,
1140 0x6ff9, 0x7064, 0xfa6c, 0x242ee,0x7147, 0x71c1, 0x7200, 0x739f,
1141 0x73a8, 0x73c9, 0x73d6, 0x741b, 0x7421, 0xfa4a, 0x7426, 0x742a,
1142 0x742c, 0x7439, 0x744b, 0x3eda, 0x7575, 0x7581, 0x7772, 0x4093,
1143 0x78c8, 0x78e0, 0x7947, 0x79ae, 0x9fc6, 0x4103,
1144 },
1145 {
1146 0x9fc5, 0x79da, 0x7a1e, 0x7b7f, 0x7c31, 0x4246, 0x7d8b, 0x7fa1,
1147 0x8118, 0x813a, 0xfa6d, 0x82ae, 0x845b, 0x84dc, 0x84ec, 0x8559,
1148 0x85ce, 0x8755, 0x87ec, 0x880b, 0x88f5, 0x89d2, 0x8af6, 0x8dce,
1149 0x8fbb, 0x8ff6, 0x90dd, 0x9127, 0x912d, 0x91b2, 0x9233, 0x9288,
1150 0x9321, 0x9348, 0x9592, 0x96de, 0x9903, 0x9940, 0x9ad9, 0x9bd6,
1151 0x9dd7, 0x9eb4, 0x9eb5,
1152 },
1153 {
1154 },
1155 {
1156 },
1157 {
1158 },
1159 {
1160 0xe0c9, 0xe0ca, 0xe0cb, 0xe0cc, 0xe0cd, 0xe0ce, 0x0000, 0xe0d0,
1161 0xe0d1, 0xe0d2, 0xe0d3, 0x0000, 0x0000, 0x0000, 0x0000, 0xe0d8,
1162 0xe0d9, 0x0000, 0x0000, 0xe0dc, 0xe0dd, 0xe0de, 0xe0df, 0xe0e0,
1163 0xe0e1, 0xe0e2, 0xe0e3, 0xe0e4, 0xe0e5, 0xe0e6, 0xe0e7, 0xe0e8,
1164 0xe0e9, 0xe0ea, 0xe0eb, 0xe0ec, 0xe0ed, 0xe0ee, 0xe0ef, 0xe0f0,
1165 0x0000, 0x0000, 0x0000, 0x0000, 0x2491, 0x2492, 0x2493, 0xe0f8,
1166 0xe0f9, 0xe0fa, 0xe0fb, 0xe0fc, 0xe0fd, 0xe0fe, 0xe0ff, 0xe180,
1167 0xe181, 0xe182, 0xe183, 0xe184, 0xe185, 0xe186, 0xe187, 0xe188,
1168 0xe189, 0xe18a, 0xe18b, 0xe18c, 0xe18d, 0xe18e, 0xe18f, 0xe190,
1169 0xe191, 0xe192, 0xe193, 0xe194, 0xe195, 0xe196, 0xe197, 0xe198,
1170 0xe199, 0xe19a, 0x3299, 0xe19c,
1171 },
1172 {
1173 0xe1a7, 0xe1a8, 0xe1a9, 0xe1aa, 0xe1ab, 0xe1ac, 0xe1ad, 0x3012,
1174 0x26e8, 0xe1b0, 0xe1b1, 0xe1b2, 0x534d, 0xe1b4, 0xe1b5, 0x26ec,
1175 0x2668, 0xe1b8, 0xe1b9, 0xe1ba, 0x2693, 0x2708, 0x26f0, 0xe1be,
1176 0xe1bf, 0xe1c0, 0xe1c1, 0xe1c2, 0xe1c3, 0x24b9, 0x24c8, 0xe1c6,
1177 0xe1c7, 0xe1c8, 0xe1c9, 0xe1ca, 0xe1cb, 0xe1cc, 0xe1cd, 0xe1ce,
1178 0xe1cf, 0xe1d0, 0x260e, 0xe1d2, 0xe1d3, 0xe1d4, 0xe1d5, 0xe1d6,
1179 0xe1d7,
1180 },
1181 {
1182 0x27a1, 0x2b05, 0x2b06, 0x2b07, 0x2b2f, 0x2b2e, 0x5e74, 0x6708,
1183 0x65e5, 0x5186, 0x33a1, 0x33a5, 0x339d, 0x33a0, 0x33a4, 0xe28f,
1184 0x2488, 0x2489, 0x248a, 0x248b, 0x248c, 0x248d, 0x248e, 0x248f,
1185 0x2490, 0xe290, 0xe291, 0xe292, 0xe293, 0xe294, 0xe295, 0xe296,
1186 0xe297, 0xe298, 0xe299, 0xe29a, 0xe29b, 0xe29c, 0xe29d, 0xe29e,
1187 0xe29f, 0x3233, 0x3236, 0x3232, 0x3231, 0x3239, 0xe2a0, 0x25b6,
1188 0x25c0, 0x3016, 0x3017, 0xe2a1, 0x00b2, 0x00b3, 0xe2a4, 0xe2a5,
1189 0xe2a6, 0xe2a7, 0xe2a8, 0xe2a9, 0xe2aa, 0xe2ab, 0xe2ac, 0xe2ad,
1190 0xe2ae, 0xe2af, 0xe2b0, 0xe2b1, 0xe2b2, 0xe2b3, 0xe2b4, 0xe2b5,
1191 0xe2b6, 0xe2b7, 0xe2b8, 0xe2b9, 0xe2ba, 0xe2bb, 0xe2bc, 0xe2bd,
1192 0xe2be, 0xe2bf, 0xe2c0, 0xe2c1, 0xe2c2, 0x1f12c,0x1f12b,0xe2c3,
1193 0xe2c4, 0xe2c5, 0x213b,
1194 },
1195 {
1196 0x322a, 0x322b, 0x322c, 0x322d, 0x322e, 0x322f, 0x3230, 0x3237,
1197 0x337e, 0x337d, 0x337c, 0x337b, 0x2116, 0x2121, 0x3036, 0xe2cc,
1198 0xe2cd, 0xe2ce, 0xe2cf, 0xe2d0, 0xe2d1, 0xe2d2, 0xe2d3, 0xe2d4,
1199 0xe2d5, 0xe2d6, 0xe2d7, 0xe2d8, 0xe2d9, 0xe2da, 0xe2db, 0xe2dc,
1200 0xe2dd, 0xe2de, 0xe2df, 0xe2e0, 0xe2e1, 0xe2e2, 0x2113, 0x338f,
1201 0x3390, 0x33ca, 0x339e, 0x33a2, 0x3371, 0x0000, 0x0000, 0x00bd,
1202 0xe2e5, 0x2153, 0x2154, 0x00bc, 0x00be, 0x2155, 0x2156, 0x2157,
1203 0x2158, 0x2159, 0x215a, 0xe2e6, 0x0000, 0xe2e7, 0xe2e8, 0x2600,
1204 0x2601, 0x2602, 0x26c4, 0x2616, 0x2617, 0x26c9, 0x26ca, 0x2666,
1205 0x2665, 0x2663, 0x2660, 0x26cb, 0x2a00, 0x203c, 0x2049, 0x26c5,
1206 0x2614, 0x26c6, 0x2603, 0x26c7, 0x26a1, 0x26c8, 0x0000, 0xe2f9,
1207 0xe2fa, 0x266c, 0x260e,
1208 },
1209 {
1210 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167,
1211 0x2168, 0x2169, 0x216a, 0x216b, 0x2470, 0x2471, 0x2472, 0x2473,
1212 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, 0x247b,
1213 0x247c, 0x247d, 0x247e, 0x247f, 0x3251, 0x3252, 0x3253, 0x3254,
1214 0x1f110,0x1f111,0x1f112,0x1f113,0x1f114,0x1f115,0x1f116,0x1f117,
1215 0x1f118,0x1f119,0x1f11a,0x1f11b,0x1f11c,0x1f11d,0x1f11e,0x1f11f,
1216 0x1f120,0x1f121,0x1f122,0x1f123,0x1f124,0x1f125,0x1f126,0x1f127,
1217 0x1f128,0x1f129,0x3255, 0x3256, 0x3257, 0x3258, 0x3259, 0x325a,
1218 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
1219 0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f,
1220 0x2776, 0x2777, 0x2778, 0x2779, 0x277a, 0x277b, 0x277c, 0x277d,
1221 0x277e, 0x277f, 0x24eb, 0x24ec, 0x325b,
1222 },
1223 };
1224
1225 static const unsigned int decoder_private_conv_table[][94] = {
1226 {
1227 0x26cc, 0x26cd, 0x26ce, 0x26cf, 0x26d0, 0x26d1, 0x0000, 0x26d2,
1228 0x26d5, 0x26d3, 0x26d4, 0x0000, 0x0000, 0x0000, 0x0000, 0x1f17f,
1229 0x1f18a, 0x0000, 0x0000, 0x26d6, 0x26d7, 0x26d8, 0x26d9, 0x26da,
1230 0x26db, 0x26dc, 0x26dd, 0x26de, 0x26df, 0x26e0, 0x26e1, 0x26e2,
1231 0x3248, 0x3249, 0x324a, 0x324b, 0x324c, 0x324d, 0x324e, 0x324f,
1232 0x0000, 0x0000, 0x0000, 0x0000, 0x2491, 0x2492, 0x2493, 0x1f14a,
1233 0x1f14c,0x1f13f,0x1f146,0x1f14b,0x1f210,0x1f211,0x1f212,0x1f213,
1234 0x1f142,0x1f214,0x1f215,0x1f216,0x1f14d,0x1f131,0x1f13d,0x2b1b,
1235 0x2b24, 0x1f217,0x1f218,0x1f219,0x1f21a,0x1f21b,0x26bf, 0x1f21c,
1236 0x1f21d,0x1f21e,0x1f21f,0x1f220,0x1f221,0x1f222,0x1f223,0x1f224,
1237 0x1f225,0x1f14e,0x3299, 0x1f200,
1238 },
1239 {
1240 0x26e3, 0x26e4, 0x26e5, 0x26e6, 0x26e7, 0x2613, 0x328b, 0x3012,
1241 0x26e8, 0x3246, 0x3245, 0x26e9, 0x0fd6, 0x26ea, 0x26eb, 0x26ec,
1242 0x2668, 0x26ed, 0x26ee, 0x26ef, 0x2693, 0x2708, 0x26f0, 0x26f1,
1243 0x26f2, 0x26f3, 0x0000, 0x26f5, 0x1f157,0x24b9, 0x24c8, 0x26f6,
1244 0x1f15f,0x1f18b,0x1f18d,0x1f18c,0x1f179,0x26f7, 0x26f8, 0x26f9,
1245 0x26fa, 0x1f17b,0x260e, 0x26fb, 0x26fc, 0x26fd, 0x26fe, 0x1f17c,
1246 0x26ff,
1247 },
1248 {
1249 0x27a1, 0x2b05, 0x2b06, 0x2b07, 0x2b2f, 0x2b2e, 0x5e74, 0x6708,
1250 0x65e5, 0x5186, 0x33a1, 0x33a5, 0x339d, 0x33a0, 0x33a4, 0x1f100,
1251 0x2488, 0x2489, 0x248a, 0x248b, 0x248c, 0x248d, 0x248e, 0x248f,
1252 0x2490, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1f101,
1253 0x1f102,0x1f103,0x1f104,0x1f105,0x1f106,0x1f107,0x1f108,0x1f109,
1254 0x1f10a,0x3233, 0x3236, 0x3232, 0x3231, 0x3239, 0x3244, 0x25b6,
1255 0x25c0, 0x3016, 0x3017, 0x27d0, 0x00b2, 0x00b3, 0x1f12d,0x0000,
1256 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
1257 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
1258 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
1259 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1f12c,0x1f12b,0x3247,
1260 0x1f14f,0x1f229,0x213b,
1261 },
1262 {
1263 0x322a, 0x322b, 0x322c, 0x322d, 0x322e, 0x322f, 0x3230, 0x3237,
1264 0x337e, 0x337d, 0x337c, 0x337b, 0x2116, 0x2121, 0x3036, 0x26be,
1265 0x1f246,0x1f240,0x1f241,0x1f243,0x1f247,0x1f244,0x1f248,0x1f242,
1266 0x1f245,0x1f12a,0x1f223,0x1f225,0x1f210,0x1f213,0x1f211,0x1f230,
1267 0x1f21f,0x1f212,0x1f219,0x1f224,0x1f22f,0x1f222,0x2113, 0x338f,
1268 0x3390, 0x33ca, 0x339e, 0x33a2, 0x3371, 0x0000, 0x0000, 0x00bd,
1269 0x2189, 0x2153, 0x2154, 0x00bc, 0x00be, 0x2155, 0x2156, 0x2157,
1270 0x2158, 0x2159, 0x215a, 0x2150, 0x0000, 0x2151, 0x2152, 0x2600,
1271 0x2601, 0x2602, 0x26c4, 0x2616, 0x2617, 0x26c9, 0x26ca, 0x2666,
1272 0x2665, 0x2663, 0x2660, 0x26cb, 0x2a00, 0x203c, 0x2049, 0x26c5,
1273 0x2614, 0x26c6, 0x2603, 0x26c7, 0x26a1, 0x26c8, 0x0000, 0x269e,
1274 0x269f, 0x266c, 0x260e,
1275 },
1276 {
1277 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167,
1278 0x2168, 0x2169, 0x216a, 0x216b, 0x2470, 0x2471, 0x2472, 0x2473,
1279 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, 0x247b,
1280 0x247c, 0x247d, 0x247e, 0x247f, 0x3251, 0x3252, 0x3253, 0x3254,
1281 0x1f110,0x1f111,0x1f112,0x1f113,0x1f114,0x1f115,0x1f116,0x1f117,
1282 0x1f118,0x1f119,0x1f11a,0x1f11b,0x1f11c,0x1f11d,0x1f11e,0x1f11f,
1283 0x1f120,0x1f121,0x1f122,0x1f123,0x1f124,0x1f125,0x1f126,0x1f127,
1284 0x1f128,0x1f129,0x3255, 0x3256, 0x3257, 0x3258, 0x3259, 0x325a,
1285 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
1286 0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f,
1287 0x2776, 0x2777, 0x2778, 0x2779, 0x277a, 0x277b, 0x277c, 0x277d,
1288 0x277e, 0x277f, 0x24eb, 0x24ec, 0x325b,
1289 },
1290 };
1291
1292 #endif
0 /*****************************************************************************
1 * decoder.c : ARIB STD-B24 JIS 8bit character code decoder
2 *****************************************************************************
3 * Copyright (C) 2014 Naohiro KORIYAMA
4 *
5 * Authors: Naohiro KORIYAMA <nkoriyama@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #include <stdio.h>
23 #include <string.h>
24 #include <stdlib.h>
25 #include <stdint.h>
26
27 #include "aribb24/decoder.h"
28 #include "aribb24_private.h"
29 #include "decoder_private.h"
30 #include "convtable.h"
31 #include "decoder_macro.h"
32 #include "drcs.h"
33
34 #if 0
35 /*****************************************************************************
36 * ARIB STD-B24 VOLUME 1 Part 3 Chapter 9.3.1 Caption management data
37 *****************************************************************************/
38 typedef struct
39 {
40 } arib_caption_management_data_t;
41
42 /*****************************************************************************
43 * ARIB STD-B24 VOLUME 1 Part 3 Chapter 9.3.2 Caption statement data
44 *****************************************************************************/
45 typedef struct
46 {
47 } arib_caption_statement_data_t;
48
49 /*****************************************************************************
50 * ARIB STD-B24 VOLUME 1 Part 3 Chapter 9.2 Structure of data group
51 *****************************************************************************/
52 typedef struct
53 {
54 uint8_t i_data_group_id;
55 uint8_t i_data_group_version;
56 uint8_t i_data_group_link_number;
57 uint8_t i_last_data_group_link_number;
58 uint16_t i_data_group_size;
59
60 arib_caption_management_data_t *caption_management_data;
61 arib_caption_statement_data_t *caption_statement_data;
62 } arib_data_group_t;
63
64 #endif
65
66 /*****************************************************************************
67 * ARIB STD-B24 JIS 8bit character code decoder
68 *****************************************************************************/
69 struct arib_decoder_t
70 {
71 arib_instance_t *p_instance;
72 const unsigned char *buf;
73 size_t count;
74 char *ubuf;
75 size_t ucount;
76 int (**handle_gl)(arib_decoder_t *, int);
77 int (**handle_gl_single)(arib_decoder_t *, int);
78 int (**handle_gr)(arib_decoder_t *, int);
79 int (*handle_g0)(arib_decoder_t *, int);
80 int (*handle_g1)(arib_decoder_t *, int);
81 int (*handle_g2)(arib_decoder_t *, int);
82 int (*handle_g3)(arib_decoder_t *, int);
83 int kanji_ku;
84
85 int i_control_time;
86
87 int i_color_map;
88 int i_foreground_color;
89 int i_foreground_color_prev;
90 int i_background_color;
91 int i_foreground_alpha;
92 int i_background_alpha;
93
94 int i_planewidth;
95 int i_planeheight;
96
97 int i_width;
98 int i_height;
99 int i_left;
100 int i_top;
101
102 int i_fontwidth;
103 int i_fontwidth_cur;
104 int i_fontheight;
105 int i_fontheight_cur;
106
107 int i_horint;
108 int i_horint_cur;
109 int i_verint;
110 int i_verint_cur;
111
112 int i_charwidth;
113 int i_charheight;
114
115 int i_right;
116 int i_bottom;
117
118 int i_charleft;
119 int i_charbottom;
120
121 arib_buf_region_t *p_region;
122 bool b_need_next_region;
123 };
124
125 static void decoder_adjust_position( arib_decoder_t *decoder )
126 {
127 #if 0
128 if( decoder->i_charleft < decoder->i_left )
129 {
130 decoder->i_charleft = decoder->i_left - decoder->i_charleft;
131 decoder->i_charbottom -= ( 1 + decoder->i_charleft / decoder->i_width ) * decoder->i_charheight;
132 decoder->i_charleft = decoder->i_right - ( decoder->i_charleft % decoder->i_width );
133 decoder->i_charleft = decoder->i_left + ( decoder->i_charleft - decoder->i_left ) / decoder->i_charwidth * decoder->i_charwidth;
134 }
135 if( decoder->i_charleft >= decoder->i_right )
136 {
137 decoder->i_charleft = decoder->i_charleft - decoder->i_right;
138 decoder->i_charbottom += ( 1 + decoder->i_charleft / decoder->i_width ) * decoder->i_charheight;
139 decoder->i_charleft = decoder->i_left + ( decoder->i_charleft % decoder->i_width );
140 decoder->i_charleft = decoder->i_left + ( decoder->i_charleft - decoder->i_left ) / decoder->i_charwidth * decoder->i_charwidth;
141 }
142 #endif
143
144 decoder->b_need_next_region = true;
145 }
146
147 static int u8_uctomb_aux( unsigned char *s, unsigned int uc, int n )
148 {
149 int count;
150
151 if( uc < 0x80 )
152 {
153 count = 1;
154 }
155 else if( uc < 0x800 )
156 {
157 count = 2;
158 }
159 else if( uc < 0x10000 )
160 {
161 count = 3;
162 }
163 else if( uc < 0x110000 )
164 {
165 count = 4;
166 }
167 else
168 {
169 return -1;
170 }
171
172 if( n < count )
173 {
174 return -2;
175 }
176
177 switch( count ) /* note: code falls through cases! */
178 {
179 case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000;
180 case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800;
181 case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0;
182 case 1: s[0] = uc;
183 }
184 return count;
185 }
186
187 static int u8_uctomb( unsigned char *s, unsigned int uc, int n )
188 {
189 if( uc < 0x80 && n > 0 )
190 {
191 s[0] = uc;
192 return 1;
193 }
194 else
195 {
196 return u8_uctomb_aux( s, uc, n );
197 }
198 }
199
200 static arib_buf_region_t *prepare_new_region( arib_decoder_t *decoder,
201 char *p_start,
202 int i_veradj,
203 int i_horadj )
204 {
205 arib_buf_region_t *p_region =
206 (arib_buf_region_t*) calloc( 1, sizeof(arib_buf_region_t) );
207 if( p_region == NULL )
208 {
209 return NULL;
210 }
211 p_region->p_start = p_start;
212 p_region->i_foreground_color = decoder->i_foreground_color;
213 p_region->i_background_color = decoder->i_background_color;
214
215 p_region->i_planewidth = decoder->i_planewidth;
216 p_region->i_planeheight = decoder->i_planeheight;
217
218 p_region->i_width = decoder->i_width;
219 p_region->i_height = decoder->i_height;
220
221 p_region->i_fontwidth = decoder->i_fontwidth_cur;
222 p_region->i_fontheight = decoder->i_fontheight_cur;
223
224 p_region->i_verint = decoder->i_verint_cur;
225 p_region->i_horint = decoder->i_horint_cur;
226
227 p_region->i_charleft = decoder->i_charleft;
228 p_region->i_charbottom = decoder->i_charbottom;
229
230 p_region->i_veradj = i_veradj;
231 p_region->i_horadj = i_horadj;
232
233 p_region->p_next = NULL;
234
235 decoder->b_need_next_region = false;
236
237 return p_region;
238 }
239
240 static int decoder_push( arib_decoder_t *decoder, unsigned int uc )
241 {
242 char *p_start = decoder->ubuf;
243
244 if( decoder->p_instance->b_replace_ellipsis && uc == 0x2026 )
245 {
246 // U+2026: HORIZONTAL ELLIPSIS
247 // U+22EF: MIDLINE HORIZONTAL ELLIPSIS
248 uc = 0x22ef;
249 }
250
251 if( decoder->i_foreground_color_prev != decoder->i_foreground_color )
252 {
253 decoder->i_foreground_color_prev = decoder->i_foreground_color;
254 decoder->b_need_next_region = true;
255 }
256
257 /* Check for new paragraph/region */
258 if( decoder->i_charleft >= decoder->i_right )
259 {
260 decoder->i_charleft = decoder->i_left;
261 decoder->i_charbottom += decoder->i_charheight;
262 decoder->b_need_next_region = true;
263 }
264
265 /* Ignore making new region */
266 bool b_skip_making_new_region = false;
267 if( decoder->b_need_next_region )
268 {
269 switch( uc )
270 {
271 //case 0x2026: /* HORIZONTAL ELLIPSIS */
272 //case 0x22EF: /* MIDLINE HORIZONTAL ELLIPSIS */
273 case 0x2192: /* RIGHTWARDS ARROW */
274 case 0x3001: /* IDEOGRAPHIC COMMA */
275 case 0x3002: /* IDEOGRAPHIC FULL STOP */
276 case 0xFF0C: /* FULLWIDTH COMMA */
277 case 0xFF0E: /* FULLWIDTH FULL STOP */
278 decoder->b_need_next_region = false;
279 b_skip_making_new_region = true;
280 break;
281 default:
282 break;
283 }
284 }
285
286 /* Adjust for somme characters */
287 int i_veradj;
288 int i_horadj;
289 switch( uc )
290 {
291 case 0x2026: /* HORIZONTAL ELLIPSIS */
292 case 0x22EF: /* MIDLINE HORIZONTAL ELLIPSIS */
293 case 0x2192: /* RIGHTWARDS ARROW */
294 case 0x2212: /* MINUS SIGN */
295 case 0xFF0D: /* FULLWIDTH MINUS SIGN */
296 i_veradj = decoder->i_fontheight * 1 / 3;
297 i_horadj = 0;
298 break;
299 case 0x3000: /* IDEOGRAPHIC SPACE */
300 i_veradj = decoder->i_fontheight * 2 / 3;
301 i_horadj = 0;
302 break;
303 case 0x3001: /* IDEOGRAPHIC COMMA */
304 case 0x3002: /* IDEOGRAPHIC FULL STOP */
305 i_veradj = decoder->i_fontheight * 1 / 2;
306 i_horadj = 0;
307 break;
308 case 0xFF1C: /* FULLWIDTH LESS-THAN SIGN */
309 case 0xFF1E: /* FULLWIDTH GREATER-THAN SIGN */
310 case 0x226A: /* MUCH LESS-THAN */
311 case 0x226B: /* MUCH GREATER-THAN */
312 //case 0x300A: /* LEFT DOUBLE ANGLE BRACKET */
313 //case 0x300B: /* RIGHT DOUBLE ANGLE BRACKET */
314 i_veradj = decoder->i_fontheight * 1 / 4;
315 i_horadj = 0;
316 break;
317 case 0x300C: /* LEFT CORNER BRACKET */
318 case 0x300E: /* LEFT WHITE CORNER BRACKET */
319 i_veradj = 0;
320 i_horadj = decoder->i_fontwidth * 1 / 6;
321 break;
322 case 0x300D: /* RIGHT CORNER BRACKET */
323 case 0x300F: /* RIGHT WHITE CORNER BRACKET */
324 i_veradj = decoder->i_fontheight * 1 / 6;
325 i_horadj = 0;
326 break;
327 case 0x3063: /* HIRAGANA LETTER SMALL TU */
328 case 0x30C3: /* KATAKANA LETTER SMALL TU */
329 i_veradj = decoder->i_fontheight * 1 / 3;
330 i_horadj = 0;
331 break;
332 case 0x3041: /* HIRAGANA LETTER SMALL A */
333 case 0x30A1: /* KATAKANA LETTER SMALL A */
334 case 0x3043: /* HIRAGANA LETTER SMALL I */
335 case 0x30A3: /* KATAKANA LETTER SMALL I */
336 case 0x3045: /* HIRAGANA LETTER SMALL U */
337 case 0x30A5: /* KATAKANA LETTER SMALL U */
338 case 0x3047: /* HIRAGANA LETTER SMALL E */
339 case 0x30A7: /* KATAKANA LETTER SMALL E */
340 case 0x3049: /* HIRAGANA LETTER SMALL O */
341 case 0x30A9: /* KATAKANA LETTER SMALL O */
342 case 0x3083: /* HIRAGANA LETTER SMALL YA */
343 case 0x3085: /* HIRAGANA LETTER SMALL YU */
344 case 0x3087: /* HIRAGANA LETTER SMALL YO */
345 case 0x30E3: /* KATAKANA LETTER SMALL YA */
346 case 0x30E5: /* KATAKANA LETTER SMALL YU */
347 case 0x30E7: /* KATAKANA LETTER SMALL YO */
348 i_veradj = decoder->i_fontheight * 1 / 6;
349 i_horadj = 0;
350 break;
351 case 0x301C: /* WAVE DASH */
352 case 0x30FC: /* KATAKANA-HIRAGANA PROLONGED SOUND MARK */
353 i_veradj = decoder->i_fontheight * 1 / 3;
354 i_horadj = 0;
355 break;
356 case 0x30FB: /* KATAKANA MIDDLE DOT */
357 i_veradj = decoder->i_fontheight * 1 / 3;
358 i_horadj = decoder->i_fontwidth * 1 / 6;
359 break;
360 case 0xFF08: /* FULLWIDTH LEFT PARENTHESIS */
361 case 0xFF09: /* FULLWIDTH RIGHT PARENTHESIS */
362 i_veradj = 0;
363 i_horadj = decoder->i_fontwidth * 1 / 6;
364 break;
365 case 0xFF0C: /* FULLWIDTH COMMA */
366 case 0xFF0E: /* FULLWIDTH FULL STOP */
367 i_veradj = decoder->i_fontheight * 1 / 2;
368 i_horadj = 0;
369 break;
370 default:
371 i_veradj = 0;
372 i_horadj = 0;
373 break;
374 }
375
376 int i_cnt = u8_uctomb( (unsigned char*)decoder->ubuf, uc, decoder->ucount );
377 if( i_cnt <= 0 )
378 {
379 return 0;
380 }
381
382 decoder->ubuf += i_cnt;
383 decoder->ucount -= i_cnt;
384
385 char *p_end = decoder->ubuf;
386
387 decoder->i_charleft += decoder->i_charwidth;
388
389 arib_buf_region_t *p_region = decoder->p_region;
390 if( p_region == NULL )
391 {
392 p_region = decoder->p_region =
393 prepare_new_region( decoder, p_start, i_veradj, i_horadj );
394 if( p_region == NULL )
395 {
396 return 0;
397 }
398 }
399
400 arib_buf_region_t *p_next;
401 while( (p_next = p_region->p_next) != NULL )
402 {
403 p_region = p_next;
404 }
405
406 if( decoder->b_need_next_region )
407 {
408 p_region = p_region->p_next =
409 prepare_new_region( decoder, p_start, i_veradj, i_horadj );
410 if( p_region == NULL )
411 {
412 return 0;
413 }
414 }
415 else
416 {
417 if( p_region->i_veradj > i_veradj )
418 {
419 p_region->i_veradj = i_veradj;
420 }
421 }
422 p_region->p_end = p_end;
423
424 if( b_skip_making_new_region )
425 {
426 decoder->b_need_next_region = true;
427 }
428
429 return 1;
430 }
431
432 static int decoder_pull( arib_decoder_t *decoder, int *c )
433 {
434 if( decoder->count == 0 )
435 {
436 return 0;
437 }
438
439 *c = decoder->buf[0];
440
441 decoder->count--;
442 decoder->buf++;
443 return 1;
444 }
445
446 static int decoder_handle_drcs( arib_decoder_t *decoder, int c )
447 {
448 unsigned int uc;
449
450 uc = 0;
451 if( c < decoder->p_instance->p->i_drcs_num )
452 {
453 uc = decoder->p_instance->p->drcs_conv_table[c];
454 }
455 if( uc == 0 )
456 {
457 /* uc = 0x3000; */ /* WHITESPACE */
458 /* uc = 0x25A1; */ /* WHITE SQUARE */
459 uc = 0x3013; /* geta */
460 }
461
462 return decoder_push( decoder, uc );
463 }
464
465 static int decoder_handle_alnum( arib_decoder_t *decoder, int c )
466 {
467 unsigned int uc;
468 uc = decoder_alnum_table[c];
469 uc += 0xfee0; /* FULLWIDTH */;
470 return decoder_push( decoder, uc );
471 }
472
473 static int decoder_handle_hiragana( arib_decoder_t *decoder, int c )
474 {
475 unsigned int uc;
476 uc = decoder_hiragana_table[c];
477 return decoder_push( decoder, uc );
478 }
479
480 static int decoder_handle_katakana( arib_decoder_t *decoder, int c )
481 {
482 unsigned int uc;
483 uc = decoder_katakana_table[c];
484 return decoder_push( decoder, uc );
485 }
486
487 static int decoder_handle_kanji( arib_decoder_t *decoder, int c )
488 {
489 int ku, ten;
490 unsigned int uc;
491
492 ku = decoder->kanji_ku;
493 if( ku < 0 )
494 {
495 decoder->kanji_ku = c;
496 return 1;
497 }
498 decoder->kanji_ku = -1;
499
500 ten = c;
501
502 uc = decoder_kanji_table[ku][ten];
503 if (decoder->p_instance->b_use_private_conv && ku >= 89)
504 {
505 uc = decoder_private_conv_table[ku -89][ten];
506 }
507 if( uc == 0 )
508 {
509 return 0;
510 }
511
512 return decoder_push( decoder, uc );
513 }
514
515 static int decoder_handle_gl( arib_decoder_t *decoder, int c )
516 {
517 int (*handle)(arib_decoder_t *, int);
518
519 if( c == 0x20 || c == 0x7f )
520 {
521 c = 0x3000;
522 return decoder_push( decoder, c );
523 }
524
525 if( decoder->handle_gl_single == NULL )
526 {
527 handle = *decoder->handle_gl;
528 }
529 else
530 {
531 handle = *decoder->handle_gl_single;
532 }
533 decoder->handle_gl_single = NULL;
534
535
536 return handle( decoder, c - 0x21 );
537 }
538
539 static int decoder_handle_gr( arib_decoder_t *decoder, int c )
540 {
541 int (*handle)(arib_decoder_t *, int);
542
543 if( c == 0xa0 || c == 0xff )
544 {
545 return 0;
546 }
547
548 handle = *decoder->handle_gr;
549
550 return handle( decoder, c - 0xa1 );
551 }
552
553 static int decoder_handle_esc( arib_decoder_t *decoder )
554 {
555 int c;
556 int (**handle)(arib_decoder_t *, int);
557
558 handle = &decoder->handle_g0;
559 while( decoder_pull( decoder, &c ) != 0 )
560 {
561 switch( c )
562 {
563 case 0x20: // DRCS
564 break;
565 case 0x24:
566 case 0x28:
567 break;
568 case 0x29:
569 handle = &decoder->handle_g1;
570 break;
571 case 0x2a:
572 handle = &decoder->handle_g2;
573 break;
574 case 0x2b:
575 handle = &decoder->handle_g3;
576 break;
577 case 0x30:
578 case 0x37:
579 *handle = decoder_handle_hiragana;
580 return 1;
581 case 0x31:
582 case 0x38:
583 *handle = decoder_handle_katakana;
584 return 1;
585 case 0x39:
586 case 0x3b:
587 case 0x42:
588 *handle = decoder_handle_kanji;
589 return 1;
590 case 0x36:
591 case 0x4a:
592 *handle = decoder_handle_alnum;
593 return 1;
594 case 0x40:
595 case 0x41:
596 //case 0x42:
597 case 0x43:
598 case 0x44:
599 case 0x45:
600 case 0x46:
601 case 0x47:
602 case 0x48:
603 case 0x49:
604 //case 0x4a:
605 case 0x4b:
606 case 0x4c:
607 case 0x4d:
608 case 0x4e:
609 case 0x4f:
610 *handle = decoder_handle_drcs;
611 return 1;
612 case 0x6e: //LS2
613 decoder->handle_gl = &decoder->handle_g2;
614 return 1;
615 case 0x6f: //LS3
616 decoder->handle_gl = &decoder->handle_g3;
617 return 1;
618 case 0x70: //macro
619 return 1;
620 case 0x7c: //LS3R
621 decoder->handle_gr = &decoder->handle_g3;
622 return 1;
623 case 0x7d: //LS2R
624 decoder->handle_gr = &decoder->handle_g2;
625 return 1;
626 case 0x7e: //LS1R
627 decoder->handle_gr = &decoder->handle_g1;
628 return 1;
629 default:
630 return 0;
631 }
632 }
633 return 0;
634 }
635
636 static int decoder_handle_papf( arib_decoder_t *decoder )
637 {
638 int c;
639 int i = 0;
640 int buf[1];
641 while( decoder_pull( decoder, &c ) != 0 )
642 {
643 buf[i] = c;
644 i++;
645 if( i >= 1 )
646 {
647 break;
648 }
649 }
650 if( i >= 1 )
651 {
652 decoder->i_charleft += decoder->i_charwidth * ( buf[0] & 0x3f );
653 decoder_adjust_position( decoder );
654 }
655 return 1;
656 }
657
658 static int decoder_handle_aps( arib_decoder_t *decoder )
659 {
660 int c;
661 int i = 0;
662 int buf[2];
663 while( decoder_pull( decoder, &c ) != 0 )
664 {
665 buf[i] = c;
666 i++;
667 if( i >= 2 )
668 {
669 break;
670 }
671 }
672 if( i >= 2 )
673 {
674 decoder->i_charbottom = decoder->i_top + decoder->i_charheight * ( 1 + ( buf[0] & 0x3f ) ) - 1;
675 decoder->i_charleft = decoder->i_left + decoder->i_charwidth * ( buf[1] & 0x3f );
676 decoder_adjust_position( decoder );
677 }
678 return 1;
679 }
680
681 static int decoder_handle_c0( arib_decoder_t *decoder, int c )
682 {
683 /* ARIB STD-B24 VOLUME 1 Part 2 Chapter 7
684 * Table 7-14 Control function character set code table */
685 switch( c )
686 {
687 case 0x00: //NUL
688 case 0x07: //BEL
689 return 1;
690 case 0x08: //APB
691 decoder->i_charleft -= decoder->i_charwidth;
692 decoder_adjust_position( decoder );
693 return 1;
694 case 0x09: //APF
695 decoder->i_charleft += decoder->i_charwidth;
696 decoder_adjust_position( decoder );
697 return 1;
698 case 0x0a: //APD
699 decoder->i_charbottom += decoder->i_charheight;
700 decoder_adjust_position( decoder );
701 return 1;
702 case 0x0b: //APU
703 decoder->i_charbottom -= decoder->i_charheight;
704 decoder_adjust_position( decoder );
705 return 1;
706 case 0x0c: //CS
707 decoder->i_charleft = decoder->i_left;
708 decoder->i_charbottom = decoder->i_top + decoder->i_charheight - 1;
709 decoder_adjust_position( decoder );
710 return 1;
711 case 0x0d: //APR
712 decoder->i_charleft = decoder->i_left;
713 decoder->i_charbottom += decoder->i_charheight;
714 decoder_adjust_position( decoder );
715 return 1;
716 case 0x0e: //LS1
717 decoder->handle_gl = &decoder->handle_g1;
718 return 1;
719 case 0x0f: //LS0
720 decoder->handle_gl = &decoder->handle_g0;
721 return 1;
722 case 0x16: //PAPF
723 return decoder_handle_papf( decoder );
724 return 1;
725 case 0x18: //CAN
726 return 1;
727 case 0x19: //SS2
728 decoder->handle_gl_single = &decoder->handle_g2;
729 return 1;
730 case 0x1b: //ESC
731 return decoder_handle_esc( decoder );
732 case 0x1c: //APS
733 return decoder_handle_aps( decoder );
734 case 0x1d: //SS3
735 decoder->handle_gl_single = &decoder->handle_g3;
736 return 1;
737 case 0x1e: //RS
738 case 0x1f: //US
739 return 1;
740 default:
741 return 0;
742 }
743 }
744
745 static int decoder_handle_szx( arib_decoder_t *decoder )
746 {
747 int c;
748 while( decoder_pull( decoder, &c ) != 0 )
749 {
750 switch( c )
751 {
752 case 0x60:
753 decoder->i_fontwidth_cur = decoder->i_fontwidth / 4;
754 decoder->i_fontheight_cur = decoder->i_fontheight / 6;
755 decoder->i_horint_cur = decoder->i_horint / 4;
756 decoder->i_verint_cur = decoder->i_verint / 6;
757 decoder->i_charwidth = decoder->i_fontwidth_cur + decoder->i_horint_cur;
758 decoder->i_charheight = decoder->i_fontheight_cur + decoder->i_verint_cur;
759 decoder->b_need_next_region = true;
760 return 1;
761 case 0x41:
762 decoder->i_fontwidth_cur = decoder->i_fontwidth;
763 decoder->i_fontheight_cur = decoder->i_fontheight * 2;
764 decoder->i_horint_cur = decoder->i_horint;
765 decoder->i_verint_cur = decoder->i_verint * 2;
766 decoder->i_charwidth = decoder->i_fontwidth_cur + decoder->i_horint_cur;
767 decoder->i_charheight = decoder->i_fontheight_cur + decoder->i_verint_cur;
768 decoder->b_need_next_region = true;
769 return 1;
770 case 0x44:
771 decoder->i_fontwidth_cur = decoder->i_fontwidth * 2;
772 decoder->i_fontheight_cur = decoder->i_fontheight;
773 decoder->i_horint_cur = decoder->i_horint * 2;
774 decoder->i_verint_cur = decoder->i_verint;
775 decoder->i_charwidth = decoder->i_fontwidth_cur + decoder->i_horint_cur;
776 decoder->i_charheight = decoder->i_fontheight_cur + decoder->i_verint_cur;
777 decoder->b_need_next_region = true;
778 return 1;
779 case 0x45:
780 decoder->i_fontwidth_cur = decoder->i_fontwidth * 2;
781 decoder->i_fontheight_cur = decoder->i_fontheight * 2;
782 decoder->i_horint_cur = decoder->i_horint * 2;
783 decoder->i_verint_cur = decoder->i_verint * 2;
784 decoder->i_charwidth = decoder->i_fontwidth_cur + decoder->i_horint_cur;
785 decoder->i_charheight = decoder->i_fontheight_cur + decoder->i_verint_cur;
786 decoder->b_need_next_region = true;
787 return 1;
788 case 0x6b:
789 case 0x64:
790 decoder->i_fontwidth_cur = decoder->i_fontwidth;
791 decoder->i_fontheight_cur = decoder->i_fontheight;
792 decoder->i_horint_cur = decoder->i_horint;
793 decoder->i_verint_cur = decoder->i_verint;
794 decoder->i_charwidth = decoder->i_fontwidth_cur + decoder->i_horint_cur;
795 decoder->i_charheight = decoder->i_fontheight_cur + decoder->i_verint_cur;
796 decoder->b_need_next_region = true;
797 return 1;
798 default:
799 return 0;
800 }
801 }
802 return 0;
803 }
804
805 static int decoder_handle_col( arib_decoder_t *decoder )
806 {
807 int c;
808 while( decoder_pull( decoder, &c ) != 0 )
809 {
810 switch( c )
811 {
812 case 0x20:
813 break;
814 case 0x48:
815 decoder->i_foreground_alpha = 0xff; // fully transparent
816 return 1;
817 default:
818 return 1;
819 }
820 }
821 return 0;
822 }
823
824 static int decoder_handle_flc( arib_decoder_t *decoder )
825 {
826 int c;
827 while( decoder_pull( decoder, &c ) != 0 )
828 {
829 switch( c )
830 {
831 case 0x40:
832 case 0x47:
833 case 0x4f:
834 return 1;
835 default:
836 return 0;
837 }
838 }
839 return 0;
840 }
841
842 static int decoder_handle_cdc( arib_decoder_t *decoder )
843 {
844 int c;
845 while( decoder_pull( decoder, &c ) != 0 )
846 {
847 switch( c )
848 {
849 case 0x20:
850 break;
851 default:
852 return 1;
853 }
854 }
855 return 0;
856 }
857
858 static int decoder_handle_pol( arib_decoder_t *decoder )
859 {
860 int c;
861 while( decoder_pull( decoder, &c ) != 0 )
862 {
863 switch( c )
864 {
865 case 0x40:
866 case 0x41:
867 case 0x42:
868 return 1;
869 default:
870 return 0;
871 }
872 }
873 return 0;
874 }
875
876 static int decoder_handle_wmm( arib_decoder_t *decoder )
877 {
878 int c;
879 while( decoder_pull( decoder, &c ) != 0 )
880 {
881 switch( c )
882 {
883 case 0x40:
884 case 0x44:
885 case 0x45:
886 return 1;
887 default:
888 return 0;
889 }
890 }
891 return 0;
892 }
893
894 static int decoder_handle_macro( arib_decoder_t *decoder )
895 {
896 int c;
897 while( decoder_pull( decoder, &c ) != 0 )
898 {
899 switch( c )
900 {
901 case 0x40:
902 case 0x41:
903 case 0x4f:
904 return 1;
905 default:
906 return 0;
907 }
908 }
909 return 0;
910 }
911
912 static int decoder_handle_hlc( arib_decoder_t *decoder )
913 {
914 int c;
915 while( decoder_pull( decoder, &c ) != 0 )
916 {
917 switch( c )
918 {
919 case 0x40:
920 case 0x41:
921 case 0x42:
922 case 0x43:
923 case 0x44:
924 case 0x45:
925 case 0x46:
926 case 0x47:
927 case 0x48:
928 case 0x49:
929 case 0x4a:
930 case 0x4b:
931 case 0x4c:
932 case 0x4d:
933 case 0x4e:
934 case 0x4f:
935 return 1;
936 default:
937 return 0;
938 }
939 }
940 return 0;
941 }
942
943 static int decoder_handle_rpc( arib_decoder_t *decoder )
944 {
945 int c;
946 while( decoder_pull( decoder, &c ) != 0 )
947 {
948 switch( c )
949 {
950 default: /* 0x40 - 0x7F */
951 return 1;
952 }
953 }
954 return 0;
955 }
956
957 static int decoder_handle_csi( arib_decoder_t *decoder )
958 {
959 int idx = 0;
960 int buf[256];
961 int c;
962 while( decoder_pull( decoder, &c ) != 0 )
963 {
964 switch( c )
965 {
966 case 0x20:
967 break;
968 case 0x30:
969 case 0x31:
970 case 0x32:
971 case 0x33:
972 case 0x34:
973 case 0x35:
974 case 0x36:
975 case 0x37:
976 case 0x38:
977 case 0x39:
978 case 0x3a:
979 case 0x3b:
980 case 0x3c:
981 case 0x3d:
982 case 0x3e:
983 case 0x3f:
984 buf[idx] = c - 0x30;
985 idx++;
986 break;
987 case 0x42: //GSM
988 case 0x53: //SWF
989 case 0x54: //CCC
990 case 0x56: //SDF
991 {
992 int i_sep = 0;
993 for( int i = 0; i < idx; i++ )
994 {
995 if( buf[i] == 0x0b )
996 {
997 i_sep = i;
998 break;
999 }
1000 }
1001 int i_param1 = 0;
1002 for( int i = 0; i < i_sep; i++ )
1003 {
1004 i_param1 = i_param1 * 10;
1005 i_param1 = i_param1 + buf[i];
1006 }
1007 int i_param2 = 0;
1008 for( int i = i_sep + 1; i < idx; i++ )
1009 {
1010 i_param2 = i_param2 * 10;
1011 i_param2 = i_param2 + buf[i];
1012 }
1013 decoder->i_width = i_param1;
1014 decoder->i_height = i_param2;
1015 decoder->i_right = decoder->i_left + decoder->i_width;
1016 decoder->i_bottom = decoder->i_top + decoder->i_height;
1017 }
1018 return 1;
1019 case 0x57: //SSM
1020 case 0x58: //SHS
1021 case 0x59: //SVS
1022 case 0x5d: //GAA
1023 case 0x5e: //SRC
1024 return 1;
1025 case 0x5f: //SDP
1026 {
1027 int i_sep = 0;
1028 for( int i = 0; i < idx; i++ )
1029 {
1030 if( buf[i] == 0x0b )
1031 {
1032 i_sep = i;
1033 break;
1034 }
1035 }
1036 int i_param1 = 0;
1037 for( int i = 0; i < i_sep; i++ )
1038 {
1039 i_param1 = i_param1 * 10;
1040 i_param1 = i_param1 + buf[i];
1041 }
1042 int i_param2 = 0;
1043 for( int i = i_sep + 1; i < idx; i++ )
1044 {
1045 i_param2 = i_param2 * 10;
1046 i_param2 = i_param2 + buf[i];
1047 }
1048 decoder->i_left = i_param1;
1049 decoder->i_top = i_param2;
1050 decoder->i_right = decoder->i_left + decoder->i_width;
1051 decoder->i_bottom = decoder->i_top + decoder->i_height;
1052 }
1053 return 1;
1054 case 0x6e: //RCS
1055 return 1;
1056 case 0x61: //ACPS
1057 {
1058 int i_sep = 0;
1059 for( int i = 0; i < idx; i++ )
1060 {
1061 if( buf[i] == 0x0b )
1062 {
1063 i_sep = i;
1064 break;
1065 }
1066 }
1067 int i_param1 = 0;
1068 for( int i = 0; i < i_sep; i++ )
1069 {
1070 i_param1 = i_param1 * 10;
1071 i_param1 = i_param1 + buf[i];
1072 }
1073 int i_param2 = 0;
1074 for( int i = i_sep + 1; i < idx; i++ )
1075 {
1076 i_param2 = i_param2 * 10;
1077 i_param2 = i_param2 + buf[i];
1078 }
1079 decoder->i_charleft = i_param1;
1080 decoder->i_charbottom = i_param2;
1081 }
1082 decoder->b_need_next_region = true;
1083 return 1;
1084 case 0x62: //TCC
1085 case 0x63: //ORN
1086 case 0x64: //MDF
1087 case 0x65: //CFS
1088 case 0x66: //XCS
1089 case 0x68: //PRA
1090 case 0x69: //ACS
1091 case 0x6a: //UED
1092 case 0x6f: //SCS
1093 return 1;
1094 default:
1095 return 0;
1096 }
1097 }
1098 return 0;
1099 }
1100
1101 static int decoder_handle_time( arib_decoder_t *decoder )
1102 {
1103 int c;
1104 int i_mode = 0;
1105 while( decoder_pull( decoder, &c ) != 0 )
1106 {
1107 switch( c )
1108 {
1109 case 0x20:
1110 if( i_mode == 0 )
1111 {
1112 i_mode = 1;
1113 }
1114 break;
1115 case 0x28:
1116 i_mode = 5;
1117 break;
1118 case 0x29:
1119 i_mode = 6;
1120 break;
1121 case 0x30:
1122 case 0x31:
1123 case 0x32:
1124 case 0x33:
1125 case 0x34:
1126 case 0x35:
1127 case 0x36:
1128 case 0x37:
1129 case 0x38:
1130 case 0x39:
1131 case 0x3B:
1132 break;
1133 case 0x40:
1134 case 0x41:
1135 case 0x42:
1136 case 0x43:
1137 if( i_mode != 0 )
1138 return 1;
1139 break;
1140 default:
1141 if( i_mode == 1 && c >= 0x40 && c <= 0x7F )
1142 decoder->i_control_time += c & 0x3f;
1143 return 1;
1144 return 0;
1145 }
1146 if( i_mode == 0 )
1147 return 0;
1148 }
1149 return 0;
1150 }
1151
1152 static int decoder_handle_c1( arib_decoder_t *decoder, int c )
1153 {
1154 /* ARIB STD-B24 VOLUME 1 Part 2 Chapter 7
1155 * Table 7-14 Control function character set code table */
1156 switch( c )
1157 {
1158 case 0x80: //BKF
1159 decoder->i_foreground_color_prev = decoder->i_foreground_color;
1160 decoder->i_foreground_color = 0x000000;
1161 decoder->i_color_map |= 0x0000;
1162 return 1;
1163 case 0x81: //RDF
1164 decoder->i_foreground_color_prev = decoder->i_foreground_color;
1165 decoder->i_foreground_color = 0xFF0000;
1166 decoder->i_color_map |= 0x0001;
1167 return 1;
1168 case 0x82: //GRF
1169 decoder->i_foreground_color_prev = decoder->i_foreground_color;
1170 decoder->i_foreground_color = 0x00FF00;
1171 decoder->i_color_map |= 0x0002;
1172 return 1;
1173 case 0x83: //YLF
1174 decoder->i_foreground_color_prev = decoder->i_foreground_color;
1175 decoder->i_foreground_color = 0xFFFF00;
1176 decoder->i_color_map |= 0x0003;
1177 return 1;
1178 case 0x84: //BLF
1179 decoder->i_foreground_color_prev = decoder->i_foreground_color;
1180 decoder->i_foreground_color = 0x0000FF;
1181 decoder->i_color_map |= 0x0004;
1182 return 1;
1183 case 0x85: //MGF
1184 decoder->i_foreground_color_prev = decoder->i_foreground_color;
1185 decoder->i_foreground_color = 0xFF00FF;
1186 decoder->i_color_map |= 0x0005;
1187 return 1;
1188 case 0x86: //CNF
1189 decoder->i_foreground_color_prev = decoder->i_foreground_color;
1190 decoder->i_foreground_color = 0x00FFFF;
1191 decoder->i_color_map |= 0x0006;
1192 return 1;
1193 case 0x87: //WHF
1194 decoder->i_foreground_color_prev = decoder->i_foreground_color;
1195 decoder->i_foreground_color = 0xFFFFFF;
1196 decoder->i_color_map |= 0x0007;
1197 return 1;
1198 case 0x88: //SSZ
1199 decoder->i_fontwidth_cur = decoder->i_fontwidth / 2;
1200 decoder->i_fontheight_cur = decoder->i_fontheight / 2;
1201 decoder->i_horint_cur = decoder->i_horint / 2;
1202 decoder->i_verint_cur = decoder->i_verint / 2;
1203 decoder->i_charwidth = decoder->i_fontwidth_cur + decoder->i_horint_cur;
1204 decoder->i_charheight = decoder->i_fontheight_cur + decoder->i_verint_cur;
1205 decoder->b_need_next_region = true;
1206 return 1;
1207 case 0x89: //MSZ
1208 decoder->i_fontwidth_cur = decoder->i_fontwidth / 2;
1209 decoder->i_fontheight_cur = decoder->i_fontheight;
1210 decoder->i_horint_cur = decoder->i_horint / 2;
1211 decoder->i_verint_cur = decoder->i_verint;
1212 decoder->i_charwidth = decoder->i_fontwidth_cur + decoder->i_horint_cur;
1213 decoder->i_charheight = decoder->i_fontheight_cur + decoder->i_verint_cur;
1214 decoder->b_need_next_region = true;
1215 return 1;
1216 case 0x8a: //NSZ
1217 decoder->i_fontwidth_cur = decoder->i_fontwidth;
1218 decoder->i_fontheight_cur = decoder->i_fontheight;
1219 decoder->i_horint_cur = decoder->i_horint;
1220 decoder->i_verint_cur = decoder->i_verint;
1221 decoder->i_charwidth = decoder->i_fontwidth_cur + decoder->i_horint_cur;
1222 decoder->i_charheight = decoder->i_fontheight_cur + decoder->i_verint_cur;
1223 decoder->b_need_next_region = true;
1224 return 1;
1225 case 0x8b: //SZX
1226 return decoder_handle_szx( decoder );
1227 case 0x90: //COL
1228 return decoder_handle_col( decoder );
1229 case 0x91: //FLC
1230 return decoder_handle_flc( decoder );
1231 case 0x92: //CDC
1232 return decoder_handle_cdc( decoder );
1233 case 0x93: //POL
1234 return decoder_handle_pol( decoder );
1235 case 0x94: //WMM
1236 return decoder_handle_wmm( decoder );
1237 case 0x95: //MACRO
1238 return decoder_handle_macro( decoder );
1239 case 0x97: //HLC
1240 return decoder_handle_hlc( decoder );
1241 case 0x98: //RPC
1242 return decoder_handle_rpc( decoder );
1243 case 0x99: //SPL
1244 case 0x9a: //STL
1245 return 1;
1246 case 0x9b: //CSI
1247 return decoder_handle_csi( decoder );
1248 case 0x9d: //TIME
1249 return decoder_handle_time( decoder );
1250 default:
1251 return 0;
1252 }
1253 }
1254
1255 static int arib_decode( arib_decoder_t *decoder );
1256 static int decoder_handle_default_macro( arib_decoder_t *decoder, int c )
1257 {
1258 c=c+0x21;
1259 if( c >= 0x60 && c <= 0x6f )
1260 {
1261 const unsigned char* macro;
1262 int size;
1263 switch( c )
1264 {
1265 case 0x60:
1266 macro = decoder_default_macro_0;
1267 size = sizeof(decoder_default_macro_0);
1268 break;
1269 case 0x61:
1270 macro = decoder_default_macro_1;
1271 size = sizeof(decoder_default_macro_1);
1272 break;
1273 case 0x62:
1274 macro = decoder_default_macro_2;
1275 size = sizeof(decoder_default_macro_2);
1276 break;
1277 case 0x63:
1278 macro = decoder_default_macro_3;
1279 size = sizeof(decoder_default_macro_3);
1280 break;
1281 case 0x64:
1282 macro = decoder_default_macro_4;
1283 size = sizeof(decoder_default_macro_4);
1284 break;
1285 case 0x65:
1286 macro = decoder_default_macro_5;
1287 size = sizeof(decoder_default_macro_5);
1288 break;
1289 case 0x66:
1290 macro = decoder_default_macro_6;
1291 size = sizeof(decoder_default_macro_6);
1292 break;
1293 case 0x67:
1294 macro = decoder_default_macro_7;
1295 size = sizeof(decoder_default_macro_7);
1296 break;
1297 case 0x68:
1298 macro = decoder_default_macro_8;
1299 size = sizeof(decoder_default_macro_8);
1300 break;
1301 case 0x69:
1302 macro = decoder_default_macro_9;
1303 size = sizeof(decoder_default_macro_9);
1304 break;
1305 case 0x6a:
1306 macro = decoder_default_macro_a;
1307 size = sizeof(decoder_default_macro_a);
1308 break;
1309 case 0x6b:
1310 macro = decoder_default_macro_b;
1311 size = sizeof(decoder_default_macro_b);
1312 break;
1313 case 0x6c:
1314 macro = decoder_default_macro_c;
1315 size = sizeof(decoder_default_macro_c);
1316 break;
1317 case 0x6d:
1318 macro = decoder_default_macro_d;
1319 size = sizeof(decoder_default_macro_d);
1320 break;
1321 case 0x6e:
1322 macro = decoder_default_macro_e;
1323 size = sizeof(decoder_default_macro_e);
1324 break;
1325 case 0x6f:
1326 macro = decoder_default_macro_f;
1327 size = sizeof(decoder_default_macro_f);
1328 break;
1329 }
1330 {
1331 const unsigned char* buf = decoder->buf;
1332 size_t count = decoder->count;
1333 decoder->buf = macro;
1334 decoder->count = size;
1335 arib_decode( decoder );
1336 decoder->buf = buf;
1337 decoder->count = count;
1338 }
1339 return 1;
1340 }
1341 return 0;
1342 }
1343
1344 static void dump( arib_instance_t *p_instance,
1345 const unsigned char *start, const unsigned char *end )
1346 {
1347 arib_log( p_instance, "could not decode ARIB string:" );
1348 while( start < end )
1349 {
1350 arib_log( p_instance, "%02x ", *start++ );
1351 }
1352 arib_log( p_instance, "<- here" );
1353 }
1354
1355 static int arib_decode( arib_decoder_t *decoder )
1356 {
1357 int (*handle)(arib_decoder_t *, int);
1358 int c;
1359 /* ARIB STD-B24 VOLUME 1 Part 2 Chapter 7 Figure 7-1 Code Table */
1360 while( decoder_pull( decoder, &c ) != 0 )
1361 {
1362 if( c < 0x20 )
1363 {
1364 handle = decoder_handle_c0;
1365 }
1366 else if( c <= 0x7f )
1367 {
1368 handle = decoder_handle_gl;
1369 }
1370 else if( c <= 0xa0 )
1371 {
1372 handle = decoder_handle_c1;
1373 }
1374 else
1375 {
1376 handle = decoder_handle_gr;
1377 }
1378 if( handle( decoder, c ) == 0 )
1379 {
1380 return 0;
1381 }
1382 }
1383 return 1;
1384 }
1385
1386 void arib_initialize_decoder( arib_decoder_t* decoder )
1387 {
1388 arib_finalize_decoder( decoder );
1389 decoder->buf = NULL;
1390 decoder->count = 0;
1391 decoder->ubuf = NULL;
1392 decoder->ucount = 0;
1393 decoder->handle_gl = &decoder->handle_g0;
1394 decoder->handle_gl_single = NULL;
1395 decoder->handle_gr = &decoder->handle_g2;
1396 decoder->handle_g0 = decoder_handle_kanji;
1397 decoder->handle_g1 = decoder_handle_alnum;
1398 decoder->handle_g2 = decoder_handle_hiragana;
1399 decoder->handle_g3 = decoder_handle_katakana;
1400 decoder->kanji_ku = -1;
1401
1402 decoder->i_control_time = 0;
1403
1404 decoder->i_color_map = 0x0000;
1405 decoder->i_foreground_color = 0xFFFFFF;
1406 decoder->i_foreground_color_prev = 0xFFFFFF;
1407 decoder->i_background_color = 0x000000;
1408 decoder->i_foreground_alpha = 0x00;
1409 decoder->i_background_alpha = 0x00;
1410
1411 decoder->i_planewidth = 0;
1412 decoder->i_planeheight = 0;
1413
1414 decoder->i_width = 0;
1415 decoder->i_height = 0;
1416 decoder->i_left = 0;
1417 decoder->i_top = 0;
1418
1419 decoder->i_fontwidth = 0;
1420 decoder->i_fontwidth_cur = 0;
1421 decoder->i_fontheight = 0;
1422 decoder->i_fontheight_cur = 0;
1423
1424 decoder->i_horint = 0;
1425 decoder->i_horint_cur = 0;
1426 decoder->i_verint = 0;
1427 decoder->i_verint_cur = 0;
1428
1429 decoder->i_charwidth = 0;
1430 decoder->i_charheight = 0;
1431
1432 decoder->i_right = 0;
1433 decoder->i_bottom = 0;
1434
1435 decoder->i_charleft = 0;
1436 decoder->i_charbottom = 0;
1437
1438 memset( decoder->p_instance->p->drcs_conv_table, 0,
1439 sizeof(decoder->p_instance->p->drcs_conv_table) );
1440
1441 apply_drcs_conversion_table( decoder->p_instance );
1442
1443 decoder->p_region = NULL;
1444 decoder->b_need_next_region = true;
1445 }
1446
1447 static void arib_initialize_decoder_size_related( arib_decoder_t* decoder,
1448 int i_planewidth, int i_planeheight, int i_width, int i_height, int i_left, int i_top,
1449 int i_fontwidth, int i_fontheight, int i_horint, int i_verint
1450 )
1451 {
1452 decoder->i_planewidth = i_planewidth;
1453 decoder->i_planeheight = i_planeheight;
1454
1455 decoder->i_width = i_width;
1456 decoder->i_height = i_height;
1457 decoder->i_left = i_left;
1458 decoder->i_top = i_top;
1459
1460 decoder->i_fontwidth = decoder->i_fontwidth_cur = i_fontwidth;
1461 decoder->i_fontheight = decoder->i_fontheight_cur = i_fontheight;
1462
1463 decoder->i_horint = decoder->i_horint_cur = i_horint;
1464 decoder->i_verint = decoder->i_verint_cur = i_verint;
1465
1466 decoder->i_charwidth = decoder->i_fontwidth + decoder->i_horint;
1467 decoder->i_charheight = decoder->i_fontheight + decoder->i_verint;
1468
1469 decoder->i_right = decoder->i_left + decoder->i_width;
1470 decoder->i_bottom = decoder->i_top + decoder->i_height;
1471
1472 decoder->i_charleft = decoder->i_left;
1473 decoder->i_charbottom = decoder->i_top + decoder->i_charheight - 1;
1474 }
1475
1476 void arib_initialize_decoder_a_profile( arib_decoder_t* decoder )
1477 {
1478 arib_initialize_decoder( decoder );
1479
1480 decoder->handle_g3 = decoder_handle_default_macro;
1481
1482 arib_initialize_decoder_size_related( decoder,
1483 960, 540, 620, 480, 170, 30,
1484 36, 36, 4, 24);
1485 }
1486
1487 void arib_initialize_decoder_c_profile( arib_decoder_t* decoder )
1488 {
1489 arib_initialize_decoder( decoder );
1490
1491 decoder->handle_g0 = decoder_handle_drcs;
1492 decoder->handle_g2 = decoder_handle_kanji;
1493
1494 arib_initialize_decoder_size_related( decoder,
1495 320, 180, 300, 160, 0, 0,
1496 18, 18, 2, 12);
1497 }
1498
1499 void arib_finalize_decoder( arib_decoder_t* decoder )
1500 {
1501 arib_buf_region_t *p_region, *p_region_next;
1502 for( p_region = decoder->p_region; p_region; p_region = p_region_next )
1503 {
1504 p_region_next = p_region->p_next;
1505 free( p_region );
1506 }
1507 decoder->p_region = NULL;
1508 }
1509
1510 size_t arib_decode_buffer( arib_decoder_t* decoder,
1511 const unsigned char *buf, size_t count,
1512 char *ubuf, size_t ucount )
1513 {
1514 decoder->buf = buf;
1515 decoder->count = count;
1516 decoder->ubuf = ubuf;
1517 decoder->ucount = ucount;
1518
1519 if( arib_decode( decoder ) == 0 )
1520 {
1521 dump( decoder->p_instance, buf, decoder->buf );
1522 }
1523 size_t i_size = ucount - decoder->ucount;
1524 if ( ucount )
1525 ubuf[ i_size ] = 0;
1526 return i_size;
1527 }
1528
1529 arib_decoder_t * arib_decoder_new( arib_instance_t *p_instance )
1530 {
1531 arib_decoder_t *p_decoder = calloc( 1, sizeof( *p_decoder ) );
1532 if ( !p_decoder )
1533 return NULL;
1534 p_decoder->p_instance = p_instance;
1535 arib_log( p_decoder->p_instance, "arib decoder was created" );
1536 return p_decoder;
1537 }
1538
1539 void arib_decoder_free( arib_decoder_t *p_decoder )
1540 {
1541 arib_finalize_decoder( p_decoder );
1542 arib_log( p_decoder->p_instance, "arib decoder destroyed" );
1543 free( p_decoder );
1544 }
1545
1546 time_t arib_decoder_get_time( arib_decoder_t *p_decoder )
1547 {
1548 return (time_t) p_decoder->i_control_time * 1000000 / 10;
1549 }
1550
1551 const arib_buf_region_t * arib_decoder_get_regions( arib_decoder_t *p_decoder )
1552 {
1553 return p_decoder->p_region;
1554 }
0 /*****************************************************************************
1 * decoder_macro.h : ARIB STD-B24 decoder
2 *****************************************************************************
3 * Copyright (C) 2014 Naohiro KORIYAMA
4 *
5 * Authors: Naohiro KORIYAMA <nkoriyama@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #ifndef ARIBB24_DECODER_MACRO_H
23 #define ARIBB24_DECODER_MACRO_H 1
24
25 static const unsigned char decoder_default_macro_0[] = {
26 0x1B,0x24,0x39,0x1B,0x29,0x4A,0x1B,0x2A,0x30,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
27 };
28 static const unsigned char decoder_default_macro_1[] = {
29 0x1B,0x24,0x39,0x1B,0x29,0x31,0x1B,0x2A,0x30,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
30 };
31 static const unsigned char decoder_default_macro_2[] = {
32 0x1B,0x24,0x39,0x1B,0x29,0x20,0x40,0x1B,0x2A,0x30,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
33 };
34 static const unsigned char decoder_default_macro_3[] = {
35 0x1B,0x28,0x32,0x1B,0x29,0x34,0x1B,0x2A,0x35,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
36 };
37 static const unsigned char decoder_default_macro_4[] = {
38 0x1B,0x28,0x32,0x1B,0x29,0x33,0x1B,0x2A,0x35,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
39 };
40 static const unsigned char decoder_default_macro_5[] = {
41 0x1B,0x28,0x32,0x1B,0x29,0x20,0x40,0x1B,0x2A,0x35,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
42 };
43 static const unsigned char decoder_default_macro_6[] = {
44 0x1B,0x28,0x20,0x41,0x1B,0x29,0x20,0x42,0x1B,0x2A,0x20,0x43,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
45 };
46 static const unsigned char decoder_default_macro_7[] = {
47 0x1B,0x28,0x20,0x44,0x1B,0x29,0x20,0x45,0x1B,0x2A,0x20,0x46,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
48 };
49 static const unsigned char decoder_default_macro_8[] = {
50 0x1B,0x28,0x20,0x47,0x1B,0x29,0x20,0x48,0x1B,0x2A,0x20,0x49,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
51 };
52 static const unsigned char decoder_default_macro_9[] = {
53 0x1B,0x28,0x20,0x4A,0x1B,0x29,0x20,0x4B,0x1B,0x2A,0x20,0x4C,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
54 };
55 static const unsigned char decoder_default_macro_a[] = {
56 0x1B,0x28,0x20,0x4D,0x1B,0x29,0x20,0x4E,0x1B,0x2A,0x20,0x4F,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
57 };
58 static const unsigned char decoder_default_macro_b[] = {
59 0x1B,0x24,0x39,0x1B,0x29,0x20,0x42,0x1B,0x2A,0x30,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
60 };
61 static const unsigned char decoder_default_macro_c[] = {
62 0x1B,0x24,0x39,0x1B,0x29,0x20,0x43,0x1B,0x2A,0x30,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
63 };
64 static const unsigned char decoder_default_macro_d[] = {
65 0x1B,0x24,0x39,0x1B,0x29,0x20,0x44,0x1B,0x2A,0x30,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
66 };
67 static const unsigned char decoder_default_macro_e[] = {
68 0x1B,0x28,0x31,0x1B,0x29,0x30,0x1B,0x2A,0x4A,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
69 };
70 static const unsigned char decoder_default_macro_f[] = {
71 0x1B,0x28,0x4A,0x1B,0x29,0x32,0x1B,0x2A,0x20,0x41,0x1B,0x2B,0x20,0x70,0x0F,0x1B,0x7D
72 };
73
74 #endif
0 /*****************************************************************************
1 * decoder_private.h : ARIB STD-B24 JIS 8bit character code decoder
2 *****************************************************************************
3 * Copyright (C) 2014 François Cartegnie
4 *
5 * Authors: François Cartegnie <fcvlcdev@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #ifndef DECODER_PRIVATE_H
23 #define DECODER_PRIVATE_H 1
24
25 arib_decoder_t * arib_decoder_new( arib_instance_t *p_instance );
26 void arib_decoder_free( arib_decoder_t * );
27
28 #endif
0 /*****************************************************************************
1 * drcs.c : ARIB STD-B24 DRCS conversion tables handling
2 *****************************************************************************
3 * Copyright (C) 2014 Naohiro KORIYAMA
4 *
5 * Authors: Naohiro KORIYAMA <nkoriyama@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #include <stdio.h>
23 #include <string.h>
24 #include <stdint.h>
25 #include <stdlib.h>
26 #include <unistd.h>
27 #include <fcntl.h>
28 #include <math.h>
29 #include <ctype.h>
30 #include <sys/stat.h>
31
32 #ifdef HAVE_PNG
33 #include "png.h"
34 #endif
35 #include "aribb24/aribb24.h"
36 #include "aribb24/bits.h"
37 #include "aribb24_private.h"
38 #include "drcs.h"
39 #include "md5.h"
40
41 #if defined( _WIN32 ) || defined( __SYMBIAN32__ ) || defined( __OS2__ )
42 # define mkdir(a,b) mkdir(a)
43 #endif
44
45 #if defined( _WIN32 ) || defined( __SYMBIAN32__ ) || defined( __OS2__ )
46 # define DIR_SEP_CHAR '\\'
47 # define DIR_SEP "\\"
48 # define PATH_SEP_CHAR ';'
49 # define PATH_SEP ";"
50 #else
51 # define DIR_SEP_CHAR '/'
52 # define DIR_SEP "/"
53 # define PATH_SEP_CHAR ':'
54 # define PATH_SEP ":"
55 #endif
56
57 #if defined( _WIN32 ) || defined( __SYMBIAN32__ ) || defined( __OS2__ )
58 # define S_IRGRP 0
59 # define S_IWGRP 0
60 # define S_IXGRP 0
61 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
62 # define S_IROTH 0
63 # define S_IWOTH 0
64 # define S_IXOTH 0
65 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
66 #endif
67
68 static char* get_arib_data_dir( arib_instance_t *p_instance )
69 {
70 const char *psz_arib_base_path = p_instance->p->psz_base_path;
71 if( psz_arib_base_path == NULL )
72 {
73 return NULL;
74 }
75
76 char *psz_arib_data_dir;
77 if( asprintf( &psz_arib_data_dir, "%s"DIR_SEP"data", psz_arib_base_path ) < 0 )
78 {
79 psz_arib_data_dir = NULL;
80 }
81
82 return psz_arib_data_dir;
83 }
84
85 static bool create_arib_basedir( arib_instance_t *p_instance )
86 {
87 const char *psz_arib_base_path = p_instance->p->psz_base_path;
88 if( psz_arib_base_path == NULL )
89 {
90 return false;
91 }
92
93 struct stat st;
94 if( stat( psz_arib_base_path, &st ) )
95 {
96 if( mkdir( psz_arib_base_path, 0700) != 0 )
97 {
98 return false;
99 }
100 }
101 return true;
102 }
103
104 static bool create_arib_datadir( arib_instance_t *p_instance )
105 {
106 create_arib_basedir( p_instance );
107 char *psz_arib_data_dir = get_arib_data_dir( p_instance );
108 if( psz_arib_data_dir == NULL )
109 {
110 return false;
111 }
112
113 struct stat st;
114 if( stat( psz_arib_data_dir, &st ) )
115 {
116 if( mkdir( psz_arib_data_dir, 0700) == 0 )
117 {
118 free( psz_arib_data_dir );
119 return false;
120 }
121 }
122
123 free( psz_arib_data_dir );
124 return true;
125 }
126
127 bool apply_drcs_conversion_table( arib_instance_t *p_instance )
128 {
129 for( int i = 0; i < p_instance->p->i_drcs_num; i++ )
130 {
131 unsigned int uc = 0;
132 drcs_conversion_t *p_drcs_conv = p_instance->p->p_drcs_conv;
133 while( p_drcs_conv != NULL )
134 {
135 if( strcmp( p_drcs_conv->hash, p_instance->p->drcs_hash_table[i] ) == 0 )
136 {
137 uc = p_drcs_conv->code;
138 break;
139 }
140 p_drcs_conv = p_drcs_conv->p_next;
141 }
142 #ifdef DEBUG_ARIBSUB
143 if( uc )
144 {
145 arib_log( p_instance, "Mapping [%s=U+%04x] will be used.",
146 p_instance->p->drcs_hash_table[i], uc );
147 }
148 else
149 {
150 arib_log( p_instance, "Mapping for hash[%s] is not found.",
151 p_instance->p->drcs_hash_table[i] );
152 }
153 #endif
154 p_instance->p->drcs_conv_table[i] = uc;
155 }
156 return true;
157 }
158
159 bool load_drcs_conversion_table( arib_instance_t *p_instance )
160 {
161 if ( !create_arib_basedir( p_instance ) )
162 return false;
163 const char *psz_arib_base_path = p_instance->p->psz_base_path;
164 if( psz_arib_base_path == NULL )
165 {
166 return false;
167 }
168
169 char* psz_conv_file;
170 if( asprintf( &psz_conv_file, "%s"DIR_SEP"drcs_conv.ini", psz_arib_base_path ) < 0 )
171 {
172 psz_conv_file = NULL;
173 }
174 if( psz_conv_file == NULL )
175 {
176 return false;
177 }
178
179 FILE *fp = fopen( psz_conv_file, "r" );
180 free( psz_conv_file );
181 if( fp == NULL )
182 {
183 return false;
184 }
185
186 drcs_conversion_t *p_drcs_conv = NULL;
187 char buf[256] = { 0 };
188 while( fgets( buf, 256, fp ) != 0 )
189 {
190 if( buf[0] == ';' || buf[0] == '#' ) // comment
191 {
192 continue;
193 }
194
195 char* p_ret = strchr( buf, '\n' );
196 if( p_ret != NULL )
197 {
198 *p_ret = '\0';
199 }
200
201 char *p_eq = strchr( buf, '=' );
202 if( p_eq == NULL || p_eq - buf != 32 )
203 {
204 continue;
205 }
206 char *psz_code = strstr( buf, "U+" );
207 if( psz_code == NULL || strlen( psz_code ) < 2 || strlen( psz_code ) > 8 )
208 {
209 continue;
210 }
211
212 char hash[32 + 1];
213 strncpy( hash, buf, 32 );
214 hash[32] = '\0';
215 unsigned long code = strtoul( psz_code + 2, NULL, 16 );
216 if( code > 0x10ffff )
217 {
218 continue;
219 }
220
221 drcs_conversion_t *p_next = (drcs_conversion_t*) calloc(
222 1, sizeof(drcs_conversion_t) );
223 if( p_next == NULL )
224 {
225 continue;
226 }
227 strncpy( p_next->hash, hash, 32 );
228 p_next->hash[32] = '\0';
229 p_next->code = code;
230 if( p_drcs_conv == NULL )
231 {
232 p_instance->p->p_drcs_conv = p_next;
233 }
234 else
235 {
236 p_drcs_conv->p_next = p_next;
237 }
238 p_drcs_conv = p_next;
239 p_drcs_conv->p_next = NULL;
240 }
241
242 fclose( fp );
243 return true;
244 }
245
246 static FILE* open_image_file( arib_instance_t* p_instance, const char *psz_hash )
247 {
248 FILE* fp = NULL;
249 if ( !create_arib_datadir( p_instance ) )
250 return NULL;
251
252 char *psz_arib_data_dir = get_arib_data_dir( p_instance );
253 if( psz_arib_data_dir == NULL )
254 {
255 return NULL;
256 }
257
258 char* psz_image_file;
259 if( asprintf( &psz_image_file, "%s"DIR_SEP"%s.png", psz_arib_data_dir, psz_hash ) < 0 )
260 {
261 psz_image_file = NULL;
262 }
263 free( psz_arib_data_dir );
264 if( psz_image_file == NULL )
265 {
266 return NULL;
267 }
268
269 int flags = O_CREAT | O_EXCL | O_WRONLY;
270 #if defined( _WIN32 ) || defined( __SYMBIAN32__ ) || defined( __OS2__ )
271 flags |= O_BINARY;
272 #endif
273 int mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
274 int fd = open( psz_image_file, flags, mode );
275 if ( fd != -1 )
276 {
277 fp = fdopen( fd, "wb" );
278 if( fp == NULL )
279 {
280 arib_log( p_instance, "Failed creating image file %s", psz_image_file );
281 close( fd );
282 }
283 }
284
285 free( psz_image_file );
286 return fp;
287 }
288
289 static char* get_drcs_pattern_data_hash(
290 arib_instance_t *p_instance,
291 int i_width, int i_height,
292 int i_depth, const int8_t* p_patternData )
293 {
294 int i_bits_per_pixel = ceil( sqrt( ( i_depth ) ) );
295 struct md5_s md5;
296 InitMD5( &md5 );
297 AddMD5( &md5, p_patternData, i_width * i_height * i_bits_per_pixel / 8 );
298 EndMD5( &md5 );
299 return psz_md5_hash( &md5 );
300 }
301
302 static void save_drcs_pattern_data_image(
303 arib_instance_t *p_instance,
304 const char* psz_hash,
305 int i_width, int i_height,
306 int i_depth, const int8_t* p_patternData )
307 {
308 #ifdef HAVE_PNG
309 FILE *fp = open_image_file( p_instance, psz_hash );
310 if( fp == NULL )
311 {
312 return;
313 }
314
315 png_structp png_ptr = png_create_write_struct(
316 PNG_LIBPNG_VER_STRING, NULL, NULL, NULL );
317 if( png_ptr == NULL )
318 {
319 goto png_create_write_struct_failed;
320 }
321 png_infop info_ptr = png_create_info_struct( png_ptr );
322 if( info_ptr == NULL )
323 {
324 goto png_create_info_struct_failed;
325 }
326
327 if( setjmp( png_jmpbuf( png_ptr ) ) )
328 {
329 goto png_failure;
330 }
331
332 png_set_IHDR( png_ptr,
333 info_ptr,
334 i_width,
335 i_height,
336 1,
337 PNG_COLOR_TYPE_PALETTE,
338 PNG_INTERLACE_NONE,
339 PNG_COMPRESSION_TYPE_DEFAULT,
340 PNG_FILTER_TYPE_DEFAULT );
341
342 png_bytepp pp_image;
343 pp_image = png_malloc( png_ptr, i_height * sizeof(png_bytep) );
344 for( int j = 0; j < i_height; j++ )
345 {
346 pp_image[j] = png_malloc( png_ptr, i_width * sizeof(png_byte) );
347 }
348
349 #if defined( __ANDROID__ )
350 int i_bits_per_pixel = ceil( log( i_depth ) / log( 2 ) );
351 #else
352 int i_bits_per_pixel = ceil( log2( i_depth ) );
353 #endif
354
355 bs_t bs;
356 bs_init( &bs, p_patternData, i_width * i_height * i_bits_per_pixel / 8 );
357
358 for( int j = 0; j < i_height; j++ )
359 {
360 for( int i = 0; i < i_width; i++ )
361 {
362 uint8_t i_pxl = bs_read( &bs, i_bits_per_pixel );
363 pp_image[j][i] = i_pxl ? 1 : 0;
364 }
365 }
366
367 png_byte trans_values[1];
368 trans_values[0] = (png_byte)0;
369 png_set_tRNS( png_ptr, info_ptr, trans_values, 1, NULL );
370
371 int colors[][3] =
372 {
373 {255, 255, 255}, /* background */
374 { 0, 0, 0}, /* foreground */
375 };
376 png_color palette[2];
377 for( int i = 0; i < 2; i++ )
378 {
379 palette[i].red = colors[i][0];
380 palette[i].green = colors[i][1];
381 palette[i].blue = colors[i][2];
382 }
383 png_set_PLTE( png_ptr, info_ptr, palette, 2 );
384
385 png_init_io( png_ptr, fp );
386 png_write_info( png_ptr, info_ptr );
387 png_set_packing( png_ptr );
388 png_write_image( png_ptr, pp_image );
389 png_write_end( png_ptr, info_ptr );
390
391 for( int j = 0; j < i_height; j++ )
392 {
393 png_free( png_ptr, pp_image[j] );
394 }
395 png_free( png_ptr, pp_image );
396
397 png_failure:
398 png_create_info_struct_failed:
399 png_destroy_write_struct( &png_ptr, &info_ptr );
400 png_create_write_struct_failed:
401 fclose( fp );
402 #endif
403 }
404
405 void save_drcs_pattern(
406 arib_instance_t *p_instance,
407 int i_width, int i_height,
408 int i_depth, const int8_t* p_patternData )
409 {
410 char* psz_hash = get_drcs_pattern_data_hash( p_instance,
411 i_width, i_height, i_depth, p_patternData );
412
413 strncpy( p_instance->p->drcs_hash_table[p_instance->p->i_drcs_num], psz_hash, 32 );
414 p_instance->p->drcs_hash_table[p_instance->p->i_drcs_num][32] = '\0';
415
416 p_instance->p->i_drcs_num++;
417
418 save_drcs_pattern_data_image( p_instance, psz_hash,
419 i_width, i_height, i_depth, p_patternData );
420
421 free( psz_hash );
422 }
423
0 /*****************************************************************************
1 * drcs.h : ARIB STD-B24 JIS 8bit character code decoder
2 *****************************************************************************
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
17 *****************************************************************************/
18
19 #ifndef DRCS_PRIVATE_H
20 #define DRCS_PRIVATE_H 1
21
22 #include <stdint.h>
23
24 typedef struct drcs_conversion_s
25 {
26 char hash[32+1];
27 unsigned int code;
28
29 struct drcs_conversion_s *p_next;
30 } drcs_conversion_t ;
31
32
33 //#define ARIBSUB_GEN_DRCS_DATA
34 #ifdef ARIBSUB_GEN_DRCS_DATA
35 typedef struct drcs_geometric_data_s
36 {
37 int8_t i_regionX;
38 int8_t i_regionY;
39 int16_t i_geometricData_length;
40
41 int8_t *p_geometricData;
42 } drcs_geometric_data_t;
43
44 typedef struct drcs_pattern_data_s
45 {
46 int8_t i_depth;
47 int8_t i_width;
48 int8_t i_height;
49
50 int8_t *p_patternData;
51 } drcs_pattern_data_t;
52
53 typedef struct drcs_font_data_s
54 {
55 int8_t i_fontId;
56 int8_t i_mode;
57
58 drcs_pattern_data_t *p_drcs_pattern_data;
59 drcs_geometric_data_t *p_drcs_geometric_data;
60 } drcs_font_data_t;
61
62 typedef struct drc_code_s
63 {
64 int16_t i_CharacterCode;
65 int8_t i_NumberOfFont;
66 drcs_font_data_t *p_drcs_font_data;
67 } drcs_code_t;
68
69 typedef struct drcs_data_s
70 {
71 int8_t i_NumberOfCode;
72
73 drcs_code_t *p_drcs_code;
74 } drcs_data_t;
75 #endif //ARIBSUB_GEN_DRCS_DATA
76
77 bool apply_drcs_conversion_table( arib_instance_t * );
78 bool load_drcs_conversion_table( arib_instance_t * );
79 void save_drcs_pattern( arib_instance_t *, int, int, int, const int8_t* );
80
81 #endif
0 /*****************************************************************************
1 * md5.c: not so strong MD5 hashing
2 *****************************************************************************
3 * Copyright (C) 1995,1996,1998,1999,2001,2002,
4 * 2003 Free Software Foundation, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
20
21 /* md5.c - MD5 Message-Digest Algorithm
22 *
23 * According to the definition of MD5 in RFC 1321 from April 1992.
24 * NOTE: This is *not* the same file as the one from glibc.
25 * Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
26 * heavily modified for GnuPG by Werner Koch <wk@gnupg.org>
27 */
28
29 /* Test values:
30 * "" D4 1D 8C D9 8F 00 B2 04 E9 80 09 98 EC F8 42 7E
31 * "a" 0C C1 75 B9 C0 F1 B6 A8 31 C3 99 E2 69 77 26 61
32 * "abc 90 01 50 98 3C D2 4F B0 D6 96 3F 7D 28 E1 7F 72
33 * "message digest" F9 6B 69 7D 7C B7 93 8D 52 5A 2F 31 AA F1 61 D0
34 */
35
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <string.h>
39
40 #include "md5.h"
41
42 typedef uint32_t u32;
43 typedef uint8_t byte;
44 #define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
45
46 typedef struct md5_s MD5_CONTEXT;
47
48
49 static void
50 md5_init( void *context )
51 {
52 MD5_CONTEXT *ctx = context;
53
54 ctx->A = 0x67452301;
55 ctx->B = 0xefcdab89;
56 ctx->C = 0x98badcfe;
57 ctx->D = 0x10325476;
58
59 ctx->nblocks = 0;
60 ctx->count = 0;
61 }
62
63
64 /* These are the four functions used in the four steps of the MD5 algorithm
65 and defined in the RFC 1321. The first function is a little bit optimized
66 (as found in Colin Plumbs public domain implementation). */
67 /* #define FF(b, c, d) ((b & c) | (~b & d)) */
68 #define FF(b, c, d) (d ^ (b & (c ^ d)))
69 #define FG(b, c, d) FF (d, b, c)
70 #define FH(b, c, d) (b ^ c ^ d)
71 #define FI(b, c, d) (c ^ (b | ~d))
72
73
74 /****************
75 * transform n*64 bytes
76 */
77 static void
78 transform ( MD5_CONTEXT *ctx, const unsigned char *data )
79 {
80 u32 correct_words[16];
81 register u32 A = ctx->A;
82 register u32 B = ctx->B;
83 register u32 C = ctx->C;
84 register u32 D = ctx->D;
85 u32 *cwp = correct_words;
86
87 #ifdef WORDS_BIGENDIAN
88 {
89 int i;
90 byte *p2, *p1;
91 for(i=0, p1=data, p2=(byte*)correct_words; i < 16; i++, p2 += 4 )
92 {
93 p2[3] = *p1++;
94 p2[2] = *p1++;
95 p2[1] = *p1++;
96 p2[0] = *p1++;
97 }
98 }
99 #else
100 memcpy( correct_words, data, 64 );
101 #endif
102
103
104 #define OP(a, b, c, d, s, T) \
105 do \
106 { \
107 a += FF (b, c, d) + (*cwp++) + T; \
108 a = rol(a, s); \
109 a += b; \
110 } \
111 while (0)
112
113 /* Before we start, one word about the strange constants.
114 They are defined in RFC 1321 as
115
116 T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
117 */
118
119 /* Round 1. */
120 OP (A, B, C, D, 7, 0xd76aa478);
121 OP (D, A, B, C, 12, 0xe8c7b756);
122 OP (C, D, A, B, 17, 0x242070db);
123 OP (B, C, D, A, 22, 0xc1bdceee);
124 OP (A, B, C, D, 7, 0xf57c0faf);
125 OP (D, A, B, C, 12, 0x4787c62a);
126 OP (C, D, A, B, 17, 0xa8304613);
127 OP (B, C, D, A, 22, 0xfd469501);
128 OP (A, B, C, D, 7, 0x698098d8);
129 OP (D, A, B, C, 12, 0x8b44f7af);
130 OP (C, D, A, B, 17, 0xffff5bb1);
131 OP (B, C, D, A, 22, 0x895cd7be);
132 OP (A, B, C, D, 7, 0x6b901122);
133 OP (D, A, B, C, 12, 0xfd987193);
134 OP (C, D, A, B, 17, 0xa679438e);
135 OP (B, C, D, A, 22, 0x49b40821);
136
137 #undef OP
138 #define OP(f, a, b, c, d, k, s, T) \
139 do \
140 { \
141 a += f (b, c, d) + correct_words[k] + T; \
142 a = rol(a, s); \
143 a += b; \
144 } \
145 while (0)
146
147 /* Round 2. */
148 OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
149 OP (FG, D, A, B, C, 6, 9, 0xc040b340);
150 OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
151 OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
152 OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
153 OP (FG, D, A, B, C, 10, 9, 0x02441453);
154 OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
155 OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
156 OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
157 OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
158 OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
159 OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
160 OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
161 OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
162 OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
163 OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
164
165 /* Round 3. */
166 OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
167 OP (FH, D, A, B, C, 8, 11, 0x8771f681);
168 OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
169 OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
170 OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
171 OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
172 OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
173 OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
174 OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
175 OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
176 OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
177 OP (FH, B, C, D, A, 6, 23, 0x04881d05);
178 OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
179 OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
180 OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
181 OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
182
183 /* Round 4. */
184 OP (FI, A, B, C, D, 0, 6, 0xf4292244);
185 OP (FI, D, A, B, C, 7, 10, 0x432aff97);
186 OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
187 OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
188 OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
189 OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
190 OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
191 OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
192 OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
193 OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
194 OP (FI, C, D, A, B, 6, 15, 0xa3014314);
195 OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
196 OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
197 OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
198 OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
199 OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
200
201 /* Put checksum in context given as argument. */
202 ctx->A += A;
203 ctx->B += B;
204 ctx->C += C;
205 ctx->D += D;
206 }
207
208
209
210 /* The routine updates the message-digest context to
211 * account for the presence of each of the characters inBuf[0..inLen-1]
212 * in the message whose digest is being computed.
213 */
214 static void
215 md5_write( void *context, const void *inbuf_arg , size_t inlen)
216 {
217 const unsigned char *inbuf = inbuf_arg;
218 MD5_CONTEXT *hd = context;
219
220 if( hd->count == 64 ) /* flush the buffer */
221 {
222 transform( hd, hd->buf );
223 hd->count = 0;
224 hd->nblocks++;
225 }
226 if( !inbuf )
227 return;
228
229 if( hd->count )
230 {
231 for( ; inlen && hd->count < 64; inlen-- )
232 hd->buf[hd->count++] = *inbuf++;
233 md5_write( hd, NULL, 0 );
234 if( !inlen )
235 return;
236 }
237
238 while( inlen >= 64 )
239 {
240 transform( hd, inbuf );
241 hd->count = 0;
242 hd->nblocks++;
243 inlen -= 64;
244 inbuf += 64;
245 }
246 for( ; inlen && hd->count < 64; inlen-- )
247 hd->buf[hd->count++] = *inbuf++;
248
249 }
250
251
252
253 /* The routine final terminates the message-digest computation and
254 * ends with the desired message digest in mdContext->digest[0...15].
255 * The handle is prepared for a new MD5 cycle.
256 * Returns 16 bytes representing the digest.
257 */
258
259 static void
260 md5_final( void *context)
261 {
262 MD5_CONTEXT *hd = context;
263 u32 t, msb, lsb;
264 byte *p;
265
266 md5_write(hd, NULL, 0); /* flush */;
267
268 t = hd->nblocks;
269 /* multiply by 64 to make a byte count */
270 lsb = t << 6;
271 msb = t >> 26;
272 /* add the count */
273 t = lsb;
274 if( (lsb += hd->count) < t )
275 msb++;
276 /* multiply by 8 to make a bit count */
277 t = lsb;
278 lsb <<= 3;
279 msb <<= 3;
280 msb |= t >> 29;
281
282 if( hd->count < 56 ) /* enough room */
283 {
284 hd->buf[hd->count++] = 0x80; /* pad */
285 while( hd->count < 56 )
286 hd->buf[hd->count++] = 0; /* pad */
287 }
288 else /* need one extra block */
289 {
290 hd->buf[hd->count++] = 0x80; /* pad character */
291 while( hd->count < 64 )
292 hd->buf[hd->count++] = 0;
293 md5_write(hd, NULL, 0); /* flush */;
294 memset(hd->buf, 0, 56 ); /* fill next block with zeroes */
295 }
296 /* append the 64 bit count */
297 hd->buf[56] = lsb ;
298 hd->buf[57] = lsb >> 8;
299 hd->buf[58] = lsb >> 16;
300 hd->buf[59] = lsb >> 24;
301 hd->buf[60] = msb ;
302 hd->buf[61] = msb >> 8;
303 hd->buf[62] = msb >> 16;
304 hd->buf[63] = msb >> 24;
305 transform( hd, hd->buf );
306
307 p = hd->buf;
308 #ifdef WORDS_BIGENDIAN
309 #define X(a) do { *p++ = hd->a ; *p++ = hd->a >> 8; \
310 *p++ = hd->a >> 16; *p++ = hd->a >> 24; } while(0)
311 #else /* little endian */
312 #define X(a) do { *(u32*)p = (*hd).a ; p += 4; } while(0)
313 #endif
314 X(A);
315 X(B);
316 X(C);
317 X(D);
318 #undef X
319
320 }
321
322 #if 0
323 static byte *
324 md5_read( void *context )
325 {
326 MD5_CONTEXT *hd = (MD5_CONTEXT *) context;
327 return hd->buf;
328 }
329 #endif
330
331 void InitMD5( struct md5_s *h )
332 {
333 md5_init( h );
334 }
335
336 void AddMD5( struct md5_s *restrict h, const void *data, size_t len )
337 {
338 md5_write( h, data, len );
339 }
340
341 void EndMD5( struct md5_s *h )
342 {
343 md5_final( h );
344 }
0 /*****************************************************************************
1 * vlc_md5.h: MD5 hash
2 *****************************************************************************
3 * Copyright © 2004-2011 VLC authors and VideoLAN
4 *
5 * Authors: Rémi Denis-Courmont
6 * Rafaël Carré
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
22
23 #ifndef VLC_MD5_H
24 # define VLC_MD5_H
25
26 #include <inttypes.h>
27
28 #ifdef __GNUC__
29 # define likely(p) __builtin_expect(!!(p), 1)
30 # define unlikely(p) __builtin_expect(!!(p), 0)
31 #else
32 # define likely(p) (!!(p))
33 # define unlikely(p) (!!(p))
34 #endif
35
36 /**
37 * \file
38 * This file defines functions and structures to compute MD5 digests
39 */
40
41 struct md5_s
42 {
43 uint32_t A, B, C, D; /* chaining variables */
44 uint32_t nblocks;
45 uint8_t buf[64];
46 int count;
47 };
48
49 void InitMD5( struct md5_s * );
50 void AddMD5( struct md5_s *, const void *, size_t );
51 void EndMD5( struct md5_s * );
52
53 /**
54 * Returns a char representation of the md5 hash, as shown by UNIX md5 or
55 * md5sum tools.
56 */
57 static inline char * psz_md5_hash( struct md5_s *md5_s )
58 {
59 char *psz = malloc( 33 ); /* md5 string is 32 bytes + NULL character */
60 if( likely(psz) )
61 {
62 for( int i = 0; i < 16; i++ )
63 sprintf( &psz[2*i], "%02"PRIx8, md5_s->buf[i] );
64 }
65 return psz;
66 }
67
68 #endif
0 /*****************************************************************************
1 * aribsub.c : ARIB STD-B24 bitstream parser
2 *****************************************************************************
3 * Copyright (C) 2014 Naohiro KORIYAMA
4 *
5 * Authors: Naohiro KORIYAMA <nkoriyama@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #include <stdio.h>
23 #include <string.h>
24 #include <stdint.h>
25 #include <stdlib.h>
26 #include <fcntl.h>
27 #include <ctype.h>
28 #include <math.h>
29
30 #include "aribb24/aribb24.h"
31 #include "aribb24/parser.h"
32 #include "aribb24/bits.h"
33 #include "aribb24_private.h"
34 #include "parser_private.h"
35
36 struct arib_parser_t
37 {
38 arib_instance_t *p_instance;
39
40 /* Decoder internal data */
41 #if 0
42 arib_data_group_t data_group;
43 #endif
44 uint32_t i_data_unit_size;
45 size_t i_subtitle_data_size;
46 unsigned char *psz_subtitle_data;
47
48 #ifdef ARIBSUB_GEN_DRCS_DATA
49 drcs_data_t *p_drcs_data;
50 #endif //ARIBSUB_GEN_DRCS_DATA
51 };
52
53 static void parse_data_unit_statement_body( arib_parser_t *p_parser, bs_t *p_bs,
54 uint8_t i_data_unit_parameter,
55 uint32_t i_data_unit_size )
56 {
57 char* p_data_unit_data_byte = (char*) calloc(
58 i_data_unit_size + 1, sizeof(char) );
59 if( p_data_unit_data_byte == NULL )
60 {
61 return;
62 }
63 for( uint32_t i = 0; i < i_data_unit_size; i++ )
64 {
65 p_data_unit_data_byte[i] = bs_read( p_bs, 8 );
66 p_parser->i_data_unit_size += 1;
67 }
68 p_data_unit_data_byte[i_data_unit_size] = '\0';
69
70 memcpy( p_parser->psz_subtitle_data + p_parser->i_subtitle_data_size,
71 p_data_unit_data_byte, i_data_unit_size );
72 p_parser->i_subtitle_data_size += i_data_unit_size;
73
74 free( p_data_unit_data_byte );
75 }
76
77 static void parse_data_unit_DRCS( arib_parser_t *p_parser, bs_t *p_bs,
78 uint8_t i_data_unit_parameter,
79 uint32_t i_data_unit_size )
80 {
81 p_parser->p_instance->p->i_drcs_num = 0;
82 #ifdef ARIBSUB_GEN_DRCS_DATA
83 if( p_parser->p_drcs_data != NULL )
84 {
85 for( int i = 0; i < p_parser->p_drcs_data->i_NumberOfCode; i++ )
86 {
87 drcs_code_t* p_drcs_code = &p_parser->p_drcs_data->p_drcs_code[i];
88 for( int j = 0; j < p_drcs_code->i_NumberOfFont ; j++ )
89 {
90 drcs_font_data_t *p_drcs_font_data = &p_drcs_code->p_drcs_font_data[j];
91 free( p_drcs_font_data->p_drcs_pattern_data );
92 free( p_drcs_font_data->p_drcs_geometric_data );
93 }
94 free( p_drcs_code->p_drcs_font_data );
95 }
96 free( p_parser->p_drcs_data->p_drcs_code );
97 free( p_parser->p_drcs_data );
98 }
99 p_parser->p_drcs_data = (drcs_data_t*) calloc( 1, sizeof(drcs_data_t) );
100 if( p_parser->p_drcs_data == NULL )
101 {
102 return;
103 }
104 #endif //ARIBSUB_GEN_DRCS_DATA
105
106 int8_t i_NumberOfCode = bs_read( p_bs, 8 );
107 p_parser->i_data_unit_size += 1;
108
109 #ifdef ARIBSUB_GEN_DRCS_DATA
110 p_parser->p_drcs_data->i_NumberOfCode = i_NumberOfCode;
111 p_parser->p_drcs_data->p_drcs_code = (drcs_code_t*) calloc(
112 i_NumberOfCode, sizeof(drcs_code_t) );
113 if( p_parser->p_drcs_data->p_drcs_code == NULL )
114 {
115 return;
116 }
117 #endif //ARIBSUB_GEN_DRCS_DATA
118
119 for( int i = 0; i < i_NumberOfCode; i++ )
120 {
121 bs_skip( p_bs, 16 ); /* i_character_code */
122 p_parser->i_data_unit_size += 2;
123 uint8_t i_NumberOfFont = bs_read( p_bs, 8 );
124 p_parser->i_data_unit_size += 1;
125
126 #ifdef ARIBSUB_GEN_DRCS_DATA
127 drcs_code_t *p_drcs_code = &p_parser->p_drcs_data->p_drcs_code[i];
128 p_drcs_code->i_CharacterCode = i_CharacterCode;
129 p_drcs_code->i_NumberOfFont = i_NumberOfFont;
130 p_drcs_code->p_drcs_font_data = (drcs_font_data_t*) calloc(
131 i_NumberOfFont, sizeof(drcs_font_data_t) );
132 if( p_drcs_code->p_drcs_font_data == NULL )
133 {
134 return;
135 }
136 #else
137 #endif //ARIBSUB_GEN_DRCS_DATA
138
139 for( int j = 0; j < i_NumberOfFont; j++ )
140 {
141 bs_skip( p_bs, 4 ); /* i_fontID */
142 uint8_t i_mode = bs_read( p_bs, 4 );
143 p_parser->i_data_unit_size += 1;
144
145 #ifdef ARIBSUB_GEN_DRCS_DATA
146 drcs_font_data_t* p_drcs_font_data =
147 &p_drcs_code->p_drcs_font_data[j];
148 p_drcs_font_data->i_fontId = i_fontId;
149 p_drcs_font_data->i_mode = i_mode;
150 p_drcs_font_data->p_drcs_pattern_data = NULL;
151 p_drcs_font_data->p_drcs_geometric_data = NULL;
152 #else
153 #endif //ARIBSUB_GEN_DRCS_DATA
154
155 if( i_mode == 0x00 || i_mode == 0x01 )
156 {
157 uint8_t i_depth = bs_read( p_bs, 8 );
158 p_parser->i_data_unit_size += 1;
159 uint8_t i_width = bs_read( p_bs, 8 );
160 p_parser->i_data_unit_size += 1;
161 uint8_t i_height = bs_read( p_bs, 8 );
162 p_parser->i_data_unit_size += 1;
163
164 int i_bits_per_pixel = ceil( sqrt( ( i_depth + 2 ) ) );
165
166 #ifdef ARIBSUB_GEN_DRCS_DATA
167 drcs_pattern_data_t* p_drcs_pattern_data =
168 p_drcs_font_data->p_drcs_pattern_data =
169 (drcs_pattern_data_t*) calloc(
170 1, sizeof(drcs_pattern_data_t) );
171 if( p_drcs_pattern_data == NULL )
172 {
173 return;
174 }
175 p_drcs_pattern_data->i_depth = i_depth;
176 p_drcs_pattern_data->i_width = i_width;
177 p_drcs_pattern_data->i_height = i_height;
178 p_drcs_pattern_data->p_patternData = (int8_t*) calloc(
179 i_width * i_height * i_bits_per_pixel / 8,
180 sizeof(int8_t) );
181 if( p_drcs_pattern_data->p_patternData == NULL )
182 {
183 return;
184 }
185 #else
186 int8_t *p_patternData = (int8_t*) calloc(
187 i_width * i_height * i_bits_per_pixel / 8,
188 sizeof(int8_t) );
189 if( p_patternData == NULL )
190 {
191 return;
192 }
193 #endif //ARIBSUB_GEN_DRCS_DATA
194
195 for( int k = 0; k < i_width * i_height * i_bits_per_pixel / 8; k++ )
196 {
197 uint8_t i_patternData = bs_read( p_bs, 8 );
198 p_parser->i_data_unit_size += 1;
199 #ifdef ARIBSUB_GEN_DRCS_DATA
200 p_drcs_pattern_data->p_patternData[k] = i_patternData;
201 #else
202 p_patternData[k] = i_patternData;
203 #endif //ARIBSUB_GEN_DRCS_DATA
204 }
205
206 #ifdef ARIBSUB_GEN_DRCS_DATA
207 save_drcs_pattern( p_parser->p_instance, i_width, i_height, i_depth + 2,
208 p_drcs_pattern_data->p_patternData );
209 #else
210 save_drcs_pattern( p_parser->p_instance, i_width, i_height, i_depth + 2,
211 p_patternData );
212 free( p_patternData );
213 #endif //ARIBSUB_GEN_DRCS_DATA
214 }
215 else
216 {
217 bs_skip( p_bs, 8 ); /* i_regionX */
218 p_parser->i_data_unit_size += 1;
219 bs_skip( p_bs, 8 ); /* i_regionY */
220 p_parser->i_data_unit_size += 1;
221 uint16_t i_geometricData_length = bs_read( p_bs, 16 );
222 p_parser->i_data_unit_size += 2;
223
224 #ifdef ARIBSUB_GEN_DRCS_DATA
225 drcs_geometric_data_t* p_drcs_geometric_data =
226 p_drcs_font_data->p_drcs_geometric_data =
227 (drcs_geometric_data_t*) calloc(
228 1, sizeof(drcs_geometric_data_t) );
229 if( p_drcs_geometric_data == NULL )
230 {
231 return;
232 }
233 p_drcs_geometric_data->i_regionX = i_regionX;
234 p_drcs_geometric_data->i_regionY = i_regionY;
235 p_drcs_geometric_data->i_geometricData_length = i_geometricData_length;
236 p_drcs_geometric_data->p_geometricData = (int8_t*)
237 calloc( i_geometricData_length, sizeof(int8_t) );
238 if( p_drcs_geometric_data->p_geometricData == NULL )
239 {
240 return;
241 }
242 #else
243 #endif //ARIBSUB_GEN_DRCS_DATA
244
245 for( int k = 0; k < i_geometricData_length ; k++ )
246 {
247 bs_skip( p_bs, 8 ); /* i_geometric_data */
248 p_parser->i_data_unit_size += 1;
249
250 #ifdef ARIBSUB_GEN_DRCS_DATA
251 p_drcs_geometric_data->p_geometricData[k] = i_geometricData;
252 #else
253 #endif //ARIBSUB_GEN_DRCS_DATA
254 }
255 }
256 }
257 }
258 }
259
260 static void parse_data_unit_others( arib_parser_t *p_parser, bs_t *p_bs,
261 uint8_t i_data_unit_parameter,
262 uint32_t i_data_unit_size )
263 {
264 for( uint32_t i = 0; i < i_data_unit_size; i++ )
265 {
266 bs_skip( p_bs, 8 );
267 p_parser->i_data_unit_size += 1;
268 }
269 }
270
271 /*****************************************************************************
272 * parse_data_unit
273 *****************************************************************************
274 * ARIB STD-B24 VOLUME 1 Part 3 Chapter 9.4 Structure of data unit
275 *****************************************************************************/
276 static void parse_data_unit( arib_parser_t *p_parser, bs_t *p_bs )
277 {
278 uint8_t i_unit_separator = bs_read( p_bs, 8 );
279 p_parser->i_data_unit_size += 1;
280 if( i_unit_separator != 0x1F )
281 {
282 return;
283 }
284 uint8_t i_data_unit_parameter = bs_read( p_bs, 8 );
285 p_parser->i_data_unit_size += 1;
286 uint32_t i_data_unit_size = bs_read( p_bs, 24 );
287 p_parser->i_data_unit_size += 3;
288 if( i_data_unit_parameter == 0x20 )
289 {
290 parse_data_unit_statement_body( p_parser, p_bs,
291 i_data_unit_parameter,
292 i_data_unit_size );
293 }
294 else if( i_data_unit_parameter == 0x30 ||
295 i_data_unit_parameter == 0x31 )
296 {
297 parse_data_unit_DRCS( p_parser, p_bs,
298 i_data_unit_parameter,
299 i_data_unit_size );
300 }
301 else
302 {
303 parse_data_unit_others( p_parser, p_bs,
304 i_data_unit_parameter,
305 i_data_unit_size );
306 }
307 }
308
309 /*****************************************************************************
310 * parse_caption_management_data
311 *****************************************************************************
312 * ARIB STD-B24 VOLUME 1 Part 3 Chapter 9.3.1 Caption management data
313 *****************************************************************************/
314 static void parse_caption_management_data( arib_parser_t *p_parser, bs_t *p_bs )
315 {
316 uint8_t i_TMD = bs_read( p_bs, 2 );
317 bs_skip( p_bs, 6 ); /* Reserved */
318 if( i_TMD == 0x02 /* 10 */ )
319 {
320 bs_skip( p_bs, 32 ); /* OTM << 4 */
321 bs_skip( p_bs, 4 ); /* OTM & 15 */
322 bs_skip( p_bs, 4 ); /* Reserved */
323 }
324 uint8_t i_num_languages = bs_read( p_bs, 8 );
325 for( int i = 0; i < i_num_languages; i++ )
326 {
327 bs_skip( p_bs, 3 ); /* i_language_tag */
328 bs_skip( p_bs, 1 ); /* Reserved */
329 uint8_t i_DMF = bs_read( p_bs, 4 );
330 if( i_DMF == 0x0C /* 1100 */ ||
331 i_DMF == 0x0D /* 1101 */ ||
332 i_DMF == 0x0E /* 1110 */ )
333 {
334 bs_skip( p_bs, 8 ); /* i_DC */
335 }
336 bs_skip( p_bs, 24 ); /* i_ISO_639_language_code */
337 bs_skip( p_bs, 4 ); /* i_Format */
338 bs_skip( p_bs, 2 ); /* i_TCS */
339 bs_skip( p_bs, 2 ); /* i_rollup_mode */
340 }
341 uint32_t i_data_unit_loop_length = bs_read( p_bs, 24 );
342 free( p_parser->psz_subtitle_data );
343 p_parser->i_data_unit_size = 0;
344 p_parser->i_subtitle_data_size = 0;
345 p_parser->psz_subtitle_data = NULL;
346 if( i_data_unit_loop_length > 0 )
347 {
348 p_parser->psz_subtitle_data = (unsigned char*) calloc(
349 i_data_unit_loop_length + 1, sizeof(unsigned char) );
350 }
351 while( p_parser->i_data_unit_size < i_data_unit_loop_length )
352 {
353 parse_data_unit( p_parser, p_bs );
354 }
355 }
356
357 /*****************************************************************************
358 * parse_caption_data
359 *****************************************************************************
360 * ARIB STD-B24 VOLUME 1 Part 3 Chapter 9.3.2 Caption statement data
361 *****************************************************************************/
362 static void parse_caption_statement_data( arib_parser_t *p_parser, bs_t *p_bs )
363 {
364 uint8_t i_TMD = bs_read( p_bs, 2 );
365 bs_skip( p_bs, 6 ); /* Reserved */
366 if( i_TMD == 0x01 /* 01 */ || i_TMD == 0x02 /* 10 */ )
367 {
368 bs_skip( p_bs, 32 ); /* STM << 4 */
369 bs_skip( p_bs, 4 ); /* STM & 15 */
370 bs_skip( p_bs, 4 ); /* Reserved */
371 }
372 uint32_t i_data_unit_loop_length = bs_read( p_bs, 24 );
373 free( p_parser->psz_subtitle_data );
374 p_parser->i_subtitle_data_size = 0;
375 p_parser->psz_subtitle_data = NULL;
376 if( i_data_unit_loop_length > 0 )
377 {
378 p_parser->psz_subtitle_data = (unsigned char*) calloc(
379 i_data_unit_loop_length + 1, sizeof(unsigned char) );
380 }
381 while( p_parser->i_data_unit_size < i_data_unit_loop_length )
382 {
383 parse_data_unit( p_parser, p_bs );
384 }
385 }
386
387 /*****************************************************************************
388 * parse_data_group
389 *****************************************************************************
390 * ARIB STD-B24 VOLUME 1 Part 3 Chapter 9.2 Structure of data group
391 *****************************************************************************/
392 static void parse_data_group( arib_parser_t *p_parser, bs_t *p_bs )
393 {
394 uint8_t i_data_group_id = bs_read( p_bs, 6 );
395 bs_skip( p_bs, 2 ); /* i_data_group_version */
396 bs_skip( p_bs, 8 ); /* i_data_group_link_number */
397 bs_skip( p_bs, 8 ); /* i_last_data_group_link_number */
398 bs_skip( p_bs, 16 ); /* i_data_group_size */
399
400 if( i_data_group_id == 0x00 || i_data_group_id == 0x20 )
401 {
402 parse_caption_management_data( p_parser, p_bs );
403 }
404 else
405 {
406 parse_caption_statement_data( p_parser, p_bs );
407 }
408 }
409
410 /*****************************************************************************
411 * arib_parse_pes
412 *****************************************************************************
413 * ARIB STD-B24 VOLUME3 Chapter 5 Independent PES transmission protocol
414 *****************************************************************************/
415 void arib_parse_pes( arib_parser_t *p_parser, const void *p_data, size_t i_data )
416 {
417 bs_t bs;
418 bs_init( &bs, p_data, i_data );
419 uint8_t i_data_group_id = bs_read( &bs, 8 );
420 if( i_data_group_id != 0x80 && i_data_group_id != 0x81 )
421 {
422 return;
423 }
424 uint8_t i_private_stream_id = bs_read( &bs, 8 );
425 if( i_private_stream_id != 0xFF )
426 {
427 return;
428 }
429 bs_skip( &bs, 4 ); /* reserved */
430 uint8_t i_PES_data_packet_header_length= bs_read( &bs, 4 );
431
432 /* skip PES_data_private_data_byte */
433 bs_skip( &bs, i_PES_data_packet_header_length );
434
435 parse_data_group( p_parser, &bs );
436 }
437
438 arib_parser_t * arib_parser_new( arib_instance_t *p_instance )
439 {
440 arib_parser_t *p_parser = calloc( 1, sizeof(*p_parser) );
441 if ( !p_parser )
442 return NULL;
443 p_parser->p_instance = p_instance;
444 arib_log( p_parser->p_instance, "arib parser was created" );
445 if ( p_instance->p->psz_base_path )
446 {
447 load_drcs_conversion_table( p_parser->p_instance );
448 arib_log( p_parser->p_instance, "could not load drcs conversion table" );
449 }
450 return p_parser;
451 }
452
453 void arib_parser_free( arib_parser_t *p_parser )
454 {
455 arib_log( p_parser->p_instance, "arib parser was destroyed" );
456 free( p_parser->psz_subtitle_data );
457 free( p_parser );
458 }
459
460 const unsigned char * arib_parser_get_data( arib_parser_t *p_parser, size_t *pi_size )
461 {
462 *pi_size = p_parser->i_subtitle_data_size;
463 return p_parser->psz_subtitle_data;
464 }
0 /*****************************************************************************
1 * parser_private.h : ARIB STD-B24 JIS 8bit character code decoder
2 *****************************************************************************
3 * Copyright (C) 2014 François Cartegnie
4 *
5 * Authors: François Cartegnie <fcvlcdev@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
21
22 #ifndef PARSER_PRIVATE_H
23 #define PARSER_PRIVATE_H 1
24
25 arib_parser_t * arib_parser_new( arib_instance_t *p_instance );
26 void arib_parser_free( arib_parser_t * );
27
28 #endif