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