• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**************************************************************************
2  *
3  * Copyright 2010 VMware, Inc.
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20  * USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * The above copyright notice and this permission notice (including the
23  * next paragraph) shall be included in all copies or substantial portions
24  * of the Software.
25  *
26  **************************************************************************/
27 
28 
29 #include "util/format/u_format_zs.h"
30 #include "util/u_math.h"
31 
32 
33 /*
34  * z32_unorm conversion functions
35  */
36 
37 static inline uint16_t
z32_unorm_to_z16_unorm(uint32_t z)38 z32_unorm_to_z16_unorm(uint32_t z)
39 {
40    /* z * 0xffff / 0xffffffff */
41    return z >> 16;
42 }
43 
44 static inline uint32_t
z16_unorm_to_z32_unorm(uint16_t z)45 z16_unorm_to_z32_unorm(uint16_t z)
46 {
47    /* z * 0xffffffff / 0xffff */
48    return ((uint32_t)z << 16) | z;
49 }
50 
51 static inline uint32_t
z32_unorm_to_z24_unorm(uint32_t z)52 z32_unorm_to_z24_unorm(uint32_t z)
53 {
54    /* z * 0xffffff / 0xffffffff */
55    return z >> 8;
56 }
57 
58 static inline uint32_t
z24_unorm_to_z32_unorm(uint32_t z)59 z24_unorm_to_z32_unorm(uint32_t z)
60 {
61    /* z * 0xffffffff / 0xffffff */
62    return (z << 8) | (z >> 16);
63 }
64 
65 
66 /*
67  * z32_float conversion functions
68  */
69 
70 static inline uint16_t
z32_float_to_z16_unorm(float z)71 z32_float_to_z16_unorm(float z)
72 {
73    const float scale = 0xffff;
74    return (uint16_t)(z * scale + 0.5f);
75 }
76 
77 static inline float
z16_unorm_to_z32_float(uint16_t z)78 z16_unorm_to_z32_float(uint16_t z)
79 {
80    const float scale = 1.0 / 0xffff;
81    return (float)(z * scale);
82 }
83 
84 static inline uint32_t
z32_float_to_z24_unorm(float z)85 z32_float_to_z24_unorm(float z)
86 {
87    const double scale = 0xffffff;
88    return (uint32_t)(z * scale) & 0xffffff;
89 }
90 
91 static inline float
z24_unorm_to_z32_float(uint32_t z)92 z24_unorm_to_z32_float(uint32_t z)
93 {
94    const double scale = 1.0 / 0xffffff;
95    return (float)(z * scale);
96 }
97 
98 static inline uint32_t
z32_float_to_z32_unorm(float z)99 z32_float_to_z32_unorm(float z)
100 {
101    const double scale = 0xffffffff;
102    return (uint32_t)(z * scale);
103 }
104 
105 static inline float
z32_unorm_to_z32_float(uint32_t z)106 z32_unorm_to_z32_float(uint32_t z)
107 {
108    const double scale = 1.0 / 0xffffffff;
109    return (float)(z * scale);
110 }
111 
112 
113 void
util_format_s8_uint_unpack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)114 util_format_s8_uint_unpack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
115                                          const uint8_t *restrict src_row, unsigned src_stride,
116                                          unsigned width, unsigned height)
117 {
118    unsigned y;
119    for(y = 0; y < height; ++y) {
120       memcpy(dst_row, src_row, width);
121       src_row += src_stride/sizeof(*src_row);
122       dst_row += dst_stride/sizeof(*dst_row);
123    }
124 }
125 
126 void
util_format_s8_uint_pack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)127 util_format_s8_uint_pack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
128                                        const uint8_t *restrict src_row, unsigned src_stride,
129                                        unsigned width, unsigned height)
130 {
131    unsigned y;
132    for(y = 0; y < height; ++y) {
133       memcpy(dst_row, src_row, width);
134       src_row += src_stride/sizeof(*src_row);
135       dst_row += dst_stride/sizeof(*dst_row);
136    }
137 }
138 
139 void
util_format_z16_unorm_unpack_z_float(float * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)140 util_format_z16_unorm_unpack_z_float(float *restrict dst_row, unsigned dst_stride,
141                                      const uint8_t *restrict src_row, unsigned src_stride,
142                                      unsigned width, unsigned height)
143 {
144    unsigned x, y;
145    for(y = 0; y < height; ++y) {
146       float *dst = dst_row;
147       const uint16_t *src = (const uint16_t *)src_row;
148       for(x = 0; x < width; ++x) {
149          *dst++ = z16_unorm_to_z32_float(*src++);
150       }
151       src_row += src_stride/sizeof(*src_row);
152       dst_row += dst_stride/sizeof(*dst_row);
153    }
154 }
155 
156 void
util_format_z16_unorm_pack_z_float(uint8_t * restrict dst_row,unsigned dst_stride,const float * restrict src_row,unsigned src_stride,unsigned width,unsigned height)157 util_format_z16_unorm_pack_z_float(uint8_t *restrict dst_row, unsigned dst_stride,
158                                    const float *restrict src_row, unsigned src_stride,
159                                    unsigned width, unsigned height)
160 {
161    unsigned x, y;
162    for(y = 0; y < height; ++y) {
163       const float *src = src_row;
164       uint16_t *dst = (uint16_t *)dst_row;
165       for(x = 0; x < width; ++x) {
166          *dst++ = z32_float_to_z16_unorm(*src++);
167       }
168       dst_row += dst_stride/sizeof(*dst_row);
169       src_row += src_stride/sizeof(*src_row);
170    }
171 }
172 
173 void
util_format_z16_unorm_unpack_z_32unorm(uint32_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)174 util_format_z16_unorm_unpack_z_32unorm(uint32_t *restrict dst_row, unsigned dst_stride,
175                                        const uint8_t *restrict src_row, unsigned src_stride,
176                                        unsigned width, unsigned height)
177 {
178    unsigned x, y;
179    for(y = 0; y < height; ++y) {
180       uint32_t *dst = dst_row;
181       const uint16_t *src = (const uint16_t *)src_row;
182       for(x = 0; x < width; ++x) {
183          *dst++ = z16_unorm_to_z32_unorm(*src++);
184       }
185       src_row += src_stride/sizeof(*src_row);
186       dst_row += dst_stride/sizeof(*dst_row);
187    }
188 }
189 
190 void
util_format_z16_unorm_pack_z_32unorm(uint8_t * restrict dst_row,unsigned dst_stride,const uint32_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)191 util_format_z16_unorm_pack_z_32unorm(uint8_t *restrict dst_row, unsigned dst_stride,
192                                      const uint32_t *restrict src_row, unsigned src_stride,
193                                      unsigned width, unsigned height)
194 {
195    unsigned x, y;
196    for(y = 0; y < height; ++y) {
197       const uint32_t *src = src_row;
198       uint16_t *dst = (uint16_t *)dst_row;
199       for(x = 0; x < width; ++x) {
200          *dst++ = z32_unorm_to_z16_unorm(*src++);
201       }
202       dst_row += dst_stride/sizeof(*dst_row);
203       src_row += src_stride/sizeof(*src_row);
204    }
205 }
206 
207 void
util_format_z32_unorm_unpack_z_float(float * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)208 util_format_z32_unorm_unpack_z_float(float *restrict dst_row, unsigned dst_stride,
209                                      const uint8_t *restrict src_row, unsigned src_stride,
210                                      unsigned width, unsigned height)
211 {
212    unsigned x, y;
213    for(y = 0; y < height; ++y) {
214       float *dst = dst_row;
215       const uint32_t *src = (const uint32_t *)src_row;
216       for(x = 0; x < width; ++x) {
217          *dst++ = z32_unorm_to_z32_float(*src++);
218       }
219       src_row += src_stride/sizeof(*src_row);
220       dst_row += dst_stride/sizeof(*dst_row);
221    }
222 }
223 
224 void
util_format_z32_unorm_pack_z_float(uint8_t * restrict dst_row,unsigned dst_stride,const float * restrict src_row,unsigned src_stride,unsigned width,unsigned height)225 util_format_z32_unorm_pack_z_float(uint8_t *restrict dst_row, unsigned dst_stride,
226                                    const float *restrict src_row, unsigned src_stride,
227                                    unsigned width, unsigned height)
228 {
229    unsigned x, y;
230    for(y = 0; y < height; ++y) {
231       const float *src = src_row;
232       uint32_t *dst = (uint32_t *)dst_row;
233       for(x = 0; x < width; ++x) {
234          *dst++ =z32_float_to_z32_unorm(*src++);
235       }
236       dst_row += dst_stride/sizeof(*dst_row);
237       src_row += src_stride/sizeof(*src_row);
238    }
239 }
240 
241 void
util_format_z32_unorm_unpack_z_32unorm(uint32_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)242 util_format_z32_unorm_unpack_z_32unorm(uint32_t *restrict dst_row, unsigned dst_stride,
243                                        const uint8_t *restrict src_row, unsigned src_stride,
244                                        unsigned width, unsigned height)
245 {
246    unsigned y;
247    for(y = 0; y < height; ++y) {
248       memcpy(dst_row, src_row, width * 4);
249       src_row += src_stride/sizeof(*src_row);
250       dst_row += dst_stride/sizeof(*dst_row);
251    }
252 }
253 
254 void
util_format_z32_unorm_pack_z_32unorm(uint8_t * restrict dst_row,unsigned dst_stride,const uint32_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)255 util_format_z32_unorm_pack_z_32unorm(uint8_t *restrict dst_row, unsigned dst_stride,
256                                      const uint32_t *restrict src_row, unsigned src_stride,
257                                      unsigned width, unsigned height)
258 {
259    unsigned y;
260    for(y = 0; y < height; ++y) {
261       memcpy(dst_row, src_row, width * 4);
262       src_row += src_stride/sizeof(*src_row);
263       dst_row += dst_stride/sizeof(*dst_row);
264    }
265 }
266 
267 void
util_format_z32_float_unpack_z_float(float * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)268 util_format_z32_float_unpack_z_float(float *restrict dst_row, unsigned dst_stride,
269                                      const uint8_t *restrict src_row, unsigned src_stride,
270                                      unsigned width, unsigned height)
271 {
272    unsigned y;
273    for(y = 0; y < height; ++y) {
274       memcpy(dst_row, src_row, width * 4);
275       src_row += src_stride/sizeof(*src_row);
276       dst_row += dst_stride/sizeof(*dst_row);
277    }
278 }
279 
280 void
util_format_z32_float_pack_z_float(uint8_t * restrict dst_row,unsigned dst_stride,const float * restrict src_row,unsigned src_stride,unsigned width,unsigned height)281 util_format_z32_float_pack_z_float(uint8_t *restrict dst_row, unsigned dst_stride,
282                                    const float *restrict src_row, unsigned src_stride,
283                                    unsigned width, unsigned height)
284 {
285    unsigned y;
286    for(y = 0; y < height; ++y) {
287       memcpy(dst_row, src_row, width * 4);
288       src_row += src_stride/sizeof(*src_row);
289       dst_row += dst_stride/sizeof(*dst_row);
290    }
291 }
292 
293 void
util_format_z32_float_unpack_z_32unorm(uint32_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)294 util_format_z32_float_unpack_z_32unorm(uint32_t *restrict dst_row, unsigned dst_stride,
295                                        const uint8_t *restrict src_row, unsigned src_stride,
296                                        unsigned width, unsigned height)
297 {
298    unsigned x, y;
299    for(y = 0; y < height; ++y) {
300       uint32_t *dst = dst_row;
301       const float *src = (const float *)src_row;
302       for(x = 0; x < width; ++x) {
303          float z = *src++;
304          *dst++ = z32_float_to_z32_unorm(CLAMP(z, 0.0f, 1.0f));
305       }
306       src_row += src_stride/sizeof(*src_row);
307       dst_row += dst_stride/sizeof(*dst_row);
308    }
309 }
310 
311 void
util_format_z32_float_pack_z_32unorm(uint8_t * restrict dst_row,unsigned dst_stride,const uint32_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)312 util_format_z32_float_pack_z_32unorm(uint8_t *restrict dst_row, unsigned dst_stride,
313                                      const uint32_t *restrict src_row, unsigned src_stride,
314                                      unsigned width, unsigned height)
315 {
316    unsigned x, y;
317    for(y = 0; y < height; ++y) {
318       const uint32_t *src = src_row;
319       float *dst = (float *)dst_row;
320       for(x = 0; x < width; ++x) {
321          *dst++ = z32_unorm_to_z32_float(*src++);
322       }
323       dst_row += dst_stride/sizeof(*dst_row);
324       src_row += src_stride/sizeof(*src_row);
325    }
326 }
327 
328 void
util_format_z16_unorm_s8_uint_unpack_z_float(float * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)329 util_format_z16_unorm_s8_uint_unpack_z_float(float *restrict dst_row, unsigned dst_stride,
330                                              const uint8_t *restrict src_row, unsigned src_stride,
331                                              unsigned width, unsigned height)
332 {
333    unreachable("z16_s8 packing/unpacking is not implemented.");
334 }
335 
336 void
util_format_z16_unorm_s8_uint_pack_z_float(uint8_t * restrict dst_row,unsigned dst_stride,const float * restrict src_row,unsigned src_stride,unsigned width,unsigned height)337 util_format_z16_unorm_s8_uint_pack_z_float(uint8_t *restrict dst_row, unsigned dst_stride,
338                                            const float *restrict src_row, unsigned src_stride,
339                                            unsigned width, unsigned height)
340 {
341    unreachable("z16_s8 packing/unpacking is not implemented.");
342 }
343 
344 void
util_format_z16_unorm_s8_uint_unpack_z_32unorm(uint32_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)345 util_format_z16_unorm_s8_uint_unpack_z_32unorm(uint32_t *restrict dst_row, unsigned dst_stride,
346                                                const uint8_t *restrict src_row, unsigned src_stride,
347                                                unsigned width, unsigned height)
348 {
349    unreachable("z16_s8 packing/unpacking is not implemented.");
350 }
351 
352 void
util_format_z16_unorm_s8_uint_pack_z_32unorm(uint8_t * restrict dst_row,unsigned dst_stride,const uint32_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)353 util_format_z16_unorm_s8_uint_pack_z_32unorm(uint8_t *restrict dst_row, unsigned dst_stride,
354                                              const uint32_t *restrict src_row, unsigned src_stride,
355                                              unsigned width, unsigned height)
356 {
357    unreachable("z16_s8 packing/unpacking is not implemented.");
358 }
359 
360 void
util_format_z16_unorm_s8_uint_unpack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)361 util_format_z16_unorm_s8_uint_unpack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
362                                              const uint8_t *restrict src_row, unsigned src_stride,
363                                              unsigned width, unsigned height)
364 {
365    unreachable("z16_s8 packing/unpacking is not implemented.");
366 }
367 
368 void
util_format_z16_unorm_s8_uint_pack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)369 util_format_z16_unorm_s8_uint_pack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
370                                            const uint8_t *restrict src_row, unsigned src_stride,
371                                            unsigned width, unsigned height)
372 {
373    unreachable("z16_s8 packing/unpacking is not implemented.");
374 }
375 
376 void
util_format_z24_unorm_s8_uint_unpack_z_float(float * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)377 util_format_z24_unorm_s8_uint_unpack_z_float(float *restrict dst_row, unsigned dst_stride,
378                                                 const uint8_t *restrict src_row, unsigned src_stride,
379                                                 unsigned width, unsigned height)
380 {
381    unsigned x, y;
382    for(y = 0; y < height; ++y) {
383       float *dst = dst_row;
384       const uint32_t *src = (const uint32_t *)src_row;
385       for(x = 0; x < width; ++x) {
386          *dst++ = z24_unorm_to_z32_float((*src++) & 0xffffff);
387       }
388       src_row += src_stride/sizeof(*src_row);
389       dst_row += dst_stride/sizeof(*dst_row);
390    }
391 }
392 
393 void
util_format_z24_unorm_s8_uint_pack_z_float(uint8_t * restrict dst_row,unsigned dst_stride,const float * restrict src_row,unsigned src_stride,unsigned width,unsigned height)394 util_format_z24_unorm_s8_uint_pack_z_float(uint8_t *restrict dst_row, unsigned dst_stride,
395                                               const float *restrict src_row, unsigned src_stride,
396                                               unsigned width, unsigned height)
397 {
398    unsigned x, y;
399    for(y = 0; y < height; ++y) {
400       const float *src = src_row;
401       uint32_t *dst = (uint32_t *)dst_row;
402       for(x = 0; x < width; ++x) {
403          uint32_t value = *dst;
404          value &= 0xff000000;
405          value |= z32_float_to_z24_unorm(*src++);
406          *dst++ = value;
407       }
408       dst_row += dst_stride/sizeof(*dst_row);
409       src_row += src_stride/sizeof(*src_row);
410    }
411 }
412 
413 
414 void
util_format_z24_unorm_s8_uint_unpack_z24(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)415 util_format_z24_unorm_s8_uint_unpack_z24(uint8_t *restrict dst_row, unsigned dst_stride,
416                                          const uint8_t *restrict src_row, unsigned src_stride,
417                                          unsigned width, unsigned height)
418 {
419    unsigned x, y;
420    for(y = 0; y < height; ++y) {
421       uint32_t *dst = (uint32_t *)dst_row;
422       const uint32_t *src = (const uint32_t *)src_row;
423       for(x = 0; x < width; ++x) {
424          *dst++ = ((*src++) & 0xffffff);
425       }
426       src_row += src_stride/sizeof(*src_row);
427       dst_row += dst_stride/sizeof(*dst_row);
428    }
429 }
430 
431 void
util_format_z24_unorm_s8_uint_pack_z24(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)432 util_format_z24_unorm_s8_uint_pack_z24(uint8_t *restrict dst_row, unsigned dst_stride,
433                                        const uint8_t *restrict src_row, unsigned src_stride,
434                                        unsigned width, unsigned height)
435 {
436    unsigned x, y;
437    for(y = 0; y < height; ++y) {
438       const uint32_t *src = (const uint32_t *)src_row;
439       uint32_t *dst = (uint32_t *)dst_row;
440       for(x = 0; x < width; ++x) {
441          uint32_t value = *dst;
442          value &= 0xff000000;
443          value |= *src & 0xffffff;
444          src++;
445          *dst++ = value;
446       }
447       dst_row += dst_stride/sizeof(*dst_row);
448       src_row += src_stride/sizeof(*src_row);
449    }
450 }
451 
452 void
util_format_z24_unorm_s8_uint_unpack_z_32unorm(uint32_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)453 util_format_z24_unorm_s8_uint_unpack_z_32unorm(uint32_t *restrict dst_row, unsigned dst_stride,
454                                                   const uint8_t *restrict src_row, unsigned src_stride,
455                                                   unsigned width, unsigned height)
456 {
457    unsigned x, y;
458    for(y = 0; y < height; ++y) {
459       uint32_t *dst = dst_row;
460       const uint32_t *src = (const uint32_t *)src_row;
461       for(x = 0; x < width; ++x) {
462          *dst++ = z24_unorm_to_z32_unorm((*src++) & 0xffffff);
463       }
464       src_row += src_stride/sizeof(*src_row);
465       dst_row += dst_stride/sizeof(*dst_row);
466    }
467 }
468 
469 void
util_format_z24_unorm_s8_uint_pack_z_32unorm(uint8_t * restrict dst_row,unsigned dst_stride,const uint32_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)470 util_format_z24_unorm_s8_uint_pack_z_32unorm(uint8_t *restrict dst_row, unsigned dst_stride,
471                                                 const uint32_t *restrict src_row, unsigned src_stride,
472                                                 unsigned width, unsigned height)
473 {
474    unsigned x, y;
475    for(y = 0; y < height; ++y) {
476       const uint32_t *src = src_row;
477       uint32_t *dst = (uint32_t *)dst_row;
478       for(x = 0; x < width; ++x) {
479          uint32_t value = *dst;
480          value &= 0xff000000;
481          value |= z32_unorm_to_z24_unorm(*src++);
482          *dst++ = value;
483       }
484       dst_row += dst_stride/sizeof(*dst_row);
485       src_row += src_stride/sizeof(*src_row);
486    }
487 }
488 
489 void
util_format_z24_unorm_s8_uint_unpack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)490 util_format_z24_unorm_s8_uint_unpack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
491                                                    const uint8_t *restrict src_row, unsigned src_stride,
492                                                    unsigned width, unsigned height)
493 {
494    unsigned x, y;
495    for(y = 0; y < height; ++y) {
496       uint8_t *dst = dst_row;
497       const uint32_t *src = (const uint32_t *)src_row;
498       for(x = 0; x < width; ++x) {
499          *dst++ = (*src++) >> 24;
500       }
501       src_row += src_stride/sizeof(*src_row);
502       dst_row += dst_stride/sizeof(*dst_row);
503    }
504 }
505 
506 void
util_format_z24_unorm_s8_uint_pack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)507 util_format_z24_unorm_s8_uint_pack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
508                                                  const uint8_t *restrict src_row, unsigned src_stride,
509                                                  unsigned width, unsigned height)
510 {
511    unsigned x, y;
512    for(y = 0; y < height; ++y) {
513       const uint8_t *src = src_row;
514       uint32_t *dst = (uint32_t *)dst_row;
515       for(x = 0; x < width; ++x) {
516          uint32_t value = util_le32_to_cpu(*dst);
517          value &= 0x00ffffff;
518          value |= (uint32_t)*src++ << 24;
519          *dst++ = value;
520       }
521       dst_row += dst_stride/sizeof(*dst_row);
522       src_row += src_stride/sizeof(*src_row);
523    }
524 }
525 
526 void
util_format_z24_unorm_s8_uint_pack_separate(uint8_t * restrict dst_row,unsigned dst_stride,const uint32_t * z_src_row,unsigned z_src_stride,const uint8_t * s_src_row,unsigned s_src_stride,unsigned width,unsigned height)527 util_format_z24_unorm_s8_uint_pack_separate(uint8_t *restrict dst_row, unsigned dst_stride,
528                                             const uint32_t *z_src_row, unsigned z_src_stride,
529                                             const uint8_t *s_src_row, unsigned s_src_stride,
530                                             unsigned width, unsigned height)
531 {
532    unsigned x, y;
533    for (y = 0; y < height; ++y) {
534       const uint32_t *z_src = z_src_row;
535       const uint8_t *s_src = s_src_row;
536       uint32_t *dst = (uint32_t *)dst_row;
537       for (x = 0; x < width; ++x) {
538          *dst++ = (*z_src++ & 0x00ffffff) | ((uint32_t)*s_src++ << 24);
539       }
540       dst_row += dst_stride / sizeof(*dst_row);
541       z_src_row += z_src_stride / sizeof(*z_src_row);
542       s_src_row += s_src_stride / sizeof(*s_src_row);
543    }
544 }
545 
546 void
util_format_z24_unorm_s8_uint_pack_separate_z32(uint8_t * restrict dst_row,unsigned dst_stride,const float * z_src_row,unsigned z_src_stride,const uint8_t * s_src_row,unsigned s_src_stride,unsigned width,unsigned height)547 util_format_z24_unorm_s8_uint_pack_separate_z32(uint8_t *restrict dst_row, unsigned dst_stride,
548                                                 const float *z_src_row, unsigned z_src_stride,
549                                                 const uint8_t *s_src_row, unsigned s_src_stride,
550                                                 unsigned width, unsigned height)
551 {
552    unsigned x, y;
553    for (y = 0; y < height; ++y) {
554       const float *z_src = z_src_row;
555       const uint8_t *s_src = s_src_row;
556       uint32_t *dst = (uint32_t *)dst_row;
557       for (x = 0; x < width; ++x) {
558          *dst++ = (z32_float_to_z24_unorm(*z_src++) & 0x00ffffff) | ((uint32_t)*s_src++ << 24);
559       }
560       dst_row += dst_stride / sizeof(*dst_row);
561       z_src_row += z_src_stride / sizeof(*z_src_row);
562       s_src_row += s_src_stride / sizeof(*s_src_row);
563    }
564 }
565 
566 void
util_format_s8_uint_z24_unorm_unpack_z_float(float * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)567 util_format_s8_uint_z24_unorm_unpack_z_float(float *restrict dst_row, unsigned dst_stride,
568                                                 const uint8_t *restrict src_row, unsigned src_stride,
569                                                 unsigned width, unsigned height)
570 {
571    unsigned x, y;
572    for(y = 0; y < height; ++y) {
573       float *dst = dst_row;
574       const uint32_t *src = (const uint32_t *)src_row;
575       for(x = 0; x < width; ++x) {
576          *dst++ = z24_unorm_to_z32_float((*src++) >> 8);
577       }
578       src_row += src_stride/sizeof(*src_row);
579       dst_row += dst_stride/sizeof(*dst_row);
580    }
581 }
582 
583 void
util_format_s8_uint_z24_unorm_pack_z_float(uint8_t * restrict dst_row,unsigned dst_stride,const float * restrict src_row,unsigned src_stride,unsigned width,unsigned height)584 util_format_s8_uint_z24_unorm_pack_z_float(uint8_t *restrict dst_row, unsigned dst_stride,
585                                               const float *restrict src_row, unsigned src_stride,
586                                               unsigned width, unsigned height)
587 {
588    unsigned x, y;
589    for(y = 0; y < height; ++y) {
590       const float *src = src_row;
591       uint32_t *dst = (uint32_t *)dst_row;
592       for(x = 0; x < width; ++x) {
593          uint32_t value = *dst;
594          value &= 0x000000ff;
595          value |= z32_float_to_z24_unorm(*src++) << 8;
596          *dst++ = value;
597       }
598       dst_row += dst_stride/sizeof(*dst_row);
599       src_row += src_stride/sizeof(*src_row);
600    }
601 }
602 
603 void
util_format_s8_uint_z24_unorm_unpack_z_32unorm(uint32_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)604 util_format_s8_uint_z24_unorm_unpack_z_32unorm(uint32_t *restrict dst_row, unsigned dst_stride,
605                                                   const uint8_t *restrict src_row, unsigned src_stride,
606                                                   unsigned width, unsigned height)
607 {
608    unsigned x, y;
609    for(y = 0; y < height; ++y) {
610       uint32_t *dst = dst_row;
611       const uint32_t *src = (const uint32_t *)src_row;
612       for(x = 0; x < width; ++x) {
613          uint32_t value = *src++;
614          *dst++ = z24_unorm_to_z32_unorm(value >> 8);
615       }
616       src_row += src_stride/sizeof(*src_row);
617       dst_row += dst_stride/sizeof(*dst_row);
618    }
619 }
620 
621 void
util_format_s8_uint_z24_unorm_pack_z_32unorm(uint8_t * restrict dst_row,unsigned dst_stride,const uint32_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)622 util_format_s8_uint_z24_unorm_pack_z_32unorm(uint8_t *restrict dst_row, unsigned dst_stride,
623                                                 const uint32_t *restrict src_row, unsigned src_stride,
624                                                 unsigned width, unsigned height)
625 {
626    unsigned x, y;
627    for(y = 0; y < height; ++y) {
628       const uint32_t *src = src_row;
629       uint32_t *dst = (uint32_t *)dst_row;
630       for(x = 0; x < width; ++x) {
631          uint32_t value = *dst;
632          value &= 0x000000ff;
633          value |= *src++ & 0xffffff00;
634          *dst++ = value;
635       }
636       dst_row += dst_stride/sizeof(*dst_row);
637       src_row += src_stride/sizeof(*src_row);
638    }
639 }
640 
641 void
util_format_s8_uint_z24_unorm_unpack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)642 util_format_s8_uint_z24_unorm_unpack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
643                                                    const uint8_t *restrict src_row, unsigned src_stride,
644                                                    unsigned width, unsigned height)
645 {
646    unsigned x, y;
647    for(y = 0; y < height; ++y) {
648       uint8_t *dst = dst_row;
649       const uint32_t *src = (const uint32_t *)src_row;
650       for(x = 0; x < width; ++x) {
651          *dst++ = (*src++) & 0xff;
652       }
653       src_row += src_stride/sizeof(*src_row);
654       dst_row += dst_stride/sizeof(*dst_row);
655    }
656 }
657 
658 void
util_format_s8_uint_z24_unorm_pack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)659 util_format_s8_uint_z24_unorm_pack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
660                                                  const uint8_t *restrict src_row, unsigned src_stride,
661                                                  unsigned width, unsigned height)
662 {
663    unsigned x, y;
664    for(y = 0; y < height; ++y) {
665       const uint8_t *src = src_row;
666       uint32_t *dst = (uint32_t *)dst_row;
667       for(x = 0; x < width; ++x) {
668          uint32_t value = *dst;
669          value &= 0xffffff00;
670          value |= *src++;
671          *dst++ = value;
672       }
673       dst_row += dst_stride/sizeof(*dst_row);
674       src_row += src_stride/sizeof(*src_row);
675    }
676 }
677 
678 void
util_format_z24x8_unorm_unpack_z_float(float * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)679 util_format_z24x8_unorm_unpack_z_float(float *restrict dst_row, unsigned dst_stride,
680                                        const uint8_t *restrict src_row, unsigned src_stride,
681                                        unsigned width, unsigned height)
682 {
683    unsigned x, y;
684    for(y = 0; y < height; ++y) {
685       float *dst = dst_row;
686       const uint32_t *src = (const uint32_t *)src_row;
687       for(x = 0; x < width; ++x) {
688          *dst++ = z24_unorm_to_z32_float((*src++) & 0xffffff);
689       }
690       src_row += src_stride/sizeof(*src_row);
691       dst_row += dst_stride/sizeof(*dst_row);
692    }
693 }
694 
695 void
util_format_z24x8_unorm_pack_z_float(uint8_t * restrict dst_row,unsigned dst_stride,const float * restrict src_row,unsigned src_stride,unsigned width,unsigned height)696 util_format_z24x8_unorm_pack_z_float(uint8_t *restrict dst_row, unsigned dst_stride,
697                                      const float *restrict src_row, unsigned src_stride,
698                                      unsigned width, unsigned height)
699 {
700    unsigned x, y;
701    for(y = 0; y < height; ++y) {
702       const float *src = src_row;
703       uint32_t *dst = (uint32_t *)dst_row;
704       for(x = 0; x < width; ++x) {
705          *dst++ = z32_float_to_z24_unorm(*src++);
706       }
707       dst_row += dst_stride/sizeof(*dst_row);
708       src_row += src_stride/sizeof(*src_row);
709    }
710 }
711 
712 void
util_format_z24x8_unorm_unpack_z_32unorm(uint32_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)713 util_format_z24x8_unorm_unpack_z_32unorm(uint32_t *restrict dst_row, unsigned dst_stride,
714                                          const uint8_t *restrict src_row, unsigned src_stride,
715                                          unsigned width, unsigned height)
716 {
717    unsigned x, y;
718    for(y = 0; y < height; ++y) {
719       uint32_t *dst = dst_row;
720       const uint32_t *src = (const uint32_t *)src_row;
721       for(x = 0; x < width; ++x) {
722          *dst++ = z24_unorm_to_z32_unorm((*src++) & 0xffffff);
723       }
724       src_row += src_stride/sizeof(*src_row);
725       dst_row += dst_stride/sizeof(*dst_row);
726    }
727 }
728 
729 void
util_format_z24x8_unorm_pack_z_32unorm(uint8_t * restrict dst_row,unsigned dst_stride,const uint32_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)730 util_format_z24x8_unorm_pack_z_32unorm(uint8_t *restrict dst_row, unsigned dst_stride,
731                                        const uint32_t *restrict src_row, unsigned src_stride,
732                                        unsigned width, unsigned height)
733 {
734    unsigned x, y;
735    for(y = 0; y < height; ++y) {
736       const uint32_t *src = src_row;
737       uint32_t *dst = (uint32_t *)dst_row;
738       for(x = 0; x < width; ++x) {
739          *dst++ = z32_unorm_to_z24_unorm(*src++);
740       }
741       dst_row += dst_stride/sizeof(*dst_row);
742       src_row += src_stride/sizeof(*src_row);
743    }
744 }
745 
746 void
util_format_x8z24_unorm_unpack_z_float(float * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)747 util_format_x8z24_unorm_unpack_z_float(float *restrict dst_row, unsigned dst_stride,
748                                        const uint8_t *restrict src_row, unsigned src_stride,
749                                        unsigned width, unsigned height)
750 {
751    unsigned x, y;
752    for(y = 0; y < height; ++y) {
753       float *dst = dst_row;
754       const uint32_t *src = (uint32_t *)src_row;
755       for(x = 0; x < width; ++x) {
756          *dst++ = z24_unorm_to_z32_float((*src++) >> 8);
757       }
758       src_row += src_stride/sizeof(*src_row);
759       dst_row += dst_stride/sizeof(*dst_row);
760    }
761 }
762 
763 void
util_format_x8z24_unorm_pack_z_float(uint8_t * restrict dst_row,unsigned dst_stride,const float * restrict src_row,unsigned src_stride,unsigned width,unsigned height)764 util_format_x8z24_unorm_pack_z_float(uint8_t *restrict dst_row, unsigned dst_stride,
765                                      const float *restrict src_row, unsigned src_stride,
766                                      unsigned width, unsigned height)
767 {
768    unsigned x, y;
769    for(y = 0; y < height; ++y) {
770       const float *src = src_row;
771       uint32_t *dst = (uint32_t *)dst_row;
772       for(x = 0; x < width; ++x) {
773          *dst++ = z32_float_to_z24_unorm(*src++) << 8;
774       }
775       dst_row += dst_stride/sizeof(*dst_row);
776       src_row += src_stride/sizeof(*src_row);
777    }
778 }
779 
780 void
util_format_x8z24_unorm_unpack_z_32unorm(uint32_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)781 util_format_x8z24_unorm_unpack_z_32unorm(uint32_t *restrict dst_row, unsigned dst_stride,
782                                          const uint8_t *restrict src_row, unsigned src_stride,
783                                          unsigned width, unsigned height)
784 {
785    unsigned x, y;
786    for(y = 0; y < height; ++y) {
787       uint32_t *dst = dst_row;
788       const uint32_t *src = (const uint32_t *)src_row;
789       for(x = 0; x < width; ++x) {
790          *dst++ = z24_unorm_to_z32_unorm((*src++) >> 8);
791       }
792       src_row += src_stride/sizeof(*src_row);
793       dst_row += dst_stride/sizeof(*dst_row);
794    }
795 }
796 
797 void
util_format_x8z24_unorm_pack_z_32unorm(uint8_t * restrict dst_row,unsigned dst_stride,const uint32_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)798 util_format_x8z24_unorm_pack_z_32unorm(uint8_t *restrict dst_row, unsigned dst_stride,
799                                        const uint32_t *restrict src_row, unsigned src_stride,
800                                        unsigned width, unsigned height)
801 {
802    unsigned x, y;
803    for(y = 0; y < height; ++y) {
804       const uint32_t *src = src_row;
805       uint32_t *dst = (uint32_t *)dst_row;
806       for(x = 0; x < width; ++x) {
807          *dst++ = z32_unorm_to_z24_unorm(*src++) << 8;
808       }
809       dst_row += dst_stride/sizeof(*dst_row);
810       src_row += src_stride/sizeof(*src_row);
811    }
812 }
813 
814 void
util_format_z32_float_s8x24_uint_unpack_z_float(float * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)815 util_format_z32_float_s8x24_uint_unpack_z_float(float *restrict dst_row, unsigned dst_stride,
816                                                    const uint8_t *restrict src_row, unsigned src_stride,
817                                                    unsigned width, unsigned height)
818 {
819    unsigned x, y;
820    for(y = 0; y < height; ++y) {
821       float *dst = dst_row;
822       const float *src = (const float *)src_row;
823       for(x = 0; x < width; ++x) {
824          *dst = *src;
825          src += 2;
826          dst += 1;
827       }
828       src_row += src_stride/sizeof(*src_row);
829       dst_row += dst_stride/sizeof(*dst_row);
830    }
831 }
832 
833 void
util_format_z32_float_s8x24_uint_pack_z_float(uint8_t * restrict dst_row,unsigned dst_stride,const float * restrict src_row,unsigned src_stride,unsigned width,unsigned height)834 util_format_z32_float_s8x24_uint_pack_z_float(uint8_t *restrict dst_row, unsigned dst_stride,
835                                                  const float *restrict src_row, unsigned src_stride,
836                                                  unsigned width, unsigned height)
837 {
838    unsigned x, y;
839    for(y = 0; y < height; ++y) {
840       const float *src = src_row;
841       float *dst = (float *)dst_row;
842       for(x = 0; x < width; ++x) {
843          *dst = *src;
844          src += 1;
845          dst += 2;
846       }
847       dst_row += dst_stride/sizeof(*dst_row);
848       src_row += src_stride/sizeof(*src_row);
849    }
850 }
851 
852 void
util_format_z32_float_s8x24_uint_unpack_z_32unorm(uint32_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)853 util_format_z32_float_s8x24_uint_unpack_z_32unorm(uint32_t *restrict dst_row, unsigned dst_stride,
854                                                      const uint8_t *restrict src_row, unsigned src_stride,
855                                                      unsigned width, unsigned height)
856 {
857    unsigned x, y;
858    for(y = 0; y < height; ++y) {
859       uint32_t *dst = dst_row;
860       const float *src = (const float *)src_row;
861       for(x = 0; x < width; ++x) {
862          *dst = z32_float_to_z32_unorm(CLAMP(*src, 0.0f, 1.0f));
863          src += 2;
864          dst += 1;
865       }
866       src_row += src_stride/sizeof(*src_row);
867       dst_row += dst_stride/sizeof(*dst_row);
868    }
869 }
870 
871 void
util_format_z32_float_s8x24_uint_pack_z_32unorm(uint8_t * restrict dst_row,unsigned dst_stride,const uint32_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)872 util_format_z32_float_s8x24_uint_pack_z_32unorm(uint8_t *restrict dst_row, unsigned dst_stride,
873                                                    const uint32_t *restrict src_row, unsigned src_stride,
874                                                    unsigned width, unsigned height)
875 {
876    unsigned x, y;
877    for(y = 0; y < height; ++y) {
878       const uint32_t *src = src_row;
879       float *dst = (float *)dst_row;
880       for(x = 0; x < width; ++x) {
881          *dst = z32_unorm_to_z32_float(*src++);
882          dst += 2;
883       }
884       dst_row += dst_stride/sizeof(*dst_row);
885       src_row += src_stride/sizeof(*src_row);
886    }
887 }
888 
889 void
util_format_z32_float_s8x24_uint_unpack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)890 util_format_z32_float_s8x24_uint_unpack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
891                                                       const uint8_t *restrict src_row, unsigned src_stride,
892                                                       unsigned width, unsigned height)
893 {
894    unsigned x, y;
895    for(y = 0; y < height; ++y) {
896       uint8_t *dst = dst_row;
897       const uint32_t *src = (uint32_t *)(src_row + 4);
898       for(x = 0; x < width; ++x) {
899          *dst = *src;
900          src += 2;
901          dst += 1;
902       }
903       src_row += src_stride/sizeof(*src_row);
904       dst_row += dst_stride/sizeof(*dst_row);
905    }
906 }
907 
908 void
util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)909 util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
910                                                     const uint8_t *restrict src_row, unsigned src_stride,
911                                                     unsigned width, unsigned height)
912 {
913    unsigned x, y;
914    for(y = 0; y < height; ++y) {
915       const uint8_t *src = src_row;
916       uint32_t *dst = ((uint32_t *)dst_row) + 1;
917       for(x = 0; x < width; ++x) {
918          *dst = *src;
919          src += 1;
920          dst += 2;
921       }
922       dst_row += dst_stride/sizeof(*dst_row);
923       src_row += src_stride/sizeof(*src_row);
924    }
925 }
926 
927 
928 void
util_format_x24s8_uint_unpack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)929 util_format_x24s8_uint_unpack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)
930 {
931    util_format_z24_unorm_s8_uint_unpack_s_8uint(dst_row, dst_stride,
932 						      src_row, src_stride,
933 						      width, height);
934 }
935 
936 void
util_format_x24s8_uint_pack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)937 util_format_x24s8_uint_pack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)
938 {
939    util_format_z24_unorm_s8_uint_pack_s_8uint(dst_row, dst_stride,
940 						    src_row, src_stride,
941 						    width, height);
942 }
943 
944 void
util_format_s8x24_uint_unpack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)945 util_format_s8x24_uint_unpack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)
946 {
947    util_format_s8_uint_z24_unorm_unpack_s_8uint(dst_row, dst_stride,
948 						      src_row, src_stride,
949 						      width, height);
950 }
951 
952 void
util_format_s8x24_uint_pack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)953 util_format_s8x24_uint_pack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride, const uint8_t *restrict src_row, unsigned src_stride, unsigned width, unsigned height)
954 {
955    util_format_s8_uint_z24_unorm_pack_s_8uint(dst_row, dst_stride,
956 						      src_row, src_stride,
957 						      width, height);
958 }
959 
960 void
util_format_x32_s8x24_uint_unpack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)961 util_format_x32_s8x24_uint_unpack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
962 						const uint8_t *restrict src_row, unsigned src_stride,
963 						unsigned width, unsigned height)
964 {
965    util_format_z32_float_s8x24_uint_unpack_s_8uint(dst_row, dst_stride,
966 							 src_row, src_stride,
967 							 width, height);
968 
969 }
970 
971 void
util_format_x32_s8x24_uint_pack_s_8uint(uint8_t * restrict dst_row,unsigned dst_stride,const uint8_t * restrict src_row,unsigned src_stride,unsigned width,unsigned height)972 util_format_x32_s8x24_uint_pack_s_8uint(uint8_t *restrict dst_row, unsigned dst_stride,
973 					      const uint8_t *restrict src_row, unsigned src_stride,
974 					      unsigned width, unsigned height)
975 {
976    util_format_z32_float_s8x24_uint_pack_s_8uint(dst_row, dst_stride,
977                                                        src_row, src_stride,
978 						       width, height);
979 }
980