hq2x.cpp 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637
  1. /*
  2. * Copyright 2016 Bruno Ribeiro
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include "hq2x.h"
  17. #include "core/math/math_funcs.h"
  18. static const uint32_t AMASK = 0xFF000000;
  19. static const uint32_t YMASK = 0x00FF0000;
  20. static const uint32_t UMASK = 0x0000FF00;
  21. static const uint32_t VMASK = 0x000000FF;
  22. _FORCE_INLINE_ static uint32_t ARGBtoAYUV(
  23. uint32_t value )
  24. {
  25. uint32_t A, R, G, B, Y, U, V;
  26. //todo big endian check
  27. A = value >> 24;
  28. R = (value >> 16) & 0xFF;
  29. G = (value >> 8) & 0xFF;
  30. B = value & 0xFF;
  31. Y = Math::fast_ftoi( 0.299 * R + 0.587 * G + 0.114 * B);
  32. U = Math::fast_ftoi(-0.169 * R - 0.331 * G + 0.5 * B) + 128;
  33. V = Math::fast_ftoi( 0.5 * R - 0.419 * G - 0.081 * B) + 128;
  34. return (A << 24) + (Y << 16) + (U << 8) + V;
  35. }
  36. /*
  37. * Use this function for sharper images (good for cartoon style, used by DOSBOX)
  38. */
  39. _FORCE_INLINE_ static bool isDifferent(
  40. uint32_t color1,
  41. uint32_t color2,
  42. uint32_t trY,
  43. uint32_t trU,
  44. uint32_t trV,
  45. uint32_t trA )
  46. {
  47. color1 = ARGBtoAYUV(color1);
  48. color2 = ARGBtoAYUV(color2);
  49. uint32_t value;
  50. value = ((color1 & YMASK) - (color2 & YMASK));
  51. value = (value ^ (value >> 31)) - (value >> 31);
  52. if (value > trY) return true;
  53. value = ((color1 & UMASK) - (color2 & UMASK));
  54. value = (value ^ (value >> 31)) - (value >> 31);
  55. if (value > trU) return true;
  56. value = ((color1 & VMASK) - (color2 & VMASK));
  57. value = (value ^ (value >> 31)) - (value >> 31);
  58. if (value > trV) return true;
  59. value = ((color1 & AMASK) - (color2 & AMASK));
  60. value = (value ^ (value >> 31)) - (value >> 31);
  61. if (value > trA) return true;
  62. return false;
  63. }
  64. #define MASK_RB 0x00FF00FF
  65. #define MASK_G 0x0000FF00
  66. #define MASK_A 0xFF000000
  67. /**
  68. * @brief Mixes two colors using the given weights.
  69. */
  70. #define HQX_MIX_2(C0,C1,W0,W1) \
  71. ((((C0 & MASK_RB) * W0 + (C1 & MASK_RB) * W1) / (W0 + W1)) & MASK_RB) | \
  72. ((((C0 & MASK_G) * W0 + (C1 & MASK_G) * W1) / (W0 + W1)) & MASK_G) | \
  73. ((((((C0 & MASK_A) >> 8) * W0 + ((C1 & MASK_A) >> 8) * W1) / (W0 + W1)) << 8) & MASK_A)
  74. /**
  75. * @brief Mixes three colors using the given weights.
  76. */
  77. #define HQX_MIX_3(C0,C1,C2,W0,W1,W2) \
  78. ((((C0 & MASK_RB) * W0 + (C1 & MASK_RB) * W1 + (C2 & MASK_RB) * W2) / (W0 + W1 + W2)) & MASK_RB) | \
  79. ((((C0 & MASK_G) * W0 + (C1 & MASK_G) * W1 + (C2 & MASK_G) * W2) / (W0 + W1 + W2)) & MASK_G) | \
  80. ((((((C0 & MASK_A) >> 8) * W0 + ((C1 & MASK_A) >> 8) * W1 + ((C2 & MASK_A) >> 8) * W2) / (W0 + W1 + W2)) << 8) & MASK_A)
  81. #define MIX_00_4 *output = w[4];
  82. #define MIX_00_MIX_00_4_0_3_1 *output = HQX_MIX_2(w[4],w[0],3U,1U);
  83. #define MIX_00_4_3_3_1 *output = HQX_MIX_2(w[4],w[3],3U,1U);
  84. #define MIX_00_4_1_3_1 *output = HQX_MIX_2(w[4],w[1],3U,1U);
  85. #define MIX_00_3_1_1_1 *output = HQX_MIX_2(w[3],w[1],1U,1U);
  86. #define MIX_00_4_3_1_2_1_1 *output = HQX_MIX_3(w[4],w[3],w[1],2U,1U,1U);
  87. #define MIX_00_4_3_1_2_7_7 *output = HQX_MIX_3(w[4],w[3],w[1],2U,7U,7U);
  88. #define MIX_00_4_0_1_2_1_1 *output = HQX_MIX_3(w[4],w[0],w[1],2U,1U,1U);
  89. #define MIX_00_4_0_3_2_1_1 *output = HQX_MIX_3(w[4],w[0],w[3],2U,1U,1U);
  90. #define MIX_00_4_1_3_5_2_1 *output = HQX_MIX_3(w[4],w[1],w[3],5U,2U,1U);
  91. #define MIX_00_4_3_1_5_2_1 *output = HQX_MIX_3(w[4],w[3],w[1],5U,2U,1U);
  92. #define MIX_00_4_3_1_6_1_1 *output = HQX_MIX_3(w[4],w[3],w[1],6U,1U,1U);
  93. #define MIX_00_4_3_1_2_3_3 *output = HQX_MIX_3(w[4],w[3],w[1],2U,3U,3U);
  94. #define MIX_00_MIX_00_4_0_3_10 *output = HQX_MIX_3(w[4],w[3],w[1],14U,1U,1U);
  95. #define MIX_01_4 *(output + 1) = w[4];
  96. #define MIX_01_4_2_3_1 *(output + 1) = HQX_MIX_2(w[4],w[2],3U,1U);
  97. #define MIX_01_4_1_3_1 *(output + 1) = HQX_MIX_2(w[4],w[1],3U,1U);
  98. #define MIX_01_1_4_3_1 *(output + 1) = HQX_MIX_2(w[1],w[4],3U,1U);
  99. #define MIX_01_4_5_3_1 *(output + 1) = HQX_MIX_2(w[4],w[5],3U,1U);
  100. #define MIX_01_4_1_7_1 *(output + 1) = HQX_MIX_2(w[4],w[1],7U,1U);
  101. #define MIX_01_4_1_5_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],2U,1U,1U);
  102. #define MIX_01_4_2_5_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[2],w[5],2U,1U,1U);
  103. #define MIX_01_4_2_1_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[2],w[1],2U,1U,1U);
  104. #define MIX_01_4_5_1_5_2_1 *(output + 1) = HQX_MIX_3(w[4],w[5],w[1],5U,2U,1U);
  105. #define MIX_01_4_1_5_5_2_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],5U,2U,1U);
  106. #define MIX_01_4_1_5_6_1_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],6U,1U,1U);
  107. #define MIX_01_4_1_5_2_3_3 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],2U,3U,3U);
  108. #define MIX_01_4_2_3_10 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],14U,1U,1U);
  109. #define MIX_02_4 *(output + 2) = w[4];
  110. #define MIX_02_4_2_3_1 *(output + 2) = HQX_MIX_2(w[4],w[2],3U,1U);
  111. #define MIX_02_4_1_3_1 *(output + 2) = HQX_MIX_2(w[4],w[1],3U,1U);
  112. #define MIX_02_4_5_3_1 *(output + 2) = HQX_MIX_2(w[4],w[5],3U,1U);
  113. #define MIX_02_4_1_5_2_1_1 *(output + 2) = HQX_MIX_3(w[4],w[1],w[5],2U,1U,1U);
  114. #define MIX_02_4_1_5_2_7_7 *(output + 2) = HQX_MIX_3(w[4],w[1],w[5],2U,7U,7U);
  115. #define MIX_02_1_5_1_1 *(output + 2) = HQX_MIX_2(w[1],w[5],1U,1U);
  116. #define MIX_10_4 *(output + lineSize) = w[4];
  117. #define MIX_10_4_6_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[6],3U,1U);
  118. #define MIX_10_4_7_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[7],3U,1U);
  119. #define MIX_10_4_3_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[3],3U,1U);
  120. #define MIX_10_4_7_3_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,1U,1U);
  121. #define MIX_10_4_6_3_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[6],w[3],2U,1U,1U);
  122. #define MIX_10_4_6_7_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[6],w[7],2U,1U,1U);
  123. #define MIX_10_4_3_7_5_2_1 *(output + lineSize) = HQX_MIX_3(w[4],w[3],w[7],5U,2U,1U);
  124. #define MIX_10_4_7_3_5_2_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],5U,2U,1U);
  125. #define MIX_10_4_7_3_6_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],6U,1U,1U);
  126. #define MIX_10_4_7_3_2_3_3 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,3U,3U);
  127. #define MIX_10_4_6_3_10 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],14U,1U,1U);
  128. #define MIX_10_4_3_7_1 *(output + lineSize) = HQX_MIX_2(w[4],w[3],7U,1U);
  129. #define MIX_10_3_4_3_1 *(output + lineSize) = HQX_MIX_2(w[3],w[4],3U,1U);
  130. #define MIX_11_4 *(output + lineSize + 1) = w[4];
  131. #define MIX_11_4_8_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[8],3U,1U);
  132. #define MIX_11_4_5_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[5],3U,1U);
  133. #define MIX_11_4_7_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[7],3U,1U);
  134. #define MIX_11_4_5_7_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],2U,1U,1U);
  135. #define MIX_11_4_8_7_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[8],w[7],2U,1U,1U);
  136. #define MIX_11_4_8_5_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[8],w[5],2U,1U,1U);
  137. #define MIX_11_4_7_5_5_2_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[7],w[5],5U,2U,1U);
  138. #define MIX_11_4_5_7_5_2_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],5U,2U,1U);
  139. #define MIX_11_4_5_7_6_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],6U,1U,1U);
  140. #define MIX_11_4_5_7_2_3_3 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],2U,3U,3U);
  141. #define MIX_11_4_8_3_10 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],14U,1U,1U);
  142. #define MIX_12_4 *(output + lineSize + 2) = w[4];
  143. #define MIX_12_4_5_3_1 *(output + lineSize + 2) = HQX_MIX_2(w[4],w[5],3U,1U);
  144. #define MIX_12_4_5_7_1 *(output + lineSize + 2) = HQX_MIX_2(w[4],w[5],7U,1U);
  145. #define MIX_12_5_4_3_1 *(output + lineSize + 2) = HQX_MIX_2(w[5],w[4],3U,1U);
  146. #define MIX_20_4 *(output + lineSize + lineSize) = w[4];
  147. #define MIX_20_4_6_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[6],3U,1U);
  148. #define MIX_20_4_7_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[7],3U,1U);
  149. #define MIX_20_4_3_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[3],3U,1U);
  150. #define MIX_20_4_7_3_2_1_1 *(output + lineSize + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,1U,1U);
  151. #define MIX_20_4_7_3_2_7_7 *(output + lineSize + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,7U,7U);
  152. #define MIX_20_7_3_1_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[7],w[3],1U,1U);
  153. #define MIX_21_4 *(output + lineSize + lineSize + 1) = w[4];
  154. #define MIX_21_4_7_3_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[4],w[7],3U,1U);
  155. #define MIX_21_4_7_7_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[4],w[7],7U,1U);
  156. #define MIX_21_7_4_3_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[7],w[4],3U,1U);
  157. #define MIX_22_4 *(output + lineSize + lineSize + 2) = w[4];
  158. #define MIX_22_4_8_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[8],3U,1U);
  159. #define MIX_22_4_7_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[7],3U,1U);
  160. #define MIX_22_4_5_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[5],3U,1U);
  161. #define MIX_22_4_5_7_2_1_1 *(output + lineSize + lineSize + 2) = HQX_MIX_3(w[4],w[5],w[7],2U,1U,1U);
  162. #define MIX_22_4_5_7_2_7_7 *(output + lineSize + lineSize + 2) = HQX_MIX_3(w[4],w[5],w[7],2U,7U,7U);
  163. #define MIX_22_5_7_1_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[5],w[7],1U,1U);
  164. uint32_t *hq2x_resize(
  165. const uint32_t *image,
  166. uint32_t width,
  167. uint32_t height,
  168. uint32_t *output,
  169. uint32_t trY,
  170. uint32_t trU,
  171. uint32_t trV,
  172. uint32_t trA,
  173. bool wrapX,
  174. bool wrapY )
  175. {
  176. int lineSize = width * 2;
  177. int previous, next;
  178. uint32_t w[9];
  179. trY <<= 16;
  180. trU <<= 8;
  181. trA <<= 24;
  182. // iterates between the lines
  183. for (uint32_t row = 0; row < height; row++)
  184. {
  185. /*
  186. * Note: this function uses a 3x3 sliding window over the original image.
  187. *
  188. * +----+----+----+
  189. * | | | |
  190. * | w0 | w1 | w2 |
  191. * +----+----+----+
  192. * | | | |
  193. * | w3 | w4 | w5 |
  194. * +----+----+----+
  195. * | | | |
  196. * | w6 | w7 | w8 |
  197. * +----+----+----+
  198. */
  199. // adjusts the previous and next line pointers
  200. if (row > 0)
  201. previous = -width;
  202. else
  203. {
  204. if (wrapY)
  205. previous = width * (height - 1);
  206. else
  207. previous = 0;
  208. }
  209. if (row < height - 1)
  210. next = width;
  211. else
  212. {
  213. if (wrapY)
  214. next = -(width * (height - 1));
  215. else
  216. next = 0;
  217. }
  218. // iterates between the columns
  219. for (uint32_t col = 0; col < width; col++)
  220. {
  221. w[1] = *(image + previous);
  222. w[4] = *image;
  223. w[7] = *(image + next);
  224. if (col > 0)
  225. {
  226. w[0] = *(image + previous - 1);
  227. w[3] = *(image - 1);
  228. w[6] = *(image + next - 1);
  229. }
  230. else
  231. {
  232. if (wrapX)
  233. {
  234. w[0] = *(image + previous + width - 1);
  235. w[3] = *(image + width - 1);
  236. w[6] = *(image + next + width - 1);
  237. }
  238. else
  239. {
  240. w[0] = w[1];
  241. w[3] = w[4];
  242. w[6] = w[7];
  243. }
  244. }
  245. if (col < width - 1)
  246. {
  247. w[2] = *(image + previous + 1);
  248. w[5] = *(image + 1);
  249. w[8] = *(image + next + 1);
  250. }
  251. else
  252. {
  253. if (wrapX)
  254. {
  255. w[2] = *(image + previous - width + 1);
  256. w[5] = *(image - width + 1);
  257. w[8] = *(image + next - width + 1);
  258. }
  259. else
  260. {
  261. w[2] = w[1];
  262. w[5] = w[4];
  263. w[8] = w[7];
  264. }
  265. }
  266. int pattern = 0;
  267. // computes the pattern to be used considering the neighbor pixels
  268. for (int k = 0, flag = 1; k < 9; k++)
  269. {
  270. // ignores the central pixel
  271. if (k == 4) continue;
  272. if (w[k] != w[4])
  273. if (isDifferent(w[4], w[k], trY, trU, trV, trA)) pattern |= flag;
  274. flag <<= 1;
  275. }
  276. switch (pattern)
  277. {
  278. case 0:
  279. case 1:
  280. case 4:
  281. case 32:
  282. case 128:
  283. case 5:
  284. case 132:
  285. case 160:
  286. case 33:
  287. case 129:
  288. case 36:
  289. case 133:
  290. case 164:
  291. case 161:
  292. case 37:
  293. case 165:
  294. MIX_00_4_3_1_2_1_1
  295. MIX_01_4_1_5_2_1_1
  296. MIX_10_4_7_3_2_1_1
  297. MIX_11_4_5_7_2_1_1
  298. break;
  299. case 2:
  300. case 34:
  301. case 130:
  302. case 162:
  303. MIX_00_4_0_3_2_1_1
  304. MIX_01_4_2_5_2_1_1
  305. MIX_10_4_7_3_2_1_1
  306. MIX_11_4_5_7_2_1_1
  307. break;
  308. case 16:
  309. case 17:
  310. case 48:
  311. case 49:
  312. MIX_00_4_3_1_2_1_1
  313. MIX_01_4_2_1_2_1_1
  314. MIX_10_4_7_3_2_1_1
  315. MIX_11_4_8_7_2_1_1
  316. break;
  317. case 64:
  318. case 65:
  319. case 68:
  320. case 69:
  321. MIX_00_4_3_1_2_1_1
  322. MIX_01_4_1_5_2_1_1
  323. MIX_10_4_6_3_2_1_1
  324. MIX_11_4_8_5_2_1_1
  325. break;
  326. case 8:
  327. case 12:
  328. case 136:
  329. case 140:
  330. MIX_00_4_0_1_2_1_1
  331. MIX_01_4_1_5_2_1_1
  332. MIX_10_4_6_7_2_1_1
  333. MIX_11_4_5_7_2_1_1
  334. break;
  335. case 3:
  336. case 35:
  337. case 131:
  338. case 163:
  339. MIX_00_4_3_3_1
  340. MIX_01_4_2_5_2_1_1
  341. MIX_10_4_7_3_2_1_1
  342. MIX_11_4_5_7_2_1_1
  343. break;
  344. case 6:
  345. case 38:
  346. case 134:
  347. case 166:
  348. MIX_00_4_0_3_2_1_1
  349. MIX_01_4_5_3_1
  350. MIX_10_4_7_3_2_1_1
  351. MIX_11_4_5_7_2_1_1
  352. break;
  353. case 20:
  354. case 21:
  355. case 52:
  356. case 53:
  357. MIX_00_4_3_1_2_1_1
  358. MIX_01_4_1_3_1
  359. MIX_10_4_7_3_2_1_1
  360. MIX_11_4_8_7_2_1_1
  361. break;
  362. case 144:
  363. case 145:
  364. case 176:
  365. case 177:
  366. MIX_00_4_3_1_2_1_1
  367. MIX_01_4_2_1_2_1_1
  368. MIX_10_4_7_3_2_1_1
  369. MIX_11_4_7_3_1
  370. break;
  371. case 192:
  372. case 193:
  373. case 196:
  374. case 197:
  375. MIX_00_4_3_1_2_1_1
  376. MIX_01_4_1_5_2_1_1
  377. MIX_10_4_6_3_2_1_1
  378. MIX_11_4_5_3_1
  379. break;
  380. case 96:
  381. case 97:
  382. case 100:
  383. case 101:
  384. MIX_00_4_3_1_2_1_1
  385. MIX_01_4_1_5_2_1_1
  386. MIX_10_4_3_3_1
  387. MIX_11_4_8_5_2_1_1
  388. break;
  389. case 40:
  390. case 44:
  391. case 168:
  392. case 172:
  393. MIX_00_4_0_1_2_1_1
  394. MIX_01_4_1_5_2_1_1
  395. MIX_10_4_7_3_1
  396. MIX_11_4_5_7_2_1_1
  397. break;
  398. case 9:
  399. case 13:
  400. case 137:
  401. case 141:
  402. MIX_00_4_1_3_1
  403. MIX_01_4_1_5_2_1_1
  404. MIX_10_4_6_7_2_1_1
  405. MIX_11_4_5_7_2_1_1
  406. break;
  407. case 18:
  408. case 50:
  409. MIX_00_4_0_3_2_1_1
  410. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  411. {
  412. MIX_01_4_2_3_1
  413. }
  414. else
  415. {
  416. MIX_01_4_1_5_2_1_1
  417. }
  418. MIX_10_4_7_3_2_1_1
  419. MIX_11_4_8_7_2_1_1
  420. break;
  421. case 80:
  422. case 81:
  423. MIX_00_4_3_1_2_1_1
  424. MIX_01_4_2_1_2_1_1
  425. MIX_10_4_6_3_2_1_1
  426. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  427. {
  428. MIX_11_4_8_3_1
  429. }
  430. else
  431. {
  432. MIX_11_4_5_7_2_1_1
  433. }
  434. break;
  435. case 72:
  436. case 76:
  437. MIX_00_4_0_1_2_1_1
  438. MIX_01_4_1_5_2_1_1
  439. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  440. {
  441. MIX_10_4_6_3_1
  442. }
  443. else
  444. {
  445. MIX_10_4_7_3_2_1_1
  446. }
  447. MIX_11_4_8_5_2_1_1
  448. break;
  449. case 10:
  450. case 138:
  451. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  452. {
  453. MIX_00_MIX_00_4_0_3_1
  454. }
  455. else
  456. {
  457. MIX_00_4_3_1_2_1_1
  458. }
  459. MIX_01_4_2_5_2_1_1
  460. MIX_10_4_6_7_2_1_1
  461. MIX_11_4_5_7_2_1_1
  462. break;
  463. case 66:
  464. MIX_00_4_0_3_2_1_1
  465. MIX_01_4_2_5_2_1_1
  466. MIX_10_4_6_3_2_1_1
  467. MIX_11_4_8_5_2_1_1
  468. break;
  469. case 24:
  470. MIX_00_4_0_1_2_1_1
  471. MIX_01_4_2_1_2_1_1
  472. MIX_10_4_6_7_2_1_1
  473. MIX_11_4_8_7_2_1_1
  474. break;
  475. case 7:
  476. case 39:
  477. case 135:
  478. MIX_00_4_3_3_1
  479. MIX_01_4_5_3_1
  480. MIX_10_4_7_3_2_1_1
  481. MIX_11_4_5_7_2_1_1
  482. break;
  483. case 148:
  484. case 149:
  485. case 180:
  486. MIX_00_4_3_1_2_1_1
  487. MIX_01_4_1_3_1
  488. MIX_10_4_7_3_2_1_1
  489. MIX_11_4_7_3_1
  490. break;
  491. case 224:
  492. case 228:
  493. case 225:
  494. MIX_00_4_3_1_2_1_1
  495. MIX_01_4_1_5_2_1_1
  496. MIX_10_4_3_3_1
  497. MIX_11_4_5_3_1
  498. break;
  499. case 41:
  500. case 169:
  501. case 45:
  502. MIX_00_4_1_3_1
  503. MIX_01_4_1_5_2_1_1
  504. MIX_10_4_7_3_1
  505. MIX_11_4_5_7_2_1_1
  506. break;
  507. case 22:
  508. case 54:
  509. MIX_00_4_0_3_2_1_1
  510. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  511. {
  512. MIX_01_4
  513. }
  514. else
  515. {
  516. MIX_01_4_1_5_2_1_1
  517. }
  518. MIX_10_4_7_3_2_1_1
  519. MIX_11_4_8_7_2_1_1
  520. break;
  521. case 208:
  522. case 209:
  523. MIX_00_4_3_1_2_1_1
  524. MIX_01_4_2_1_2_1_1
  525. MIX_10_4_6_3_2_1_1
  526. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  527. {
  528. MIX_11_4
  529. }
  530. else
  531. {
  532. MIX_11_4_5_7_2_1_1
  533. }
  534. break;
  535. case 104:
  536. case 108:
  537. MIX_00_4_0_1_2_1_1
  538. MIX_01_4_1_5_2_1_1
  539. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  540. {
  541. MIX_10_4
  542. }
  543. else
  544. {
  545. MIX_10_4_7_3_2_1_1
  546. }
  547. MIX_11_4_8_5_2_1_1
  548. break;
  549. case 11:
  550. case 139:
  551. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  552. {
  553. MIX_00_4
  554. }
  555. else
  556. {
  557. MIX_00_4_3_1_2_1_1
  558. }
  559. MIX_01_4_2_5_2_1_1
  560. MIX_10_4_6_7_2_1_1
  561. MIX_11_4_5_7_2_1_1
  562. break;
  563. case 19:
  564. case 51:
  565. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  566. {
  567. MIX_00_4_3_3_1
  568. MIX_01_4_2_3_1
  569. }
  570. else
  571. {
  572. MIX_00_4_1_3_5_2_1
  573. MIX_01_4_1_5_2_3_3
  574. }
  575. MIX_10_4_7_3_2_1_1
  576. MIX_11_4_8_7_2_1_1
  577. break;
  578. case 146:
  579. case 178:
  580. MIX_00_4_0_3_2_1_1
  581. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  582. {
  583. MIX_01_4_2_3_1
  584. MIX_11_4_7_3_1
  585. }
  586. else
  587. {
  588. MIX_01_4_1_5_2_3_3
  589. MIX_11_4_5_7_5_2_1
  590. }
  591. MIX_10_4_7_3_2_1_1
  592. break;
  593. case 84:
  594. case 85:
  595. MIX_00_4_3_1_2_1_1
  596. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  597. {
  598. MIX_01_4_1_3_1
  599. MIX_11_4_8_3_1
  600. }
  601. else
  602. {
  603. MIX_01_4_5_1_5_2_1
  604. MIX_11_4_5_7_2_3_3
  605. }
  606. MIX_10_4_6_3_2_1_1
  607. break;
  608. case 112:
  609. case 113:
  610. MIX_00_4_3_1_2_1_1
  611. MIX_01_4_2_1_2_1_1
  612. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  613. {
  614. MIX_10_4_3_3_1
  615. MIX_11_4_8_3_1
  616. }
  617. else
  618. {
  619. MIX_10_4_7_3_5_2_1
  620. MIX_11_4_5_7_2_3_3
  621. }
  622. break;
  623. case 200:
  624. case 204:
  625. MIX_00_4_0_1_2_1_1
  626. MIX_01_4_1_5_2_1_1
  627. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  628. {
  629. MIX_10_4_6_3_1
  630. MIX_11_4_5_3_1
  631. }
  632. else
  633. {
  634. MIX_10_4_7_3_2_3_3
  635. MIX_11_4_7_5_5_2_1
  636. }
  637. break;
  638. case 73:
  639. case 77:
  640. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  641. {
  642. MIX_00_4_1_3_1
  643. MIX_10_4_6_3_1
  644. }
  645. else
  646. {
  647. MIX_00_4_3_1_5_2_1
  648. MIX_10_4_7_3_2_3_3
  649. }
  650. MIX_01_4_1_5_2_1_1
  651. MIX_11_4_8_5_2_1_1
  652. break;
  653. case 42:
  654. case 170:
  655. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  656. {
  657. MIX_00_MIX_00_4_0_3_1
  658. MIX_10_4_7_3_1
  659. }
  660. else
  661. {
  662. MIX_00_4_3_1_2_3_3
  663. MIX_10_4_3_7_5_2_1
  664. }
  665. MIX_01_4_2_5_2_1_1
  666. MIX_11_4_5_7_2_1_1
  667. break;
  668. case 14:
  669. case 142:
  670. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  671. {
  672. MIX_00_MIX_00_4_0_3_1
  673. MIX_01_4_5_3_1
  674. }
  675. else
  676. {
  677. MIX_00_4_3_1_2_3_3
  678. MIX_01_4_1_5_5_2_1
  679. }
  680. MIX_10_4_6_7_2_1_1
  681. MIX_11_4_5_7_2_1_1
  682. break;
  683. case 67:
  684. MIX_00_4_3_3_1
  685. MIX_01_4_2_5_2_1_1
  686. MIX_10_4_6_3_2_1_1
  687. MIX_11_4_8_5_2_1_1
  688. break;
  689. case 70:
  690. MIX_00_4_0_3_2_1_1
  691. MIX_01_4_5_3_1
  692. MIX_10_4_6_3_2_1_1
  693. MIX_11_4_8_5_2_1_1
  694. break;
  695. case 28:
  696. MIX_00_4_0_1_2_1_1
  697. MIX_01_4_1_3_1
  698. MIX_10_4_6_7_2_1_1
  699. MIX_11_4_8_7_2_1_1
  700. break;
  701. case 152:
  702. MIX_00_4_0_1_2_1_1
  703. MIX_01_4_2_1_2_1_1
  704. MIX_10_4_6_7_2_1_1
  705. MIX_11_4_7_3_1
  706. break;
  707. case 194:
  708. MIX_00_4_0_3_2_1_1
  709. MIX_01_4_2_5_2_1_1
  710. MIX_10_4_6_3_2_1_1
  711. MIX_11_4_5_3_1
  712. break;
  713. case 98:
  714. MIX_00_4_0_3_2_1_1
  715. MIX_01_4_2_5_2_1_1
  716. MIX_10_4_3_3_1
  717. MIX_11_4_8_5_2_1_1
  718. break;
  719. case 56:
  720. MIX_00_4_0_1_2_1_1
  721. MIX_01_4_2_1_2_1_1
  722. MIX_10_4_7_3_1
  723. MIX_11_4_8_7_2_1_1
  724. break;
  725. case 25:
  726. MIX_00_4_1_3_1
  727. MIX_01_4_2_1_2_1_1
  728. MIX_10_4_6_7_2_1_1
  729. MIX_11_4_8_7_2_1_1
  730. break;
  731. case 26:
  732. case 31:
  733. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  734. {
  735. MIX_00_4
  736. }
  737. else
  738. {
  739. MIX_00_4_3_1_2_1_1
  740. }
  741. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  742. {
  743. MIX_01_4
  744. }
  745. else
  746. {
  747. MIX_01_4_1_5_2_1_1
  748. }
  749. MIX_10_4_6_7_2_1_1
  750. MIX_11_4_8_7_2_1_1
  751. break;
  752. case 82:
  753. case 214:
  754. MIX_00_4_0_3_2_1_1
  755. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  756. {
  757. MIX_01_4
  758. }
  759. else
  760. {
  761. MIX_01_4_1_5_2_1_1
  762. }
  763. MIX_10_4_6_3_2_1_1
  764. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  765. {
  766. MIX_11_4
  767. }
  768. else
  769. {
  770. MIX_11_4_5_7_2_1_1
  771. }
  772. break;
  773. case 88:
  774. case 248:
  775. MIX_00_4_0_1_2_1_1
  776. MIX_01_4_2_1_2_1_1
  777. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  778. {
  779. MIX_10_4
  780. }
  781. else
  782. {
  783. MIX_10_4_7_3_2_1_1
  784. }
  785. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  786. {
  787. MIX_11_4
  788. }
  789. else
  790. {
  791. MIX_11_4_5_7_2_1_1
  792. }
  793. break;
  794. case 74:
  795. case 107:
  796. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  797. {
  798. MIX_00_4
  799. }
  800. else
  801. {
  802. MIX_00_4_3_1_2_1_1
  803. }
  804. MIX_01_4_2_5_2_1_1
  805. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  806. {
  807. MIX_10_4
  808. }
  809. else
  810. {
  811. MIX_10_4_7_3_2_1_1
  812. }
  813. MIX_11_4_8_5_2_1_1
  814. break;
  815. case 27:
  816. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  817. {
  818. MIX_00_4
  819. }
  820. else
  821. {
  822. MIX_00_4_3_1_2_1_1
  823. }
  824. MIX_01_4_2_3_1
  825. MIX_10_4_6_7_2_1_1
  826. MIX_11_4_8_7_2_1_1
  827. break;
  828. case 86:
  829. MIX_00_4_0_3_2_1_1
  830. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  831. {
  832. MIX_01_4
  833. }
  834. else
  835. {
  836. MIX_01_4_1_5_2_1_1
  837. }
  838. MIX_10_4_6_3_2_1_1
  839. MIX_11_4_8_3_1
  840. break;
  841. case 216:
  842. MIX_00_4_0_1_2_1_1
  843. MIX_01_4_2_1_2_1_1
  844. MIX_10_4_6_3_1
  845. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  846. {
  847. MIX_11_4
  848. }
  849. else
  850. {
  851. MIX_11_4_5_7_2_1_1
  852. }
  853. break;
  854. case 106:
  855. MIX_00_MIX_00_4_0_3_1
  856. MIX_01_4_2_5_2_1_1
  857. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  858. {
  859. MIX_10_4
  860. }
  861. else
  862. {
  863. MIX_10_4_7_3_2_1_1
  864. }
  865. MIX_11_4_8_5_2_1_1
  866. break;
  867. case 30:
  868. MIX_00_MIX_00_4_0_3_1
  869. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  870. {
  871. MIX_01_4
  872. }
  873. else
  874. {
  875. MIX_01_4_1_5_2_1_1
  876. }
  877. MIX_10_4_6_7_2_1_1
  878. MIX_11_4_8_7_2_1_1
  879. break;
  880. case 210:
  881. MIX_00_4_0_3_2_1_1
  882. MIX_01_4_2_3_1
  883. MIX_10_4_6_3_2_1_1
  884. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  885. {
  886. MIX_11_4
  887. }
  888. else
  889. {
  890. MIX_11_4_5_7_2_1_1
  891. }
  892. break;
  893. case 120:
  894. MIX_00_4_0_1_2_1_1
  895. MIX_01_4_2_1_2_1_1
  896. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  897. {
  898. MIX_10_4
  899. }
  900. else
  901. {
  902. MIX_10_4_7_3_2_1_1
  903. }
  904. MIX_11_4_8_3_1
  905. break;
  906. case 75:
  907. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  908. {
  909. MIX_00_4
  910. }
  911. else
  912. {
  913. MIX_00_4_3_1_2_1_1
  914. }
  915. MIX_01_4_2_5_2_1_1
  916. MIX_10_4_6_3_1
  917. MIX_11_4_8_5_2_1_1
  918. break;
  919. case 29:
  920. MIX_00_4_1_3_1
  921. MIX_01_4_1_3_1
  922. MIX_10_4_6_7_2_1_1
  923. MIX_11_4_8_7_2_1_1
  924. break;
  925. case 198:
  926. MIX_00_4_0_3_2_1_1
  927. MIX_01_4_5_3_1
  928. MIX_10_4_6_3_2_1_1
  929. MIX_11_4_5_3_1
  930. break;
  931. case 184:
  932. MIX_00_4_0_1_2_1_1
  933. MIX_01_4_2_1_2_1_1
  934. MIX_10_4_7_3_1
  935. MIX_11_4_7_3_1
  936. break;
  937. case 99:
  938. MIX_00_4_3_3_1
  939. MIX_01_4_2_5_2_1_1
  940. MIX_10_4_3_3_1
  941. MIX_11_4_8_5_2_1_1
  942. break;
  943. case 57:
  944. MIX_00_4_1_3_1
  945. MIX_01_4_2_1_2_1_1
  946. MIX_10_4_7_3_1
  947. MIX_11_4_8_7_2_1_1
  948. break;
  949. case 71:
  950. MIX_00_4_3_3_1
  951. MIX_01_4_5_3_1
  952. MIX_10_4_6_3_2_1_1
  953. MIX_11_4_8_5_2_1_1
  954. break;
  955. case 156:
  956. MIX_00_4_0_1_2_1_1
  957. MIX_01_4_1_3_1
  958. MIX_10_4_6_7_2_1_1
  959. MIX_11_4_7_3_1
  960. break;
  961. case 226:
  962. MIX_00_4_0_3_2_1_1
  963. MIX_01_4_2_5_2_1_1
  964. MIX_10_4_3_3_1
  965. MIX_11_4_5_3_1
  966. break;
  967. case 60:
  968. MIX_00_4_0_1_2_1_1
  969. MIX_01_4_1_3_1
  970. MIX_10_4_7_3_1
  971. MIX_11_4_8_7_2_1_1
  972. break;
  973. case 195:
  974. MIX_00_4_3_3_1
  975. MIX_01_4_2_5_2_1_1
  976. MIX_10_4_6_3_2_1_1
  977. MIX_11_4_5_3_1
  978. break;
  979. case 102:
  980. MIX_00_4_0_3_2_1_1
  981. MIX_01_4_5_3_1
  982. MIX_10_4_3_3_1
  983. MIX_11_4_8_5_2_1_1
  984. break;
  985. case 153:
  986. MIX_00_4_1_3_1
  987. MIX_01_4_2_1_2_1_1
  988. MIX_10_4_6_7_2_1_1
  989. MIX_11_4_7_3_1
  990. break;
  991. case 58:
  992. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  993. {
  994. MIX_00_MIX_00_4_0_3_1
  995. }
  996. else
  997. {
  998. MIX_00_4_3_1_6_1_1
  999. }
  1000. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1001. {
  1002. MIX_01_4_2_3_1
  1003. }
  1004. else
  1005. {
  1006. MIX_01_4_1_5_6_1_1
  1007. }
  1008. MIX_10_4_7_3_1
  1009. MIX_11_4_8_7_2_1_1
  1010. break;
  1011. case 83:
  1012. MIX_00_4_3_3_1
  1013. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1014. {
  1015. MIX_01_4_2_3_1
  1016. }
  1017. else
  1018. {
  1019. MIX_01_4_1_5_6_1_1
  1020. }
  1021. MIX_10_4_6_3_2_1_1
  1022. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1023. {
  1024. MIX_11_4_8_3_1
  1025. }
  1026. else
  1027. {
  1028. MIX_11_4_5_7_6_1_1
  1029. }
  1030. break;
  1031. case 92:
  1032. MIX_00_4_0_1_2_1_1
  1033. MIX_01_4_1_3_1
  1034. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1035. {
  1036. MIX_10_4_6_3_1
  1037. }
  1038. else
  1039. {
  1040. MIX_10_4_7_3_6_1_1
  1041. }
  1042. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1043. {
  1044. MIX_11_4_8_3_1
  1045. }
  1046. else
  1047. {
  1048. MIX_11_4_5_7_6_1_1
  1049. }
  1050. break;
  1051. case 202:
  1052. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1053. {
  1054. MIX_00_MIX_00_4_0_3_1
  1055. }
  1056. else
  1057. {
  1058. MIX_00_4_3_1_6_1_1
  1059. }
  1060. MIX_01_4_2_5_2_1_1
  1061. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1062. {
  1063. MIX_10_4_6_3_1
  1064. }
  1065. else
  1066. {
  1067. MIX_10_4_7_3_6_1_1
  1068. }
  1069. MIX_11_4_5_3_1
  1070. break;
  1071. case 78:
  1072. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1073. {
  1074. MIX_00_MIX_00_4_0_3_1
  1075. }
  1076. else
  1077. {
  1078. MIX_00_4_3_1_6_1_1
  1079. }
  1080. MIX_01_4_5_3_1
  1081. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1082. {
  1083. MIX_10_4_6_3_1
  1084. }
  1085. else
  1086. {
  1087. MIX_10_4_7_3_6_1_1
  1088. }
  1089. MIX_11_4_8_5_2_1_1
  1090. break;
  1091. case 154:
  1092. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1093. {
  1094. MIX_00_MIX_00_4_0_3_1
  1095. }
  1096. else
  1097. {
  1098. MIX_00_4_3_1_6_1_1
  1099. }
  1100. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1101. {
  1102. MIX_01_4_2_3_1
  1103. }
  1104. else
  1105. {
  1106. MIX_01_4_1_5_6_1_1
  1107. }
  1108. MIX_10_4_6_7_2_1_1
  1109. MIX_11_4_7_3_1
  1110. break;
  1111. case 114:
  1112. MIX_00_4_0_3_2_1_1
  1113. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1114. {
  1115. MIX_01_4_2_3_1
  1116. }
  1117. else
  1118. {
  1119. MIX_01_4_1_5_6_1_1
  1120. }
  1121. MIX_10_4_3_3_1
  1122. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1123. {
  1124. MIX_11_4_8_3_1
  1125. }
  1126. else
  1127. {
  1128. MIX_11_4_5_7_6_1_1
  1129. }
  1130. break;
  1131. case 89:
  1132. MIX_00_4_1_3_1
  1133. MIX_01_4_2_1_2_1_1
  1134. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1135. {
  1136. MIX_10_4_6_3_1
  1137. }
  1138. else
  1139. {
  1140. MIX_10_4_7_3_6_1_1
  1141. }
  1142. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1143. {
  1144. MIX_11_4_8_3_1
  1145. }
  1146. else
  1147. {
  1148. MIX_11_4_5_7_6_1_1
  1149. }
  1150. break;
  1151. case 90:
  1152. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1153. {
  1154. MIX_00_MIX_00_4_0_3_1
  1155. }
  1156. else
  1157. {
  1158. MIX_00_4_3_1_6_1_1
  1159. }
  1160. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1161. {
  1162. MIX_01_4_2_3_1
  1163. }
  1164. else
  1165. {
  1166. MIX_01_4_1_5_6_1_1
  1167. }
  1168. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1169. {
  1170. MIX_10_4_6_3_1
  1171. }
  1172. else
  1173. {
  1174. MIX_10_4_7_3_6_1_1
  1175. }
  1176. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1177. {
  1178. MIX_11_4_8_3_1
  1179. }
  1180. else
  1181. {
  1182. MIX_11_4_5_7_6_1_1
  1183. }
  1184. break;
  1185. case 55:
  1186. case 23:
  1187. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1188. {
  1189. MIX_00_4_3_3_1
  1190. MIX_01_4
  1191. }
  1192. else
  1193. {
  1194. MIX_00_4_1_3_5_2_1
  1195. MIX_01_4_1_5_2_3_3
  1196. }
  1197. MIX_10_4_7_3_2_1_1
  1198. MIX_11_4_8_7_2_1_1
  1199. break;
  1200. case 182:
  1201. case 150:
  1202. MIX_00_4_0_3_2_1_1
  1203. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1204. {
  1205. MIX_01_4
  1206. MIX_11_4_7_3_1
  1207. }
  1208. else
  1209. {
  1210. MIX_01_4_1_5_2_3_3
  1211. MIX_11_4_5_7_5_2_1
  1212. }
  1213. MIX_10_4_7_3_2_1_1
  1214. break;
  1215. case 213:
  1216. case 212:
  1217. MIX_00_4_3_1_2_1_1
  1218. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1219. {
  1220. MIX_01_4_1_3_1
  1221. MIX_11_4
  1222. }
  1223. else
  1224. {
  1225. MIX_01_4_5_1_5_2_1
  1226. MIX_11_4_5_7_2_3_3
  1227. }
  1228. MIX_10_4_6_3_2_1_1
  1229. break;
  1230. case 241:
  1231. case 240:
  1232. MIX_00_4_3_1_2_1_1
  1233. MIX_01_4_2_1_2_1_1
  1234. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1235. {
  1236. MIX_10_4_3_3_1
  1237. MIX_11_4
  1238. }
  1239. else
  1240. {
  1241. MIX_10_4_7_3_5_2_1
  1242. MIX_11_4_5_7_2_3_3
  1243. }
  1244. break;
  1245. case 236:
  1246. case 232:
  1247. MIX_00_4_0_1_2_1_1
  1248. MIX_01_4_1_5_2_1_1
  1249. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1250. {
  1251. MIX_10_4
  1252. MIX_11_4_5_3_1
  1253. }
  1254. else
  1255. {
  1256. MIX_10_4_7_3_2_3_3
  1257. MIX_11_4_7_5_5_2_1
  1258. }
  1259. break;
  1260. case 109:
  1261. case 105:
  1262. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1263. {
  1264. MIX_00_4_1_3_1
  1265. MIX_10_4
  1266. }
  1267. else
  1268. {
  1269. MIX_00_4_3_1_5_2_1
  1270. MIX_10_4_7_3_2_3_3
  1271. }
  1272. MIX_01_4_1_5_2_1_1
  1273. MIX_11_4_8_5_2_1_1
  1274. break;
  1275. case 171:
  1276. case 43:
  1277. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1278. {
  1279. MIX_00_4
  1280. MIX_10_4_7_3_1
  1281. }
  1282. else
  1283. {
  1284. MIX_00_4_3_1_2_3_3
  1285. MIX_10_4_3_7_5_2_1
  1286. }
  1287. MIX_01_4_2_5_2_1_1
  1288. MIX_11_4_5_7_2_1_1
  1289. break;
  1290. case 143:
  1291. case 15:
  1292. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1293. {
  1294. MIX_00_4
  1295. MIX_01_4_5_3_1
  1296. }
  1297. else
  1298. {
  1299. MIX_00_4_3_1_2_3_3
  1300. MIX_01_4_1_5_5_2_1
  1301. }
  1302. MIX_10_4_6_7_2_1_1
  1303. MIX_11_4_5_7_2_1_1
  1304. break;
  1305. case 124:
  1306. MIX_00_4_0_1_2_1_1
  1307. MIX_01_4_1_3_1
  1308. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1309. {
  1310. MIX_10_4
  1311. }
  1312. else
  1313. {
  1314. MIX_10_4_7_3_2_1_1
  1315. }
  1316. MIX_11_4_8_3_1
  1317. break;
  1318. case 203:
  1319. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1320. {
  1321. MIX_00_4
  1322. }
  1323. else
  1324. {
  1325. MIX_00_4_3_1_2_1_1
  1326. }
  1327. MIX_01_4_2_5_2_1_1
  1328. MIX_10_4_6_3_1
  1329. MIX_11_4_5_3_1
  1330. break;
  1331. case 62:
  1332. MIX_00_MIX_00_4_0_3_1
  1333. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1334. {
  1335. MIX_01_4
  1336. }
  1337. else
  1338. {
  1339. MIX_01_4_1_5_2_1_1
  1340. }
  1341. MIX_10_4_7_3_1
  1342. MIX_11_4_8_7_2_1_1
  1343. break;
  1344. case 211:
  1345. MIX_00_4_3_3_1
  1346. MIX_01_4_2_3_1
  1347. MIX_10_4_6_3_2_1_1
  1348. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1349. {
  1350. MIX_11_4
  1351. }
  1352. else
  1353. {
  1354. MIX_11_4_5_7_2_1_1
  1355. }
  1356. break;
  1357. case 118:
  1358. MIX_00_4_0_3_2_1_1
  1359. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1360. {
  1361. MIX_01_4
  1362. }
  1363. else
  1364. {
  1365. MIX_01_4_1_5_2_1_1
  1366. }
  1367. MIX_10_4_3_3_1
  1368. MIX_11_4_8_3_1
  1369. break;
  1370. case 217:
  1371. MIX_00_4_1_3_1
  1372. MIX_01_4_2_1_2_1_1
  1373. MIX_10_4_6_3_1
  1374. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1375. {
  1376. MIX_11_4
  1377. }
  1378. else
  1379. {
  1380. MIX_11_4_5_7_2_1_1
  1381. }
  1382. break;
  1383. case 110:
  1384. MIX_00_MIX_00_4_0_3_1
  1385. MIX_01_4_5_3_1
  1386. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1387. {
  1388. MIX_10_4
  1389. }
  1390. else
  1391. {
  1392. MIX_10_4_7_3_2_1_1
  1393. }
  1394. MIX_11_4_8_5_2_1_1
  1395. break;
  1396. case 155:
  1397. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1398. {
  1399. MIX_00_4
  1400. }
  1401. else
  1402. {
  1403. MIX_00_4_3_1_2_1_1
  1404. }
  1405. MIX_01_4_2_3_1
  1406. MIX_10_4_6_7_2_1_1
  1407. MIX_11_4_7_3_1
  1408. break;
  1409. case 188:
  1410. MIX_00_4_0_1_2_1_1
  1411. MIX_01_4_1_3_1
  1412. MIX_10_4_7_3_1
  1413. MIX_11_4_7_3_1
  1414. break;
  1415. case 185:
  1416. MIX_00_4_1_3_1
  1417. MIX_01_4_2_1_2_1_1
  1418. MIX_10_4_7_3_1
  1419. MIX_11_4_7_3_1
  1420. break;
  1421. case 61:
  1422. MIX_00_4_1_3_1
  1423. MIX_01_4_1_3_1
  1424. MIX_10_4_7_3_1
  1425. MIX_11_4_8_7_2_1_1
  1426. break;
  1427. case 157:
  1428. MIX_00_4_1_3_1
  1429. MIX_01_4_1_3_1
  1430. MIX_10_4_6_7_2_1_1
  1431. MIX_11_4_7_3_1
  1432. break;
  1433. case 103:
  1434. MIX_00_4_3_3_1
  1435. MIX_01_4_5_3_1
  1436. MIX_10_4_3_3_1
  1437. MIX_11_4_8_5_2_1_1
  1438. break;
  1439. case 227:
  1440. MIX_00_4_3_3_1
  1441. MIX_01_4_2_5_2_1_1
  1442. MIX_10_4_3_3_1
  1443. MIX_11_4_5_3_1
  1444. break;
  1445. case 230:
  1446. MIX_00_4_0_3_2_1_1
  1447. MIX_01_4_5_3_1
  1448. MIX_10_4_3_3_1
  1449. MIX_11_4_5_3_1
  1450. break;
  1451. case 199:
  1452. MIX_00_4_3_3_1
  1453. MIX_01_4_5_3_1
  1454. MIX_10_4_6_3_2_1_1
  1455. MIX_11_4_5_3_1
  1456. break;
  1457. case 220:
  1458. MIX_00_4_0_1_2_1_1
  1459. MIX_01_4_1_3_1
  1460. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1461. {
  1462. MIX_10_4_6_3_1
  1463. }
  1464. else
  1465. {
  1466. MIX_10_4_7_3_6_1_1
  1467. }
  1468. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1469. {
  1470. MIX_11_4
  1471. }
  1472. else
  1473. {
  1474. MIX_11_4_5_7_2_1_1
  1475. }
  1476. break;
  1477. case 158:
  1478. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1479. {
  1480. MIX_00_MIX_00_4_0_3_1
  1481. }
  1482. else
  1483. {
  1484. MIX_00_4_3_1_6_1_1
  1485. }
  1486. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1487. {
  1488. MIX_01_4
  1489. }
  1490. else
  1491. {
  1492. MIX_01_4_1_5_2_1_1
  1493. }
  1494. MIX_10_4_6_7_2_1_1
  1495. MIX_11_4_7_3_1
  1496. break;
  1497. case 234:
  1498. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1499. {
  1500. MIX_00_MIX_00_4_0_3_1
  1501. }
  1502. else
  1503. {
  1504. MIX_00_4_3_1_6_1_1
  1505. }
  1506. MIX_01_4_2_5_2_1_1
  1507. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1508. {
  1509. MIX_10_4
  1510. }
  1511. else
  1512. {
  1513. MIX_10_4_7_3_2_1_1
  1514. }
  1515. MIX_11_4_5_3_1
  1516. break;
  1517. case 242:
  1518. MIX_00_4_0_3_2_1_1
  1519. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1520. {
  1521. MIX_01_4_2_3_1
  1522. }
  1523. else
  1524. {
  1525. MIX_01_4_1_5_6_1_1
  1526. }
  1527. MIX_10_4_3_3_1
  1528. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1529. {
  1530. MIX_11_4
  1531. }
  1532. else
  1533. {
  1534. MIX_11_4_5_7_2_1_1
  1535. }
  1536. break;
  1537. case 59:
  1538. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1539. {
  1540. MIX_00_4
  1541. }
  1542. else
  1543. {
  1544. MIX_00_4_3_1_2_1_1
  1545. }
  1546. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1547. {
  1548. MIX_01_4_2_3_1
  1549. }
  1550. else
  1551. {
  1552. MIX_01_4_1_5_6_1_1
  1553. }
  1554. MIX_10_4_7_3_1
  1555. MIX_11_4_8_7_2_1_1
  1556. break;
  1557. case 121:
  1558. MIX_00_4_1_3_1
  1559. MIX_01_4_2_1_2_1_1
  1560. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1561. {
  1562. MIX_10_4
  1563. }
  1564. else
  1565. {
  1566. MIX_10_4_7_3_2_1_1
  1567. }
  1568. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1569. {
  1570. MIX_11_4_8_3_1
  1571. }
  1572. else
  1573. {
  1574. MIX_11_4_5_7_6_1_1
  1575. }
  1576. break;
  1577. case 87:
  1578. MIX_00_4_3_3_1
  1579. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1580. {
  1581. MIX_01_4
  1582. }
  1583. else
  1584. {
  1585. MIX_01_4_1_5_2_1_1
  1586. }
  1587. MIX_10_4_6_3_2_1_1
  1588. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1589. {
  1590. MIX_11_4_8_3_1
  1591. }
  1592. else
  1593. {
  1594. MIX_11_4_5_7_6_1_1
  1595. }
  1596. break;
  1597. case 79:
  1598. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1599. {
  1600. MIX_00_4
  1601. }
  1602. else
  1603. {
  1604. MIX_00_4_3_1_2_1_1
  1605. }
  1606. MIX_01_4_5_3_1
  1607. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1608. {
  1609. MIX_10_4_6_3_1
  1610. }
  1611. else
  1612. {
  1613. MIX_10_4_7_3_6_1_1
  1614. }
  1615. MIX_11_4_8_5_2_1_1
  1616. break;
  1617. case 122:
  1618. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1619. {
  1620. MIX_00_MIX_00_4_0_3_1
  1621. }
  1622. else
  1623. {
  1624. MIX_00_4_3_1_6_1_1
  1625. }
  1626. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1627. {
  1628. MIX_01_4_2_3_1
  1629. }
  1630. else
  1631. {
  1632. MIX_01_4_1_5_6_1_1
  1633. }
  1634. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1635. {
  1636. MIX_10_4
  1637. }
  1638. else
  1639. {
  1640. MIX_10_4_7_3_2_1_1
  1641. }
  1642. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1643. {
  1644. MIX_11_4_8_3_1
  1645. }
  1646. else
  1647. {
  1648. MIX_11_4_5_7_6_1_1
  1649. }
  1650. break;
  1651. case 94:
  1652. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1653. {
  1654. MIX_00_MIX_00_4_0_3_1
  1655. }
  1656. else
  1657. {
  1658. MIX_00_4_3_1_6_1_1
  1659. }
  1660. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1661. {
  1662. MIX_01_4
  1663. }
  1664. else
  1665. {
  1666. MIX_01_4_1_5_2_1_1
  1667. }
  1668. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1669. {
  1670. MIX_10_4_6_3_1
  1671. }
  1672. else
  1673. {
  1674. MIX_10_4_7_3_6_1_1
  1675. }
  1676. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1677. {
  1678. MIX_11_4_8_3_1
  1679. }
  1680. else
  1681. {
  1682. MIX_11_4_5_7_6_1_1
  1683. }
  1684. break;
  1685. case 218:
  1686. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1687. {
  1688. MIX_00_MIX_00_4_0_3_1
  1689. }
  1690. else
  1691. {
  1692. MIX_00_4_3_1_6_1_1
  1693. }
  1694. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1695. {
  1696. MIX_01_4_2_3_1
  1697. }
  1698. else
  1699. {
  1700. MIX_01_4_1_5_6_1_1
  1701. }
  1702. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1703. {
  1704. MIX_10_4_6_3_1
  1705. }
  1706. else
  1707. {
  1708. MIX_10_4_7_3_6_1_1
  1709. }
  1710. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1711. {
  1712. MIX_11_4
  1713. }
  1714. else
  1715. {
  1716. MIX_11_4_5_7_2_1_1
  1717. }
  1718. break;
  1719. case 91:
  1720. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1721. {
  1722. MIX_00_4
  1723. }
  1724. else
  1725. {
  1726. MIX_00_4_3_1_2_1_1
  1727. }
  1728. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1729. {
  1730. MIX_01_4_2_3_1
  1731. }
  1732. else
  1733. {
  1734. MIX_01_4_1_5_6_1_1
  1735. }
  1736. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1737. {
  1738. MIX_10_4_6_3_1
  1739. }
  1740. else
  1741. {
  1742. MIX_10_4_7_3_6_1_1
  1743. }
  1744. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1745. {
  1746. MIX_11_4_8_3_1
  1747. }
  1748. else
  1749. {
  1750. MIX_11_4_5_7_6_1_1
  1751. }
  1752. break;
  1753. case 229:
  1754. MIX_00_4_3_1_2_1_1
  1755. MIX_01_4_1_5_2_1_1
  1756. MIX_10_4_3_3_1
  1757. MIX_11_4_5_3_1
  1758. break;
  1759. case 167:
  1760. MIX_00_4_3_3_1
  1761. MIX_01_4_5_3_1
  1762. MIX_10_4_7_3_2_1_1
  1763. MIX_11_4_5_7_2_1_1
  1764. break;
  1765. case 173:
  1766. MIX_00_4_1_3_1
  1767. MIX_01_4_1_5_2_1_1
  1768. MIX_10_4_7_3_1
  1769. MIX_11_4_5_7_2_1_1
  1770. break;
  1771. case 181:
  1772. MIX_00_4_3_1_2_1_1
  1773. MIX_01_4_1_3_1
  1774. MIX_10_4_7_3_2_1_1
  1775. MIX_11_4_7_3_1
  1776. break;
  1777. case 186:
  1778. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1779. {
  1780. MIX_00_MIX_00_4_0_3_1
  1781. }
  1782. else
  1783. {
  1784. MIX_00_4_3_1_6_1_1
  1785. }
  1786. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1787. {
  1788. MIX_01_4_2_3_1
  1789. }
  1790. else
  1791. {
  1792. MIX_01_4_1_5_6_1_1
  1793. }
  1794. MIX_10_4_7_3_1
  1795. MIX_11_4_7_3_1
  1796. break;
  1797. case 115:
  1798. MIX_00_4_3_3_1
  1799. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1800. {
  1801. MIX_01_4_2_3_1
  1802. }
  1803. else
  1804. {
  1805. MIX_01_4_1_5_6_1_1
  1806. }
  1807. MIX_10_4_3_3_1
  1808. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1809. {
  1810. MIX_11_4_8_3_1
  1811. }
  1812. else
  1813. {
  1814. MIX_11_4_5_7_6_1_1
  1815. }
  1816. break;
  1817. case 93:
  1818. MIX_00_4_1_3_1
  1819. MIX_01_4_1_3_1
  1820. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1821. {
  1822. MIX_10_4_6_3_1
  1823. }
  1824. else
  1825. {
  1826. MIX_10_4_7_3_6_1_1
  1827. }
  1828. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1829. {
  1830. MIX_11_4_8_3_1
  1831. }
  1832. else
  1833. {
  1834. MIX_11_4_5_7_6_1_1
  1835. }
  1836. break;
  1837. case 206:
  1838. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1839. {
  1840. MIX_00_MIX_00_4_0_3_1
  1841. }
  1842. else
  1843. {
  1844. MIX_00_4_3_1_6_1_1
  1845. }
  1846. MIX_01_4_5_3_1
  1847. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1848. {
  1849. MIX_10_4_6_3_1
  1850. }
  1851. else
  1852. {
  1853. MIX_10_4_7_3_6_1_1
  1854. }
  1855. MIX_11_4_5_3_1
  1856. break;
  1857. case 205:
  1858. case 201:
  1859. MIX_00_4_1_3_1
  1860. MIX_01_4_1_5_2_1_1
  1861. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1862. {
  1863. MIX_10_4_6_3_1
  1864. }
  1865. else
  1866. {
  1867. MIX_10_4_7_3_6_1_1
  1868. }
  1869. MIX_11_4_5_3_1
  1870. break;
  1871. case 174:
  1872. case 46:
  1873. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1874. {
  1875. MIX_00_MIX_00_4_0_3_1
  1876. }
  1877. else
  1878. {
  1879. MIX_00_4_3_1_6_1_1
  1880. }
  1881. MIX_01_4_5_3_1
  1882. MIX_10_4_7_3_1
  1883. MIX_11_4_5_7_2_1_1
  1884. break;
  1885. case 179:
  1886. case 147:
  1887. MIX_00_4_3_3_1
  1888. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1889. {
  1890. MIX_01_4_2_3_1
  1891. }
  1892. else
  1893. {
  1894. MIX_01_4_1_5_6_1_1
  1895. }
  1896. MIX_10_4_7_3_2_1_1
  1897. MIX_11_4_7_3_1
  1898. break;
  1899. case 117:
  1900. case 116:
  1901. MIX_00_4_3_1_2_1_1
  1902. MIX_01_4_1_3_1
  1903. MIX_10_4_3_3_1
  1904. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1905. {
  1906. MIX_11_4_8_3_1
  1907. }
  1908. else
  1909. {
  1910. MIX_11_4_5_7_6_1_1
  1911. }
  1912. break;
  1913. case 189:
  1914. MIX_00_4_1_3_1
  1915. MIX_01_4_1_3_1
  1916. MIX_10_4_7_3_1
  1917. MIX_11_4_7_3_1
  1918. break;
  1919. case 231:
  1920. MIX_00_4_3_3_1
  1921. MIX_01_4_5_3_1
  1922. MIX_10_4_3_3_1
  1923. MIX_11_4_5_3_1
  1924. break;
  1925. case 126:
  1926. MIX_00_MIX_00_4_0_3_1
  1927. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  1928. {
  1929. MIX_01_4
  1930. }
  1931. else
  1932. {
  1933. MIX_01_4_1_5_2_1_1
  1934. }
  1935. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1936. {
  1937. MIX_10_4
  1938. }
  1939. else
  1940. {
  1941. MIX_10_4_7_3_2_1_1
  1942. }
  1943. MIX_11_4_8_3_1
  1944. break;
  1945. case 219:
  1946. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1947. {
  1948. MIX_00_4
  1949. }
  1950. else
  1951. {
  1952. MIX_00_4_3_1_2_1_1
  1953. }
  1954. MIX_01_4_2_3_1
  1955. MIX_10_4_6_3_1
  1956. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1957. {
  1958. MIX_11_4
  1959. }
  1960. else
  1961. {
  1962. MIX_11_4_5_7_2_1_1
  1963. }
  1964. break;
  1965. case 125:
  1966. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  1967. {
  1968. MIX_00_4_1_3_1
  1969. MIX_10_4
  1970. }
  1971. else
  1972. {
  1973. MIX_00_4_3_1_5_2_1
  1974. MIX_10_4_7_3_2_3_3
  1975. }
  1976. MIX_01_4_1_3_1
  1977. MIX_11_4_8_3_1
  1978. break;
  1979. case 221:
  1980. MIX_00_4_1_3_1
  1981. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  1982. {
  1983. MIX_01_4_1_3_1
  1984. MIX_11_4
  1985. }
  1986. else
  1987. {
  1988. MIX_01_4_5_1_5_2_1
  1989. MIX_11_4_5_7_2_3_3
  1990. }
  1991. MIX_10_4_6_3_1
  1992. break;
  1993. case 207:
  1994. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  1995. {
  1996. MIX_00_4
  1997. MIX_01_4_5_3_1
  1998. }
  1999. else
  2000. {
  2001. MIX_00_4_3_1_2_3_3
  2002. MIX_01_4_1_5_5_2_1
  2003. }
  2004. MIX_10_4_6_3_1
  2005. MIX_11_4_5_3_1
  2006. break;
  2007. case 238:
  2008. MIX_00_MIX_00_4_0_3_1
  2009. MIX_01_4_5_3_1
  2010. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2011. {
  2012. MIX_10_4
  2013. MIX_11_4_5_3_1
  2014. }
  2015. else
  2016. {
  2017. MIX_10_4_7_3_2_3_3
  2018. MIX_11_4_7_5_5_2_1
  2019. }
  2020. break;
  2021. case 190:
  2022. MIX_00_MIX_00_4_0_3_1
  2023. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2024. {
  2025. MIX_01_4
  2026. MIX_11_4_7_3_1
  2027. }
  2028. else
  2029. {
  2030. MIX_01_4_1_5_2_3_3
  2031. MIX_11_4_5_7_5_2_1
  2032. }
  2033. MIX_10_4_7_3_1
  2034. break;
  2035. case 187:
  2036. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2037. {
  2038. MIX_00_4
  2039. MIX_10_4_7_3_1
  2040. }
  2041. else
  2042. {
  2043. MIX_00_4_3_1_2_3_3
  2044. MIX_10_4_3_7_5_2_1
  2045. }
  2046. MIX_01_4_2_3_1
  2047. MIX_11_4_7_3_1
  2048. break;
  2049. case 243:
  2050. MIX_00_4_3_3_1
  2051. MIX_01_4_2_3_1
  2052. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2053. {
  2054. MIX_10_4_3_3_1
  2055. MIX_11_4
  2056. }
  2057. else
  2058. {
  2059. MIX_10_4_7_3_5_2_1
  2060. MIX_11_4_5_7_2_3_3
  2061. }
  2062. break;
  2063. case 119:
  2064. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2065. {
  2066. MIX_00_4_3_3_1
  2067. MIX_01_4
  2068. }
  2069. else
  2070. {
  2071. MIX_00_4_1_3_5_2_1
  2072. MIX_01_4_1_5_2_3_3
  2073. }
  2074. MIX_10_4_3_3_1
  2075. MIX_11_4_8_3_1
  2076. break;
  2077. case 237:
  2078. case 233:
  2079. MIX_00_4_1_3_1
  2080. MIX_01_4_1_5_2_1_1
  2081. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2082. {
  2083. MIX_10_4
  2084. }
  2085. else
  2086. {
  2087. MIX_10_4_6_3_10
  2088. }
  2089. MIX_11_4_5_3_1
  2090. break;
  2091. case 175:
  2092. case 47:
  2093. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2094. {
  2095. MIX_00_4
  2096. }
  2097. else
  2098. {
  2099. MIX_00_MIX_00_4_0_3_10
  2100. }
  2101. MIX_01_4_5_3_1
  2102. MIX_10_4_7_3_1
  2103. MIX_11_4_5_7_2_1_1
  2104. break;
  2105. case 183:
  2106. case 151:
  2107. MIX_00_4_3_3_1
  2108. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2109. {
  2110. MIX_01_4
  2111. }
  2112. else
  2113. {
  2114. MIX_01_4_2_3_10
  2115. }
  2116. MIX_10_4_7_3_2_1_1
  2117. MIX_11_4_7_3_1
  2118. break;
  2119. case 245:
  2120. case 244:
  2121. MIX_00_4_3_1_2_1_1
  2122. MIX_01_4_1_3_1
  2123. MIX_10_4_3_3_1
  2124. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2125. {
  2126. MIX_11_4
  2127. }
  2128. else
  2129. {
  2130. MIX_11_4_8_3_10
  2131. }
  2132. break;
  2133. case 250:
  2134. MIX_00_MIX_00_4_0_3_1
  2135. MIX_01_4_2_3_1
  2136. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2137. {
  2138. MIX_10_4
  2139. }
  2140. else
  2141. {
  2142. MIX_10_4_7_3_2_1_1
  2143. }
  2144. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2145. {
  2146. MIX_11_4
  2147. }
  2148. else
  2149. {
  2150. MIX_11_4_5_7_2_1_1
  2151. }
  2152. break;
  2153. case 123:
  2154. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2155. {
  2156. MIX_00_4
  2157. }
  2158. else
  2159. {
  2160. MIX_00_4_3_1_2_1_1
  2161. }
  2162. MIX_01_4_2_3_1
  2163. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2164. {
  2165. MIX_10_4
  2166. }
  2167. else
  2168. {
  2169. MIX_10_4_7_3_2_1_1
  2170. }
  2171. MIX_11_4_8_3_1
  2172. break;
  2173. case 95:
  2174. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2175. {
  2176. MIX_00_4
  2177. }
  2178. else
  2179. {
  2180. MIX_00_4_3_1_2_1_1
  2181. }
  2182. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2183. {
  2184. MIX_01_4
  2185. }
  2186. else
  2187. {
  2188. MIX_01_4_1_5_2_1_1
  2189. }
  2190. MIX_10_4_6_3_1
  2191. MIX_11_4_8_3_1
  2192. break;
  2193. case 222:
  2194. MIX_00_MIX_00_4_0_3_1
  2195. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2196. {
  2197. MIX_01_4
  2198. }
  2199. else
  2200. {
  2201. MIX_01_4_1_5_2_1_1
  2202. }
  2203. MIX_10_4_6_3_1
  2204. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2205. {
  2206. MIX_11_4
  2207. }
  2208. else
  2209. {
  2210. MIX_11_4_5_7_2_1_1
  2211. }
  2212. break;
  2213. case 252:
  2214. MIX_00_4_0_1_2_1_1
  2215. MIX_01_4_1_3_1
  2216. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2217. {
  2218. MIX_10_4
  2219. }
  2220. else
  2221. {
  2222. MIX_10_4_7_3_2_1_1
  2223. }
  2224. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2225. {
  2226. MIX_11_4
  2227. }
  2228. else
  2229. {
  2230. MIX_11_4_8_3_10
  2231. }
  2232. break;
  2233. case 249:
  2234. MIX_00_4_1_3_1
  2235. MIX_01_4_2_1_2_1_1
  2236. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2237. {
  2238. MIX_10_4
  2239. }
  2240. else
  2241. {
  2242. MIX_10_4_6_3_10
  2243. }
  2244. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2245. {
  2246. MIX_11_4
  2247. }
  2248. else
  2249. {
  2250. MIX_11_4_5_7_2_1_1
  2251. }
  2252. break;
  2253. case 235:
  2254. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2255. {
  2256. MIX_00_4
  2257. }
  2258. else
  2259. {
  2260. MIX_00_4_3_1_2_1_1
  2261. }
  2262. MIX_01_4_2_5_2_1_1
  2263. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2264. {
  2265. MIX_10_4
  2266. }
  2267. else
  2268. {
  2269. MIX_10_4_6_3_10
  2270. }
  2271. MIX_11_4_5_3_1
  2272. break;
  2273. case 111:
  2274. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2275. {
  2276. MIX_00_4
  2277. }
  2278. else
  2279. {
  2280. MIX_00_MIX_00_4_0_3_10
  2281. }
  2282. MIX_01_4_5_3_1
  2283. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2284. {
  2285. MIX_10_4
  2286. }
  2287. else
  2288. {
  2289. MIX_10_4_7_3_2_1_1
  2290. }
  2291. MIX_11_4_8_5_2_1_1
  2292. break;
  2293. case 63:
  2294. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2295. {
  2296. MIX_00_4
  2297. }
  2298. else
  2299. {
  2300. MIX_00_MIX_00_4_0_3_10
  2301. }
  2302. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2303. {
  2304. MIX_01_4
  2305. }
  2306. else
  2307. {
  2308. MIX_01_4_1_5_2_1_1
  2309. }
  2310. MIX_10_4_7_3_1
  2311. MIX_11_4_8_7_2_1_1
  2312. break;
  2313. case 159:
  2314. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2315. {
  2316. MIX_00_4
  2317. }
  2318. else
  2319. {
  2320. MIX_00_4_3_1_2_1_1
  2321. }
  2322. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2323. {
  2324. MIX_01_4
  2325. }
  2326. else
  2327. {
  2328. MIX_01_4_2_3_10
  2329. }
  2330. MIX_10_4_6_7_2_1_1
  2331. MIX_11_4_7_3_1
  2332. break;
  2333. case 215:
  2334. MIX_00_4_3_3_1
  2335. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2336. {
  2337. MIX_01_4
  2338. }
  2339. else
  2340. {
  2341. MIX_01_4_2_3_10
  2342. }
  2343. MIX_10_4_6_3_2_1_1
  2344. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2345. {
  2346. MIX_11_4
  2347. }
  2348. else
  2349. {
  2350. MIX_11_4_5_7_2_1_1
  2351. }
  2352. break;
  2353. case 246:
  2354. MIX_00_4_0_3_2_1_1
  2355. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2356. {
  2357. MIX_01_4
  2358. }
  2359. else
  2360. {
  2361. MIX_01_4_1_5_2_1_1
  2362. }
  2363. MIX_10_4_3_3_1
  2364. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2365. {
  2366. MIX_11_4
  2367. }
  2368. else
  2369. {
  2370. MIX_11_4_8_3_10
  2371. }
  2372. break;
  2373. case 254:
  2374. MIX_00_MIX_00_4_0_3_1
  2375. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2376. {
  2377. MIX_01_4
  2378. }
  2379. else
  2380. {
  2381. MIX_01_4_1_5_2_1_1
  2382. }
  2383. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2384. {
  2385. MIX_10_4
  2386. }
  2387. else
  2388. {
  2389. MIX_10_4_7_3_2_1_1
  2390. }
  2391. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2392. {
  2393. MIX_11_4
  2394. }
  2395. else
  2396. {
  2397. MIX_11_4_8_3_10
  2398. }
  2399. break;
  2400. case 253:
  2401. MIX_00_4_1_3_1
  2402. MIX_01_4_1_3_1
  2403. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2404. {
  2405. MIX_10_4
  2406. }
  2407. else
  2408. {
  2409. MIX_10_4_6_3_10
  2410. }
  2411. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2412. {
  2413. MIX_11_4
  2414. }
  2415. else
  2416. {
  2417. MIX_11_4_8_3_10
  2418. }
  2419. break;
  2420. case 251:
  2421. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2422. {
  2423. MIX_00_4
  2424. }
  2425. else
  2426. {
  2427. MIX_00_4_3_1_2_1_1
  2428. }
  2429. MIX_01_4_2_3_1
  2430. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2431. {
  2432. MIX_10_4
  2433. }
  2434. else
  2435. {
  2436. MIX_10_4_6_3_10
  2437. }
  2438. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2439. {
  2440. MIX_11_4
  2441. }
  2442. else
  2443. {
  2444. MIX_11_4_5_7_2_1_1
  2445. }
  2446. break;
  2447. case 239:
  2448. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2449. {
  2450. MIX_00_4
  2451. }
  2452. else
  2453. {
  2454. MIX_00_MIX_00_4_0_3_10
  2455. }
  2456. MIX_01_4_5_3_1
  2457. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2458. {
  2459. MIX_10_4
  2460. }
  2461. else
  2462. {
  2463. MIX_10_4_6_3_10
  2464. }
  2465. MIX_11_4_5_3_1
  2466. break;
  2467. case 127:
  2468. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2469. {
  2470. MIX_00_4
  2471. }
  2472. else
  2473. {
  2474. MIX_00_MIX_00_4_0_3_10
  2475. }
  2476. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2477. {
  2478. MIX_01_4
  2479. }
  2480. else
  2481. {
  2482. MIX_01_4_1_5_2_1_1
  2483. }
  2484. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2485. {
  2486. MIX_10_4
  2487. }
  2488. else
  2489. {
  2490. MIX_10_4_7_3_2_1_1
  2491. }
  2492. MIX_11_4_8_3_1
  2493. break;
  2494. case 191:
  2495. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2496. {
  2497. MIX_00_4
  2498. }
  2499. else
  2500. {
  2501. MIX_00_MIX_00_4_0_3_10
  2502. }
  2503. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2504. {
  2505. MIX_01_4
  2506. }
  2507. else
  2508. {
  2509. MIX_01_4_2_3_10
  2510. }
  2511. MIX_10_4_7_3_1
  2512. MIX_11_4_7_3_1
  2513. break;
  2514. case 223:
  2515. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2516. {
  2517. MIX_00_4
  2518. }
  2519. else
  2520. {
  2521. MIX_00_4_3_1_2_1_1
  2522. }
  2523. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2524. {
  2525. MIX_01_4
  2526. }
  2527. else
  2528. {
  2529. MIX_01_4_2_3_10
  2530. }
  2531. MIX_10_4_6_3_1
  2532. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2533. {
  2534. MIX_11_4
  2535. }
  2536. else
  2537. {
  2538. MIX_11_4_5_7_2_1_1
  2539. }
  2540. break;
  2541. case 247:
  2542. MIX_00_4_3_3_1
  2543. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2544. {
  2545. MIX_01_4
  2546. }
  2547. else
  2548. {
  2549. MIX_01_4_2_3_10
  2550. }
  2551. MIX_10_4_3_3_1
  2552. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2553. {
  2554. MIX_11_4
  2555. }
  2556. else
  2557. {
  2558. MIX_11_4_8_3_10
  2559. }
  2560. break;
  2561. case 255:
  2562. if (isDifferent(w[3], w[1], trY, trU, trV, trA))
  2563. MIX_00_4
  2564. else
  2565. MIX_00_MIX_00_4_0_3_10
  2566. if (isDifferent(w[1], w[5], trY, trU, trV, trA))
  2567. MIX_01_4
  2568. else
  2569. MIX_01_4_2_3_10
  2570. if (isDifferent(w[7], w[3], trY, trU, trV, trA))
  2571. MIX_10_4
  2572. else
  2573. MIX_10_4_6_3_10
  2574. if (isDifferent(w[5], w[7], trY, trU, trV, trA))
  2575. MIX_11_4
  2576. else
  2577. MIX_11_4_8_3_10
  2578. break;
  2579. }
  2580. image++;
  2581. output += 2;
  2582. }
  2583. output += lineSize;
  2584. }
  2585. return output;
  2586. }