cf2ea9ca40b82f8f7166b3f508c3d89164a53cd8
[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_YUV420P16LE] = {
1178 .name = "yuv420p16le",
1179 .nb_components = 3,
1180 .log2_chroma_w = 1,
1181 .log2_chroma_h = 1,
1182 .comp = {
1183 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1184 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1185 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1186 },
1187 .flags = AV_PIX_FMT_FLAG_PLANAR,
1188 },
1189 [AV_PIX_FMT_YUV420P16BE] = {
1190 .name = "yuv420p16be",
1191 .nb_components = 3,
1192 .log2_chroma_w = 1,
1193 .log2_chroma_h = 1,
1194 .comp = {
1195 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1196 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1197 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1198 },
1199 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1200 },
1201 [AV_PIX_FMT_YUV422P9LE] = {
1202 .name = "yuv422p9le",
1203 .nb_components = 3,
1204 .log2_chroma_w = 1,
1205 .log2_chroma_h = 0,
1206 .comp = {
1207 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1208 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1209 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1210 },
1211 .flags = AV_PIX_FMT_FLAG_PLANAR,
1212 },
1213 [AV_PIX_FMT_YUV422P9BE] = {
1214 .name = "yuv422p9be",
1215 .nb_components = 3,
1216 .log2_chroma_w = 1,
1217 .log2_chroma_h = 0,
1218 .comp = {
1219 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1220 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1221 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1222 },
1223 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1224 },
1225 [AV_PIX_FMT_YUV422P10LE] = {
1226 .name = "yuv422p10le",
1227 .nb_components = 3,
1228 .log2_chroma_w = 1,
1229 .log2_chroma_h = 0,
1230 .comp = {
1231 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1232 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1233 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1234 },
1235 .flags = AV_PIX_FMT_FLAG_PLANAR,
1236 },
1237 [AV_PIX_FMT_YUV422P10BE] = {
1238 .name = "yuv422p10be",
1239 .nb_components = 3,
1240 .log2_chroma_w = 1,
1241 .log2_chroma_h = 0,
1242 .comp = {
1243 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1244 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1245 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1246 },
1247 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1248 },
1249 [AV_PIX_FMT_YUV422P16LE] = {
1250 .name = "yuv422p16le",
1251 .nb_components = 3,
1252 .log2_chroma_w = 1,
1253 .log2_chroma_h = 0,
1254 .comp = {
1255 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1256 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1257 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1258 },
1259 .flags = AV_PIX_FMT_FLAG_PLANAR,
1260 },
1261 [AV_PIX_FMT_YUV422P16BE] = {
1262 .name = "yuv422p16be",
1263 .nb_components = 3,
1264 .log2_chroma_w = 1,
1265 .log2_chroma_h = 0,
1266 .comp = {
1267 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1268 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1269 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1270 },
1271 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1272 },
1273 [AV_PIX_FMT_YUV444P16LE] = {
1274 .name = "yuv444p16le",
1275 .nb_components = 3,
1276 .log2_chroma_w = 0,
1277 .log2_chroma_h = 0,
1278 .comp = {
1279 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1280 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1281 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1282 },
1283 .flags = AV_PIX_FMT_FLAG_PLANAR,
1284 },
1285 [AV_PIX_FMT_YUV444P16BE] = {
1286 .name = "yuv444p16be",
1287 .nb_components = 3,
1288 .log2_chroma_w = 0,
1289 .log2_chroma_h = 0,
1290 .comp = {
1291 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1292 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1293 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1294 },
1295 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1296 },
1297 [AV_PIX_FMT_YUV444P10LE] = {
1298 .name = "yuv444p10le",
1299 .nb_components = 3,
1300 .log2_chroma_w = 0,
1301 .log2_chroma_h = 0,
1302 .comp = {
1303 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1304 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1305 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1306 },
1307 .flags = AV_PIX_FMT_FLAG_PLANAR,
1308 },
1309 [AV_PIX_FMT_YUV444P10BE] = {
1310 .name = "yuv444p10be",
1311 .nb_components = 3,
1312 .log2_chroma_w = 0,
1313 .log2_chroma_h = 0,
1314 .comp = {
1315 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1316 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1317 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1318 },
1319 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1320 },
1321 [AV_PIX_FMT_YUV444P9LE] = {
1322 .name = "yuv444p9le",
1323 .nb_components = 3,
1324 .log2_chroma_w = 0,
1325 .log2_chroma_h = 0,
1326 .comp = {
1327 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1328 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1329 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1330 },
1331 .flags = AV_PIX_FMT_FLAG_PLANAR,
1332 },
1333 [AV_PIX_FMT_YUV444P9BE] = {
1334 .name = "yuv444p9be",
1335 .nb_components = 3,
1336 .log2_chroma_w = 0,
1337 .log2_chroma_h = 0,
1338 .comp = {
1339 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1340 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1341 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1342 },
1343 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1344 },
1345 [AV_PIX_FMT_D3D11VA_VLD] = {
1346 .name = "d3d11va_vld",
1347 .log2_chroma_w = 1,
1348 .log2_chroma_h = 1,
1349 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1350 },
1351 [AV_PIX_FMT_DXVA2_VLD] = {
1352 .name = "dxva2_vld",
1353 .log2_chroma_w = 1,
1354 .log2_chroma_h = 1,
1355 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1356 },
1357 [AV_PIX_FMT_YA8] = {
1358 .name = "ya8",
1359 .nb_components = 2,
1360 .comp = {
1361 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
1362 { 0, 2, 1, 0, 8, 1, 7, 2 }, /* A */
1363 },
1364 .flags = AV_PIX_FMT_FLAG_ALPHA,
1365 .alias = "gray8a",
1366 },
1367 [AV_PIX_FMT_YA16LE] = {
1368 .name = "ya16le",
1369 .nb_components = 2,
1370 .comp = {
1371 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1372 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1373 },
1374 .flags = AV_PIX_FMT_FLAG_ALPHA,
1375 },
1376 [AV_PIX_FMT_YA16BE] = {
1377 .name = "ya16be",
1378 .nb_components = 2,
1379 .comp = {
1380 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1381 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1382 },
1383 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
1384 },
1385 [AV_PIX_FMT_GBRP] = {
1386 .name = "gbrp",
1387 .nb_components = 3,
1388 .log2_chroma_w = 0,
1389 .log2_chroma_h = 0,
1390 .comp = {
1391 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1392 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1393 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1394 },
1395 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1396 },
1397 [AV_PIX_FMT_GBRP9LE] = {
1398 .name = "gbrp9le",
1399 .nb_components = 3,
1400 .log2_chroma_w = 0,
1401 .log2_chroma_h = 0,
1402 .comp = {
1403 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1404 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1405 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1406 },
1407 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1408 },
1409 [AV_PIX_FMT_GBRP9BE] = {
1410 .name = "gbrp9be",
1411 .nb_components = 3,
1412 .log2_chroma_w = 0,
1413 .log2_chroma_h = 0,
1414 .comp = {
1415 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1416 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1417 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1418 },
1419 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1420 },
1421 [AV_PIX_FMT_GBRP10LE] = {
1422 .name = "gbrp10le",
1423 .nb_components = 3,
1424 .log2_chroma_w = 0,
1425 .log2_chroma_h = 0,
1426 .comp = {
1427 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1428 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1429 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1430 },
1431 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1432 },
1433 [AV_PIX_FMT_GBRP10BE] = {
1434 .name = "gbrp10be",
1435 .nb_components = 3,
1436 .log2_chroma_w = 0,
1437 .log2_chroma_h = 0,
1438 .comp = {
1439 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1440 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1441 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1442 },
1443 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1444 },
1445 [AV_PIX_FMT_GBRP16LE] = {
1446 .name = "gbrp16le",
1447 .nb_components = 3,
1448 .log2_chroma_w = 0,
1449 .log2_chroma_h = 0,
1450 .comp = {
1451 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1452 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1453 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1454 },
1455 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1456 },
1457 [AV_PIX_FMT_GBRP16BE] = {
1458 .name = "gbrp16be",
1459 .nb_components = 3,
1460 .log2_chroma_w = 0,
1461 .log2_chroma_h = 0,
1462 .comp = {
1463 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1464 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1465 { 1, 2, 0, 0, 16, 1, 15, 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_GBRAP] = {
1470 .name = "gbrap",
1471 .nb_components = 4,
1472 .log2_chroma_w = 0,
1473 .log2_chroma_h = 0,
1474 .comp = {
1475 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1476 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1477 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1478 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
1479 },
1480 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1481 AV_PIX_FMT_FLAG_ALPHA,
1482 },
1483 [AV_PIX_FMT_GBRAP16LE] = {
1484 .name = "gbrap16le",
1485 .nb_components = 4,
1486 .log2_chroma_w = 0,
1487 .log2_chroma_h = 0,
1488 .comp = {
1489 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1490 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1491 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1492 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1493 },
1494 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1495 AV_PIX_FMT_FLAG_ALPHA,
1496 },
1497 [AV_PIX_FMT_GBRAP16BE] = {
1498 .name = "gbrap16be",
1499 .nb_components = 4,
1500 .log2_chroma_w = 0,
1501 .log2_chroma_h = 0,
1502 .comp = {
1503 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1504 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1505 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1506 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1507 },
1508 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
1509 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1510 },
1511 [AV_PIX_FMT_VDPAU] = {
1512 .name = "vdpau",
1513 .log2_chroma_w = 1,
1514 .log2_chroma_h = 1,
1515 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1516 },
1517 [AV_PIX_FMT_XYZ12LE] = {
1518 .name = "xyz12le",
1519 .nb_components = 3,
1520 .log2_chroma_w = 0,
1521 .log2_chroma_h = 0,
1522 .comp = {
1523 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1524 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1525 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1526 },
1527 /*.flags = -- not used*/
1528 },
1529 [AV_PIX_FMT_XYZ12BE] = {
1530 .name = "xyz12be",
1531 .nb_components = 3,
1532 .log2_chroma_w = 0,
1533 .log2_chroma_h = 0,
1534 .comp = {
1535 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1536 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1537 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1538 },
1539 .flags = AV_PIX_FMT_FLAG_BE,
1540 },
1541 [AV_PIX_FMT_NV16] = {
1542 .name = "nv16",
1543 .nb_components = 3,
1544 .log2_chroma_w = 1,
1545 .log2_chroma_h = 0,
1546 .comp = {
1547 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
1548 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
1549 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
1550 },
1551 .flags = AV_PIX_FMT_FLAG_PLANAR,
1552 },
1553 [AV_PIX_FMT_NV20LE] = {
1554 .name = "nv20le",
1555 .nb_components = 3,
1556 .log2_chroma_w = 1,
1557 .log2_chroma_h = 0,
1558 .comp = {
1559 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1560 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
1561 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
1562 },
1563 .flags = AV_PIX_FMT_FLAG_PLANAR,
1564 },
1565 [AV_PIX_FMT_NV20BE] = {
1566 .name = "nv20be",
1567 .nb_components = 3,
1568 .log2_chroma_w = 1,
1569 .log2_chroma_h = 0,
1570 .comp = {
1571 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1572 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
1573 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
1574 },
1575 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
1576 },
1577 [AV_PIX_FMT_VDA] = {
1578 .name = "vda",
1579 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1580 },
1581 [AV_PIX_FMT_QSV] = {
1582 .name = "qsv",
1583 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1584 },
1585 [AV_PIX_FMT_MMAL] = {
1586 .name = "mmal",
1587 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1588 },
1589 [AV_PIX_FMT_CUDA] = {
1590 .name = "cuda",
1591 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1592 },
1593 [AV_PIX_FMT_P010LE] = {
1594 .name = "p010le",
1595 .nb_components = 3,
1596 .log2_chroma_w = 1,
1597 .log2_chroma_h = 1,
1598 .comp = {
1599 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
1600 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
1601 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
1602 },
1603 .flags = AV_PIX_FMT_FLAG_PLANAR,
1604 },
1605 [AV_PIX_FMT_P010BE] = {
1606 .name = "p010be",
1607 .nb_components = 3,
1608 .log2_chroma_w = 1,
1609 .log2_chroma_h = 1,
1610 .comp = {
1611 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
1612 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
1613 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
1614 },
1615 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
1616 },
1617 };
1618 #if FF_API_PLUS1_MINUS1
1619 FF_ENABLE_DEPRECATION_WARNINGS
1620 #endif
1621
1622 static const char *color_range_names[] = {
1623 [AVCOL_RANGE_UNSPECIFIED] = "unknown",
1624 [AVCOL_RANGE_MPEG] = "tv",
1625 [AVCOL_RANGE_JPEG] = "pc",
1626 };
1627
1628 static const char *color_primaries_names[] = {
1629 [AVCOL_PRI_RESERVED0] = "reserved",
1630 [AVCOL_PRI_BT709] = "bt709",
1631 [AVCOL_PRI_UNSPECIFIED] = "unknown",
1632 [AVCOL_PRI_RESERVED] = "reserved",
1633 [AVCOL_PRI_BT470M] = "bt470m",
1634 [AVCOL_PRI_BT470BG] = "bt470bg",
1635 [AVCOL_PRI_SMPTE170M] = "smpte170m",
1636 [AVCOL_PRI_SMPTE240M] = "smpte240m",
1637 [AVCOL_PRI_FILM] = "film",
1638 [AVCOL_PRI_BT2020] = "bt2020",
1639 [AVCOL_PRI_SMPTE428] = "smpte428",
1640 [AVCOL_PRI_SMPTE431] = "smpte431",
1641 [AVCOL_PRI_SMPTE432] = "smpte432",
1642 };
1643
1644 static const char *color_transfer_names[] = {
1645 [AVCOL_TRC_RESERVED0] = "reserved",
1646 [AVCOL_TRC_BT709] = "bt709",
1647 [AVCOL_TRC_UNSPECIFIED] = "unknown",
1648 [AVCOL_TRC_RESERVED] = "reserved",
1649 [AVCOL_TRC_GAMMA22] = "bt470m",
1650 [AVCOL_TRC_GAMMA28] = "bt470bg",
1651 [AVCOL_TRC_SMPTE170M] = "smpte170m",
1652 [AVCOL_TRC_SMPTE240M] = "smpte240m",
1653 [AVCOL_TRC_LINEAR] = "linear",
1654 [AVCOL_TRC_LOG] = "log100",
1655 [AVCOL_TRC_LOG_SQRT] = "log316",
1656 [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
1657 [AVCOL_TRC_BT1361_ECG] = "bt1361e",
1658 [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
1659 [AVCOL_TRC_BT2020_10] = "bt2020-10",
1660 [AVCOL_TRC_BT2020_12] = "bt2020-12",
1661 [AVCOL_TRC_SMPTE2084] = "smpte2084",
1662 [AVCOL_TRC_SMPTE428] = "smpte428",
1663 [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
1664 };
1665
1666 static const char *color_space_names[] = {
1667 [AVCOL_SPC_RGB] = "gbr",
1668 [AVCOL_SPC_BT709] = "bt709",
1669 [AVCOL_SPC_UNSPECIFIED] = "unknown",
1670 [AVCOL_SPC_RESERVED] = "reserved",
1671 [AVCOL_SPC_FCC] = "fcc",
1672 [AVCOL_SPC_BT470BG] = "bt470bg",
1673 [AVCOL_SPC_SMPTE170M] = "smpte170m",
1674 [AVCOL_SPC_SMPTE240M] = "smpte240m",
1675 [AVCOL_SPC_YCOCG] = "ycgco",
1676 [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
1677 [AVCOL_SPC_BT2020_CL] = "bt2020c",
1678 [AVCOL_SPC_SMPTE2085] = "smpte2085",
1679 };
1680
1681 static const char *chroma_location_names[] = {
1682 [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
1683 [AVCHROMA_LOC_LEFT] = "left",
1684 [AVCHROMA_LOC_CENTER] = "center",
1685 [AVCHROMA_LOC_TOPLEFT] = "topleft",
1686 [AVCHROMA_LOC_TOP] = "top",
1687 [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
1688 [AVCHROMA_LOC_BOTTOM] = "bottom",
1689 };
1690
1691 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
1692 {
1693 enum AVPixelFormat pix_fmt;
1694
1695 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
1696 if (av_pix_fmt_descriptors[pix_fmt].name &&
1697 (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
1698 av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
1699 return pix_fmt;
1700
1701 return AV_PIX_FMT_NONE;
1702 }
1703
1704 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
1705 {
1706 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
1707 av_pix_fmt_descriptors[pix_fmt].name : NULL;
1708 }
1709
1710 #if HAVE_BIGENDIAN
1711 # define X_NE(be, le) be
1712 #else
1713 # define X_NE(be, le) le
1714 #endif
1715
1716 enum AVPixelFormat av_get_pix_fmt(const char *name)
1717 {
1718 enum AVPixelFormat pix_fmt;
1719
1720 if (!strcmp(name, "rgb32"))
1721 name = X_NE("argb", "bgra");
1722 else if (!strcmp(name, "bgr32"))
1723 name = X_NE("abgr", "rgba");
1724
1725 pix_fmt = get_pix_fmt_internal(name);
1726 if (pix_fmt == AV_PIX_FMT_NONE) {
1727 char name2[32];
1728
1729 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
1730 pix_fmt = get_pix_fmt_internal(name2);
1731 }
1732
1733 #if FF_API_VAAPI
1734 if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
1735 pix_fmt = AV_PIX_FMT_VAAPI;
1736 #endif
1737 return pix_fmt;
1738 }
1739
1740 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
1741 {
1742 int c, bits = 0;
1743 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
1744
1745 for (c = 0; c < pixdesc->nb_components; c++) {
1746 int s = c == 1 || c == 2 ? 0 : log2_pixels;
1747 bits += pixdesc->comp[c].depth << s;
1748 }
1749
1750 return bits >> log2_pixels;
1751 }
1752
1753 char *av_get_pix_fmt_string(char *buf, int buf_size,
1754 enum AVPixelFormat pix_fmt)
1755 {
1756 /* print header */
1757 if (pix_fmt < 0) {
1758 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
1759 } else {
1760 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
1761 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
1762 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
1763 }
1764
1765 return buf;
1766 }
1767
1768 const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1769 {
1770 if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1771 return NULL;
1772 return &av_pix_fmt_descriptors[pix_fmt];
1773 }
1774
1775 const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
1776 {
1777 if (!prev)
1778 return &av_pix_fmt_descriptors[0];
1779 if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1)
1780 return prev + 1;
1781 return NULL;
1782 }
1783
1784 enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
1785 {
1786 if (desc < av_pix_fmt_descriptors ||
1787 desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
1788 return AV_PIX_FMT_NONE;
1789
1790 return desc - av_pix_fmt_descriptors;
1791 }
1792
1793 int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
1794 int *h_shift, int *v_shift)
1795 {
1796 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
1797 if (!desc)
1798 return AVERROR(ENOSYS);
1799 *h_shift = desc->log2_chroma_w;
1800 *v_shift = desc->log2_chroma_h;
1801
1802 return 0;
1803 }
1804
1805 int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
1806 {
1807 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
1808 int i, planes[4] = { 0 }, ret = 0;
1809
1810 if (!desc)
1811 return AVERROR(EINVAL);
1812
1813 for (i = 0; i < desc->nb_components; i++)
1814 planes[desc->comp[i].plane] = 1;
1815 for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
1816 ret += planes[i];
1817 return ret;
1818 }
1819
1820
1821 enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
1822 {
1823 #define PIX_FMT_SWAP_ENDIANNESS(fmt) \
1824 case AV_PIX_FMT_ ## fmt ## BE: return AV_PIX_FMT_ ## fmt ## LE; \
1825 case AV_PIX_FMT_ ## fmt ## LE: return AV_PIX_FMT_ ## fmt ## BE
1826
1827 switch (pix_fmt) {
1828 PIX_FMT_SWAP_ENDIANNESS(GRAY16);
1829 PIX_FMT_SWAP_ENDIANNESS(YA16);
1830 PIX_FMT_SWAP_ENDIANNESS(RGB48);
1831 PIX_FMT_SWAP_ENDIANNESS(RGB565);
1832 PIX_FMT_SWAP_ENDIANNESS(RGB555);
1833 PIX_FMT_SWAP_ENDIANNESS(RGB444);
1834 PIX_FMT_SWAP_ENDIANNESS(BGR48);
1835 PIX_FMT_SWAP_ENDIANNESS(BGR565);
1836 PIX_FMT_SWAP_ENDIANNESS(BGR555);
1837 PIX_FMT_SWAP_ENDIANNESS(BGR444);
1838
1839 PIX_FMT_SWAP_ENDIANNESS(YUV420P9);
1840 PIX_FMT_SWAP_ENDIANNESS(YUV422P9);
1841 PIX_FMT_SWAP_ENDIANNESS(YUV444P9);
1842 PIX_FMT_SWAP_ENDIANNESS(YUV420P10);
1843 PIX_FMT_SWAP_ENDIANNESS(YUV422P10);
1844 PIX_FMT_SWAP_ENDIANNESS(YUV444P10);
1845 PIX_FMT_SWAP_ENDIANNESS(YUV420P16);
1846 PIX_FMT_SWAP_ENDIANNESS(YUV422P16);
1847 PIX_FMT_SWAP_ENDIANNESS(YUV444P16);
1848
1849 PIX_FMT_SWAP_ENDIANNESS(GBRP9);
1850 PIX_FMT_SWAP_ENDIANNESS(GBRP10);
1851 PIX_FMT_SWAP_ENDIANNESS(GBRP16);
1852 PIX_FMT_SWAP_ENDIANNESS(YUVA420P9);
1853 PIX_FMT_SWAP_ENDIANNESS(YUVA422P9);
1854 PIX_FMT_SWAP_ENDIANNESS(YUVA444P9);
1855 PIX_FMT_SWAP_ENDIANNESS(YUVA420P10);
1856 PIX_FMT_SWAP_ENDIANNESS(YUVA422P10);
1857 PIX_FMT_SWAP_ENDIANNESS(YUVA444P10);
1858 PIX_FMT_SWAP_ENDIANNESS(YUVA420P16);
1859 PIX_FMT_SWAP_ENDIANNESS(YUVA422P16);
1860 PIX_FMT_SWAP_ENDIANNESS(YUVA444P16);
1861
1862 PIX_FMT_SWAP_ENDIANNESS(XYZ12);
1863 PIX_FMT_SWAP_ENDIANNESS(NV20);
1864 PIX_FMT_SWAP_ENDIANNESS(RGBA64);
1865 PIX_FMT_SWAP_ENDIANNESS(BGRA64);
1866 default:
1867 return AV_PIX_FMT_NONE;
1868 }
1869 #undef PIX_FMT_SWAP_ENDIANNESS
1870 }
1871
1872 const char *av_color_range_name(enum AVColorRange range)
1873 {
1874 return (unsigned) range < AVCOL_RANGE_NB ?
1875 color_range_names[range] : NULL;
1876 }
1877
1878 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
1879 {
1880 return (unsigned) primaries < AVCOL_PRI_NB ?
1881 color_primaries_names[primaries] : NULL;
1882 }
1883
1884 const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
1885 {
1886 return (unsigned) transfer < AVCOL_TRC_NB ?
1887 color_transfer_names[transfer] : NULL;
1888 }
1889
1890 const char *av_color_space_name(enum AVColorSpace space)
1891 {
1892 return (unsigned) space < AVCOL_SPC_NB ?
1893 color_space_names[space] : NULL;
1894 }
1895
1896 const char *av_chroma_location_name(enum AVChromaLocation location)
1897 {
1898 return (unsigned) location < AVCHROMA_LOC_NB ?
1899 chroma_location_names[location] : NULL;
1900 }
1901