Blender  V2.93
BlockDXT.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 /*
22  * This file is based on a similar file from the NVIDIA texture tools
23  * (http://nvidia-texture-tools.googlecode.com/)
24  *
25  * Original license from NVIDIA follows.
26  */
27 
28 /* Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
29  *
30  * Permission is hereby granted, free of charge, to any person
31  * obtaining a copy of this software and associated documentation
32  * files (the "Software"), to deal in the Software without
33  * restriction, including without limitation the rights to use,
34  * copy, modify, merge, publish, distribute, sublicense, and/or sell
35  * copies of the Software, and to permit persons to whom the
36  * Software is furnished to do so, subject to the following
37  * conditions:
38  *
39  * The above copyright notice and this permission notice shall be
40  * included in all copies or substantial portions of the Software.
41  *
42  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
43  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
44  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
45  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
46  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
47  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
48  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
49  * OTHER DEALINGS IN THE SOFTWARE. */
50 
51 #include <BlockDXT.h>
52 #include <ColorBlock.h>
53 #include <Common.h>
54 #include <Stream.h>
55 
56 /* ---------------------------------------------------------------------------
57  * BlockDXT1
58  * --------------------------------------------------------------------------*/
59 
61 {
62  /* Does bit expansion before interpolation. */
63  color_array[0].b = (col0.b << 3) | (col0.b >> 2);
64  color_array[0].g = (col0.g << 2) | (col0.g >> 4);
65  color_array[0].r = (col0.r << 3) | (col0.r >> 2);
66  color_array[0].a = 0xFF;
67 
68  /* @@ Same as above, but faster?
69  * Color32 c;
70  * c.u = ((col0.u << 3) & 0xf8) | ((col0.u << 5) & 0xfc00) | ((col0.u << 8) & 0xf80000);
71  * c.u |= (c.u >> 5) & 0x070007;
72  * c.u |= (c.u >> 6) & 0x000300;
73  * color_array[0].u = c.u; */
74 
75  color_array[1].r = (col1.r << 3) | (col1.r >> 2);
76  color_array[1].g = (col1.g << 2) | (col1.g >> 4);
77  color_array[1].b = (col1.b << 3) | (col1.b >> 2);
78  color_array[1].a = 0xFF;
79 
80  /* @@ Same as above, but faster?
81  * c.u = ((col1.u << 3) & 0xf8) | ((col1.u << 5) & 0xfc00) | ((col1.u << 8) & 0xf80000);
82  * c.u |= (c.u >> 5) & 0x070007;
83  * c.u |= (c.u >> 6) & 0x000300;
84  * color_array[1].u = c.u; */
85 
86  if (col0.u > col1.u) {
87  /* Four-color block: derive the other two colors. */
88  color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3;
89  color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
90  color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3;
91  color_array[2].a = 0xFF;
92 
93  color_array[3].r = (2 * color_array[1].r + color_array[0].r) / 3;
94  color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3;
95  color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3;
96  color_array[3].a = 0xFF;
97 
98  return 4;
99  }
100 
101  /* Three-color block: derive the other color. */
102  color_array[2].r = (color_array[0].r + color_array[1].r) / 2;
103  color_array[2].g = (color_array[0].g + color_array[1].g) / 2;
104  color_array[2].b = (color_array[0].b + color_array[1].b) / 2;
105  color_array[2].a = 0xFF;
106 
107  /* Set all components to 0 to match DXT specs. */
108  color_array[3].r = 0x00; /* color_array[2].r; */
109  color_array[3].g = 0x00; /* color_array[2].g; */
110  color_array[3].b = 0x00; /* color_array[2].b; */
111  color_array[3].a = 0x00;
112 
113  return 3;
114 }
115 
117 {
118  /* Does bit expansion before interpolation. */
119  color_array[0].b = (3 * col0.b * 22) / 8;
120  color_array[0].g = (col0.g << 2) | (col0.g >> 4);
121  color_array[0].r = (3 * col0.r * 22) / 8;
122  color_array[0].a = 0xFF;
123 
124  color_array[1].r = (3 * col1.r * 22) / 8;
125  color_array[1].g = (col1.g << 2) | (col1.g >> 4);
126  color_array[1].b = (3 * col1.b * 22) / 8;
127  color_array[1].a = 0xFF;
128 
129  int gdiff = color_array[1].g - color_array[0].g;
130 
131  if (col0.u > col1.u) {
132  /* Four-color block: derive the other two colors. */
133  color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8;
134  color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256;
135  color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8;
136  color_array[2].a = 0xFF;
137 
138  color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8;
139  color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256;
140  color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8;
141  color_array[3].a = 0xFF;
142 
143  return 4;
144  }
145 
146  /* Three-color block: derive the other color. */
147  color_array[2].r = ((col0.r + col1.r) * 33) / 8;
148  color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
149  color_array[2].b = ((col0.b + col1.b) * 33) / 8;
150  color_array[2].a = 0xFF;
151 
152  /* Set all components to 0 to match DXT specs. */
153  color_array[3].r = 0x00; /* color_array[2].r; */
154  color_array[3].g = 0x00; /* color_array[2].g; */
155  color_array[3].b = 0x00; /* color_array[2].b; */
156  color_array[3].a = 0x00;
157 
158  return 3;
159 }
160 
161 /* Evaluate palette assuming 3 color block. */
162 void BlockDXT1::evaluatePalette3(Color32 color_array[4]) const
163 {
164  color_array[0].b = (col0.b << 3) | (col0.b >> 2);
165  color_array[0].g = (col0.g << 2) | (col0.g >> 4);
166  color_array[0].r = (col0.r << 3) | (col0.r >> 2);
167  color_array[0].a = 0xFF;
168 
169  color_array[1].r = (col1.r << 3) | (col1.r >> 2);
170  color_array[1].g = (col1.g << 2) | (col1.g >> 4);
171  color_array[1].b = (col1.b << 3) | (col1.b >> 2);
172  color_array[1].a = 0xFF;
173 
174  /* Three-color block: derive the other color. */
175  color_array[2].r = (color_array[0].r + color_array[1].r) / 2;
176  color_array[2].g = (color_array[0].g + color_array[1].g) / 2;
177  color_array[2].b = (color_array[0].b + color_array[1].b) / 2;
178  color_array[2].a = 0xFF;
179 
180  /* Set all components to 0 to match DXT specs. */
181  color_array[3].r = 0x00; /* color_array[2].r; */
182  color_array[3].g = 0x00; /* color_array[2].g; */
183  color_array[3].b = 0x00; /* color_array[2].b; */
184  color_array[3].a = 0x00;
185 }
186 
187 /* Evaluate palette assuming 4 color block. */
188 void BlockDXT1::evaluatePalette4(Color32 color_array[4]) const
189 {
190  color_array[0].b = (col0.b << 3) | (col0.b >> 2);
191  color_array[0].g = (col0.g << 2) | (col0.g >> 4);
192  color_array[0].r = (col0.r << 3) | (col0.r >> 2);
193  color_array[0].a = 0xFF;
194 
195  color_array[1].r = (col1.r << 3) | (col1.r >> 2);
196  color_array[1].g = (col1.g << 2) | (col1.g >> 4);
197  color_array[1].b = (col1.b << 3) | (col1.b >> 2);
198  color_array[1].a = 0xFF;
199 
200  /* Four-color block: derive the other two colors. */
201  color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3;
202  color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
203  color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3;
204  color_array[2].a = 0xFF;
205 
206  color_array[3].r = (2 * color_array[1].r + color_array[0].r) / 3;
207  color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3;
208  color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3;
209  color_array[3].a = 0xFF;
210 }
211 
213 {
214  /* Decode color block. */
215  Color32 color_array[4];
216  evaluatePalette(color_array);
217 
218  /* Write color block. */
219  for (uint j = 0; j < 4; j++) {
220  for (uint i = 0; i < 4; i++) {
221  uint idx = (row[j] >> (2 * i)) & 3;
222  block->color(i, j) = color_array[idx];
223  }
224  }
225 }
226 
228 {
229  /* Decode color block. */
230  Color32 color_array[4];
231  evaluatePaletteNV5x(color_array);
232 
233  /* Write color block. */
234  for (uint j = 0; j < 4; j++) {
235  for (uint i = 0; i < 4; i++) {
236  uint idx = (row[j] >> (2 * i)) & 3;
237  block->color(i, j) = color_array[idx];
238  }
239  }
240 }
241 
242 void BlockDXT1::setIndices(const int *idx)
243 {
244  indices = 0;
245  for (uint i = 0; i < 16; i++) {
246  indices |= (idx[i] & 3) << (2 * i);
247  }
248 }
249 
251 inline void BlockDXT1::flip4()
252 {
253  swap(row[0], row[3]);
254  swap(row[1], row[2]);
255 }
256 
258 inline void BlockDXT1::flip2()
259 {
260  swap(row[0], row[1]);
261 }
262 
263 /* ---------------------------------------------------------------------------
264  * BlockDXT3
265  * ---------------------------------------------------------------------------*/
266 
268 {
269  /* Decode color. */
270  color.decodeBlock(block);
271 
272  /* Decode alpha. */
273  alpha.decodeBlock(block);
274 }
275 
277 {
278  color.decodeBlockNV5x(block);
279  alpha.decodeBlock(block);
280 }
281 
283 {
284  block->color(0x0).a = (alpha0 << 4) | alpha0;
285  block->color(0x1).a = (alpha1 << 4) | alpha1;
286  block->color(0x2).a = (alpha2 << 4) | alpha2;
287  block->color(0x3).a = (alpha3 << 4) | alpha3;
288  block->color(0x4).a = (alpha4 << 4) | alpha4;
289  block->color(0x5).a = (alpha5 << 4) | alpha5;
290  block->color(0x6).a = (alpha6 << 4) | alpha6;
291  block->color(0x7).a = (alpha7 << 4) | alpha7;
292  block->color(0x8).a = (alpha8 << 4) | alpha8;
293  block->color(0x9).a = (alpha9 << 4) | alpha9;
294  block->color(0xA).a = (alphaA << 4) | alphaA;
295  block->color(0xB).a = (alphaB << 4) | alphaB;
296  block->color(0xC).a = (alphaC << 4) | alphaC;
297  block->color(0xD).a = (alphaD << 4) | alphaD;
298  block->color(0xE).a = (alphaE << 4) | alphaE;
299  block->color(0xF).a = (alphaF << 4) | alphaF;
300 }
301 
304 {
305  swap(row[0], row[3]);
306  swap(row[1], row[2]);
307 }
308 
311 {
312  swap(row[0], row[1]);
313 }
314 
317 {
318  alpha.flip4();
319  color.flip4();
320 }
321 
324 {
325  alpha.flip2();
326  color.flip2();
327 }
328 
329 /* ---------------------------------------------------------------------------
330  * BlockDXT5
331  * ---------------------------------------------------------------------------*/
332 
334 {
335  if (alpha0() > alpha1()) {
337  }
338  else {
340  }
341 }
342 
344 {
345  /* 8-alpha block: derive the other six alphas.
346  * Bit code 000 = alpha0, 001 = alpha1, others are interpolated. */
347  alpha[0] = alpha0();
348  alpha[1] = alpha1();
349  alpha[2] = (6 * alpha[0] + 1 * alpha[1]) / 7; /* bit code 010 */
350  alpha[3] = (5 * alpha[0] + 2 * alpha[1]) / 7; /* bit code 011 */
351  alpha[4] = (4 * alpha[0] + 3 * alpha[1]) / 7; /* bit code 100 */
352  alpha[5] = (3 * alpha[0] + 4 * alpha[1]) / 7; /* bit code 101 */
353  alpha[6] = (2 * alpha[0] + 5 * alpha[1]) / 7; /* bit code 110 */
354  alpha[7] = (1 * alpha[0] + 6 * alpha[1]) / 7; /* bit code 111 */
355 }
356 
358 {
359  /* 6-alpha block.
360  * Bit code 000 = alpha0, 001 = alpha1, others are interpolated. */
361  alpha[0] = alpha0();
362  alpha[1] = alpha1();
363  alpha[2] = (4 * alpha[0] + 1 * alpha[1]) / 5; /* Bit code 010 */
364  alpha[3] = (3 * alpha[0] + 2 * alpha[1]) / 5; /* Bit code 011 */
365  alpha[4] = (2 * alpha[0] + 3 * alpha[1]) / 5; /* Bit code 100 */
366  alpha[5] = (1 * alpha[0] + 4 * alpha[1]) / 5; /* Bit code 101 */
367  alpha[6] = 0x00; /* Bit code 110 */
368  alpha[7] = 0xFF; /* Bit code 111 */
369 }
370 
371 void AlphaBlockDXT5::indices(uint8 index_array[16]) const
372 {
373  index_array[0x0] = bits0();
374  index_array[0x1] = bits1();
375  index_array[0x2] = bits2();
376  index_array[0x3] = bits3();
377  index_array[0x4] = bits4();
378  index_array[0x5] = bits5();
379  index_array[0x6] = bits6();
380  index_array[0x7] = bits7();
381  index_array[0x8] = bits8();
382  index_array[0x9] = bits9();
383  index_array[0xA] = bitsA();
384  index_array[0xB] = bitsB();
385  index_array[0xC] = bitsC();
386  index_array[0xD] = bitsD();
387  index_array[0xE] = bitsE();
388  index_array[0xF] = bitsF();
389 }
390 
392 {
393  int offset = (3 * index + 16);
394  return uint((this->u >> offset) & 0x7);
395 }
396 
398 {
399  int offset = (3 * index + 16);
400  uint64 mask = uint64(0x7) << offset;
401  this->u = (this->u & ~mask) | (uint64(value) << offset);
402 }
403 
405 {
406  uint8 alpha_array[8];
407  evaluatePalette(alpha_array);
408 
409  uint8 index_array[16];
410  indices(index_array);
411 
412  for (uint i = 0; i < 16; i++) {
413  block->color(i).a = alpha_array[index_array[i]];
414  }
415 }
416 
418 {
419  uint64 *b = (uint64 *)this;
420 
421  /* @@ The masks might have to be byte swapped. */
422  uint64 tmp = (*b & (uint64)(0x000000000000FFFFLL));
423  tmp |= (*b & (uint64)(0x000000000FFF0000LL)) << 36;
424  tmp |= (*b & (uint64)(0x000000FFF0000000LL)) << 12;
425  tmp |= (*b & (uint64)(0x000FFF0000000000LL)) >> 12;
426  tmp |= (*b & (uint64)(0xFFF0000000000000LL)) >> 36;
427 
428  *b = tmp;
429 }
430 
432 {
433  uint *b = (uint *)this;
434 
435  /* @@ The masks might have to be byte swapped. */
436  uint tmp = (*b & 0xFF000000);
437  tmp |= (*b & 0x00000FFF) << 12;
438  tmp |= (*b & 0x00FFF000) >> 12;
439 
440  *b = tmp;
441 }
442 
444 {
445  /* Decode color. */
446  color.decodeBlock(block);
447 
448  /* Decode alpha. */
449  alpha.decodeBlock(block);
450 }
451 
453 {
454  /* Decode color. */
455  color.decodeBlockNV5x(block);
456 
457  /* Decode alpha. */
458  alpha.decodeBlock(block);
459 }
460 
463 {
464  alpha.flip4();
465  color.flip4();
466 }
467 
470 {
471  alpha.flip2();
472  color.flip2();
473 }
474 
477 {
478  uint8 alpha_array[8];
479  alpha.evaluatePalette(alpha_array);
480 
481  uint8 index_array[16];
482  alpha.indices(index_array);
483 
484  for (uint i = 0; i < 16; i++) {
485  Color32 &c = block->color(i);
486  c.b = c.g = c.r = alpha_array[index_array[i]];
487  c.a = 255;
488  }
489 }
490 
493 {
494  alpha.flip4();
495 }
496 
499 {
500  alpha.flip2();
501 }
502 
505 {
506  uint8 alpha_array[8];
507  uint8 index_array[16];
508 
509  x.evaluatePalette(alpha_array);
510  x.indices(index_array);
511 
512  for (uint i = 0; i < 16; i++) {
513  Color32 &c = block->color(i);
514  c.r = alpha_array[index_array[i]];
515  }
516 
517  y.evaluatePalette(alpha_array);
518  y.indices(index_array);
519 
520  for (uint i = 0; i < 16; i++) {
521  Color32 &c = block->color(i);
522  c.g = alpha_array[index_array[i]];
523  c.b = 0;
524  c.a = 255;
525  }
526 }
527 
530 {
531  x.flip4();
532  y.flip4();
533 }
534 
537 {
538  x.flip2();
539  y.flip2();
540 }
541 
542 void BlockCTX1::evaluatePalette(Color32 color_array[4]) const
543 {
544  /* Does bit expansion before interpolation. */
545  color_array[0].b = 0x00;
546  color_array[0].g = col0[1];
547  color_array[0].r = col0[0];
548  color_array[0].a = 0xFF;
549 
550  color_array[1].r = 0x00;
551  color_array[1].g = col0[1];
552  color_array[1].b = col1[0];
553  color_array[1].a = 0xFF;
554 
555  color_array[2].r = 0x00;
556  color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
557  color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3;
558  color_array[2].a = 0xFF;
559 
560  color_array[3].r = 0x00;
561  color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3;
562  color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3;
563  color_array[3].a = 0xFF;
564 }
565 
567 {
568  /* Decode color block. */
569  Color32 color_array[4];
570  evaluatePalette(color_array);
571 
572  /* Write color block. */
573  for (uint j = 0; j < 4; j++) {
574  for (uint i = 0; i < 4; i++) {
575  uint idx = (row[j] >> (2 * i)) & 3;
576  block->color(i, j) = color_array[idx];
577  }
578  }
579 }
580 
581 void BlockCTX1::setIndices(const int *idx)
582 {
583  indices = 0;
584  for (uint i = 0; i < 16; i++) {
585  indices |= (idx[i] & 3) << (2 * i);
586  }
587 }
588 
590 inline void BlockCTX1::flip4()
591 {
592  swap(row[0], row[3]);
593  swap(row[1], row[2]);
594 }
595 
597 inline void BlockCTX1::flip2()
598 {
599  swap(row[0], row[1]);
600 }
601 
602 void mem_read(Stream &mem, BlockDXT1 &block)
603 {
604  mem_read(mem, block.col0.u);
605  mem_read(mem, block.col1.u);
606  mem_read(mem, block.indices);
607 }
608 
609 void mem_read(Stream &mem, AlphaBlockDXT3 &block)
610 {
611  for (unsigned short &alpha : block.row) {
612  mem_read(mem, alpha);
613  }
614 }
615 
616 void mem_read(Stream &mem, BlockDXT3 &block)
617 {
618  mem_read(mem, block.alpha);
619  mem_read(mem, block.color);
620 }
621 
622 void mem_read(Stream &mem, AlphaBlockDXT5 &block)
623 {
624  mem_read(mem, block.u);
625 }
626 
627 void mem_read(Stream &mem, BlockDXT5 &block)
628 {
629  mem_read(mem, block.alpha);
630  mem_read(mem, block.color);
631 }
632 
633 void mem_read(Stream &mem, BlockATI1 &block)
634 {
635  mem_read(mem, block.alpha);
636 }
637 
638 void mem_read(Stream &mem, BlockATI2 &block)
639 {
640  mem_read(mem, block.x);
641  mem_read(mem, block.y);
642 }
643 
644 void mem_read(Stream &mem, BlockCTX1 &block)
645 {
646  mem_read(mem, block.col0[0]);
647  mem_read(mem, block.col0[1]);
648  mem_read(mem, block.col1[0]);
649  mem_read(mem, block.col1[1]);
650  mem_read(mem, block.indices);
651 }
unsigned int uint
Definition: BLI_sys_types.h:83
void mem_read(Stream &mem, BlockDXT1 &block)
Definition: BlockDXT.cpp:602
unsigned long long uint64
Definition: Common.h:44
void swap(T &a, T &b)
Definition: Common.h:33
unsigned char uint8
Definition: Common.h:40
unsigned short g
Definition: Color.h:112
unsigned short b
Definition: Color.h:111
unsigned short u
Definition: Color.h:115
unsigned short r
Definition: Color.h:113
Definition: Color.h:33
unsigned char g
Definition: Color.h:90
unsigned char b
Definition: Color.h:90
unsigned char r
Definition: Color.h:90
unsigned char a
Definition: Color.h:90
static CCL_NAMESPACE_BEGIN const double alpha
static unsigned c
Definition: RandGen.cpp:97
void decodeBlock(ColorBlock *block) const
Definition: BlockDXT.cpp:282
uint16 row[4]
Definition: BlockDXT.h:111
void indices(uint8 index_array[16]) const
Definition: BlockDXT.cpp:371
uint index(uint index) const
Definition: BlockDXT.cpp:391
uint8 bits6() const
Definition: BlockDXT.h:193
void setIndex(uint index, uint value)
Definition: BlockDXT.cpp:397
uint8 alpha0() const
Definition: BlockDXT.h:161
uint8 bitsF() const
Definition: BlockDXT.h:229
uint8 bitsD() const
Definition: BlockDXT.h:221
uint8 bits9() const
Definition: BlockDXT.h:205
uint8 bits2() const
Definition: BlockDXT.h:177
void decodeBlock(ColorBlock *block) const
Definition: BlockDXT.cpp:404
uint8 bits0() const
Definition: BlockDXT.h:169
uint8 bitsC() const
Definition: BlockDXT.h:217
void evaluatePalette8(uint8 alpha[8]) const
Definition: BlockDXT.cpp:343
void evaluatePalette(uint8 alpha[8]) const
Definition: BlockDXT.cpp:333
uint8 bitsB() const
Definition: BlockDXT.h:213
uint8 bits7() const
Definition: BlockDXT.h:197
void evaluatePalette6(uint8 alpha[8]) const
Definition: BlockDXT.cpp:357
uint8 bits5() const
Definition: BlockDXT.h:189
uint8 bits4() const
Definition: BlockDXT.h:185
uint8 bitsE() const
Definition: BlockDXT.h:225
uint8 alpha1() const
Definition: BlockDXT.h:165
uint8 bits8() const
Definition: BlockDXT.h:201
uint8 bits3() const
Definition: BlockDXT.h:181
uint8 bits1() const
Definition: BlockDXT.h:173
uint8 bitsA() const
Definition: BlockDXT.h:209
void decodeBlock(ColorBlock *block) const
Definition: BlockDXT.cpp:476
void flip2()
Definition: BlockDXT.cpp:498
AlphaBlockDXT5 alpha
Definition: BlockDXT.h:262
void flip4()
Definition: BlockDXT.cpp:492
AlphaBlockDXT5 y
Definition: BlockDXT.h:273
void decodeBlock(ColorBlock *block) const
Definition: BlockDXT.cpp:504
AlphaBlockDXT5 x
Definition: BlockDXT.h:272
void flip2()
Definition: BlockDXT.cpp:536
void flip4()
Definition: BlockDXT.cpp:529
void flip4()
Definition: BlockDXT.cpp:590
uint indices
Definition: BlockDXT.h:287
uint8 col1[2]
Definition: BlockDXT.h:284
void decodeBlock(ColorBlock *block) const
Definition: BlockDXT.cpp:566
void flip2()
Definition: BlockDXT.cpp:597
void setIndices(const int *idx)
Definition: BlockDXT.cpp:581
uint8 row[4]
Definition: BlockDXT.h:286
uint8 col0[2]
Definition: BlockDXT.h:283
void evaluatePalette(Color32 color_array[4]) const
Definition: BlockDXT.cpp:542
Color16 col1
Definition: BlockDXT.h:61
void evaluatePalette3(Color32 color_array[4]) const
Definition: BlockDXT.cpp:162
void decodeBlock(ColorBlock *block) const
Definition: BlockDXT.cpp:212
void evaluatePalette4(Color32 color_array[4]) const
Definition: BlockDXT.cpp:188
void setIndices(const int *idx)
Definition: BlockDXT.cpp:242
void flip4()
Definition: BlockDXT.cpp:251
Color16 col0
Definition: BlockDXT.h:60
uint evaluatePalette(Color32 color_array[4]) const
Definition: BlockDXT.cpp:60
void flip2()
Definition: BlockDXT.cpp:258
uint indices
Definition: BlockDXT.h:64
void decodeBlockNV5x(ColorBlock *block) const
Definition: BlockDXT.cpp:227
uint8 row[4]
Definition: BlockDXT.h:63
uint evaluatePaletteNV5x(Color32 color_array[4]) const
Definition: BlockDXT.cpp:116
void decodeBlockNV5x(ColorBlock *block) const
Definition: BlockDXT.cpp:276
void flip4()
Definition: BlockDXT.cpp:316
void decodeBlock(ColorBlock *block) const
Definition: BlockDXT.cpp:267
BlockDXT1 color
Definition: BlockDXT.h:123
void flip2()
Definition: BlockDXT.cpp:323
AlphaBlockDXT3 alpha
Definition: BlockDXT.h:122
BlockDXT1 color
Definition: BlockDXT.h:251
void decodeBlockNV5x(ColorBlock *block) const
Definition: BlockDXT.cpp:452
void flip4()
Definition: BlockDXT.cpp:462
void flip2()
Definition: BlockDXT.cpp:469
AlphaBlockDXT5 alpha
Definition: BlockDXT.h:250
void decodeBlock(ColorBlock *block) const
Definition: BlockDXT.cpp:443
Color32 color(uint i) const
Definition: ColorBlock.h:71
Definition: Stream.h:25
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)