• 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 /**
30  * @file
31  * YUV and RGB subsampled formats conversion.
32  *
33  * @author Jose Fonseca <jfonseca@vmware.com>
34  */
35 
36 
37 #include "util/u_debug.h"
38 #include "util/u_format_yuv.h"
39 
40 
41 void
util_format_r8g8_b8g8_unorm_unpack_rgba_float(float * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)42 util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
43                                          const uint8_t *src_row, unsigned src_stride,
44                                          unsigned width, unsigned height)
45 {
46    unsigned x, y;
47 
48    for (y = 0; y < height; y += 1) {
49       float *dst = dst_row;
50       const uint32_t *src = (const uint32_t *)src_row;
51       uint32_t value;
52       float r, g0, g1, b;
53 
54       for (x = 0; x + 1 < width; x += 2) {
55          value = util_cpu_to_le32(*src++);
56 
57          r  = ubyte_to_float((value >>  0) & 0xff);
58          g0 = ubyte_to_float((value >>  8) & 0xff);
59          b  = ubyte_to_float((value >> 16) & 0xff);
60          g1 = ubyte_to_float((value >> 24) & 0xff);
61 
62          dst[0] = r;    /* r */
63          dst[1] = g0;   /* g */
64          dst[2] = b;    /* b */
65          dst[3] = 1.0f; /* a */
66          dst += 4;
67 
68          dst[0] = r;    /* r */
69          dst[1] = g1;   /* g */
70          dst[2] = b;    /* b */
71          dst[3] = 1.0f; /* a */
72          dst += 4;
73       }
74 
75       if (x < width) {
76          value = util_cpu_to_le32(*src);
77 
78          r  = ubyte_to_float((value >>  0) & 0xff);
79          g0 = ubyte_to_float((value >>  8) & 0xff);
80          b  = ubyte_to_float((value >> 16) & 0xff);
81          g1 = ubyte_to_float((value >> 24) & 0xff);
82 
83          dst[0] = r;    /* r */
84          dst[1] = g0;   /* g */
85          dst[2] = b;    /* b */
86          dst[3] = 1.0f; /* a */
87       }
88 
89       src_row += src_stride/sizeof(*src_row);
90       dst_row += dst_stride/sizeof(*dst_row);
91    }
92 }
93 
94 
95 void
util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)96 util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
97                                           const uint8_t *src_row, unsigned src_stride,
98                                           unsigned width, unsigned height)
99 {
100    unsigned x, y;
101 
102    for (y = 0; y < height; y += 1) {
103       uint8_t *dst = dst_row;
104       const uint32_t *src = (const uint32_t *)src_row;
105       uint32_t value;
106       uint8_t r, g0, g1, b;
107 
108       for (x = 0; x + 1 < width; x += 2) {
109          value = util_cpu_to_le32(*src++);
110 
111          r  = (value >>  0) & 0xff;
112          g0 = (value >>  8) & 0xff;
113          b  = (value >> 16) & 0xff;
114          g1 = (value >> 24) & 0xff;
115 
116          dst[0] = r;    /* r */
117          dst[1] = g0;   /* g */
118          dst[2] = b;    /* b */
119          dst[3] = 0xff; /* a */
120          dst += 4;
121 
122          dst[0] = r;    /* r */
123          dst[1] = g1;   /* g */
124          dst[2] = b;    /* b */
125          dst[3] = 0xff; /* a */
126          dst += 4;
127       }
128 
129       if (x < width) {
130          value = util_cpu_to_le32(*src);
131 
132          r  = (value >>  0) & 0xff;
133          g0 = (value >>  8) & 0xff;
134          b  = (value >> 16) & 0xff;
135          g1 = (value >> 24) & 0xff;
136 
137          dst[0] = r;    /* r */
138          dst[1] = g0;   /* g */
139          dst[2] = b;    /* b */
140          dst[3] = 0xff; /* a */
141       }
142 
143       src_row += src_stride/sizeof(*src_row);
144       dst_row += dst_stride/sizeof(*dst_row);
145    }
146 }
147 
148 
149 void
util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t * dst_row,unsigned dst_stride,const float * src_row,unsigned src_stride,unsigned width,unsigned height)150 util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
151                                        const float *src_row, unsigned src_stride,
152                                        unsigned width, unsigned height)
153 {
154    unsigned x, y;
155 
156    for (y = 0; y < height; y += 1) {
157       const float *src = src_row;
158       uint32_t *dst = (uint32_t *)dst_row;
159       float r, g0, g1, b;
160       uint32_t value;
161 
162       for (x = 0; x + 1 < width; x += 2) {
163          r  = 0.5f*(src[0] + src[4]);
164          g0 = src[1];
165          g1 = src[5];
166          b  = 0.5f*(src[2] + src[6]);
167 
168          value  = float_to_ubyte(r);
169          value |= float_to_ubyte(g0) <<  8;
170          value |= float_to_ubyte(b)  << 16;
171          value |= float_to_ubyte(g1) << 24;
172 
173          *dst++ = util_le32_to_cpu(value);
174 
175          src += 8;
176       }
177 
178       if (x < width) {
179          r  = src[0];
180          g0 = src[1];
181          g1 = 0;
182          b  = src[2];
183 
184          value  = float_to_ubyte(r);
185          value |= float_to_ubyte(g0) <<  8;
186          value |= float_to_ubyte(b)  << 16;
187          value |= float_to_ubyte(g1) << 24;
188 
189          *dst = util_le32_to_cpu(value);
190       }
191 
192       dst_row += dst_stride/sizeof(*dst_row);
193       src_row += src_stride/sizeof(*src_row);
194    }
195 }
196 
197 
198 void
util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)199 util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
200                                         const uint8_t *src_row, unsigned src_stride,
201                                         unsigned width, unsigned height)
202 {
203    unsigned x, y;
204 
205    for (y = 0; y < height; y += 1) {
206       const uint8_t *src = src_row;
207       uint32_t *dst = (uint32_t *)dst_row;
208       uint32_t r, g0, g1, b;
209       uint32_t value;
210 
211       for (x = 0; x + 1 < width; x += 2) {
212          r  = (src[0] + src[4] + 1) >> 1;
213          g0 = src[1];
214          g1 = src[5];
215          b  = (src[2] + src[6] + 1) >> 1;
216 
217          value  = r;
218          value |= g0 <<  8;
219          value |= b  << 16;
220          value |= g1 << 24;
221 
222          *dst++ = util_le32_to_cpu(value);
223 
224          src += 8;
225       }
226 
227       if (x < width) {
228          r  = src[0];
229          g0 = src[1];
230          g1 = 0;
231          b  = src[2];
232 
233          value  = r;
234          value |= g0 <<  8;
235          value |= b  << 16;
236          value |= g1 << 24;
237 
238          *dst = util_le32_to_cpu(value);
239       }
240 
241       dst_row += dst_stride/sizeof(*dst_row);
242       src_row += src_stride/sizeof(*src_row);
243    }
244 }
245 
246 
247 void
util_format_r8g8_b8g8_unorm_fetch_rgba_float(float * dst,const uint8_t * src,unsigned i,MAYBE_UNUSED unsigned j)248 util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
249                                         unsigned i, MAYBE_UNUSED unsigned j)
250 {
251    assert(i < 2);
252    assert(j < 1);
253 
254    dst[0] = ubyte_to_float(src[0]);             /* r */
255    dst[1] = ubyte_to_float(src[1 + 2*i]);       /* g */
256    dst[2] = ubyte_to_float(src[2]);             /* b */
257    dst[3] = 1.0f;                               /* a */
258 }
259 
260 
261 void
util_format_g8r8_g8b8_unorm_unpack_rgba_float(float * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)262 util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
263                                          const uint8_t *src_row, unsigned src_stride,
264                                          unsigned width, unsigned height)
265 {
266    unsigned x, y;
267 
268    for (y = 0; y < height; y += 1) {
269       float *dst = dst_row;
270       const uint32_t *src = (const uint32_t *)src_row;
271       uint32_t value;
272       float r, g0, g1, b;
273 
274       for (x = 0; x + 1 < width; x += 2) {
275          value = util_cpu_to_le32(*src++);
276 
277          g0 = ubyte_to_float((value >>  0) & 0xff);
278          r  = ubyte_to_float((value >>  8) & 0xff);
279          g1 = ubyte_to_float((value >> 16) & 0xff);
280          b  = ubyte_to_float((value >> 24) & 0xff);
281 
282          dst[0] = r;    /* r */
283          dst[1] = g0;   /* g */
284          dst[2] = b;    /* b */
285          dst[3] = 1.0f; /* a */
286          dst += 4;
287 
288          dst[0] = r;    /* r */
289          dst[1] = g1;   /* g */
290          dst[2] = b;    /* b */
291          dst[3] = 1.0f; /* a */
292          dst += 4;
293       }
294 
295       if (x < width) {
296          value = util_cpu_to_le32(*src);
297 
298          g0 = ubyte_to_float((value >>  0) & 0xff);
299          r  = ubyte_to_float((value >>  8) & 0xff);
300          g1 = ubyte_to_float((value >> 16) & 0xff);
301          b  = ubyte_to_float((value >> 24) & 0xff);
302 
303          dst[0] = r;    /* r */
304          dst[1] = g0;   /* g */
305          dst[2] = b;    /* b */
306          dst[3] = 1.0f; /* a */
307       }
308 
309       src_row += src_stride/sizeof(*src_row);
310       dst_row += dst_stride/sizeof(*dst_row);
311    }
312 }
313 
314 
315 void
util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)316 util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
317                                           const uint8_t *src_row, unsigned src_stride,
318                                           unsigned width, unsigned height)
319 {
320    unsigned x, y;
321 
322    for (y = 0; y < height; y += 1) {
323       uint8_t *dst = dst_row;
324       const uint32_t *src = (const uint32_t *)src_row;
325       uint32_t value;
326       uint8_t r, g0, g1, b;
327 
328       for (x = 0; x + 1 < width; x += 2) {
329          value = util_cpu_to_le32(*src++);
330 
331          g0 = (value >>  0) & 0xff;
332          r  = (value >>  8) & 0xff;
333          g1 = (value >> 16) & 0xff;
334          b  = (value >> 24) & 0xff;
335 
336          dst[0] = r;    /* r */
337          dst[1] = g0;   /* g */
338          dst[2] = b;    /* b */
339          dst[3] = 0xff; /* a */
340          dst += 4;
341 
342          dst[0] = r;    /* r */
343          dst[1] = g1;   /* g */
344          dst[2] = b;    /* b */
345          dst[3] = 0xff; /* a */
346          dst += 4;
347       }
348 
349       if (x < width) {
350          value = util_cpu_to_le32(*src);
351 
352          g0 = (value >>  0) & 0xff;
353          r  = (value >>  8) & 0xff;
354          g1 = (value >> 16) & 0xff;
355          b  = (value >> 24) & 0xff;
356 
357          dst[0] = r;    /* r */
358          dst[1] = g0;   /* g */
359          dst[2] = b;    /* b */
360          dst[3] = 0xff; /* a */
361       }
362 
363       src_row += src_stride/sizeof(*src_row);
364       dst_row += dst_stride/sizeof(*dst_row);
365    }
366 }
367 
368 
369 void
util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t * dst_row,unsigned dst_stride,const float * src_row,unsigned src_stride,unsigned width,unsigned height)370 util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
371                                        const float *src_row, unsigned src_stride,
372                                        unsigned width, unsigned height)
373 {
374    unsigned x, y;
375 
376    for (y = 0; y < height; y += 1) {
377       const float *src = src_row;
378       uint32_t *dst = (uint32_t *)dst_row;
379       float r, g0, g1, b;
380       uint32_t value;
381 
382       for (x = 0; x + 1 < width; x += 2) {
383          r  = 0.5f*(src[0] + src[4]);
384          g0 = src[1];
385          g1 = src[5];
386          b  = 0.5f*(src[2] + src[6]);
387 
388          value  = float_to_ubyte(g0);
389          value |= float_to_ubyte(r)  <<  8;
390          value |= float_to_ubyte(g1) << 16;
391          value |= float_to_ubyte(b)  << 24;
392 
393          *dst++ = util_le32_to_cpu(value);
394 
395          src += 8;
396       }
397 
398       if (x < width) {
399          r  = src[0];
400          g0 = src[1];
401          g1 = 0;
402          b  = src[2];
403 
404          value  = float_to_ubyte(g0);
405          value |= float_to_ubyte(r)  <<  8;
406          value |= float_to_ubyte(g1) << 16;
407          value |= float_to_ubyte(b)  << 24;
408 
409          *dst = util_le32_to_cpu(value);
410       }
411 
412       dst_row += dst_stride/sizeof(*dst_row);
413       src_row += src_stride/sizeof(*src_row);
414    }
415 }
416 
417 
418 void
util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)419 util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
420                                         const uint8_t *src_row, unsigned src_stride,
421                                         unsigned width, unsigned height)
422 {
423    unsigned x, y;
424 
425    for (y = 0; y < height; y += 1) {
426       const uint8_t *src = src_row;
427       uint32_t *dst = (uint32_t *)dst_row;
428       uint32_t r, g0, g1, b;
429       uint32_t value;
430 
431       for (x = 0; x + 1 < width; x += 2) {
432          r  = (src[0] + src[4] + 1) >> 1;
433          g0 = src[1];
434          g1 = src[5];
435          b  = (src[2] + src[6] + 1) >> 1;
436 
437          value  = g0;
438          value |= r  <<  8;
439          value |= g1 << 16;
440          value |= b  << 24;
441 
442          *dst++ = util_le32_to_cpu(value);
443 
444          src += 8;
445       }
446 
447       if (x < width) {
448          r  = src[0];
449          g0 = src[1];
450          g1 = 0;
451          b  = src[2];
452 
453          value  = g0;
454          value |= r  <<  8;
455          value |= g1 << 16;
456          value |= b  << 24;
457 
458          *dst = util_le32_to_cpu(value);
459       }
460 
461       dst_row += dst_stride/sizeof(*dst_row);
462       src_row += src_stride/sizeof(*src_row);
463    }
464 }
465 
466 
467 void
util_format_g8r8_g8b8_unorm_fetch_rgba_float(float * dst,const uint8_t * src,unsigned i,MAYBE_UNUSED unsigned j)468 util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
469                                         unsigned i, MAYBE_UNUSED unsigned j)
470 {
471    assert(i < 2);
472    assert(j < 1);
473 
474    dst[0] = ubyte_to_float(src[1]);             /* r */
475    dst[1] = ubyte_to_float(src[0 + 2*i]);       /* g */
476    dst[2] = ubyte_to_float(src[3]);             /* b */
477    dst[3] = 1.0f;                               /* a */
478 }
479 
480 
481 void
util_format_uyvy_unpack_rgba_float(float * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)482 util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
483                               const uint8_t *src_row, unsigned src_stride,
484                               unsigned width, unsigned height)
485 {
486    unsigned x, y;
487 
488    for (y = 0; y < height; y += 1) {
489       float *dst = dst_row;
490       const uint32_t *src = (const uint32_t *)src_row;
491       uint32_t value;
492       uint8_t y0, y1, u, v;
493 
494       for (x = 0; x + 1 < width; x += 2) {
495          value = util_cpu_to_le32(*src++);
496 
497          u  = (value >>  0) & 0xff;
498          y0 = (value >>  8) & 0xff;
499          v  = (value >> 16) & 0xff;
500          y1 = (value >> 24) & 0xff;
501 
502          util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
503          dst[3] = 1.0f; /* a */
504          dst += 4;
505 
506          util_format_yuv_to_rgb_float(y1, u, v, &dst[0], &dst[1], &dst[2]);
507          dst[3] = 1.0f; /* a */
508          dst += 4;
509       }
510 
511       if (x < width) {
512          value = util_cpu_to_le32(*src);
513 
514          u  = (value >>  0) & 0xff;
515          y0 = (value >>  8) & 0xff;
516          v  = (value >> 16) & 0xff;
517          y1 = (value >> 24) & 0xff;
518 
519          util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
520          dst[3] = 1.0f; /* a */
521       }
522 
523       src_row += src_stride/sizeof(*src_row);
524       dst_row += dst_stride/sizeof(*dst_row);
525    }
526 }
527 
528 
529 void
util_format_uyvy_unpack_rgba_8unorm(uint8_t * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)530 util_format_uyvy_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
531                                const uint8_t *src_row, unsigned src_stride,
532                                unsigned width, unsigned height)
533 {
534    unsigned x, y;
535 
536    for (y = 0; y < height; y += 1) {
537       uint8_t *dst = dst_row;
538       const uint32_t *src = (const uint32_t *)src_row;
539       uint32_t value;
540       uint8_t y0, y1, u, v;
541 
542       for (x = 0; x + 1 < width; x += 2) {
543          value = util_cpu_to_le32(*src++);
544 
545          u  = (value >>  0) & 0xff;
546          y0 = (value >>  8) & 0xff;
547          v  = (value >> 16) & 0xff;
548          y1 = (value >> 24) & 0xff;
549 
550          util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
551          dst[3] = 0xff; /* a */
552          dst += 4;
553 
554          util_format_yuv_to_rgb_8unorm(y1, u, v, &dst[0], &dst[1], &dst[2]);
555          dst[3] = 0xff; /* a */
556          dst += 4;
557       }
558 
559       if (x < width) {
560          value = util_cpu_to_le32(*src);
561 
562          u  = (value >>  0) & 0xff;
563          y0 = (value >>  8) & 0xff;
564          v  = (value >> 16) & 0xff;
565          y1 = (value >> 24) & 0xff;
566 
567          util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
568          dst[3] = 0xff; /* a */
569       }
570 
571       src_row += src_stride/sizeof(*src_row);
572       dst_row += dst_stride/sizeof(*dst_row);
573    }
574 }
575 
576 
577 void
util_format_uyvy_pack_rgba_float(uint8_t * dst_row,unsigned dst_stride,const float * src_row,unsigned src_stride,unsigned width,unsigned height)578 util_format_uyvy_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
579                             const float *src_row, unsigned src_stride,
580                             unsigned width, unsigned height)
581 {
582    unsigned x, y;
583 
584    for (y = 0; y < height; y += 1) {
585       const float *src = src_row;
586       uint32_t *dst = (uint32_t *)dst_row;
587       uint8_t y0, y1, u, v;
588       uint32_t value;
589 
590       for (x = 0; x + 1 < width; x += 2) {
591          uint8_t y0, y1, u0, u1, v0, v1, u, v;
592 
593          util_format_rgb_float_to_yuv(src[0], src[1], src[2],
594                                       &y0, &u0, &v0);
595          util_format_rgb_float_to_yuv(src[4], src[5], src[6],
596                                       &y1, &u1, &v1);
597 
598          u = (u0 + u1 + 1) >> 1;
599          v = (v0 + v1 + 1) >> 1;
600 
601          value  = u;
602          value |= y0 <<  8;
603          value |= v  << 16;
604          value |= y1 << 24;
605 
606          *dst++ = util_le32_to_cpu(value);
607 
608          src += 8;
609       }
610 
611       if (x < width) {
612          util_format_rgb_float_to_yuv(src[0], src[1], src[2],
613                                       &y0, &u, &v);
614          y1 = 0;
615 
616          value  = u;
617          value |= y0 <<  8;
618          value |= v  << 16;
619          value |= y1 << 24;
620 
621          *dst = util_le32_to_cpu(value);
622       }
623 
624       dst_row += dst_stride/sizeof(*dst_row);
625       src_row += src_stride/sizeof(*src_row);
626    }
627 }
628 
629 
630 void
util_format_uyvy_pack_rgba_8unorm(uint8_t * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)631 util_format_uyvy_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
632                              const uint8_t *src_row, unsigned src_stride,
633                              unsigned width, unsigned height)
634 {
635    unsigned x, y;
636 
637    for (y = 0; y < height; y += 1) {
638       const uint8_t *src = src_row;
639       uint32_t *dst = (uint32_t *)dst_row;
640       uint8_t y0, y1, u, v;
641       uint32_t value;
642 
643       for (x = 0; x + 1 < width; x += 2) {
644          uint8_t y0, y1, u0, u1, v0, v1, u, v;
645 
646          util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
647                                        &y0, &u0, &v0);
648          util_format_rgb_8unorm_to_yuv(src[4], src[5], src[6],
649                                        &y1, &u1, &v1);
650 
651          u = (u0 + u1 + 1) >> 1;
652          v = (v0 + v1 + 1) >> 1;
653 
654          value  = u;
655          value |= y0 <<  8;
656          value |= v  << 16;
657          value |= y1 << 24;
658 
659          *dst++ = util_le32_to_cpu(value);
660 
661          src += 8;
662       }
663 
664       if (x < width) {
665          util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
666                                        &y0, &u, &v);
667          y1 = 0;
668 
669          value  = u;
670          value |= y0 <<  8;
671          value |= v  << 16;
672          value |= y1 << 24;
673 
674          *dst = util_le32_to_cpu(value);
675       }
676 
677       dst_row += dst_stride/sizeof(*dst_row);
678       src_row += src_stride/sizeof(*src_row);
679    }
680 }
681 
682 
683 void
util_format_uyvy_fetch_rgba_float(float * dst,const uint8_t * src,unsigned i,MAYBE_UNUSED unsigned j)684 util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
685                              unsigned i, MAYBE_UNUSED unsigned j)
686 {
687    uint8_t y, u, v;
688 
689    assert(i < 2);
690    assert(j < 1);
691 
692    y = src[1 + i*2];
693    u = src[0];
694    v = src[2];
695 
696    util_format_yuv_to_rgb_float(y, u, v, &dst[0], &dst[1], &dst[2]);
697 
698    dst[3] = 1.0f;
699 }
700 
701 
702 void
util_format_yuyv_unpack_rgba_float(float * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)703 util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
704                               const uint8_t *src_row, unsigned src_stride,
705                               unsigned width, unsigned height)
706 {
707    unsigned x, y;
708 
709    for (y = 0; y < height; y += 1) {
710       float *dst = dst_row;
711       const uint32_t *src = (const uint32_t *)src_row;
712       uint32_t value;
713       uint8_t y0, y1, u, v;
714 
715       for (x = 0; x + 1 < width; x += 2) {
716          value = util_cpu_to_le32(*src++);
717 
718          y0 = (value >>  0) & 0xff;
719          u  = (value >>  8) & 0xff;
720          y1 = (value >> 16) & 0xff;
721          v  = (value >> 24) & 0xff;
722 
723          util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
724          dst[3] = 1.0f; /* a */
725          dst += 4;
726 
727          util_format_yuv_to_rgb_float(y1, u, v, &dst[0], &dst[1], &dst[2]);
728          dst[3] = 1.0f; /* a */
729          dst += 4;
730       }
731 
732       if (x < width) {
733          value = util_cpu_to_le32(*src);
734 
735          y0 = (value >>  0) & 0xff;
736          u  = (value >>  8) & 0xff;
737          y1 = (value >> 16) & 0xff;
738          v  = (value >> 24) & 0xff;
739 
740          util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
741          dst[3] = 1.0f; /* a */
742       }
743 
744       src_row += src_stride/sizeof(*src_row);
745       dst_row += dst_stride/sizeof(*dst_row);
746    }
747 }
748 
749 
750 void
util_format_yuyv_unpack_rgba_8unorm(uint8_t * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)751 util_format_yuyv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
752                                const uint8_t *src_row, unsigned src_stride,
753                                unsigned width, unsigned height)
754 {
755    unsigned x, y;
756 
757    for (y = 0; y < height; y += 1) {
758       uint8_t *dst = dst_row;
759       const uint32_t *src = (const uint32_t *)src_row;
760       uint32_t value;
761       uint8_t y0, y1, u, v;
762 
763       for (x = 0; x + 1 < width; x += 2) {
764          value = util_cpu_to_le32(*src++);
765 
766          y0 = (value >>  0) & 0xff;
767          u  = (value >>  8) & 0xff;
768          y1 = (value >> 16) & 0xff;
769          v  = (value >> 24) & 0xff;
770 
771          util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
772          dst[3] = 0xff; /* a */
773          dst += 4;
774 
775          util_format_yuv_to_rgb_8unorm(y1, u, v, &dst[0], &dst[1], &dst[2]);
776          dst[3] = 0xff; /* a */
777          dst += 4;
778       }
779 
780       if (x < width) {
781          value = util_cpu_to_le32(*src);
782 
783          y0 = (value >>  0) & 0xff;
784          u  = (value >>  8) & 0xff;
785          y1 = (value >> 16) & 0xff;
786          v  = (value >> 24) & 0xff;
787 
788          util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
789          dst[3] = 0xff; /* a */
790       }
791 
792       src_row += src_stride/sizeof(*src_row);
793       dst_row += dst_stride/sizeof(*dst_row);
794    }
795 }
796 
797 
798 void
util_format_yuyv_pack_rgba_float(uint8_t * dst_row,unsigned dst_stride,const float * src_row,unsigned src_stride,unsigned width,unsigned height)799 util_format_yuyv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
800                             const float *src_row, unsigned src_stride,
801                             unsigned width, unsigned height)
802 {
803    unsigned x, y;
804 
805    for (y = 0; y < height; y += 1) {
806       const float *src = src_row;
807       uint32_t *dst = (uint32_t *)dst_row;
808       uint8_t y0, y1, u, v;
809       uint32_t value;
810 
811       for (x = 0; x + 1 < width; x += 2) {
812          uint8_t y0, y1, u0, u1, v0, v1, u, v;
813 
814          util_format_rgb_float_to_yuv(src[0], src[1], src[2],
815                                       &y0, &u0, &v0);
816          util_format_rgb_float_to_yuv(src[4], src[5], src[6],
817                                       &y1, &u1, &v1);
818 
819          u = (u0 + u1 + 1) >> 1;
820          v = (v0 + v1 + 1) >> 1;
821 
822          value  = y0;
823          value |= u  <<  8;
824          value |= y1 << 16;
825          value |= v  << 24;
826 
827          *dst++ = util_le32_to_cpu(value);
828 
829          src += 8;
830       }
831 
832       if (x < width) {
833          util_format_rgb_float_to_yuv(src[0], src[1], src[2],
834                                       &y0, &u, &v);
835          y1 = 0;
836 
837          value  = y0;
838          value |= u  <<  8;
839          value |= y1 << 16;
840          value |= v  << 24;
841 
842          *dst = util_le32_to_cpu(value);
843       }
844 
845       dst_row += dst_stride/sizeof(*dst_row);
846       src_row += src_stride/sizeof(*src_row);
847    }
848 }
849 
850 
851 void
util_format_yuyv_pack_rgba_8unorm(uint8_t * dst_row,unsigned dst_stride,const uint8_t * src_row,unsigned src_stride,unsigned width,unsigned height)852 util_format_yuyv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
853                              const uint8_t *src_row, unsigned src_stride,
854                              unsigned width, unsigned height)
855 {
856    unsigned x, y;
857 
858    for (y = 0; y < height; y += 1) {
859       const uint8_t *src = src_row;
860       uint32_t *dst = (uint32_t *)dst_row;
861       uint8_t y0, y1, u, v;
862       uint32_t value;
863 
864       for (x = 0; x + 1 < width; x += 2) {
865          uint8_t y0, y1, u0, u1, v0, v1, u, v;
866 
867          util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
868                                        &y0, &u0, &v0);
869          util_format_rgb_8unorm_to_yuv(src[4], src[5], src[6],
870                                        &y1, &u1, &v1);
871 
872          u = (u0 + u1 + 1) >> 1;
873          v = (v0 + v1 + 1) >> 1;
874 
875          value  = y0;
876          value |= u  <<  8;
877          value |= y1 << 16;
878          value |= v  << 24;
879 
880          *dst++ = util_le32_to_cpu(value);
881 
882          src += 8;
883       }
884 
885       if (x < width) {
886          util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
887                                        &y0, &u, &v);
888          y1 = 0;
889 
890          value  = y0;
891          value |= u  <<  8;
892          value |= y1 << 16;
893          value |= v  << 24;
894 
895          *dst = util_le32_to_cpu(value);
896       }
897 
898       dst_row += dst_stride/sizeof(*dst_row);
899       src_row += src_stride/sizeof(*src_row);
900    }
901 }
902 
903 
904 void
util_format_yuyv_fetch_rgba_float(float * dst,const uint8_t * src,unsigned i,MAYBE_UNUSED unsigned j)905 util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
906                              unsigned i, MAYBE_UNUSED unsigned j)
907 {
908    uint8_t y, u, v;
909 
910    assert(i < 2);
911    assert(j < 1);
912 
913    y = src[0 + i*2];
914    u = src[1];
915    v = src[3];
916 
917    util_format_yuv_to_rgb_float(y, u, v, &dst[0], &dst[1], &dst[2]);
918 
919    dst[3] = 1.0f;
920 }
921 
922 /* XXX: Stubbed for now */
923 void
util_format_yv12_unpack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)924 util_format_yv12_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
925                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
926                              UNUSED unsigned width, UNUSED unsigned height) {}
927 void
util_format_yv12_pack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)928 util_format_yv12_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
929                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
930                              UNUSED unsigned width, UNUSED unsigned height) {}
931 void
util_format_yv12_unpack_rgba_float(UNUSED float * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)932 util_format_yv12_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
933                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
934                              UNUSED unsigned width, UNUSED unsigned height) {}
935 void
util_format_yv12_pack_rgba_float(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const float * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)936 util_format_yv12_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
937                              UNUSED const float *src_row, UNUSED unsigned src_stride,
938                              UNUSED unsigned width, UNUSED unsigned height) {}
939 void
util_format_yv12_fetch_rgba_float(UNUSED float * dst,UNUSED const uint8_t * src,UNUSED unsigned i,UNUSED unsigned j)940 util_format_yv12_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
941                              UNUSED unsigned i, UNUSED unsigned j) {}
942 void
util_format_yv16_unpack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)943 util_format_yv16_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
944                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
945                              UNUSED unsigned width, UNUSED unsigned height) {}
946 void
util_format_yv16_pack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)947 util_format_yv16_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
948                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
949                              UNUSED unsigned width, UNUSED unsigned height) {}
950 void
util_format_yv16_unpack_rgba_float(UNUSED float * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)951 util_format_yv16_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
952                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
953                              UNUSED unsigned width, UNUSED unsigned height) {}
954 void
util_format_yv16_pack_rgba_float(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const float * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)955 util_format_yv16_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
956                              UNUSED const float *src_row, UNUSED unsigned src_stride,
957                              UNUSED unsigned width, UNUSED unsigned height) {}
958 void
util_format_yv16_fetch_rgba_float(UNUSED float * dst,UNUSED const uint8_t * src,UNUSED unsigned i,UNUSED unsigned j)959 util_format_yv16_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
960                              UNUSED unsigned i, UNUSED unsigned j) {}
961 void
util_format_iyuv_unpack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)962 util_format_iyuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
963                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
964                              UNUSED unsigned width, UNUSED unsigned height) {}
965 void
util_format_iyuv_pack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)966 util_format_iyuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
967                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
968                              UNUSED unsigned width, UNUSED unsigned height) {}
969 void
util_format_iyuv_unpack_rgba_float(UNUSED float * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)970 util_format_iyuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
971                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
972                              UNUSED unsigned width, UNUSED unsigned height) {}
973 void
util_format_iyuv_pack_rgba_float(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const float * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)974 util_format_iyuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
975                              UNUSED const float *src_row, UNUSED unsigned src_stride,
976                              UNUSED unsigned width, UNUSED unsigned height) {}
977 void
util_format_iyuv_fetch_rgba_float(UNUSED float * dst,UNUSED const uint8_t * src,UNUSED unsigned i,UNUSED unsigned j)978 util_format_iyuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
979                              UNUSED unsigned i, UNUSED unsigned j) {}
980 void
util_format_nv12_unpack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)981 util_format_nv12_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
982                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
983                              UNUSED unsigned width, UNUSED unsigned height) {}
984 void
util_format_nv12_pack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)985 util_format_nv12_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
986                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
987                              UNUSED unsigned width, UNUSED unsigned height) {}
988 void
util_format_nv12_unpack_rgba_float(UNUSED float * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)989 util_format_nv12_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
990                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
991                              UNUSED unsigned width, UNUSED unsigned height) {}
992 void
util_format_nv12_pack_rgba_float(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const float * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)993 util_format_nv12_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
994                              UNUSED const float *src_row, UNUSED unsigned src_stride,
995                              UNUSED unsigned width, UNUSED unsigned height) {}
996 void
util_format_nv12_fetch_rgba_float(UNUSED float * dst,UNUSED const uint8_t * src,UNUSED unsigned i,UNUSED unsigned j)997 util_format_nv12_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
998                              UNUSED unsigned i, UNUSED unsigned j) {}
999 void
util_format_nv21_unpack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1000 util_format_nv21_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1001                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1002                              UNUSED unsigned width, UNUSED unsigned height) {}
1003 void
util_format_nv21_pack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1004 util_format_nv21_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1005                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1006                              UNUSED unsigned width, UNUSED unsigned height) {}
1007 void
util_format_nv21_unpack_rgba_float(UNUSED float * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1008 util_format_nv21_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
1009                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1010                              UNUSED unsigned width, UNUSED unsigned height) {}
1011 void
util_format_nv21_pack_rgba_float(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const float * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1012 util_format_nv21_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1013                              UNUSED const float *src_row, UNUSED unsigned src_stride,
1014                              UNUSED unsigned width, UNUSED unsigned height) {}
1015 void
util_format_nv21_fetch_rgba_float(UNUSED float * dst,UNUSED const uint8_t * src,UNUSED unsigned i,UNUSED unsigned j)1016 util_format_nv21_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
1017                              UNUSED unsigned i, UNUSED unsigned j) {}
1018 void
util_format_p016_unpack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1019 util_format_p016_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1020                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1021                              UNUSED unsigned width, UNUSED unsigned height) {}
1022 void
util_format_p016_pack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1023 util_format_p016_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1024                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1025                              UNUSED unsigned width, UNUSED unsigned height) {}
1026 void
util_format_p016_unpack_rgba_float(UNUSED float * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1027 util_format_p016_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
1028                              UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1029                              UNUSED unsigned width, UNUSED unsigned height) {}
1030 void
util_format_p016_pack_rgba_float(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const float * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1031 util_format_p016_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1032                              UNUSED const float *src_row, UNUSED unsigned src_stride,
1033                              UNUSED unsigned width, UNUSED unsigned height) {}
1034 void
util_format_p016_fetch_rgba_float(UNUSED float * dst,UNUSED const uint8_t * src,UNUSED unsigned i,UNUSED unsigned j)1035 util_format_p016_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
1036                              UNUSED unsigned i, UNUSED unsigned j) {}
1037 
1038 void
util_format_r8g8_r8b8_unorm_unpack_rgba_float(UNUSED float * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1039 util_format_r8g8_r8b8_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
1040                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1041                                          UNUSED unsigned width, UNUSED unsigned height) {}
1042 
1043 void
util_format_r8g8_r8b8_unorm_unpack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1044 util_format_r8g8_r8b8_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1045                                           UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1046                                           UNUSED unsigned width, UNUSED unsigned height) {}
1047 
1048 void
util_format_r8g8_r8b8_unorm_pack_rgba_float(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const float * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1049 util_format_r8g8_r8b8_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1050                                        UNUSED const float *src_row, UNUSED unsigned src_stride,
1051                                        UNUSED unsigned width, UNUSED unsigned height) {}
1052 
1053 void
util_format_r8g8_r8b8_unorm_pack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1054 util_format_r8g8_r8b8_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1055                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1056                                         UNUSED unsigned width, UNUSED unsigned height) {}
1057 
1058 void
util_format_r8g8_r8b8_unorm_fetch_rgba_float(UNUSED float * dst,UNUSED const uint8_t * src,UNUSED unsigned i,UNUSED unsigned j)1059 util_format_r8g8_r8b8_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
1060                                         UNUSED unsigned i, UNUSED unsigned j) {}
1061 
1062 void
util_format_g8r8_b8r8_unorm_unpack_rgba_float(UNUSED float * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1063 util_format_g8r8_b8r8_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
1064                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1065                                          UNUSED unsigned width, UNUSED unsigned height) {}
1066 
1067 void
util_format_g8r8_b8r8_unorm_unpack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1068 util_format_g8r8_b8r8_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1069                                           UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1070                                           UNUSED unsigned width, UNUSED unsigned height) {}
1071 
1072 void
util_format_g8r8_b8r8_unorm_pack_rgba_float(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const float * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1073 util_format_g8r8_b8r8_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1074                                        UNUSED const float *src_row, UNUSED unsigned src_stride,
1075                                        UNUSED unsigned width, UNUSED unsigned height) {}
1076 
1077 void
util_format_g8r8_b8r8_unorm_pack_rgba_8unorm(UNUSED uint8_t * dst_row,UNUSED unsigned dst_stride,UNUSED const uint8_t * src_row,UNUSED unsigned src_stride,UNUSED unsigned width,UNUSED unsigned height)1078 util_format_g8r8_b8r8_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
1079                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
1080                                         UNUSED unsigned width, UNUSED unsigned height) {}
1081 
1082 void
util_format_g8r8_b8r8_unorm_fetch_rgba_float(UNUSED float * dst,UNUSED const uint8_t * src,UNUSED unsigned i,UNUSED unsigned j)1083 util_format_g8r8_b8r8_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
1084                                         UNUSED unsigned i, UNUSED unsigned j) {}
1085