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