Path: blob/21.2-virgl/src/util/format/u_format_s3tc.c
7202 views
/**************************************************************************1*2* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.3* Copyright (c) 2008 VMware, Inc.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the "Software"),7* to deal in the Software without restriction, including without limitation8* the rights to use, copy, modify, merge, publish, distribute, sublicense,9* and/or sell copies of the Software, and to permit persons to whom the10* Software is furnished to do so, subject to the following conditions:11*12* The above copyright notice and this permission notice shall be included13* in all copies or substantial portions of the Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS16* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL18* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR19* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,20* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR21* OTHER DEALINGS IN THE SOFTWARE.22*23**************************************************************************/2425#include "util/format/u_format.h"26#include "util/format/u_format_s3tc.h"27#include "util/format_srgb.h"28#include "util/u_math.h"29#include "../../mesa/main/texcompress_s3tc_tmp.h"303132util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgb_dxt1;33util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1;34util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3;35util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5;3637util_format_dxtn_pack_t util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn;383940/*41* Pixel fetch.42*/4344void45util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *restrict dst, const uint8_t *restrict src, unsigned i, unsigned j)46{47util_format_dxt1_rgb_fetch(0, src, i, j, dst);48}4950void51util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *restrict dst, const uint8_t *restrict src, unsigned i, unsigned j)52{53util_format_dxt1_rgba_fetch(0, src, i, j, dst);54}5556void57util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *restrict dst, const uint8_t *restrict src, unsigned i, unsigned j)58{59util_format_dxt3_rgba_fetch(0, src, i, j, dst);60}6162void63util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *restrict dst, const uint8_t *restrict src, unsigned i, unsigned j)64{65util_format_dxt5_rgba_fetch(0, src, i, j, dst);66}6768void69util_format_dxt1_rgb_fetch_rgba(void *restrict in_dst, const uint8_t *restrict src, unsigned i, unsigned j)70{71float *dst = in_dst;72uint8_t tmp[4];73util_format_dxt1_rgb_fetch(0, src, i, j, tmp);74dst[0] = ubyte_to_float(tmp[0]);75dst[1] = ubyte_to_float(tmp[1]);76dst[2] = ubyte_to_float(tmp[2]);77dst[3] = 1.0;78}7980void81util_format_dxt1_rgba_fetch_rgba(void *restrict in_dst, const uint8_t *restrict src, unsigned i, unsigned j)82{83float *dst = in_dst;84uint8_t tmp[4];85util_format_dxt1_rgba_fetch(0, src, i, j, tmp);86dst[0] = ubyte_to_float(tmp[0]);87dst[1] = ubyte_to_float(tmp[1]);88dst[2] = ubyte_to_float(tmp[2]);89dst[3] = ubyte_to_float(tmp[3]);90}9192void93util_format_dxt3_rgba_fetch_rgba(void *restrict in_dst, const uint8_t *restrict src, unsigned i, unsigned j)94{95float *dst = in_dst;96uint8_t tmp[4];97util_format_dxt3_rgba_fetch(0, src, i, j, tmp);98dst[0] = ubyte_to_float(tmp[0]);99dst[1] = ubyte_to_float(tmp[1]);100dst[2] = ubyte_to_float(tmp[2]);101dst[3] = ubyte_to_float(tmp[3]);102}103104void105util_format_dxt5_rgba_fetch_rgba(void *restrict in_dst, const uint8_t *restrict src, unsigned i, unsigned j)106{107float *dst = in_dst;108uint8_t tmp[4];109util_format_dxt5_rgba_fetch(0, src, i, j, tmp);110dst[0] = ubyte_to_float(tmp[0]);111dst[1] = ubyte_to_float(tmp[1]);112dst[2] = ubyte_to_float(tmp[2]);113dst[3] = ubyte_to_float(tmp[3]);114}115116117/*118* Block decompression.119*/120121static inline void122util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride,123const uint8_t *restrict src_row, unsigned src_stride,124unsigned width, unsigned height,125util_format_dxtn_fetch_t fetch,126unsigned block_size, boolean srgb)127{128const unsigned bw = 4, bh = 4, comps = 4;129unsigned x, y, i, j;130for(y = 0; y < height; y += bh) {131const uint8_t *src = src_row;132for(x = 0; x < width; x += bw) {133for(j = 0; j < bh; ++j) {134for(i = 0; i < bw; ++i) {135uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;136fetch(0, src, i, j, dst);137if (srgb) {138dst[0] = util_format_srgb_to_linear_8unorm(dst[0]);139dst[1] = util_format_srgb_to_linear_8unorm(dst[1]);140dst[2] = util_format_srgb_to_linear_8unorm(dst[2]);141}142}143}144src += block_size;145}146src_row += src_stride;147}148}149150void151util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride,152const uint8_t *restrict src_row, unsigned src_stride,153unsigned width, unsigned height)154{155util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,156src_row, src_stride,157width, height,158util_format_dxt1_rgb_fetch,1598, FALSE);160}161162void163util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride,164const uint8_t *restrict src_row, unsigned src_stride,165unsigned width, unsigned height)166{167util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,168src_row, src_stride,169width, height,170util_format_dxt1_rgba_fetch,1718, FALSE);172}173174void175util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride,176const uint8_t *restrict src_row, unsigned src_stride,177unsigned width, unsigned height)178{179util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,180src_row, src_stride,181width, height,182util_format_dxt3_rgba_fetch,18316, FALSE);184}185186void187util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride,188const uint8_t *restrict src_row, unsigned src_stride,189unsigned width, unsigned height)190{191util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,192src_row, src_stride,193width, height,194util_format_dxt5_rgba_fetch,19516, FALSE);196}197198static inline void199util_format_dxtn_rgb_unpack_rgba_float(float *restrict dst_row, unsigned dst_stride,200const uint8_t *restrict src_row, unsigned src_stride,201unsigned width, unsigned height,202util_format_dxtn_fetch_t fetch,203unsigned block_size, boolean srgb)204{205unsigned x, y, i, j;206for(y = 0; y < height; y += 4) {207const uint8_t *src = src_row;208for(x = 0; x < width; x += 4) {209for(j = 0; j < 4; ++j) {210for(i = 0; i < 4; ++i) {211float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;212uint8_t tmp[4];213fetch(0, src, i, j, tmp);214if (srgb) {215dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);216dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);217dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);218}219else {220dst[0] = ubyte_to_float(tmp[0]);221dst[1] = ubyte_to_float(tmp[1]);222dst[2] = ubyte_to_float(tmp[2]);223}224dst[3] = ubyte_to_float(tmp[3]);225}226}227src += block_size;228}229src_row += src_stride;230}231}232233void234util_format_dxt1_rgb_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride,235const uint8_t *restrict src_row, unsigned src_stride,236unsigned width, unsigned height)237{238util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,239src_row, src_stride,240width, height,241util_format_dxt1_rgb_fetch,2428, FALSE);243}244245void246util_format_dxt1_rgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride,247const uint8_t *restrict src_row, unsigned src_stride,248unsigned width, unsigned height)249{250util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,251src_row, src_stride,252width, height,253util_format_dxt1_rgba_fetch,2548, FALSE);255}256257void258util_format_dxt3_rgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride,259const uint8_t *restrict src_row, unsigned src_stride,260unsigned width, unsigned height)261{262util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,263src_row, src_stride,264width, height,265util_format_dxt3_rgba_fetch,26616, FALSE);267}268269void270util_format_dxt5_rgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride,271const uint8_t *restrict src_row, unsigned src_stride,272unsigned width, unsigned height)273{274util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,275src_row, src_stride,276width, height,277util_format_dxt5_rgba_fetch,27816, FALSE);279}280281282/*283* Block compression.284*/285286static inline void287util_format_dxtn_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride,288const uint8_t *restrict src, unsigned src_stride,289unsigned width, unsigned height,290enum util_format_dxtn format,291unsigned block_size, boolean srgb)292{293const unsigned bw = 4, bh = 4, comps = 4;294unsigned x, y, i, j, k;295for(y = 0; y < height; y += bh) {296uint8_t *dst = dst_row;297for(x = 0; x < width; x += bw) {298uint8_t tmp[4][4][4]; /* [bh][bw][comps] */299for(j = 0; j < bh; ++j) {300for(i = 0; i < bw; ++i) {301uint8_t src_tmp;302for(k = 0; k < 3; ++k) {303src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + k];304if (srgb) {305tmp[j][i][k] = util_format_linear_to_srgb_8unorm(src_tmp);306}307else {308tmp[j][i][k] = src_tmp;309}310}311/* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */312tmp[j][i][3] = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + 3];313}314}315/* even for dxt1_rgb have 4 src comps */316util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);317dst += block_size;318}319dst_row += dst_stride / sizeof(*dst_row);320}321322}323324void325util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride,326const uint8_t *restrict src, unsigned src_stride,327unsigned width, unsigned height)328{329util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,330width, height, UTIL_FORMAT_DXT1_RGB,3318, FALSE);332}333334void335util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride,336const uint8_t *restrict src, unsigned src_stride,337unsigned width, unsigned height)338{339util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,340width, height, UTIL_FORMAT_DXT1_RGBA,3418, FALSE);342}343344void345util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride,346const uint8_t *restrict src, unsigned src_stride,347unsigned width, unsigned height)348{349util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,350width, height, UTIL_FORMAT_DXT3_RGBA,35116, FALSE);352}353354void355util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride,356const uint8_t *restrict src, unsigned src_stride,357unsigned width, unsigned height)358{359util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,360width, height, UTIL_FORMAT_DXT5_RGBA,36116, FALSE);362}363364static inline void365util_format_dxtn_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride,366const float *restrict src, unsigned src_stride,367unsigned width, unsigned height,368enum util_format_dxtn format,369unsigned block_size, boolean srgb)370{371unsigned x, y, i, j, k;372for(y = 0; y < height; y += 4) {373uint8_t *dst = dst_row;374for(x = 0; x < width; x += 4) {375uint8_t tmp[4][4][4];376for(j = 0; j < 4; ++j) {377for(i = 0; i < 4; ++i) {378float src_tmp;379for(k = 0; k < 3; ++k) {380src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k];381if (srgb) {382tmp[j][i][k] = util_format_linear_float_to_srgb_8unorm(src_tmp);383}384else {385tmp[j][i][k] = float_to_ubyte(src_tmp);386}387}388/* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */389src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + 3];390tmp[j][i][3] = float_to_ubyte(src_tmp);391}392}393util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);394dst += block_size;395}396dst_row += 4*dst_stride/sizeof(*dst_row);397}398}399400void401util_format_dxt1_rgb_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride,402const float *src, unsigned src_stride,403unsigned width, unsigned height)404{405util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,406width, height, UTIL_FORMAT_DXT1_RGB,4078, FALSE);408}409410void411util_format_dxt1_rgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride,412const float *src, unsigned src_stride,413unsigned width, unsigned height)414{415util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,416width, height, UTIL_FORMAT_DXT1_RGBA,4178, FALSE);418}419420void421util_format_dxt3_rgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride,422const float *src, unsigned src_stride,423unsigned width, unsigned height)424{425util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,426width, height, UTIL_FORMAT_DXT3_RGBA,42716, FALSE);428}429430void431util_format_dxt5_rgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride,432const float *src, unsigned src_stride,433unsigned width, unsigned height)434{435util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,436width, height, UTIL_FORMAT_DXT5_RGBA,43716, FALSE);438}439440441/*442* SRGB variants.443*/444445void446util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *restrict dst, const uint8_t *restrict src, unsigned i, unsigned j)447{448uint8_t tmp[4];449util_format_dxt1_rgb_fetch(0, src, i, j, tmp);450dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);451dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);452dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);453dst[3] = 255;454}455456void457util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *restrict dst, const uint8_t *restrict src, unsigned i, unsigned j)458{459uint8_t tmp[4];460util_format_dxt1_rgba_fetch(0, src, i, j, tmp);461dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);462dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);463dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);464dst[3] = tmp[3];465}466467void468util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *restrict dst, const uint8_t *restrict src, unsigned i, unsigned j)469{470uint8_t tmp[4];471util_format_dxt3_rgba_fetch(0, src, i, j, tmp);472dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);473dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);474dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);475dst[3] = tmp[3];476}477478void479util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *restrict dst, const uint8_t *restrict src, unsigned i, unsigned j)480{481uint8_t tmp[4];482util_format_dxt5_rgba_fetch(0, src, i, j, tmp);483dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);484dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);485dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);486dst[3] = tmp[3];487}488489void490util_format_dxt1_srgb_fetch_rgba(void *restrict in_dst, const uint8_t *restrict src, unsigned i, unsigned j)491{492float *dst = in_dst;493uint8_t tmp[4];494util_format_dxt1_rgb_fetch(0, src, i, j, tmp);495dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);496dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);497dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);498dst[3] = 1.0f;499}500501void502util_format_dxt1_srgba_fetch_rgba(void *restrict in_dst, const uint8_t *restrict src, unsigned i, unsigned j)503{504float *dst = in_dst;505uint8_t tmp[4];506util_format_dxt1_rgba_fetch(0, src, i, j, tmp);507dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);508dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);509dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);510dst[3] = ubyte_to_float(tmp[3]);511}512513void514util_format_dxt3_srgba_fetch_rgba(void *restrict in_dst, const uint8_t *restrict src, unsigned i, unsigned j)515{516float *dst = in_dst;517uint8_t tmp[4];518util_format_dxt3_rgba_fetch(0, src, i, j, tmp);519dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);520dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);521dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);522dst[3] = ubyte_to_float(tmp[3]);523}524525void526util_format_dxt5_srgba_fetch_rgba(void *restrict in_dst, const uint8_t *restrict src, unsigned i, unsigned j)527{528float *dst = in_dst;529uint8_t tmp[4];530util_format_dxt5_rgba_fetch(0, src, i, j, tmp);531dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);532dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);533dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);534dst[3] = ubyte_to_float(tmp[3]);535}536537void538util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)539{540util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,541src_row, src_stride,542width, height,543util_format_dxt1_rgb_fetch,5448, TRUE);545}546547void548util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)549{550util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,551src_row, src_stride,552width, height,553util_format_dxt1_rgba_fetch,5548, TRUE);555}556557void558util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)559{560util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,561src_row, src_stride,562width, height,563util_format_dxt3_rgba_fetch,56416, TRUE);565}566567void568util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)569{570util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,571src_row, src_stride,572width, height,573util_format_dxt5_rgba_fetch,57416, TRUE);575}576577void578util_format_dxt1_srgb_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)579{580util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,581src_row, src_stride,582width, height,583util_format_dxt1_rgb_fetch,5848, TRUE);585}586587void588util_format_dxt1_srgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)589{590util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,591src_row, src_stride,592width, height,593util_format_dxt1_rgba_fetch,5948, TRUE);595}596597void598util_format_dxt3_srgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)599{600util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,601src_row, src_stride,602width, height,603util_format_dxt3_rgba_fetch,60416, TRUE);605}606607void608util_format_dxt5_srgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)609{610util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,611src_row, src_stride,612width, height,613util_format_dxt5_rgba_fetch,61416, TRUE);615}616617void618util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)619{620util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,621width, height, UTIL_FORMAT_DXT1_RGB,6228, TRUE);623}624625void626util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)627{628util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,629width, height, UTIL_FORMAT_DXT1_RGBA,6308, TRUE);631}632633void634util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)635{636util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,637width, height, UTIL_FORMAT_DXT3_RGBA,63816, TRUE);639}640641void642util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)643{644util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,645width, height, UTIL_FORMAT_DXT5_RGBA,64616, TRUE);647}648649void650util_format_dxt1_srgb_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride, const float *restrict src_row, unsigned src_stride, unsigned width, unsigned height)651{652util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,653width, height, UTIL_FORMAT_DXT1_RGB,6548, TRUE);655}656657void658util_format_dxt1_srgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride, const float *restrict src_row, unsigned src_stride, unsigned width, unsigned height)659{660util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,661width, height, UTIL_FORMAT_DXT1_RGBA,6628, TRUE);663}664665void666util_format_dxt3_srgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride, const float *restrict src_row, unsigned src_stride, unsigned width, unsigned height)667{668util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,669width, height, UTIL_FORMAT_DXT3_RGBA,67016, TRUE);671}672673void674util_format_dxt5_srgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride, const float *restrict src_row, unsigned src_stride, unsigned width, unsigned height)675{676util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,677width, height, UTIL_FORMAT_DXT5_RGBA,67816, TRUE);679}680681682683