u_format_s3tc.c revision 4ffef888997888c120deba9c1604cfd56645c041
1/**************************************************************************
2 *
3 * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
4 * Copyright (c) 2008 VMware, Inc.
5 *
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:
12 *
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
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.
22 *
23 **************************************************************************/
24
25#include "u_dl.h"
26#include "u_math.h"
27#include "u_format.h"
28#include "u_format_s3tc.h"
29
30
31#if defined(_WIN32) || defined(WIN32)
32#define DXTN_LIBNAME "dxtn.dll"
33#elif defined(__APPLE__)
34#define DXTN_LIBNAME "libtxc_dxtn.dylib"
35#else
36#define DXTN_LIBNAME "libtxc_dxtn.so"
37#endif
38
39
40static void
41util_format_dxt1_rgb_fetch_stub(int src_stride,
42                                const uint8_t *src,
43                                int col, int row,
44                                uint8_t *dst)
45{
46   assert(0);
47}
48
49
50static void
51util_format_dxt1_rgba_fetch_stub(int src_stride,
52                                 const uint8_t *src,
53                                 int col, int row,
54                                 uint8_t *dst )
55{
56   assert(0);
57}
58
59
60static void
61util_format_dxt3_rgba_fetch_stub(int src_stride,
62                                 const uint8_t *src,
63                                 int col, int row,
64                                 uint8_t *dst )
65{
66   assert(0);
67}
68
69
70static void
71util_format_dxt5_rgba_fetch_stub(int src_stride,
72                                 const uint8_t *src,
73                                 int col, int row,
74                                 uint8_t *dst )
75{
76   assert(0);
77}
78
79
80static void
81util_format_dxtn_pack_stub(int src_comps,
82                           int width, int height,
83                           const uint8_t *src,
84                           enum util_format_dxtn dst_format,
85                           uint8_t *dst,
86                           int dst_stride)
87{
88   assert(0);
89}
90
91
92boolean util_format_s3tc_enabled = FALSE;
93
94util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = util_format_dxt1_rgb_fetch_stub;
95util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch = util_format_dxt1_rgba_fetch_stub;
96util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch = util_format_dxt3_rgba_fetch_stub;
97util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch = util_format_dxt5_rgba_fetch_stub;
98
99util_format_dxtn_pack_t util_format_dxtn_pack = util_format_dxtn_pack_stub;
100
101
102void
103util_format_s3tc_init(void)
104{
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;
112
113   if (!first_time)
114      return;
115   first_time = FALSE;
116
117   if (util_format_s3tc_enabled)
118      return;
119
120   library = util_dl_open(DXTN_LIBNAME);
121   if (!library) {
122      debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
123         "compression/decompression unavailable\n");
124      return;
125   }
126
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");
135   tx_compress_dxtn =
136         util_dl_get_proc_address(library, "tx_compress_dxtn");
137
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 "
145                   "unavailable\n");
146      util_dl_close(library);
147      return;
148   }
149
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;
156}
157
158
159/*
160 * Pixel fetch.
161 */
162
163void
164util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
165{
166   util_format_dxt1_rgb_fetch(0, src, i, j, dst);
167}
168
169void
170util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
171{
172   util_format_dxt1_rgba_fetch(0, src, i, j, dst);
173}
174
175void
176util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
177{
178   util_format_dxt3_rgba_fetch(0, src, i, j, dst);
179}
180
181void
182util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
183{
184   util_format_dxt5_rgba_fetch(0, src, i, j, dst);
185}
186
187void
188util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
189{
190   uint8_t tmp[4];
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]);
195   dst[3] = 1.0;
196}
197
198void
199util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
200{
201   uint8_t tmp[4];
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]);
207}
208
209void
210util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
211{
212   uint8_t tmp[4];
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]);
218}
219
220void
221util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
222{
223   uint8_t tmp[4];
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]);
229}
230
231
232/*
233 * Block decompression.
234 */
235
236static INLINE void
237util_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,
241                                        unsigned block_size)
242{
243   const unsigned bw = 4, bh = 4, comps = 4;
244   unsigned x, y, i, j;
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);
252            }
253         }
254         src += block_size;
255      }
256      src_row += src_stride;
257   }
258}
259
260void
261util_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)
264{
265   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
266                                           src_row, src_stride,
267                                           width, height,
268                                           util_format_dxt1_rgb_fetch, 8);
269}
270
271void
272util_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)
275{
276   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
277                                           src_row, src_stride,
278                                           width, height,
279                                           util_format_dxt1_rgba_fetch, 8);
280}
281
282void
283util_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)
286{
287   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
288                                           src_row, src_stride,
289                                           width, height,
290                                           util_format_dxt3_rgba_fetch, 16);
291}
292
293void
294util_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)
297{
298   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
299                                           src_row, src_stride,
300                                           width, height,
301                                           util_format_dxt5_rgba_fetch, 16);
302}
303
304static INLINE void
305util_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,
309                                       unsigned block_size)
310{
311   unsigned x, y, i, j;
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;
318               uint8_t tmp[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]);
324            }
325         }
326         src += block_size;
327      }
328      src_row += src_stride;
329   }
330}
331
332void
333util_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)
336{
337   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
338                                          src_row, src_stride,
339                                          width, height,
340                                          util_format_dxt1_rgb_fetch, 8);
341}
342
343void
344util_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)
347{
348   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
349                                          src_row, src_stride,
350                                          width, height,
351                                          util_format_dxt1_rgba_fetch, 8);
352}
353
354void
355util_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)
358{
359   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
360                                          src_row, src_stride,
361                                          width, height,
362                                          util_format_dxt3_rgba_fetch, 16);
363}
364
365void
366util_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)
369{
370   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
371                                          src_row, src_stride,
372                                          width, height,
373                                          util_format_dxt5_rgba_fetch, 16);
374}
375
376
377/*
378 * Block compression.
379 */
380
381void
382util_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)
385{
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];
396               }
397            }
398         }
399         util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, 0);
400         dst += bytes_per_block;
401      }
402      dst_row += dst_stride / sizeof(*dst_row);
403   }
404}
405
406void
407util_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)
410{
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];
421               }
422            }
423         }
424         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, 0);
425         dst += bytes_per_block;
426      }
427      dst_row += dst_stride / sizeof(*dst_row);
428   }
429}
430
431void
432util_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)
435{
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];
446               }
447            }
448         }
449         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, 0);
450         dst += bytes_per_block;
451      }
452      dst_row += dst_stride / sizeof(*dst_row);
453   }
454}
455
456void
457util_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)
460{
461   const unsigned bw = 4, bh = 4, comps = 4, bytes_per_block = 16;
462   unsigned x, y, i, j, k;
463
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];
472               }
473            }
474         }
475         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, 0);
476         dst += bytes_per_block;
477      }
478      dst_row += dst_stride / sizeof(*dst_row);
479   }
480}
481
482void
483util_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)
486{
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]);
496               }
497            }
498         }
499         util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, 0);
500         dst += 8;
501      }
502      dst_row += 4*dst_stride/sizeof(*dst_row);
503   }
504}
505
506void
507util_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)
510{
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]);
520               }
521            }
522         }
523         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, 0);
524         dst += 8;
525      }
526      dst_row += 4*dst_stride/sizeof(*dst_row);
527   }
528}
529
530void
531util_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)
534{
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]);
544               }
545            }
546         }
547         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, 0);
548         dst += 16;
549      }
550      dst_row += 4*dst_stride/sizeof(*dst_row);
551   }
552}
553
554void
555util_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)
558{
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]);
568               }
569            }
570         }
571         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, 0);
572         dst += 16;
573      }
574      dst_row += 4*dst_stride/sizeof(*dst_row);
575   }
576}
577
578
579/*
580 * SRGB variants.
581 *
582 * FIXME: shunts to RGB for now
583 */
584
585void
586util_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)
587{
588   util_format_dxt1_rgb_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
589}
590
591void
592util_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)
593{
594   util_format_dxt1_rgb_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
595}
596
597void
598util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
599{
600   util_format_dxt1_rgb_fetch_rgba_8unorm(dst, src, i, j);
601}
602
603void
604util_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)
605{
606   util_format_dxt1_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
607}
608
609void
610util_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)
611{
612   util_format_dxt1_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
613}
614
615void
616util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
617{
618   util_format_dxt1_rgba_fetch_rgba_8unorm(dst, src, i, j);
619}
620
621void
622util_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)
623{
624   util_format_dxt3_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
625}
626
627void
628util_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)
629{
630   util_format_dxt3_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
631}
632
633void
634util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
635{
636   util_format_dxt3_rgba_fetch_rgba_8unorm(dst, src, i, j);
637}
638
639void
640util_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)
641{
642   util_format_dxt5_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
643}
644
645void
646util_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)
647{
648   util_format_dxt5_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
649}
650
651void
652util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
653{
654   util_format_dxt5_rgba_fetch_rgba_8unorm(dst, src, i, j);
655}
656
657void
658util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
659{
660   util_format_dxt1_rgb_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
661}
662
663void
664util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
665{
666   util_format_dxt1_rgb_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
667}
668
669void
670util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
671{
672   util_format_dxt1_rgb_fetch_rgba_float(dst, src, i, j);
673}
674
675void
676util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
677{
678   util_format_dxt1_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
679}
680
681void
682util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
683{
684   util_format_dxt1_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
685}
686
687void
688util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
689{
690   util_format_dxt1_rgba_fetch_rgba_float(dst, src, i, j);
691}
692
693void
694util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
695{
696   util_format_dxt3_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
697}
698
699void
700util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
701{
702   util_format_dxt3_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
703}
704
705void
706util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
707{
708   util_format_dxt3_rgba_fetch_rgba_float(dst, src, i, j);
709}
710
711void
712util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
713{
714   util_format_dxt5_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
715}
716
717void
718util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
719{
720   util_format_dxt5_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
721}
722
723void
724util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
725{
726   util_format_dxt5_rgba_fetch_rgba_float(dst, src, i, j);
727}
728
729