You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

655 lines
20KB

  1. /*
  2. * Texture block decompression
  3. * Copyright (C) 2009 Benjamin Dobell, Glass Echidna
  4. * Copyright (C) 2012 Matthäus G. "Anteru" Chajdas (http://anteru.net)
  5. * Copyright (C) 2015 Vittorio Giovara <vittorio.giovara@gmail.com>
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a
  8. * copy of this software and associated documentation files (the "Software"),
  9. * to deal in the Software without restriction, including without limitation
  10. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  11. * and/or sell copies of the Software, and to permit persons to whom the
  12. * Software is furnished to do so, subject to the following conditions:
  13. * The above copyright notice and this permission notice shall be included
  14. * in all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  22. * IN THE SOFTWARE.
  23. */
  24. #include <stddef.h>
  25. #include <stdint.h>
  26. #include "libavutil/attributes.h"
  27. #include "libavutil/common.h"
  28. #include "libavutil/intreadwrite.h"
  29. #include "libavutil/libm.h"
  30. #include "texturedsp.h"
  31. #define RGBA(r, g, b, a) (((uint8_t)(r) << 0) | \
  32. ((uint8_t)(g) << 8) | \
  33. ((uint8_t)(b) << 16) | \
  34. ((unsigned)(uint8_t)(a) << 24))
  35. static av_always_inline void extract_color(uint32_t colors[4],
  36. uint16_t color0,
  37. uint16_t color1,
  38. int dxtn, int alpha)
  39. {
  40. int tmp;
  41. uint8_t r0, g0, b0, r1, g1, b1;
  42. uint8_t a = dxtn ? 0 : 255;
  43. tmp = (color0 >> 11) * 255 + 16;
  44. r0 = (uint8_t) ((tmp / 32 + tmp) / 32);
  45. tmp = ((color0 & 0x07E0) >> 5) * 255 + 32;
  46. g0 = (uint8_t) ((tmp / 64 + tmp) / 64);
  47. tmp = (color0 & 0x001F) * 255 + 16;
  48. b0 = (uint8_t) ((tmp / 32 + tmp) / 32);
  49. tmp = (color1 >> 11) * 255 + 16;
  50. r1 = (uint8_t) ((tmp / 32 + tmp) / 32);
  51. tmp = ((color1 & 0x07E0) >> 5) * 255 + 32;
  52. g1 = (uint8_t) ((tmp / 64 + tmp) / 64);
  53. tmp = (color1 & 0x001F) * 255 + 16;
  54. b1 = (uint8_t) ((tmp / 32 + tmp) / 32);
  55. if (dxtn || color0 > color1) {
  56. colors[0] = RGBA(r0, g0, b0, a);
  57. colors[1] = RGBA(r1, g1, b1, a);
  58. colors[2] = RGBA((2 * r0 + r1) / 3,
  59. (2 * g0 + g1) / 3,
  60. (2 * b0 + b1) / 3,
  61. a);
  62. colors[3] = RGBA((2 * r1 + r0) / 3,
  63. (2 * g1 + g0) / 3,
  64. (2 * b1 + b0) / 3,
  65. a);
  66. } else {
  67. colors[0] = RGBA(r0, g0, b0, a);
  68. colors[1] = RGBA(r1, g1, b1, a);
  69. colors[2] = RGBA((r0 + r1) / 2,
  70. (g0 + g1) / 2,
  71. (b0 + b1) / 2,
  72. a);
  73. colors[3] = RGBA(0, 0, 0, alpha);
  74. }
  75. }
  76. static inline void dxt1_block_internal(uint8_t *dst, ptrdiff_t stride,
  77. const uint8_t *block, uint8_t alpha)
  78. {
  79. int x, y;
  80. uint32_t colors[4];
  81. uint16_t color0 = AV_RL16(block + 0);
  82. uint16_t color1 = AV_RL16(block + 2);
  83. uint32_t code = AV_RL32(block + 4);
  84. extract_color(colors, color0, color1, 0, alpha);
  85. for (y = 0; y < 4; y++) {
  86. for (x = 0; x < 4; x++) {
  87. uint32_t pixel = colors[code & 3];
  88. code >>= 2;
  89. AV_WL32(dst + x * 4, pixel);
  90. }
  91. dst += stride;
  92. }
  93. }
  94. /**
  95. * Decompress one block of a DXT1 texture and store the resulting
  96. * RGBA pixels in 'dst'. Alpha component is fully opaque.
  97. *
  98. * @param dst output buffer.
  99. * @param stride scanline in bytes.
  100. * @param block block to decompress.
  101. * @return how much texture data has been consumed.
  102. */
  103. static int dxt1_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  104. {
  105. dxt1_block_internal(dst, stride, block, 255);
  106. return 8;
  107. }
  108. /**
  109. * Decompress one block of a DXT1 with 1-bit alpha texture and store
  110. * the resulting RGBA pixels in 'dst'. Alpha is either fully opaque or
  111. * fully transparent.
  112. *
  113. * @param dst output buffer.
  114. * @param stride scanline in bytes.
  115. * @param block block to decompress.
  116. * @return how much texture data has been consumed.
  117. */
  118. static int dxt1a_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  119. {
  120. dxt1_block_internal(dst, stride, block, 0);
  121. return 8;
  122. }
  123. static inline void dxt3_block_internal(uint8_t *dst, ptrdiff_t stride,
  124. const uint8_t *block)
  125. {
  126. int x, y;
  127. uint32_t colors[4];
  128. uint16_t color0 = AV_RL16(block + 8);
  129. uint16_t color1 = AV_RL16(block + 10);
  130. uint32_t code = AV_RL32(block + 12);
  131. extract_color(colors, color0, color1, 1, 0);
  132. for (y = 0; y < 4; y++) {
  133. const uint16_t alpha_code = AV_RL16(block + 2 * y);
  134. uint8_t alpha_values[4];
  135. alpha_values[0] = ((alpha_code >> 0) & 0x0F) * 17;
  136. alpha_values[1] = ((alpha_code >> 4) & 0x0F) * 17;
  137. alpha_values[2] = ((alpha_code >> 8) & 0x0F) * 17;
  138. alpha_values[3] = ((alpha_code >> 12) & 0x0F) * 17;
  139. for (x = 0; x < 4; x++) {
  140. uint8_t alpha = alpha_values[x];
  141. uint32_t pixel = colors[code & 3] | ((unsigned)alpha << 24);
  142. code >>= 2;
  143. AV_WL32(dst + x * 4, pixel);
  144. }
  145. dst += stride;
  146. }
  147. }
  148. /** Convert a premultiplied alpha pixel to a straight alpha pixel. */
  149. static av_always_inline void premult2straight(uint8_t *src)
  150. {
  151. int r = src[0];
  152. int g = src[1];
  153. int b = src[2];
  154. int a = src[3]; /* unchanged */
  155. src[0] = (uint8_t) r * a / 255;
  156. src[1] = (uint8_t) g * a / 255;
  157. src[2] = (uint8_t) b * a / 255;
  158. }
  159. /**
  160. * Decompress one block of a DXT2 texture and store the resulting
  161. * RGBA pixels in 'dst'.
  162. *
  163. * @param dst output buffer.
  164. * @param stride scanline in bytes.
  165. * @param block block to decompress.
  166. * @return how much texture data has been consumed.
  167. */
  168. static int dxt2_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  169. {
  170. int x, y;
  171. dxt3_block_internal(dst, stride, block);
  172. /* This format is DXT3, but returns premultiplied alpha. It needs to be
  173. * converted because it's what lavc outputs (and swscale expects). */
  174. for (y = 0; y < 4; y++)
  175. for (x = 0; x < 4; x++)
  176. premult2straight(dst + x * 4 + y * stride);
  177. return 16;
  178. }
  179. /**
  180. * Decompress one block of a DXT3 texture and store the resulting
  181. * RGBA pixels in 'dst'.
  182. *
  183. * @param dst output buffer.
  184. * @param stride scanline in bytes.
  185. * @param block block to decompress.
  186. * @return how much texture data has been consumed.
  187. */
  188. static int dxt3_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  189. {
  190. dxt3_block_internal(dst, stride, block);
  191. return 16;
  192. }
  193. /**
  194. * Decompress a BC 16x3 index block stored as
  195. * h g f e
  196. * d c b a
  197. * p o n m
  198. * l k j i
  199. *
  200. * Bits packed as
  201. * | h | g | f | e | d | c | b | a | // Entry
  202. * |765 432 107 654 321 076 543 210| // Bit
  203. * |0000000000111111111112222222222| // Byte
  204. *
  205. * into 16 8-bit indices.
  206. */
  207. static void decompress_indices(uint8_t *dst, const uint8_t *src)
  208. {
  209. int block, i;
  210. for (block = 0; block < 2; block++) {
  211. int tmp = AV_RL24(src);
  212. /* Unpack 8x3 bit from last 3 byte block */
  213. for (i = 0; i < 8; i++)
  214. dst[i] = (tmp >> (i * 3)) & 0x7;
  215. src += 3;
  216. dst += 8;
  217. }
  218. }
  219. static inline void dxt5_block_internal(uint8_t *dst, ptrdiff_t stride,
  220. const uint8_t *block)
  221. {
  222. int x, y;
  223. uint32_t colors[4];
  224. uint8_t alpha_indices[16];
  225. uint16_t color0 = AV_RL16(block + 8);
  226. uint16_t color1 = AV_RL16(block + 10);
  227. uint32_t code = AV_RL32(block + 12);
  228. uint8_t alpha0 = *(block);
  229. uint8_t alpha1 = *(block + 1);
  230. decompress_indices(alpha_indices, block + 2);
  231. extract_color(colors, color0, color1, 1, 0);
  232. for (y = 0; y < 4; y++) {
  233. for (x = 0; x < 4; x++) {
  234. int alpha_code = alpha_indices[x + y * 4];
  235. uint32_t pixel;
  236. uint8_t alpha;
  237. if (alpha_code == 0) {
  238. alpha = alpha0;
  239. } else if (alpha_code == 1) {
  240. alpha = alpha1;
  241. } else {
  242. if (alpha0 > alpha1) {
  243. alpha = (uint8_t) (((8 - alpha_code) * alpha0 +
  244. (alpha_code - 1) * alpha1) / 7);
  245. } else {
  246. if (alpha_code == 6) {
  247. alpha = 0;
  248. } else if (alpha_code == 7) {
  249. alpha = 255;
  250. } else {
  251. alpha = (uint8_t) (((6 - alpha_code) * alpha0 +
  252. (alpha_code - 1) * alpha1) / 5);
  253. }
  254. }
  255. }
  256. pixel = colors[code & 3] | ((unsigned)alpha << 24);
  257. code >>= 2;
  258. AV_WL32(dst + x * 4, pixel);
  259. }
  260. dst += stride;
  261. }
  262. }
  263. /**
  264. * Decompress one block of a DXT4 texture and store the resulting
  265. * RGBA pixels in 'dst'.
  266. *
  267. * @param dst output buffer.
  268. * @param stride scanline in bytes.
  269. * @param block block to decompress.
  270. * @return how much texture data has been consumed.
  271. */
  272. static int dxt4_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  273. {
  274. int x, y;
  275. dxt5_block_internal(dst, stride, block);
  276. /* This format is DXT5, but returns premultiplied alpha. It needs to be
  277. * converted because it's what lavc outputs (and swscale expects). */
  278. for (y = 0; y < 4; y++)
  279. for (x = 0; x < 4; x++)
  280. premult2straight(dst + x * 4 + y * stride);
  281. return 16;
  282. }
  283. /**
  284. * Decompress one block of a DXT5 texture and store the resulting
  285. * RGBA pixels in 'dst'.
  286. *
  287. * @param dst output buffer.
  288. * @param stride scanline in bytes.
  289. * @param block block to decompress.
  290. * @return how much texture data has been consumed.
  291. */
  292. static int dxt5_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  293. {
  294. dxt5_block_internal(dst, stride, block);
  295. return 16;
  296. }
  297. /**
  298. * Convert a YCoCg buffer to RGBA.
  299. *
  300. * @param src input buffer.
  301. * @param scaled variant with scaled chroma components and opaque alpha.
  302. */
  303. static av_always_inline void ycocg2rgba(uint8_t *src, int scaled)
  304. {
  305. int r = src[0];
  306. int g = src[1];
  307. int b = src[2];
  308. int a = src[3];
  309. int s = scaled ? (b >> 3) + 1 : 1;
  310. int y = a;
  311. int co = (r - 128) / s;
  312. int cg = (g - 128) / s;
  313. src[0] = av_clip_uint8(y + co - cg);
  314. src[1] = av_clip_uint8(y + cg);
  315. src[2] = av_clip_uint8(y - co - cg);
  316. src[3] = scaled ? 255 : b;
  317. }
  318. /**
  319. * Decompress one block of a DXT5 texture with classic YCoCg and store
  320. * the resulting RGBA pixels in 'dst'. Alpha component is fully opaque.
  321. *
  322. * @param dst output buffer.
  323. * @param stride scanline in bytes.
  324. * @param block block to decompress.
  325. * @return how much texture data has been consumed.
  326. */
  327. static int dxt5y_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  328. {
  329. int x, y;
  330. /* This format is basically DXT5, with luma stored in alpha.
  331. * Run a normal decompress and then reorder the components. */
  332. dxt5_block_internal(dst, stride, block);
  333. for (y = 0; y < 4; y++)
  334. for (x = 0; x < 4; x++)
  335. ycocg2rgba(dst + x * 4 + y * stride, 0);
  336. return 16;
  337. }
  338. /**
  339. * Decompress one block of a DXT5 texture with scaled YCoCg and store
  340. * the resulting RGBA pixels in 'dst'. Alpha component is fully opaque.
  341. *
  342. * @param dst output buffer.
  343. * @param stride scanline in bytes.
  344. * @param block block to decompress.
  345. * @return how much texture data has been consumed.
  346. */
  347. static int dxt5ys_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  348. {
  349. int x, y;
  350. /* This format is basically DXT5, with luma stored in alpha.
  351. * Run a normal decompress and then reorder the components. */
  352. dxt5_block_internal(dst, stride, block);
  353. for (y = 0; y < 4; y++)
  354. for (x = 0; x < 4; x++)
  355. ycocg2rgba(dst + x * 4 + y * stride, 1);
  356. return 16;
  357. }
  358. static inline void rgtc_block_internal(uint8_t *dst, ptrdiff_t stride,
  359. const uint8_t *block,
  360. const int *color_tab, int mono, int offset, int pix_size)
  361. {
  362. uint8_t indices[16];
  363. int x, y;
  364. decompress_indices(indices, block + 2);
  365. /* Only one or two channels are stored at most, since it only used to
  366. * compress specular (black and white) or normal (red and green) maps.
  367. * Although the standard says to zero out unused components, many
  368. * implementations fill all of them with the same value. */
  369. for (y = 0; y < 4; y++) {
  370. for (x = 0; x < 4; x++) {
  371. int i = indices[x + y * 4];
  372. /* Interval expansion from [-1 1] or [0 1] to [0 255]. */
  373. int c = color_tab[i];
  374. if (mono){
  375. dst [x * pix_size + y * stride + offset] = (uint8_t)c;
  376. }
  377. else{
  378. uint32_t pixel = RGBA(c, c, c, 255U);
  379. AV_WL32(dst + x * pix_size + y * stride, pixel);
  380. }
  381. }
  382. }
  383. }
  384. static inline void rgtc1_block_internal(uint8_t *dst, ptrdiff_t stride,
  385. const uint8_t *block, int sign, int mono, int offset, int pix_size)
  386. {
  387. int color_table[8];
  388. int r0, r1;
  389. if (sign) {
  390. /* signed data is in [-128 127] so just offset it to unsigned
  391. * and it can be treated exactly the same */
  392. r0 = ((int8_t) block[0]) + 128;
  393. r1 = ((int8_t) block[1]) + 128;
  394. } else {
  395. r0 = block[0];
  396. r1 = block[1];
  397. }
  398. color_table[0] = r0;
  399. color_table[1] = r1;
  400. if (r0 > r1) {
  401. /* 6 interpolated color values */
  402. color_table[2] = (6 * r0 + 1 * r1) / 7; // bit code 010
  403. color_table[3] = (5 * r0 + 2 * r1) / 7; // bit code 011
  404. color_table[4] = (4 * r0 + 3 * r1) / 7; // bit code 100
  405. color_table[5] = (3 * r0 + 4 * r1) / 7; // bit code 101
  406. color_table[6] = (2 * r0 + 5 * r1) / 7; // bit code 110
  407. color_table[7] = (1 * r0 + 6 * r1) / 7; // bit code 111
  408. } else {
  409. /* 4 interpolated color values */
  410. color_table[2] = (4 * r0 + 1 * r1) / 5; // bit code 010
  411. color_table[3] = (3 * r0 + 2 * r1) / 5; // bit code 011
  412. color_table[4] = (2 * r0 + 3 * r1) / 5; // bit code 100
  413. color_table[5] = (1 * r0 + 4 * r1) / 5; // bit code 101
  414. color_table[6] = 0; /* min range */ // bit code 110
  415. color_table[7] = 255; /* max range */ // bit code 111
  416. }
  417. rgtc_block_internal(dst, stride, block, color_table, mono, offset, pix_size);
  418. }
  419. /**
  420. * Decompress one block of a RGRC1 texture with signed components
  421. * and store the resulting RGBA pixels in 'dst'.
  422. *
  423. * @param dst output buffer.
  424. * @param stride scanline in bytes.
  425. * @param block block to decompress.
  426. * @return how much texture data has been consumed.
  427. */
  428. static int rgtc1s_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  429. {
  430. rgtc1_block_internal(dst, stride, block, 1, 0, 0, 4);
  431. return 8;
  432. }
  433. /**
  434. * Decompress one block of a RGRC1 texture with unsigned components
  435. * and store the resulting RGBA pixels in 'dst'.
  436. *
  437. * @param dst output buffer.
  438. * @param stride scanline in bytes.
  439. * @param block block to decompress.
  440. * @return how much texture data has been consumed.
  441. */
  442. static int rgtc1u_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  443. {
  444. rgtc1_block_internal(dst, stride, block, 0, 0, 0, 4);
  445. return 8;
  446. }
  447. /**
  448. * Decompress one block of a RGTC1 texture with unsigned components
  449. * and overwrite the alpha component in 'dst' (RGBA data).
  450. *
  451. * @param dst output buffer.
  452. * @param stride scanline in bytes.
  453. * @param block block to decompress.
  454. * @return how much texture data has been consumed.
  455. */
  456. static int rgtc1u_alpha_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  457. {
  458. rgtc1_block_internal(dst, stride, block, 0, 1, 3, 4);
  459. return 8;
  460. }
  461. /**
  462. * Decompress one block of a RGTC1 texture with unsigned components
  463. * to Gray 8.
  464. *
  465. * @param dst output buffer.
  466. * @param stride scanline in bytes.
  467. * @param block block to decompress.
  468. * @return how much texture data has been consumed.
  469. */
  470. static int rgtc1u_gray_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  471. {
  472. rgtc1_block_internal(dst, stride, block, 0, 1, 0, 1);
  473. return 8;
  474. }
  475. static inline void rgtc2_block_internal(uint8_t *dst, ptrdiff_t stride,
  476. const uint8_t *block, int sign)
  477. {
  478. /* 4x4 block containing 4 component pixels. */
  479. uint8_t c0[4 * 4 * 4];
  480. uint8_t c1[4 * 4 * 4];
  481. int x, y;
  482. /* Decompress the two channels separately and interleave them afterwards. */
  483. rgtc1_block_internal(c0, 16, block, sign, 0, 0, 4);
  484. rgtc1_block_internal(c1, 16, block + 8, sign, 0, 0, 4);
  485. /* B is rebuilt exactly like a normal map. */
  486. for (y = 0; y < 4; y++) {
  487. for (x = 0; x < 4; x++) {
  488. uint8_t *p = dst + x * 4 + y * stride;
  489. int r = c0[x * 4 + y * 16];
  490. int g = c1[x * 4 + y * 16];
  491. int b = 127;
  492. int d = (255 * 255 - r * r - g * g) / 2;
  493. if (d > 0)
  494. b = lrint(sqrtf(d));
  495. p[0] = r;
  496. p[1] = g;
  497. p[2] = b;
  498. p[3] = 255;
  499. }
  500. }
  501. }
  502. /**
  503. * Decompress one block of a RGRC2 texture with signed components
  504. * and store the resulting RGBA pixels in 'dst'. Alpha is fully opaque.
  505. *
  506. * @param dst output buffer.
  507. * @param stride scanline in bytes.
  508. * @param block block to decompress.
  509. * @return how much texture data has been consumed.
  510. */
  511. static int rgtc2s_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  512. {
  513. rgtc2_block_internal(dst, stride, block, 1);
  514. return 16;
  515. }
  516. /**
  517. * Decompress one block of a RGRC2 texture with unsigned components
  518. * and store the resulting RGBA pixels in 'dst'. Alpha is fully opaque.
  519. *
  520. * @param dst output buffer.
  521. * @param stride scanline in bytes.
  522. * @param block block to decompress.
  523. * @return how much texture data has been consumed.
  524. */
  525. static int rgtc2u_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  526. {
  527. rgtc2_block_internal(dst, stride, block, 0);
  528. return 16;
  529. }
  530. /**
  531. * Decompress one block of a 3Dc texture with unsigned components
  532. * and store the resulting RGBA pixels in 'dst'. Alpha is fully opaque.
  533. *
  534. * @param dst output buffer.
  535. * @param stride scanline in bytes.
  536. * @param block block to decompress.
  537. * @return how much texture data has been consumed.
  538. */
  539. static int dxn3dc_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
  540. {
  541. int x, y;
  542. rgtc2_block_internal(dst, stride, block, 0);
  543. /* This is the 3Dc variant of RGTC2, with swapped R and G. */
  544. for (y = 0; y < 4; y++) {
  545. for (x = 0; x < 4; x++) {
  546. uint8_t *p = dst + x * 4 + y * stride;
  547. FFSWAP(uint8_t, p[0], p[1]);
  548. }
  549. }
  550. return 16;
  551. }
  552. av_cold void ff_texturedsp_init(TextureDSPContext *c)
  553. {
  554. c->dxt1_block = dxt1_block;
  555. c->dxt1a_block = dxt1a_block;
  556. c->dxt2_block = dxt2_block;
  557. c->dxt3_block = dxt3_block;
  558. c->dxt4_block = dxt4_block;
  559. c->dxt5_block = dxt5_block;
  560. c->dxt5y_block = dxt5y_block;
  561. c->dxt5ys_block = dxt5ys_block;
  562. c->rgtc1s_block = rgtc1s_block;
  563. c->rgtc1u_block = rgtc1u_block;
  564. c->rgtc1u_gray_block = rgtc1u_gray_block;
  565. c->rgtc1u_alpha_block = rgtc1u_alpha_block;
  566. c->rgtc2s_block = rgtc2s_block;
  567. c->rgtc2u_block = rgtc2u_block;
  568. c->dxn3dc_block = dxn3dc_block;
  569. }