1 /**************************************************************************
3 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
4 * Copyright (c) 2008 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * 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.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 **************************************************************************/
28 #include "u_format_s3tc.h"
31 #if defined(_WIN32) || defined(WIN32)
32 #define DXTN_LIBNAME "dxtn.dll"
34 #define DXTN_LIBNAME "libtxc_dxtn.so"
38 boolean util_format_s3tc_enabled
= FALSE
;
40 util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch
= NULL
;
41 util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch
= NULL
;
42 util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch
= NULL
;
43 util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch
= NULL
;
45 util_format_dxtn_pack_t util_format_dxtn_pack
= NULL
;
49 util_format_s3tc_init(void)
51 static struct util_dl_library
*
54 if (util_format_s3tc_enabled
)
58 library
= util_dl_open(DXTN_LIBNAME
);
60 debug_printf("couldn't open " DXTN_LIBNAME
", software DXTn "
61 "compression/decompression unavailable");
64 util_format_dxt1_rgb_fetch
= (util_format_dxtn_fetch_t
)
65 util_dl_get_proc_address(library
, "fetch_2d_texel_rgb_dxt1");
66 util_format_dxt1_rgba_fetch
= (util_format_dxtn_fetch_t
)
67 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt1");
68 util_format_dxt3_rgba_fetch
= (util_format_dxtn_fetch_t
)
69 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt3");
70 util_format_dxt5_rgba_fetch
= (util_format_dxtn_fetch_t
)
71 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt5");
72 util_format_dxtn_pack
= (util_format_dxtn_pack_t
)
73 util_dl_get_proc_address(library
, "tx_compress_dxtn");
75 if (util_format_dxt1_rgb_fetch
||
76 util_format_dxt1_rgba_fetch
||
77 util_format_dxt3_rgba_fetch
||
78 util_format_dxt5_rgba_fetch
||
79 util_format_dxtn_pack
) {
80 util_format_s3tc_enabled
= TRUE
;
81 debug_printf("software DXTn compression/decompression available");
84 debug_printf("couldn't reference all symbols in "
85 DXTN_LIBNAME
", software DXTn compression/decompression "
98 util_format_dxt1_rgb_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
100 if (util_format_dxt1_rgb_fetch
) {
101 util_format_dxt1_rgb_fetch(0, src
, i
, j
, dst
);
106 util_format_dxt1_rgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
108 if (util_format_dxt1_rgba_fetch
) {
109 util_format_dxt1_rgba_fetch(0, src
, i
, j
, dst
);
114 util_format_dxt3_rgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
116 if (util_format_dxt3_rgba_fetch
) {
117 util_format_dxt3_rgba_fetch(0, src
, i
, j
, dst
);
122 util_format_dxt5_rgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
124 if (util_format_dxt5_rgba_fetch
) {
125 util_format_dxt5_rgba_fetch(0, src
, i
, j
, dst
);
130 util_format_dxt1_rgb_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
132 if (util_format_dxt1_rgb_fetch
) {
134 util_format_dxt1_rgb_fetch(0, src
, i
, j
, tmp
);
135 dst
[0] = ubyte_to_float(tmp
[0]);
136 dst
[1] = ubyte_to_float(tmp
[1]);
137 dst
[2] = ubyte_to_float(tmp
[2]);
143 util_format_dxt1_rgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
145 if (util_format_dxt1_rgba_fetch
) {
147 util_format_dxt1_rgba_fetch(0, src
, i
, j
, tmp
);
148 dst
[0] = ubyte_to_float(tmp
[0]);
149 dst
[1] = ubyte_to_float(tmp
[1]);
150 dst
[2] = ubyte_to_float(tmp
[2]);
151 dst
[3] = ubyte_to_float(tmp
[3]);
156 util_format_dxt3_rgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
158 if (util_format_dxt3_rgba_fetch
) {
160 util_format_dxt3_rgba_fetch(0, src
, i
, j
, tmp
);
161 dst
[0] = ubyte_to_float(tmp
[0]);
162 dst
[1] = ubyte_to_float(tmp
[1]);
163 dst
[2] = ubyte_to_float(tmp
[2]);
164 dst
[3] = ubyte_to_float(tmp
[3]);
169 util_format_dxt5_rgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
171 if (util_format_dxt5_rgba_fetch
) {
173 util_format_dxt5_rgba_fetch(0, src
, i
, j
, tmp
);
174 dst
[0] = ubyte_to_float(tmp
[0]);
175 dst
[1] = ubyte_to_float(tmp
[1]);
176 dst
[2] = ubyte_to_float(tmp
[2]);
177 dst
[3] = ubyte_to_float(tmp
[3]);
183 * Block decompression.
187 util_format_dxt1_rgb_unpack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
189 if (util_format_dxt1_rgb_fetch
) {
191 for(y
= 0; y
< height
; y
+= 4) {
192 const uint8_t *src
= src_row
;
193 for(x
= 0; x
< width
; x
+= 4) {
194 for(j
= 0; j
< 4; ++j
) {
195 for(i
= 0; i
< 4; ++i
) {
196 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
197 util_format_dxt1_rgb_fetch(0, src
, i
, j
, dst
);
202 src_row
+= src_stride
;
208 util_format_dxt1_rgba_unpack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
210 if (util_format_dxt1_rgba_fetch
) {
212 for(y
= 0; y
< height
; y
+= 4) {
213 const uint8_t *src
= src_row
;
214 for(x
= 0; x
< width
; x
+= 4) {
215 for(j
= 0; j
< 4; ++j
) {
216 for(i
= 0; i
< 4; ++i
) {
217 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
218 util_format_dxt1_rgba_fetch(0, src
, i
, j
, dst
);
223 src_row
+= src_stride
;
229 util_format_dxt3_rgba_unpack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
231 if (util_format_dxt3_rgba_fetch
) {
233 for(y
= 0; y
< height
; y
+= 4) {
234 const uint8_t *src
= src_row
;
235 for(x
= 0; x
< width
; x
+= 4) {
236 for(j
= 0; j
< 4; ++j
) {
237 for(i
= 0; i
< 4; ++i
) {
238 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
239 util_format_dxt3_rgba_fetch(0, src
, i
, j
, dst
);
244 src_row
+= src_stride
;
250 util_format_dxt5_rgba_unpack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
252 if (util_format_dxt5_rgba_fetch
) {
254 for(y
= 0; y
< height
; y
+= 4) {
255 const uint8_t *src
= src_row
;
256 for(x
= 0; x
< width
; x
+= 4) {
257 for(j
= 0; j
< 4; ++j
) {
258 for(i
= 0; i
< 4; ++i
) {
259 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
260 util_format_dxt5_rgba_fetch(0, src
, i
, j
, dst
);
265 src_row
+= src_stride
;
271 util_format_dxt1_rgb_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
273 if (util_format_dxt1_rgb_fetch
) {
275 for(y
= 0; y
< height
; y
+= 4) {
276 const uint8_t *src
= src_row
;
277 for(x
= 0; x
< width
; x
+= 4) {
278 for(j
= 0; j
< 4; ++j
) {
279 for(i
= 0; i
< 4; ++i
) {
280 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
282 util_format_dxt1_rgb_fetch(0, src
, i
, j
, tmp
);
283 dst
[0] = ubyte_to_float(tmp
[0]);
284 dst
[1] = ubyte_to_float(tmp
[1]);
285 dst
[2] = ubyte_to_float(tmp
[2]);
291 src_row
+= src_stride
;
297 util_format_dxt1_rgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
299 if (util_format_dxt1_rgba_fetch
) {
301 for(y
= 0; y
< height
; y
+= 4) {
302 const uint8_t *src
= src_row
;
303 for(x
= 0; x
< width
; x
+= 4) {
304 for(j
= 0; j
< 4; ++j
) {
305 for(i
= 0; i
< 4; ++i
) {
306 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
308 util_format_dxt1_rgba_fetch(0, src
, i
, j
, tmp
);
309 dst
[0] = ubyte_to_float(tmp
[0]);
310 dst
[1] = ubyte_to_float(tmp
[1]);
311 dst
[2] = ubyte_to_float(tmp
[2]);
312 dst
[3] = ubyte_to_float(tmp
[3]);
317 src_row
+= src_stride
;
323 util_format_dxt3_rgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
325 if (util_format_dxt3_rgba_fetch
) {
327 for(y
= 0; y
< height
; y
+= 4) {
328 const uint8_t *src
= src_row
;
329 for(x
= 0; x
< width
; x
+= 4) {
330 for(j
= 0; j
< 4; ++j
) {
331 for(i
= 0; i
< 4; ++i
) {
332 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
334 util_format_dxt3_rgba_fetch(0, src
, i
, j
, tmp
);
335 dst
[0] = ubyte_to_float(tmp
[0]);
336 dst
[1] = ubyte_to_float(tmp
[1]);
337 dst
[2] = ubyte_to_float(tmp
[2]);
338 dst
[3] = ubyte_to_float(tmp
[3]);
343 src_row
+= src_stride
;
349 util_format_dxt5_rgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
351 if (util_format_dxt5_rgba_fetch
) {
353 for(y
= 0; y
< height
; y
+= 4) {
354 const uint8_t *src
= src_row
;
355 for(x
= 0; x
< width
; x
+= 4) {
356 for(j
= 0; j
< 4; ++j
) {
357 for(i
= 0; i
< 4; ++i
) {
358 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
360 util_format_dxt5_rgba_fetch(0, src
, i
, j
, tmp
);
361 dst
[0] = ubyte_to_float(tmp
[0]);
362 dst
[1] = ubyte_to_float(tmp
[1]);
363 dst
[2] = ubyte_to_float(tmp
[2]);
364 dst
[3] = ubyte_to_float(tmp
[3]);
369 src_row
+= src_stride
;
380 util_format_dxt1_rgb_pack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
382 if (util_format_dxtn_pack
) {
383 unsigned x
, y
, i
, j
, k
;
384 for(y
= 0; y
< height
; y
+= 4) {
385 const uint8_t *src
= src_row
;
386 uint8_t *dst
= dst_row
;
387 for(x
= 0; x
< width
; x
+= 4) {
388 uint8_t tmp
[4][4][3];
389 for(j
= 0; j
< 4; ++j
) {
390 for(i
= 0; i
< 4; ++i
) {
391 for(k
= 0; k
< 3; ++k
) {
392 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
396 util_format_dxtn_pack(3, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGB
, dst
, dst_stride
);
400 src_row
+= src_stride
;
401 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
407 util_format_dxt1_rgba_pack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
409 if (util_format_dxtn_pack
) {
410 unsigned x
, y
, i
, j
, k
;
411 for(y
= 0; y
< height
; y
+= 4) {
412 const uint8_t *src
= src_row
;
413 uint8_t *dst
= dst_row
;
414 for(x
= 0; x
< width
; x
+= 4) {
415 uint8_t tmp
[4][4][4];
416 for(j
= 0; j
< 4; ++j
) {
417 for(i
= 0; i
< 4; ++i
) {
418 for(k
= 0; k
< 4; ++k
) {
419 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
423 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGBA
, dst
, dst_stride
);
427 src_row
+= src_stride
;
428 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
434 util_format_dxt3_rgba_pack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
436 if (util_format_dxtn_pack
) {
437 unsigned x
, y
, i
, j
, k
;
438 for(y
= 0; y
< height
; y
+= 4) {
439 const uint8_t *src
= src_row
;
440 uint8_t *dst
= dst_row
;
441 for(x
= 0; x
< width
; x
+= 4) {
442 uint8_t tmp
[4][4][4];
443 for(j
= 0; j
< 4; ++j
) {
444 for(i
= 0; i
< 4; ++i
) {
445 for(k
= 0; k
< 4; ++k
) {
446 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
450 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT3_RGBA
, dst
, dst_stride
);
454 src_row
+= src_stride
;
455 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
461 util_format_dxt5_rgba_pack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
463 if (util_format_dxtn_pack
) {
464 unsigned x
, y
, i
, j
, k
;
465 for(y
= 0; y
< height
; y
+= 4) {
466 const uint8_t *src
= src_row
;
467 uint8_t *dst
= dst_row
;
468 for(x
= 0; x
< width
; x
+= 4) {
469 uint8_t tmp
[4][4][4];
470 for(j
= 0; j
< 4; ++j
) {
471 for(i
= 0; i
< 4; ++i
) {
472 for(k
= 0; k
< 4; ++k
) {
473 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
477 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT5_RGBA
, dst
, dst_stride
);
481 src_row
+= src_stride
;
482 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
488 util_format_dxt1_rgb_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
490 if (util_format_dxtn_pack
) {
491 unsigned x
, y
, i
, j
, k
;
492 for(y
= 0; y
< height
; y
+= 4) {
493 const float *src
= src_row
;
494 uint8_t *dst
= dst_row
;
495 for(x
= 0; x
< width
; x
+= 4) {
496 uint8_t tmp
[4][4][3];
497 for(j
= 0; j
< 4; ++j
) {
498 for(i
= 0; i
< 4; ++i
) {
499 for(k
= 0; k
< 3; ++k
) {
500 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
504 util_format_dxtn_pack(3, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGB
, dst
, dst_stride
);
508 src_row
+= src_stride
;
509 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
515 util_format_dxt1_rgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
517 if (util_format_dxtn_pack
) {
518 unsigned x
, y
, i
, j
, k
;
519 for(y
= 0; y
< height
; y
+= 4) {
520 const float *src
= src_row
;
521 uint8_t *dst
= dst_row
;
522 for(x
= 0; x
< width
; x
+= 4) {
523 uint8_t tmp
[4][4][4];
524 for(j
= 0; j
< 4; ++j
) {
525 for(i
= 0; i
< 4; ++i
) {
526 for(k
= 0; k
< 4; ++k
) {
527 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
531 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGBA
, dst
, dst_stride
);
535 src_row
+= src_stride
;
536 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
542 util_format_dxt3_rgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
544 if (util_format_dxtn_pack
) {
545 unsigned x
, y
, i
, j
, k
;
546 for(y
= 0; y
< height
; y
+= 4) {
547 const float *src
= src_row
;
548 uint8_t *dst
= dst_row
;
549 for(x
= 0; x
< width
; x
+= 4) {
550 uint8_t tmp
[4][4][4];
551 for(j
= 0; j
< 4; ++j
) {
552 for(i
= 0; i
< 4; ++i
) {
553 for(k
= 0; k
< 4; ++k
) {
554 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
558 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT3_RGBA
, dst
, dst_stride
);
562 src_row
+= src_stride
;
563 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
569 util_format_dxt5_rgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
571 if (util_format_dxtn_pack
) {
572 unsigned x
, y
, i
, j
, k
;
573 for(y
= 0; y
< height
; y
+= 4) {
574 const float *src
= src_row
;
575 uint8_t *dst
= dst_row
;
576 for(x
= 0; x
< width
; x
+= 4) {
577 uint8_t tmp
[4][4][4];
578 for(j
= 0; j
< 4; ++j
) {
579 for(i
= 0; i
< 4; ++i
) {
580 for(k
= 0; k
< 4; ++k
) {
581 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
585 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT5_RGBA
, dst
, dst_stride
);
589 src_row
+= src_stride
;
590 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
599 * FIXME: shunts to RGB for now
603 util_format_dxt1_srgb_unpack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
605 util_format_dxt1_rgb_unpack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
609 util_format_dxt1_srgb_pack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
611 util_format_dxt1_rgb_pack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
615 util_format_dxt1_srgb_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
617 util_format_dxt1_rgb_fetch_8unorm(dst
, src
, i
, j
);
621 util_format_dxt1_srgba_unpack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
623 util_format_dxt1_rgba_unpack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
627 util_format_dxt1_srgba_pack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
629 util_format_dxt1_rgba_pack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
633 util_format_dxt1_srgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
635 util_format_dxt1_rgba_fetch_8unorm(dst
, src
, i
, j
);
639 util_format_dxt3_srgba_unpack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
641 util_format_dxt3_rgba_unpack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
645 util_format_dxt3_srgba_pack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
647 util_format_dxt3_rgba_pack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
651 util_format_dxt3_srgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
653 util_format_dxt3_rgba_fetch_8unorm(dst
, src
, i
, j
);
657 util_format_dxt5_srgba_unpack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
659 util_format_dxt5_rgba_unpack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
663 util_format_dxt5_srgba_pack_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
665 util_format_dxt5_rgba_pack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
669 util_format_dxt5_srgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
671 util_format_dxt5_rgba_fetch_8unorm(dst
, src
, i
, j
);
675 util_format_dxt1_srgb_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
677 util_format_dxt1_rgb_unpack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
681 util_format_dxt1_srgb_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
683 util_format_dxt1_rgb_pack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
687 util_format_dxt1_srgb_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
689 util_format_dxt1_rgb_fetch_float(dst
, src
, i
, j
);
693 util_format_dxt1_srgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
695 util_format_dxt1_rgba_unpack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
699 util_format_dxt1_srgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
701 util_format_dxt1_rgba_pack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
705 util_format_dxt1_srgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
707 util_format_dxt1_rgba_fetch_float(dst
, src
, i
, j
);
711 util_format_dxt3_srgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
713 util_format_dxt3_rgba_unpack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
717 util_format_dxt3_srgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
719 util_format_dxt3_rgba_pack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
723 util_format_dxt3_srgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
725 util_format_dxt3_rgba_fetch_float(dst
, src
, i
, j
);
729 util_format_dxt5_srgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
731 util_format_dxt5_rgba_unpack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
735 util_format_dxt5_srgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
737 util_format_dxt5_rgba_pack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
741 util_format_dxt5_srgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
743 util_format_dxt5_rgba_fetch_float(dst
, src
, i
, j
);