├── .classpath ├── .gitignore ├── .project ├── GPL-3.0.txt ├── LGPL-3.0.txt ├── README.md └── src └── hqx ├── Hqx.java ├── Hqx_2x.java ├── Hqx_3x.java ├── Hqx_4x.java ├── Interpolation.java └── RgbYuv.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | *.swp -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | hqx-java 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /GPL-3.0.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | -------------------------------------------------------------------------------- /LGPL-3.0.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Original Introduction 2 | __hqx__ ("hq" stands for "high quality" and "x" stands for magnification) is one of the pixel art scaling algorithms developed by Maxim Stepin, used in emulators such as Nestopia, bsnes, ZSNES, Snes9x, FCE Ultra and many more. There are 3 hqx filters: hq2x, hq3x, and hq4x, which magnify by factor of 2, 3, and 4 respectively. 3 | 4 | ## Port Introduction 5 | __hqx-java__ is a Java port of the excellent [hqxSharp](http://code.google.com/p/hqx-sharp) C# port, which itself is a port of the original [hqx](http://code.google.com/p/hqx) C project 6 | 7 | Like the hqxSharp project, the focus of this code is asset creation and usage in tools, so no optimizations were done, just an almost-direct copy of the code. 8 | 9 | ## Usage 10 | Look in the wiki for usage information 11 | 12 | ## Examples 13 | For examples, go to Maxim Stepin hqx pages ([hq2x](http://www.hiend3d.com/hq2x.html) and [hq3x](http://www.hiend3d.com/hq3x.html)) -------------------------------------------------------------------------------- /src/hqx/Hqx.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2003 Maxim Stepin (maxst@hiend3d.com) 3 | * 4 | * Copyright © 2010 Cameron Zemek (grom@zeminvaders.net) 5 | * 6 | * Copyright © 2011 Tamme Schichler (tamme.schichler@googlemail.com) 7 | 8 | * Copyright © 2012 A. Eduardo García (arcnorj@gmail.com) 9 | * 10 | * This file is part of hqx-java. 11 | * 12 | * hqx-java is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU Lesser General Public License as published by 14 | * the Free Software Foundation, either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * hqx-java is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Lesser General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public License 23 | * along with hqx-java. If not, see . 24 | */ 25 | 26 | package hqx; 27 | 28 | abstract class Hqx { 29 | private static final int Ymask = 0x00FF0000; 30 | private static final int Umask = 0x0000FF00; 31 | private static final int Vmask = 0x000000FF; 32 | 33 | /** 34 | * Compares two ARGB colors according to the provided Y, U, V and A thresholds. 35 | * @param c1 an ARGB color 36 | * @param c2 a second ARGB color 37 | * @param trY the Y (luminance) threshold 38 | * @param trU the U (chrominance) threshold 39 | * @param trV the V (chrominance) threshold 40 | * @param trA the A (transparency) threshold 41 | * @return true if colors differ more than the thresholds permit, false otherwise 42 | */ 43 | protected static boolean diff(final int c1, final int c2, final int trY, final int trU, final int trV, final int trA) { 44 | final int YUV1 = RgbYuv.getYuv(c1); 45 | final int YUV2 = RgbYuv.getYuv(c2); 46 | 47 | return ( 48 | (Math.abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY) || 49 | (Math.abs((YUV1 & Umask) - (YUV2 & Umask)) > trU) || 50 | (Math.abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV) || 51 | (Math.abs(((c1 >> 24) - (c2 >> 24))) > trA) 52 | ); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/hqx/Hqx_2x.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2003 Maxim Stepin (maxst@hiend3d.com) 3 | * 4 | * Copyright © 2010 Cameron Zemek (grom@zeminvaders.net) 5 | * 6 | * Copyright © 2011 Tamme Schichler (tamme.schichler@googlemail.com) 7 | 8 | * Copyright © 2012 A. Eduardo García (arcnorj@gmail.com) 9 | * 10 | * This file is part of hqx-java. 11 | * 12 | * hqx-java is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU Lesser General Public License as published by 14 | * the Free Software Foundation, either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * hqx-java is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Lesser General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public License 23 | * along with hqx-java. If not, see . 24 | */ 25 | 26 | package hqx; 27 | 28 | public class Hqx_2x extends Hqx { 29 | /** 30 | * This is the extended Java port of the hq2x algorithm. 31 | * The destination image must be exactly twice as large in both dimensions as the source image 32 | * The Y, U, V, A parameters will be set as 48, 7, 6 and 0, respectively. Also, wrapping will be false. 33 | * 34 | * @param sp the source image data array in ARGB format 35 | * @param dp the destination image data array in ARGB format 36 | * @param Xres the horizontal resolution of the source image 37 | * @param Yres the vertical resolution of the source image 38 | * 39 | * @see #hq2x_32_rb(int[], int[], int, int, int, int, int, int, boolean, boolean) 40 | */ 41 | public static void hq2x_32_rb( 42 | final int[] sp, final int[] dp, 43 | final int Xres, final int Yres) 44 | { 45 | hq2x_32_rb(sp, dp, Xres, Yres, 48, 7, 6, 0, false, false); 46 | } 47 | 48 | /** 49 | * This is the extended Java port of the hq2x algorithm. 50 | * The destination image must be exactly twice as large in both dimensions as the source image 51 | * @param sp the source image data array in ARGB format 52 | * @param dp the destination image data array in ARGB format 53 | * @param Xres the horizontal resolution of the source image 54 | * @param Yres the vertical resolution of the source image 55 | * @param trY the Y (luminance) threshold 56 | * @param trU the U (chrominance) threshold 57 | * @param trV the V (chrominance) threshold 58 | * @param trA the A (transparency) threshold 59 | * @param wrapX used for images that can be seamlessly repeated horizontally 60 | * @param wrapY used for images that can be seamlessly repeated vertically 61 | */ 62 | public static void hq2x_32_rb( 63 | final int[] sp, final int[] dp, 64 | final int Xres, final int Yres, 65 | int trY, int trU, final int trV, final int trA, 66 | final boolean wrapX, final boolean wrapY) 67 | { 68 | int spIdx = 0, dpIdx = 0; 69 | //Don't shift trA, as it uses shift right instead of a mask for comparisons. 70 | trY <<= 2 * 8; 71 | trU <<= 1 * 8; 72 | final int dpL = Xres * 2; 73 | 74 | int prevline, nextline; 75 | final int[] w = new int[9]; 76 | 77 | for (int j = 0; j < Yres; j++) { 78 | prevline = (j > 0) 79 | ? -Xres 80 | : wrapY 81 | ? Xres * (Yres - 1) 82 | : 0; 83 | nextline = (j < Yres - 1) 84 | ? Xres 85 | : wrapY 86 | ? -(Xres * (Yres - 1)) 87 | : 0; 88 | for (int i = 0; i < Xres; i++) { 89 | w[1] = sp[spIdx + prevline]; 90 | w[4] = sp[spIdx]; 91 | w[7] = sp[spIdx + nextline]; 92 | 93 | if (i > 0) { 94 | w[0] = sp[spIdx + prevline - 1]; 95 | w[3] = sp[spIdx - 1]; 96 | w[6] = sp[spIdx + nextline - 1]; 97 | } else { 98 | if (wrapX) { 99 | w[0] = sp[spIdx + prevline + Xres - 1]; 100 | w[3] = sp[spIdx + Xres - 1]; 101 | w[6] = sp[spIdx + nextline + Xres - 1]; 102 | } else { 103 | w[0] = w[1]; 104 | w[3] = w[4]; 105 | w[6] = w[7]; 106 | } 107 | } 108 | 109 | if (i < Xres - 1) { 110 | w[2] = sp[spIdx + prevline + 1]; 111 | w[5] = sp[spIdx + 1]; 112 | w[8] = sp[spIdx + nextline + 1]; 113 | } else { 114 | if (wrapX) { 115 | w[2] = sp[spIdx + prevline - Xres + 1]; 116 | w[5] = sp[spIdx - Xres + 1]; 117 | w[8] = sp[spIdx + nextline - Xres + 1]; 118 | } else { 119 | w[2] = w[1]; 120 | w[5] = w[4]; 121 | w[8] = w[7]; 122 | } 123 | } 124 | 125 | int pattern = 0; 126 | int flag = 1; 127 | 128 | for (int k = 0; k < 9; k++) 129 | { 130 | if (k == 4) continue; 131 | 132 | if (w[k] != w[4]) 133 | { 134 | if (diff(w[4], w[k], trY, trU, trV, trA)) 135 | pattern |= flag; 136 | } 137 | flag <<= 1; 138 | } 139 | 140 | switch (pattern) { 141 | case 0: 142 | case 1: 143 | case 4: 144 | case 32: 145 | case 128: 146 | case 5: 147 | case 132: 148 | case 160: 149 | case 33: 150 | case 129: 151 | case 36: 152 | case 133: 153 | case 164: 154 | case 161: 155 | case 37: 156 | case 165: { 157 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 158 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 159 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 160 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 161 | break; 162 | } 163 | case 2: 164 | case 34: 165 | case 130: 166 | case 162: { 167 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 168 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 169 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 170 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 171 | break; 172 | } 173 | case 16: 174 | case 17: 175 | case 48: 176 | case 49: { 177 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 178 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 179 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 180 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 181 | break; 182 | } 183 | case 64: 184 | case 65: 185 | case 68: 186 | case 69: { 187 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 188 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 189 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 190 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 191 | break; 192 | } 193 | case 8: 194 | case 12: 195 | case 136: 196 | case 140: { 197 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 198 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 199 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 200 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 201 | break; 202 | } 203 | case 3: 204 | case 35: 205 | case 131: 206 | case 163: { 207 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 208 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 209 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 210 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 211 | break; 212 | } 213 | case 6: 214 | case 38: 215 | case 134: 216 | case 166: { 217 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 218 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 219 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 220 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 221 | break; 222 | } 223 | case 20: 224 | case 21: 225 | case 52: 226 | case 53: { 227 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 228 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 229 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 230 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 231 | break; 232 | } 233 | case 144: 234 | case 145: 235 | case 176: 236 | case 177: { 237 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 238 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 239 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 240 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 241 | break; 242 | } 243 | case 192: 244 | case 193: 245 | case 196: 246 | case 197: { 247 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 248 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 249 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 250 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 251 | break; 252 | } 253 | case 96: 254 | case 97: 255 | case 100: 256 | case 101: { 257 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 258 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 259 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 260 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 261 | break; 262 | } 263 | case 40: 264 | case 44: 265 | case 168: 266 | case 172: { 267 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 268 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 269 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 270 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 271 | break; 272 | } 273 | case 9: 274 | case 13: 275 | case 137: 276 | case 141: { 277 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 278 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 279 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 280 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 281 | break; 282 | } 283 | case 18: 284 | case 50: { 285 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 286 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 287 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 288 | } else { 289 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 290 | } 291 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 292 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 293 | break; 294 | } 295 | case 80: 296 | case 81: { 297 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 298 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 299 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 300 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 301 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 302 | } else { 303 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 304 | } 305 | break; 306 | } 307 | case 72: 308 | case 76: { 309 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 310 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 311 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 312 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 313 | } else { 314 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 315 | } 316 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 317 | break; 318 | } 319 | case 10: 320 | case 138: { 321 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 322 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 323 | } else { 324 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 325 | } 326 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 327 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 328 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 329 | break; 330 | } 331 | case 66: { 332 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 333 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 334 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 335 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 336 | break; 337 | } 338 | case 24: { 339 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 340 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 341 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 342 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 343 | break; 344 | } 345 | case 7: 346 | case 39: 347 | case 135: { 348 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 349 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 350 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 351 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 352 | break; 353 | } 354 | case 148: 355 | case 149: 356 | case 180: { 357 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 358 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 359 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 360 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 361 | break; 362 | } 363 | case 224: 364 | case 228: 365 | case 225: { 366 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 367 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 368 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 369 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 370 | break; 371 | } 372 | case 41: 373 | case 169: 374 | case 45: { 375 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 376 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 377 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 378 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 379 | break; 380 | } 381 | case 22: 382 | case 54: { 383 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 384 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 385 | dp[dpIdx + 1] = w[4]; 386 | } else { 387 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 388 | } 389 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 390 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 391 | break; 392 | } 393 | case 208: 394 | case 209: { 395 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 396 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 397 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 398 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 399 | dp[dpIdx + dpL + 1] = w[4]; 400 | } else { 401 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 402 | } 403 | break; 404 | } 405 | case 104: 406 | case 108: { 407 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 408 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 409 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 410 | dp[dpIdx + dpL] = w[4]; 411 | } else { 412 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 413 | } 414 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 415 | break; 416 | } 417 | case 11: 418 | case 139: { 419 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 420 | dp[dpIdx] = w[4]; 421 | } else { 422 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 423 | } 424 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 425 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 426 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 427 | break; 428 | } 429 | case 19: 430 | case 51: { 431 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 432 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 433 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 434 | } else { 435 | dp[dpIdx] = Interpolation.Mix4To2To1(w[4], w[1], w[3]); 436 | dp[dpIdx + 1] = Interpolation.Mix2To3To3(w[4], w[1], w[5]); 437 | } 438 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 439 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 440 | break; 441 | } 442 | case 146: 443 | case 178: { 444 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 445 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 446 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 447 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 448 | } else { 449 | dp[dpIdx + 1] = Interpolation.Mix2To3To3(w[4], w[1], w[5]); 450 | dp[dpIdx + dpL + 1] = Interpolation.Mix4To2To1(w[4], w[5], w[7]); 451 | } 452 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 453 | break; 454 | } 455 | case 84: 456 | case 85: { 457 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 458 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 459 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 460 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 461 | } else { 462 | dp[dpIdx + 1] = Interpolation.Mix4To2To1(w[4], w[5], w[1]); 463 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To3To3(w[4], w[5], w[7]); 464 | } 465 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 466 | break; 467 | } 468 | case 112: 469 | case 113: { 470 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 471 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 472 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 473 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 474 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 475 | } else { 476 | dp[dpIdx + dpL] = Interpolation.Mix4To2To1(w[4], w[7], w[3]); 477 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To3To3(w[4], w[5], w[7]); 478 | } 479 | break; 480 | } 481 | case 200: 482 | case 204: { 483 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 484 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 485 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 486 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 487 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 488 | } else { 489 | dp[dpIdx + dpL] = Interpolation.Mix2To3To3(w[4], w[7], w[3]); 490 | dp[dpIdx + dpL + 1] = Interpolation.Mix4To2To1(w[4], w[7], w[5]); 491 | } 492 | break; 493 | } 494 | case 73: 495 | case 77: { 496 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 497 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 498 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 499 | } else { 500 | dp[dpIdx] = Interpolation.Mix4To2To1(w[4], w[3], w[1]); 501 | dp[dpIdx + dpL] = Interpolation.Mix2To3To3(w[4], w[7], w[3]); 502 | } 503 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 504 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 505 | break; 506 | } 507 | case 42: 508 | case 170: { 509 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 510 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 511 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 512 | } else { 513 | dp[dpIdx] = Interpolation.Mix2To3To3(w[4], w[3], w[1]); 514 | dp[dpIdx + dpL] = Interpolation.Mix4To2To1(w[4], w[3], w[7]); 515 | } 516 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 517 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 518 | break; 519 | } 520 | case 14: 521 | case 142: { 522 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 523 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 524 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 525 | } else { 526 | dp[dpIdx] = Interpolation.Mix2To3To3(w[4], w[3], w[1]); 527 | dp[dpIdx + 1] = Interpolation.Mix4To2To1(w[4], w[1], w[5]); 528 | } 529 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 530 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 531 | break; 532 | } 533 | case 67: { 534 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 535 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 536 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 537 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 538 | break; 539 | } 540 | case 70: { 541 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 542 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 543 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 544 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 545 | break; 546 | } 547 | case 28: { 548 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 549 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 550 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 551 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 552 | break; 553 | } 554 | case 152: { 555 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 556 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 557 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 558 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 559 | break; 560 | } 561 | case 194: { 562 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 563 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 564 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 565 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 566 | break; 567 | } 568 | case 98: { 569 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 570 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 571 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 572 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 573 | break; 574 | } 575 | case 56: { 576 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 577 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 578 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 579 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 580 | break; 581 | } 582 | case 25: { 583 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 584 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 585 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 586 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 587 | break; 588 | } 589 | case 26: 590 | case 31: { 591 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 592 | dp[dpIdx] = w[4]; 593 | } else { 594 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 595 | } 596 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 597 | dp[dpIdx + 1] = w[4]; 598 | } else { 599 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 600 | } 601 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 602 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 603 | break; 604 | } 605 | case 82: 606 | case 214: { 607 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 608 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 609 | dp[dpIdx + 1] = w[4]; 610 | } else { 611 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 612 | } 613 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 614 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 615 | dp[dpIdx + dpL + 1] = w[4]; 616 | } else { 617 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 618 | } 619 | break; 620 | } 621 | case 88: 622 | case 248: { 623 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 624 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 625 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 626 | dp[dpIdx + dpL] = w[4]; 627 | } else { 628 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 629 | } 630 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 631 | dp[dpIdx + dpL + 1] = w[4]; 632 | } else { 633 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 634 | } 635 | break; 636 | } 637 | case 74: 638 | case 107: { 639 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 640 | dp[dpIdx] = w[4]; 641 | } else { 642 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 643 | } 644 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 645 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 646 | dp[dpIdx + dpL] = w[4]; 647 | } else { 648 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 649 | } 650 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 651 | break; 652 | } 653 | case 27: { 654 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 655 | dp[dpIdx] = w[4]; 656 | } else { 657 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 658 | } 659 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 660 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 661 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 662 | break; 663 | } 664 | case 86: { 665 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 666 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 667 | dp[dpIdx + 1] = w[4]; 668 | } else { 669 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 670 | } 671 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 672 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 673 | break; 674 | } 675 | case 216: { 676 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 677 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 678 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 679 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 680 | dp[dpIdx + dpL + 1] = w[4]; 681 | } else { 682 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 683 | } 684 | break; 685 | } 686 | case 106: { 687 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 688 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 689 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 690 | dp[dpIdx + dpL] = w[4]; 691 | } else { 692 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 693 | } 694 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 695 | break; 696 | } 697 | case 30: { 698 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 699 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 700 | dp[dpIdx + 1] = w[4]; 701 | } else { 702 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 703 | } 704 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 705 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 706 | break; 707 | } 708 | case 210: { 709 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 710 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 711 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 712 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 713 | dp[dpIdx + dpL + 1] = w[4]; 714 | } else { 715 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 716 | } 717 | break; 718 | } 719 | case 120: { 720 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 721 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 722 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 723 | dp[dpIdx + dpL] = w[4]; 724 | } else { 725 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 726 | } 727 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 728 | break; 729 | } 730 | case 75: { 731 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 732 | dp[dpIdx] = w[4]; 733 | } else { 734 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 735 | } 736 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 737 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 738 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 739 | break; 740 | } 741 | case 29: { 742 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 743 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 744 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 745 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 746 | break; 747 | } 748 | case 198: { 749 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 750 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 751 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 752 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 753 | break; 754 | } 755 | case 184: { 756 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 757 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 758 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 759 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 760 | break; 761 | } 762 | case 99: { 763 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 764 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 765 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 766 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 767 | break; 768 | } 769 | case 57: { 770 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 771 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 772 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 773 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 774 | break; 775 | } 776 | case 71: { 777 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 778 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 779 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 780 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 781 | break; 782 | } 783 | case 156: { 784 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 785 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 786 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 787 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 788 | break; 789 | } 790 | case 226: { 791 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 792 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 793 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 794 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 795 | break; 796 | } 797 | case 60: { 798 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 799 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 800 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 801 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 802 | break; 803 | } 804 | case 195: { 805 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 806 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 807 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 808 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 809 | break; 810 | } 811 | case 102: { 812 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 813 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 814 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 815 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 816 | break; 817 | } 818 | case 153: { 819 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 820 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 821 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 822 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 823 | break; 824 | } 825 | case 58: { 826 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 827 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 828 | } else { 829 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 830 | } 831 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 832 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 833 | } else { 834 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 835 | } 836 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 837 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 838 | break; 839 | } 840 | case 83: { 841 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 842 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 843 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 844 | } else { 845 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 846 | } 847 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 848 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 849 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 850 | } else { 851 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 852 | } 853 | break; 854 | } 855 | case 92: { 856 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 857 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 858 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 859 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 860 | } else { 861 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 862 | } 863 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 864 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 865 | } else { 866 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 867 | } 868 | break; 869 | } 870 | case 202: { 871 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 872 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 873 | } else { 874 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 875 | } 876 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 877 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 878 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 879 | } else { 880 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 881 | } 882 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 883 | break; 884 | } 885 | case 78: { 886 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 887 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 888 | } else { 889 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 890 | } 891 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 892 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 893 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 894 | } else { 895 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 896 | } 897 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 898 | break; 899 | } 900 | case 154: { 901 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 902 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 903 | } else { 904 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 905 | } 906 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 907 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 908 | } else { 909 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 910 | } 911 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 912 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 913 | break; 914 | } 915 | case 114: { 916 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 917 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 918 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 919 | } else { 920 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 921 | } 922 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 923 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 924 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 925 | } else { 926 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 927 | } 928 | break; 929 | } 930 | case 89: { 931 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 932 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 933 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 934 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 935 | } else { 936 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 937 | } 938 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 939 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 940 | } else { 941 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 942 | } 943 | break; 944 | } 945 | case 90: { 946 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 947 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 948 | } else { 949 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 950 | } 951 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 952 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 953 | } else { 954 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 955 | } 956 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 957 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 958 | } else { 959 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 960 | } 961 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 962 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 963 | } else { 964 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 965 | } 966 | break; 967 | } 968 | case 55: 969 | case 23: { 970 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 971 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 972 | dp[dpIdx + 1] = w[4]; 973 | } else { 974 | dp[dpIdx] = Interpolation.Mix4To2To1(w[4], w[1], w[3]); 975 | dp[dpIdx + 1] = Interpolation.Mix2To3To3(w[4], w[1], w[5]); 976 | } 977 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 978 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 979 | break; 980 | } 981 | case 182: 982 | case 150: { 983 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 984 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 985 | dp[dpIdx + 1] = w[4]; 986 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 987 | } else { 988 | dp[dpIdx + 1] = Interpolation.Mix2To3To3(w[4], w[1], w[5]); 989 | dp[dpIdx + dpL + 1] = Interpolation.Mix4To2To1(w[4], w[5], w[7]); 990 | } 991 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 992 | break; 993 | } 994 | case 213: 995 | case 212: { 996 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 997 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 998 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 999 | dp[dpIdx + dpL + 1] = w[4]; 1000 | } else { 1001 | dp[dpIdx + 1] = Interpolation.Mix4To2To1(w[4], w[5], w[1]); 1002 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To3To3(w[4], w[5], w[7]); 1003 | } 1004 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 1005 | break; 1006 | } 1007 | case 241: 1008 | case 240: { 1009 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1010 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 1011 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1012 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1013 | dp[dpIdx + dpL + 1] = w[4]; 1014 | } else { 1015 | dp[dpIdx + dpL] = Interpolation.Mix4To2To1(w[4], w[7], w[3]); 1016 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To3To3(w[4], w[5], w[7]); 1017 | } 1018 | break; 1019 | } 1020 | case 236: 1021 | case 232: { 1022 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 1023 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1024 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1025 | dp[dpIdx + dpL] = w[4]; 1026 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1027 | } else { 1028 | dp[dpIdx + dpL] = Interpolation.Mix2To3To3(w[4], w[7], w[3]); 1029 | dp[dpIdx + dpL + 1] = Interpolation.Mix4To2To1(w[4], w[7], w[5]); 1030 | } 1031 | break; 1032 | } 1033 | case 109: 1034 | case 105: { 1035 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1036 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1037 | dp[dpIdx + dpL] = w[4]; 1038 | } else { 1039 | dp[dpIdx] = Interpolation.Mix4To2To1(w[4], w[3], w[1]); 1040 | dp[dpIdx + dpL] = Interpolation.Mix2To3To3(w[4], w[7], w[3]); 1041 | } 1042 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1043 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 1044 | break; 1045 | } 1046 | case 171: 1047 | case 43: { 1048 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1049 | dp[dpIdx] = w[4]; 1050 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1051 | } else { 1052 | dp[dpIdx] = Interpolation.Mix2To3To3(w[4], w[3], w[1]); 1053 | dp[dpIdx + dpL] = Interpolation.Mix4To2To1(w[4], w[3], w[7]); 1054 | } 1055 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 1056 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1057 | break; 1058 | } 1059 | case 143: 1060 | case 15: { 1061 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1062 | dp[dpIdx] = w[4]; 1063 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1064 | } else { 1065 | dp[dpIdx] = Interpolation.Mix2To3To3(w[4], w[3], w[1]); 1066 | dp[dpIdx + 1] = Interpolation.Mix4To2To1(w[4], w[1], w[5]); 1067 | } 1068 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 1069 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1070 | break; 1071 | } 1072 | case 124: { 1073 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 1074 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1075 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1076 | dp[dpIdx + dpL] = w[4]; 1077 | } else { 1078 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1079 | } 1080 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1081 | break; 1082 | } 1083 | case 203: { 1084 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1085 | dp[dpIdx] = w[4]; 1086 | } else { 1087 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1088 | } 1089 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 1090 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1091 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1092 | break; 1093 | } 1094 | case 62: { 1095 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1096 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1097 | dp[dpIdx + 1] = w[4]; 1098 | } else { 1099 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1100 | } 1101 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1102 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 1103 | break; 1104 | } 1105 | case 211: { 1106 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1107 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1108 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 1109 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1110 | dp[dpIdx + dpL + 1] = w[4]; 1111 | } else { 1112 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1113 | } 1114 | break; 1115 | } 1116 | case 118: { 1117 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 1118 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1119 | dp[dpIdx + 1] = w[4]; 1120 | } else { 1121 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1122 | } 1123 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1124 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1125 | break; 1126 | } 1127 | case 217: { 1128 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1129 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 1130 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1131 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1132 | dp[dpIdx + dpL + 1] = w[4]; 1133 | } else { 1134 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1135 | } 1136 | break; 1137 | } 1138 | case 110: { 1139 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1140 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1141 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1142 | dp[dpIdx + dpL] = w[4]; 1143 | } else { 1144 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1145 | } 1146 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 1147 | break; 1148 | } 1149 | case 155: { 1150 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1151 | dp[dpIdx] = w[4]; 1152 | } else { 1153 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1154 | } 1155 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1156 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 1157 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1158 | break; 1159 | } 1160 | case 188: { 1161 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 1162 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1163 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1164 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1165 | break; 1166 | } 1167 | case 185: { 1168 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1169 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 1170 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1171 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1172 | break; 1173 | } 1174 | case 61: { 1175 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1176 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1177 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1178 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 1179 | break; 1180 | } 1181 | case 157: { 1182 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1183 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1184 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 1185 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1186 | break; 1187 | } 1188 | case 103: { 1189 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1190 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1191 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1192 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 1193 | break; 1194 | } 1195 | case 227: { 1196 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1197 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 1198 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1199 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1200 | break; 1201 | } 1202 | case 230: { 1203 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 1204 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1205 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1206 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1207 | break; 1208 | } 1209 | case 199: { 1210 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1211 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1212 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 1213 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1214 | break; 1215 | } 1216 | case 220: { 1217 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 1218 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1219 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1220 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1221 | } else { 1222 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 1223 | } 1224 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1225 | dp[dpIdx + dpL + 1] = w[4]; 1226 | } else { 1227 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1228 | } 1229 | break; 1230 | } 1231 | case 158: { 1232 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1233 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1234 | } else { 1235 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 1236 | } 1237 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1238 | dp[dpIdx + 1] = w[4]; 1239 | } else { 1240 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1241 | } 1242 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 1243 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1244 | break; 1245 | } 1246 | case 234: { 1247 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1248 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1249 | } else { 1250 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 1251 | } 1252 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 1253 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1254 | dp[dpIdx + dpL] = w[4]; 1255 | } else { 1256 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1257 | } 1258 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1259 | break; 1260 | } 1261 | case 242: { 1262 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 1263 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1264 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1265 | } else { 1266 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 1267 | } 1268 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1269 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1270 | dp[dpIdx + dpL + 1] = w[4]; 1271 | } else { 1272 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1273 | } 1274 | break; 1275 | } 1276 | case 59: { 1277 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1278 | dp[dpIdx] = w[4]; 1279 | } else { 1280 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1281 | } 1282 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1283 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1284 | } else { 1285 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 1286 | } 1287 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1288 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 1289 | break; 1290 | } 1291 | case 121: { 1292 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1293 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 1294 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1295 | dp[dpIdx + dpL] = w[4]; 1296 | } else { 1297 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1298 | } 1299 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1300 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1301 | } else { 1302 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 1303 | } 1304 | break; 1305 | } 1306 | case 87: { 1307 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1308 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1309 | dp[dpIdx + 1] = w[4]; 1310 | } else { 1311 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1312 | } 1313 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 1314 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1315 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1316 | } else { 1317 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 1318 | } 1319 | break; 1320 | } 1321 | case 79: { 1322 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1323 | dp[dpIdx] = w[4]; 1324 | } else { 1325 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1326 | } 1327 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1328 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1329 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1330 | } else { 1331 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 1332 | } 1333 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 1334 | break; 1335 | } 1336 | case 122: { 1337 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1338 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1339 | } else { 1340 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 1341 | } 1342 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1343 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1344 | } else { 1345 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 1346 | } 1347 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1348 | dp[dpIdx + dpL] = w[4]; 1349 | } else { 1350 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1351 | } 1352 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1353 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1354 | } else { 1355 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 1356 | } 1357 | break; 1358 | } 1359 | case 94: { 1360 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1361 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1362 | } else { 1363 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 1364 | } 1365 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1366 | dp[dpIdx + 1] = w[4]; 1367 | } else { 1368 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1369 | } 1370 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1371 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1372 | } else { 1373 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 1374 | } 1375 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1376 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1377 | } else { 1378 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 1379 | } 1380 | break; 1381 | } 1382 | case 218: { 1383 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1384 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1385 | } else { 1386 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 1387 | } 1388 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1389 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1390 | } else { 1391 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 1392 | } 1393 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1394 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1395 | } else { 1396 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 1397 | } 1398 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1399 | dp[dpIdx + dpL + 1] = w[4]; 1400 | } else { 1401 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1402 | } 1403 | break; 1404 | } 1405 | case 91: { 1406 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1407 | dp[dpIdx] = w[4]; 1408 | } else { 1409 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1410 | } 1411 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1412 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1413 | } else { 1414 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 1415 | } 1416 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1417 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1418 | } else { 1419 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 1420 | } 1421 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1422 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1423 | } else { 1424 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 1425 | } 1426 | break; 1427 | } 1428 | case 229: { 1429 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1430 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1431 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1432 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1433 | break; 1434 | } 1435 | case 167: { 1436 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1437 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1438 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1439 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1440 | break; 1441 | } 1442 | case 173: { 1443 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1444 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1445 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1446 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1447 | break; 1448 | } 1449 | case 181: { 1450 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1451 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1452 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1453 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1454 | break; 1455 | } 1456 | case 186: { 1457 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1458 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1459 | } else { 1460 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 1461 | } 1462 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1463 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1464 | } else { 1465 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 1466 | } 1467 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1468 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1469 | break; 1470 | } 1471 | case 115: { 1472 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1473 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1474 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1475 | } else { 1476 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 1477 | } 1478 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1479 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1480 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1481 | } else { 1482 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 1483 | } 1484 | break; 1485 | } 1486 | case 93: { 1487 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1488 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1489 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1490 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1491 | } else { 1492 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 1493 | } 1494 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1495 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1496 | } else { 1497 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 1498 | } 1499 | break; 1500 | } 1501 | case 206: { 1502 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1503 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1504 | } else { 1505 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 1506 | } 1507 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1508 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1509 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1510 | } else { 1511 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 1512 | } 1513 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1514 | break; 1515 | } 1516 | case 205: 1517 | case 201: { 1518 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1519 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1520 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1521 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1522 | } else { 1523 | dp[dpIdx + dpL] = Interpolation.Mix6To1To1(w[4], w[7], w[3]); 1524 | } 1525 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1526 | break; 1527 | } 1528 | case 174: 1529 | case 46: { 1530 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1531 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1532 | } else { 1533 | dp[dpIdx] = Interpolation.Mix6To1To1(w[4], w[3], w[1]); 1534 | } 1535 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1536 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1537 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1538 | break; 1539 | } 1540 | case 179: 1541 | case 147: { 1542 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1543 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1544 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1545 | } else { 1546 | dp[dpIdx + 1] = Interpolation.Mix6To1To1(w[4], w[1], w[5]); 1547 | } 1548 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1549 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1550 | break; 1551 | } 1552 | case 117: 1553 | case 116: { 1554 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1555 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1556 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1557 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1558 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1559 | } else { 1560 | dp[dpIdx + dpL + 1] = Interpolation.Mix6To1To1(w[4], w[5], w[7]); 1561 | } 1562 | break; 1563 | } 1564 | case 189: { 1565 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1566 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1567 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1568 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1569 | break; 1570 | } 1571 | case 231: { 1572 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1573 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1574 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1575 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1576 | break; 1577 | } 1578 | case 126: { 1579 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1580 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1581 | dp[dpIdx + 1] = w[4]; 1582 | } else { 1583 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1584 | } 1585 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1586 | dp[dpIdx + dpL] = w[4]; 1587 | } else { 1588 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1589 | } 1590 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1591 | break; 1592 | } 1593 | case 219: { 1594 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1595 | dp[dpIdx] = w[4]; 1596 | } else { 1597 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1598 | } 1599 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1600 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1601 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1602 | dp[dpIdx + dpL + 1] = w[4]; 1603 | } else { 1604 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1605 | } 1606 | break; 1607 | } 1608 | case 125: { 1609 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1610 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1611 | dp[dpIdx + dpL] = w[4]; 1612 | } else { 1613 | dp[dpIdx] = Interpolation.Mix4To2To1(w[4], w[3], w[1]); 1614 | dp[dpIdx + dpL] = Interpolation.Mix2To3To3(w[4], w[7], w[3]); 1615 | } 1616 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1617 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1618 | break; 1619 | } 1620 | case 221: { 1621 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1622 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1623 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1624 | dp[dpIdx + dpL + 1] = w[4]; 1625 | } else { 1626 | dp[dpIdx + 1] = Interpolation.Mix4To2To1(w[4], w[5], w[1]); 1627 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To3To3(w[4], w[5], w[7]); 1628 | } 1629 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1630 | break; 1631 | } 1632 | case 207: { 1633 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1634 | dp[dpIdx] = w[4]; 1635 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1636 | } else { 1637 | dp[dpIdx] = Interpolation.Mix2To3To3(w[4], w[3], w[1]); 1638 | dp[dpIdx + 1] = Interpolation.Mix4To2To1(w[4], w[1], w[5]); 1639 | } 1640 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1641 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1642 | break; 1643 | } 1644 | case 238: { 1645 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1646 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1647 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1648 | dp[dpIdx + dpL] = w[4]; 1649 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1650 | } else { 1651 | dp[dpIdx + dpL] = Interpolation.Mix2To3To3(w[4], w[7], w[3]); 1652 | dp[dpIdx + dpL + 1] = Interpolation.Mix4To2To1(w[4], w[7], w[5]); 1653 | } 1654 | break; 1655 | } 1656 | case 190: { 1657 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1658 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1659 | dp[dpIdx + 1] = w[4]; 1660 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1661 | } else { 1662 | dp[dpIdx + 1] = Interpolation.Mix2To3To3(w[4], w[1], w[5]); 1663 | dp[dpIdx + dpL + 1] = Interpolation.Mix4To2To1(w[4], w[5], w[7]); 1664 | } 1665 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1666 | break; 1667 | } 1668 | case 187: { 1669 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1670 | dp[dpIdx] = w[4]; 1671 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1672 | } else { 1673 | dp[dpIdx] = Interpolation.Mix2To3To3(w[4], w[3], w[1]); 1674 | dp[dpIdx + dpL] = Interpolation.Mix4To2To1(w[4], w[3], w[7]); 1675 | } 1676 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1677 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1678 | break; 1679 | } 1680 | case 243: { 1681 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1682 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1683 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1684 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1685 | dp[dpIdx + dpL + 1] = w[4]; 1686 | } else { 1687 | dp[dpIdx + dpL] = Interpolation.Mix4To2To1(w[4], w[7], w[3]); 1688 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To3To3(w[4], w[5], w[7]); 1689 | } 1690 | break; 1691 | } 1692 | case 119: { 1693 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1694 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1695 | dp[dpIdx + 1] = w[4]; 1696 | } else { 1697 | dp[dpIdx] = Interpolation.Mix4To2To1(w[4], w[1], w[3]); 1698 | dp[dpIdx + 1] = Interpolation.Mix2To3To3(w[4], w[1], w[5]); 1699 | } 1700 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1701 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1702 | break; 1703 | } 1704 | case 237: 1705 | case 233: { 1706 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1707 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1708 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1709 | dp[dpIdx + dpL] = w[4]; 1710 | } else { 1711 | dp[dpIdx + dpL] = Interpolation.Mix14To1To1(w[4], w[7], w[3]); 1712 | } 1713 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1714 | break; 1715 | } 1716 | case 175: 1717 | case 47: { 1718 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1719 | dp[dpIdx] = w[4]; 1720 | } else { 1721 | dp[dpIdx] = Interpolation.Mix14To1To1(w[4], w[3], w[1]); 1722 | } 1723 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1724 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1725 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1726 | break; 1727 | } 1728 | case 183: 1729 | case 151: { 1730 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1731 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1732 | dp[dpIdx + 1] = w[4]; 1733 | } else { 1734 | dp[dpIdx + 1] = Interpolation.Mix14To1To1(w[4], w[1], w[5]); 1735 | } 1736 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1737 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1738 | break; 1739 | } 1740 | case 245: 1741 | case 244: { 1742 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1743 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1744 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1745 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1746 | dp[dpIdx + dpL + 1] = w[4]; 1747 | } else { 1748 | dp[dpIdx + dpL + 1] = Interpolation.Mix14To1To1(w[4], w[5], w[7]); 1749 | } 1750 | break; 1751 | } 1752 | case 250: { 1753 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1754 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1755 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1756 | dp[dpIdx + dpL] = w[4]; 1757 | } else { 1758 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1759 | } 1760 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1761 | dp[dpIdx + dpL + 1] = w[4]; 1762 | } else { 1763 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1764 | } 1765 | break; 1766 | } 1767 | case 123: { 1768 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1769 | dp[dpIdx] = w[4]; 1770 | } else { 1771 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1772 | } 1773 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1774 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1775 | dp[dpIdx + dpL] = w[4]; 1776 | } else { 1777 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1778 | } 1779 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1780 | break; 1781 | } 1782 | case 95: { 1783 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1784 | dp[dpIdx] = w[4]; 1785 | } else { 1786 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1787 | } 1788 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1789 | dp[dpIdx + 1] = w[4]; 1790 | } else { 1791 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1792 | } 1793 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1794 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 1795 | break; 1796 | } 1797 | case 222: { 1798 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1799 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1800 | dp[dpIdx + 1] = w[4]; 1801 | } else { 1802 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1803 | } 1804 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 1805 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1806 | dp[dpIdx + dpL + 1] = w[4]; 1807 | } else { 1808 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1809 | } 1810 | break; 1811 | } 1812 | case 252: { 1813 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[1]); 1814 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1815 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1816 | dp[dpIdx + dpL] = w[4]; 1817 | } else { 1818 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1819 | } 1820 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1821 | dp[dpIdx + dpL + 1] = w[4]; 1822 | } else { 1823 | dp[dpIdx + dpL + 1] = Interpolation.Mix14To1To1(w[4], w[5], w[7]); 1824 | } 1825 | break; 1826 | } 1827 | case 249: { 1828 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1829 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[1]); 1830 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1831 | dp[dpIdx + dpL] = w[4]; 1832 | } else { 1833 | dp[dpIdx + dpL] = Interpolation.Mix14To1To1(w[4], w[7], w[3]); 1834 | } 1835 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1836 | dp[dpIdx + dpL + 1] = w[4]; 1837 | } else { 1838 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1839 | } 1840 | break; 1841 | } 1842 | case 235: { 1843 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1844 | dp[dpIdx] = w[4]; 1845 | } else { 1846 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1847 | } 1848 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[2], w[5]); 1849 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1850 | dp[dpIdx + dpL] = w[4]; 1851 | } else { 1852 | dp[dpIdx + dpL] = Interpolation.Mix14To1To1(w[4], w[7], w[3]); 1853 | } 1854 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1855 | break; 1856 | } 1857 | case 111: { 1858 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1859 | dp[dpIdx] = w[4]; 1860 | } else { 1861 | dp[dpIdx] = Interpolation.Mix14To1To1(w[4], w[3], w[1]); 1862 | } 1863 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1864 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1865 | dp[dpIdx + dpL] = w[4]; 1866 | } else { 1867 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1868 | } 1869 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[5]); 1870 | break; 1871 | } 1872 | case 63: { 1873 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1874 | dp[dpIdx] = w[4]; 1875 | } else { 1876 | dp[dpIdx] = Interpolation.Mix14To1To1(w[4], w[3], w[1]); 1877 | } 1878 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1879 | dp[dpIdx + 1] = w[4]; 1880 | } else { 1881 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1882 | } 1883 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 1884 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[8], w[7]); 1885 | break; 1886 | } 1887 | case 159: { 1888 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1889 | dp[dpIdx] = w[4]; 1890 | } else { 1891 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1892 | } 1893 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1894 | dp[dpIdx + 1] = w[4]; 1895 | } else { 1896 | dp[dpIdx + 1] = Interpolation.Mix14To1To1(w[4], w[1], w[5]); 1897 | } 1898 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[7]); 1899 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 1900 | break; 1901 | } 1902 | case 215: { 1903 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 1904 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1905 | dp[dpIdx + 1] = w[4]; 1906 | } else { 1907 | dp[dpIdx + 1] = Interpolation.Mix14To1To1(w[4], w[1], w[5]); 1908 | } 1909 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[6], w[3]); 1910 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1911 | dp[dpIdx + dpL + 1] = w[4]; 1912 | } else { 1913 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1914 | } 1915 | break; 1916 | } 1917 | case 246: { 1918 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[0], w[3]); 1919 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1920 | dp[dpIdx + 1] = w[4]; 1921 | } else { 1922 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1923 | } 1924 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 1925 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1926 | dp[dpIdx + dpL + 1] = w[4]; 1927 | } else { 1928 | dp[dpIdx + dpL + 1] = Interpolation.Mix14To1To1(w[4], w[5], w[7]); 1929 | } 1930 | break; 1931 | } 1932 | case 254: { 1933 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[0]); 1934 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 1935 | dp[dpIdx + 1] = w[4]; 1936 | } else { 1937 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 1938 | } 1939 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1940 | dp[dpIdx + dpL] = w[4]; 1941 | } else { 1942 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 1943 | } 1944 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1945 | dp[dpIdx + dpL + 1] = w[4]; 1946 | } else { 1947 | dp[dpIdx + dpL + 1] = Interpolation.Mix14To1To1(w[4], w[5], w[7]); 1948 | } 1949 | break; 1950 | } 1951 | case 253: { 1952 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[1]); 1953 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[1]); 1954 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1955 | dp[dpIdx + dpL] = w[4]; 1956 | } else { 1957 | dp[dpIdx + dpL] = Interpolation.Mix14To1To1(w[4], w[7], w[3]); 1958 | } 1959 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1960 | dp[dpIdx + dpL + 1] = w[4]; 1961 | } else { 1962 | dp[dpIdx + dpL + 1] = Interpolation.Mix14To1To1(w[4], w[5], w[7]); 1963 | } 1964 | break; 1965 | } 1966 | case 251: { 1967 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1968 | dp[dpIdx] = w[4]; 1969 | } else { 1970 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 1971 | } 1972 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[2]); 1973 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1974 | dp[dpIdx + dpL] = w[4]; 1975 | } else { 1976 | dp[dpIdx + dpL] = Interpolation.Mix14To1To1(w[4], w[7], w[3]); 1977 | } 1978 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 1979 | dp[dpIdx + dpL + 1] = w[4]; 1980 | } else { 1981 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 1982 | } 1983 | break; 1984 | } 1985 | case 239: { 1986 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 1987 | dp[dpIdx] = w[4]; 1988 | } else { 1989 | dp[dpIdx] = Interpolation.Mix14To1To1(w[4], w[3], w[1]); 1990 | } 1991 | dp[dpIdx + 1] = Interpolation.Mix3To1(w[4], w[5]); 1992 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 1993 | dp[dpIdx + dpL] = w[4]; 1994 | } else { 1995 | dp[dpIdx + dpL] = Interpolation.Mix14To1To1(w[4], w[7], w[3]); 1996 | } 1997 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[5]); 1998 | break; 1999 | } 2000 | case 127: { 2001 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 2002 | dp[dpIdx] = w[4]; 2003 | } else { 2004 | dp[dpIdx] = Interpolation.Mix14To1To1(w[4], w[3], w[1]); 2005 | } 2006 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 2007 | dp[dpIdx + 1] = w[4]; 2008 | } else { 2009 | dp[dpIdx + 1] = Interpolation.Mix2To1To1(w[4], w[1], w[5]); 2010 | } 2011 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 2012 | dp[dpIdx + dpL] = w[4]; 2013 | } else { 2014 | dp[dpIdx + dpL] = Interpolation.Mix2To1To1(w[4], w[7], w[3]); 2015 | } 2016 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[8]); 2017 | break; 2018 | } 2019 | case 191: { 2020 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 2021 | dp[dpIdx] = w[4]; 2022 | } else { 2023 | dp[dpIdx] = Interpolation.Mix14To1To1(w[4], w[3], w[1]); 2024 | } 2025 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 2026 | dp[dpIdx + 1] = w[4]; 2027 | } else { 2028 | dp[dpIdx + 1] = Interpolation.Mix14To1To1(w[4], w[1], w[5]); 2029 | } 2030 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[7]); 2031 | dp[dpIdx + dpL + 1] = Interpolation.Mix3To1(w[4], w[7]); 2032 | break; 2033 | } 2034 | case 223: { 2035 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 2036 | dp[dpIdx] = w[4]; 2037 | } else { 2038 | dp[dpIdx] = Interpolation.Mix2To1To1(w[4], w[3], w[1]); 2039 | } 2040 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 2041 | dp[dpIdx + 1] = w[4]; 2042 | } else { 2043 | dp[dpIdx + 1] = Interpolation.Mix14To1To1(w[4], w[1], w[5]); 2044 | } 2045 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[6]); 2046 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 2047 | dp[dpIdx + dpL + 1] = w[4]; 2048 | } else { 2049 | dp[dpIdx + dpL + 1] = Interpolation.Mix2To1To1(w[4], w[5], w[7]); 2050 | } 2051 | break; 2052 | } 2053 | case 247: { 2054 | dp[dpIdx] = Interpolation.Mix3To1(w[4], w[3]); 2055 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 2056 | dp[dpIdx + 1] = w[4]; 2057 | } else { 2058 | dp[dpIdx + 1] = Interpolation.Mix14To1To1(w[4], w[1], w[5]); 2059 | } 2060 | dp[dpIdx + dpL] = Interpolation.Mix3To1(w[4], w[3]); 2061 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 2062 | dp[dpIdx + dpL + 1] = w[4]; 2063 | } else { 2064 | dp[dpIdx + dpL + 1] = Interpolation.Mix14To1To1(w[4], w[5], w[7]); 2065 | } 2066 | break; 2067 | } 2068 | case 255: { 2069 | if (diff(w[3], w[1], trY, trU, trV, trA)) { 2070 | dp[dpIdx] = w[4]; 2071 | } else { 2072 | dp[dpIdx] = Interpolation.Mix14To1To1(w[4], w[3], w[1]); 2073 | } 2074 | if (diff(w[1], w[5], trY, trU, trV, trA)) { 2075 | dp[dpIdx + 1] = w[4]; 2076 | } else { 2077 | dp[dpIdx + 1] = Interpolation.Mix14To1To1(w[4], w[1], w[5]); 2078 | } 2079 | if (diff(w[7], w[3], trY, trU, trV, trA)) { 2080 | dp[dpIdx + dpL] = w[4]; 2081 | } else { 2082 | dp[dpIdx + dpL] = Interpolation.Mix14To1To1(w[4], w[7], w[3]); 2083 | } 2084 | if (diff(w[5], w[7], trY, trU, trV, trA)) { 2085 | dp[dpIdx + dpL + 1] = w[4]; 2086 | } else { 2087 | dp[dpIdx + dpL + 1] = Interpolation.Mix14To1To1(w[4], w[5], w[7]); 2088 | } 2089 | break; 2090 | } 2091 | } 2092 | spIdx++; 2093 | dpIdx += 2; 2094 | } 2095 | dpIdx += dpL; 2096 | } 2097 | } 2098 | } 2099 | -------------------------------------------------------------------------------- /src/hqx/Interpolation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2003 Maxim Stepin (maxst@hiend3d.com) 3 | * 4 | * Copyright © 2010 Cameron Zemek (grom@zeminvaders.net) 5 | * 6 | * Copyright © 2011 Tamme Schichler (tamme.schichler@googlemail.com) 7 | 8 | * Copyright © 2012 A. Eduardo García (arcnorj@gmail.com) 9 | * 10 | * This file is part of hqx-java. 11 | * 12 | * hqx-java is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU Lesser General Public License as published by 14 | * the Free Software Foundation, either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * hqx-java is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Lesser General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public License 23 | * along with hqx-java. If not, see . 24 | */ 25 | 26 | package hqx; 27 | 28 | /** 29 | * Helper class to interpolate colors. Nothing to see here, move along... 30 | */ 31 | final class Interpolation { 32 | private static final int Mask4 = 0xFF000000; 33 | private static final int Mask2 = 0x0000FF00; 34 | private static final int Mask13 = 0x00FF00FF; 35 | 36 | // return statements: 37 | // 1. line: green 38 | // 2. line: red and blue 39 | // 3. line: alpha 40 | 41 | static final int Mix3To1(final int c1, final int c2) { 42 | //return (c1*3+c2) >> 2; 43 | if (c1 == c2) { 44 | return c1; 45 | } 46 | return ((((c1 & Mask2) * 3 + (c2 & Mask2)) >> 2) & Mask2) | 47 | ((((c1 & Mask13) * 3 + (c2 & Mask13)) >> 2) & Mask13) | 48 | ((((c1 & Mask4) >> 2) * 3 + ((c2 & Mask4) >> 2)) & Mask4); 49 | } 50 | 51 | static final int Mix2To1To1(final int c1, final int c2, final int c3) { 52 | //return (c1*2+c2+c3) >> 2; 53 | return ((((c1 & Mask2) * 2 + (c2 & Mask2) + (c3 & Mask2)) >> 2) & Mask2) | 54 | ((((c1 & Mask13) * 2 + (c2 & Mask13) + (c3 & Mask13)) >> 2) & Mask13) | 55 | ((((c1 & Mask4) >> 2) * 2 + ((c2 & Mask4) >> 2) + ((c3 & Mask4) >> 2)) & Mask4); 56 | } 57 | 58 | static final int Mix7To1(final int c1, final int c2) { 59 | //return (c1*7+c2)/8; 60 | if (c1 == c2) { 61 | return c1; 62 | } 63 | return ((((c1 & Mask2) * 7 + (c2 & Mask2)) >> 3) & Mask2) | 64 | ((((c1 & Mask13) * 7 + (c2 & Mask13)) >> 3) & Mask13) | 65 | ((((c1 & Mask4) >> 3) * 7 + ((c2 & Mask4) >> 3)) & Mask4); 66 | } 67 | 68 | static final int Mix2To7To7(final int c1, final int c2, final int c3) { 69 | //return (c1*2+(c2+c3)*7)/16; 70 | return ((((c1 & Mask2) * 2 + (c2 & Mask2) * 7 + (c3 & Mask2) * 7) >> 4) & Mask2) | 71 | ((((c1 & Mask13) * 2 + (c2 & Mask13) * 7 + (c3 & Mask13) * 7) >> 4) & Mask13) | 72 | ((((c1 & Mask4) >> 4) * 2 + ((c2 & Mask4) >> 4) * 7 + ((c3 & Mask4) >> 4) * 7) & Mask4); 73 | } 74 | 75 | static final int MixEven(final int c1, final int c2) { 76 | //return (c1+c2) >> 1; 77 | if (c1 == c2) { 78 | return c1; 79 | } 80 | return ((((c1 & Mask2) + (c2 & Mask2)) >> 1) & Mask2) | 81 | ((((c1 & Mask13) + (c2 & Mask13)) >> 1) & Mask13) | 82 | ((((c1 & Mask4) >> 1) + ((c2 & Mask4) >> 1)) & Mask4); 83 | } 84 | 85 | static final int Mix4To2To1(final int c1, final int c2, final int c3) { 86 | //return (c1*5+c2*2+c3)/8; 87 | return ((((c1 & Mask2) * 5 + (c2 & Mask2) * 2 + (c3 & Mask2)) >> 3) & Mask2) | 88 | ((((c1 & Mask13) * 5 + (c2 & Mask13) * 2 + (c3 & Mask13)) >> 3) & Mask13) | 89 | ((((c1 & Mask4) >> 3) * 5 + ((c2 & Mask4) >> 3) * 2 + ((c3 & Mask4) >> 3)) & Mask4); 90 | } 91 | 92 | static final int Mix6To1To1(final int c1, final int c2, final int c3) { 93 | //return (c1*6+c2+c3)/8; 94 | return ((((c1 & Mask2) * 6 + (c2 & Mask2) + (c3 & Mask2)) >> 3) & Mask2) | 95 | ((((c1 & Mask13) * 6 + (c2 & Mask13) + (c3 & Mask13)) >> 3) & Mask13) | 96 | ((((c1 & Mask4) >> 3) * 6 + ((c2 & Mask4) >> 3) + ((c3 & Mask4) >> 3)) & Mask4); 97 | } 98 | 99 | static final int Mix5To3(final int c1, final int c2) { 100 | //return (c1*5+c2*3)/8; 101 | if (c1 == c2) { 102 | return c1; 103 | } 104 | return ((((c1 & Mask2) * 5 + (c2 & Mask2) * 3) >> 3) & Mask2) | 105 | ((((c1 & Mask13) * 5 + (c2 & Mask13) * 3) >> 3) & Mask13) | 106 | ((((c1 & Mask4) >> 3) * 5 + ((c2 & Mask4) >> 3) * 3) & Mask4); 107 | } 108 | 109 | static final int Mix2To3To3(final int c1, final int c2, final int c3) { 110 | //return (c1*2+(c2+c3)*3)/8; 111 | return ((((c1 & Mask2) * 2 + (c2 & Mask2) * 3 + (c3 & Mask2) * 3) >> 3) & Mask2) | 112 | ((((c1 & Mask13) * 2 + (c2 & Mask13) * 3 + (c3 & Mask13) * 3) >> 3) & Mask13) | 113 | ((((c1 & Mask4) >> 3) * 2 + ((c2 & Mask4) >> 3) * 3 + ((c3 & Mask4) >> 3) * 3) & Mask4); 114 | } 115 | 116 | static final int Mix14To1To1(final int c1, final int c2, final int c3) { 117 | //return (c1*14+c2+c3)/16; 118 | return ((((c1 & Mask2) * 14 + (c2 & Mask2) + (c3 & Mask2)) >> 4) & Mask2) | 119 | ((((c1 & Mask13) * 14 + (c2 & Mask13) + (c3 & Mask13)) >> 4) & Mask13) | 120 | ((((c1 & Mask4) >> 4) * 14 + ((c2 & Mask4) >> 4) + ((c3 & Mask4) >> 4)) & Mask4); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/hqx/RgbYuv.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2003 Maxim Stepin (maxst@hiend3d.com) 3 | * 4 | * Copyright © 2010 Cameron Zemek (grom@zeminvaders.net) 5 | * 6 | * Copyright © 2011 Tamme Schichler (tamme.schichler@googlemail.com) 7 | 8 | * Copyright © 2012 A. Eduardo García (arcnorj@gmail.com) 9 | * 10 | * This file is part of hqx-java. 11 | * 12 | * hqx-java is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU Lesser General Public License as published by 14 | * the Free Software Foundation, either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * hqx-java is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Lesser General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public License 23 | * along with hqx-java. If not, see . 24 | */ 25 | 26 | package hqx; 27 | 28 | public final class RgbYuv { 29 | private static final int rgbMask = 0x00FFFFFF; 30 | private static int[] RGBtoYUV = new int[0x1000000]; 31 | 32 | /** 33 | * Returns the 24bit YUV equivalent of the provided 24bit RGB color.Any alpha component is dropped 34 | * 35 | * @param rgb a 24bit rgb color 36 | * @return the corresponding 24bit YUV color 37 | */ 38 | static int getYuv(final int rgb) { 39 | return RGBtoYUV[rgb & rgbMask]; 40 | } 41 | 42 | /** 43 | * Calculates the lookup table. MUST be called (only once) before doing anything else 44 | */ 45 | public static void hqxInit() { 46 | /* Initalize RGB to YUV lookup table */ 47 | int r, g, b, y, u, v; 48 | for (int c = 0x1000000 - 1; c >= 0; c--) { 49 | r = (c & 0xFF0000) >> 16; 50 | g = (c & 0x00FF00) >> 8; 51 | b = c & 0x0000FF; 52 | y = (int) (+0.299d * r + 0.587d * g + 0.114d * b); 53 | u = (int) (-0.169d * r - 0.331d * g + 0.500d * b) + 128; 54 | v = (int) (+0.500d * r - 0.419d * g - 0.081d * b) + 128; 55 | RGBtoYUV[c] = (y << 16) | (u << 8) | v; 56 | } 57 | } 58 | 59 | /// 60 | /// Releases the reference to the lookup table. 61 | /// The table has to be calculated again for the next lookup. 62 | /// 63 | /** 64 | * Releases the reference to the lookup table. The table has to be calculated again for the next lookup. 65 | */ 66 | public static void hqxDeinit() { 67 | RGBtoYUV = null; 68 | } 69 | } 70 | --------------------------------------------------------------------------------