1 /*
2 * pixel format descriptor
3 * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg 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 * FFmpeg 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 FFmpeg; 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 "avassert.h"
26 #include "avstring.h"
27 #include "common.h"
28 #include "pixfmt.h"
29 #include "pixdesc.h"
30 #include "internal.h"
31 #include "intreadwrite.h"
32 #include "version.h"
33
av_read_image_line2(void * dst,const uint8_t * data[4],const int linesize[4],const AVPixFmtDescriptor * desc,int x,int y,int c,int w,int read_pal_component,int dst_element_size)34 void av_read_image_line2(void *dst,
35 const uint8_t *data[4], const int linesize[4],
36 const AVPixFmtDescriptor *desc,
37 int x, int y, int c, int w,
38 int read_pal_component,
39 int dst_element_size)
40 {
41 AVComponentDescriptor comp = desc->comp[c];
42 int plane = comp.plane;
43 int depth = comp.depth;
44 unsigned mask = (1ULL << depth) - 1;
45 int shift = comp.shift;
46 int step = comp.step;
47 int flags = desc->flags;
48 uint16_t *dst16 = dst;
49 uint32_t *dst32 = dst;
50
51 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
52 int skip = x * step + comp.offset;
53 const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
54 int shift = 8 - depth - (skip & 7);
55
56 while (w--) {
57 int val = (*p >> shift) & mask;
58 if (read_pal_component)
59 val = data[1][4*val + c];
60 shift -= step;
61 p -= shift >> 3;
62 shift &= 7;
63 if (dst_element_size == 4) *dst32++ = val;
64 else *dst16++ = val;
65 }
66 } else {
67 const uint8_t *p = data[plane] + y * linesize[plane] +
68 x * step + comp.offset;
69 int is_8bit = shift + depth <= 8;
70 int is_16bit= shift + depth <=16;
71
72 if (is_8bit)
73 p += !!(flags & AV_PIX_FMT_FLAG_BE);
74
75 while (w--) {
76 unsigned val;
77 if (is_8bit) val = *p;
78 else if(is_16bit) val = flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p);
79 else val = flags & AV_PIX_FMT_FLAG_BE ? AV_RB32(p) : AV_RL32(p);
80 val = (val >> shift) & mask;
81 if (read_pal_component)
82 val = data[1][4 * val + c];
83 p += step;
84 if (dst_element_size == 4) *dst32++ = val;
85 else *dst16++ = val;
86 }
87 }
88 }
89
av_read_image_line(uint16_t * dst,const uint8_t * data[4],const int linesize[4],const AVPixFmtDescriptor * desc,int x,int y,int c,int w,int read_pal_component)90 void av_read_image_line(uint16_t *dst,
91 const uint8_t *data[4], const int linesize[4],
92 const AVPixFmtDescriptor *desc,
93 int x, int y, int c, int w,
94 int read_pal_component)
95 {
96 av_read_image_line2(dst, data, linesize, desc,x, y, c, w,
97 read_pal_component,
98 2);
99 }
100
av_write_image_line2(const void * src,uint8_t * data[4],const int linesize[4],const AVPixFmtDescriptor * desc,int x,int y,int c,int w,int src_element_size)101 void av_write_image_line2(const void *src,
102 uint8_t *data[4], const int linesize[4],
103 const AVPixFmtDescriptor *desc,
104 int x, int y, int c, int w, int src_element_size)
105 {
106 AVComponentDescriptor comp = desc->comp[c];
107 int plane = comp.plane;
108 int depth = comp.depth;
109 int step = comp.step;
110 int flags = desc->flags;
111 const uint32_t *src32 = src;
112 const uint16_t *src16 = src;
113
114 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
115 int skip = x * step + comp.offset;
116 uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
117 int shift = 8 - depth - (skip & 7);
118
119 while (w--) {
120 *p |= (src_element_size == 4 ? *src32++ : *src16++) << shift;
121 shift -= step;
122 p -= shift >> 3;
123 shift &= 7;
124 }
125 } else {
126 int shift = comp.shift;
127 uint8_t *p = data[plane] + y * linesize[plane] +
128 x * step + comp.offset;
129
130 if (shift + depth <= 8) {
131 p += !!(flags & AV_PIX_FMT_FLAG_BE);
132 while (w--) {
133 *p |= ((src_element_size == 4 ? *src32++ : *src16++) << shift);
134 p += step;
135 }
136 } else {
137 while (w--) {
138 unsigned s = (src_element_size == 4 ? *src32++ : *src16++);
139 if (shift + depth <= 16) {
140 if (flags & AV_PIX_FMT_FLAG_BE) {
141 uint16_t val = AV_RB16(p) | (s << shift);
142 AV_WB16(p, val);
143 } else {
144 uint16_t val = AV_RL16(p) | (s << shift);
145 AV_WL16(p, val);
146 }
147 } else {
148 if (flags & AV_PIX_FMT_FLAG_BE) {
149 uint32_t val = AV_RB32(p) | (s << shift);
150 AV_WB32(p, val);
151 } else {
152 uint32_t val = AV_RL32(p) | (s << shift);
153 AV_WL32(p, val);
154 }
155 }
156 p += step;
157 }
158 }
159 }
160 }
161
av_write_image_line(const uint16_t * src,uint8_t * data[4],const int linesize[4],const AVPixFmtDescriptor * desc,int x,int y,int c,int w)162 void av_write_image_line(const uint16_t *src,
163 uint8_t *data[4], const int linesize[4],
164 const AVPixFmtDescriptor *desc,
165 int x, int y, int c, int w)
166 {
167 av_write_image_line2(src, data, linesize, desc, x, y, c, w, 2);
168 }
169
170 #if FF_API_PLUS1_MINUS1
171 FF_DISABLE_DEPRECATION_WARNINGS
172 #endif
173 static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
174 [AV_PIX_FMT_YUV420P] = {
175 .name = "yuv420p",
176 .nb_components = 3,
177 .log2_chroma_w = 1,
178 .log2_chroma_h = 1,
179 .comp = {
180 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
181 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
182 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
183 },
184 .flags = AV_PIX_FMT_FLAG_PLANAR,
185 },
186 [AV_PIX_FMT_YUYV422] = {
187 .name = "yuyv422",
188 .nb_components = 3,
189 .log2_chroma_w = 1,
190 .log2_chroma_h = 0,
191 .comp = {
192 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
193 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* U */
194 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* V */
195 },
196 },
197 [AV_PIX_FMT_YVYU422] = {
198 .name = "yvyu422",
199 .nb_components = 3,
200 .log2_chroma_w = 1,
201 .log2_chroma_h = 0,
202 .comp = {
203 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
204 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* U */
205 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* V */
206 },
207 },
208 [AV_PIX_FMT_Y210LE] = {
209 .name = "y210le",
210 .nb_components = 3,
211 .log2_chroma_w = 1,
212 .log2_chroma_h = 0,
213 .comp = {
214 { 0, 4, 0, 6, 10, 3, 9, 1 }, /* Y */
215 { 0, 8, 2, 6, 10, 7, 9, 3 }, /* U */
216 { 0, 8, 6, 6, 10, 7, 9, 7 }, /* V */
217 },
218 },
219 [AV_PIX_FMT_Y210BE] = {
220 .name = "y210be",
221 .nb_components = 3,
222 .log2_chroma_w = 1,
223 .log2_chroma_h = 0,
224 .comp = {
225 { 0, 4, 0, 6, 10, 3, 9, 1 }, /* Y */
226 { 0, 8, 2, 6, 10, 7, 9, 3 }, /* U */
227 { 0, 8, 6, 6, 10, 7, 9, 7 }, /* V */
228 },
229 .flags = AV_PIX_FMT_FLAG_BE,
230 },
231 [AV_PIX_FMT_RGB24] = {
232 .name = "rgb24",
233 .nb_components = 3,
234 .log2_chroma_w = 0,
235 .log2_chroma_h = 0,
236 .comp = {
237 { 0, 3, 0, 0, 8, 2, 7, 1 }, /* R */
238 { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
239 { 0, 3, 2, 0, 8, 2, 7, 3 }, /* B */
240 },
241 .flags = AV_PIX_FMT_FLAG_RGB,
242 },
243 [AV_PIX_FMT_BGR24] = {
244 .name = "bgr24",
245 .nb_components = 3,
246 .log2_chroma_w = 0,
247 .log2_chroma_h = 0,
248 .comp = {
249 { 0, 3, 2, 0, 8, 2, 7, 3 }, /* R */
250 { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
251 { 0, 3, 0, 0, 8, 2, 7, 1 }, /* B */
252 },
253 .flags = AV_PIX_FMT_FLAG_RGB,
254 },
255 [AV_PIX_FMT_X2RGB10LE] = {
256 .name = "x2rgb10le",
257 .nb_components= 3,
258 .log2_chroma_w= 0,
259 .log2_chroma_h= 0,
260 .comp = {
261 { 0, 4, 2, 4, 10, 3, 9, 2 }, /* R */
262 { 0, 4, 1, 2, 10, 3, 9, 3 }, /* G */
263 { 0, 4, 0, 0, 10, 3, 9, 4 }, /* B */
264 },
265 .flags = AV_PIX_FMT_FLAG_RGB,
266 },
267 [AV_PIX_FMT_X2RGB10BE] = {
268 .name = "x2rgb10be",
269 .nb_components= 3,
270 .log2_chroma_w= 0,
271 .log2_chroma_h= 0,
272 .comp = {
273 { 0, 4, 0, 4, 10, 3, 9, 2 }, /* R */
274 { 0, 4, 1, 2, 10, 3, 9, 3 }, /* G */
275 { 0, 4, 2, 0, 10, 3, 9, 4 }, /* B */
276 },
277 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
278 },
279 [AV_PIX_FMT_YUV422P] = {
280 .name = "yuv422p",
281 .nb_components = 3,
282 .log2_chroma_w = 1,
283 .log2_chroma_h = 0,
284 .comp = {
285 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
286 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
287 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
288 },
289 .flags = AV_PIX_FMT_FLAG_PLANAR,
290 },
291 [AV_PIX_FMT_YUV444P] = {
292 .name = "yuv444p",
293 .nb_components = 3,
294 .log2_chroma_w = 0,
295 .log2_chroma_h = 0,
296 .comp = {
297 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
298 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
299 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
300 },
301 .flags = AV_PIX_FMT_FLAG_PLANAR,
302 },
303 [AV_PIX_FMT_YUV410P] = {
304 .name = "yuv410p",
305 .nb_components = 3,
306 .log2_chroma_w = 2,
307 .log2_chroma_h = 2,
308 .comp = {
309 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
310 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
311 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
312 },
313 .flags = AV_PIX_FMT_FLAG_PLANAR,
314 },
315 [AV_PIX_FMT_YUV411P] = {
316 .name = "yuv411p",
317 .nb_components = 3,
318 .log2_chroma_w = 2,
319 .log2_chroma_h = 0,
320 .comp = {
321 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
322 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
323 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
324 },
325 .flags = AV_PIX_FMT_FLAG_PLANAR,
326 },
327 [AV_PIX_FMT_YUVJ411P] = {
328 .name = "yuvj411p",
329 .nb_components = 3,
330 .log2_chroma_w = 2,
331 .log2_chroma_h = 0,
332 .comp = {
333 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
334 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
335 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
336 },
337 .flags = AV_PIX_FMT_FLAG_PLANAR,
338 },
339 [AV_PIX_FMT_GRAY8] = {
340 .name = "gray",
341 .nb_components = 1,
342 .log2_chroma_w = 0,
343 .log2_chroma_h = 0,
344 .comp = {
345 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
346 },
347 .flags = FF_PSEUDOPAL,
348 .alias = "gray8,y8",
349 },
350 [AV_PIX_FMT_MONOWHITE] = {
351 .name = "monow",
352 .nb_components = 1,
353 .log2_chroma_w = 0,
354 .log2_chroma_h = 0,
355 .comp = {
356 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* Y */
357 },
358 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
359 },
360 [AV_PIX_FMT_MONOBLACK] = {
361 .name = "monob",
362 .nb_components = 1,
363 .log2_chroma_w = 0,
364 .log2_chroma_h = 0,
365 .comp = {
366 { 0, 1, 0, 7, 1, 0, 0, 1 }, /* Y */
367 },
368 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
369 },
370 [AV_PIX_FMT_PAL8] = {
371 .name = "pal8",
372 .nb_components = 1,
373 .log2_chroma_w = 0,
374 .log2_chroma_h = 0,
375 .comp = {
376 { 0, 1, 0, 0, 8, 0, 7, 1 },
377 },
378 .flags = AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_ALPHA,
379 },
380 [AV_PIX_FMT_YUVJ420P] = {
381 .name = "yuvj420p",
382 .nb_components = 3,
383 .log2_chroma_w = 1,
384 .log2_chroma_h = 1,
385 .comp = {
386 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
387 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
388 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
389 },
390 .flags = AV_PIX_FMT_FLAG_PLANAR,
391 },
392 [AV_PIX_FMT_YUVJ422P] = {
393 .name = "yuvj422p",
394 .nb_components = 3,
395 .log2_chroma_w = 1,
396 .log2_chroma_h = 0,
397 .comp = {
398 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
399 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
400 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
401 },
402 .flags = AV_PIX_FMT_FLAG_PLANAR,
403 },
404 [AV_PIX_FMT_YUVJ444P] = {
405 .name = "yuvj444p",
406 .nb_components = 3,
407 .log2_chroma_w = 0,
408 .log2_chroma_h = 0,
409 .comp = {
410 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
411 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
412 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
413 },
414 .flags = AV_PIX_FMT_FLAG_PLANAR,
415 },
416 [AV_PIX_FMT_XVMC] = {
417 .name = "xvmc",
418 .flags = AV_PIX_FMT_FLAG_HWACCEL,
419 },
420 [AV_PIX_FMT_UYVY422] = {
421 .name = "uyvy422",
422 .nb_components = 3,
423 .log2_chroma_w = 1,
424 .log2_chroma_h = 0,
425 .comp = {
426 { 0, 2, 1, 0, 8, 1, 7, 2 }, /* Y */
427 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* U */
428 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* V */
429 },
430 },
431 [AV_PIX_FMT_UYYVYY411] = {
432 .name = "uyyvyy411",
433 .nb_components = 3,
434 .log2_chroma_w = 2,
435 .log2_chroma_h = 0,
436 .comp = {
437 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* Y */
438 { 0, 6, 0, 0, 8, 5, 7, 1 }, /* U */
439 { 0, 6, 3, 0, 8, 5, 7, 4 }, /* V */
440 },
441 },
442 [AV_PIX_FMT_BGR8] = {
443 .name = "bgr8",
444 .nb_components = 3,
445 .log2_chroma_w = 0,
446 .log2_chroma_h = 0,
447 .comp = {
448 { 0, 1, 0, 0, 3, 0, 2, 1 }, /* R */
449 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
450 { 0, 1, 0, 6, 2, 0, 1, 1 }, /* B */
451 },
452 .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
453 },
454 [AV_PIX_FMT_BGR4] = {
455 .name = "bgr4",
456 .nb_components = 3,
457 .log2_chroma_w = 0,
458 .log2_chroma_h = 0,
459 .comp = {
460 { 0, 4, 3, 0, 1, 3, 0, 4 }, /* R */
461 { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
462 { 0, 4, 0, 0, 1, 3, 0, 1 }, /* B */
463 },
464 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
465 },
466 [AV_PIX_FMT_BGR4_BYTE] = {
467 .name = "bgr4_byte",
468 .nb_components = 3,
469 .log2_chroma_w = 0,
470 .log2_chroma_h = 0,
471 .comp = {
472 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* R */
473 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
474 { 0, 1, 0, 3, 1, 0, 0, 1 }, /* B */
475 },
476 .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
477 },
478 [AV_PIX_FMT_RGB8] = {
479 .name = "rgb8",
480 .nb_components = 3,
481 .log2_chroma_w = 0,
482 .log2_chroma_h = 0,
483 .comp = {
484 { 0, 1, 0, 6, 2, 0, 1, 1 }, /* R */
485 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
486 { 0, 1, 0, 0, 3, 0, 2, 1 }, /* B */
487 },
488 .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
489 },
490 [AV_PIX_FMT_RGB4] = {
491 .name = "rgb4",
492 .nb_components = 3,
493 .log2_chroma_w = 0,
494 .log2_chroma_h = 0,
495 .comp = {
496 { 0, 4, 0, 0, 1, 3, 0, 1 }, /* R */
497 { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
498 { 0, 4, 3, 0, 1, 3, 0, 4 }, /* B */
499 },
500 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
501 },
502 [AV_PIX_FMT_RGB4_BYTE] = {
503 .name = "rgb4_byte",
504 .nb_components = 3,
505 .log2_chroma_w = 0,
506 .log2_chroma_h = 0,
507 .comp = {
508 { 0, 1, 0, 3, 1, 0, 0, 1 }, /* R */
509 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
510 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* B */
511 },
512 .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
513 },
514 [AV_PIX_FMT_NV12] = {
515 .name = "nv12",
516 .nb_components = 3,
517 .log2_chroma_w = 1,
518 .log2_chroma_h = 1,
519 .comp = {
520 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
521 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
522 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
523 },
524 .flags = AV_PIX_FMT_FLAG_PLANAR,
525 },
526 [AV_PIX_FMT_NV21] = {
527 .name = "nv21",
528 .nb_components = 3,
529 .log2_chroma_w = 1,
530 .log2_chroma_h = 1,
531 .comp = {
532 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
533 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */
534 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */
535 },
536 .flags = AV_PIX_FMT_FLAG_PLANAR,
537 },
538 [AV_PIX_FMT_ARGB] = {
539 .name = "argb",
540 .nb_components = 4,
541 .log2_chroma_w = 0,
542 .log2_chroma_h = 0,
543 .comp = {
544 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
545 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
546 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
547 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
548 },
549 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
550 },
551 [AV_PIX_FMT_RGBA] = {
552 .name = "rgba",
553 .nb_components = 4,
554 .log2_chroma_w = 0,
555 .log2_chroma_h = 0,
556 .comp = {
557 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
558 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
559 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
560 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
561 },
562 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
563 },
564 [AV_PIX_FMT_ABGR] = {
565 .name = "abgr",
566 .nb_components = 4,
567 .log2_chroma_w = 0,
568 .log2_chroma_h = 0,
569 .comp = {
570 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
571 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
572 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
573 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
574 },
575 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
576 },
577 [AV_PIX_FMT_BGRA] = {
578 .name = "bgra",
579 .nb_components = 4,
580 .log2_chroma_w = 0,
581 .log2_chroma_h = 0,
582 .comp = {
583 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
584 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
585 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
586 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
587 },
588 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
589 },
590 [AV_PIX_FMT_0RGB] = {
591 .name = "0rgb",
592 .nb_components= 3,
593 .log2_chroma_w= 0,
594 .log2_chroma_h= 0,
595 .comp = {
596 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
597 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
598 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
599 },
600 .flags = AV_PIX_FMT_FLAG_RGB,
601 },
602 [AV_PIX_FMT_RGB0] = {
603 .name = "rgb0",
604 .nb_components= 3,
605 .log2_chroma_w= 0,
606 .log2_chroma_h= 0,
607 .comp = {
608 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
609 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
610 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
611 },
612 .flags = AV_PIX_FMT_FLAG_RGB,
613 },
614 [AV_PIX_FMT_0BGR] = {
615 .name = "0bgr",
616 .nb_components= 3,
617 .log2_chroma_w= 0,
618 .log2_chroma_h= 0,
619 .comp = {
620 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
621 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
622 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
623 },
624 .flags = AV_PIX_FMT_FLAG_RGB,
625 },
626 [AV_PIX_FMT_BGR0] = {
627 .name = "bgr0",
628 .nb_components= 3,
629 .log2_chroma_w= 0,
630 .log2_chroma_h= 0,
631 .comp = {
632 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
633 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
634 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
635 },
636 .flags = AV_PIX_FMT_FLAG_RGB,
637 },
638 [AV_PIX_FMT_GRAY9BE] = {
639 .name = "gray9be",
640 .nb_components = 1,
641 .log2_chroma_w = 0,
642 .log2_chroma_h = 0,
643 .comp = {
644 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
645 },
646 .flags = AV_PIX_FMT_FLAG_BE,
647 .alias = "y9be",
648 },
649 [AV_PIX_FMT_GRAY9LE] = {
650 .name = "gray9le",
651 .nb_components = 1,
652 .log2_chroma_w = 0,
653 .log2_chroma_h = 0,
654 .comp = {
655 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
656 },
657 .alias = "y9le",
658 },
659 [AV_PIX_FMT_GRAY10BE] = {
660 .name = "gray10be",
661 .nb_components = 1,
662 .log2_chroma_w = 0,
663 .log2_chroma_h = 0,
664 .comp = {
665 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
666 },
667 .flags = AV_PIX_FMT_FLAG_BE,
668 .alias = "y10be",
669 },
670 [AV_PIX_FMT_GRAY10LE] = {
671 .name = "gray10le",
672 .nb_components = 1,
673 .log2_chroma_w = 0,
674 .log2_chroma_h = 0,
675 .comp = {
676 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
677 },
678 .alias = "y10le",
679 },
680 [AV_PIX_FMT_GRAY12BE] = {
681 .name = "gray12be",
682 .nb_components = 1,
683 .log2_chroma_w = 0,
684 .log2_chroma_h = 0,
685 .comp = {
686 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
687 },
688 .flags = AV_PIX_FMT_FLAG_BE,
689 .alias = "y12be",
690 },
691 [AV_PIX_FMT_GRAY12LE] = {
692 .name = "gray12le",
693 .nb_components = 1,
694 .log2_chroma_w = 0,
695 .log2_chroma_h = 0,
696 .comp = {
697 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
698 },
699 .alias = "y12le",
700 },
701 [AV_PIX_FMT_GRAY14BE] = {
702 .name = "gray14be",
703 .nb_components = 1,
704 .log2_chroma_w = 0,
705 .log2_chroma_h = 0,
706 .comp = {
707 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
708 },
709 .flags = AV_PIX_FMT_FLAG_BE,
710 .alias = "y14be",
711 },
712 [AV_PIX_FMT_GRAY14LE] = {
713 .name = "gray14le",
714 .nb_components = 1,
715 .log2_chroma_w = 0,
716 .log2_chroma_h = 0,
717 .comp = {
718 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
719 },
720 .alias = "y14le",
721 },
722 [AV_PIX_FMT_GRAY16BE] = {
723 .name = "gray16be",
724 .nb_components = 1,
725 .log2_chroma_w = 0,
726 .log2_chroma_h = 0,
727 .comp = {
728 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
729 },
730 .flags = AV_PIX_FMT_FLAG_BE,
731 .alias = "y16be",
732 },
733 [AV_PIX_FMT_GRAY16LE] = {
734 .name = "gray16le",
735 .nb_components = 1,
736 .log2_chroma_w = 0,
737 .log2_chroma_h = 0,
738 .comp = {
739 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
740 },
741 .alias = "y16le",
742 },
743 [AV_PIX_FMT_YUV440P] = {
744 .name = "yuv440p",
745 .nb_components = 3,
746 .log2_chroma_w = 0,
747 .log2_chroma_h = 1,
748 .comp = {
749 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
750 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
751 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
752 },
753 .flags = AV_PIX_FMT_FLAG_PLANAR,
754 },
755 [AV_PIX_FMT_YUVJ440P] = {
756 .name = "yuvj440p",
757 .nb_components = 3,
758 .log2_chroma_w = 0,
759 .log2_chroma_h = 1,
760 .comp = {
761 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
762 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
763 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
764 },
765 .flags = AV_PIX_FMT_FLAG_PLANAR,
766 },
767 [AV_PIX_FMT_YUV440P10LE] = {
768 .name = "yuv440p10le",
769 .nb_components = 3,
770 .log2_chroma_w = 0,
771 .log2_chroma_h = 1,
772 .comp = {
773 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
774 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
775 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
776 },
777 .flags = AV_PIX_FMT_FLAG_PLANAR,
778 },
779 [AV_PIX_FMT_YUV440P10BE] = {
780 .name = "yuv440p10be",
781 .nb_components = 3,
782 .log2_chroma_w = 0,
783 .log2_chroma_h = 1,
784 .comp = {
785 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
786 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
787 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
788 },
789 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
790 },
791 [AV_PIX_FMT_YUV440P12LE] = {
792 .name = "yuv440p12le",
793 .nb_components = 3,
794 .log2_chroma_w = 0,
795 .log2_chroma_h = 1,
796 .comp = {
797 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
798 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
799 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
800 },
801 .flags = AV_PIX_FMT_FLAG_PLANAR,
802 },
803 [AV_PIX_FMT_YUV440P12BE] = {
804 .name = "yuv440p12be",
805 .nb_components = 3,
806 .log2_chroma_w = 0,
807 .log2_chroma_h = 1,
808 .comp = {
809 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
810 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
811 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
812 },
813 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
814 },
815 [AV_PIX_FMT_YUVA420P] = {
816 .name = "yuva420p",
817 .nb_components = 4,
818 .log2_chroma_w = 1,
819 .log2_chroma_h = 1,
820 .comp = {
821 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
822 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
823 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
824 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
825 },
826 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
827 },
828 [AV_PIX_FMT_YUVA422P] = {
829 .name = "yuva422p",
830 .nb_components = 4,
831 .log2_chroma_w = 1,
832 .log2_chroma_h = 0,
833 .comp = {
834 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
835 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
836 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
837 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
838 },
839 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
840 },
841 [AV_PIX_FMT_YUVA444P] = {
842 .name = "yuva444p",
843 .nb_components = 4,
844 .log2_chroma_w = 0,
845 .log2_chroma_h = 0,
846 .comp = {
847 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
848 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
849 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
850 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
851 },
852 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
853 },
854 [AV_PIX_FMT_YUVA420P9BE] = {
855 .name = "yuva420p9be",
856 .nb_components = 4,
857 .log2_chroma_w = 1,
858 .log2_chroma_h = 1,
859 .comp = {
860 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
861 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
862 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
863 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
864 },
865 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
866 },
867 [AV_PIX_FMT_YUVA420P9LE] = {
868 .name = "yuva420p9le",
869 .nb_components = 4,
870 .log2_chroma_w = 1,
871 .log2_chroma_h = 1,
872 .comp = {
873 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
874 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
875 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
876 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
877 },
878 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
879 },
880 [AV_PIX_FMT_YUVA422P9BE] = {
881 .name = "yuva422p9be",
882 .nb_components = 4,
883 .log2_chroma_w = 1,
884 .log2_chroma_h = 0,
885 .comp = {
886 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
887 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
888 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
889 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
890 },
891 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
892 },
893 [AV_PIX_FMT_YUVA422P9LE] = {
894 .name = "yuva422p9le",
895 .nb_components = 4,
896 .log2_chroma_w = 1,
897 .log2_chroma_h = 0,
898 .comp = {
899 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
900 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
901 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
902 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
903 },
904 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
905 },
906 [AV_PIX_FMT_YUVA444P9BE] = {
907 .name = "yuva444p9be",
908 .nb_components = 4,
909 .log2_chroma_w = 0,
910 .log2_chroma_h = 0,
911 .comp = {
912 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
913 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
914 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
915 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
916 },
917 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
918 },
919 [AV_PIX_FMT_YUVA444P9LE] = {
920 .name = "yuva444p9le",
921 .nb_components = 4,
922 .log2_chroma_w = 0,
923 .log2_chroma_h = 0,
924 .comp = {
925 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
926 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
927 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
928 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
929 },
930 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
931 },
932 [AV_PIX_FMT_YUVA420P10BE] = {
933 .name = "yuva420p10be",
934 .nb_components = 4,
935 .log2_chroma_w = 1,
936 .log2_chroma_h = 1,
937 .comp = {
938 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
939 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
940 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
941 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
942 },
943 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
944 },
945 [AV_PIX_FMT_YUVA420P10LE] = {
946 .name = "yuva420p10le",
947 .nb_components = 4,
948 .log2_chroma_w = 1,
949 .log2_chroma_h = 1,
950 .comp = {
951 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
952 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
953 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
954 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
955 },
956 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
957 },
958 [AV_PIX_FMT_YUVA422P10BE] = {
959 .name = "yuva422p10be",
960 .nb_components = 4,
961 .log2_chroma_w = 1,
962 .log2_chroma_h = 0,
963 .comp = {
964 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
965 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
966 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
967 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
968 },
969 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
970 },
971 [AV_PIX_FMT_YUVA422P10LE] = {
972 .name = "yuva422p10le",
973 .nb_components = 4,
974 .log2_chroma_w = 1,
975 .log2_chroma_h = 0,
976 .comp = {
977 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
978 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
979 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
980 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
981 },
982 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
983 },
984 [AV_PIX_FMT_YUVA444P10BE] = {
985 .name = "yuva444p10be",
986 .nb_components = 4,
987 .log2_chroma_w = 0,
988 .log2_chroma_h = 0,
989 .comp = {
990 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
991 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
992 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
993 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
994 },
995 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
996 },
997 [AV_PIX_FMT_YUVA444P10LE] = {
998 .name = "yuva444p10le",
999 .nb_components = 4,
1000 .log2_chroma_w = 0,
1001 .log2_chroma_h = 0,
1002 .comp = {
1003 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1004 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1005 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1006 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
1007 },
1008 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1009 },
1010 [AV_PIX_FMT_YUVA420P16BE] = {
1011 .name = "yuva420p16be",
1012 .nb_components = 4,
1013 .log2_chroma_w = 1,
1014 .log2_chroma_h = 1,
1015 .comp = {
1016 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1017 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1018 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1019 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1020 },
1021 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1022 },
1023 [AV_PIX_FMT_YUVA420P16LE] = {
1024 .name = "yuva420p16le",
1025 .nb_components = 4,
1026 .log2_chroma_w = 1,
1027 .log2_chroma_h = 1,
1028 .comp = {
1029 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1030 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1031 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1032 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1033 },
1034 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1035 },
1036 [AV_PIX_FMT_YUVA422P16BE] = {
1037 .name = "yuva422p16be",
1038 .nb_components = 4,
1039 .log2_chroma_w = 1,
1040 .log2_chroma_h = 0,
1041 .comp = {
1042 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1043 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1044 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1045 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1046 },
1047 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1048 },
1049 [AV_PIX_FMT_YUVA422P16LE] = {
1050 .name = "yuva422p16le",
1051 .nb_components = 4,
1052 .log2_chroma_w = 1,
1053 .log2_chroma_h = 0,
1054 .comp = {
1055 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1056 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1057 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1058 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1059 },
1060 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1061 },
1062 [AV_PIX_FMT_YUVA444P16BE] = {
1063 .name = "yuva444p16be",
1064 .nb_components = 4,
1065 .log2_chroma_w = 0,
1066 .log2_chroma_h = 0,
1067 .comp = {
1068 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1069 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1070 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1071 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1072 },
1073 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1074 },
1075 [AV_PIX_FMT_YUVA444P16LE] = {
1076 .name = "yuva444p16le",
1077 .nb_components = 4,
1078 .log2_chroma_w = 0,
1079 .log2_chroma_h = 0,
1080 .comp = {
1081 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1082 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1083 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1084 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1085 },
1086 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1087 },
1088 [AV_PIX_FMT_RGB48BE] = {
1089 .name = "rgb48be",
1090 .nb_components = 3,
1091 .log2_chroma_w = 0,
1092 .log2_chroma_h = 0,
1093 .comp = {
1094 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
1095 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1096 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
1097 },
1098 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
1099 },
1100 [AV_PIX_FMT_RGB48LE] = {
1101 .name = "rgb48le",
1102 .nb_components = 3,
1103 .log2_chroma_w = 0,
1104 .log2_chroma_h = 0,
1105 .comp = {
1106 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
1107 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1108 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
1109 },
1110 .flags = AV_PIX_FMT_FLAG_RGB,
1111 },
1112 [AV_PIX_FMT_RGBA64BE] = {
1113 .name = "rgba64be",
1114 .nb_components = 4,
1115 .log2_chroma_w = 0,
1116 .log2_chroma_h = 0,
1117 .comp = {
1118 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
1119 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1120 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1121 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1122 },
1123 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1124 },
1125 [AV_PIX_FMT_RGBA64LE] = {
1126 .name = "rgba64le",
1127 .nb_components = 4,
1128 .log2_chroma_w = 0,
1129 .log2_chroma_h = 0,
1130 .comp = {
1131 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
1132 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1133 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1134 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1135 },
1136 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1137 },
1138 [AV_PIX_FMT_RGB565BE] = {
1139 .name = "rgb565be",
1140 .nb_components = 3,
1141 .log2_chroma_w = 0,
1142 .log2_chroma_h = 0,
1143 .comp = {
1144 { 0, 2, -1, 3, 5, 1, 4, 0 }, /* R */
1145 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1146 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1147 },
1148 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1149 },
1150 [AV_PIX_FMT_RGB565LE] = {
1151 .name = "rgb565le",
1152 .nb_components = 3,
1153 .log2_chroma_w = 0,
1154 .log2_chroma_h = 0,
1155 .comp = {
1156 { 0, 2, 1, 3, 5, 1, 4, 2 }, /* R */
1157 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1158 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1159 },
1160 .flags = AV_PIX_FMT_FLAG_RGB,
1161 },
1162 [AV_PIX_FMT_RGB555BE] = {
1163 .name = "rgb555be",
1164 .nb_components = 3,
1165 .log2_chroma_w = 0,
1166 .log2_chroma_h = 0,
1167 .comp = {
1168 { 0, 2, -1, 2, 5, 1, 4, 0 }, /* R */
1169 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1170 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1171 },
1172 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1173 },
1174 [AV_PIX_FMT_RGB555LE] = {
1175 .name = "rgb555le",
1176 .nb_components = 3,
1177 .log2_chroma_w = 0,
1178 .log2_chroma_h = 0,
1179 .comp = {
1180 { 0, 2, 1, 2, 5, 1, 4, 2 }, /* R */
1181 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1182 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1183 },
1184 .flags = AV_PIX_FMT_FLAG_RGB,
1185 },
1186 [AV_PIX_FMT_RGB444BE] = {
1187 .name = "rgb444be",
1188 .nb_components = 3,
1189 .log2_chroma_w = 0,
1190 .log2_chroma_h = 0,
1191 .comp = {
1192 { 0, 2, -1, 0, 4, 1, 3, 0 }, /* R */
1193 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1194 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1195 },
1196 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1197 },
1198 [AV_PIX_FMT_RGB444LE] = {
1199 .name = "rgb444le",
1200 .nb_components = 3,
1201 .log2_chroma_w = 0,
1202 .log2_chroma_h = 0,
1203 .comp = {
1204 { 0, 2, 1, 0, 4, 1, 3, 2 }, /* R */
1205 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1206 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1207 },
1208 .flags = AV_PIX_FMT_FLAG_RGB,
1209 },
1210 [AV_PIX_FMT_BGR48BE] = {
1211 .name = "bgr48be",
1212 .nb_components = 3,
1213 .log2_chroma_w = 0,
1214 .log2_chroma_h = 0,
1215 .comp = {
1216 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1217 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1218 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1219 },
1220 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1221 },
1222 [AV_PIX_FMT_BGR48LE] = {
1223 .name = "bgr48le",
1224 .nb_components = 3,
1225 .log2_chroma_w = 0,
1226 .log2_chroma_h = 0,
1227 .comp = {
1228 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1229 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1230 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1231 },
1232 .flags = AV_PIX_FMT_FLAG_RGB,
1233 },
1234 [AV_PIX_FMT_BGRA64BE] = {
1235 .name = "bgra64be",
1236 .nb_components = 4,
1237 .log2_chroma_w = 0,
1238 .log2_chroma_h = 0,
1239 .comp = {
1240 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1241 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1242 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1243 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1244 },
1245 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1246 },
1247 [AV_PIX_FMT_BGRA64LE] = {
1248 .name = "bgra64le",
1249 .nb_components = 4,
1250 .log2_chroma_w = 0,
1251 .log2_chroma_h = 0,
1252 .comp = {
1253 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1254 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1255 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1256 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1257 },
1258 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1259 },
1260 [AV_PIX_FMT_BGR565BE] = {
1261 .name = "bgr565be",
1262 .nb_components = 3,
1263 .log2_chroma_w = 0,
1264 .log2_chroma_h = 0,
1265 .comp = {
1266 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1267 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1268 { 0, 2, -1, 3, 5, 1, 4, 0 }, /* B */
1269 },
1270 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1271 },
1272 [AV_PIX_FMT_BGR565LE] = {
1273 .name = "bgr565le",
1274 .nb_components = 3,
1275 .log2_chroma_w = 0,
1276 .log2_chroma_h = 0,
1277 .comp = {
1278 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1279 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1280 { 0, 2, 1, 3, 5, 1, 4, 2 }, /* B */
1281 },
1282 .flags = AV_PIX_FMT_FLAG_RGB,
1283 },
1284 [AV_PIX_FMT_BGR555BE] = {
1285 .name = "bgr555be",
1286 .nb_components = 3,
1287 .log2_chroma_w = 0,
1288 .log2_chroma_h = 0,
1289 .comp = {
1290 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1291 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1292 { 0, 2, -1, 2, 5, 1, 4, 0 }, /* B */
1293 },
1294 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1295 },
1296 [AV_PIX_FMT_BGR555LE] = {
1297 .name = "bgr555le",
1298 .nb_components = 3,
1299 .log2_chroma_w = 0,
1300 .log2_chroma_h = 0,
1301 .comp = {
1302 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1303 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1304 { 0, 2, 1, 2, 5, 1, 4, 2 }, /* B */
1305 },
1306 .flags = AV_PIX_FMT_FLAG_RGB,
1307 },
1308 [AV_PIX_FMT_BGR444BE] = {
1309 .name = "bgr444be",
1310 .nb_components = 3,
1311 .log2_chroma_w = 0,
1312 .log2_chroma_h = 0,
1313 .comp = {
1314 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1315 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1316 { 0, 2, -1, 0, 4, 1, 3, 0 }, /* B */
1317 },
1318 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1319 },
1320 [AV_PIX_FMT_BGR444LE] = {
1321 .name = "bgr444le",
1322 .nb_components = 3,
1323 .log2_chroma_w = 0,
1324 .log2_chroma_h = 0,
1325 .comp = {
1326 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1327 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1328 { 0, 2, 1, 0, 4, 1, 3, 2 }, /* B */
1329 },
1330 .flags = AV_PIX_FMT_FLAG_RGB,
1331 },
1332 #if FF_API_VAAPI
1333 [AV_PIX_FMT_VAAPI_MOCO] = {
1334 .name = "vaapi_moco",
1335 .log2_chroma_w = 1,
1336 .log2_chroma_h = 1,
1337 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1338 },
1339 [AV_PIX_FMT_VAAPI_IDCT] = {
1340 .name = "vaapi_idct",
1341 .log2_chroma_w = 1,
1342 .log2_chroma_h = 1,
1343 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1344 },
1345 [AV_PIX_FMT_VAAPI_VLD] = {
1346 .name = "vaapi_vld",
1347 .log2_chroma_w = 1,
1348 .log2_chroma_h = 1,
1349 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1350 },
1351 #else
1352 [AV_PIX_FMT_VAAPI] = {
1353 .name = "vaapi",
1354 .log2_chroma_w = 1,
1355 .log2_chroma_h = 1,
1356 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1357 },
1358 #endif
1359 [AV_PIX_FMT_YUV420P9LE] = {
1360 .name = "yuv420p9le",
1361 .nb_components = 3,
1362 .log2_chroma_w = 1,
1363 .log2_chroma_h = 1,
1364 .comp = {
1365 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1366 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1367 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1368 },
1369 .flags = AV_PIX_FMT_FLAG_PLANAR,
1370 },
1371 [AV_PIX_FMT_YUV420P9BE] = {
1372 .name = "yuv420p9be",
1373 .nb_components = 3,
1374 .log2_chroma_w = 1,
1375 .log2_chroma_h = 1,
1376 .comp = {
1377 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1378 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1379 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1380 },
1381 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1382 },
1383 [AV_PIX_FMT_YUV420P10LE] = {
1384 .name = "yuv420p10le",
1385 .nb_components = 3,
1386 .log2_chroma_w = 1,
1387 .log2_chroma_h = 1,
1388 .comp = {
1389 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1390 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1391 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1392 },
1393 .flags = AV_PIX_FMT_FLAG_PLANAR,
1394 },
1395 [AV_PIX_FMT_YUV420P10BE] = {
1396 .name = "yuv420p10be",
1397 .nb_components = 3,
1398 .log2_chroma_w = 1,
1399 .log2_chroma_h = 1,
1400 .comp = {
1401 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1402 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1403 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1404 },
1405 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1406 },
1407 [AV_PIX_FMT_YUV420P12LE] = {
1408 .name = "yuv420p12le",
1409 .nb_components = 3,
1410 .log2_chroma_w = 1,
1411 .log2_chroma_h = 1,
1412 .comp = {
1413 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1414 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1415 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1416 },
1417 .flags = AV_PIX_FMT_FLAG_PLANAR,
1418 },
1419 [AV_PIX_FMT_YUV420P12BE] = {
1420 .name = "yuv420p12be",
1421 .nb_components = 3,
1422 .log2_chroma_w = 1,
1423 .log2_chroma_h = 1,
1424 .comp = {
1425 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1426 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1427 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1428 },
1429 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1430 },
1431 [AV_PIX_FMT_YUV420P14LE] = {
1432 .name = "yuv420p14le",
1433 .nb_components = 3,
1434 .log2_chroma_w = 1,
1435 .log2_chroma_h = 1,
1436 .comp = {
1437 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1438 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1439 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1440 },
1441 .flags = AV_PIX_FMT_FLAG_PLANAR,
1442 },
1443 [AV_PIX_FMT_YUV420P14BE] = {
1444 .name = "yuv420p14be",
1445 .nb_components = 3,
1446 .log2_chroma_w = 1,
1447 .log2_chroma_h = 1,
1448 .comp = {
1449 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1450 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1451 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1452 },
1453 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1454 },
1455 [AV_PIX_FMT_YUV420P16LE] = {
1456 .name = "yuv420p16le",
1457 .nb_components = 3,
1458 .log2_chroma_w = 1,
1459 .log2_chroma_h = 1,
1460 .comp = {
1461 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1462 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1463 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1464 },
1465 .flags = AV_PIX_FMT_FLAG_PLANAR,
1466 },
1467 [AV_PIX_FMT_YUV420P16BE] = {
1468 .name = "yuv420p16be",
1469 .nb_components = 3,
1470 .log2_chroma_w = 1,
1471 .log2_chroma_h = 1,
1472 .comp = {
1473 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1474 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1475 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1476 },
1477 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1478 },
1479 [AV_PIX_FMT_YUV422P9LE] = {
1480 .name = "yuv422p9le",
1481 .nb_components = 3,
1482 .log2_chroma_w = 1,
1483 .log2_chroma_h = 0,
1484 .comp = {
1485 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1486 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1487 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1488 },
1489 .flags = AV_PIX_FMT_FLAG_PLANAR,
1490 },
1491 [AV_PIX_FMT_YUV422P9BE] = {
1492 .name = "yuv422p9be",
1493 .nb_components = 3,
1494 .log2_chroma_w = 1,
1495 .log2_chroma_h = 0,
1496 .comp = {
1497 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1498 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1499 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1500 },
1501 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1502 },
1503 [AV_PIX_FMT_YUV422P10LE] = {
1504 .name = "yuv422p10le",
1505 .nb_components = 3,
1506 .log2_chroma_w = 1,
1507 .log2_chroma_h = 0,
1508 .comp = {
1509 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1510 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1511 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1512 },
1513 .flags = AV_PIX_FMT_FLAG_PLANAR,
1514 },
1515 [AV_PIX_FMT_YUV422P10BE] = {
1516 .name = "yuv422p10be",
1517 .nb_components = 3,
1518 .log2_chroma_w = 1,
1519 .log2_chroma_h = 0,
1520 .comp = {
1521 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1522 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1523 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1524 },
1525 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1526 },
1527 [AV_PIX_FMT_YUV422P12LE] = {
1528 .name = "yuv422p12le",
1529 .nb_components = 3,
1530 .log2_chroma_w = 1,
1531 .log2_chroma_h = 0,
1532 .comp = {
1533 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1534 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1535 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1536 },
1537 .flags = AV_PIX_FMT_FLAG_PLANAR,
1538 },
1539 [AV_PIX_FMT_YUV422P12BE] = {
1540 .name = "yuv422p12be",
1541 .nb_components = 3,
1542 .log2_chroma_w = 1,
1543 .log2_chroma_h = 0,
1544 .comp = {
1545 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1546 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1547 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1548 },
1549 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1550 },
1551 [AV_PIX_FMT_YUV422P14LE] = {
1552 .name = "yuv422p14le",
1553 .nb_components = 3,
1554 .log2_chroma_w = 1,
1555 .log2_chroma_h = 0,
1556 .comp = {
1557 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1558 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1559 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1560 },
1561 .flags = AV_PIX_FMT_FLAG_PLANAR,
1562 },
1563 [AV_PIX_FMT_YUV422P14BE] = {
1564 .name = "yuv422p14be",
1565 .nb_components = 3,
1566 .log2_chroma_w = 1,
1567 .log2_chroma_h = 0,
1568 .comp = {
1569 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1570 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1571 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1572 },
1573 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1574 },
1575 [AV_PIX_FMT_YUV422P16LE] = {
1576 .name = "yuv422p16le",
1577 .nb_components = 3,
1578 .log2_chroma_w = 1,
1579 .log2_chroma_h = 0,
1580 .comp = {
1581 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1582 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1583 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1584 },
1585 .flags = AV_PIX_FMT_FLAG_PLANAR,
1586 },
1587 [AV_PIX_FMT_YUV422P16BE] = {
1588 .name = "yuv422p16be",
1589 .nb_components = 3,
1590 .log2_chroma_w = 1,
1591 .log2_chroma_h = 0,
1592 .comp = {
1593 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1594 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1595 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1596 },
1597 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1598 },
1599 [AV_PIX_FMT_YUV444P16LE] = {
1600 .name = "yuv444p16le",
1601 .nb_components = 3,
1602 .log2_chroma_w = 0,
1603 .log2_chroma_h = 0,
1604 .comp = {
1605 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1606 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1607 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1608 },
1609 .flags = AV_PIX_FMT_FLAG_PLANAR,
1610 },
1611 [AV_PIX_FMT_YUV444P16BE] = {
1612 .name = "yuv444p16be",
1613 .nb_components = 3,
1614 .log2_chroma_w = 0,
1615 .log2_chroma_h = 0,
1616 .comp = {
1617 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1618 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1619 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1620 },
1621 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1622 },
1623 [AV_PIX_FMT_YUV444P10LE] = {
1624 .name = "yuv444p10le",
1625 .nb_components = 3,
1626 .log2_chroma_w = 0,
1627 .log2_chroma_h = 0,
1628 .comp = {
1629 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1630 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1631 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1632 },
1633 .flags = AV_PIX_FMT_FLAG_PLANAR,
1634 },
1635 [AV_PIX_FMT_YUV444P10BE] = {
1636 .name = "yuv444p10be",
1637 .nb_components = 3,
1638 .log2_chroma_w = 0,
1639 .log2_chroma_h = 0,
1640 .comp = {
1641 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1642 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1643 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1644 },
1645 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1646 },
1647 [AV_PIX_FMT_YUV444P9LE] = {
1648 .name = "yuv444p9le",
1649 .nb_components = 3,
1650 .log2_chroma_w = 0,
1651 .log2_chroma_h = 0,
1652 .comp = {
1653 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1654 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1655 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1656 },
1657 .flags = AV_PIX_FMT_FLAG_PLANAR,
1658 },
1659 [AV_PIX_FMT_YUV444P9BE] = {
1660 .name = "yuv444p9be",
1661 .nb_components = 3,
1662 .log2_chroma_w = 0,
1663 .log2_chroma_h = 0,
1664 .comp = {
1665 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1666 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1667 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1668 },
1669 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1670 },
1671 [AV_PIX_FMT_YUV444P12LE] = {
1672 .name = "yuv444p12le",
1673 .nb_components = 3,
1674 .log2_chroma_w = 0,
1675 .log2_chroma_h = 0,
1676 .comp = {
1677 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1678 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1679 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1680 },
1681 .flags = AV_PIX_FMT_FLAG_PLANAR,
1682 },
1683 [AV_PIX_FMT_YUV444P12BE] = {
1684 .name = "yuv444p12be",
1685 .nb_components = 3,
1686 .log2_chroma_w = 0,
1687 .log2_chroma_h = 0,
1688 .comp = {
1689 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1690 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1691 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1692 },
1693 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1694 },
1695 [AV_PIX_FMT_YUV444P14LE] = {
1696 .name = "yuv444p14le",
1697 .nb_components = 3,
1698 .log2_chroma_w = 0,
1699 .log2_chroma_h = 0,
1700 .comp = {
1701 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1702 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1703 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1704 },
1705 .flags = AV_PIX_FMT_FLAG_PLANAR,
1706 },
1707 [AV_PIX_FMT_YUV444P14BE] = {
1708 .name = "yuv444p14be",
1709 .nb_components = 3,
1710 .log2_chroma_w = 0,
1711 .log2_chroma_h = 0,
1712 .comp = {
1713 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1714 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1715 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1716 },
1717 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1718 },
1719 [AV_PIX_FMT_D3D11VA_VLD] = {
1720 .name = "d3d11va_vld",
1721 .log2_chroma_w = 1,
1722 .log2_chroma_h = 1,
1723 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1724 },
1725 [AV_PIX_FMT_DXVA2_VLD] = {
1726 .name = "dxva2_vld",
1727 .log2_chroma_w = 1,
1728 .log2_chroma_h = 1,
1729 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1730 },
1731 [AV_PIX_FMT_YA8] = {
1732 .name = "ya8",
1733 .nb_components = 2,
1734 .comp = {
1735 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
1736 { 0, 2, 1, 0, 8, 1, 7, 2 }, /* A */
1737 },
1738 .flags = AV_PIX_FMT_FLAG_ALPHA,
1739 .alias = "gray8a",
1740 },
1741 [AV_PIX_FMT_YA16LE] = {
1742 .name = "ya16le",
1743 .nb_components = 2,
1744 .comp = {
1745 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1746 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1747 },
1748 .flags = AV_PIX_FMT_FLAG_ALPHA,
1749 },
1750 [AV_PIX_FMT_YA16BE] = {
1751 .name = "ya16be",
1752 .nb_components = 2,
1753 .comp = {
1754 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1755 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1756 },
1757 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
1758 },
1759 [AV_PIX_FMT_VIDEOTOOLBOX] = {
1760 .name = "videotoolbox_vld",
1761 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1762 },
1763 [AV_PIX_FMT_GBRP] = {
1764 .name = "gbrp",
1765 .nb_components = 3,
1766 .log2_chroma_w = 0,
1767 .log2_chroma_h = 0,
1768 .comp = {
1769 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1770 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1771 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1772 },
1773 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1774 },
1775 [AV_PIX_FMT_GBRP9LE] = {
1776 .name = "gbrp9le",
1777 .nb_components = 3,
1778 .log2_chroma_w = 0,
1779 .log2_chroma_h = 0,
1780 .comp = {
1781 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1782 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1783 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1784 },
1785 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1786 },
1787 [AV_PIX_FMT_GBRP9BE] = {
1788 .name = "gbrp9be",
1789 .nb_components = 3,
1790 .log2_chroma_w = 0,
1791 .log2_chroma_h = 0,
1792 .comp = {
1793 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1794 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1795 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1796 },
1797 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1798 },
1799 [AV_PIX_FMT_GBRP10LE] = {
1800 .name = "gbrp10le",
1801 .nb_components = 3,
1802 .log2_chroma_w = 0,
1803 .log2_chroma_h = 0,
1804 .comp = {
1805 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1806 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1807 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1808 },
1809 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1810 },
1811 [AV_PIX_FMT_GBRP10BE] = {
1812 .name = "gbrp10be",
1813 .nb_components = 3,
1814 .log2_chroma_w = 0,
1815 .log2_chroma_h = 0,
1816 .comp = {
1817 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1818 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1819 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1820 },
1821 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1822 },
1823 [AV_PIX_FMT_GBRP12LE] = {
1824 .name = "gbrp12le",
1825 .nb_components = 3,
1826 .log2_chroma_w = 0,
1827 .log2_chroma_h = 0,
1828 .comp = {
1829 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1830 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1831 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1832 },
1833 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1834 },
1835 [AV_PIX_FMT_GBRP12BE] = {
1836 .name = "gbrp12be",
1837 .nb_components = 3,
1838 .log2_chroma_w = 0,
1839 .log2_chroma_h = 0,
1840 .comp = {
1841 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1842 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1843 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1844 },
1845 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1846 },
1847 [AV_PIX_FMT_GBRP14LE] = {
1848 .name = "gbrp14le",
1849 .nb_components = 3,
1850 .log2_chroma_w = 0,
1851 .log2_chroma_h = 0,
1852 .comp = {
1853 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1854 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1855 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1856 },
1857 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1858 },
1859 [AV_PIX_FMT_GBRP14BE] = {
1860 .name = "gbrp14be",
1861 .nb_components = 3,
1862 .log2_chroma_w = 0,
1863 .log2_chroma_h = 0,
1864 .comp = {
1865 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1866 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1867 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1868 },
1869 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1870 },
1871 [AV_PIX_FMT_GBRP16LE] = {
1872 .name = "gbrp16le",
1873 .nb_components = 3,
1874 .log2_chroma_w = 0,
1875 .log2_chroma_h = 0,
1876 .comp = {
1877 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1878 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1879 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1880 },
1881 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1882 },
1883 [AV_PIX_FMT_GBRP16BE] = {
1884 .name = "gbrp16be",
1885 .nb_components = 3,
1886 .log2_chroma_w = 0,
1887 .log2_chroma_h = 0,
1888 .comp = {
1889 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1890 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1891 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1892 },
1893 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1894 },
1895 [AV_PIX_FMT_GBRAP] = {
1896 .name = "gbrap",
1897 .nb_components = 4,
1898 .log2_chroma_w = 0,
1899 .log2_chroma_h = 0,
1900 .comp = {
1901 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1902 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1903 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1904 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
1905 },
1906 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1907 AV_PIX_FMT_FLAG_ALPHA,
1908 },
1909 [AV_PIX_FMT_GBRAP16LE] = {
1910 .name = "gbrap16le",
1911 .nb_components = 4,
1912 .log2_chroma_w = 0,
1913 .log2_chroma_h = 0,
1914 .comp = {
1915 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1916 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1917 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1918 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1919 },
1920 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1921 AV_PIX_FMT_FLAG_ALPHA,
1922 },
1923 [AV_PIX_FMT_GBRAP16BE] = {
1924 .name = "gbrap16be",
1925 .nb_components = 4,
1926 .log2_chroma_w = 0,
1927 .log2_chroma_h = 0,
1928 .comp = {
1929 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1930 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1931 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1932 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1933 },
1934 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
1935 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1936 },
1937 [AV_PIX_FMT_VDPAU] = {
1938 .name = "vdpau",
1939 .log2_chroma_w = 1,
1940 .log2_chroma_h = 1,
1941 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1942 },
1943 [AV_PIX_FMT_XYZ12LE] = {
1944 .name = "xyz12le",
1945 .nb_components = 3,
1946 .log2_chroma_w = 0,
1947 .log2_chroma_h = 0,
1948 .comp = {
1949 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1950 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1951 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1952 },
1953 /*.flags = -- not used*/
1954 },
1955 [AV_PIX_FMT_XYZ12BE] = {
1956 .name = "xyz12be",
1957 .nb_components = 3,
1958 .log2_chroma_w = 0,
1959 .log2_chroma_h = 0,
1960 .comp = {
1961 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1962 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1963 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1964 },
1965 .flags = AV_PIX_FMT_FLAG_BE,
1966 },
1967
1968 #define BAYER8_DESC_COMMON \
1969 .nb_components= 3, \
1970 .log2_chroma_w= 0, \
1971 .log2_chroma_h= 0, \
1972 .comp = { \
1973 {0,1,0,0,2,0,1,1},\
1974 {0,1,0,0,4,0,3,1},\
1975 {0,1,0,0,2,0,1,1},\
1976 }, \
1977
1978 #define BAYER16_DESC_COMMON \
1979 .nb_components= 3, \
1980 .log2_chroma_w= 0, \
1981 .log2_chroma_h= 0, \
1982 .comp = { \
1983 {0,2,0,0,4,1,3,1},\
1984 {0,2,0,0,8,1,7,1},\
1985 {0,2,0,0,4,1,3,1},\
1986 }, \
1987
1988 [AV_PIX_FMT_BAYER_BGGR8] = {
1989 .name = "bayer_bggr8",
1990 BAYER8_DESC_COMMON
1991 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1992 },
1993 [AV_PIX_FMT_BAYER_BGGR16LE] = {
1994 .name = "bayer_bggr16le",
1995 BAYER16_DESC_COMMON
1996 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1997 },
1998 [AV_PIX_FMT_BAYER_BGGR16BE] = {
1999 .name = "bayer_bggr16be",
2000 BAYER16_DESC_COMMON
2001 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2002 },
2003 [AV_PIX_FMT_BAYER_RGGB8] = {
2004 .name = "bayer_rggb8",
2005 BAYER8_DESC_COMMON
2006 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2007 },
2008 [AV_PIX_FMT_BAYER_RGGB16LE] = {
2009 .name = "bayer_rggb16le",
2010 BAYER16_DESC_COMMON
2011 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2012 },
2013 [AV_PIX_FMT_BAYER_RGGB16BE] = {
2014 .name = "bayer_rggb16be",
2015 BAYER16_DESC_COMMON
2016 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2017 },
2018 [AV_PIX_FMT_BAYER_GBRG8] = {
2019 .name = "bayer_gbrg8",
2020 BAYER8_DESC_COMMON
2021 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2022 },
2023 [AV_PIX_FMT_BAYER_GBRG16LE] = {
2024 .name = "bayer_gbrg16le",
2025 BAYER16_DESC_COMMON
2026 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2027 },
2028 [AV_PIX_FMT_BAYER_GBRG16BE] = {
2029 .name = "bayer_gbrg16be",
2030 BAYER16_DESC_COMMON
2031 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2032 },
2033 [AV_PIX_FMT_BAYER_GRBG8] = {
2034 .name = "bayer_grbg8",
2035 BAYER8_DESC_COMMON
2036 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2037 },
2038 [AV_PIX_FMT_BAYER_GRBG16LE] = {
2039 .name = "bayer_grbg16le",
2040 BAYER16_DESC_COMMON
2041 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2042 },
2043 [AV_PIX_FMT_BAYER_GRBG16BE] = {
2044 .name = "bayer_grbg16be",
2045 BAYER16_DESC_COMMON
2046 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2047 },
2048 [AV_PIX_FMT_NV16] = {
2049 .name = "nv16",
2050 .nb_components = 3,
2051 .log2_chroma_w = 1,
2052 .log2_chroma_h = 0,
2053 .comp = {
2054 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
2055 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
2056 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
2057 },
2058 .flags = AV_PIX_FMT_FLAG_PLANAR,
2059 },
2060 [AV_PIX_FMT_NV20LE] = {
2061 .name = "nv20le",
2062 .nb_components = 3,
2063 .log2_chroma_w = 1,
2064 .log2_chroma_h = 0,
2065 .comp = {
2066 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
2067 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
2068 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
2069 },
2070 .flags = AV_PIX_FMT_FLAG_PLANAR,
2071 },
2072 [AV_PIX_FMT_NV20BE] = {
2073 .name = "nv20be",
2074 .nb_components = 3,
2075 .log2_chroma_w = 1,
2076 .log2_chroma_h = 0,
2077 .comp = {
2078 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
2079 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
2080 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
2081 },
2082 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2083 },
2084 [AV_PIX_FMT_QSV] = {
2085 .name = "qsv",
2086 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2087 },
2088 [AV_PIX_FMT_MEDIACODEC] = {
2089 .name = "mediacodec",
2090 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2091 },
2092 [AV_PIX_FMT_MMAL] = {
2093 .name = "mmal",
2094 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2095 },
2096 [AV_PIX_FMT_CUDA] = {
2097 .name = "cuda",
2098 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2099 },
2100 [AV_PIX_FMT_AYUV64LE] = {
2101 .name = "ayuv64le",
2102 .nb_components = 4,
2103 .log2_chroma_w = 0,
2104 .log2_chroma_h = 0,
2105 .comp = {
2106 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
2107 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2108 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2109 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2110 },
2111 .flags = AV_PIX_FMT_FLAG_ALPHA,
2112 },
2113 [AV_PIX_FMT_AYUV64BE] = {
2114 .name = "ayuv64be",
2115 .nb_components = 4,
2116 .log2_chroma_w = 0,
2117 .log2_chroma_h = 0,
2118 .comp = {
2119 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
2120 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2121 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2122 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2123 },
2124 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
2125 },
2126 [AV_PIX_FMT_P010LE] = {
2127 .name = "p010le",
2128 .nb_components = 3,
2129 .log2_chroma_w = 1,
2130 .log2_chroma_h = 1,
2131 .comp = {
2132 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2133 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2134 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2135 },
2136 .flags = AV_PIX_FMT_FLAG_PLANAR,
2137 },
2138 [AV_PIX_FMT_P010BE] = {
2139 .name = "p010be",
2140 .nb_components = 3,
2141 .log2_chroma_w = 1,
2142 .log2_chroma_h = 1,
2143 .comp = {
2144 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2145 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2146 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2147 },
2148 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2149 },
2150 [AV_PIX_FMT_P016LE] = {
2151 .name = "p016le",
2152 .nb_components = 3,
2153 .log2_chroma_w = 1,
2154 .log2_chroma_h = 1,
2155 .comp = {
2156 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
2157 { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
2158 { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
2159 },
2160 .flags = AV_PIX_FMT_FLAG_PLANAR,
2161 },
2162 [AV_PIX_FMT_P016BE] = {
2163 .name = "p016be",
2164 .nb_components = 3,
2165 .log2_chroma_w = 1,
2166 .log2_chroma_h = 1,
2167 .comp = {
2168 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
2169 { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
2170 { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
2171 },
2172 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2173 },
2174 [AV_PIX_FMT_GBRAP12LE] = {
2175 .name = "gbrap12le",
2176 .nb_components = 4,
2177 .log2_chroma_w = 0,
2178 .log2_chroma_h = 0,
2179 .comp = {
2180 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2181 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2182 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2183 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2184 },
2185 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2186 AV_PIX_FMT_FLAG_ALPHA,
2187 },
2188 [AV_PIX_FMT_GBRAP12BE] = {
2189 .name = "gbrap12be",
2190 .nb_components = 4,
2191 .log2_chroma_w = 0,
2192 .log2_chroma_h = 0,
2193 .comp = {
2194 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2195 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2196 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2197 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2198 },
2199 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2200 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2201 },
2202 [AV_PIX_FMT_GBRAP10LE] = {
2203 .name = "gbrap10le",
2204 .nb_components = 4,
2205 .log2_chroma_w = 0,
2206 .log2_chroma_h = 0,
2207 .comp = {
2208 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2209 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2210 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2211 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2212 },
2213 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2214 AV_PIX_FMT_FLAG_ALPHA,
2215 },
2216 [AV_PIX_FMT_GBRAP10BE] = {
2217 .name = "gbrap10be",
2218 .nb_components = 4,
2219 .log2_chroma_w = 0,
2220 .log2_chroma_h = 0,
2221 .comp = {
2222 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2223 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2224 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2225 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2226 },
2227 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2228 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2229 },
2230 [AV_PIX_FMT_D3D11] = {
2231 .name = "d3d11",
2232 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2233 },
2234 [AV_PIX_FMT_GBRPF32BE] = {
2235 .name = "gbrpf32be",
2236 .nb_components = 3,
2237 .log2_chroma_w = 0,
2238 .log2_chroma_h = 0,
2239 .comp = {
2240 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2241 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2242 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2243 },
2244 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2245 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
2246 },
2247 [AV_PIX_FMT_GBRPF32LE] = {
2248 .name = "gbrpf32le",
2249 .nb_components = 3,
2250 .log2_chroma_w = 0,
2251 .log2_chroma_h = 0,
2252 .comp = {
2253 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2254 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2255 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2256 },
2257 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_RGB,
2258 },
2259 [AV_PIX_FMT_GBRAPF32BE] = {
2260 .name = "gbrapf32be",
2261 .nb_components = 4,
2262 .log2_chroma_w = 0,
2263 .log2_chroma_h = 0,
2264 .comp = {
2265 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2266 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2267 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2268 { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
2269 },
2270 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2271 AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_RGB |
2272 AV_PIX_FMT_FLAG_FLOAT,
2273 },
2274 [AV_PIX_FMT_GBRAPF32LE] = {
2275 .name = "gbrapf32le",
2276 .nb_components = 4,
2277 .log2_chroma_w = 0,
2278 .log2_chroma_h = 0,
2279 .comp = {
2280 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2281 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2282 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2283 { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
2284 },
2285 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA |
2286 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
2287 },
2288 [AV_PIX_FMT_DRM_PRIME] = {
2289 .name = "drm_prime",
2290 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2291 },
2292 [AV_PIX_FMT_OPENCL] = {
2293 .name = "opencl",
2294 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2295 },
2296 [AV_PIX_FMT_GRAYF32BE] = {
2297 .name = "grayf32be",
2298 .nb_components = 1,
2299 .log2_chroma_w = 0,
2300 .log2_chroma_h = 0,
2301 .comp = {
2302 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */
2303 },
2304 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_FLOAT,
2305 .alias = "yf32be",
2306 },
2307 [AV_PIX_FMT_GRAYF32LE] = {
2308 .name = "grayf32le",
2309 .nb_components = 1,
2310 .log2_chroma_w = 0,
2311 .log2_chroma_h = 0,
2312 .comp = {
2313 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */
2314 },
2315 .flags = AV_PIX_FMT_FLAG_FLOAT,
2316 .alias = "yf32le",
2317 },
2318 [AV_PIX_FMT_YUVA422P12BE] = {
2319 .name = "yuva422p12be",
2320 .nb_components = 4,
2321 .log2_chroma_w = 1,
2322 .log2_chroma_h = 0,
2323 .comp = {
2324 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
2325 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
2326 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
2327 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2328 },
2329 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2330 },
2331 [AV_PIX_FMT_YUVA422P12LE] = {
2332 .name = "yuva422p12le",
2333 .nb_components = 4,
2334 .log2_chroma_w = 1,
2335 .log2_chroma_h = 0,
2336 .comp = {
2337 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
2338 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
2339 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
2340 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2341 },
2342 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2343 },
2344 [AV_PIX_FMT_YUVA444P12BE] = {
2345 .name = "yuva444p12be",
2346 .nb_components = 4,
2347 .log2_chroma_w = 0,
2348 .log2_chroma_h = 0,
2349 .comp = {
2350 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
2351 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
2352 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
2353 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2354 },
2355 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2356 },
2357 [AV_PIX_FMT_YUVA444P12LE] = {
2358 .name = "yuva444p12le",
2359 .nb_components = 4,
2360 .log2_chroma_w = 0,
2361 .log2_chroma_h = 0,
2362 .comp = {
2363 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
2364 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
2365 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
2366 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2367 },
2368 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2369 },
2370 [AV_PIX_FMT_NV24] = {
2371 .name = "nv24",
2372 .nb_components = 3,
2373 .log2_chroma_w = 0,
2374 .log2_chroma_h = 0,
2375 .comp = {
2376 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
2377 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
2378 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
2379 },
2380 .flags = AV_PIX_FMT_FLAG_PLANAR,
2381 },
2382 [AV_PIX_FMT_NV42] = {
2383 .name = "nv42",
2384 .nb_components = 3,
2385 .log2_chroma_w = 0,
2386 .log2_chroma_h = 0,
2387 .comp = {
2388 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
2389 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */
2390 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */
2391 },
2392 .flags = AV_PIX_FMT_FLAG_PLANAR,
2393 },
2394 [AV_PIX_FMT_VULKAN] = {
2395 .name = "vulkan",
2396 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2397 },
2398 };
2399 #if FF_API_PLUS1_MINUS1
2400 FF_ENABLE_DEPRECATION_WARNINGS
2401 #endif
2402
2403 static const char * const color_range_names[] = {
2404 [AVCOL_RANGE_UNSPECIFIED] = "unknown",
2405 [AVCOL_RANGE_MPEG] = "tv",
2406 [AVCOL_RANGE_JPEG] = "pc",
2407 };
2408
2409 static const char * const color_primaries_names[AVCOL_PRI_NB] = {
2410 [AVCOL_PRI_RESERVED0] = "reserved",
2411 [AVCOL_PRI_BT709] = "bt709",
2412 [AVCOL_PRI_UNSPECIFIED] = "unknown",
2413 [AVCOL_PRI_RESERVED] = "reserved",
2414 [AVCOL_PRI_BT470M] = "bt470m",
2415 [AVCOL_PRI_BT470BG] = "bt470bg",
2416 [AVCOL_PRI_SMPTE170M] = "smpte170m",
2417 [AVCOL_PRI_SMPTE240M] = "smpte240m",
2418 [AVCOL_PRI_FILM] = "film",
2419 [AVCOL_PRI_BT2020] = "bt2020",
2420 [AVCOL_PRI_SMPTE428] = "smpte428",
2421 [AVCOL_PRI_SMPTE431] = "smpte431",
2422 [AVCOL_PRI_SMPTE432] = "smpte432",
2423 [AVCOL_PRI_EBU3213] = "ebu3213",
2424 };
2425
2426 static const char * const color_transfer_names[] = {
2427 [AVCOL_TRC_RESERVED0] = "reserved",
2428 [AVCOL_TRC_BT709] = "bt709",
2429 [AVCOL_TRC_UNSPECIFIED] = "unknown",
2430 [AVCOL_TRC_RESERVED] = "reserved",
2431 [AVCOL_TRC_GAMMA22] = "bt470m",
2432 [AVCOL_TRC_GAMMA28] = "bt470bg",
2433 [AVCOL_TRC_SMPTE170M] = "smpte170m",
2434 [AVCOL_TRC_SMPTE240M] = "smpte240m",
2435 [AVCOL_TRC_LINEAR] = "linear",
2436 [AVCOL_TRC_LOG] = "log100",
2437 [AVCOL_TRC_LOG_SQRT] = "log316",
2438 [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
2439 [AVCOL_TRC_BT1361_ECG] = "bt1361e",
2440 [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
2441 [AVCOL_TRC_BT2020_10] = "bt2020-10",
2442 [AVCOL_TRC_BT2020_12] = "bt2020-12",
2443 [AVCOL_TRC_SMPTE2084] = "smpte2084",
2444 [AVCOL_TRC_SMPTE428] = "smpte428",
2445 [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
2446 };
2447
2448 static const char * const color_space_names[] = {
2449 [AVCOL_SPC_RGB] = "gbr",
2450 [AVCOL_SPC_BT709] = "bt709",
2451 [AVCOL_SPC_UNSPECIFIED] = "unknown",
2452 [AVCOL_SPC_RESERVED] = "reserved",
2453 [AVCOL_SPC_FCC] = "fcc",
2454 [AVCOL_SPC_BT470BG] = "bt470bg",
2455 [AVCOL_SPC_SMPTE170M] = "smpte170m",
2456 [AVCOL_SPC_SMPTE240M] = "smpte240m",
2457 [AVCOL_SPC_YCGCO] = "ycgco",
2458 [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
2459 [AVCOL_SPC_BT2020_CL] = "bt2020c",
2460 [AVCOL_SPC_SMPTE2085] = "smpte2085",
2461 [AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
2462 [AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
2463 [AVCOL_SPC_ICTCP] = "ictcp",
2464 };
2465
2466 static const char * const chroma_location_names[] = {
2467 [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
2468 [AVCHROMA_LOC_LEFT] = "left",
2469 [AVCHROMA_LOC_CENTER] = "center",
2470 [AVCHROMA_LOC_TOPLEFT] = "topleft",
2471 [AVCHROMA_LOC_TOP] = "top",
2472 [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
2473 [AVCHROMA_LOC_BOTTOM] = "bottom",
2474 };
2475
get_pix_fmt_internal(const char * name)2476 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
2477 {
2478 enum AVPixelFormat pix_fmt;
2479
2480 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
2481 if (av_pix_fmt_descriptors[pix_fmt].name &&
2482 (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
2483 av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
2484 return pix_fmt;
2485
2486 return AV_PIX_FMT_NONE;
2487 }
2488
av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)2489 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
2490 {
2491 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
2492 av_pix_fmt_descriptors[pix_fmt].name : NULL;
2493 }
2494
2495 #if HAVE_BIGENDIAN
2496 # define X_NE(be, le) be
2497 #else
2498 # define X_NE(be, le) le
2499 #endif
2500
av_get_pix_fmt(const char * name)2501 enum AVPixelFormat av_get_pix_fmt(const char *name)
2502 {
2503 enum AVPixelFormat pix_fmt;
2504
2505 if (!strcmp(name, "rgb32"))
2506 name = X_NE("argb", "bgra");
2507 else if (!strcmp(name, "bgr32"))
2508 name = X_NE("abgr", "rgba");
2509
2510 pix_fmt = get_pix_fmt_internal(name);
2511 if (pix_fmt == AV_PIX_FMT_NONE) {
2512 char name2[32];
2513
2514 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
2515 pix_fmt = get_pix_fmt_internal(name2);
2516 }
2517
2518 #if FF_API_VAAPI
2519 if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
2520 pix_fmt = AV_PIX_FMT_VAAPI;
2521 #endif
2522 return pix_fmt;
2523 }
2524
av_get_bits_per_pixel(const AVPixFmtDescriptor * pixdesc)2525 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
2526 {
2527 int c, bits = 0;
2528 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2529
2530 for (c = 0; c < pixdesc->nb_components; c++) {
2531 int s = c == 1 || c == 2 ? 0 : log2_pixels;
2532 bits += pixdesc->comp[c].depth << s;
2533 }
2534
2535 return bits >> log2_pixels;
2536 }
2537
av_get_padded_bits_per_pixel(const AVPixFmtDescriptor * pixdesc)2538 int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
2539 {
2540 int c, bits = 0;
2541 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2542 int steps[4] = {0};
2543
2544 for (c = 0; c < pixdesc->nb_components; c++) {
2545 const AVComponentDescriptor *comp = &pixdesc->comp[c];
2546 int s = c == 1 || c == 2 ? 0 : log2_pixels;
2547 steps[comp->plane] = comp->step << s;
2548 }
2549 for (c = 0; c < 4; c++)
2550 bits += steps[c];
2551
2552 if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
2553 bits *= 8;
2554
2555 return bits >> log2_pixels;
2556 }
2557
av_get_pix_fmt_string(char * buf,int buf_size,enum AVPixelFormat pix_fmt)2558 char *av_get_pix_fmt_string(char *buf, int buf_size,
2559 enum AVPixelFormat pix_fmt)
2560 {
2561 /* print header */
2562 if (pix_fmt < 0) {
2563 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
2564 } else {
2565 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
2566 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
2567 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
2568 }
2569
2570 return buf;
2571 }
2572
av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)2573 const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
2574 {
2575 if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
2576 return NULL;
2577 return &av_pix_fmt_descriptors[pix_fmt];
2578 }
2579
av_pix_fmt_desc_next(const AVPixFmtDescriptor * prev)2580 const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
2581 {
2582 if (!prev)
2583 return &av_pix_fmt_descriptors[0];
2584 while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
2585 prev++;
2586 if (prev->name)
2587 return prev;
2588 }
2589 return NULL;
2590 }
2591
av_pix_fmt_desc_get_id(const AVPixFmtDescriptor * desc)2592 enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
2593 {
2594 if (desc < av_pix_fmt_descriptors ||
2595 desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
2596 return AV_PIX_FMT_NONE;
2597
2598 return desc - av_pix_fmt_descriptors;
2599 }
2600
av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,int * h_shift,int * v_shift)2601 int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
2602 int *h_shift, int *v_shift)
2603 {
2604 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2605 if (!desc)
2606 return AVERROR(ENOSYS);
2607 *h_shift = desc->log2_chroma_w;
2608 *v_shift = desc->log2_chroma_h;
2609
2610 return 0;
2611 }
2612
av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)2613 int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
2614 {
2615 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2616 int i, planes[4] = { 0 }, ret = 0;
2617
2618 if (!desc)
2619 return AVERROR(EINVAL);
2620
2621 for (i = 0; i < desc->nb_components; i++)
2622 planes[desc->comp[i].plane] = 1;
2623 for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
2624 ret += planes[i];
2625 return ret;
2626 }
2627
ff_check_pixfmt_descriptors(void)2628 void ff_check_pixfmt_descriptors(void){
2629 int i, j;
2630
2631 for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
2632 const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
2633 uint8_t fill[4][8+6+3] = {{0}};
2634 uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
2635 int linesize[4] = {0,0,0,0};
2636 uint16_t tmp[2];
2637
2638 if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
2639 continue;
2640 // av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
2641 av_assert0(d->log2_chroma_w <= 3);
2642 av_assert0(d->log2_chroma_h <= 3);
2643 av_assert0(d->nb_components <= 4);
2644 av_assert0(d->name && d->name[0]);
2645 av_assert2(av_get_pix_fmt(d->name) == i);
2646
2647 for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
2648 const AVComponentDescriptor *c = &d->comp[j];
2649 if(j>=d->nb_components) {
2650 av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
2651 continue;
2652 }
2653 if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
2654 av_assert0(c->step >= c->depth);
2655 } else {
2656 av_assert0(8*c->step >= c->depth);
2657 }
2658 if (d->flags & AV_PIX_FMT_FLAG_BAYER)
2659 continue;
2660 av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
2661 av_assert0(tmp[0] == 0 && tmp[1] == 0);
2662 tmp[0] = tmp[1] = (1ULL << c->depth) - 1;
2663 av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
2664 }
2665 }
2666 }
2667
2668
av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)2669 enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
2670 {
2671 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2672 char name[16];
2673 int i;
2674
2675 if (!desc || strlen(desc->name) < 2)
2676 return AV_PIX_FMT_NONE;
2677 av_strlcpy(name, desc->name, sizeof(name));
2678 i = strlen(name) - 2;
2679 if (strcmp(name + i, "be") && strcmp(name + i, "le"))
2680 return AV_PIX_FMT_NONE;
2681
2682 name[i] ^= 'b' ^ 'l';
2683
2684 return get_pix_fmt_internal(name);
2685 }
2686
2687 #define FF_COLOR_NA -1
2688 #define FF_COLOR_RGB 0 /**< RGB color space */
2689 #define FF_COLOR_GRAY 1 /**< gray color space */
2690 #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
2691 #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
2692 #define FF_COLOR_XYZ 4
2693
2694 #define pixdesc_has_alpha(pixdesc) \
2695 ((pixdesc)->flags & AV_PIX_FMT_FLAG_ALPHA)
2696
2697
get_color_type(const AVPixFmtDescriptor * desc)2698 static int get_color_type(const AVPixFmtDescriptor *desc) {
2699 if (desc->flags & AV_PIX_FMT_FLAG_PAL)
2700 return FF_COLOR_RGB;
2701
2702 if(desc->nb_components == 1 || desc->nb_components == 2)
2703 return FF_COLOR_GRAY;
2704
2705 if (desc->name) {
2706 if (av_strstart(desc->name, "yuvj", NULL))
2707 return FF_COLOR_YUV_JPEG;
2708
2709 if (av_strstart(desc->name, "xyz", NULL))
2710 return FF_COLOR_XYZ;
2711 }
2712
2713 if(desc->flags & AV_PIX_FMT_FLAG_RGB)
2714 return FF_COLOR_RGB;
2715
2716 if(desc->nb_components == 0)
2717 return FF_COLOR_NA;
2718
2719 return FF_COLOR_YUV;
2720 }
2721
get_pix_fmt_depth(int * min,int * max,enum AVPixelFormat pix_fmt)2722 static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
2723 {
2724 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2725 int i;
2726
2727 if (!desc || !desc->nb_components) {
2728 *min = *max = 0;
2729 return AVERROR(EINVAL);
2730 }
2731
2732 *min = INT_MAX, *max = -INT_MAX;
2733 for (i = 0; i < desc->nb_components; i++) {
2734 *min = FFMIN(desc->comp[i].depth, *min);
2735 *max = FFMAX(desc->comp[i].depth, *max);
2736 }
2737 return 0;
2738 }
2739
get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,enum AVPixelFormat src_pix_fmt,unsigned * lossp,unsigned consider)2740 static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
2741 enum AVPixelFormat src_pix_fmt,
2742 unsigned *lossp, unsigned consider)
2743 {
2744 const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
2745 const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
2746 int src_color, dst_color;
2747 int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
2748 int ret, loss, i, nb_components;
2749 int score = INT_MAX - 1;
2750
2751 if (!src_desc || !dst_desc)
2752 return -4;
2753
2754 if ((src_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) ||
2755 (dst_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
2756 if (dst_pix_fmt == src_pix_fmt)
2757 return -1;
2758 else
2759 return -2;
2760 }
2761
2762 /* compute loss */
2763 *lossp = loss = 0;
2764
2765 if (dst_pix_fmt == src_pix_fmt)
2766 return INT_MAX;
2767
2768 if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
2769 return -3;
2770 if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
2771 return -3;
2772
2773 src_color = get_color_type(src_desc);
2774 dst_color = get_color_type(dst_desc);
2775 if (dst_pix_fmt == AV_PIX_FMT_PAL8)
2776 nb_components = FFMIN(src_desc->nb_components, 4);
2777 else
2778 nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
2779
2780 for (i = 0; i < nb_components; i++) {
2781 int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
2782 if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
2783 loss |= FF_LOSS_DEPTH;
2784 score -= 65536 >> depth_minus1;
2785 }
2786 }
2787
2788 if (consider & FF_LOSS_RESOLUTION) {
2789 if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
2790 loss |= FF_LOSS_RESOLUTION;
2791 score -= 256 << dst_desc->log2_chroma_w;
2792 }
2793 if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
2794 loss |= FF_LOSS_RESOLUTION;
2795 score -= 256 << dst_desc->log2_chroma_h;
2796 }
2797 // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
2798 if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
2799 dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
2800 score += 512;
2801 }
2802 }
2803
2804 if(consider & FF_LOSS_COLORSPACE)
2805 switch(dst_color) {
2806 case FF_COLOR_RGB:
2807 if (src_color != FF_COLOR_RGB &&
2808 src_color != FF_COLOR_GRAY)
2809 loss |= FF_LOSS_COLORSPACE;
2810 break;
2811 case FF_COLOR_GRAY:
2812 if (src_color != FF_COLOR_GRAY)
2813 loss |= FF_LOSS_COLORSPACE;
2814 break;
2815 case FF_COLOR_YUV:
2816 if (src_color != FF_COLOR_YUV)
2817 loss |= FF_LOSS_COLORSPACE;
2818 break;
2819 case FF_COLOR_YUV_JPEG:
2820 if (src_color != FF_COLOR_YUV_JPEG &&
2821 src_color != FF_COLOR_YUV &&
2822 src_color != FF_COLOR_GRAY)
2823 loss |= FF_LOSS_COLORSPACE;
2824 break;
2825 default:
2826 /* fail safe test */
2827 if (src_color != dst_color)
2828 loss |= FF_LOSS_COLORSPACE;
2829 break;
2830 }
2831 if(loss & FF_LOSS_COLORSPACE)
2832 score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
2833
2834 if (dst_color == FF_COLOR_GRAY &&
2835 src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
2836 loss |= FF_LOSS_CHROMA;
2837 score -= 2 * 65536;
2838 }
2839 if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
2840 loss |= FF_LOSS_ALPHA;
2841 score -= 65536;
2842 }
2843 if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
2844 (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
2845 loss |= FF_LOSS_COLORQUANT;
2846 score -= 65536;
2847 }
2848
2849 *lossp = loss;
2850 return score;
2851 }
2852
av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,enum AVPixelFormat src_pix_fmt,int has_alpha)2853 int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
2854 enum AVPixelFormat src_pix_fmt,
2855 int has_alpha)
2856 {
2857 int loss;
2858 int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
2859 if (ret < 0)
2860 return ret;
2861 return loss;
2862 }
2863
av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1,enum AVPixelFormat dst_pix_fmt2,enum AVPixelFormat src_pix_fmt,int has_alpha,int * loss_ptr)2864 enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
2865 enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
2866 {
2867 enum AVPixelFormat dst_pix_fmt;
2868 int loss1, loss2, loss_mask;
2869 const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
2870 const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
2871 int score1, score2;
2872
2873 if (!desc1) {
2874 dst_pix_fmt = dst_pix_fmt2;
2875 } else if (!desc2) {
2876 dst_pix_fmt = dst_pix_fmt1;
2877 } else {
2878 loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
2879 if(!has_alpha)
2880 loss_mask &= ~FF_LOSS_ALPHA;
2881
2882 score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
2883 score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
2884
2885 if (score1 == score2) {
2886 if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) {
2887 dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
2888 } else {
2889 dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
2890 }
2891 } else {
2892 dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
2893 }
2894 }
2895
2896 if (loss_ptr)
2897 *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
2898 return dst_pix_fmt;
2899 }
2900
av_color_range_name(enum AVColorRange range)2901 const char *av_color_range_name(enum AVColorRange range)
2902 {
2903 return (unsigned) range < AVCOL_RANGE_NB ?
2904 color_range_names[range] : NULL;
2905 }
2906
av_color_range_from_name(const char * name)2907 int av_color_range_from_name(const char *name)
2908 {
2909 int i;
2910
2911 for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
2912 if (av_strstart(name, color_range_names[i], NULL))
2913 return i;
2914 }
2915
2916 return AVERROR(EINVAL);
2917 }
2918
av_color_primaries_name(enum AVColorPrimaries primaries)2919 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
2920 {
2921 return (unsigned) primaries < AVCOL_PRI_NB ?
2922 color_primaries_names[primaries] : NULL;
2923 }
2924
av_color_primaries_from_name(const char * name)2925 int av_color_primaries_from_name(const char *name)
2926 {
2927 int i;
2928
2929 for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) {
2930 if (!color_primaries_names[i])
2931 continue;
2932
2933 if (av_strstart(name, color_primaries_names[i], NULL))
2934 return i;
2935 }
2936
2937 return AVERROR(EINVAL);
2938 }
2939
av_color_transfer_name(enum AVColorTransferCharacteristic transfer)2940 const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
2941 {
2942 return (unsigned) transfer < AVCOL_TRC_NB ?
2943 color_transfer_names[transfer] : NULL;
2944 }
2945
av_color_transfer_from_name(const char * name)2946 int av_color_transfer_from_name(const char *name)
2947 {
2948 int i;
2949
2950 for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) {
2951 if (!color_transfer_names[i])
2952 continue;
2953
2954 if (av_strstart(name, color_transfer_names[i], NULL))
2955 return i;
2956 }
2957
2958 return AVERROR(EINVAL);
2959 }
2960
av_color_space_name(enum AVColorSpace space)2961 const char *av_color_space_name(enum AVColorSpace space)
2962 {
2963 return (unsigned) space < AVCOL_SPC_NB ?
2964 color_space_names[space] : NULL;
2965 }
2966
av_color_space_from_name(const char * name)2967 int av_color_space_from_name(const char *name)
2968 {
2969 int i;
2970
2971 for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) {
2972 if (!color_space_names[i])
2973 continue;
2974
2975 if (av_strstart(name, color_space_names[i], NULL))
2976 return i;
2977 }
2978
2979 return AVERROR(EINVAL);
2980 }
2981
av_chroma_location_name(enum AVChromaLocation location)2982 const char *av_chroma_location_name(enum AVChromaLocation location)
2983 {
2984 return (unsigned) location < AVCHROMA_LOC_NB ?
2985 chroma_location_names[location] : NULL;
2986 }
2987
av_chroma_location_from_name(const char * name)2988 int av_chroma_location_from_name(const char *name)
2989 {
2990 int i;
2991
2992 for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) {
2993 if (!chroma_location_names[i])
2994 continue;
2995
2996 if (av_strstart(name, chroma_location_names[i], NULL))
2997 return i;
2998 }
2999
3000 return AVERROR(EINVAL);
3001 }
3002