2 * pixel format descriptor
3 * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at>
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
31 #include "intreadwrite.h"
34 void av_read_image_line(uint16_t *dst,
35 const uint8_t *data[4], const int linesize[4],
36 const AVPixFmtDescriptor *desc,
37 int x, int y, int c, int w,
38 int read_pal_component)
40 AVComponentDescriptor comp = desc->comp[c];
41 int plane = comp.plane;
42 int depth = comp.depth;
43 int mask = (1 << depth) - 1;
44 int shift = comp.shift;
46 int flags = desc->flags;
48 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
49 int skip = x * step + comp.offset;
50 const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
51 int shift = 8 - depth - (skip & 7);
54 int val = (*p >> shift) & mask;
55 if (read_pal_component)
56 val = data[1][4*val + c];
63 const uint8_t *p = data[plane] + y * linesize[plane] +
64 x * step + comp.offset;
65 int is_8bit = shift + depth <= 8;
68 p += !!(flags & AV_PIX_FMT_FLAG_BE);
71 int val = is_8bit ? *p :
72 flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p);
73 val = (val >> shift) & mask;
74 if (read_pal_component)
75 val = data[1][4 * val + c];
82 void av_write_image_line(const uint16_t *src,
83 uint8_t *data[4], const int linesize[4],
84 const AVPixFmtDescriptor *desc,
85 int x, int y, int c, int w)
87 AVComponentDescriptor comp = desc->comp[c];
88 int plane = comp.plane;
89 int depth = comp.depth;
91 int flags = desc->flags;
93 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
94 int skip = x * step + comp.offset;
95 uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
96 int shift = 8 - depth - (skip & 7);
99 *p |= *src++ << shift;
105 int shift = comp.shift;
106 uint8_t *p = data[plane] + y * linesize[plane] +
107 x * step + comp.offset;
109 if (shift + depth <= 8) {
110 p += !!(flags & AV_PIX_FMT_FLAG_BE);
112 *p |= (*src++ << shift);
117 if (flags & AV_PIX_FMT_FLAG_BE) {
118 uint16_t val = AV_RB16(p) | (*src++ << shift);
121 uint16_t val = AV_RL16(p) | (*src++ << shift);
130 #if FF_API_PLUS1_MINUS1
131 FF_DISABLE_DEPRECATION_WARNINGS
133 static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
134 [AV_PIX_FMT_YUV420P] = {
140 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
141 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
142 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
144 .flags = AV_PIX_FMT_FLAG_PLANAR,
146 [AV_PIX_FMT_YUYV422] = {
152 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
153 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* U */
154 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* V */
157 [AV_PIX_FMT_YVYU422] = {
163 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
164 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* U */
165 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* V */
168 [AV_PIX_FMT_RGB24] = {
174 { 0, 3, 0, 0, 8, 2, 7, 1 }, /* R */
175 { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
176 { 0, 3, 2, 0, 8, 2, 7, 3 }, /* B */
178 .flags = AV_PIX_FMT_FLAG_RGB,
180 [AV_PIX_FMT_BGR24] = {
186 { 0, 3, 2, 0, 8, 2, 7, 3 }, /* R */
187 { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
188 { 0, 3, 0, 0, 8, 2, 7, 1 }, /* B */
190 .flags = AV_PIX_FMT_FLAG_RGB,
192 [AV_PIX_FMT_YUV422P] = {
198 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
199 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
200 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
202 .flags = AV_PIX_FMT_FLAG_PLANAR,
204 [AV_PIX_FMT_YUV444P] = {
210 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
211 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
212 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
214 .flags = AV_PIX_FMT_FLAG_PLANAR,
216 [AV_PIX_FMT_YUV410P] = {
222 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
223 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
224 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
226 .flags = AV_PIX_FMT_FLAG_PLANAR,
228 [AV_PIX_FMT_YUV411P] = {
234 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
235 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
236 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
238 .flags = AV_PIX_FMT_FLAG_PLANAR,
240 [AV_PIX_FMT_YUVJ411P] = {
246 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
247 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
248 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
250 .flags = AV_PIX_FMT_FLAG_PLANAR,
252 [AV_PIX_FMT_GRAY8] = {
258 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
260 .flags = AV_PIX_FMT_FLAG_PSEUDOPAL,
263 [AV_PIX_FMT_MONOWHITE] = {
269 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* Y */
271 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
273 [AV_PIX_FMT_MONOBLACK] = {
279 { 0, 1, 0, 7, 1, 0, 0, 1 }, /* Y */
281 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
283 [AV_PIX_FMT_PAL8] = {
289 { 0, 1, 0, 0, 8, 0, 7, 1 },
291 .flags = AV_PIX_FMT_FLAG_PAL,
293 [AV_PIX_FMT_YUVJ420P] = {
299 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
300 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
301 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
303 .flags = AV_PIX_FMT_FLAG_PLANAR,
305 [AV_PIX_FMT_YUVJ422P] = {
311 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
312 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
313 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
315 .flags = AV_PIX_FMT_FLAG_PLANAR,
317 [AV_PIX_FMT_YUVJ444P] = {
323 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
324 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
325 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
327 .flags = AV_PIX_FMT_FLAG_PLANAR,
330 [AV_PIX_FMT_XVMC_MPEG2_MC] = {
332 .flags = AV_PIX_FMT_FLAG_HWACCEL,
334 [AV_PIX_FMT_XVMC_MPEG2_IDCT] = {
336 .flags = AV_PIX_FMT_FLAG_HWACCEL,
338 #endif /* FF_API_XVMC */
340 [AV_PIX_FMT_XVMC] = {
342 .flags = AV_PIX_FMT_FLAG_HWACCEL,
344 #endif /* !FF_API_XVMC */
345 [AV_PIX_FMT_UYVY422] = {
351 { 0, 2, 1, 0, 8, 1, 7, 2 }, /* Y */
352 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* U */
353 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* V */
356 [AV_PIX_FMT_UYYVYY411] = {
362 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* Y */
363 { 0, 6, 0, 0, 8, 5, 7, 1 }, /* U */
364 { 0, 6, 3, 0, 8, 5, 7, 4 }, /* V */
367 [AV_PIX_FMT_BGR8] = {
373 { 0, 1, 0, 0, 3, 0, 2, 1 }, /* R */
374 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
375 { 0, 1, 0, 6, 2, 0, 1, 1 }, /* B */
377 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
379 [AV_PIX_FMT_BGR4] = {
385 { 0, 4, 3, 0, 1, 3, 0, 4 }, /* R */
386 { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
387 { 0, 4, 0, 0, 1, 3, 0, 1 }, /* B */
389 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
391 [AV_PIX_FMT_BGR4_BYTE] = {
397 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* R */
398 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
399 { 0, 1, 0, 3, 1, 0, 0, 1 }, /* B */
401 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
403 [AV_PIX_FMT_RGB8] = {
409 { 0, 1, 0, 6, 2, 0, 1, 1 }, /* R */
410 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
411 { 0, 1, 0, 0, 3, 0, 2, 1 }, /* B */
413 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
415 [AV_PIX_FMT_RGB4] = {
421 { 0, 4, 0, 0, 1, 3, 0, 1 }, /* R */
422 { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
423 { 0, 4, 3, 0, 1, 3, 0, 4 }, /* B */
425 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
427 [AV_PIX_FMT_RGB4_BYTE] = {
433 { 0, 1, 0, 3, 1, 0, 0, 1 }, /* R */
434 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
435 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* B */
437 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
439 [AV_PIX_FMT_NV12] = {
445 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
446 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
447 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
449 .flags = AV_PIX_FMT_FLAG_PLANAR,
451 [AV_PIX_FMT_NV21] = {
457 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
458 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */
459 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */
461 .flags = AV_PIX_FMT_FLAG_PLANAR,
463 [AV_PIX_FMT_ARGB] = {
469 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
470 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
471 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
472 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
474 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
476 [AV_PIX_FMT_RGBA] = {
482 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
483 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
484 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
485 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
487 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
489 [AV_PIX_FMT_ABGR] = {
495 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
496 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
497 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
498 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
500 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
502 [AV_PIX_FMT_BGRA] = {
508 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
509 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
510 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
511 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
513 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
515 [AV_PIX_FMT_0RGB] = {
521 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
522 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
523 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
525 .flags = AV_PIX_FMT_FLAG_RGB,
527 [AV_PIX_FMT_RGB0] = {
533 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
534 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
535 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
537 .flags = AV_PIX_FMT_FLAG_RGB,
539 [AV_PIX_FMT_0BGR] = {
545 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
546 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
547 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
549 .flags = AV_PIX_FMT_FLAG_RGB,
551 [AV_PIX_FMT_BGR0] = {
557 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
558 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
559 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
561 .flags = AV_PIX_FMT_FLAG_RGB,
563 [AV_PIX_FMT_GRAY10BE] = {
569 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
571 .flags = AV_PIX_FMT_FLAG_BE,
574 [AV_PIX_FMT_GRAY10LE] = {
580 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
584 [AV_PIX_FMT_GRAY12BE] = {
590 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
592 .flags = AV_PIX_FMT_FLAG_BE,
595 [AV_PIX_FMT_GRAY12LE] = {
601 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
605 [AV_PIX_FMT_GRAY16BE] = {
611 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
613 .flags = AV_PIX_FMT_FLAG_BE,
616 [AV_PIX_FMT_GRAY16LE] = {
622 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
626 [AV_PIX_FMT_YUV440P] = {
632 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
633 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
634 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
636 .flags = AV_PIX_FMT_FLAG_PLANAR,
638 [AV_PIX_FMT_YUVJ440P] = {
644 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
645 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
646 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
648 .flags = AV_PIX_FMT_FLAG_PLANAR,
650 [AV_PIX_FMT_YUV440P10LE] = {
651 .name = "yuv440p10le",
656 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
657 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
658 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
660 .flags = AV_PIX_FMT_FLAG_PLANAR,
662 [AV_PIX_FMT_YUV440P10BE] = {
663 .name = "yuv440p10be",
668 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
669 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
670 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
672 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
674 [AV_PIX_FMT_YUV440P12LE] = {
675 .name = "yuv440p12le",
680 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
681 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
682 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
684 .flags = AV_PIX_FMT_FLAG_PLANAR,
686 [AV_PIX_FMT_YUV440P12BE] = {
687 .name = "yuv440p12be",
692 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
693 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
694 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
696 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
698 [AV_PIX_FMT_YUVA420P] = {
704 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
705 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
706 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
707 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
709 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
711 [AV_PIX_FMT_YUVA422P] = {
717 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
718 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
719 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
720 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
722 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
724 [AV_PIX_FMT_YUVA444P] = {
730 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
731 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
732 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
733 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
735 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
737 [AV_PIX_FMT_YUVA420P9BE] = {
738 .name = "yuva420p9be",
743 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
744 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
745 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
746 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
748 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
750 [AV_PIX_FMT_YUVA420P9LE] = {
751 .name = "yuva420p9le",
756 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
757 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
758 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
759 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
761 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
763 [AV_PIX_FMT_YUVA422P9BE] = {
764 .name = "yuva422p9be",
769 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
770 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
771 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
772 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
774 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
776 [AV_PIX_FMT_YUVA422P9LE] = {
777 .name = "yuva422p9le",
782 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
783 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
784 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
785 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
787 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
789 [AV_PIX_FMT_YUVA444P9BE] = {
790 .name = "yuva444p9be",
795 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
796 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
797 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
798 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
800 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
802 [AV_PIX_FMT_YUVA444P9LE] = {
803 .name = "yuva444p9le",
808 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
809 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
810 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
811 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
813 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
815 [AV_PIX_FMT_YUVA420P10BE] = {
816 .name = "yuva420p10be",
821 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
822 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
823 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
824 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
826 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
828 [AV_PIX_FMT_YUVA420P10LE] = {
829 .name = "yuva420p10le",
834 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
835 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
836 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
837 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
839 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
841 [AV_PIX_FMT_YUVA422P10BE] = {
842 .name = "yuva422p10be",
847 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
848 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
849 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
850 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
852 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
854 [AV_PIX_FMT_YUVA422P10LE] = {
855 .name = "yuva422p10le",
860 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
861 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
862 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
863 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
865 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
867 [AV_PIX_FMT_YUVA444P10BE] = {
868 .name = "yuva444p10be",
873 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
874 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
875 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
876 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
878 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
880 [AV_PIX_FMT_YUVA444P10LE] = {
881 .name = "yuva444p10le",
886 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
887 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
888 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
889 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
891 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
893 [AV_PIX_FMT_YUVA420P16BE] = {
894 .name = "yuva420p16be",
899 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
900 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
901 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
902 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
904 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
906 [AV_PIX_FMT_YUVA420P16LE] = {
907 .name = "yuva420p16le",
912 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
913 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
914 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
915 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
917 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
919 [AV_PIX_FMT_YUVA422P16BE] = {
920 .name = "yuva422p16be",
925 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
926 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
927 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
928 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
930 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
932 [AV_PIX_FMT_YUVA422P16LE] = {
933 .name = "yuva422p16le",
938 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
939 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
940 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
941 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
943 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
945 [AV_PIX_FMT_YUVA444P16BE] = {
946 .name = "yuva444p16be",
951 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
952 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
953 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
954 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
956 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
958 [AV_PIX_FMT_YUVA444P16LE] = {
959 .name = "yuva444p16le",
964 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
965 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
966 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
967 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
969 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
972 [AV_PIX_FMT_VDPAU_H264] = {
973 .name = "vdpau_h264",
976 .flags = AV_PIX_FMT_FLAG_HWACCEL,
978 [AV_PIX_FMT_VDPAU_MPEG1] = {
979 .name = "vdpau_mpeg1",
982 .flags = AV_PIX_FMT_FLAG_HWACCEL,
984 [AV_PIX_FMT_VDPAU_MPEG2] = {
985 .name = "vdpau_mpeg2",
988 .flags = AV_PIX_FMT_FLAG_HWACCEL,
990 [AV_PIX_FMT_VDPAU_WMV3] = {
991 .name = "vdpau_wmv3",
994 .flags = AV_PIX_FMT_FLAG_HWACCEL,
996 [AV_PIX_FMT_VDPAU_VC1] = {
1000 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1002 [AV_PIX_FMT_VDPAU_MPEG4] = {
1003 .name = "vdpau_mpeg4",
1006 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1009 [AV_PIX_FMT_RGB48BE] = {
1015 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
1016 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1017 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
1019 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
1021 [AV_PIX_FMT_RGB48LE] = {
1027 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
1028 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1029 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
1031 .flags = AV_PIX_FMT_FLAG_RGB,
1033 [AV_PIX_FMT_RGBA64BE] = {
1039 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
1040 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1041 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1042 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1044 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1046 [AV_PIX_FMT_RGBA64LE] = {
1052 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
1053 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1054 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1055 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1057 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1059 [AV_PIX_FMT_RGB565BE] = {
1065 { 0, 2, -1, 3, 5, 1, 4, 0 }, /* R */
1066 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1067 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1069 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1071 [AV_PIX_FMT_RGB565LE] = {
1077 { 0, 2, 1, 3, 5, 1, 4, 2 }, /* R */
1078 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1079 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1081 .flags = AV_PIX_FMT_FLAG_RGB,
1083 [AV_PIX_FMT_RGB555BE] = {
1089 { 0, 2, -1, 2, 5, 1, 4, 0 }, /* R */
1090 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1091 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1093 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1095 [AV_PIX_FMT_RGB555LE] = {
1101 { 0, 2, 1, 2, 5, 1, 4, 2 }, /* R */
1102 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1103 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1105 .flags = AV_PIX_FMT_FLAG_RGB,
1107 [AV_PIX_FMT_RGB444BE] = {
1113 { 0, 2, -1, 0, 4, 1, 3, 0 }, /* R */
1114 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1115 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1117 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1119 [AV_PIX_FMT_RGB444LE] = {
1125 { 0, 2, 1, 0, 4, 1, 3, 2 }, /* R */
1126 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1127 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1129 .flags = AV_PIX_FMT_FLAG_RGB,
1131 [AV_PIX_FMT_BGR48BE] = {
1137 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1138 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1139 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1141 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1143 [AV_PIX_FMT_BGR48LE] = {
1149 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1150 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1151 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1153 .flags = AV_PIX_FMT_FLAG_RGB,
1155 [AV_PIX_FMT_BGRA64BE] = {
1161 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1162 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1163 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1164 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1166 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1168 [AV_PIX_FMT_BGRA64LE] = {
1174 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1175 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1176 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1177 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1179 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1181 [AV_PIX_FMT_BGR565BE] = {
1187 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1188 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1189 { 0, 2, -1, 3, 5, 1, 4, 0 }, /* B */
1191 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1193 [AV_PIX_FMT_BGR565LE] = {
1199 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1200 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1201 { 0, 2, 1, 3, 5, 1, 4, 2 }, /* B */
1203 .flags = AV_PIX_FMT_FLAG_RGB,
1205 [AV_PIX_FMT_BGR555BE] = {
1211 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1212 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1213 { 0, 2, -1, 2, 5, 1, 4, 0 }, /* B */
1215 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1217 [AV_PIX_FMT_BGR555LE] = {
1223 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1224 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1225 { 0, 2, 1, 2, 5, 1, 4, 2 }, /* B */
1227 .flags = AV_PIX_FMT_FLAG_RGB,
1229 [AV_PIX_FMT_BGR444BE] = {
1235 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1236 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1237 { 0, 2, -1, 0, 4, 1, 3, 0 }, /* B */
1239 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1241 [AV_PIX_FMT_BGR444LE] = {
1247 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1248 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1249 { 0, 2, 1, 0, 4, 1, 3, 2 }, /* B */
1251 .flags = AV_PIX_FMT_FLAG_RGB,
1254 [AV_PIX_FMT_VAAPI_MOCO] = {
1255 .name = "vaapi_moco",
1258 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1260 [AV_PIX_FMT_VAAPI_IDCT] = {
1261 .name = "vaapi_idct",
1264 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1266 [AV_PIX_FMT_VAAPI_VLD] = {
1267 .name = "vaapi_vld",
1270 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1273 [AV_PIX_FMT_VAAPI] = {
1277 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1280 [AV_PIX_FMT_YUV420P9LE] = {
1281 .name = "yuv420p9le",
1286 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1287 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1288 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1290 .flags = AV_PIX_FMT_FLAG_PLANAR,
1292 [AV_PIX_FMT_YUV420P9BE] = {
1293 .name = "yuv420p9be",
1298 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1299 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1300 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1302 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1304 [AV_PIX_FMT_YUV420P10LE] = {
1305 .name = "yuv420p10le",
1310 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1311 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1312 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1314 .flags = AV_PIX_FMT_FLAG_PLANAR,
1316 [AV_PIX_FMT_YUV420P10BE] = {
1317 .name = "yuv420p10be",
1322 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1323 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1324 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1326 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1328 [AV_PIX_FMT_YUV420P12LE] = {
1329 .name = "yuv420p12le",
1334 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1335 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1336 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1338 .flags = AV_PIX_FMT_FLAG_PLANAR,
1340 [AV_PIX_FMT_YUV420P12BE] = {
1341 .name = "yuv420p12be",
1346 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1347 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1348 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1350 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1352 [AV_PIX_FMT_YUV420P14LE] = {
1353 .name = "yuv420p14le",
1358 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1359 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1360 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1362 .flags = AV_PIX_FMT_FLAG_PLANAR,
1364 [AV_PIX_FMT_YUV420P14BE] = {
1365 .name = "yuv420p14be",
1370 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1371 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1372 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1374 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1376 [AV_PIX_FMT_YUV420P16LE] = {
1377 .name = "yuv420p16le",
1382 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1383 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1384 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1386 .flags = AV_PIX_FMT_FLAG_PLANAR,
1388 [AV_PIX_FMT_YUV420P16BE] = {
1389 .name = "yuv420p16be",
1394 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1395 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1396 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1398 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1400 [AV_PIX_FMT_YUV422P9LE] = {
1401 .name = "yuv422p9le",
1406 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1407 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1408 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1410 .flags = AV_PIX_FMT_FLAG_PLANAR,
1412 [AV_PIX_FMT_YUV422P9BE] = {
1413 .name = "yuv422p9be",
1418 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1419 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1420 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1422 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1424 [AV_PIX_FMT_YUV422P10LE] = {
1425 .name = "yuv422p10le",
1430 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1431 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1432 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1434 .flags = AV_PIX_FMT_FLAG_PLANAR,
1436 [AV_PIX_FMT_YUV422P10BE] = {
1437 .name = "yuv422p10be",
1442 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1443 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1444 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1446 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1448 [AV_PIX_FMT_YUV422P12LE] = {
1449 .name = "yuv422p12le",
1454 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1455 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1456 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1458 .flags = AV_PIX_FMT_FLAG_PLANAR,
1460 [AV_PIX_FMT_YUV422P12BE] = {
1461 .name = "yuv422p12be",
1466 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1467 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1468 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1470 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1472 [AV_PIX_FMT_YUV422P14LE] = {
1473 .name = "yuv422p14le",
1478 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1479 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1480 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1482 .flags = AV_PIX_FMT_FLAG_PLANAR,
1484 [AV_PIX_FMT_YUV422P14BE] = {
1485 .name = "yuv422p14be",
1490 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1491 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1492 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1494 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1496 [AV_PIX_FMT_YUV422P16LE] = {
1497 .name = "yuv422p16le",
1502 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1503 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1504 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1506 .flags = AV_PIX_FMT_FLAG_PLANAR,
1508 [AV_PIX_FMT_YUV422P16BE] = {
1509 .name = "yuv422p16be",
1514 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1515 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1516 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1518 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1520 [AV_PIX_FMT_YUV444P16LE] = {
1521 .name = "yuv444p16le",
1526 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1527 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1528 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1530 .flags = AV_PIX_FMT_FLAG_PLANAR,
1532 [AV_PIX_FMT_YUV444P16BE] = {
1533 .name = "yuv444p16be",
1538 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1539 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1540 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1542 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1544 [AV_PIX_FMT_YUV444P10LE] = {
1545 .name = "yuv444p10le",
1550 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1551 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1552 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1554 .flags = AV_PIX_FMT_FLAG_PLANAR,
1556 [AV_PIX_FMT_YUV444P10BE] = {
1557 .name = "yuv444p10be",
1562 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1563 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1564 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1566 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1568 [AV_PIX_FMT_YUV444P9LE] = {
1569 .name = "yuv444p9le",
1574 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1575 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1576 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1578 .flags = AV_PIX_FMT_FLAG_PLANAR,
1580 [AV_PIX_FMT_YUV444P9BE] = {
1581 .name = "yuv444p9be",
1586 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1587 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1588 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1590 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1592 [AV_PIX_FMT_YUV444P12LE] = {
1593 .name = "yuv444p12le",
1598 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1599 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1600 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1602 .flags = AV_PIX_FMT_FLAG_PLANAR,
1604 [AV_PIX_FMT_YUV444P12BE] = {
1605 .name = "yuv444p12be",
1610 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1611 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1612 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1614 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1616 [AV_PIX_FMT_YUV444P14LE] = {
1617 .name = "yuv444p14le",
1622 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1623 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1624 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1626 .flags = AV_PIX_FMT_FLAG_PLANAR,
1628 [AV_PIX_FMT_YUV444P14BE] = {
1629 .name = "yuv444p14be",
1634 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1635 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1636 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1638 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1640 [AV_PIX_FMT_D3D11VA_VLD] = {
1641 .name = "d3d11va_vld",
1644 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1646 [AV_PIX_FMT_DXVA2_VLD] = {
1647 .name = "dxva2_vld",
1650 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1652 [AV_PIX_FMT_VDA_VLD] = {
1656 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1658 [AV_PIX_FMT_YA8] = {
1662 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
1663 { 0, 2, 1, 0, 8, 1, 7, 2 }, /* A */
1665 .flags = AV_PIX_FMT_FLAG_ALPHA,
1668 [AV_PIX_FMT_YA16LE] = {
1672 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1673 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1675 .flags = AV_PIX_FMT_FLAG_ALPHA,
1677 [AV_PIX_FMT_YA16BE] = {
1681 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1682 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1684 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
1686 [AV_PIX_FMT_VIDEOTOOLBOX] = {
1687 .name = "videotoolbox_vld",
1688 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1690 [AV_PIX_FMT_GBRP] = {
1696 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1697 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1698 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1700 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1702 [AV_PIX_FMT_GBRP9LE] = {
1708 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1709 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1710 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1712 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1714 [AV_PIX_FMT_GBRP9BE] = {
1720 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1721 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1722 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1724 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1726 [AV_PIX_FMT_GBRP10LE] = {
1732 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1733 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1734 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1736 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1738 [AV_PIX_FMT_GBRP10BE] = {
1744 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1745 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1746 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1748 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1750 [AV_PIX_FMT_GBRP12LE] = {
1756 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1757 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1758 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1760 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1762 [AV_PIX_FMT_GBRP12BE] = {
1768 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1769 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1770 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1772 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1774 [AV_PIX_FMT_GBRP14LE] = {
1780 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1781 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1782 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1784 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1786 [AV_PIX_FMT_GBRP14BE] = {
1792 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1793 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1794 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1796 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1798 [AV_PIX_FMT_GBRP16LE] = {
1804 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1805 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1806 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1808 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1810 [AV_PIX_FMT_GBRP16BE] = {
1816 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1817 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1818 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1820 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1822 [AV_PIX_FMT_GBRAP] = {
1828 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1829 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1830 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1831 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
1833 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1834 AV_PIX_FMT_FLAG_ALPHA,
1836 [AV_PIX_FMT_GBRAP16LE] = {
1837 .name = "gbrap16le",
1842 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1843 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1844 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1845 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1847 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1848 AV_PIX_FMT_FLAG_ALPHA,
1850 [AV_PIX_FMT_GBRAP16BE] = {
1851 .name = "gbrap16be",
1856 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1857 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1858 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1859 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1861 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
1862 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1864 [AV_PIX_FMT_VDPAU] = {
1868 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1870 [AV_PIX_FMT_XYZ12LE] = {
1876 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1877 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1878 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1880 /*.flags = -- not used*/
1882 [AV_PIX_FMT_XYZ12BE] = {
1888 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1889 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1890 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1892 .flags = AV_PIX_FMT_FLAG_BE,
1895 #define BAYER8_DESC_COMMON \
1896 .nb_components= 3, \
1897 .log2_chroma_w= 0, \
1898 .log2_chroma_h= 0, \
1905 #define BAYER16_DESC_COMMON \
1906 .nb_components= 3, \
1907 .log2_chroma_w= 0, \
1908 .log2_chroma_h= 0, \
1915 [AV_PIX_FMT_BAYER_BGGR8] = {
1916 .name = "bayer_bggr8",
1918 .flags = AV_PIX_FMT_FLAG_RGB,
1920 [AV_PIX_FMT_BAYER_BGGR16LE] = {
1921 .name = "bayer_bggr16le",
1923 .flags = AV_PIX_FMT_FLAG_RGB,
1925 [AV_PIX_FMT_BAYER_BGGR16BE] = {
1926 .name = "bayer_bggr16be",
1928 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1930 [AV_PIX_FMT_BAYER_RGGB8] = {
1931 .name = "bayer_rggb8",
1933 .flags = AV_PIX_FMT_FLAG_RGB,
1935 [AV_PIX_FMT_BAYER_RGGB16LE] = {
1936 .name = "bayer_rggb16le",
1938 .flags = AV_PIX_FMT_FLAG_RGB,
1940 [AV_PIX_FMT_BAYER_RGGB16BE] = {
1941 .name = "bayer_rggb16be",
1943 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1945 [AV_PIX_FMT_BAYER_GBRG8] = {
1946 .name = "bayer_gbrg8",
1948 .flags = AV_PIX_FMT_FLAG_RGB,
1950 [AV_PIX_FMT_BAYER_GBRG16LE] = {
1951 .name = "bayer_gbrg16le",
1953 .flags = AV_PIX_FMT_FLAG_RGB,
1955 [AV_PIX_FMT_BAYER_GBRG16BE] = {
1956 .name = "bayer_gbrg16be",
1958 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1960 [AV_PIX_FMT_BAYER_GRBG8] = {
1961 .name = "bayer_grbg8",
1963 .flags = AV_PIX_FMT_FLAG_RGB,
1965 [AV_PIX_FMT_BAYER_GRBG16LE] = {
1966 .name = "bayer_grbg16le",
1968 .flags = AV_PIX_FMT_FLAG_RGB,
1970 [AV_PIX_FMT_BAYER_GRBG16BE] = {
1971 .name = "bayer_grbg16be",
1973 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1975 [AV_PIX_FMT_NV16] = {
1981 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
1982 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
1983 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
1985 .flags = AV_PIX_FMT_FLAG_PLANAR,
1987 [AV_PIX_FMT_NV20LE] = {
1993 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1994 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
1995 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
1997 .flags = AV_PIX_FMT_FLAG_PLANAR,
1999 [AV_PIX_FMT_NV20BE] = {
2005 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
2006 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
2007 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
2009 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2011 [AV_PIX_FMT_VDA] = {
2013 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2015 [AV_PIX_FMT_QSV] = {
2017 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2019 [AV_PIX_FMT_MEDIACODEC] = {
2020 .name = "mediacodec",
2021 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2023 [AV_PIX_FMT_MMAL] = {
2025 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2027 [AV_PIX_FMT_CUDA] = {
2029 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2031 [AV_PIX_FMT_AYUV64LE] = {
2037 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
2038 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2039 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2040 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2042 .flags = AV_PIX_FMT_FLAG_ALPHA,
2044 [AV_PIX_FMT_AYUV64BE] = {
2050 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
2051 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2052 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2053 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2055 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
2057 [AV_PIX_FMT_P010LE] = {
2063 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2064 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2065 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2067 .flags = AV_PIX_FMT_FLAG_PLANAR,
2069 [AV_PIX_FMT_P010BE] = {
2075 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2076 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2077 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2079 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2081 [AV_PIX_FMT_P016LE] = {
2087 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
2088 { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
2089 { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
2091 .flags = AV_PIX_FMT_FLAG_PLANAR,
2093 [AV_PIX_FMT_P016BE] = {
2099 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
2100 { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
2101 { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
2103 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2105 [AV_PIX_FMT_GBRAP12LE] = {
2106 .name = "gbrap12le",
2111 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2112 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2113 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2114 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2116 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2117 AV_PIX_FMT_FLAG_ALPHA,
2119 [AV_PIX_FMT_GBRAP12BE] = {
2120 .name = "gbrap12be",
2125 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2126 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2127 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2128 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2130 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2131 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2133 [AV_PIX_FMT_GBRAP10LE] = {
2134 .name = "gbrap10le",
2139 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2140 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2141 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2142 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2144 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2145 AV_PIX_FMT_FLAG_ALPHA,
2147 [AV_PIX_FMT_GBRAP10BE] = {
2148 .name = "gbrap10be",
2153 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2154 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2155 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2156 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2158 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2159 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2162 #if FF_API_PLUS1_MINUS1
2163 FF_ENABLE_DEPRECATION_WARNINGS
2166 static const char *color_range_names[] = {
2167 [AVCOL_RANGE_UNSPECIFIED] = "unknown",
2168 [AVCOL_RANGE_MPEG] = "tv",
2169 [AVCOL_RANGE_JPEG] = "pc",
2172 static const char *color_primaries_names[AVCOL_PRI_NB] = {
2173 [AVCOL_PRI_RESERVED0] = "reserved",
2174 [AVCOL_PRI_BT709] = "bt709",
2175 [AVCOL_PRI_UNSPECIFIED] = "unknown",
2176 [AVCOL_PRI_RESERVED] = "reserved",
2177 [AVCOL_PRI_BT470M] = "bt470m",
2178 [AVCOL_PRI_BT470BG] = "bt470bg",
2179 [AVCOL_PRI_SMPTE170M] = "smpte170m",
2180 [AVCOL_PRI_SMPTE240M] = "smpte240m",
2181 [AVCOL_PRI_FILM] = "film",
2182 [AVCOL_PRI_BT2020] = "bt2020",
2183 [AVCOL_PRI_SMPTE428] = "smpte428",
2184 [AVCOL_PRI_SMPTE431] = "smpte431",
2185 [AVCOL_PRI_SMPTE432] = "smpte432",
2188 static const char *color_transfer_names[] = {
2189 [AVCOL_TRC_RESERVED0] = "reserved",
2190 [AVCOL_TRC_BT709] = "bt709",
2191 [AVCOL_TRC_UNSPECIFIED] = "unknown",
2192 [AVCOL_TRC_RESERVED] = "reserved",
2193 [AVCOL_TRC_GAMMA22] = "bt470m",
2194 [AVCOL_TRC_GAMMA28] = "bt470bg",
2195 [AVCOL_TRC_SMPTE170M] = "smpte170m",
2196 [AVCOL_TRC_SMPTE240M] = "smpte240m",
2197 [AVCOL_TRC_LINEAR] = "linear",
2198 [AVCOL_TRC_LOG] = "log100",
2199 [AVCOL_TRC_LOG_SQRT] = "log316",
2200 [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
2201 [AVCOL_TRC_BT1361_ECG] = "bt1361e",
2202 [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
2203 [AVCOL_TRC_BT2020_10] = "bt2020-10",
2204 [AVCOL_TRC_BT2020_12] = "bt2020-12",
2205 [AVCOL_TRC_SMPTE2084] = "smpte2084",
2206 [AVCOL_TRC_SMPTE428] = "smpte428",
2207 [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
2210 static const char *color_space_names[] = {
2211 [AVCOL_SPC_RGB] = "gbr",
2212 [AVCOL_SPC_BT709] = "bt709",
2213 [AVCOL_SPC_UNSPECIFIED] = "unknown",
2214 [AVCOL_SPC_RESERVED] = "reserved",
2215 [AVCOL_SPC_FCC] = "fcc",
2216 [AVCOL_SPC_BT470BG] = "bt470bg",
2217 [AVCOL_SPC_SMPTE170M] = "smpte170m",
2218 [AVCOL_SPC_SMPTE240M] = "smpte240m",
2219 [AVCOL_SPC_YCOCG] = "ycgco",
2220 [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
2221 [AVCOL_SPC_BT2020_CL] = "bt2020c",
2222 [AVCOL_SPC_SMPTE2085] = "smpte2085",
2225 static const char *chroma_location_names[] = {
2226 [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
2227 [AVCHROMA_LOC_LEFT] = "left",
2228 [AVCHROMA_LOC_CENTER] = "center",
2229 [AVCHROMA_LOC_TOPLEFT] = "topleft",
2230 [AVCHROMA_LOC_TOP] = "top",
2231 [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
2232 [AVCHROMA_LOC_BOTTOM] = "bottom",
2235 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
2237 enum AVPixelFormat pix_fmt;
2239 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
2240 if (av_pix_fmt_descriptors[pix_fmt].name &&
2241 (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
2242 av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
2245 return AV_PIX_FMT_NONE;
2248 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
2250 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
2251 av_pix_fmt_descriptors[pix_fmt].name : NULL;
2255 # define X_NE(be, le) be
2257 # define X_NE(be, le) le
2260 enum AVPixelFormat av_get_pix_fmt(const char *name)
2262 enum AVPixelFormat pix_fmt;
2264 if (!strcmp(name, "rgb32"))
2265 name = X_NE("argb", "bgra");
2266 else if (!strcmp(name, "bgr32"))
2267 name = X_NE("abgr", "rgba");
2269 pix_fmt = get_pix_fmt_internal(name);
2270 if (pix_fmt == AV_PIX_FMT_NONE) {
2273 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
2274 pix_fmt = get_pix_fmt_internal(name2);
2278 if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
2279 pix_fmt = AV_PIX_FMT_VAAPI;
2284 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
2287 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2289 for (c = 0; c < pixdesc->nb_components; c++) {
2290 int s = c == 1 || c == 2 ? 0 : log2_pixels;
2291 bits += pixdesc->comp[c].depth << s;
2294 return bits >> log2_pixels;
2297 int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
2300 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2303 for (c = 0; c < pixdesc->nb_components; c++) {
2304 const AVComponentDescriptor *comp = &pixdesc->comp[c];
2305 int s = c == 1 || c == 2 ? 0 : log2_pixels;
2306 steps[comp->plane] = comp->step << s;
2308 for (c = 0; c < 4; c++)
2311 if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
2314 return bits >> log2_pixels;
2317 char *av_get_pix_fmt_string(char *buf, int buf_size,
2318 enum AVPixelFormat pix_fmt)
2322 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
2324 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
2325 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
2326 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
2332 const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
2334 if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
2336 return &av_pix_fmt_descriptors[pix_fmt];
2339 const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
2342 return &av_pix_fmt_descriptors[0];
2343 while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
2351 enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
2353 if (desc < av_pix_fmt_descriptors ||
2354 desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
2355 return AV_PIX_FMT_NONE;
2357 return desc - av_pix_fmt_descriptors;
2360 int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
2361 int *h_shift, int *v_shift)
2363 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2365 return AVERROR(ENOSYS);
2366 *h_shift = desc->log2_chroma_w;
2367 *v_shift = desc->log2_chroma_h;
2372 int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
2374 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2375 int i, planes[4] = { 0 }, ret = 0;
2378 return AVERROR(EINVAL);
2380 for (i = 0; i < desc->nb_components; i++)
2381 planes[desc->comp[i].plane] = 1;
2382 for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
2387 void ff_check_pixfmt_descriptors(void){
2390 for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
2391 const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
2392 uint8_t fill[4][8+6+3] = {{0}};
2393 uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
2394 int linesize[4] = {0,0,0,0};
2397 if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
2399 // av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
2400 av_assert0(d->log2_chroma_w <= 3);
2401 av_assert0(d->log2_chroma_h <= 3);
2402 av_assert0(d->nb_components <= 4);
2403 av_assert0(d->name && d->name[0]);
2404 av_assert0((d->nb_components==4 || d->nb_components==2) == !!(d->flags & AV_PIX_FMT_FLAG_ALPHA));
2405 av_assert2(av_get_pix_fmt(d->name) == i);
2407 for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
2408 const AVComponentDescriptor *c = &d->comp[j];
2409 if(j>=d->nb_components) {
2410 av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
2413 if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
2414 av_assert0(c->step >= c->depth);
2416 av_assert0(8*c->step >= c->depth);
2418 if (!strncmp(d->name, "bayer_", 6))
2420 av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
2421 av_assert0(tmp[0] == 0 && tmp[1] == 0);
2422 tmp[0] = tmp[1] = (1<<c->depth) - 1;
2423 av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
2429 enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
2431 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2435 if (!desc || strlen(desc->name) < 2)
2436 return AV_PIX_FMT_NONE;
2437 av_strlcpy(name, desc->name, sizeof(name));
2438 i = strlen(name) - 2;
2439 if (strcmp(name + i, "be") && strcmp(name + i, "le"))
2440 return AV_PIX_FMT_NONE;
2442 name[i] ^= 'b' ^ 'l';
2444 return get_pix_fmt_internal(name);
2447 #define FF_COLOR_NA -1
2448 #define FF_COLOR_RGB 0 /**< RGB color space */
2449 #define FF_COLOR_GRAY 1 /**< gray color space */
2450 #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
2451 #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
2452 #define FF_COLOR_XYZ 4
2454 #define pixdesc_has_alpha(pixdesc) \
2455 ((pixdesc)->nb_components == 2 || (pixdesc)->nb_components == 4 || (pixdesc)->flags & AV_PIX_FMT_FLAG_PAL)
2458 static int get_color_type(const AVPixFmtDescriptor *desc) {
2459 if (desc->flags & AV_PIX_FMT_FLAG_PAL)
2460 return FF_COLOR_RGB;
2462 if(desc->nb_components == 1 || desc->nb_components == 2)
2463 return FF_COLOR_GRAY;
2465 if(desc->name && !strncmp(desc->name, "yuvj", 4))
2466 return FF_COLOR_YUV_JPEG;
2468 if(desc->name && !strncmp(desc->name, "xyz", 3))
2469 return FF_COLOR_XYZ;
2471 if(desc->flags & AV_PIX_FMT_FLAG_RGB)
2472 return FF_COLOR_RGB;
2474 if(desc->nb_components == 0)
2477 return FF_COLOR_YUV;
2480 static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
2482 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2485 if (!desc || !desc->nb_components) {
2487 return AVERROR(EINVAL);
2490 *min = INT_MAX, *max = -INT_MAX;
2491 for (i = 0; i < desc->nb_components; i++) {
2492 *min = FFMIN(desc->comp[i].depth, *min);
2493 *max = FFMAX(desc->comp[i].depth, *max);
2498 static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
2499 enum AVPixelFormat src_pix_fmt,
2500 unsigned *lossp, unsigned consider)
2502 const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
2503 const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
2504 int src_color, dst_color;
2505 int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
2506 int ret, loss, i, nb_components;
2507 int score = INT_MAX - 1;
2509 if (dst_pix_fmt >= AV_PIX_FMT_NB || dst_pix_fmt <= AV_PIX_FMT_NONE)
2515 if (dst_pix_fmt == src_pix_fmt)
2518 if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
2520 if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
2523 src_color = get_color_type(src_desc);
2524 dst_color = get_color_type(dst_desc);
2525 if (dst_pix_fmt == AV_PIX_FMT_PAL8)
2526 nb_components = FFMIN(src_desc->nb_components, 4);
2528 nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
2530 for (i = 0; i < nb_components; i++) {
2531 int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
2532 if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
2533 loss |= FF_LOSS_DEPTH;
2534 score -= 65536 >> depth_minus1;
2538 if (consider & FF_LOSS_RESOLUTION) {
2539 if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
2540 loss |= FF_LOSS_RESOLUTION;
2541 score -= 256 << dst_desc->log2_chroma_w;
2543 if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
2544 loss |= FF_LOSS_RESOLUTION;
2545 score -= 256 << dst_desc->log2_chroma_h;
2547 // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
2548 if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
2549 dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
2554 if(consider & FF_LOSS_COLORSPACE)
2557 if (src_color != FF_COLOR_RGB &&
2558 src_color != FF_COLOR_GRAY)
2559 loss |= FF_LOSS_COLORSPACE;
2562 if (src_color != FF_COLOR_GRAY)
2563 loss |= FF_LOSS_COLORSPACE;
2566 if (src_color != FF_COLOR_YUV)
2567 loss |= FF_LOSS_COLORSPACE;
2569 case FF_COLOR_YUV_JPEG:
2570 if (src_color != FF_COLOR_YUV_JPEG &&
2571 src_color != FF_COLOR_YUV &&
2572 src_color != FF_COLOR_GRAY)
2573 loss |= FF_LOSS_COLORSPACE;
2576 /* fail safe test */
2577 if (src_color != dst_color)
2578 loss |= FF_LOSS_COLORSPACE;
2581 if(loss & FF_LOSS_COLORSPACE)
2582 score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
2584 if (dst_color == FF_COLOR_GRAY &&
2585 src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
2586 loss |= FF_LOSS_CHROMA;
2589 if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
2590 loss |= FF_LOSS_ALPHA;
2593 if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
2594 (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
2595 loss |= FF_LOSS_COLORQUANT;
2603 int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
2604 enum AVPixelFormat src_pix_fmt,
2608 int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
2614 enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
2615 enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
2617 enum AVPixelFormat dst_pix_fmt;
2618 int loss1, loss2, loss_mask;
2619 const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
2620 const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
2623 loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
2625 loss_mask &= ~FF_LOSS_ALPHA;
2627 score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
2628 score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
2630 if (score1 == score2) {
2631 if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) {
2632 dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
2634 dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
2637 dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
2641 *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
2645 const char *av_color_range_name(enum AVColorRange range)
2647 return (unsigned) range < AVCOL_RANGE_NB ?
2648 color_range_names[range] : NULL;
2651 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
2653 return (unsigned) primaries < AVCOL_PRI_NB ?
2654 color_primaries_names[primaries] : NULL;
2657 const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
2659 return (unsigned) transfer < AVCOL_TRC_NB ?
2660 color_transfer_names[transfer] : NULL;
2663 const char *av_color_space_name(enum AVColorSpace space)
2665 return (unsigned) space < AVCOL_SPC_NB ?
2666 color_space_names[space] : NULL;
2669 const char *av_chroma_location_name(enum AVChromaLocation location)
2671 return (unsigned) location < AVCHROMA_LOC_NB ?
2672 chroma_location_names[location] : NULL;