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"
39 util_format_dxt1_rgb_fetch_stub(int src_stride
,
49 util_format_dxt1_rgba_fetch_stub(int src_stride
,
59 util_format_dxt3_rgba_fetch_stub(int src_stride
,
69 util_format_dxt5_rgba_fetch_stub(int src_stride
,
79 util_format_dxtn_pack_stub(int src_comps
,
80 int width
, int height
,
82 enum util_format_dxtn dst_format
,
90 boolean util_format_s3tc_enabled
= FALSE
;
92 util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch
= util_format_dxt1_rgb_fetch_stub
;
93 util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch
= util_format_dxt1_rgba_fetch_stub
;
94 util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch
= util_format_dxt3_rgba_fetch_stub
;
95 util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch
= util_format_dxt5_rgba_fetch_stub
;
97 util_format_dxtn_pack_t util_format_dxtn_pack
= util_format_dxtn_pack_stub
;
101 util_format_s3tc_init(void)
103 static boolean first_time
= TRUE
;
104 struct util_dl_library
*library
= NULL
;
105 util_dl_proc fetch_2d_texel_rgb_dxt1
;
106 util_dl_proc fetch_2d_texel_rgba_dxt1
;
107 util_dl_proc fetch_2d_texel_rgba_dxt3
;
108 util_dl_proc fetch_2d_texel_rgba_dxt5
;
109 util_dl_proc tx_compress_dxtn
;
115 if (util_format_s3tc_enabled
)
118 library
= util_dl_open(DXTN_LIBNAME
);
120 debug_printf("couldn't open " DXTN_LIBNAME
", software DXTn "
121 "compression/decompression unavailable");
125 fetch_2d_texel_rgb_dxt1
=
126 util_dl_get_proc_address(library
, "fetch_2d_texel_rgb_dxt1");
127 fetch_2d_texel_rgba_dxt1
=
128 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt1");
129 fetch_2d_texel_rgba_dxt3
=
130 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt3");
131 fetch_2d_texel_rgba_dxt5
=
132 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt5");
134 util_dl_get_proc_address(library
, "tx_compress_dxtn");
136 if (!util_format_dxt1_rgb_fetch
||
137 !util_format_dxt1_rgba_fetch
||
138 !util_format_dxt3_rgba_fetch
||
139 !util_format_dxt5_rgba_fetch
||
140 !util_format_dxtn_pack
) {
141 debug_printf("couldn't reference all symbols in " DXTN_LIBNAME
142 ", software DXTn compression/decompression "
147 util_format_dxt1_rgb_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgb_dxt1
;
148 util_format_dxt1_rgba_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgba_dxt1
;
149 util_format_dxt3_rgba_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgba_dxt3
;
150 util_format_dxt5_rgba_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgba_dxt5
;
151 util_format_dxtn_pack
= (util_format_dxtn_pack_t
)tx_compress_dxtn
;
152 util_format_s3tc_enabled
= TRUE
;
161 util_format_dxt1_rgb_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
163 util_format_dxt1_rgb_fetch(0, src
, i
, j
, dst
);
167 util_format_dxt1_rgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
169 util_format_dxt1_rgba_fetch(0, src
, i
, j
, dst
);
173 util_format_dxt3_rgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
175 util_format_dxt3_rgba_fetch(0, src
, i
, j
, dst
);
179 util_format_dxt5_rgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
181 util_format_dxt5_rgba_fetch(0, src
, i
, j
, dst
);
185 util_format_dxt1_rgb_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
188 util_format_dxt1_rgb_fetch(0, src
, i
, j
, tmp
);
189 dst
[0] = ubyte_to_float(tmp
[0]);
190 dst
[1] = ubyte_to_float(tmp
[1]);
191 dst
[2] = ubyte_to_float(tmp
[2]);
196 util_format_dxt1_rgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
199 util_format_dxt1_rgba_fetch(0, src
, i
, j
, tmp
);
200 dst
[0] = ubyte_to_float(tmp
[0]);
201 dst
[1] = ubyte_to_float(tmp
[1]);
202 dst
[2] = ubyte_to_float(tmp
[2]);
203 dst
[3] = ubyte_to_float(tmp
[3]);
207 util_format_dxt3_rgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
210 util_format_dxt3_rgba_fetch(0, src
, i
, j
, tmp
);
211 dst
[0] = ubyte_to_float(tmp
[0]);
212 dst
[1] = ubyte_to_float(tmp
[1]);
213 dst
[2] = ubyte_to_float(tmp
[2]);
214 dst
[3] = ubyte_to_float(tmp
[3]);
218 util_format_dxt5_rgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
221 util_format_dxt5_rgba_fetch(0, src
, i
, j
, tmp
);
222 dst
[0] = ubyte_to_float(tmp
[0]);
223 dst
[1] = ubyte_to_float(tmp
[1]);
224 dst
[2] = ubyte_to_float(tmp
[2]);
225 dst
[3] = ubyte_to_float(tmp
[3]);
230 * Block decompression.
234 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
)
237 for(y
= 0; y
< height
; y
+= 4) {
238 const uint8_t *src
= src_row
;
239 for(x
= 0; x
< width
; x
+= 4) {
240 for(j
= 0; j
< 4; ++j
) {
241 for(i
= 0; i
< 4; ++i
) {
242 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
243 util_format_dxt1_rgb_fetch(0, src
, i
, j
, dst
);
248 src_row
+= src_stride
;
253 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
)
256 for(y
= 0; y
< height
; y
+= 4) {
257 const uint8_t *src
= src_row
;
258 for(x
= 0; x
< width
; x
+= 4) {
259 for(j
= 0; j
< 4; ++j
) {
260 for(i
= 0; i
< 4; ++i
) {
261 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
262 util_format_dxt1_rgba_fetch(0, src
, i
, j
, dst
);
267 src_row
+= src_stride
;
272 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
)
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 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
281 util_format_dxt3_rgba_fetch(0, src
, i
, j
, dst
);
286 src_row
+= src_stride
;
291 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
)
294 for(y
= 0; y
< height
; y
+= 4) {
295 const uint8_t *src
= src_row
;
296 for(x
= 0; x
< width
; x
+= 4) {
297 for(j
= 0; j
< 4; ++j
) {
298 for(i
= 0; i
< 4; ++i
) {
299 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
300 util_format_dxt5_rgba_fetch(0, src
, i
, j
, dst
);
305 src_row
+= src_stride
;
310 util_format_dxt1_rgb_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
313 for(y
= 0; y
< height
; y
+= 4) {
314 const uint8_t *src
= src_row
;
315 for(x
= 0; x
< width
; x
+= 4) {
316 for(j
= 0; j
< 4; ++j
) {
317 for(i
= 0; i
< 4; ++i
) {
318 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
320 util_format_dxt1_rgb_fetch(0, src
, i
, j
, tmp
);
321 dst
[0] = ubyte_to_float(tmp
[0]);
322 dst
[1] = ubyte_to_float(tmp
[1]);
323 dst
[2] = ubyte_to_float(tmp
[2]);
329 src_row
+= src_stride
;
334 util_format_dxt1_rgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
337 for(y
= 0; y
< height
; y
+= 4) {
338 const uint8_t *src
= src_row
;
339 for(x
= 0; x
< width
; x
+= 4) {
340 for(j
= 0; j
< 4; ++j
) {
341 for(i
= 0; i
< 4; ++i
) {
342 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
344 util_format_dxt1_rgba_fetch(0, src
, i
, j
, tmp
);
345 dst
[0] = ubyte_to_float(tmp
[0]);
346 dst
[1] = ubyte_to_float(tmp
[1]);
347 dst
[2] = ubyte_to_float(tmp
[2]);
348 dst
[3] = ubyte_to_float(tmp
[3]);
353 src_row
+= src_stride
;
358 util_format_dxt3_rgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
361 for(y
= 0; y
< height
; y
+= 4) {
362 const uint8_t *src
= src_row
;
363 for(x
= 0; x
< width
; x
+= 4) {
364 for(j
= 0; j
< 4; ++j
) {
365 for(i
= 0; i
< 4; ++i
) {
366 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
368 util_format_dxt3_rgba_fetch(0, src
, i
, j
, tmp
);
369 dst
[0] = ubyte_to_float(tmp
[0]);
370 dst
[1] = ubyte_to_float(tmp
[1]);
371 dst
[2] = ubyte_to_float(tmp
[2]);
372 dst
[3] = ubyte_to_float(tmp
[3]);
377 src_row
+= src_stride
;
382 util_format_dxt5_rgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
385 for(y
= 0; y
< height
; y
+= 4) {
386 const uint8_t *src
= src_row
;
387 for(x
= 0; x
< width
; x
+= 4) {
388 for(j
= 0; j
< 4; ++j
) {
389 for(i
= 0; i
< 4; ++i
) {
390 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
392 util_format_dxt5_rgba_fetch(0, src
, i
, j
, tmp
);
393 dst
[0] = ubyte_to_float(tmp
[0]);
394 dst
[1] = ubyte_to_float(tmp
[1]);
395 dst
[2] = ubyte_to_float(tmp
[2]);
396 dst
[3] = ubyte_to_float(tmp
[3]);
401 src_row
+= src_stride
;
411 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
)
413 unsigned x
, y
, i
, j
, k
;
414 for(y
= 0; y
< height
; y
+= 4) {
415 const uint8_t *src
= src_row
;
416 uint8_t *dst
= dst_row
;
417 for(x
= 0; x
< width
; x
+= 4) {
418 uint8_t tmp
[4][4][3];
419 for(j
= 0; j
< 4; ++j
) {
420 for(i
= 0; i
< 4; ++i
) {
421 for(k
= 0; k
< 3; ++k
) {
422 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
426 util_format_dxtn_pack(3, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGB
, dst
, dst_stride
);
430 src_row
+= src_stride
;
431 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
436 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
)
438 unsigned x
, y
, i
, j
, k
;
439 for(y
= 0; y
< height
; y
+= 4) {
440 const uint8_t *src
= src_row
;
441 uint8_t *dst
= dst_row
;
442 for(x
= 0; x
< width
; x
+= 4) {
443 uint8_t tmp
[4][4][4];
444 for(j
= 0; j
< 4; ++j
) {
445 for(i
= 0; i
< 4; ++i
) {
446 for(k
= 0; k
< 4; ++k
) {
447 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
451 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGBA
, dst
, dst_stride
);
455 src_row
+= src_stride
;
456 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
461 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
)
463 unsigned x
, y
, i
, j
, k
;
464 for(y
= 0; y
< height
; y
+= 4) {
465 const uint8_t *src
= src_row
;
466 uint8_t *dst
= dst_row
;
467 for(x
= 0; x
< width
; x
+= 4) {
468 uint8_t tmp
[4][4][4];
469 for(j
= 0; j
< 4; ++j
) {
470 for(i
= 0; i
< 4; ++i
) {
471 for(k
= 0; k
< 4; ++k
) {
472 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
476 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT3_RGBA
, dst
, dst_stride
);
480 src_row
+= src_stride
;
481 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
486 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
)
488 unsigned x
, y
, i
, j
, k
;
489 for(y
= 0; y
< height
; y
+= 4) {
490 const uint8_t *src
= src_row
;
491 uint8_t *dst
= dst_row
;
492 for(x
= 0; x
< width
; x
+= 4) {
493 uint8_t tmp
[4][4][4];
494 for(j
= 0; j
< 4; ++j
) {
495 for(i
= 0; i
< 4; ++i
) {
496 for(k
= 0; k
< 4; ++k
) {
497 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
501 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT5_RGBA
, dst
, dst_stride
);
505 src_row
+= src_stride
;
506 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
511 util_format_dxt1_rgb_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
513 unsigned x
, y
, i
, j
, k
;
514 for(y
= 0; y
< height
; y
+= 4) {
515 const float *src
= src_row
;
516 uint8_t *dst
= dst_row
;
517 for(x
= 0; x
< width
; x
+= 4) {
518 uint8_t tmp
[4][4][3];
519 for(j
= 0; j
< 4; ++j
) {
520 for(i
= 0; i
< 4; ++i
) {
521 for(k
= 0; k
< 3; ++k
) {
522 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
526 util_format_dxtn_pack(3, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGB
, dst
, dst_stride
);
530 src_row
+= src_stride
;
531 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
536 util_format_dxt1_rgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
538 unsigned x
, y
, i
, j
, k
;
539 for(y
= 0; y
< height
; y
+= 4) {
540 const float *src
= src_row
;
541 uint8_t *dst
= dst_row
;
542 for(x
= 0; x
< width
; x
+= 4) {
543 uint8_t tmp
[4][4][4];
544 for(j
= 0; j
< 4; ++j
) {
545 for(i
= 0; i
< 4; ++i
) {
546 for(k
= 0; k
< 4; ++k
) {
547 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
551 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGBA
, dst
, dst_stride
);
555 src_row
+= src_stride
;
556 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
561 util_format_dxt3_rgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
563 unsigned x
, y
, i
, j
, k
;
564 for(y
= 0; y
< height
; y
+= 4) {
565 const float *src
= src_row
;
566 uint8_t *dst
= dst_row
;
567 for(x
= 0; x
< width
; x
+= 4) {
568 uint8_t tmp
[4][4][4];
569 for(j
= 0; j
< 4; ++j
) {
570 for(i
= 0; i
< 4; ++i
) {
571 for(k
= 0; k
< 4; ++k
) {
572 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
576 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT3_RGBA
, dst
, dst_stride
);
580 src_row
+= src_stride
;
581 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
586 util_format_dxt5_rgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
588 unsigned x
, y
, i
, j
, k
;
589 for(y
= 0; y
< height
; y
+= 4) {
590 const float *src
= src_row
;
591 uint8_t *dst
= dst_row
;
592 for(x
= 0; x
< width
; x
+= 4) {
593 uint8_t tmp
[4][4][4];
594 for(j
= 0; j
< 4; ++j
) {
595 for(i
= 0; i
< 4; ++i
) {
596 for(k
= 0; k
< 4; ++k
) {
597 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
601 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT5_RGBA
, dst
, dst_stride
);
605 src_row
+= src_stride
;
606 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
614 * FIXME: shunts to RGB for now
618 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
)
620 util_format_dxt1_rgb_unpack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
624 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
)
626 util_format_dxt1_rgb_pack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
630 util_format_dxt1_srgb_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
632 util_format_dxt1_rgb_fetch_8unorm(dst
, src
, i
, j
);
636 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
)
638 util_format_dxt1_rgba_unpack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
642 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
)
644 util_format_dxt1_rgba_pack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
648 util_format_dxt1_srgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
650 util_format_dxt1_rgba_fetch_8unorm(dst
, src
, i
, j
);
654 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
)
656 util_format_dxt3_rgba_unpack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
660 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
)
662 util_format_dxt3_rgba_pack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
666 util_format_dxt3_srgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
668 util_format_dxt3_rgba_fetch_8unorm(dst
, src
, i
, j
);
672 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
)
674 util_format_dxt5_rgba_unpack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
678 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
)
680 util_format_dxt5_rgba_pack_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
684 util_format_dxt5_srgba_fetch_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
686 util_format_dxt5_rgba_fetch_8unorm(dst
, src
, i
, j
);
690 util_format_dxt1_srgb_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
692 util_format_dxt1_rgb_unpack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
696 util_format_dxt1_srgb_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
698 util_format_dxt1_rgb_pack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
702 util_format_dxt1_srgb_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
704 util_format_dxt1_rgb_fetch_float(dst
, src
, i
, j
);
708 util_format_dxt1_srgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
710 util_format_dxt1_rgba_unpack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
714 util_format_dxt1_srgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
716 util_format_dxt1_rgba_pack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
720 util_format_dxt1_srgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
722 util_format_dxt1_rgba_fetch_float(dst
, src
, i
, j
);
726 util_format_dxt3_srgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
728 util_format_dxt3_rgba_unpack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
732 util_format_dxt3_srgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
734 util_format_dxt3_rgba_pack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
738 util_format_dxt3_srgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
740 util_format_dxt3_rgba_fetch_float(dst
, src
, i
, j
);
744 util_format_dxt5_srgba_unpack_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
746 util_format_dxt5_rgba_unpack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
750 util_format_dxt5_srgba_pack_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
752 util_format_dxt5_rgba_pack_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
756 util_format_dxt5_srgba_fetch_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
758 util_format_dxt5_rgba_fetch_float(dst
, src
, i
, j
);