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"
33 #elif defined(__APPLE__)
34 #define DXTN_LIBNAME "libtxc_dxtn.dylib"
36 #define DXTN_LIBNAME "libtxc_dxtn.so"
41 util_format_dxt1_rgb_fetch_stub(int src_stride
,
51 util_format_dxt1_rgba_fetch_stub(int src_stride
,
61 util_format_dxt3_rgba_fetch_stub(int src_stride
,
71 util_format_dxt5_rgba_fetch_stub(int src_stride
,
81 util_format_dxtn_pack_stub(int src_comps
,
82 int width
, int height
,
84 enum util_format_dxtn dst_format
,
92 boolean util_format_s3tc_enabled
= FALSE
;
94 util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch
= util_format_dxt1_rgb_fetch_stub
;
95 util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch
= util_format_dxt1_rgba_fetch_stub
;
96 util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch
= util_format_dxt3_rgba_fetch_stub
;
97 util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch
= util_format_dxt5_rgba_fetch_stub
;
99 util_format_dxtn_pack_t util_format_dxtn_pack
= util_format_dxtn_pack_stub
;
103 util_format_s3tc_init(void)
105 static boolean first_time
= TRUE
;
106 struct util_dl_library
*library
= NULL
;
107 util_dl_proc fetch_2d_texel_rgb_dxt1
;
108 util_dl_proc fetch_2d_texel_rgba_dxt1
;
109 util_dl_proc fetch_2d_texel_rgba_dxt3
;
110 util_dl_proc fetch_2d_texel_rgba_dxt5
;
111 util_dl_proc tx_compress_dxtn
;
117 if (util_format_s3tc_enabled
)
120 library
= util_dl_open(DXTN_LIBNAME
);
122 debug_printf("couldn't open " DXTN_LIBNAME
", software DXTn "
123 "compression/decompression unavailable\n");
127 fetch_2d_texel_rgb_dxt1
=
128 util_dl_get_proc_address(library
, "fetch_2d_texel_rgb_dxt1");
129 fetch_2d_texel_rgba_dxt1
=
130 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt1");
131 fetch_2d_texel_rgba_dxt3
=
132 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt3");
133 fetch_2d_texel_rgba_dxt5
=
134 util_dl_get_proc_address(library
, "fetch_2d_texel_rgba_dxt5");
136 util_dl_get_proc_address(library
, "tx_compress_dxtn");
138 if (!util_format_dxt1_rgb_fetch
||
139 !util_format_dxt1_rgba_fetch
||
140 !util_format_dxt3_rgba_fetch
||
141 !util_format_dxt5_rgba_fetch
||
142 !util_format_dxtn_pack
) {
143 debug_printf("couldn't reference all symbols in " DXTN_LIBNAME
144 ", software DXTn compression/decompression "
146 util_dl_close(library
);
150 util_format_dxt1_rgb_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgb_dxt1
;
151 util_format_dxt1_rgba_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgba_dxt1
;
152 util_format_dxt3_rgba_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgba_dxt3
;
153 util_format_dxt5_rgba_fetch
= (util_format_dxtn_fetch_t
)fetch_2d_texel_rgba_dxt5
;
154 util_format_dxtn_pack
= (util_format_dxtn_pack_t
)tx_compress_dxtn
;
155 util_format_s3tc_enabled
= TRUE
;
164 util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
166 util_format_dxt1_rgb_fetch(0, src
, i
, j
, dst
);
170 util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
172 util_format_dxt1_rgba_fetch(0, src
, i
, j
, dst
);
176 util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
178 util_format_dxt3_rgba_fetch(0, src
, i
, j
, dst
);
182 util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
184 util_format_dxt5_rgba_fetch(0, src
, i
, j
, dst
);
188 util_format_dxt1_rgb_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
191 util_format_dxt1_rgb_fetch(0, src
, i
, j
, tmp
);
192 dst
[0] = ubyte_to_float(tmp
[0]);
193 dst
[1] = ubyte_to_float(tmp
[1]);
194 dst
[2] = ubyte_to_float(tmp
[2]);
199 util_format_dxt1_rgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
202 util_format_dxt1_rgba_fetch(0, src
, i
, j
, tmp
);
203 dst
[0] = ubyte_to_float(tmp
[0]);
204 dst
[1] = ubyte_to_float(tmp
[1]);
205 dst
[2] = ubyte_to_float(tmp
[2]);
206 dst
[3] = ubyte_to_float(tmp
[3]);
210 util_format_dxt3_rgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
213 util_format_dxt3_rgba_fetch(0, src
, i
, j
, tmp
);
214 dst
[0] = ubyte_to_float(tmp
[0]);
215 dst
[1] = ubyte_to_float(tmp
[1]);
216 dst
[2] = ubyte_to_float(tmp
[2]);
217 dst
[3] = ubyte_to_float(tmp
[3]);
221 util_format_dxt5_rgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
224 util_format_dxt5_rgba_fetch(0, src
, i
, j
, tmp
);
225 dst
[0] = ubyte_to_float(tmp
[0]);
226 dst
[1] = ubyte_to_float(tmp
[1]);
227 dst
[2] = ubyte_to_float(tmp
[2]);
228 dst
[3] = ubyte_to_float(tmp
[3]);
233 * Block decompression.
237 util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
238 const uint8_t *src_row
, unsigned src_stride
,
239 unsigned width
, unsigned height
,
240 util_format_dxtn_fetch_t fetch
,
243 const unsigned bw
= 4, bh
= 4, comps
= 4;
245 for(y
= 0; y
< height
; y
+= bh
) {
246 const uint8_t *src
= src_row
;
247 for(x
= 0; x
< width
; x
+= bw
) {
248 for(j
= 0; j
< bh
; ++j
) {
249 for(i
= 0; i
< bw
; ++i
) {
250 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*comps
;
251 fetch(0, src
, i
, j
, dst
);
256 src_row
+= src_stride
;
261 util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
262 const uint8_t *src_row
, unsigned src_stride
,
263 unsigned width
, unsigned height
)
265 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
268 util_format_dxt1_rgb_fetch
, 8);
272 util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
273 const uint8_t *src_row
, unsigned src_stride
,
274 unsigned width
, unsigned height
)
276 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
279 util_format_dxt1_rgba_fetch
, 8);
283 util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
284 const uint8_t *src_row
, unsigned src_stride
,
285 unsigned width
, unsigned height
)
287 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
290 util_format_dxt3_rgba_fetch
, 16);
294 util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
295 const uint8_t *src_row
, unsigned src_stride
,
296 unsigned width
, unsigned height
)
298 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
,
301 util_format_dxt5_rgba_fetch
, 16);
305 util_format_dxtn_rgb_unpack_rgba_float(float *dst_row
, unsigned dst_stride
,
306 const uint8_t *src_row
, unsigned src_stride
,
307 unsigned width
, unsigned height
,
308 util_format_dxtn_fetch_t fetch
,
312 for(y
= 0; y
< height
; y
+= 4) {
313 const uint8_t *src
= src_row
;
314 for(x
= 0; x
< width
; x
+= 4) {
315 for(j
= 0; j
< 4; ++j
) {
316 for(i
= 0; i
< 4; ++i
) {
317 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
319 fetch(0, src
, i
, j
, tmp
);
320 dst
[0] = ubyte_to_float(tmp
[0]);
321 dst
[1] = ubyte_to_float(tmp
[1]);
322 dst
[2] = ubyte_to_float(tmp
[2]);
323 dst
[3] = ubyte_to_float(tmp
[3]);
328 src_row
+= src_stride
;
333 util_format_dxt1_rgb_unpack_rgba_float(float *dst_row
, unsigned dst_stride
,
334 const uint8_t *src_row
, unsigned src_stride
,
335 unsigned width
, unsigned height
)
337 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
340 util_format_dxt1_rgb_fetch
, 8);
344 util_format_dxt1_rgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
,
345 const uint8_t *src_row
, unsigned src_stride
,
346 unsigned width
, unsigned height
)
348 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
351 util_format_dxt1_rgba_fetch
, 8);
355 util_format_dxt3_rgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
,
356 const uint8_t *src_row
, unsigned src_stride
,
357 unsigned width
, unsigned height
)
359 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
362 util_format_dxt3_rgba_fetch
, 16);
366 util_format_dxt5_rgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
,
367 const uint8_t *src_row
, unsigned src_stride
,
368 unsigned width
, unsigned height
)
370 util_format_dxtn_rgb_unpack_rgba_float(dst_row
, dst_stride
,
373 util_format_dxt5_rgba_fetch
, 16);
382 util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
383 const uint8_t *src
, unsigned src_stride
,
384 unsigned width
, unsigned height
)
386 const unsigned bw
= 4, bh
= 4, bytes_per_block
= 8;
387 unsigned x
, y
, i
, j
, k
;
388 for(y
= 0; y
< height
; y
+= bh
) {
389 uint8_t *dst
= dst_row
;
390 for(x
= 0; x
< width
; x
+= bw
) {
391 uint8_t tmp
[4][4][3]; /* [bh][bw][comps] */
392 for(j
= 0; j
< bh
; ++j
) {
393 for(i
= 0; i
< bw
; ++i
) {
394 for(k
= 0; k
< 3; ++k
) {
395 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+ i
)*4 + k
];
399 util_format_dxtn_pack(3, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGB
, dst
, 0);
400 dst
+= bytes_per_block
;
402 dst_row
+= dst_stride
/ sizeof(*dst_row
);
407 util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
408 const uint8_t *src
, unsigned src_stride
,
409 unsigned width
, unsigned height
)
411 const unsigned bw
= 4, bh
= 4, comps
= 4, bytes_per_block
= 8;
412 unsigned x
, y
, i
, j
, k
;
413 for(y
= 0; y
< height
; y
+= bh
) {
414 uint8_t *dst
= dst_row
;
415 for(x
= 0; x
< width
; x
+= bw
) {
416 uint8_t tmp
[4][4][4]; /* [bh][bw][comps] */
417 for(j
= 0; j
< bh
; ++j
) {
418 for(i
= 0; i
< bw
; ++i
) {
419 for(k
= 0; k
< comps
; ++k
) {
420 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+ i
)*comps
+ k
];
424 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGBA
, dst
, 0);
425 dst
+= bytes_per_block
;
427 dst_row
+= dst_stride
/ sizeof(*dst_row
);
432 util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
433 const uint8_t *src
, unsigned src_stride
,
434 unsigned width
, unsigned height
)
436 const unsigned bw
= 4, bh
= 4, comps
= 4, bytes_per_block
= 16;
437 unsigned x
, y
, i
, j
, k
;
438 for(y
= 0; y
< height
; y
+= bh
) {
439 uint8_t *dst
= dst_row
;
440 for(x
= 0; x
< width
; x
+= bw
) {
441 uint8_t tmp
[4][4][4]; /* [bh][bw][comps] */
442 for(j
= 0; j
< bh
; ++j
) {
443 for(i
= 0; i
< bw
; ++i
) {
444 for(k
= 0; k
< comps
; ++k
) {
445 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+ i
)*comps
+ k
];
449 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT3_RGBA
, dst
, 0);
450 dst
+= bytes_per_block
;
452 dst_row
+= dst_stride
/ sizeof(*dst_row
);
457 util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
,
458 const uint8_t *src
, unsigned src_stride
,
459 unsigned width
, unsigned height
)
461 const unsigned bw
= 4, bh
= 4, comps
= 4, bytes_per_block
= 16;
462 unsigned x
, y
, i
, j
, k
;
464 for(y
= 0; y
< height
; y
+= bh
) {
465 uint8_t *dst
= dst_row
;
466 for(x
= 0; x
< width
; x
+= bw
) {
467 uint8_t tmp
[4][4][4]; /* [bh][bw][comps] */
468 for(j
= 0; j
< bh
; ++j
) {
469 for(i
= 0; i
< bw
; ++i
) {
470 for(k
= 0; k
< comps
; ++k
) {
471 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+ i
)*comps
+ k
];
475 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT5_RGBA
, dst
, 0);
476 dst
+= bytes_per_block
;
478 dst_row
+= dst_stride
/ sizeof(*dst_row
);
483 util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
,
484 const float *src
, unsigned src_stride
,
485 unsigned width
, unsigned height
)
487 unsigned x
, y
, i
, j
, k
;
488 for(y
= 0; y
< height
; y
+= 4) {
489 uint8_t *dst
= dst_row
;
490 for(x
= 0; x
< width
; x
+= 4) {
491 uint8_t tmp
[4][4][3];
492 for(j
= 0; j
< 4; ++j
) {
493 for(i
= 0; i
< 4; ++i
) {
494 for(k
= 0; k
< 3; ++k
) {
495 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+i
)*4 + k
]);
499 util_format_dxtn_pack(3, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGB
, dst
, 0);
502 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
507 util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
,
508 const float *src
, unsigned src_stride
,
509 unsigned width
, unsigned height
)
511 unsigned x
, y
, i
, j
, k
;
512 for(y
= 0; y
< height
; y
+= 4) {
513 uint8_t *dst
= dst_row
;
514 for(x
= 0; x
< width
; x
+= 4) {
515 uint8_t tmp
[4][4][4];
516 for(j
= 0; j
< 4; ++j
) {
517 for(i
= 0; i
< 4; ++i
) {
518 for(k
= 0; k
< 4; ++k
) {
519 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+i
)*4 + k
]);
523 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGBA
, dst
, 0);
526 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
531 util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
,
532 const float *src
, unsigned src_stride
,
533 unsigned width
, unsigned height
)
535 unsigned x
, y
, i
, j
, k
;
536 for(y
= 0; y
< height
; y
+= 4) {
537 uint8_t *dst
= dst_row
;
538 for(x
= 0; x
< width
; x
+= 4) {
539 uint8_t tmp
[4][4][4];
540 for(j
= 0; j
< 4; ++j
) {
541 for(i
= 0; i
< 4; ++i
) {
542 for(k
= 0; k
< 4; ++k
) {
543 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+i
)*4 + k
]);
547 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT3_RGBA
, dst
, 0);
550 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
555 util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
,
556 const float *src
, unsigned src_stride
,
557 unsigned width
, unsigned height
)
559 unsigned x
, y
, i
, j
, k
;
560 for(y
= 0; y
< height
; y
+= 4) {
561 uint8_t *dst
= dst_row
;
562 for(x
= 0; x
< width
; x
+= 4) {
563 uint8_t tmp
[4][4][4];
564 for(j
= 0; j
< 4; ++j
) {
565 for(i
= 0; i
< 4; ++i
) {
566 for(k
= 0; k
< 4; ++k
) {
567 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + (x
+i
)*4 + k
]);
571 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT5_RGBA
, dst
, 0);
574 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
582 * FIXME: shunts to RGB for now
586 util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
588 util_format_dxt1_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
592 util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
594 util_format_dxt1_rgb_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
598 util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
600 util_format_dxt1_rgb_fetch_rgba_8unorm(dst
, src
, i
, j
);
604 util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
606 util_format_dxt1_rgba_unpack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
610 util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
612 util_format_dxt1_rgba_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
616 util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
618 util_format_dxt1_rgba_fetch_rgba_8unorm(dst
, src
, i
, j
);
622 util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
624 util_format_dxt3_rgba_unpack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
628 util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
630 util_format_dxt3_rgba_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
634 util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
636 util_format_dxt3_rgba_fetch_rgba_8unorm(dst
, src
, i
, j
);
640 util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
642 util_format_dxt5_rgba_unpack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
646 util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
648 util_format_dxt5_rgba_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
652 util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
654 util_format_dxt5_rgba_fetch_rgba_8unorm(dst
, src
, i
, j
);
658 util_format_dxt1_srgb_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
660 util_format_dxt1_rgb_unpack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
664 util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
666 util_format_dxt1_rgb_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
670 util_format_dxt1_srgb_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
672 util_format_dxt1_rgb_fetch_rgba_float(dst
, src
, i
, j
);
676 util_format_dxt1_srgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
678 util_format_dxt1_rgba_unpack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
682 util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
684 util_format_dxt1_rgba_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
688 util_format_dxt1_srgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
690 util_format_dxt1_rgba_fetch_rgba_float(dst
, src
, i
, j
);
694 util_format_dxt3_srgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
696 util_format_dxt3_rgba_unpack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
700 util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
702 util_format_dxt3_rgba_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
706 util_format_dxt3_srgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
708 util_format_dxt3_rgba_fetch_rgba_float(dst
, src
, i
, j
);
712 util_format_dxt5_srgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
714 util_format_dxt5_rgba_unpack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
718 util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
720 util_format_dxt5_rgba_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
724 util_format_dxt5_srgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
726 util_format_dxt5_rgba_fetch_rgba_float(dst
, src
, i
, j
);