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");
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_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
240 for(y
= 0; y
< height
; y
+= 4) {
241 const uint8_t *src
= src_row
;
242 for(x
= 0; x
< width
; x
+= 4) {
243 for(j
= 0; j
< 4; ++j
) {
244 for(i
= 0; i
< 4; ++i
) {
245 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
246 util_format_dxt1_rgb_fetch(0, src
, i
, j
, dst
);
251 src_row
+= src_stride
;
256 util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
259 for(y
= 0; y
< height
; y
+= 4) {
260 const uint8_t *src
= src_row
;
261 for(x
= 0; x
< width
; x
+= 4) {
262 for(j
= 0; j
< 4; ++j
) {
263 for(i
= 0; i
< 4; ++i
) {
264 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
265 util_format_dxt1_rgba_fetch(0, src
, i
, j
, dst
);
270 src_row
+= src_stride
;
275 util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
278 for(y
= 0; y
< height
; y
+= 4) {
279 const uint8_t *src
= src_row
;
280 for(x
= 0; x
< width
; x
+= 4) {
281 for(j
= 0; j
< 4; ++j
) {
282 for(i
= 0; i
< 4; ++i
) {
283 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
284 util_format_dxt3_rgba_fetch(0, src
, i
, j
, dst
);
289 src_row
+= src_stride
;
294 util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
297 for(y
= 0; y
< height
; y
+= 4) {
298 const uint8_t *src
= src_row
;
299 for(x
= 0; x
< width
; x
+= 4) {
300 for(j
= 0; j
< 4; ++j
) {
301 for(i
= 0; i
< 4; ++i
) {
302 uint8_t *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
303 util_format_dxt5_rgba_fetch(0, src
, i
, j
, dst
);
308 src_row
+= src_stride
;
313 util_format_dxt1_rgb_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
316 for(y
= 0; y
< height
; y
+= 4) {
317 const uint8_t *src
= src_row
;
318 for(x
= 0; x
< width
; x
+= 4) {
319 for(j
= 0; j
< 4; ++j
) {
320 for(i
= 0; i
< 4; ++i
) {
321 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
323 util_format_dxt1_rgb_fetch(0, src
, i
, j
, tmp
);
324 dst
[0] = ubyte_to_float(tmp
[0]);
325 dst
[1] = ubyte_to_float(tmp
[1]);
326 dst
[2] = ubyte_to_float(tmp
[2]);
332 src_row
+= src_stride
;
337 util_format_dxt1_rgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
340 for(y
= 0; y
< height
; y
+= 4) {
341 const uint8_t *src
= src_row
;
342 for(x
= 0; x
< width
; x
+= 4) {
343 for(j
= 0; j
< 4; ++j
) {
344 for(i
= 0; i
< 4; ++i
) {
345 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
347 util_format_dxt1_rgba_fetch(0, src
, i
, j
, tmp
);
348 dst
[0] = ubyte_to_float(tmp
[0]);
349 dst
[1] = ubyte_to_float(tmp
[1]);
350 dst
[2] = ubyte_to_float(tmp
[2]);
351 dst
[3] = ubyte_to_float(tmp
[3]);
356 src_row
+= src_stride
;
361 util_format_dxt3_rgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
364 for(y
= 0; y
< height
; y
+= 4) {
365 const uint8_t *src
= src_row
;
366 for(x
= 0; x
< width
; x
+= 4) {
367 for(j
= 0; j
< 4; ++j
) {
368 for(i
= 0; i
< 4; ++i
) {
369 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
371 util_format_dxt3_rgba_fetch(0, src
, i
, j
, tmp
);
372 dst
[0] = ubyte_to_float(tmp
[0]);
373 dst
[1] = ubyte_to_float(tmp
[1]);
374 dst
[2] = ubyte_to_float(tmp
[2]);
375 dst
[3] = ubyte_to_float(tmp
[3]);
380 src_row
+= src_stride
;
385 util_format_dxt5_rgba_unpack_rgba_float(float *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
388 for(y
= 0; y
< height
; y
+= 4) {
389 const uint8_t *src
= src_row
;
390 for(x
= 0; x
< width
; x
+= 4) {
391 for(j
= 0; j
< 4; ++j
) {
392 for(i
= 0; i
< 4; ++i
) {
393 float *dst
= dst_row
+ (y
+ j
)*dst_stride
/sizeof(*dst_row
) + (x
+ i
)*4;
395 util_format_dxt5_rgba_fetch(0, src
, i
, j
, tmp
);
396 dst
[0] = ubyte_to_float(tmp
[0]);
397 dst
[1] = ubyte_to_float(tmp
[1]);
398 dst
[2] = ubyte_to_float(tmp
[2]);
399 dst
[3] = ubyte_to_float(tmp
[3]);
404 src_row
+= src_stride
;
414 util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
416 unsigned x
, y
, i
, j
, k
;
417 for(y
= 0; y
< height
; y
+= 4) {
418 const uint8_t *src
= src_row
;
419 uint8_t *dst
= dst_row
;
420 for(x
= 0; x
< width
; x
+= 4) {
421 uint8_t tmp
[4][4][3];
422 for(j
= 0; j
< 4; ++j
) {
423 for(i
= 0; i
< 4; ++i
) {
424 for(k
= 0; k
< 3; ++k
) {
425 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
429 util_format_dxtn_pack(3, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGB
, dst
, dst_stride
);
433 src_row
+= src_stride
;
434 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
439 util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
441 unsigned x
, y
, i
, j
, k
;
442 for(y
= 0; y
< height
; y
+= 4) {
443 const uint8_t *src
= src_row
;
444 uint8_t *dst
= dst_row
;
445 for(x
= 0; x
< width
; x
+= 4) {
446 uint8_t tmp
[4][4][4];
447 for(j
= 0; j
< 4; ++j
) {
448 for(i
= 0; i
< 4; ++i
) {
449 for(k
= 0; k
< 4; ++k
) {
450 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
454 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGBA
, dst
, dst_stride
);
458 src_row
+= src_stride
;
459 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
464 util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
466 unsigned x
, y
, i
, j
, k
;
467 for(y
= 0; y
< height
; y
+= 4) {
468 const uint8_t *src
= src_row
;
469 uint8_t *dst
= dst_row
;
470 for(x
= 0; x
< width
; x
+= 4) {
471 uint8_t tmp
[4][4][4];
472 for(j
= 0; j
< 4; ++j
) {
473 for(i
= 0; i
< 4; ++i
) {
474 for(k
= 0; k
< 4; ++k
) {
475 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
479 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT3_RGBA
, dst
, dst_stride
);
483 src_row
+= src_stride
;
484 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
489 util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row
, unsigned dst_stride
, const uint8_t *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
491 unsigned x
, y
, i
, j
, k
;
492 for(y
= 0; y
< height
; y
+= 4) {
493 const uint8_t *src
= src_row
;
494 uint8_t *dst
= dst_row
;
495 for(x
= 0; x
< width
; x
+= 4) {
496 uint8_t tmp
[4][4][4];
497 for(j
= 0; j
< 4; ++j
) {
498 for(i
= 0; i
< 4; ++i
) {
499 for(k
= 0; k
< 4; ++k
) {
500 tmp
[j
][i
][k
] = src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
];
504 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT5_RGBA
, dst
, dst_stride
);
508 src_row
+= src_stride
;
509 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
514 util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
516 unsigned x
, y
, i
, j
, k
;
517 for(y
= 0; y
< height
; y
+= 4) {
518 const float *src
= src_row
;
519 uint8_t *dst
= dst_row
;
520 for(x
= 0; x
< width
; x
+= 4) {
521 uint8_t tmp
[4][4][3];
522 for(j
= 0; j
< 4; ++j
) {
523 for(i
= 0; i
< 4; ++i
) {
524 for(k
= 0; k
< 3; ++k
) {
525 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
529 util_format_dxtn_pack(3, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGB
, dst
, dst_stride
);
533 src_row
+= src_stride
;
534 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
539 util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
541 unsigned x
, y
, i
, j
, k
;
542 for(y
= 0; y
< height
; y
+= 4) {
543 const float *src
= src_row
;
544 uint8_t *dst
= dst_row
;
545 for(x
= 0; x
< width
; x
+= 4) {
546 uint8_t tmp
[4][4][4];
547 for(j
= 0; j
< 4; ++j
) {
548 for(i
= 0; i
< 4; ++i
) {
549 for(k
= 0; k
< 4; ++k
) {
550 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
554 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT1_RGBA
, dst
, dst_stride
);
558 src_row
+= src_stride
;
559 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
564 util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
566 unsigned x
, y
, i
, j
, k
;
567 for(y
= 0; y
< height
; y
+= 4) {
568 const float *src
= src_row
;
569 uint8_t *dst
= dst_row
;
570 for(x
= 0; x
< width
; x
+= 4) {
571 uint8_t tmp
[4][4][4];
572 for(j
= 0; j
< 4; ++j
) {
573 for(i
= 0; i
< 4; ++i
) {
574 for(k
= 0; k
< 4; ++k
) {
575 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
579 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT3_RGBA
, dst
, dst_stride
);
583 src_row
+= src_stride
;
584 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
589 util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row
, unsigned dst_stride
, const float *src_row
, unsigned src_stride
, unsigned width
, unsigned height
)
591 unsigned x
, y
, i
, j
, k
;
592 for(y
= 0; y
< height
; y
+= 4) {
593 const float *src
= src_row
;
594 uint8_t *dst
= dst_row
;
595 for(x
= 0; x
< width
; x
+= 4) {
596 uint8_t tmp
[4][4][4];
597 for(j
= 0; j
< 4; ++j
) {
598 for(i
= 0; i
< 4; ++i
) {
599 for(k
= 0; k
< 4; ++k
) {
600 tmp
[j
][i
][k
] = float_to_ubyte(src
[(y
+ j
)*src_stride
/sizeof(*src
) + i
*4 + k
]);
604 util_format_dxtn_pack(4, 4, 4, &tmp
[0][0][0], UTIL_FORMAT_DXT5_RGBA
, dst
, dst_stride
);
608 src_row
+= src_stride
;
609 dst_row
+= 4*dst_stride
/sizeof(*dst_row
);
617 * FIXME: shunts to RGB for now
621 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
)
623 util_format_dxt1_rgb_unpack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
627 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
)
629 util_format_dxt1_rgb_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
633 util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
635 util_format_dxt1_rgb_fetch_rgba_8unorm(dst
, src
, i
, j
);
639 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
)
641 util_format_dxt1_rgba_unpack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
645 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
)
647 util_format_dxt1_rgba_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
651 util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
653 util_format_dxt1_rgba_fetch_rgba_8unorm(dst
, src
, i
, j
);
657 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
)
659 util_format_dxt3_rgba_unpack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
663 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
)
665 util_format_dxt3_rgba_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
669 util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
671 util_format_dxt3_rgba_fetch_rgba_8unorm(dst
, src
, i
, j
);
675 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
)
677 util_format_dxt5_rgba_unpack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
681 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
)
683 util_format_dxt5_rgba_pack_rgba_8unorm(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
687 util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
689 util_format_dxt5_rgba_fetch_rgba_8unorm(dst
, src
, i
, j
);
693 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
)
695 util_format_dxt1_rgb_unpack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
699 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
)
701 util_format_dxt1_rgb_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
705 util_format_dxt1_srgb_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
707 util_format_dxt1_rgb_fetch_rgba_float(dst
, src
, i
, j
);
711 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
)
713 util_format_dxt1_rgba_unpack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
717 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
)
719 util_format_dxt1_rgba_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
723 util_format_dxt1_srgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
725 util_format_dxt1_rgba_fetch_rgba_float(dst
, src
, i
, j
);
729 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
)
731 util_format_dxt3_rgba_unpack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
735 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
)
737 util_format_dxt3_rgba_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
741 util_format_dxt3_srgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
743 util_format_dxt3_rgba_fetch_rgba_float(dst
, src
, i
, j
);
747 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
)
749 util_format_dxt5_rgba_unpack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
753 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
)
755 util_format_dxt5_rgba_pack_rgba_float(dst_row
, dst_stride
, src_row
, src_stride
, width
, height
);
759 util_format_dxt5_srgba_fetch_rgba_float(float *dst
, const uint8_t *src
, unsigned i
, unsigned j
)
761 util_format_dxt5_rgba_fetch_rgba_float(dst
, src
, i
, j
);