u_format_s3tc.c revision 52bc90caa86925629296c02306773c4e00176f78
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"); 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"); 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 unsigned x, y, i, j; 244 for(y = 0; y < height; y += 4) { 245 const uint8_t *src = src_row; 246 for(x = 0; x < width; x += 4) { 247 for(j = 0; j < 4; ++j) { 248 for(i = 0; i < 4; ++i) { 249 uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4; 250 fetch(0, src, i, j, dst); 251 } 252 } 253 src += block_size; 254 } 255 src_row += src_stride; 256 } 257} 258 259void 260util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, 261 const uint8_t *src_row, unsigned src_stride, 262 unsigned width, unsigned height) 263{ 264 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride, 265 src_row, src_stride, 266 width, height, 267 util_format_dxt1_rgb_fetch, 8); 268} 269 270void 271util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, 272 const uint8_t *src_row, unsigned src_stride, 273 unsigned width, unsigned height) 274{ 275 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride, 276 src_row, src_stride, 277 width, height, 278 util_format_dxt1_rgba_fetch, 8); 279} 280 281void 282util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, 283 const uint8_t *src_row, unsigned src_stride, 284 unsigned width, unsigned height) 285{ 286 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride, 287 src_row, src_stride, 288 width, height, 289 util_format_dxt3_rgba_fetch, 16); 290} 291 292void 293util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, 294 const uint8_t *src_row, unsigned src_stride, 295 unsigned width, unsigned height) 296{ 297 util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride, 298 src_row, src_stride, 299 width, height, 300 util_format_dxt5_rgba_fetch, 16); 301} 302 303void 304util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, 305 const uint8_t *src_row, unsigned src_stride, 306 unsigned width, unsigned height, 307 util_format_dxtn_fetch_t fetch, 308 unsigned block_size) 309{ 310 unsigned x, y, i, j; 311 for(y = 0; y < height; y += 4) { 312 const uint8_t *src = src_row; 313 for(x = 0; x < width; x += 4) { 314 for(j = 0; j < 4; ++j) { 315 for(i = 0; i < 4; ++i) { 316 float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4; 317 uint8_t tmp[4]; 318 fetch(0, src, i, j, tmp); 319 dst[0] = ubyte_to_float(tmp[0]); 320 dst[1] = ubyte_to_float(tmp[1]); 321 dst[2] = ubyte_to_float(tmp[2]); 322 dst[3] = ubyte_to_float(tmp[3]); 323 } 324 } 325 src += block_size; 326 } 327 src_row += src_stride; 328 } 329} 330 331void 332util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, 333 const uint8_t *src_row, unsigned src_stride, 334 unsigned width, unsigned height) 335{ 336 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride, 337 src_row, src_stride, 338 width, height, 339 util_format_dxt1_rgb_fetch, 8); 340} 341 342void 343util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, 344 const uint8_t *src_row, unsigned src_stride, 345 unsigned width, unsigned height) 346{ 347 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride, 348 src_row, src_stride, 349 width, height, 350 util_format_dxt1_rgba_fetch, 8); 351} 352 353void 354util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, 355 const uint8_t *src_row, unsigned src_stride, 356 unsigned width, unsigned height) 357{ 358 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride, 359 src_row, src_stride, 360 width, height, 361 util_format_dxt3_rgba_fetch, 16); 362} 363 364void 365util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, 366 const uint8_t *src_row, unsigned src_stride, 367 unsigned width, unsigned height) 368{ 369 util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride, 370 src_row, src_stride, 371 width, height, 372 util_format_dxt5_rgba_fetch, 16); 373} 374 375 376/* 377 * Block compression. 378 */ 379 380void 381util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, 382 const uint8_t *src_row, unsigned src_stride, 383 unsigned width, unsigned height) 384{ 385 unsigned x, y, i, j, k; 386 for(y = 0; y < height; y += 4) { 387 const uint8_t *src = src_row; 388 uint8_t *dst = dst_row; 389 for(x = 0; x < width; x += 4) { 390 uint8_t tmp[4][4][3]; 391 for(j = 0; j < 4; ++j) { 392 for(i = 0; i < 4; ++i) { 393 for(k = 0; k < 3; ++k) { 394 tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + i*4 + k]; 395 } 396 } 397 } 398 util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, dst_stride); 399 src += 4*4; 400 dst += 8; 401 } 402 src_row += src_stride; 403 dst_row += 4*dst_stride/sizeof(*dst_row); 404 } 405} 406 407void 408util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, 409 const uint8_t *src_row, unsigned src_stride, 410 unsigned width, unsigned height) 411{ 412 unsigned x, y, i, j, k; 413 for(y = 0; y < height; y += 4) { 414 const uint8_t *src = src_row; 415 uint8_t *dst = dst_row; 416 for(x = 0; x < width; x += 4) { 417 uint8_t tmp[4][4][4]; 418 for(j = 0; j < 4; ++j) { 419 for(i = 0; i < 4; ++i) { 420 for(k = 0; k < 4; ++k) { 421 tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + i*4 + k]; 422 } 423 } 424 } 425 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, dst_stride); 426 src += 4*4; 427 dst += 8; 428 } 429 src_row += src_stride; 430 dst_row += 4*dst_stride/sizeof(*dst_row); 431 } 432} 433 434void 435util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, 436 const uint8_t *src_row, unsigned src_stride, 437 unsigned width, unsigned height) 438{ 439 unsigned x, y, i, j, k; 440 for(y = 0; y < height; y += 4) { 441 const uint8_t *src = src_row; 442 uint8_t *dst = dst_row; 443 for(x = 0; x < width; x += 4) { 444 uint8_t tmp[4][4][4]; 445 for(j = 0; j < 4; ++j) { 446 for(i = 0; i < 4; ++i) { 447 for(k = 0; k < 4; ++k) { 448 tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + i*4 + k]; 449 } 450 } 451 } 452 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, dst_stride); 453 src += 4*4; 454 dst += 16; 455 } 456 src_row += src_stride; 457 dst_row += 4*dst_stride/sizeof(*dst_row); 458 } 459} 460 461void 462util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, 463 const uint8_t *src_row, unsigned src_stride, 464 unsigned width, unsigned height) 465{ 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]; 476 } 477 } 478 } 479 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, dst_stride); 480 src += 4*4; 481 dst += 16; 482 } 483 src_row += src_stride; 484 dst_row += 4*dst_stride/sizeof(*dst_row); 485 } 486} 487 488void 489util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, 490 const float *src_row, unsigned src_stride, 491 unsigned width, unsigned height) 492{ 493 unsigned x, y, i, j, k; 494 for(y = 0; y < height; y += 4) { 495 const float *src = src_row; 496 uint8_t *dst = dst_row; 497 for(x = 0; x < width; x += 4) { 498 uint8_t tmp[4][4][3]; 499 for(j = 0; j < 4; ++j) { 500 for(i = 0; i < 4; ++i) { 501 for(k = 0; k < 3; ++k) { 502 tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + i*4 + k]); 503 } 504 } 505 } 506 util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, dst_stride); 507 src += 4*4; 508 dst += 8; 509 } 510 src_row += src_stride; 511 dst_row += 4*dst_stride/sizeof(*dst_row); 512 } 513} 514 515void 516util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, 517 const float *src_row, unsigned src_stride, 518 unsigned width, unsigned height) 519{ 520 unsigned x, y, i, j, k; 521 for(y = 0; y < height; y += 4) { 522 const float *src = src_row; 523 uint8_t *dst = dst_row; 524 for(x = 0; x < width; x += 4) { 525 uint8_t tmp[4][4][4]; 526 for(j = 0; j < 4; ++j) { 527 for(i = 0; i < 4; ++i) { 528 for(k = 0; k < 4; ++k) { 529 tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + i*4 + k]); 530 } 531 } 532 } 533 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, dst_stride); 534 src += 4*4; 535 dst += 8; 536 } 537 src_row += src_stride; 538 dst_row += 4*dst_stride/sizeof(*dst_row); 539 } 540} 541 542void 543util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) 544{ 545 unsigned x, y, i, j, k; 546 for(y = 0; y < height; y += 4) { 547 const float *src = src_row; 548 uint8_t *dst = dst_row; 549 for(x = 0; x < width; x += 4) { 550 uint8_t tmp[4][4][4]; 551 for(j = 0; j < 4; ++j) { 552 for(i = 0; i < 4; ++i) { 553 for(k = 0; k < 4; ++k) { 554 tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + i*4 + k]); 555 } 556 } 557 } 558 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, dst_stride); 559 src += 4*4; 560 dst += 16; 561 } 562 src_row += src_stride; 563 dst_row += 4*dst_stride/sizeof(*dst_row); 564 } 565} 566 567void 568util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) 569{ 570 unsigned x, y, i, j, k; 571 for(y = 0; y < height; y += 4) { 572 const float *src = src_row; 573 uint8_t *dst = dst_row; 574 for(x = 0; x < width; x += 4) { 575 uint8_t tmp[4][4][4]; 576 for(j = 0; j < 4; ++j) { 577 for(i = 0; i < 4; ++i) { 578 for(k = 0; k < 4; ++k) { 579 tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + i*4 + k]); 580 } 581 } 582 } 583 util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, dst_stride); 584 src += 4*4; 585 dst += 16; 586 } 587 src_row += src_stride; 588 dst_row += 4*dst_stride/sizeof(*dst_row); 589 } 590} 591 592 593/* 594 * SRGB variants. 595 * 596 * FIXME: shunts to RGB for now 597 */ 598 599void 600util_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) 601{ 602 util_format_dxt1_rgb_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); 603} 604 605void 606util_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) 607{ 608 util_format_dxt1_rgb_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); 609} 610 611void 612util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) 613{ 614 util_format_dxt1_rgb_fetch_rgba_8unorm(dst, src, i, j); 615} 616 617void 618util_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) 619{ 620 util_format_dxt1_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); 621} 622 623void 624util_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) 625{ 626 util_format_dxt1_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); 627} 628 629void 630util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) 631{ 632 util_format_dxt1_rgba_fetch_rgba_8unorm(dst, src, i, j); 633} 634 635void 636util_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) 637{ 638 util_format_dxt3_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); 639} 640 641void 642util_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) 643{ 644 util_format_dxt3_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); 645} 646 647void 648util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) 649{ 650 util_format_dxt3_rgba_fetch_rgba_8unorm(dst, src, i, j); 651} 652 653void 654util_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) 655{ 656 util_format_dxt5_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); 657} 658 659void 660util_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) 661{ 662 util_format_dxt5_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); 663} 664 665void 666util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) 667{ 668 util_format_dxt5_rgba_fetch_rgba_8unorm(dst, src, i, j); 669} 670 671void 672util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) 673{ 674 util_format_dxt1_rgb_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); 675} 676 677void 678util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) 679{ 680 util_format_dxt1_rgb_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); 681} 682 683void 684util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) 685{ 686 util_format_dxt1_rgb_fetch_rgba_float(dst, src, i, j); 687} 688 689void 690util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) 691{ 692 util_format_dxt1_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); 693} 694 695void 696util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) 697{ 698 util_format_dxt1_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); 699} 700 701void 702util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) 703{ 704 util_format_dxt1_rgba_fetch_rgba_float(dst, src, i, j); 705} 706 707void 708util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) 709{ 710 util_format_dxt3_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); 711} 712 713void 714util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) 715{ 716 util_format_dxt3_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); 717} 718 719void 720util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) 721{ 722 util_format_dxt3_rgba_fetch_rgba_float(dst, src, i, j); 723} 724 725void 726util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) 727{ 728 util_format_dxt5_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); 729} 730 731void 732util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) 733{ 734 util_format_dxt5_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); 735} 736 737void 738util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) 739{ 740 util_format_dxt5_rgba_fetch_rgba_float(dst, src, i, j); 741} 742 743