pixfmt: Add gbrap10 pixel format
[libav.git] / libavutil / pixdesc.c
1 /*
2 * pixel format descriptor
3 * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at>
4 *
5 * This file is part of Libav.
6 *
7 * Libav is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * Libav is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with Libav; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include <stdio.h>
23 #include <string.h>
24
25 #include "avstring.h"
26 #include "common.h"
27 #include "pixfmt.h"
28 #include "pixdesc.h"
29 #include "internal.h"
30 #include "intreadwrite.h"
31 #include "version.h"
32
33 void av_read_image_line(uint16_t *dst,
34 const uint8_t *data[4], const int linesize[4],
35 const AVPixFmtDescriptor *desc,
36 int x, int y, int c, int w,
37 int read_pal_component)
38 {
39 AVComponentDescriptor comp = desc->comp[c];
40 int plane = comp.plane;
41 int depth = comp.depth;
42 int mask = (1 << depth) - 1;
43 int shift = comp.shift;
44 int step = comp.step;
45 int flags = desc->flags;
46
47 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
48 int skip = x * step + comp.offset;
49 const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
50 int shift = 8 - depth - (skip & 7);
51
52 while (w--) {
53 int val = (*p >> shift) & mask;
54 if (read_pal_component)
55 val = data[1][4*val + c];
56 shift -= step;
57 p -= shift >> 3;
58 shift &= 7;
59 *dst++ = val;
60 }
61 } else {
62 const uint8_t *p = data[plane] + y * linesize[plane] +
63 x * step + comp.offset;
64 int is_8bit = shift + depth <= 8;
65
66 if (is_8bit)
67 p += !!(flags & AV_PIX_FMT_FLAG_BE);
68
69 while (w--) {
70 int val = is_8bit ? *p :
71 flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p);
72 val = (val >> shift) & mask;
73 if (read_pal_component)
74 val = data[1][4 * val + c];
75 p += step;
76 *dst++ = val;
77 }
78 }
79 }
80
81 void av_write_image_line(const uint16_t *src,
82 uint8_t *data[4], const int linesize[4],
83 const AVPixFmtDescriptor *desc,
84 int x, int y, int c, int w)
85 {
86 AVComponentDescriptor comp = desc->comp[c];
87 int plane = comp.plane;
88 int depth = comp.depth;
89 int step = comp.step;
90 int flags = desc->flags;
91
92 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
93 int skip = x * step + comp.offset;
94 uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
95 int shift = 8 - depth - (skip & 7);
96
97 while (w--) {
98 *p |= *src++ << shift;
99 shift -= step;
100 p -= shift >> 3;
101 shift &= 7;
102 }
103 } else {
104 int shift = comp.shift;
105 uint8_t *p = data[plane] + y * linesize[plane] +
106 x * step + comp.offset;
107
108 if (shift + depth <= 8) {
109 p += !!(flags & AV_PIX_FMT_FLAG_BE);
110 while (w--) {
111 *p |= (*src++ << shift);
112 p += step;
113 }
114 } else {
115 while (w--) {
116 if (flags & AV_PIX_FMT_FLAG_BE) {
117 uint16_t val = AV_RB16(p) | (*src++ << shift);
118 AV_WB16(p, val);
119 } else {
120 uint16_t val = AV_RL16(p) | (*src++ << shift);
121 AV_WL16(p, val);
122 }
123 p += step;
124 }
125 }
126 }
127 }
128
129 #if FF_API_PLUS1_MINUS1
130 FF_DISABLE_DEPRECATION_WARNINGS
131 #endif
132 static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
133 [AV_PIX_FMT_YUV420P] = {
134 .name = "yuv420p",
135 .nb_components = 3,
136 .log2_chroma_w = 1,
137 .log2_chroma_h = 1,
138 .comp = {
139 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
140 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
141 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
142 },
143 .flags = AV_PIX_FMT_FLAG_PLANAR,
144 },
145 [AV_PIX_FMT_YUYV422] = {
146 .name = "yuyv422",
147 .nb_components = 3,
148 .log2_chroma_w = 1,
149 .log2_chroma_h = 0,
150 .comp = {
151 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
152 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* U */
153 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* V */
154 },
155 },
156 [AV_PIX_FMT_YVYU422] = {
157 .name = "yvyu422",
158 .nb_components = 3,
159 .log2_chroma_w = 1,
160 .log2_chroma_h = 0,
161 .comp = {
162 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
163 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* U */
164 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* V */
165 },
166 },
167 [AV_PIX_FMT_RGB24] = {
168 .name = "rgb24",
169 .nb_components = 3,
170 .log2_chroma_w = 0,
171 .log2_chroma_h = 0,
172 .comp = {
173 { 0, 3, 0, 0, 8, 2, 7, 1 }, /* R */
174 { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
175 { 0, 3, 2, 0, 8, 2, 7, 3 }, /* B */
176 },
177 .flags = AV_PIX_FMT_FLAG_RGB,
178 },
179 [AV_PIX_FMT_BGR24] = {
180 .name = "bgr24",
181 .nb_components = 3,
182 .log2_chroma_w = 0,
183 .log2_chroma_h = 0,
184 .comp = {
185 { 0, 3, 2, 0, 8, 2, 7, 3 }, /* R */
186 { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
187 { 0, 3, 0, 0, 8, 2, 7, 1 }, /* B */
188 },
189 .flags = AV_PIX_FMT_FLAG_RGB,
190 },
191 [AV_PIX_FMT_YUV422P] = {
192 .name = "yuv422p",
193 .nb_components = 3,
194 .log2_chroma_w = 1,
195 .log2_chroma_h = 0,
196 .comp = {
197 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
198 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
199 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
200 },
201 .flags = AV_PIX_FMT_FLAG_PLANAR,
202 },
203 [AV_PIX_FMT_YUV444P] = {
204 .name = "yuv444p",
205 .nb_components = 3,
206 .log2_chroma_w = 0,
207 .log2_chroma_h = 0,
208 .comp = {
209 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
210 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
211 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
212 },
213 .flags = AV_PIX_FMT_FLAG_PLANAR,
214 },
215 [AV_PIX_FMT_YUV410P] = {
216 .name = "yuv410p",
217 .nb_components = 3,
218 .log2_chroma_w = 2,
219 .log2_chroma_h = 2,
220 .comp = {
221 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
222 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
223 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
224 },
225 .flags = AV_PIX_FMT_FLAG_PLANAR,
226 },
227 [AV_PIX_FMT_YUV411P] = {
228 .name = "yuv411p",
229 .nb_components = 3,
230 .log2_chroma_w = 2,
231 .log2_chroma_h = 0,
232 .comp = {
233 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
234 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
235 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
236 },
237 .flags = AV_PIX_FMT_FLAG_PLANAR,
238 },
239 [AV_PIX_FMT_GRAY8] = {
240 .name = "gray",
241 .nb_components = 1,
242 .log2_chroma_w = 0,
243 .log2_chroma_h = 0,
244 .comp = {
245 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
246 },
247 .flags = AV_PIX_FMT_FLAG_PSEUDOPAL,
248 .alias = "gray8,y8",
249 },
250 [AV_PIX_FMT_MONOWHITE] = {
251 .name = "monow",
252 .nb_components = 1,
253 .log2_chroma_w = 0,
254 .log2_chroma_h = 0,
255 .comp = {
256 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* Y */
257 },
258 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
259 },
260 [AV_PIX_FMT_MONOBLACK] = {
261 .name = "monob",
262 .nb_components = 1,
263 .log2_chroma_w = 0,
264 .log2_chroma_h = 0,
265 .comp = {
266 { 0, 1, 0, 7, 1, 0, 0, 1 }, /* Y */
267 },
268 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
269 },
270 [AV_PIX_FMT_PAL8] = {
271 .name = "pal8",
272 .nb_components = 1,
273 .log2_chroma_w = 0,
274 .log2_chroma_h = 0,
275 .comp = {
276 { 0, 1, 0, 0, 8, 0, 7, 1 },
277 },
278 .flags = AV_PIX_FMT_FLAG_PAL,
279 },
280 [AV_PIX_FMT_YUVJ420P] = {
281 .name = "yuvj420p",
282 .nb_components = 3,
283 .log2_chroma_w = 1,
284 .log2_chroma_h = 1,
285 .comp = {
286 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
287 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
288 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
289 },
290 .flags = AV_PIX_FMT_FLAG_PLANAR,
291 },
292 [AV_PIX_FMT_YUVJ422P] = {
293 .name = "yuvj422p",
294 .nb_components = 3,
295 .log2_chroma_w = 1,
296 .log2_chroma_h = 0,
297 .comp = {
298 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
299 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
300 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
301 },
302 .flags = AV_PIX_FMT_FLAG_PLANAR,
303 },
304 [AV_PIX_FMT_YUVJ444P] = {
305 .name = "yuvj444p",
306 .nb_components = 3,
307 .log2_chroma_w = 0,
308 .log2_chroma_h = 0,
309 .comp = {
310 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
311 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
312 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
313 },
314 .flags = AV_PIX_FMT_FLAG_PLANAR,
315 },
316 [AV_PIX_FMT_UYVY422] = {
317 .name = "uyvy422",
318 .nb_components = 3,
319 .log2_chroma_w = 1,
320 .log2_chroma_h = 0,
321 .comp = {
322 { 0, 2, 1, 0, 8, 1, 7, 2 }, /* Y */
323 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* U */
324 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* V */
325 },
326 },
327 [AV_PIX_FMT_UYYVYY411] = {
328 .name = "uyyvyy411",
329 .nb_components = 3,
330 .log2_chroma_w = 2,
331 .log2_chroma_h = 0,
332 .comp = {
333 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* Y */
334 { 0, 6, 0, 0, 8, 5, 7, 1 }, /* U */
335 { 0, 6, 3, 0, 8, 5, 7, 4 }, /* V */
336 },
337 },
338 [AV_PIX_FMT_BGR8] = {
339 .name = "bgr8",
340 .nb_components = 3,
341 .log2_chroma_w = 0,
342 .log2_chroma_h = 0,
343 .comp = {
344 { 0, 1, 0, 0, 3, 0, 2, 1 }, /* R */
345 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
346 { 0, 1, 0, 6, 2, 0, 1, 1 }, /* B */
347 },
348 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
349 },
350 [AV_PIX_FMT_BGR4] = {
351 .name = "bgr4",
352 .nb_components = 3,
353 .log2_chroma_w = 0,
354 .log2_chroma_h = 0,
355 .comp = {
356 { 0, 4, 3, 0, 1, 3, 0, 4 }, /* R */
357 { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
358 { 0, 4, 0, 0, 1, 3, 0, 1 }, /* B */
359 },
360 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
361 },
362 [AV_PIX_FMT_BGR4_BYTE] = {
363 .name = "bgr4_byte",
364 .nb_components = 3,
365 .log2_chroma_w = 0,
366 .log2_chroma_h = 0,
367 .comp = {
368 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* R */
369 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
370 { 0, 1, 0, 3, 1, 0, 0, 1 }, /* B */
371 },
372 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
373 },
374 [AV_PIX_FMT_RGB8] = {
375 .name = "rgb8",
376 .nb_components = 3,
377 .log2_chroma_w = 0,
378 .log2_chroma_h = 0,
379 .comp = {
380 { 0, 1, 0, 6, 2, 0, 1, 1 }, /* R */
381 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
382 { 0, 1, 0, 0, 3, 0, 2, 1 }, /* B */
383 },
384 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
385 },
386 [AV_PIX_FMT_RGB4] = {
387 .name = "rgb4",
388 .nb_components = 3,
389 .log2_chroma_w = 0,
390 .log2_chroma_h = 0,
391 .comp = {
392 { 0, 4, 0, 0, 1, 3, 0, 1 }, /* R */
393 { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
394 { 0, 4, 3, 0, 1, 3, 0, 4 }, /* B */
395 },
396 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
397 },
398 [AV_PIX_FMT_RGB4_BYTE] = {
399 .name = "rgb4_byte",
400 .nb_components = 3,
401 .log2_chroma_w = 0,
402 .log2_chroma_h = 0,
403 .comp = {
404 { 0, 1, 0, 3, 1, 0, 0, 1 }, /* R */
405 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
406 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* B */
407 },
408 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
409 },
410 [AV_PIX_FMT_NV12] = {
411 .name = "nv12",
412 .nb_components = 3,
413 .log2_chroma_w = 1,
414 .log2_chroma_h = 1,
415 .comp = {
416 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
417 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
418 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
419 },
420 .flags = AV_PIX_FMT_FLAG_PLANAR,
421 },
422 [AV_PIX_FMT_NV21] = {
423 .name = "nv21",
424 .nb_components = 3,
425 .log2_chroma_w = 1,
426 .log2_chroma_h = 1,
427 .comp = {
428 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
429 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */
430 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */
431 },
432 .flags = AV_PIX_FMT_FLAG_PLANAR,
433 },
434 [AV_PIX_FMT_ARGB] = {
435 .name = "argb",
436 .nb_components = 4,
437 .log2_chroma_w = 0,
438 .log2_chroma_h = 0,
439 .comp = {
440 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
441 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
442 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
443 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
444 },
445 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
446 },
447 [AV_PIX_FMT_RGBA] = {
448 .name = "rgba",
449 .nb_components = 4,
450 .log2_chroma_w = 0,
451 .log2_chroma_h = 0,
452 .comp = {
453 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
454 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
455 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
456 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
457 },
458 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
459 },
460 [AV_PIX_FMT_ABGR] = {
461 .name = "abgr",
462 .nb_components = 4,
463 .log2_chroma_w = 0,
464 .log2_chroma_h = 0,
465 .comp = {
466 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
467 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
468 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
469 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
470 },
471 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
472 },
473 [AV_PIX_FMT_BGRA] = {
474 .name = "bgra",
475 .nb_components = 4,
476 .log2_chroma_w = 0,
477 .log2_chroma_h = 0,
478 .comp = {
479 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
480 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
481 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
482 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
483 },
484 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
485 },
486 [AV_PIX_FMT_GRAY12BE] = {
487 .name = "gray12be",
488 .nb_components = 1,
489 .log2_chroma_w = 0,
490 .log2_chroma_h = 0,
491 .comp = {
492 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
493 },
494 .flags = AV_PIX_FMT_FLAG_BE,
495 .alias = "y12be",
496 },
497 [AV_PIX_FMT_GRAY12LE] = {
498 .name = "gray12le",
499 .nb_components = 1,
500 .log2_chroma_w = 0,
501 .log2_chroma_h = 0,
502 .comp = {
503 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
504 },
505 .alias = "y12le",
506 },
507 [AV_PIX_FMT_GRAY16BE] = {
508 .name = "gray16be",
509 .nb_components = 1,
510 .log2_chroma_w = 0,
511 .log2_chroma_h = 0,
512 .comp = {
513 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
514 },
515 .flags = AV_PIX_FMT_FLAG_BE,
516 .alias = "y16be",
517 },
518 [AV_PIX_FMT_GRAY16LE] = {
519 .name = "gray16le",
520 .nb_components = 1,
521 .log2_chroma_w = 0,
522 .log2_chroma_h = 0,
523 .comp = {
524 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
525 },
526 .alias = "y16le",
527 },
528 [AV_PIX_FMT_YUV440P] = {
529 .name = "yuv440p",
530 .nb_components = 3,
531 .log2_chroma_w = 0,
532 .log2_chroma_h = 1,
533 .comp = {
534 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
535 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
536 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
537 },
538 .flags = AV_PIX_FMT_FLAG_PLANAR,
539 },
540 [AV_PIX_FMT_YUVJ440P] = {
541 .name = "yuvj440p",
542 .nb_components = 3,
543 .log2_chroma_w = 0,
544 .log2_chroma_h = 1,
545 .comp = {
546 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
547 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
548 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
549 },
550 .flags = AV_PIX_FMT_FLAG_PLANAR,
551 },
552 [AV_PIX_FMT_YUVA420P] = {
553 .name = "yuva420p",
554 .nb_components = 4,
555 .log2_chroma_w = 1,
556 .log2_chroma_h = 1,
557 .comp = {
558 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
559 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
560 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
561 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
562 },
563 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
564 },
565 [AV_PIX_FMT_YUVA422P] = {
566 .name = "yuva422p",
567 .nb_components = 4,
568 .log2_chroma_w = 1,
569 .log2_chroma_h = 0,
570 .comp = {
571 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
572 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
573 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
574 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
575 },
576 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
577 },
578 [AV_PIX_FMT_YUVA444P] = {
579 .name = "yuva444p",
580 .nb_components = 4,
581 .log2_chroma_w = 0,
582 .log2_chroma_h = 0,
583 .comp = {
584 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
585 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
586 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
587 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
588 },
589 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
590 },
591 [AV_PIX_FMT_YUVA420P9BE] = {
592 .name = "yuva420p9be",
593 .nb_components = 4,
594 .log2_chroma_w = 1,
595 .log2_chroma_h = 1,
596 .comp = {
597 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
598 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
599 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
600 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
601 },
602 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
603 },
604 [AV_PIX_FMT_YUVA420P9LE] = {
605 .name = "yuva420p9le",
606 .nb_components = 4,
607 .log2_chroma_w = 1,
608 .log2_chroma_h = 1,
609 .comp = {
610 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
611 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
612 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
613 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
614 },
615 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
616 },
617 [AV_PIX_FMT_YUVA422P9BE] = {
618 .name = "yuva422p9be",
619 .nb_components = 4,
620 .log2_chroma_w = 1,
621 .log2_chroma_h = 0,
622 .comp = {
623 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
624 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
625 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
626 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
627 },
628 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
629 },
630 [AV_PIX_FMT_YUVA422P9LE] = {
631 .name = "yuva422p9le",
632 .nb_components = 4,
633 .log2_chroma_w = 1,
634 .log2_chroma_h = 0,
635 .comp = {
636 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
637 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
638 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
639 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
640 },
641 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
642 },
643 [AV_PIX_FMT_YUVA444P9BE] = {
644 .name = "yuva444p9be",
645 .nb_components = 4,
646 .log2_chroma_w = 0,
647 .log2_chroma_h = 0,
648 .comp = {
649 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
650 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
651 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
652 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
653 },
654 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
655 },
656 [AV_PIX_FMT_YUVA444P9LE] = {
657 .name = "yuva444p9le",
658 .nb_components = 4,
659 .log2_chroma_w = 0,
660 .log2_chroma_h = 0,
661 .comp = {
662 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
663 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
664 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
665 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
666 },
667 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
668 },
669 [AV_PIX_FMT_YUVA420P10BE] = {
670 .name = "yuva420p10be",
671 .nb_components = 4,
672 .log2_chroma_w = 1,
673 .log2_chroma_h = 1,
674 .comp = {
675 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
676 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
677 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
678 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
679 },
680 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
681 },
682 [AV_PIX_FMT_YUVA420P10LE] = {
683 .name = "yuva420p10le",
684 .nb_components = 4,
685 .log2_chroma_w = 1,
686 .log2_chroma_h = 1,
687 .comp = {
688 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
689 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
690 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
691 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
692 },
693 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
694 },
695 [AV_PIX_FMT_YUVA422P10BE] = {
696 .name = "yuva422p10be",
697 .nb_components = 4,
698 .log2_chroma_w = 1,
699 .log2_chroma_h = 0,
700 .comp = {
701 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
702 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
703 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
704 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
705 },
706 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
707 },
708 [AV_PIX_FMT_YUVA422P10LE] = {
709 .name = "yuva422p10le",
710 .nb_components = 4,
711 .log2_chroma_w = 1,
712 .log2_chroma_h = 0,
713 .comp = {
714 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
715 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
716 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
717 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
718 },
719 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
720 },
721 [AV_PIX_FMT_YUVA444P10BE] = {
722 .name = "yuva444p10be",
723 .nb_components = 4,
724 .log2_chroma_w = 0,
725 .log2_chroma_h = 0,
726 .comp = {
727 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
728 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
729 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
730 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
731 },
732 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
733 },
734 [AV_PIX_FMT_YUVA444P10LE] = {
735 .name = "yuva444p10le",
736 .nb_components = 4,
737 .log2_chroma_w = 0,
738 .log2_chroma_h = 0,
739 .comp = {
740 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
741 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
742 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
743 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
744 },
745 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
746 },
747 [AV_PIX_FMT_YUVA420P16BE] = {
748 .name = "yuva420p16be",
749 .nb_components = 4,
750 .log2_chroma_w = 1,
751 .log2_chroma_h = 1,
752 .comp = {
753 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
754 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
755 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
756 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
757 },
758 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
759 },
760 [AV_PIX_FMT_YUVA420P16LE] = {
761 .name = "yuva420p16le",
762 .nb_components = 4,
763 .log2_chroma_w = 1,
764 .log2_chroma_h = 1,
765 .comp = {
766 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
767 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
768 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
769 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
770 },
771 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
772 },
773 [AV_PIX_FMT_YUVA422P16BE] = {
774 .name = "yuva422p16be",
775 .nb_components = 4,
776 .log2_chroma_w = 1,
777 .log2_chroma_h = 0,
778 .comp = {
779 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
780 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
781 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
782 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
783 },
784 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
785 },
786 [AV_PIX_FMT_YUVA422P16LE] = {
787 .name = "yuva422p16le",
788 .nb_components = 4,
789 .log2_chroma_w = 1,
790 .log2_chroma_h = 0,
791 .comp = {
792 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
793 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
794 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
795 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
796 },
797 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
798 },
799 [AV_PIX_FMT_YUVA444P16BE] = {
800 .name = "yuva444p16be",
801 .nb_components = 4,
802 .log2_chroma_w = 0,
803 .log2_chroma_h = 0,
804 .comp = {
805 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
806 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
807 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
808 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
809 },
810 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
811 },
812 [AV_PIX_FMT_YUVA444P16LE] = {
813 .name = "yuva444p16le",
814 .nb_components = 4,
815 .log2_chroma_w = 0,
816 .log2_chroma_h = 0,
817 .comp = {
818 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
819 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
820 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
821 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
822 },
823 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
824 },
825 [AV_PIX_FMT_RGB48BE] = {
826 .name = "rgb48be",
827 .nb_components = 3,
828 .log2_chroma_w = 0,
829 .log2_chroma_h = 0,
830 .comp = {
831 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
832 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
833 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
834 },
835 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
836 },
837 [AV_PIX_FMT_RGB48LE] = {
838 .name = "rgb48le",
839 .nb_components = 3,
840 .log2_chroma_w = 0,
841 .log2_chroma_h = 0,
842 .comp = {
843 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
844 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
845 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
846 },
847 .flags = AV_PIX_FMT_FLAG_RGB,
848 },
849 [AV_PIX_FMT_RGBA64BE] = {
850 .name = "rgba64be",
851 .nb_components = 4,
852 .log2_chroma_w = 0,
853 .log2_chroma_h = 0,
854 .comp = {
855 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
856 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
857 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
858 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
859 },
860 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
861 },
862 [AV_PIX_FMT_RGBA64LE] = {
863 .name = "rgba64le",
864 .nb_components = 4,
865 .log2_chroma_w = 0,
866 .log2_chroma_h = 0,
867 .comp = {
868 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
869 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
870 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
871 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
872 },
873 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
874 },
875 [AV_PIX_FMT_RGB565BE] = {
876 .name = "rgb565be",
877 .nb_components = 3,
878 .log2_chroma_w = 0,
879 .log2_chroma_h = 0,
880 .comp = {
881 { 0, 2, -1, 3, 5, 1, 4, 0 }, /* R */
882 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
883 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
884 },
885 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
886 },
887 [AV_PIX_FMT_RGB565LE] = {
888 .name = "rgb565le",
889 .nb_components = 3,
890 .log2_chroma_w = 0,
891 .log2_chroma_h = 0,
892 .comp = {
893 { 0, 2, 1, 3, 5, 1, 4, 2 }, /* R */
894 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
895 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
896 },
897 .flags = AV_PIX_FMT_FLAG_RGB,
898 },
899 [AV_PIX_FMT_RGB555BE] = {
900 .name = "rgb555be",
901 .nb_components = 3,
902 .log2_chroma_w = 0,
903 .log2_chroma_h = 0,
904 .comp = {
905 { 0, 2, -1, 2, 5, 1, 4, 0 }, /* R */
906 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
907 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
908 },
909 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
910 },
911 [AV_PIX_FMT_RGB555LE] = {
912 .name = "rgb555le",
913 .nb_components = 3,
914 .log2_chroma_w = 0,
915 .log2_chroma_h = 0,
916 .comp = {
917 { 0, 2, 1, 2, 5, 1, 4, 2 }, /* R */
918 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
919 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
920 },
921 .flags = AV_PIX_FMT_FLAG_RGB,
922 },
923 [AV_PIX_FMT_RGB444BE] = {
924 .name = "rgb444be",
925 .nb_components = 3,
926 .log2_chroma_w = 0,
927 .log2_chroma_h = 0,
928 .comp = {
929 { 0, 2, -1, 0, 4, 1, 3, 0 }, /* R */
930 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
931 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
932 },
933 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
934 },
935 [AV_PIX_FMT_RGB444LE] = {
936 .name = "rgb444le",
937 .nb_components = 3,
938 .log2_chroma_w = 0,
939 .log2_chroma_h = 0,
940 .comp = {
941 { 0, 2, 1, 0, 4, 1, 3, 2 }, /* R */
942 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
943 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
944 },
945 .flags = AV_PIX_FMT_FLAG_RGB,
946 },
947 [AV_PIX_FMT_BGR48BE] = {
948 .name = "bgr48be",
949 .nb_components = 3,
950 .log2_chroma_w = 0,
951 .log2_chroma_h = 0,
952 .comp = {
953 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
954 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
955 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
956 },
957 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
958 },
959 [AV_PIX_FMT_BGR48LE] = {
960 .name = "bgr48le",
961 .nb_components = 3,
962 .log2_chroma_w = 0,
963 .log2_chroma_h = 0,
964 .comp = {
965 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
966 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
967 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
968 },
969 .flags = AV_PIX_FMT_FLAG_RGB,
970 },
971 [AV_PIX_FMT_BGRA64BE] = {
972 .name = "bgra64be",
973 .nb_components = 4,
974 .log2_chroma_w = 0,
975 .log2_chroma_h = 0,
976 .comp = {
977 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
978 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
979 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
980 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
981 },
982 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
983 },
984 [AV_PIX_FMT_BGRA64LE] = {
985 .name = "bgra64le",
986 .nb_components = 4,
987 .log2_chroma_w = 0,
988 .log2_chroma_h = 0,
989 .comp = {
990 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
991 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
992 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
993 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
994 },
995 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
996 },
997 [AV_PIX_FMT_BGR565BE] = {
998 .name = "bgr565be",
999 .nb_components = 3,
1000 .log2_chroma_w = 0,
1001 .log2_chroma_h = 0,
1002 .comp = {
1003 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1004 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1005 { 0, 2, -1, 3, 5, 1, 4, 0 }, /* B */
1006 },
1007 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1008 },
1009 [AV_PIX_FMT_BGR565LE] = {
1010 .name = "bgr565le",
1011 .nb_components = 3,
1012 .log2_chroma_w = 0,
1013 .log2_chroma_h = 0,
1014 .comp = {
1015 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1016 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1017 { 0, 2, 1, 3, 5, 1, 4, 2 }, /* B */
1018 },
1019 .flags = AV_PIX_FMT_FLAG_RGB,
1020 },
1021 [AV_PIX_FMT_BGR555BE] = {
1022 .name = "bgr555be",
1023 .nb_components = 3,
1024 .log2_chroma_w = 0,
1025 .log2_chroma_h = 0,
1026 .comp = {
1027 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1028 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1029 { 0, 2, -1, 2, 5, 1, 4, 0 }, /* B */
1030 },
1031 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1032 },
1033 [AV_PIX_FMT_BGR555LE] = {
1034 .name = "bgr555le",
1035 .nb_components = 3,
1036 .log2_chroma_w = 0,
1037 .log2_chroma_h = 0,
1038 .comp = {
1039 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1040 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1041 { 0, 2, 1, 2, 5, 1, 4, 2 }, /* B */
1042 },
1043 .flags = AV_PIX_FMT_FLAG_RGB,
1044 },
1045 [AV_PIX_FMT_BGR444BE] = {
1046 .name = "bgr444be",
1047 .nb_components = 3,
1048 .log2_chroma_w = 0,
1049 .log2_chroma_h = 0,
1050 .comp = {
1051 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1052 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1053 { 0, 2, -1, 0, 4, 1, 3, 0 }, /* B */
1054 },
1055 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1056 },
1057 [AV_PIX_FMT_BGR444LE] = {
1058 .name = "bgr444le",
1059 .nb_components = 3,
1060 .log2_chroma_w = 0,
1061 .log2_chroma_h = 0,
1062 .comp = {
1063 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1064 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1065 { 0, 2, 1, 0, 4, 1, 3, 2 }, /* B */
1066 },
1067 .flags = AV_PIX_FMT_FLAG_RGB,
1068 },
1069 #if FF_API_VAAPI
1070 [AV_PIX_FMT_VAAPI_MOCO] = {
1071 .name = "vaapi_moco",
1072 .log2_chroma_w = 1,
1073 .log2_chroma_h = 1,
1074 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1075 },
1076 [AV_PIX_FMT_VAAPI_IDCT] = {
1077 .name = "vaapi_idct",
1078 .log2_chroma_w = 1,
1079 .log2_chroma_h = 1,
1080 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1081 },
1082 [AV_PIX_FMT_VAAPI_VLD] = {
1083 .name = "vaapi_vld",
1084 .log2_chroma_w = 1,
1085 .log2_chroma_h = 1,
1086 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1087 },
1088 #else
1089 [AV_PIX_FMT_VAAPI] = {
1090 .name = "vaapi",
1091 .log2_chroma_w = 1,
1092 .log2_chroma_h = 1,
1093 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1094 },
1095 #endif
1096 [AV_PIX_FMT_VDA_VLD] = {
1097 .name = "vda_vld",
1098 .log2_chroma_w = 1,
1099 .log2_chroma_h = 1,
1100 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1101 },
1102 [AV_PIX_FMT_YUV420P9LE] = {
1103 .name = "yuv420p9le",
1104 .nb_components = 3,
1105 .log2_chroma_w = 1,
1106 .log2_chroma_h = 1,
1107 .comp = {
1108 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1109 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1110 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1111 },
1112 .flags = AV_PIX_FMT_FLAG_PLANAR,
1113 },
1114 [AV_PIX_FMT_YUV420P9BE] = {
1115 .name = "yuv420p9be",
1116 .nb_components = 3,
1117 .log2_chroma_w = 1,
1118 .log2_chroma_h = 1,
1119 .comp = {
1120 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1121 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1122 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1123 },
1124 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1125 },
1126 [AV_PIX_FMT_YUV420P10LE] = {
1127 .name = "yuv420p10le",
1128 .nb_components = 3,
1129 .log2_chroma_w = 1,
1130 .log2_chroma_h = 1,
1131 .comp = {
1132 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1133 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1134 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1135 },
1136 .flags = AV_PIX_FMT_FLAG_PLANAR,
1137 },
1138 [AV_PIX_FMT_YUV420P10BE] = {
1139 .name = "yuv420p10be",
1140 .nb_components = 3,
1141 .log2_chroma_w = 1,
1142 .log2_chroma_h = 1,
1143 .comp = {
1144 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1145 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1146 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1147 },
1148 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1149 },
1150 [AV_PIX_FMT_YUV420P12LE] = {
1151 .name = "yuv420p12le",
1152 .nb_components = 3,
1153 .log2_chroma_w = 1,
1154 .log2_chroma_h = 1,
1155 .comp = {
1156 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1157 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1158 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1159 },
1160 .flags = AV_PIX_FMT_FLAG_PLANAR,
1161 },
1162 [AV_PIX_FMT_YUV420P12BE] = {
1163 .name = "yuv420p12be",
1164 .nb_components = 3,
1165 .log2_chroma_w = 1,
1166 .log2_chroma_h = 1,
1167 .comp = {
1168 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1169 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1170 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1171 },
1172 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1173 },
1174 [AV_PIX_FMT_YUV420P16LE] = {
1175 .name = "yuv420p16le",
1176 .nb_components = 3,
1177 .log2_chroma_w = 1,
1178 .log2_chroma_h = 1,
1179 .comp = {
1180 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1181 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1182 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1183 },
1184 .flags = AV_PIX_FMT_FLAG_PLANAR,
1185 },
1186 [AV_PIX_FMT_YUV420P16BE] = {
1187 .name = "yuv420p16be",
1188 .nb_components = 3,
1189 .log2_chroma_w = 1,
1190 .log2_chroma_h = 1,
1191 .comp = {
1192 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1193 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1194 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1195 },
1196 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1197 },
1198 [AV_PIX_FMT_YUV422P9LE] = {
1199 .name = "yuv422p9le",
1200 .nb_components = 3,
1201 .log2_chroma_w = 1,
1202 .log2_chroma_h = 0,
1203 .comp = {
1204 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1205 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1206 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1207 },
1208 .flags = AV_PIX_FMT_FLAG_PLANAR,
1209 },
1210 [AV_PIX_FMT_YUV422P9BE] = {
1211 .name = "yuv422p9be",
1212 .nb_components = 3,
1213 .log2_chroma_w = 1,
1214 .log2_chroma_h = 0,
1215 .comp = {
1216 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1217 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1218 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1219 },
1220 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1221 },
1222 [AV_PIX_FMT_YUV422P10LE] = {
1223 .name = "yuv422p10le",
1224 .nb_components = 3,
1225 .log2_chroma_w = 1,
1226 .log2_chroma_h = 0,
1227 .comp = {
1228 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1229 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1230 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1231 },
1232 .flags = AV_PIX_FMT_FLAG_PLANAR,
1233 },
1234 [AV_PIX_FMT_YUV422P10BE] = {
1235 .name = "yuv422p10be",
1236 .nb_components = 3,
1237 .log2_chroma_w = 1,
1238 .log2_chroma_h = 0,
1239 .comp = {
1240 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1241 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1242 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1243 },
1244 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1245 },
1246 [AV_PIX_FMT_YUV422P12LE] = {
1247 .name = "yuv422p12le",
1248 .nb_components = 3,
1249 .log2_chroma_w = 1,
1250 .log2_chroma_h = 0,
1251 .comp = {
1252 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1253 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1254 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1255 },
1256 .flags = AV_PIX_FMT_FLAG_PLANAR,
1257 },
1258 [AV_PIX_FMT_YUV422P12BE] = {
1259 .name = "yuv422p12be",
1260 .nb_components = 3,
1261 .log2_chroma_w = 1,
1262 .log2_chroma_h = 0,
1263 .comp = {
1264 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1265 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1266 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1267 },
1268 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1269 },
1270 [AV_PIX_FMT_YUV422P16LE] = {
1271 .name = "yuv422p16le",
1272 .nb_components = 3,
1273 .log2_chroma_w = 1,
1274 .log2_chroma_h = 0,
1275 .comp = {
1276 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1277 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1278 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1279 },
1280 .flags = AV_PIX_FMT_FLAG_PLANAR,
1281 },
1282 [AV_PIX_FMT_YUV422P16BE] = {
1283 .name = "yuv422p16be",
1284 .nb_components = 3,
1285 .log2_chroma_w = 1,
1286 .log2_chroma_h = 0,
1287 .comp = {
1288 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1289 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1290 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1291 },
1292 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1293 },
1294 [AV_PIX_FMT_YUV444P16LE] = {
1295 .name = "yuv444p16le",
1296 .nb_components = 3,
1297 .log2_chroma_w = 0,
1298 .log2_chroma_h = 0,
1299 .comp = {
1300 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1301 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1302 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1303 },
1304 .flags = AV_PIX_FMT_FLAG_PLANAR,
1305 },
1306 [AV_PIX_FMT_YUV444P16BE] = {
1307 .name = "yuv444p16be",
1308 .nb_components = 3,
1309 .log2_chroma_w = 0,
1310 .log2_chroma_h = 0,
1311 .comp = {
1312 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1313 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1314 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1315 },
1316 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1317 },
1318 [AV_PIX_FMT_YUV444P12LE] = {
1319 .name = "yuv444p12le",
1320 .nb_components = 3,
1321 .log2_chroma_w = 0,
1322 .log2_chroma_h = 0,
1323 .comp = {
1324 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1325 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1326 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1327 },
1328 .flags = AV_PIX_FMT_FLAG_PLANAR,
1329 },
1330 [AV_PIX_FMT_YUV444P12BE] = {
1331 .name = "yuv444p12be",
1332 .nb_components = 3,
1333 .log2_chroma_w = 0,
1334 .log2_chroma_h = 0,
1335 .comp = {
1336 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1337 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1338 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1339 },
1340 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1341 },
1342 [AV_PIX_FMT_YUV444P10LE] = {
1343 .name = "yuv444p10le",
1344 .nb_components = 3,
1345 .log2_chroma_w = 0,
1346 .log2_chroma_h = 0,
1347 .comp = {
1348 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1349 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1350 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1351 },
1352 .flags = AV_PIX_FMT_FLAG_PLANAR,
1353 },
1354 [AV_PIX_FMT_YUV444P10BE] = {
1355 .name = "yuv444p10be",
1356 .nb_components = 3,
1357 .log2_chroma_w = 0,
1358 .log2_chroma_h = 0,
1359 .comp = {
1360 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1361 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1362 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1363 },
1364 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1365 },
1366 [AV_PIX_FMT_YUV444P9LE] = {
1367 .name = "yuv444p9le",
1368 .nb_components = 3,
1369 .log2_chroma_w = 0,
1370 .log2_chroma_h = 0,
1371 .comp = {
1372 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1373 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1374 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1375 },
1376 .flags = AV_PIX_FMT_FLAG_PLANAR,
1377 },
1378 [AV_PIX_FMT_YUV444P9BE] = {
1379 .name = "yuv444p9be",
1380 .nb_components = 3,
1381 .log2_chroma_w = 0,
1382 .log2_chroma_h = 0,
1383 .comp = {
1384 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1385 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1386 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1387 },
1388 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1389 },
1390 [AV_PIX_FMT_D3D11VA_VLD] = {
1391 .name = "d3d11va_vld",
1392 .log2_chroma_w = 1,
1393 .log2_chroma_h = 1,
1394 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1395 },
1396 [AV_PIX_FMT_DXVA2_VLD] = {
1397 .name = "dxva2_vld",
1398 .log2_chroma_w = 1,
1399 .log2_chroma_h = 1,
1400 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1401 },
1402 [AV_PIX_FMT_YA8] = {
1403 .name = "ya8",
1404 .nb_components = 2,
1405 .comp = {
1406 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
1407 { 0, 2, 1, 0, 8, 1, 7, 2 }, /* A */
1408 },
1409 .flags = AV_PIX_FMT_FLAG_ALPHA,
1410 .alias = "gray8a",
1411 },
1412 [AV_PIX_FMT_YA16LE] = {
1413 .name = "ya16le",
1414 .nb_components = 2,
1415 .comp = {
1416 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1417 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1418 },
1419 .flags = AV_PIX_FMT_FLAG_ALPHA,
1420 },
1421 [AV_PIX_FMT_YA16BE] = {
1422 .name = "ya16be",
1423 .nb_components = 2,
1424 .comp = {
1425 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1426 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1427 },
1428 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
1429 },
1430 [AV_PIX_FMT_GBRP] = {
1431 .name = "gbrp",
1432 .nb_components = 3,
1433 .log2_chroma_w = 0,
1434 .log2_chroma_h = 0,
1435 .comp = {
1436 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1437 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1438 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1439 },
1440 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1441 },
1442 [AV_PIX_FMT_GBRP9LE] = {
1443 .name = "gbrp9le",
1444 .nb_components = 3,
1445 .log2_chroma_w = 0,
1446 .log2_chroma_h = 0,
1447 .comp = {
1448 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1449 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1450 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1451 },
1452 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1453 },
1454 [AV_PIX_FMT_GBRP9BE] = {
1455 .name = "gbrp9be",
1456 .nb_components = 3,
1457 .log2_chroma_w = 0,
1458 .log2_chroma_h = 0,
1459 .comp = {
1460 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1461 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1462 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1463 },
1464 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1465 },
1466 [AV_PIX_FMT_GBRP10LE] = {
1467 .name = "gbrp10le",
1468 .nb_components = 3,
1469 .log2_chroma_w = 0,
1470 .log2_chroma_h = 0,
1471 .comp = {
1472 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1473 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1474 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1475 },
1476 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1477 },
1478 [AV_PIX_FMT_GBRP10BE] = {
1479 .name = "gbrp10be",
1480 .nb_components = 3,
1481 .log2_chroma_w = 0,
1482 .log2_chroma_h = 0,
1483 .comp = {
1484 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1485 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1486 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1487 },
1488 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1489 },
1490 [AV_PIX_FMT_GBRP12LE] = {
1491 .name = "gbrp12le",
1492 .nb_components = 3,
1493 .log2_chroma_w = 0,
1494 .log2_chroma_h = 0,
1495 .comp = {
1496 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1497 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1498 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1499 },
1500 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1501 },
1502 [AV_PIX_FMT_GBRP12BE] = {
1503 .name = "gbrp12be",
1504 .nb_components = 3,
1505 .log2_chroma_w = 0,
1506 .log2_chroma_h = 0,
1507 .comp = {
1508 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1509 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1510 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1511 },
1512 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1513 },
1514 [AV_PIX_FMT_GBRP16LE] = {
1515 .name = "gbrp16le",
1516 .nb_components = 3,
1517 .log2_chroma_w = 0,
1518 .log2_chroma_h = 0,
1519 .comp = {
1520 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1521 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1522 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1523 },
1524 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1525 },
1526 [AV_PIX_FMT_GBRP16BE] = {
1527 .name = "gbrp16be",
1528 .nb_components = 3,
1529 .log2_chroma_w = 0,
1530 .log2_chroma_h = 0,
1531 .comp = {
1532 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1533 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1534 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1535 },
1536 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1537 },
1538 [AV_PIX_FMT_GBRAP] = {
1539 .name = "gbrap",
1540 .nb_components = 4,
1541 .log2_chroma_w = 0,
1542 .log2_chroma_h = 0,
1543 .comp = {
1544 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1545 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1546 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1547 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
1548 },
1549 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1550 AV_PIX_FMT_FLAG_ALPHA,
1551 },
1552 [AV_PIX_FMT_GBRAP16LE] = {
1553 .name = "gbrap16le",
1554 .nb_components = 4,
1555 .log2_chroma_w = 0,
1556 .log2_chroma_h = 0,
1557 .comp = {
1558 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1559 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1560 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1561 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1562 },
1563 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1564 AV_PIX_FMT_FLAG_ALPHA,
1565 },
1566 [AV_PIX_FMT_GBRAP16BE] = {
1567 .name = "gbrap16be",
1568 .nb_components = 4,
1569 .log2_chroma_w = 0,
1570 .log2_chroma_h = 0,
1571 .comp = {
1572 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1573 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1574 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1575 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1576 },
1577 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
1578 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1579 },
1580 [AV_PIX_FMT_VDPAU] = {
1581 .name = "vdpau",
1582 .log2_chroma_w = 1,
1583 .log2_chroma_h = 1,
1584 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1585 },
1586 [AV_PIX_FMT_XYZ12LE] = {
1587 .name = "xyz12le",
1588 .nb_components = 3,
1589 .log2_chroma_w = 0,
1590 .log2_chroma_h = 0,
1591 .comp = {
1592 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1593 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1594 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1595 },
1596 /*.flags = -- not used*/
1597 },
1598 [AV_PIX_FMT_XYZ12BE] = {
1599 .name = "xyz12be",
1600 .nb_components = 3,
1601 .log2_chroma_w = 0,
1602 .log2_chroma_h = 0,
1603 .comp = {
1604 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1605 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1606 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1607 },
1608 .flags = AV_PIX_FMT_FLAG_BE,
1609 },
1610 [AV_PIX_FMT_NV16] = {
1611 .name = "nv16",
1612 .nb_components = 3,
1613 .log2_chroma_w = 1,
1614 .log2_chroma_h = 0,
1615 .comp = {
1616 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
1617 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
1618 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
1619 },
1620 .flags = AV_PIX_FMT_FLAG_PLANAR,
1621 },
1622 [AV_PIX_FMT_NV20LE] = {
1623 .name = "nv20le",
1624 .nb_components = 3,
1625 .log2_chroma_w = 1,
1626 .log2_chroma_h = 0,
1627 .comp = {
1628 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1629 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
1630 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
1631 },
1632 .flags = AV_PIX_FMT_FLAG_PLANAR,
1633 },
1634 [AV_PIX_FMT_NV20BE] = {
1635 .name = "nv20be",
1636 .nb_components = 3,
1637 .log2_chroma_w = 1,
1638 .log2_chroma_h = 0,
1639 .comp = {
1640 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1641 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
1642 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
1643 },
1644 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
1645 },
1646 [AV_PIX_FMT_VDA] = {
1647 .name = "vda",
1648 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1649 },
1650 [AV_PIX_FMT_QSV] = {
1651 .name = "qsv",
1652 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1653 },
1654 [AV_PIX_FMT_MMAL] = {
1655 .name = "mmal",
1656 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1657 },
1658 [AV_PIX_FMT_CUDA] = {
1659 .name = "cuda",
1660 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1661 },
1662 [AV_PIX_FMT_P010LE] = {
1663 .name = "p010le",
1664 .nb_components = 3,
1665 .log2_chroma_w = 1,
1666 .log2_chroma_h = 1,
1667 .comp = {
1668 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
1669 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
1670 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
1671 },
1672 .flags = AV_PIX_FMT_FLAG_PLANAR,
1673 },
1674 [AV_PIX_FMT_P010BE] = {
1675 .name = "p010be",
1676 .nb_components = 3,
1677 .log2_chroma_w = 1,
1678 .log2_chroma_h = 1,
1679 .comp = {
1680 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
1681 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
1682 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
1683 },
1684 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
1685 },
1686 [AV_PIX_FMT_GBRAP10LE] = {
1687 .name = "gbrap10le",
1688 .nb_components = 4,
1689 .log2_chroma_w = 0,
1690 .log2_chroma_h = 0,
1691 .comp = {
1692 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1693 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1694 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1695 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
1696 },
1697 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1698 AV_PIX_FMT_FLAG_ALPHA,
1699 },
1700 [AV_PIX_FMT_GBRAP10BE] = {
1701 .name = "gbrap10be",
1702 .nb_components = 4,
1703 .log2_chroma_w = 0,
1704 .log2_chroma_h = 0,
1705 .comp = {
1706 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1707 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1708 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1709 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
1710 },
1711 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
1712 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1713 },
1714 [AV_PIX_FMT_GBRAP12LE] = {
1715 .name = "gbrap12le",
1716 .nb_components = 4,
1717 .log2_chroma_w = 0,
1718 .log2_chroma_h = 0,
1719 .comp = {
1720 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1721 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1722 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1723 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
1724 },
1725 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1726 AV_PIX_FMT_FLAG_ALPHA,
1727 },
1728 [AV_PIX_FMT_GBRAP12BE] = {
1729 .name = "gbrap12be",
1730 .nb_components = 4,
1731 .log2_chroma_w = 0,
1732 .log2_chroma_h = 0,
1733 .comp = {
1734 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1735 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1736 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1737 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
1738 },
1739 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
1740 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1741 },
1742 };
1743 #if FF_API_PLUS1_MINUS1
1744 FF_ENABLE_DEPRECATION_WARNINGS
1745 #endif
1746
1747 static const char * const color_range_names[] = {
1748 [AVCOL_RANGE_UNSPECIFIED] = "unknown",
1749 [AVCOL_RANGE_MPEG] = "tv",
1750 [AVCOL_RANGE_JPEG] = "pc",
1751 };
1752
1753 static const char * const color_primaries_names[] = {
1754 [AVCOL_PRI_RESERVED0] = "reserved",
1755 [AVCOL_PRI_BT709] = "bt709",
1756 [AVCOL_PRI_UNSPECIFIED] = "unknown",
1757 [AVCOL_PRI_RESERVED] = "reserved",
1758 [AVCOL_PRI_BT470M] = "bt470m",
1759 [AVCOL_PRI_BT470BG] = "bt470bg",
1760 [AVCOL_PRI_SMPTE170M] = "smpte170m",
1761 [AVCOL_PRI_SMPTE240M] = "smpte240m",
1762 [AVCOL_PRI_FILM] = "film",
1763 [AVCOL_PRI_BT2020] = "bt2020",
1764 [AVCOL_PRI_SMPTE428] = "smpte428",
1765 [AVCOL_PRI_SMPTE431] = "smpte431",
1766 [AVCOL_PRI_SMPTE432] = "smpte432",
1767 [AVCOL_PRI_JEDEC_P22] = "jedec-p22",
1768 };
1769
1770 static const char * const color_transfer_names[] = {
1771 [AVCOL_TRC_RESERVED0] = "reserved",
1772 [AVCOL_TRC_BT709] = "bt709",
1773 [AVCOL_TRC_UNSPECIFIED] = "unknown",
1774 [AVCOL_TRC_RESERVED] = "reserved",
1775 [AVCOL_TRC_GAMMA22] = "bt470m",
1776 [AVCOL_TRC_GAMMA28] = "bt470bg",
1777 [AVCOL_TRC_SMPTE170M] = "smpte170m",
1778 [AVCOL_TRC_SMPTE240M] = "smpte240m",
1779 [AVCOL_TRC_LINEAR] = "linear",
1780 [AVCOL_TRC_LOG] = "log100",
1781 [AVCOL_TRC_LOG_SQRT] = "log316",
1782 [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
1783 [AVCOL_TRC_BT1361_ECG] = "bt1361e",
1784 [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
1785 [AVCOL_TRC_BT2020_10] = "bt2020-10",
1786 [AVCOL_TRC_BT2020_12] = "bt2020-12",
1787 [AVCOL_TRC_SMPTE2084] = "smpte2084",
1788 [AVCOL_TRC_SMPTE428] = "smpte428",
1789 [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
1790 };
1791
1792 static const char * const color_space_names[] = {
1793 [AVCOL_SPC_RGB] = "gbr",
1794 [AVCOL_SPC_BT709] = "bt709",
1795 [AVCOL_SPC_UNSPECIFIED] = "unknown",
1796 [AVCOL_SPC_RESERVED] = "reserved",
1797 [AVCOL_SPC_FCC] = "fcc",
1798 [AVCOL_SPC_BT470BG] = "bt470bg",
1799 [AVCOL_SPC_SMPTE170M] = "smpte170m",
1800 [AVCOL_SPC_SMPTE240M] = "smpte240m",
1801 [AVCOL_SPC_YCGCO] = "ycgco",
1802 [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
1803 [AVCOL_SPC_BT2020_CL] = "bt2020c",
1804 [AVCOL_SPC_SMPTE2085] = "smpte2085",
1805 };
1806
1807 static const char * const chroma_location_names[] = {
1808 [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
1809 [AVCHROMA_LOC_LEFT] = "left",
1810 [AVCHROMA_LOC_CENTER] = "center",
1811 [AVCHROMA_LOC_TOPLEFT] = "topleft",
1812 [AVCHROMA_LOC_TOP] = "top",
1813 [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
1814 [AVCHROMA_LOC_BOTTOM] = "bottom",
1815 };
1816
1817 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
1818 {
1819 enum AVPixelFormat pix_fmt;
1820
1821 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
1822 if (av_pix_fmt_descriptors[pix_fmt].name &&
1823 (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
1824 av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
1825 return pix_fmt;
1826
1827 return AV_PIX_FMT_NONE;
1828 }
1829
1830 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
1831 {
1832 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
1833 av_pix_fmt_descriptors[pix_fmt].name : NULL;
1834 }
1835
1836 #if HAVE_BIGENDIAN
1837 # define X_NE(be, le) be
1838 #else
1839 # define X_NE(be, le) le
1840 #endif
1841
1842 enum AVPixelFormat av_get_pix_fmt(const char *name)
1843 {
1844 enum AVPixelFormat pix_fmt;
1845
1846 if (!strcmp(name, "rgb32"))
1847 name = X_NE("argb", "bgra");
1848 else if (!strcmp(name, "bgr32"))
1849 name = X_NE("abgr", "rgba");
1850
1851 pix_fmt = get_pix_fmt_internal(name);
1852 if (pix_fmt == AV_PIX_FMT_NONE) {
1853 char name2[32];
1854
1855 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
1856 pix_fmt = get_pix_fmt_internal(name2);
1857 }
1858
1859 #if FF_API_VAAPI
1860 if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
1861 pix_fmt = AV_PIX_FMT_VAAPI;
1862 #endif
1863 return pix_fmt;
1864 }
1865
1866 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
1867 {
1868 int c, bits = 0;
1869 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
1870
1871 for (c = 0; c < pixdesc->nb_components; c++) {
1872 int s = c == 1 || c == 2 ? 0 : log2_pixels;
1873 bits += pixdesc->comp[c].depth << s;
1874 }
1875
1876 return bits >> log2_pixels;
1877 }
1878
1879 char *av_get_pix_fmt_string(char *buf, int buf_size,
1880 enum AVPixelFormat pix_fmt)
1881 {
1882 /* print header */
1883 if (pix_fmt < 0) {
1884 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
1885 } else {
1886 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
1887 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
1888 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
1889 }
1890
1891 return buf;
1892 }
1893
1894 const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1895 {
1896 if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1897 return NULL;
1898 return &av_pix_fmt_descriptors[pix_fmt];
1899 }
1900
1901 const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
1902 {
1903 if (!prev)
1904 return &av_pix_fmt_descriptors[0];
1905 if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1)
1906 return prev + 1;
1907 return NULL;
1908 }
1909
1910 enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
1911 {
1912 if (desc < av_pix_fmt_descriptors ||
1913 desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
1914 return AV_PIX_FMT_NONE;
1915
1916 return desc - av_pix_fmt_descriptors;
1917 }
1918
1919 int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
1920 int *h_shift, int *v_shift)
1921 {
1922 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
1923 if (!desc)
1924 return AVERROR(ENOSYS);
1925 *h_shift = desc->log2_chroma_w;
1926 *v_shift = desc->log2_chroma_h;
1927
1928 return 0;
1929 }
1930
1931 int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
1932 {
1933 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
1934 int i, planes[4] = { 0 }, ret = 0;
1935
1936 if (!desc)
1937 return AVERROR(EINVAL);
1938
1939 for (i = 0; i < desc->nb_components; i++)
1940 planes[desc->comp[i].plane] = 1;
1941 for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
1942 ret += planes[i];
1943 return ret;
1944 }
1945
1946
1947 enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
1948 {
1949 #define PIX_FMT_SWAP_ENDIANNESS(fmt) \
1950 case AV_PIX_FMT_ ## fmt ## BE: return AV_PIX_FMT_ ## fmt ## LE; \
1951 case AV_PIX_FMT_ ## fmt ## LE: return AV_PIX_FMT_ ## fmt ## BE
1952
1953 switch (pix_fmt) {
1954 PIX_FMT_SWAP_ENDIANNESS(GRAY12);
1955 PIX_FMT_SWAP_ENDIANNESS(GRAY16);
1956 PIX_FMT_SWAP_ENDIANNESS(YA16);
1957 PIX_FMT_SWAP_ENDIANNESS(RGB48);
1958 PIX_FMT_SWAP_ENDIANNESS(RGB565);
1959 PIX_FMT_SWAP_ENDIANNESS(RGB555);
1960 PIX_FMT_SWAP_ENDIANNESS(RGB444);
1961 PIX_FMT_SWAP_ENDIANNESS(BGR48);
1962 PIX_FMT_SWAP_ENDIANNESS(BGR565);
1963 PIX_FMT_SWAP_ENDIANNESS(BGR555);
1964 PIX_FMT_SWAP_ENDIANNESS(BGR444);
1965
1966 PIX_FMT_SWAP_ENDIANNESS(YUV420P9);
1967 PIX_FMT_SWAP_ENDIANNESS(YUV422P9);
1968 PIX_FMT_SWAP_ENDIANNESS(YUV444P9);
1969 PIX_FMT_SWAP_ENDIANNESS(YUV420P10);
1970 PIX_FMT_SWAP_ENDIANNESS(YUV422P10);
1971 PIX_FMT_SWAP_ENDIANNESS(YUV444P10);
1972 PIX_FMT_SWAP_ENDIANNESS(YUV420P12);
1973 PIX_FMT_SWAP_ENDIANNESS(YUV422P12);
1974 PIX_FMT_SWAP_ENDIANNESS(YUV444P12);
1975 PIX_FMT_SWAP_ENDIANNESS(YUV420P16);
1976 PIX_FMT_SWAP_ENDIANNESS(YUV422P16);
1977 PIX_FMT_SWAP_ENDIANNESS(YUV444P16);
1978
1979 PIX_FMT_SWAP_ENDIANNESS(GBRP9);
1980 PIX_FMT_SWAP_ENDIANNESS(GBRP10);
1981 PIX_FMT_SWAP_ENDIANNESS(GBRP12);
1982 PIX_FMT_SWAP_ENDIANNESS(GBRP16);
1983 PIX_FMT_SWAP_ENDIANNESS(YUVA420P9);
1984 PIX_FMT_SWAP_ENDIANNESS(YUVA422P9);
1985 PIX_FMT_SWAP_ENDIANNESS(YUVA444P9);
1986 PIX_FMT_SWAP_ENDIANNESS(YUVA420P10);
1987 PIX_FMT_SWAP_ENDIANNESS(YUVA422P10);
1988 PIX_FMT_SWAP_ENDIANNESS(YUVA444P10);
1989 PIX_FMT_SWAP_ENDIANNESS(YUVA420P16);
1990 PIX_FMT_SWAP_ENDIANNESS(YUVA422P16);
1991 PIX_FMT_SWAP_ENDIANNESS(YUVA444P16);
1992
1993 PIX_FMT_SWAP_ENDIANNESS(XYZ12);
1994 PIX_FMT_SWAP_ENDIANNESS(NV20);
1995 PIX_FMT_SWAP_ENDIANNESS(RGBA64);
1996 PIX_FMT_SWAP_ENDIANNESS(BGRA64);
1997 default:
1998 return AV_PIX_FMT_NONE;
1999 }
2000 #undef PIX_FMT_SWAP_ENDIANNESS
2001 }
2002
2003 const char *av_color_range_name(enum AVColorRange range)
2004 {
2005 return (unsigned) range < AVCOL_RANGE_NB ?
2006 color_range_names[range] : NULL;
2007 }
2008
2009 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
2010 {
2011 return (unsigned) primaries < AVCOL_PRI_NB ?
2012 color_primaries_names[primaries] : NULL;
2013 }
2014
2015 const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
2016 {
2017 return (unsigned) transfer < AVCOL_TRC_NB ?
2018 color_transfer_names[transfer] : NULL;
2019 }
2020
2021 const char *av_color_space_name(enum AVColorSpace space)
2022 {
2023 return (unsigned) space < AVCOL_SPC_NB ?
2024 color_space_names[space] : NULL;
2025 }
2026
2027 const char *av_chroma_location_name(enum AVChromaLocation location)
2028 {
2029 return (unsigned) location < AVCHROMA_LOC_NB ?
2030 chroma_location_names[location] : NULL;
2031 }
2032