bc7_encode_kernel.h 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755
  1. //=====================================================================
  2. // Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files(the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions :
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. //=====================================================================
  23. #ifndef BC7_ENCODE_KERNEL_H
  24. #define BC7_ENCODE_KERNEL_H
  25. #pragma warning(disable:4505) // disable warnings on unreferenced local function has been removed
  26. #include "common_def.h"
  27. #define USE_VARYING
  28. #ifndef ASPM_GPU
  29. struct cmp_bc7_state {
  30. CGV_FLOAT block[16][4];
  31. CGV_UINT32 best_data[4];
  32. } ;
  33. typedef enum {
  34. CGU_FORMAT_Unknown, // Undefined texture format.
  35. // Channel Component formats-------------------------------------------------------------------------------
  36. CGU_FORMAT_RGBA_8888, // RGBA format with 8-bit fixed channels.
  37. // Formats supported by GPU
  38. CGU_FORMAT_BC1, // A four component opaque (or 1-bit alpha) compressed texture format for Microsoft DirectX10. Identical to DXT1. Four bits per pixel.
  39. CGU_FORMAT_BC6H, // BC6H compressed texture format
  40. CGU_FORMAT_BC7, // BC7 compressed texture format
  41. // Formats supported by CPU
  42. CGU_FORMAT_GTC, // GTC Gradient Texture Compressor
  43. CGU_FORMAT_APC, // APC Texture Compressor
  44. CGU_FORMAT_MAX
  45. } CGU_FORMAT;
  46. //------------------------------------
  47. // The structure describing a texture
  48. //------------------------------------
  49. struct CGU_Texture_Type {
  50. // Optional Settings
  51. CGU_FLOAT m_fquality; // Minimum resulting quality to maintain while processing the texture, default is 0.05
  52. CGU_INT8 m_nBlockHeight; // Size of the texture tiles (blocks) to use.during processing
  53. CGU_INT8 m_nBlockWidth; // default = 4
  54. CGU_INT8 m_nBlockDepth; // default = 1
  55. // Required settings
  56. CGU_FORMAT m_format; // Texture format
  57. CGU_UINT32 m_src_width; // Width of the texture.
  58. CGU_UINT32 m_src_height; // Height of the texture.
  59. CGU_UINT32 m_stride; // Number of bytes to start of next line
  60. CGU_UINT32 m_dwDataSize; // Size of the allocated texture data.
  61. CGU_UINT8* m_pData; // Pointer to the texture data
  62. };
  63. #endif // End of ASPM_CPU
  64. #define SOURCE_BLOCK_SIZE 16 // Size of a source block in pixels (each pixel has RGBA:8888 channels)
  65. #define COMPRESSED_BLOCK_SIZE 16 // Size of a compressed block in bytes
  66. #define MAX_CHANNELS 4
  67. #define MAX_SUBSETS 3 // Maximum number of possible subsets
  68. #define MAX_SUBSET_SIZE 16 // Largest possible size for an individual subset
  69. #define BC7_qFAST_THRESHOLD 0.50f
  70. #define MAX_INDEX_BITS 4 // Maximum number of index bits
  71. typedef struct {
  72. CGV_FLOAT image;
  73. CGV_UINT8 index;
  74. } CMP_di;
  75. typedef struct {
  76. CGV_FLOAT image;
  77. CGV_UINT8 index;
  78. } CMP_du;
  79. #define MAX_PARTITION_ENTRIES 64
  80. #define MAX_PARTITIONS_TABLE 193
  81. #define MAX_PARTITIONS 64 // Maximum number of partition types
  82. #define EPSILON 0.00390625f
  83. #define DIMENSION 4
  84. #define BlockX 4
  85. #define BlockY 4
  86. #define QUANT_RT 250.0f // quality = 0.05f
  87. //==========================================================================================================
  88. #define LOG_CL_RANGE 5
  89. #define LOG_CL_BASE 2
  90. #define BIT_BASE 5
  91. #define BIT_RANGE 9
  92. #define MAX_CLUSTERS_BIG 16
  93. #define MAX_CLUSTERS 8
  94. #define BTT(bits) (bits-BIT_BASE)
  95. #define CLT(cl) (cl-LOG_CL_BASE)
  96. #define MAX_TRY_QUANT_TRACE 2 // used in optQuantTrace_d : increasing this has no gain in quality!, keep it set at 2
  97. #define NUM_BLOCK_TYPES 8 // Number of block types in the format
  98. #define BC7_MAX_TRACE 25000
  99. // If this is defined, ramp calculation is done via math floor and division.
  100. // Otherwise, ramp calculation is done by bit shifting
  101. #define USE_HIGH_PRECISION_INTERPOLATION_BC7
  102. typedef struct {
  103. CGU_INT32 k;
  104. CGV_FLOAT d;
  105. } TRACE;
  106. typedef struct
  107. #ifdef ASPM
  108. BC7_EncodeState
  109. #endif
  110. {
  111. CGV_FLOAT image_src[64];
  112. CGV_UINT8 cmp_out[COMPRESSED_BLOCK_SIZE];
  113. // Common
  114. CGV_FLOAT opaque_err; // error for coding alpha=255
  115. CGV_FLOAT best_err;
  116. // set per mode
  117. CGU_UINT8 channels3or4;
  118. CGU_UINT8 bits;
  119. CGU_INT clusters;
  120. CGU_UINT8 componentBits;
  121. CGU_UINT8 numPartitionModes;
  122. CGU_INT maxSubSets;
  123. CGU_UINT8 numClusters0[2];
  124. CGU_UINT8 numClusters1[2];
  125. CGU_UINT8 max_idxMode;
  126. CGU_INT modeBits[2];
  127. CGU_BOOL optimizedQ;
  128. CGU_UINT32 validModeMask;
  129. CGU_INT part_count;
  130. CGU_UINT8 channels;
  131. // use_icmp
  132. CGV_UINT32 best_cmp_out[5];
  133. CGV_BOOL cmp_isout16Bytes;
  134. CGU_INT refineIterations;
  135. CGU_INT fastSkipTreshold;
  136. }
  137. #ifndef ASPM
  138. BC7_EncodeState
  139. #endif
  140. ;
  141. typedef struct
  142. #ifdef ASPM
  143. cmp_mode_parameters
  144. #endif
  145. {
  146. CGV_INT color_qendpoint[8];
  147. CGV_INT alpha_qendpoint[8];
  148. CGV_UINT32 best_color_index[2];
  149. CGV_UINT32 best_alpha_index[2];
  150. CGV_UINT8 color_index[SOURCE_BLOCK_SIZE];
  151. CGV_UINT8 alpha_index[SOURCE_BLOCK_SIZE];
  152. CGV_UINT32 idxMode;
  153. CGV_UINT32 rotated_channel;
  154. }
  155. #ifndef ASPM
  156. cmp_mode_parameters
  157. #endif
  158. ;
  159. typedef struct
  160. #ifdef ASPM
  161. BC7_Encode
  162. #endif
  163. {
  164. // Global data setup at initialization time
  165. CGU_FLOAT quality; // range is 0 to 1
  166. CGU_FLOAT errorThreshold; // use 5 to 75
  167. CGU_UINT32 validModeMask; // bit for mode masks def to 0xFF
  168. CGU_BOOL imageNeedsAlpha; // default: false
  169. CGU_BOOL colourRestrict; // default: false
  170. CGU_BOOL alphaRestrict; // default: false
  171. // Used to track errors in internal state code
  172. CGV_FLOAT opaque_err;
  173. CGV_FLOAT best_err;
  174. CGU_FLOAT minThreshold;
  175. CGU_FLOAT maxThreshold;;
  176. // icmp code settings
  177. CGU_INT refineIterations;
  178. CGU_INT part_count;
  179. CGU_INT channels;
  180. }
  181. #ifndef ASPM
  182. BC7_Encode
  183. #endif
  184. ;
  185. CMP_CONSTANT CGU_FLOAT rampWeights[5][SOURCE_BLOCK_SIZE] = {
  186. { 0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f}, // 0 bit index
  187. { 0.000000f,1.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f}, // 1 bit index
  188. { 0.000000f,0.328125f,0.671875f,1.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f}, // 2 bit index
  189. { 0.000000f,0.140625f,0.281250f,0.421875f,0.578125f,0.718750f,0.859375f,1.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f}, // 3 bit index
  190. { 0.000000f,0.062500f,0.140625f,0.203125f,0.265625f,0.328125f,0.406250f,0.468750f,0.531250f,0.593750f,0.671875f,0.734375f,0.796875f,0.859375f,0.937500f,1.000000f} // 4 bit index
  191. };
  192. #ifndef ASPM_GPU
  193. typedef struct
  194. #ifdef ASPM
  195. BC7_EncodeRamps
  196. #endif
  197. {
  198. CGU_INT ep_d[4][256];
  199. #ifdef USE_BC7_SP_ERR_IDX
  200. CGU_UINT8 sp_err[3*4*256*2*2*16];
  201. CGU_INT sp_idx[3*4*256*2*2*16*2];
  202. #endif
  203. #ifdef USE_BC7_RAMP
  204. CGU_FLOAT ramp[3*4*256*256*16];
  205. #endif
  206. CGU_BOOL ramp_init;
  207. }
  208. #ifndef ASPM
  209. BC7_EncodeRamps
  210. #endif
  211. ;
  212. #endif
  213. CMP_CONSTANT CGU_UINT8 npv_nd[2][8] = {
  214. {1,2,4,8,16,32,0,0}, // 3
  215. {1,2,4,0,0,0,0,0} // 4
  216. };
  217. typedef enum {
  218. NO_ALPHA,
  219. COMBINED_ALPHA,
  220. SEPARATE_ALPHA
  221. } CMP_BCE;
  222. // Endpoint encoding type
  223. typedef enum {
  224. NO_PBIT,
  225. ONE_PBIT,
  226. TWO_PBIT,
  227. THREE_PBIT,
  228. FOUR_PBIT,
  229. FIVE_PBIT
  230. } CMP_PBIT;
  231. typedef struct
  232. #ifdef ASPM
  233. BC7_Encode_local
  234. #endif
  235. {
  236. // Data for compressing a particular block mode
  237. CGV_INT clusters[2];
  238. CGV_UINT8 parityBits;
  239. CGV_UINT8 componentBits[MAX_CHANNELS];
  240. CMP_BCE encodingType; // Type of block
  241. CGU_UINT8 partitionBits; // Number of bits for partition data
  242. CGU_UINT8 rotationBits; // Number of bits for component rotation
  243. CGU_UINT8 indexModeBits; // Number of bits for index selection
  244. CMP_PBIT pBitType; // Type of P-bit encoding
  245. CGU_UINT8 subsetCount; // Number of subsets
  246. CGU_UINT8 indexBits[2]; // Number of bits per index in each index set
  247. // Bulky temporary data used during compression of a block
  248. CGV_UINT8 storedindex[MAX_PARTITIONS][MAX_SUBSETS][MAX_SUBSET_SIZE];
  249. CGV_FLOAT storedError[MAX_PARTITIONS];
  250. CGV_UINT8 sortedModes[MAX_PARTITIONS];
  251. // This stores the min and max for the components of the block, and the ranges
  252. CGV_FLOAT blockMin[MAX_CHANNELS];
  253. CGV_FLOAT blockMax[MAX_CHANNELS];
  254. CGV_FLOAT blockRange[MAX_CHANNELS];
  255. CGV_FLOAT blockMaxRange;
  256. }
  257. #ifndef ASPM
  258. BC7_Encode_local
  259. #endif
  260. ;
  261. typedef enum {
  262. CART,
  263. SAME_PAR,
  264. BCC,
  265. SAME_FCC,
  266. FCC,
  267. FCC_SAME_BCC,
  268. } CMP_qt;
  269. // Block component encoding
  270. // Descriptor structure for block encodings
  271. typedef struct {
  272. uniform CMP_BCE encodingType; // Type of block
  273. CGU_UINT8 partitionBits; // Number of bits for partition data
  274. CGU_UINT8 rotationBits; // Number of bits for component rotation
  275. CGU_UINT8 indexModeBits; // Number of bits for index selection
  276. CGU_UINT8 scalarBits; // Number of bits for one scalar endpoint
  277. CGU_UINT8 vectorBits; // Number of bits for one vector endpoint(excluding P bits)
  278. uniform CMP_PBIT pBitType; // Type of P-bit encoding
  279. CGU_UINT8 subsetCount; // Number of subsets
  280. CGU_UINT8 indexBits[2]; // Number of bits per index in each index set
  281. } CMP_BTI;
  282. typedef enum {
  283. COMP_RED = 0,
  284. COMP_GREEN = 1,
  285. COMP_BLUE = 2,
  286. COMP_ALPHA = 3
  287. } COMPONENT;
  288. CMP_CONSTANT CGU_UINT8 componentRotations[4][4] = {
  289. { COMP_ALPHA, COMP_RED, COMP_GREEN, COMP_BLUE },
  290. { COMP_RED, COMP_ALPHA, COMP_GREEN, COMP_BLUE },
  291. { COMP_GREEN, COMP_RED, COMP_ALPHA, COMP_BLUE },
  292. { COMP_BLUE, COMP_RED, COMP_GREEN, COMP_ALPHA }
  293. };
  294. CMP_CONSTANT CMP_BTI bti[NUM_BLOCK_TYPES] = {
  295. //encodingType,partitionBits,rotationBits,indexModeBits,scalarBits,vectorBits,pBitType, subsetCount,indexBits[0]&[1]
  296. { NO_ALPHA, 4, 0, 0, 0, 12, TWO_PBIT, 3, { 3, 0 } }, // Format Mode 0
  297. { NO_ALPHA, 6, 0, 0, 0, 18, ONE_PBIT, 2, { 3, 0 } }, // Format Mode 1
  298. { NO_ALPHA, 6, 0, 0, 0, 15, NO_PBIT, 3, { 2, 0 } }, // Format Mode 2
  299. { NO_ALPHA, 6, 0, 0, 0, 21, TWO_PBIT, 2, { 2, 0 } }, // Format Mode 3
  300. { SEPARATE_ALPHA, 0, 2, 1, 6, 15, NO_PBIT, 1, { 2, 3 } }, // Format Mode 4
  301. { SEPARATE_ALPHA, 0, 2, 0, 8, 21, NO_PBIT, 1, { 2, 2 } }, // Format Mode 5
  302. { COMBINED_ALPHA, 0, 0, 0, 0, 28, TWO_PBIT, 1, { 4, 0 } }, // Format Mode 6
  303. { COMBINED_ALPHA, 6, 0, 0, 0, 20, TWO_PBIT, 2, { 2, 0 } } // Format Mode 7
  304. };
  305. CMP_CONSTANT CGU_UINT8 par_vectors_nd[2][8][64][2][4] = {
  306. {
  307. // 3D
  308. {
  309. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  310. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  311. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  312. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  313. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  314. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  315. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  316. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  317. },
  318. {
  319. {{0,0,0,0},{0,0,0,0}},{{1,1,1,0},{1,1,1,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  320. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  321. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  322. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  323. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  324. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  325. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  326. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  327. },
  328. {
  329. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{1,1,1,0}},{{1,1,1,0},{0,0,0,0}},{{1,1,1,0},{1,1,1,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  330. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  331. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  332. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  333. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  334. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  335. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  336. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  337. },
  338. {
  339. {{0,0,0,0},{0,0,0,0}},{{1,1,0,0},{1,1,0,0}},{{1,0,1,0},{1,0,1,0}},{{0,1,1,0},{0,1,1,0}},{{0,0,0,0},{1,1,1,0}},{{1,1,1,0},{0,0,0,0}},{{0,1,0,0},{0,1,0,0}},{{1,1,1,0},{1,1,1,0}},
  340. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  341. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  342. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  343. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  344. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  345. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  346. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  347. },
  348. {
  349. {{0,0,0,0},{0,0,0,0}},{{1,1,0,0},{0,0,0,0}},{{1,0,1,0},{0,0,0,0}},{{0,1,1,0},{0,0,0,0}},{{0,0,0,0},{1,1,0,0}},{{1,1,0,0},{1,1,0,0}},{{1,0,1,0},{1,1,0,0}},{{0,1,1,0},{1,1,0,0}},
  350. {{0,0,0,0},{1,0,1,0}},{{1,1,0,0},{1,0,1,0}},{{1,0,1,0},{1,0,1,0}},{{0,1,1,0},{1,0,1,0}},{{0,0,0,0},{0,1,1,0}},{{1,1,0,0},{0,1,1,0}},{{1,0,1,0},{0,1,1,0}},{{0,1,1,0},{0,1,1,0}},
  351. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  352. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  353. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  354. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  355. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  356. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  357. },
  358. {
  359. {{0,0,0,0},{0,0,0,0}},{{1,1,0,0},{0,0,0,0}},{{1,0,1,0},{0,0,0,0}},{{0,1,1,0},{0,0,0,0}},{{0,0,0,0},{1,1,0,0}},{{1,1,0,0},{1,1,0,0}},{{1,0,1,0},{1,1,0,0}},{{0,1,1,0},{1,1,0,0}},
  360. {{0,0,0,0},{1,0,1,0}},{{1,1,0,0},{1,0,1,0}},{{1,0,1,0},{1,0,1,0}},{{0,1,1,0},{1,0,1,0}},{{0,0,0,0},{0,1,1,0}},{{1,1,0,0},{0,1,1,0}},{{1,0,1,0},{0,1,1,0}},{{0,1,1,0},{0,1,1,0}},
  361. {{1,0,0,0},{1,1,1,0}},{{0,1,0,0},{1,1,1,0}},{{0,0,1,0},{1,1,1,0}},{{1,1,1,0},{1,1,1,0}},{{1,0,0,0},{0,0,1,0}},{{0,1,0,0},{0,0,1,0}},{{0,0,1,0},{0,0,1,0}},{{1,1,1,0},{0,0,1,0}},
  362. {{1,0,0,0},{1,0,0,0}},{{0,1,0,0},{1,0,0,0}},{{0,0,1,0},{1,0,0,0}},{{1,1,1,0},{1,0,0,0}},{{1,0,0,0},{0,1,0,0}},{{0,1,0,0},{0,1,0,0}},{{0,0,1,0},{0,1,0,0}},{{1,1,1,0},{0,1,0,0}},
  363. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  364. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  365. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  366. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  367. },
  368. {
  369. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  370. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  371. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  372. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  373. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  374. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  375. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  376. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  377. },
  378. {
  379. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  380. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  381. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  382. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  383. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  384. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  385. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  386. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  387. },
  388. },
  389. {
  390. // 4D
  391. {
  392. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  393. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  394. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  395. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  396. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  397. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  398. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  399. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  400. },
  401. {
  402. {{0,0,0,0},{0,0,0,0}},{{1,1,1,1},{1,1,1,1}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  403. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  404. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  405. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  406. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  407. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  408. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  409. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  410. },
  411. {
  412. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{1,1,1,1}},{{1,1,1,1},{0,0,0,0}},{{1,1,1,1},{1,1,1,1}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  413. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  414. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  415. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  416. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  417. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  418. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  419. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  420. },
  421. {
  422. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,1,1,1}},{{0,1,1,1},{0,0,0,0}},{{0,1,1,1},{0,1,1,1}},{{1,0,0,0},{1,0,0,0}},{{1,0,0,0},{1,1,1,1}},{{1,1,1,1},{1,0,0,0}},{{1,1,1,1},{1,1,1,1}},
  423. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  424. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  425. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  426. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  427. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  428. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  429. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  430. },
  431. {
  432. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,1,1,1}},{{0,1,1,1},{0,0,0,0}},{{0,1,1,1},{0,1,1,1}},{{1,0,0,0},{1,0,0,0}},{{1,0,0,0},{1,1,1,1}},{{1,1,1,1},{1,0,0,0}},{{1,1,1,1},{1,1,1,1}},
  433. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,1,1}},{{0,0,1,1},{0,0,0,0}},{{0,1,0,1},{0,1,0,1}},{{1,0,0,0},{1,0,0,0}},{{1,0,0,0},{1,0,1,1}},{{1,0,1,1},{1,0,0,0}},{{1,1,0,1},{1,1,0,1}},
  434. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  435. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  436. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  437. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  438. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  439. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  440. },
  441. {
  442. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  443. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  444. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  445. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  446. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  447. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  448. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  449. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  450. },
  451. {
  452. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  453. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  454. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  455. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  456. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  457. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  458. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  459. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  460. },
  461. {
  462. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  463. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  464. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  465. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  466. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  467. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  468. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},
  469. {{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}},{{0,0,0,0},{0,0,0,0}}
  470. },
  471. },
  472. };
  473. CMP_CONSTANT CGU_UINT32 subset_mask_table[] = {
  474. // 2 subset region patterns
  475. 0x0000CCCCu, // 0 1100 1100 1100 1100 (MSB..LSB)
  476. 0x00008888u, // 1 1000 1000 1000 1000
  477. 0x0000EEEEu, // 2 1110 1110 1110 1110
  478. 0x0000ECC8u, // 3 1110 1100 1100 1000
  479. 0x0000C880u, // 4 1100 1000 1000 0000
  480. 0x0000FEECu, // 5 1111 1110 1110 1100
  481. 0x0000FEC8u, // 6 1111 1110 1100 1000
  482. 0x0000EC80u, // 7 1110 1100 1000 0000
  483. 0x0000C800u, // 8 1100 1000 0000 0000
  484. 0x0000FFECu, // 9 1111 1111 1110 1100
  485. 0x0000FE80u, // 10 1111 1110 1000 0000
  486. 0x0000E800u, // 11 1110 1000 0000 0000
  487. 0x0000FFE8u, // 12 1111 1111 1110 1000
  488. 0x0000FF00u, // 13 1111 1111 0000 0000
  489. 0x0000FFF0u, // 14 1111 1111 1111 0000
  490. 0x0000F000u, // 15 1111 0000 0000 0000
  491. 0x0000F710u, // 16 1111 0111 0001 0000
  492. 0x0000008Eu, // 17 0000 0000 1000 1110
  493. 0x00007100u, // 18 0111 0001 0000 0000
  494. 0x000008CEu, // 19 0000 1000 1100 1110
  495. 0x0000008Cu, // 20 0000 0000 1000 1100
  496. 0x00007310u, // 21 0111 0011 0001 0000
  497. 0x00003100u, // 22 0011 0001 0000 0000
  498. 0x00008CCEu, // 23 1000 1100 1100 1110
  499. 0x0000088Cu, // 24 0000 1000 1000 1100
  500. 0x00003110u, // 25 0011 0001 0001 0000
  501. 0x00006666u, // 26 0110 0110 0110 0110
  502. 0x0000366Cu, // 27 0011 0110 0110 1100
  503. 0x000017E8u, // 28 0001 0111 1110 1000
  504. 0x00000FF0u, // 29 0000 1111 1111 0000
  505. 0x0000718Eu, // 30 0111 0001 1000 1110
  506. 0x0000399Cu, // 31 0011 1001 1001 1100
  507. 0x0000AAAAu, // 32 1010 1010 1010 1010
  508. 0x0000F0F0u, // 33 1111 0000 1111 0000
  509. 0x00005A5Au, // 34 0101 1010 0101 1010
  510. 0x000033CCu, // 35 0011 0011 1100 1100
  511. 0x00003C3Cu, // 36 0011 1100 0011 1100
  512. 0x000055AAu, // 37 0101 0101 1010 1010
  513. 0x00009696u, // 38 1001 0110 1001 0110
  514. 0x0000A55Au, // 39 1010 0101 0101 1010
  515. 0x000073CEu, // 40 0111 0011 1100 1110
  516. 0x000013C8u, // 41 0001 0011 1100 1000
  517. 0x0000324Cu, // 42 0011 0010 0100 1100
  518. 0x00003BDCu, // 43 0011 1011 1101 1100
  519. 0x00006996u, // 44 0110 1001 1001 0110
  520. 0x0000C33Cu, // 45 1100 0011 0011 1100
  521. 0x00009966u, // 46 1001 1001 0110 0110
  522. 0x00000660u, // 47 0000 0110 0110 0000
  523. 0x00000272u, // 48 0000 0010 0111 0010
  524. 0x000004E4u, // 49 0000 0100 1110 0100
  525. 0x00004E40u, // 50 0100 1110 0100 0000
  526. 0x00002720u, // 51 0010 0111 0010 0000
  527. 0x0000C936u, // 52 1100 1001 0011 0110
  528. 0x0000936Cu, // 53 1001 0011 0110 1100
  529. 0x000039C6u, // 54 0011 1001 1100 0110
  530. 0x0000639Cu, // 55 0110 0011 1001 1100
  531. 0x00009336u, // 56 1001 0011 0011 0110
  532. 0x00009CC6u, // 57 1001 1100 1100 0110
  533. 0x0000817Eu, // 58 1000 0001 0111 1110
  534. 0x0000E718u, // 59 1110 0111 0001 1000
  535. 0x0000CCF0u, // 60 1100 1100 1111 0000
  536. 0x00000FCCu, // 61 0000 1111 1100 1100
  537. 0x00007744u, // 62 0111 0111 0100 0100
  538. 0x0000EE22u, // 63 1110 1110 0010 0010
  539. // 3 Subset region patterns
  540. 0xF60008CCu,// 0 1111 0110 0000 0000 : 0000 1000 1100 1100 = 2222122011001100 (MSB...LSB)
  541. 0x73008CC8u,// 1 0111 0011 0000 0000 : 1000 1100 1100 1000 = 1222112211001000
  542. 0x3310CC80u,// 2 0011 0011 0001 0000 : 1100 1100 1000 0000 = 1122112210020000
  543. 0x00CEEC00u,// 3 0000 0000 1100 1110 : 1110 1100 0000 0000 = 1110110022002220
  544. 0xCC003300u,// 4 1100 1100 0000 0000 : 0011 0011 0000 0000 = 2211221100000000
  545. 0xCC0000CCu,// 5 1100 1100 0000 0000 : 0000 0000 1100 1100 = 2200220011001100
  546. 0x00CCFF00u,// 6 0000 0000 1100 1100 : 1111 1111 0000 0000 = 1111111122002200
  547. 0x3300CCCCu,// 7 0011 0011 0000 0000 : 1100 1100 1100 1100 = 1122112211001100
  548. 0xF0000F00u,// 8 1111 0000 0000 0000 : 0000 1111 0000 0000 = 2222111100000000
  549. 0xF0000FF0u,// 9 1111 0000 0000 0000 : 0000 1111 1111 0000 = 2222111111110000
  550. 0xFF0000F0u,// 10 1111 1111 0000 0000 : 0000 0000 1111 0000 = 2222222211110000
  551. 0x88884444u,// 11 1000 1000 1000 1000 : 0100 0100 0100 0100 = 2100210021002100
  552. 0x88886666u,// 12 1000 1000 1000 1000 : 0110 0110 0110 0110 = 2110211021102110
  553. 0xCCCC2222u,// 13 1100 1100 1100 1100 : 0010 0010 0010 0010 = 2210221022102210
  554. 0xEC80136Cu,// 14 1110 1100 1000 0000 : 0001 0011 0110 1100 = 2221221121101100
  555. 0x7310008Cu,// 15 0111 0011 0001 0000 : 0000 0000 1000 1100 = 0222002210021100
  556. 0xC80036C8u,// 16 1100 1000 0000 0000 : 0011 0110 1100 1000 = 2211211011001000
  557. 0x310008CEu,// 17 0011 0001 0000 0000 : 0000 1000 1100 1110 = 0022100211001110
  558. 0xCCC03330u,// 18 1100 1100 1100 0000 : 0011 0011 0011 0000 = 2211221122110000
  559. 0x0CCCF000u,// 19 0000 1100 1100 1100 : 1111 0000 0000 0000 = 1111220022002200
  560. 0xEE0000EEu,// 20 1110 1110 0000 0000 : 0000 0000 1110 1110 = 2220222011101110
  561. 0x77008888u,// 21 0111 0111 0000 0000 : 1000 1000 1000 1000 = 1222122210001000
  562. 0xCC0022C0u,// 22 1100 1100 0000 0000 : 0010 0010 1100 0000 = 2210221011000000
  563. 0x33004430u,// 23 0011 0011 0000 0000 : 0100 0100 0011 0000 = 0122012200110000
  564. 0x00CC0C22u,// 24 0000 0000 1100 1100 : 0000 1100 0010 0010 = 0000110022102210
  565. 0xFC880344u,// 25 1111 1100 1000 1000 : 0000 0011 0100 0100 = 2222221121002100
  566. 0x06606996u,// 26 0000 0110 0110 0000 : 0110 1001 1001 0110 = 0110122112210110
  567. 0x66009960u,// 27 0110 0110 0000 0000 : 1001 1001 0110 0000 = 1221122101100000
  568. 0xC88C0330u,// 28 1100 1000 1000 1100 : 0000 0011 0011 0000 = 2200201120112200
  569. 0xF9000066u,// 29 1111 1001 0000 0000 : 0000 0000 0110 0110 = 2222200201100110
  570. 0x0CC0C22Cu,// 30 0000 1100 1100 0000 : 1100 0010 0010 1100 = 1100221022101100
  571. 0x73108C00u,// 31 0111 0011 0001 0000 : 1000 1100 0000 0000 = 1222112200020000
  572. 0xEC801300u,// 32 1110 1100 1000 0000 : 0001 0011 0000 0000 = 2221221120000000
  573. 0x08CEC400u,// 33 0000 1000 1100 1110 : 1100 0100 0000 0000 = 1100210022002220
  574. 0xEC80004Cu,// 34 1110 1100 1000 0000 : 0000 0000 0100 1100 = 2220220021001100
  575. 0x44442222u,// 35 0100 0100 0100 0100 : 0010 0010 0010 0010 = 0210021002100210
  576. 0x0F0000F0u,// 36 0000 1111 0000 0000 : 0000 0000 1111 0000 = 0000222211110000
  577. 0x49242492u,// 37 0100 1001 0010 0100 : 0010 0100 1001 0010 = 0210210210210210
  578. 0x42942942u,// 38 0100 0010 1001 0100 : 0010 1001 0100 0010 = 0210102121020210
  579. 0x0C30C30Cu,// 39 0000 1100 0011 0000 : 1100 0011 0000 1100 = 1100221100221100
  580. 0x03C0C03Cu,// 40 0000 0011 1100 0000 : 1100 0000 0011 1100 = 1100002222111100
  581. 0xFF0000AAu,// 41 1111 1111 0000 0000 : 0000 0000 1010 1010 = 2222222210101010
  582. 0x5500AA00u,// 42 0101 0101 0000 0000 : 1010 1010 0000 0000 = 1212121200000000
  583. 0xCCCC3030u,// 43 1100 1100 1100 1100 : 0011 0000 0011 0000 = 2211220022112200
  584. 0x0C0CC0C0u,// 44 0000 1100 0000 1100 : 1100 0000 1100 0000 = 1100220011002200
  585. 0x66669090u,// 45 0110 0110 0110 0110 : 1001 0000 1001 0000 = 1221022012210220
  586. 0x0FF0A00Au,// 46 0000 1111 1111 0000 : 1010 0000 0000 1010 = 1010222222221010
  587. 0x5550AAA0u,// 47 0101 0101 0101 0000 : 1010 1010 1010 0000 = 1212121212120000
  588. 0xF0000AAAu,// 48 1111 0000 0000 0000 : 0000 1010 1010 1010 = 2222101010101010
  589. 0x0E0EE0E0u,// 49 0000 1110 0000 1110 : 1110 0000 1110 0000 = 1110222011102220
  590. 0x88887070u,// 50 1000 1000 1000 1000 : 0111 0000 0111 0000 = 2111200021112000
  591. 0x99906660u,// 51 1001 1001 1001 0000 : 0110 0110 0110 0000 = 2112211221120000
  592. 0xE00E0EE0u,// 52 1110 0000 0000 1110 : 0000 1110 1110 0000 = 2220111011102220
  593. 0x88880770u,// 53 1000 1000 1000 1000 : 0000 0111 0111 0000 = 2000211121112000
  594. 0xF0000666u,// 54 1111 0000 0000 0000 : 0000 0110 0110 0110 = 2222011001100110
  595. 0x99006600u,// 55 1001 1001 0000 0000 : 0110 0110 0000 0000 = 2112211200000000
  596. 0xFF000066u,// 56 1111 1111 0000 0000 : 0000 0000 0110 0110 = 2222222201100110
  597. 0xC00C0CC0u,// 57 1100 0000 0000 1100 : 0000 1100 1100 0000 = 2200110011002200
  598. 0xCCCC0330u,// 58 1100 1100 1100 1100 : 0000 0011 0011 0000 = 2200221122112200
  599. 0x90006000u,// 59 1001 0000 0000 0000 : 0110 0000 0000 0000 = 2112000000000000
  600. 0x08088080u,// 60 0000 1000 0000 1000 : 1000 0000 1000 0000 = 1000200010002000
  601. 0xEEEE1010u,// 61 1110 1110 1110 1110 : 0001 0000 0001 0000 = 2221222022212220
  602. 0xFFF0000Au,// 62 1111 1111 1111 0000 : 0000 0000 0000 1010 = 2222222222221010
  603. 0x731008CEu,// 63 0111 0011 0001 0000 : 0000 1000 1100 1110 = 0222102211021110
  604. };
  605. CMP_CONSTANT CGV_INT rampI[5*SOURCE_BLOCK_SIZE] = {
  606. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0 bit index
  607. 0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 1 bit index
  608. 0,21,43,64,0,0,0,0,0,0,0,0,0,0,0,0, // 2 bit index
  609. 0,9,18,27,37,46,55,64,0,0,0,0,0,0,0,0, // 3 bit index
  610. 0,4,9,13,17,21,26,30,34,38,43,47,51,55,60,64 // 4 bit index
  611. };
  612. // same as CMP SDK v3.1 BC7_FIXUPINDEX1 & BC7_FIXUPINDEX2 for each partition range 0..63
  613. // The data is saved as a packed INT = (BC7_FIXUPINDEX1 << 4 + BC7_FIXUPINDEX2)
  614. CMP_CONSTANT CGV_UINT32 FIXUPINDEX[] = {
  615. // 2 subset partitions 0..63
  616. 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u,
  617. 0xf0u, 0x20u, 0x80u, 0x20u, 0x20u, 0x80u, 0x80u, 0xf0u, 0x20u, 0x80u, 0x20u, 0x20u, 0x80u, 0x80u, 0x20u, 0x20u,
  618. 0xf0u, 0xf0u, 0x60u, 0x80u, 0x20u, 0x80u, 0xf0u, 0xf0u, 0x20u, 0x80u, 0x20u, 0x20u, 0x20u, 0xf0u, 0xf0u, 0x60u,
  619. 0x60u, 0x20u, 0x60u, 0x80u, 0xf0u, 0xf0u, 0x20u, 0x20u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0xf0u, 0x20u, 0x20u, 0xf0u,
  620. // 3 subset partitions 64..128
  621. 0x3fu, 0x38u, 0xf8u, 0xf3u, 0x8fu, 0x3fu, 0xf3u, 0xf8u, 0x8fu, 0x8fu, 0x6fu, 0x6fu, 0x6fu, 0x5fu, 0x3fu, 0x38u,
  622. 0x3fu, 0x38u, 0x8fu, 0xf3u, 0x3fu, 0x38u, 0x6fu, 0xa8u, 0x53u, 0x8fu, 0x86u, 0x6au, 0x8fu, 0x5fu, 0xfau, 0xf8u,
  623. 0x8fu, 0xf3u, 0x3fu, 0x5au, 0x6au, 0xa8u, 0x89u, 0xfau, 0xf6u, 0x3fu, 0xf8u, 0x5fu, 0xf3u, 0xf6u, 0xf6u, 0xf8u,
  624. 0x3fu, 0xf3u, 0x5fu, 0x5fu, 0x5fu, 0x8fu, 0x5fu, 0xafu, 0x5fu, 0xafu, 0x8fu, 0xdfu, 0xf3u, 0xcfu, 0x3fu, 0x38u
  625. };
  626. #ifndef ASPM_GPU
  627. // =============================== USED BY DECODER THIS CODE NEEDS TO BE UPDATED =========================================
  628. CMP_CONSTANT CGU_UINT32 BC7_FIXUPINDICES_LOCAL[MAX_SUBSETS][MAX_PARTITIONS][3] = {
  629. // One subset
  630. {
  631. {0, 0, 0},
  632. },
  633. {
  634. {0, 15},{0, 15},{0, 15},{0, 15},
  635. {0, 15},{0, 15},{0, 15},{0, 15},
  636. {0, 15},{0, 15},{0, 15},{0, 15},
  637. {0, 15},{0, 15},{0, 15},{0, 15},
  638. {0, 15},{0, 2},{0, 8},{0, 2},
  639. {0, 2},{0, 8},{0, 8},{0, 15},
  640. {0, 2},{0, 8},{0, 2},{0, 2},
  641. {0, 8},{0, 8},{0, 2},{0, 2},
  642. {0, 15},{0, 15},{0, 6},{0, 8},
  643. {0, 2},{0, 8},{0, 15},{0, 15},
  644. {0, 2},{0, 8},{0, 2},{0, 2},
  645. {0, 2},{0, 15},{0, 15},{0, 6},
  646. {0, 6},{0, 2},{0, 6},{0, 8},
  647. {0, 15},{0, 15},{0, 2},{0, 2},
  648. {0, 15},{0, 15},{0, 15},{0, 15},
  649. {0, 15},{0, 2},{0, 2},{0, 15},
  650. },
  651. // Three subsets
  652. {
  653. {0, 3,15}, {0, 3, 8}, {0,15, 8}, {0,15, 3},
  654. {0, 8,15}, {0, 3,15}, {0,15, 3}, {0,15, 8},
  655. {0, 8,15}, {0, 8,15}, {0, 6,15}, {0, 6,15},
  656. {0, 6,15}, {0, 5,15}, {0, 3,15}, {0, 3, 8},
  657. {0, 3,15}, {0, 3, 8}, {0, 8,15}, {0,15, 3},
  658. {0, 3,15}, {0, 3, 8}, {0, 6,15}, {0,10, 8},
  659. {0, 5, 3}, {0, 8,15}, {0, 8, 6}, {0, 6,10},
  660. {0, 8,15}, {0, 5,15}, {0,15,10}, {0,15, 8},
  661. {0, 8,15}, {0,15, 3}, {0, 3,15}, {0, 5,10},
  662. {0, 6,10}, {0,10, 8}, {0, 8, 9}, {0,15,10},
  663. {0,15, 6}, {0, 3,15}, {0,15, 8}, {0, 5,15},
  664. {0,15, 3}, {0,15, 6}, {0,15, 6}, {0,15, 8},
  665. {0, 3,15}, {0,15, 3}, {0, 5,15}, {0, 5,15},
  666. {0, 5,15}, {0, 8,15}, {0, 5,15}, {0,10,15},
  667. {0, 5,15}, {0,10,15}, {0, 8,15}, {0,13,15},
  668. {0,15, 3}, {0,12,15}, {0, 3,15}, {0, 3, 8}
  669. },
  670. };
  671. CMP_STATIC void SetDefaultBC7Options(BC7_Encode *BC7Encode) {
  672. if (BC7Encode) {
  673. // Set for max quality
  674. BC7Encode->quality = 1.0f;
  675. BC7Encode->minThreshold = 5.0f;
  676. BC7Encode->maxThreshold = 80.0f;
  677. BC7Encode->errorThreshold = 5.0f;
  678. BC7Encode->validModeMask = 0xFF;
  679. BC7Encode->imageNeedsAlpha = FALSE;
  680. BC7Encode->colourRestrict = FALSE;
  681. BC7Encode->alphaRestrict = FALSE;
  682. BC7Encode->channels = 4;
  683. BC7Encode->part_count = 128;
  684. }
  685. }
  686. #ifndef ASPM
  687. //=====================
  688. // Used by Decoder
  689. //=====================
  690. __constant CGU_FLOAT rampLerpWeightsBC7[5][16] = {
  691. { 0.0 }, // 0 bit index
  692. { 0.0, 1.0 }, // 1 bit index
  693. { 0.0, 21.0 / 64.0, 43.0 / 64.0, 1.0 }, // 2 bit index
  694. { 0.0, 9.0 / 64.0, 18.0 / 64.0, 27.0 / 64.0, 37.0 / 64.0, 46.0 / 64.0, 55.0 / 64.0, 1.0 }, // 3 bit index
  695. {
  696. 0.0, 4.0 / 64.0, 9.0 / 64.0, 13.0 / 64.0, 17.0 / 64.0, 21.0 / 64.0, 26.0 / 64.0, 30.0 / 64.0,
  697. 34.0 / 64.0, 38.0 / 64.0, 43.0 / 64.0, 47.0 / 64.0, 51.0 / 64.0, 55.0 / 64.0, 60.0 / 64.0, 1.0
  698. } // 4 bit index
  699. };
  700. __constant CGU_UINT8 BC7_PARTITIONS[MAX_SUBSETS][MAX_PARTITIONS][MAX_SUBSET_SIZE] = {
  701. // Single subset partitions for both BC6H abd BC7
  702. {
  703. {
  704. 0, 0, 0, 0,
  705. 0, 0, 0, 0,
  706. 0, 0, 0, 0,
  707. 0, 0, 0, 0,
  708. },
  709. },
  710. {
  711. {
  712. // 0
  713. 0,0,1,1,
  714. 0,0,1,1,
  715. 0,0,1,1,
  716. 0,0,1,1
  717. },
  718. {
  719. // 1
  720. 0,0,0,1,
  721. 0,0,0,1,
  722. 0,0,0,1,
  723. 0,0,0,1
  724. },
  725. {
  726. // 2
  727. 0,1,1,1,
  728. 0,1,1,1,
  729. 0,1,1,1,
  730. 0,1,1,1
  731. },
  732. {
  733. // 3
  734. 0,0,0,1,
  735. 0,0,1,1,
  736. 0,0,1,1,
  737. 0,1,1,1
  738. },
  739. {
  740. // 4
  741. 0,0,0,0,
  742. 0,0,0,1,
  743. 0,0,0,1,
  744. 0,0,1,1
  745. },
  746. {
  747. // 5
  748. 0,0,1,1,
  749. 0,1,1,1,
  750. 0,1,1,1,
  751. 1,1,1,1
  752. },
  753. {
  754. // 6
  755. 0,0,0,1,
  756. 0,0,1,1,
  757. 0,1,1,1,
  758. 1,1,1,1
  759. },
  760. {
  761. // 7
  762. 0,0,0,0,
  763. 0,0,0,1,
  764. 0,0,1,1,
  765. 0,1,1,1
  766. },
  767. {
  768. // 8
  769. 0,0,0,0,
  770. 0,0,0,0,
  771. 0,0,0,1,
  772. 0,0,1,1
  773. },
  774. {
  775. // 9
  776. 0,0,1,1,
  777. 0,1,1,1,
  778. 1,1,1,1,
  779. 1,1,1,1
  780. },
  781. {
  782. // 10
  783. 0,0,0,0,
  784. 0,0,0,1,
  785. 0,1,1,1,
  786. 1,1,1,1
  787. },
  788. {
  789. // 11
  790. 0,0,0,0,
  791. 0,0,0,0,
  792. 0,0,0,1,
  793. 0,1,1,1
  794. },
  795. {
  796. // 12
  797. 0,0,0,1,
  798. 0,1,1,1,
  799. 1,1,1,1,
  800. 1,1,1,1
  801. },
  802. {
  803. // 13
  804. 0,0,0,0,
  805. 0,0,0,0,
  806. 1,1,1,1,
  807. 1,1,1,1
  808. },
  809. {
  810. // 14
  811. 0,0,0,0,
  812. 1,1,1,1,
  813. 1,1,1,1,
  814. 1,1,1,1
  815. },
  816. {
  817. // 15
  818. 0,0,0,0,
  819. 0,0,0,0,
  820. 0,0,0,0,
  821. 1,1,1,1
  822. },
  823. {
  824. // 16
  825. 0,0,0,0,
  826. 1,0,0,0,
  827. 1,1,1,0,
  828. 1,1,1,1
  829. },
  830. {
  831. // 17
  832. 0,1,1,1,
  833. 0,0,0,1,
  834. 0,0,0,0,
  835. 0,0,0,0
  836. },
  837. {
  838. // 18
  839. 0,0,0,0,
  840. 0,0,0,0,
  841. 1,0,0,0,
  842. 1,1,1,0
  843. },
  844. {
  845. // 19
  846. 0,1,1,1,
  847. 0,0,1,1,
  848. 0,0,0,1,
  849. 0,0,0,0
  850. },
  851. {
  852. // 20
  853. 0,0,1,1,
  854. 0,0,0,1,
  855. 0,0,0,0,
  856. 0,0,0,0
  857. },
  858. {
  859. // 21
  860. 0,0,0,0,
  861. 1,0,0,0,
  862. 1,1,0,0,
  863. 1,1,1,0
  864. },
  865. {
  866. // 22
  867. 0,0,0,0,
  868. 0,0,0,0,
  869. 1,0,0,0,
  870. 1,1,0,0
  871. },
  872. {
  873. // 23
  874. 0,1,1,1,
  875. 0,0,1,1,
  876. 0,0,1,1,
  877. 0,0,0,1
  878. },
  879. {
  880. // 24
  881. 0,0,1,1,
  882. 0,0,0,1,
  883. 0,0,0,1,
  884. 0,0,0,0
  885. },
  886. {
  887. // 25
  888. 0,0,0,0,
  889. 1,0,0,0,
  890. 1,0,0,0,
  891. 1,1,0,0
  892. },
  893. {
  894. // 26
  895. 0,1,1,0,
  896. 0,1,1,0,
  897. 0,1,1,0,
  898. 0,1,1,0
  899. },
  900. {
  901. // 27
  902. 0,0,1,1,
  903. 0,1,1,0,
  904. 0,1,1,0,
  905. 1,1,0,0
  906. },
  907. {
  908. // 28
  909. 0,0,0,1,
  910. 0,1,1,1,
  911. 1,1,1,0,
  912. 1,0,0,0
  913. },
  914. {
  915. // 29
  916. 0,0,0,0,
  917. 1,1,1,1,
  918. 1,1,1,1,
  919. 0,0,0,0
  920. },
  921. {
  922. // 30
  923. 0,1,1,1,
  924. 0,0,0,1,
  925. 1,0,0,0,
  926. 1,1,1,0
  927. },
  928. {
  929. // 31
  930. 0,0,1,1,
  931. 1,0,0,1,
  932. 1,0,0,1,
  933. 1,1,0,0
  934. },
  935. // ----------- BC7 only shapes from here on -------------
  936. {
  937. // 32
  938. 0,1,0,1,
  939. 0,1,0,1,
  940. 0,1,0,1,
  941. 0,1,0,1
  942. },
  943. {
  944. // 33
  945. 0,0,0,0,
  946. 1,1,1,1,
  947. 0,0,0,0,
  948. 1,1,1,1
  949. },
  950. {
  951. // 34
  952. 0,1,0,1,
  953. 1,0,1,0,
  954. 0,1,0,1,
  955. 1,0,1,0
  956. },
  957. {
  958. // 35
  959. 0,0,1,1,
  960. 0,0,1,1,
  961. 1,1,0,0,
  962. 1,1,0,0
  963. },
  964. {
  965. // 36
  966. 0,0,1,1,
  967. 1,1,0,0,
  968. 0,0,1,1,
  969. 1,1,0,0
  970. },
  971. {
  972. // 37
  973. 0,1,0,1,
  974. 0,1,0,1,
  975. 1,0,1,0,
  976. 1,0,1,0
  977. },
  978. {
  979. // 38
  980. 0,1,1,0,
  981. 1,0,0,1,
  982. 0,1,1,0,
  983. 1,0,0,1
  984. },
  985. {
  986. // 39
  987. 0,1,0,1,
  988. 1,0,1,0,
  989. 1,0,1,0,
  990. 0,1,0,1
  991. },
  992. {
  993. // 40
  994. 0,1,1,1,
  995. 0,0,1,1,
  996. 1,1,0,0,
  997. 1,1,1,0
  998. },
  999. {
  1000. // 41
  1001. 0,0,0,1,
  1002. 0,0,1,1,
  1003. 1,1,0,0,
  1004. 1,0,0,0
  1005. },
  1006. {
  1007. // 42
  1008. 0,0,1,1,
  1009. 0,0,1,0,
  1010. 0,1,0,0,
  1011. 1,1,0,0
  1012. },
  1013. {
  1014. // 43
  1015. 0,0,1,1,
  1016. 1,0,1,1,
  1017. 1,1,0,1,
  1018. 1,1,0,0
  1019. },
  1020. {
  1021. // 44
  1022. 0,1,1,0,
  1023. 1,0,0,1,
  1024. 1,0,0,1,
  1025. 0,1,1,0
  1026. },
  1027. {
  1028. // 45
  1029. 0,0,1,1,
  1030. 1,1,0,0,
  1031. 1,1,0,0,
  1032. 0,0,1,1
  1033. },
  1034. {
  1035. // 46
  1036. 0,1,1,0,
  1037. 0,1,1,0,
  1038. 1,0,0,1,
  1039. 1,0,0,1
  1040. },
  1041. {
  1042. // 47
  1043. 0,0,0,0,
  1044. 0,1,1,0,
  1045. 0,1,1,0,
  1046. 0,0,0,0
  1047. },
  1048. {
  1049. // 48
  1050. 0,1,0,0,
  1051. 1,1,1,0,
  1052. 0,1,0,0,
  1053. 0,0,0,0
  1054. },
  1055. {
  1056. // 49
  1057. 0,0,1,0,
  1058. 0,1,1,1,
  1059. 0,0,1,0,
  1060. 0,0,0,0
  1061. },
  1062. {
  1063. // 50
  1064. 0,0,0,0,
  1065. 0,0,1,0,
  1066. 0,1,1,1,
  1067. 0,0,1,0
  1068. },
  1069. {
  1070. // 51
  1071. 0,0,0,0,
  1072. 0,1,0,0,
  1073. 1,1,1,0,
  1074. 0,1,0,0
  1075. },
  1076. {
  1077. // 52
  1078. 0,1,1,0,
  1079. 1,1,0,0,
  1080. 1,0,0,1,
  1081. 0,0,1,1
  1082. },
  1083. {
  1084. // 53
  1085. 0,0,1,1,
  1086. 0,1,1,0,
  1087. 1,1,0,0,
  1088. 1,0,0,1
  1089. },
  1090. {
  1091. // 54
  1092. 0,1,1,0,
  1093. 0,0,1,1,
  1094. 1,0,0,1,
  1095. 1,1,0,0
  1096. },
  1097. {
  1098. // 55
  1099. 0,0,1,1,
  1100. 1,0,0,1,
  1101. 1,1,0,0,
  1102. 0,1,1,0
  1103. },
  1104. {
  1105. // 56
  1106. 0,1,1,0,
  1107. 1,1,0,0,
  1108. 1,1,0,0,
  1109. 1,0,0,1
  1110. },
  1111. {
  1112. // 57
  1113. 0,1,1,0,
  1114. 0,0,1,1,
  1115. 0,0,1,1,
  1116. 1,0,0,1
  1117. },
  1118. {
  1119. // 58
  1120. 0,1,1,1,
  1121. 1,1,1,0,
  1122. 1,0,0,0,
  1123. 0,0,0,1
  1124. },
  1125. {
  1126. // 59
  1127. 0,0,0,1,
  1128. 1,0,0,0,
  1129. 1,1,1,0,
  1130. 0,1,1,1
  1131. },
  1132. {
  1133. // 60
  1134. 0,0,0,0,
  1135. 1,1,1,1,
  1136. 0,0,1,1,
  1137. 0,0,1,1
  1138. },
  1139. {
  1140. // 61
  1141. 0,0,1,1,
  1142. 0,0,1,1,
  1143. 1,1,1,1,
  1144. 0,0,0,0
  1145. },
  1146. {
  1147. // 62
  1148. 0,0,1,0,
  1149. 0,0,1,0,
  1150. 1,1,1,0,
  1151. 1,1,1,0
  1152. },
  1153. {
  1154. // 63
  1155. 0,1,0,0,
  1156. 0,1,0,0,
  1157. 0,1,1,1,
  1158. 0,1,1,1
  1159. },
  1160. },
  1161. // Table.P3 - only for BC7
  1162. {
  1163. {
  1164. 0,0,1,1,
  1165. 0,0,1,1,
  1166. 0,2,2,1,
  1167. 2,2,2,2
  1168. },
  1169. {
  1170. 0,0,0,1,
  1171. 0,0,1,1,
  1172. 2,2,1,1,
  1173. 2,2,2,1
  1174. },
  1175. {
  1176. 0,0,0,0,
  1177. 2,0,0,1,
  1178. 2,2,1,1,
  1179. 2,2,1,1
  1180. },
  1181. {
  1182. 0,2,2,2,
  1183. 0,0,2,2,
  1184. 0,0,1,1,
  1185. 0,1,1,1
  1186. },
  1187. {
  1188. 0,0,0,0,
  1189. 0,0,0,0,
  1190. 1,1,2,2,
  1191. 1,1,2,2
  1192. },
  1193. {
  1194. 0,0,1,1,
  1195. 0,0,1,1,
  1196. 0,0,2,2,
  1197. 0,0,2,2
  1198. },
  1199. {
  1200. 0,0,2,2,
  1201. 0,0,2,2,
  1202. 1,1,1,1,
  1203. 1,1,1,1
  1204. },
  1205. {
  1206. 0,0,1,1,
  1207. 0,0,1,1,
  1208. 2,2,1,1,
  1209. 2,2,1,1
  1210. },
  1211. {
  1212. 0,0,0,0,
  1213. 0,0,0,0,
  1214. 1,1,1,1,
  1215. 2,2,2,2
  1216. },
  1217. {
  1218. 0,0,0,0,
  1219. 1,1,1,1,
  1220. 1,1,1,1,
  1221. 2,2,2,2
  1222. },
  1223. {
  1224. 0,0,0,0,
  1225. 1,1,1,1,
  1226. 2,2,2,2,
  1227. 2,2,2,2
  1228. },
  1229. {
  1230. 0,0,1,2,
  1231. 0,0,1,2,
  1232. 0,0,1,2,
  1233. 0,0,1,2
  1234. },
  1235. {
  1236. 0,1,1,2,
  1237. 0,1,1,2,
  1238. 0,1,1,2,
  1239. 0,1,1,2
  1240. },
  1241. {
  1242. 0,1,2,2,
  1243. 0,1,2,2,
  1244. 0,1,2,2,
  1245. 0,1,2,2
  1246. },
  1247. {
  1248. 0,0,1,1,
  1249. 0,1,1,2,
  1250. 1,1,2,2,
  1251. 1,2,2,2
  1252. },
  1253. {
  1254. 0,0,1,1,
  1255. 2,0,0,1,
  1256. 2,2,0,0,
  1257. 2,2,2,0
  1258. },
  1259. {
  1260. 0,0,0,1,
  1261. 0,0,1,1,
  1262. 0,1,1,2,
  1263. 1,1,2,2
  1264. },
  1265. {
  1266. 0,1,1,1,
  1267. 0,0,1,1,
  1268. 2,0,0,1,
  1269. 2,2,0,0
  1270. },
  1271. {
  1272. 0,0,0,0,
  1273. 1,1,2,2,
  1274. 1,1,2,2,
  1275. 1,1,2,2
  1276. },
  1277. {
  1278. 0,0,2,2,
  1279. 0,0,2,2,
  1280. 0,0,2,2,
  1281. 1,1,1,1
  1282. },
  1283. {
  1284. 0,1,1,1,
  1285. 0,1,1,1,
  1286. 0,2,2,2,
  1287. 0,2,2,2
  1288. },
  1289. {
  1290. 0,0,0,1,
  1291. 0,0,0,1,
  1292. 2,2,2,1,
  1293. 2,2,2,1
  1294. },
  1295. {
  1296. 0,0,0,0,
  1297. 0,0,1,1,
  1298. 0,1,2,2,
  1299. 0,1,2,2
  1300. },
  1301. {
  1302. 0,0,0,0,
  1303. 1,1,0,0,
  1304. 2,2,1,0,
  1305. 2,2,1,0
  1306. },
  1307. {
  1308. 0,1,2,2,
  1309. 0,1,2,2,
  1310. 0,0,1,1,
  1311. 0,0,0,0
  1312. },
  1313. {
  1314. 0,0,1,2,
  1315. 0,0,1,2,
  1316. 1,1,2,2,
  1317. 2,2,2,2
  1318. },
  1319. {
  1320. 0,1,1,0,
  1321. 1,2,2,1,
  1322. 1,2,2,1,
  1323. 0,1,1,0
  1324. },
  1325. {
  1326. 0,0,0,0,
  1327. 0,1,1,0,
  1328. 1,2,2,1,
  1329. 1,2,2,1
  1330. },
  1331. {
  1332. 0,0,2,2,
  1333. 1,1,0,2,
  1334. 1,1,0,2,
  1335. 0,0,2,2
  1336. },
  1337. {
  1338. 0,1,1,0,
  1339. 0,1,1,0,
  1340. 2,0,0,2,
  1341. 2,2,2,2
  1342. },
  1343. {
  1344. 0,0,1,1,
  1345. 0,1,2,2,
  1346. 0,1,2,2,
  1347. 0,0,1,1
  1348. },
  1349. {
  1350. 0,0,0,0,
  1351. 2,0,0,0,
  1352. 2,2,1,1,
  1353. 2,2,2,1
  1354. },
  1355. {
  1356. 0,0,0,0,
  1357. 0,0,0,2,
  1358. 1,1,2,2,
  1359. 1,2,2,2
  1360. },
  1361. {
  1362. 0,2,2,2,
  1363. 0,0,2,2,
  1364. 0,0,1,2,
  1365. 0,0,1,1
  1366. },
  1367. {
  1368. 0,0,1,1,
  1369. 0,0,1,2,
  1370. 0,0,2,2,
  1371. 0,2,2,2
  1372. },
  1373. {
  1374. 0,1,2,0,
  1375. 0,1,2,0,
  1376. 0,1,2,0,
  1377. 0,1,2,0
  1378. },
  1379. {
  1380. 0,0,0,0,
  1381. 1,1,1,1,
  1382. 2,2,2,2,
  1383. 0,0,0,0
  1384. },
  1385. {
  1386. 0,1,2,0,
  1387. 1,2,0,1,
  1388. 2,0,1,2,
  1389. 0,1,2,0
  1390. },
  1391. {
  1392. 0,1,2,0,
  1393. 2,0,1,2,
  1394. 1,2,0,1,
  1395. 0,1,2,0
  1396. },
  1397. {
  1398. 0,0,1,1,
  1399. 2,2,0,0,
  1400. 1,1,2,2,
  1401. 0,0,1,1
  1402. },
  1403. {
  1404. 0,0,1,1,
  1405. 1,1,2,2,
  1406. 2,2,0,0,
  1407. 0,0,1,1
  1408. },
  1409. {
  1410. 0,1,0,1,
  1411. 0,1,0,1,
  1412. 2,2,2,2,
  1413. 2,2,2,2
  1414. },
  1415. {
  1416. 0,0,0,0,
  1417. 0,0,0,0,
  1418. 2,1,2,1,
  1419. 2,1,2,1
  1420. },
  1421. {
  1422. 0,0,2,2,
  1423. 1,1,2,2,
  1424. 0,0,2,2,
  1425. 1,1,2,2
  1426. },
  1427. {
  1428. 0,0,2,2,
  1429. 0,0,1,1,
  1430. 0,0,2,2,
  1431. 0,0,1,1
  1432. },
  1433. {
  1434. 0,2,2,0,
  1435. 1,2,2,1,
  1436. 0,2,2,0,
  1437. 1,2,2,1
  1438. },
  1439. {
  1440. 0,1,0,1,
  1441. 2,2,2,2,
  1442. 2,2,2,2,
  1443. 0,1,0,1
  1444. },
  1445. {
  1446. 0,0,0,0,
  1447. 2,1,2,1,
  1448. 2,1,2,1,
  1449. 2,1,2,1
  1450. },
  1451. {
  1452. 0,1,0,1,
  1453. 0,1,0,1,
  1454. 0,1,0,1,
  1455. 2,2,2,2
  1456. },
  1457. {
  1458. 0,2,2,2,
  1459. 0,1,1,1,
  1460. 0,2,2,2,
  1461. 0,1,1,1
  1462. },
  1463. {
  1464. 0,0,0,2,
  1465. 1,1,1,2,
  1466. 0,0,0,2,
  1467. 1,1,1,2
  1468. },
  1469. {
  1470. 0,0,0,0,
  1471. 2,1,1,2,
  1472. 2,1,1,2,
  1473. 2,1,1,2
  1474. },
  1475. {
  1476. 0,2,2,2,
  1477. 0,1,1,1,
  1478. 0,1,1,1,
  1479. 0,2,2,2
  1480. },
  1481. {
  1482. 0,0,0,2,
  1483. 1,1,1,2,
  1484. 1,1,1,2,
  1485. 0,0,0,2
  1486. },
  1487. {
  1488. 0,1,1,0,
  1489. 0,1,1,0,
  1490. 0,1,1,0,
  1491. 2,2,2,2
  1492. },
  1493. {
  1494. 0,0,0,0,
  1495. 0,0,0,0,
  1496. 2,1,1,2,
  1497. 2,1,1,2
  1498. },
  1499. {
  1500. 0,1,1,0,
  1501. 0,1,1,0,
  1502. 2,2,2,2,
  1503. 2,2,2,2
  1504. },
  1505. {
  1506. 0,0,2,2,
  1507. 0,0,1,1,
  1508. 0,0,1,1,
  1509. 0,0,2,2
  1510. },
  1511. {
  1512. 0,0,2,2,
  1513. 1,1,2,2,
  1514. 1,1,2,2,
  1515. 0,0,2,2
  1516. },
  1517. {
  1518. 0,0,0,0,
  1519. 0,0,0,0,
  1520. 0,0,0,0,
  1521. 2,1,1,2
  1522. },
  1523. {
  1524. 0,0,0,2,
  1525. 0,0,0,1,
  1526. 0,0,0,2,
  1527. 0,0,0,1
  1528. },
  1529. {
  1530. 0,2,2,2,
  1531. 1,2,2,2,
  1532. 0,2,2,2,
  1533. 1,2,2,2
  1534. },
  1535. {
  1536. 0,1,0,1,
  1537. 2,2,2,2,
  1538. 2,2,2,2,
  1539. 2,2,2,2
  1540. },
  1541. {
  1542. 0,1,1,1,
  1543. 2,0,1,1,
  1544. 2,2,0,1,
  1545. 2,2,2,0
  1546. },
  1547. },
  1548. };
  1549. #endif
  1550. #endif // !ASPM_GPU
  1551. #endif