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_line2(void *dst,
35 const uint8_t *data[4], const int linesize[4],
36 const AVPixFmtDescriptor *desc,
37 int x, int y, int c, int w,
38 int read_pal_component,
41 AVComponentDescriptor comp = desc->comp[c];
42 int plane = comp.plane;
43 int depth = comp.depth;
44 unsigned mask = (1ULL << depth) - 1;
45 int shift = comp.shift;
47 int flags = desc->flags;
48 uint16_t *dst16 = dst;
49 uint32_t *dst32 = dst;
51 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
52 int skip = x * step + comp.offset;
53 const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
54 int shift = 8 - depth - (skip & 7);
57 int val = (*p >> shift) & mask;
58 if (read_pal_component)
59 val = data[1][4*val + c];
63 if (dst_element_size == 4) *dst32++ = val;
67 const uint8_t *p = data[plane] + y * linesize[plane] +
68 x * step + comp.offset;
69 int is_8bit = shift + depth <= 8;
70 int is_16bit= shift + depth <=16;
73 p += !!(flags & AV_PIX_FMT_FLAG_BE);
77 if (is_8bit) val = *p;
78 else if(is_16bit) val = flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p);
79 else val = flags & AV_PIX_FMT_FLAG_BE ? AV_RB32(p) : AV_RL32(p);
80 val = (val >> shift) & mask;
81 if (read_pal_component)
82 val = data[1][4 * val + c];
84 if (dst_element_size == 4) *dst32++ = val;
90 void av_read_image_line(uint16_t *dst,
91 const uint8_t *data[4], const int linesize[4],
92 const AVPixFmtDescriptor *desc,
93 int x, int y, int c, int w,
94 int read_pal_component)
96 av_read_image_line2(dst, data, linesize, desc,x, y, c, w,
101 void av_write_image_line2(const void *src,
102 uint8_t *data[4], const int linesize[4],
103 const AVPixFmtDescriptor *desc,
104 int x, int y, int c, int w, int src_element_size)
106 AVComponentDescriptor comp = desc->comp[c];
107 int plane = comp.plane;
108 int depth = comp.depth;
109 int step = comp.step;
110 int flags = desc->flags;
111 const uint32_t *src32 = src;
112 const uint16_t *src16 = src;
114 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
115 int skip = x * step + comp.offset;
116 uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
117 int shift = 8 - depth - (skip & 7);
120 *p |= (src_element_size == 4 ? *src32++ : *src16++) << shift;
126 int shift = comp.shift;
127 uint8_t *p = data[plane] + y * linesize[plane] +
128 x * step + comp.offset;
130 if (shift + depth <= 8) {
131 p += !!(flags & AV_PIX_FMT_FLAG_BE);
133 *p |= ((src_element_size == 4 ? *src32++ : *src16++) << shift);
138 unsigned s = (src_element_size == 4 ? *src32++ : *src16++);
139 if (shift + depth <= 16) {
140 if (flags & AV_PIX_FMT_FLAG_BE) {
141 uint16_t val = AV_RB16(p) | (s << shift);
144 uint16_t val = AV_RL16(p) | (s << shift);
148 if (flags & AV_PIX_FMT_FLAG_BE) {
149 uint32_t val = AV_RB32(p) | (s << shift);
152 uint32_t val = AV_RL32(p) | (s << shift);
162 void av_write_image_line(const uint16_t *src,
163 uint8_t *data[4], const int linesize[4],
164 const AVPixFmtDescriptor *desc,
165 int x, int y, int c, int w)
167 av_write_image_line2(src, data, linesize, desc, x, y, c, w, 2);
170 static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
171 [AV_PIX_FMT_YUV420P] = {
177 { 0, 1, 0, 0, 8 }, /* Y */
178 { 1, 1, 0, 0, 8 }, /* U */
179 { 2, 1, 0, 0, 8 }, /* V */
181 .flags = AV_PIX_FMT_FLAG_PLANAR,
183 [AV_PIX_FMT_YUYV422] = {
189 { 0, 2, 0, 0, 8 }, /* Y */
190 { 0, 4, 1, 0, 8 }, /* U */
191 { 0, 4, 3, 0, 8 }, /* V */
194 [AV_PIX_FMT_YVYU422] = {
200 { 0, 2, 0, 0, 8 }, /* Y */
201 { 0, 4, 3, 0, 8 }, /* U */
202 { 0, 4, 1, 0, 8 }, /* V */
205 [AV_PIX_FMT_Y210LE] = {
211 { 0, 4, 0, 6, 10 }, /* Y */
212 { 0, 8, 2, 6, 10 }, /* U */
213 { 0, 8, 6, 6, 10 }, /* V */
216 [AV_PIX_FMT_Y210BE] = {
222 { 0, 4, 0, 6, 10 }, /* Y */
223 { 0, 8, 2, 6, 10 }, /* U */
224 { 0, 8, 6, 6, 10 }, /* V */
226 .flags = AV_PIX_FMT_FLAG_BE,
228 [AV_PIX_FMT_RGB24] = {
234 { 0, 3, 0, 0, 8 }, /* R */
235 { 0, 3, 1, 0, 8 }, /* G */
236 { 0, 3, 2, 0, 8 }, /* B */
238 .flags = AV_PIX_FMT_FLAG_RGB,
240 [AV_PIX_FMT_BGR24] = {
246 { 0, 3, 2, 0, 8 }, /* R */
247 { 0, 3, 1, 0, 8 }, /* G */
248 { 0, 3, 0, 0, 8 }, /* B */
250 .flags = AV_PIX_FMT_FLAG_RGB,
252 [AV_PIX_FMT_X2RGB10LE] = {
258 { 0, 4, 2, 4, 10 }, /* R */
259 { 0, 4, 1, 2, 10 }, /* G */
260 { 0, 4, 0, 0, 10 }, /* B */
262 .flags = AV_PIX_FMT_FLAG_RGB,
264 [AV_PIX_FMT_X2RGB10BE] = {
270 { 0, 4, 0, 4, 10 }, /* R */
271 { 0, 4, 1, 2, 10 }, /* G */
272 { 0, 4, 2, 0, 10 }, /* B */
274 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
276 [AV_PIX_FMT_YUV422P] = {
282 { 0, 1, 0, 0, 8 }, /* Y */
283 { 1, 1, 0, 0, 8 }, /* U */
284 { 2, 1, 0, 0, 8 }, /* V */
286 .flags = AV_PIX_FMT_FLAG_PLANAR,
288 [AV_PIX_FMT_YUV444P] = {
294 { 0, 1, 0, 0, 8 }, /* Y */
295 { 1, 1, 0, 0, 8 }, /* U */
296 { 2, 1, 0, 0, 8 }, /* V */
298 .flags = AV_PIX_FMT_FLAG_PLANAR,
300 [AV_PIX_FMT_YUV410P] = {
306 { 0, 1, 0, 0, 8 }, /* Y */
307 { 1, 1, 0, 0, 8 }, /* U */
308 { 2, 1, 0, 0, 8 }, /* V */
310 .flags = AV_PIX_FMT_FLAG_PLANAR,
312 [AV_PIX_FMT_YUV411P] = {
318 { 0, 1, 0, 0, 8 }, /* Y */
319 { 1, 1, 0, 0, 8 }, /* U */
320 { 2, 1, 0, 0, 8 }, /* V */
322 .flags = AV_PIX_FMT_FLAG_PLANAR,
324 [AV_PIX_FMT_YUVJ411P] = {
330 { 0, 1, 0, 0, 8 }, /* Y */
331 { 1, 1, 0, 0, 8 }, /* U */
332 { 2, 1, 0, 0, 8 }, /* V */
334 .flags = AV_PIX_FMT_FLAG_PLANAR,
336 [AV_PIX_FMT_GRAY8] = {
342 { 0, 1, 0, 0, 8 }, /* Y */
346 [AV_PIX_FMT_MONOWHITE] = {
352 { 0, 1, 0, 0, 1 }, /* Y */
354 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
356 [AV_PIX_FMT_MONOBLACK] = {
362 { 0, 1, 0, 7, 1 }, /* Y */
364 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
366 [AV_PIX_FMT_PAL8] = {
374 .flags = AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_ALPHA,
376 [AV_PIX_FMT_YUVJ420P] = {
382 { 0, 1, 0, 0, 8 }, /* Y */
383 { 1, 1, 0, 0, 8 }, /* U */
384 { 2, 1, 0, 0, 8 }, /* V */
386 .flags = AV_PIX_FMT_FLAG_PLANAR,
388 [AV_PIX_FMT_YUVJ422P] = {
394 { 0, 1, 0, 0, 8 }, /* Y */
395 { 1, 1, 0, 0, 8 }, /* U */
396 { 2, 1, 0, 0, 8 }, /* V */
398 .flags = AV_PIX_FMT_FLAG_PLANAR,
400 [AV_PIX_FMT_YUVJ444P] = {
406 { 0, 1, 0, 0, 8 }, /* Y */
407 { 1, 1, 0, 0, 8 }, /* U */
408 { 2, 1, 0, 0, 8 }, /* V */
410 .flags = AV_PIX_FMT_FLAG_PLANAR,
412 [AV_PIX_FMT_XVMC] = {
414 .flags = AV_PIX_FMT_FLAG_HWACCEL,
416 [AV_PIX_FMT_UYVY422] = {
422 { 0, 2, 1, 0, 8 }, /* Y */
423 { 0, 4, 0, 0, 8 }, /* U */
424 { 0, 4, 2, 0, 8 }, /* V */
427 [AV_PIX_FMT_UYYVYY411] = {
433 { 0, 4, 1, 0, 8 }, /* Y */
434 { 0, 6, 0, 0, 8 }, /* U */
435 { 0, 6, 3, 0, 8 }, /* V */
438 [AV_PIX_FMT_BGR8] = {
444 { 0, 1, 0, 0, 3 }, /* R */
445 { 0, 1, 0, 3, 3 }, /* G */
446 { 0, 1, 0, 6, 2 }, /* B */
448 .flags = AV_PIX_FMT_FLAG_RGB,
450 [AV_PIX_FMT_BGR4] = {
456 { 0, 4, 3, 0, 1 }, /* R */
457 { 0, 4, 1, 0, 2 }, /* G */
458 { 0, 4, 0, 0, 1 }, /* B */
460 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
462 [AV_PIX_FMT_BGR4_BYTE] = {
468 { 0, 1, 0, 0, 1 }, /* R */
469 { 0, 1, 0, 1, 2 }, /* G */
470 { 0, 1, 0, 3, 1 }, /* B */
472 .flags = AV_PIX_FMT_FLAG_RGB,
474 [AV_PIX_FMT_RGB8] = {
480 { 0, 1, 0, 6, 2 }, /* R */
481 { 0, 1, 0, 3, 3 }, /* G */
482 { 0, 1, 0, 0, 3 }, /* B */
484 .flags = AV_PIX_FMT_FLAG_RGB,
486 [AV_PIX_FMT_RGB4] = {
492 { 0, 4, 0, 0, 1 }, /* R */
493 { 0, 4, 1, 0, 2 }, /* G */
494 { 0, 4, 3, 0, 1 }, /* B */
496 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
498 [AV_PIX_FMT_RGB4_BYTE] = {
504 { 0, 1, 0, 3, 1 }, /* R */
505 { 0, 1, 0, 1, 2 }, /* G */
506 { 0, 1, 0, 0, 1 }, /* B */
508 .flags = AV_PIX_FMT_FLAG_RGB,
510 [AV_PIX_FMT_NV12] = {
516 { 0, 1, 0, 0, 8 }, /* Y */
517 { 1, 2, 0, 0, 8 }, /* U */
518 { 1, 2, 1, 0, 8 }, /* V */
520 .flags = AV_PIX_FMT_FLAG_PLANAR,
522 [AV_PIX_FMT_NV21] = {
528 { 0, 1, 0, 0, 8 }, /* Y */
529 { 1, 2, 1, 0, 8 }, /* U */
530 { 1, 2, 0, 0, 8 }, /* V */
532 .flags = AV_PIX_FMT_FLAG_PLANAR,
534 [AV_PIX_FMT_ARGB] = {
540 { 0, 4, 1, 0, 8 }, /* R */
541 { 0, 4, 2, 0, 8 }, /* G */
542 { 0, 4, 3, 0, 8 }, /* B */
543 { 0, 4, 0, 0, 8 }, /* A */
545 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
547 [AV_PIX_FMT_RGBA] = {
553 { 0, 4, 0, 0, 8 }, /* R */
554 { 0, 4, 1, 0, 8 }, /* G */
555 { 0, 4, 2, 0, 8 }, /* B */
556 { 0, 4, 3, 0, 8 }, /* A */
558 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
560 [AV_PIX_FMT_ABGR] = {
566 { 0, 4, 3, 0, 8 }, /* R */
567 { 0, 4, 2, 0, 8 }, /* G */
568 { 0, 4, 1, 0, 8 }, /* B */
569 { 0, 4, 0, 0, 8 }, /* A */
571 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
573 [AV_PIX_FMT_BGRA] = {
579 { 0, 4, 2, 0, 8 }, /* R */
580 { 0, 4, 1, 0, 8 }, /* G */
581 { 0, 4, 0, 0, 8 }, /* B */
582 { 0, 4, 3, 0, 8 }, /* A */
584 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
586 [AV_PIX_FMT_0RGB] = {
592 { 0, 4, 1, 0, 8 }, /* R */
593 { 0, 4, 2, 0, 8 }, /* G */
594 { 0, 4, 3, 0, 8 }, /* B */
596 .flags = AV_PIX_FMT_FLAG_RGB,
598 [AV_PIX_FMT_RGB0] = {
604 { 0, 4, 0, 0, 8 }, /* R */
605 { 0, 4, 1, 0, 8 }, /* G */
606 { 0, 4, 2, 0, 8 }, /* B */
608 .flags = AV_PIX_FMT_FLAG_RGB,
610 [AV_PIX_FMT_0BGR] = {
616 { 0, 4, 3, 0, 8 }, /* R */
617 { 0, 4, 2, 0, 8 }, /* G */
618 { 0, 4, 1, 0, 8 }, /* B */
620 .flags = AV_PIX_FMT_FLAG_RGB,
622 [AV_PIX_FMT_BGR0] = {
628 { 0, 4, 2, 0, 8 }, /* R */
629 { 0, 4, 1, 0, 8 }, /* G */
630 { 0, 4, 0, 0, 8 }, /* B */
632 .flags = AV_PIX_FMT_FLAG_RGB,
634 [AV_PIX_FMT_GRAY9BE] = {
640 { 0, 2, 0, 0, 9 }, /* Y */
642 .flags = AV_PIX_FMT_FLAG_BE,
645 [AV_PIX_FMT_GRAY9LE] = {
651 { 0, 2, 0, 0, 9 }, /* Y */
655 [AV_PIX_FMT_GRAY10BE] = {
661 { 0, 2, 0, 0, 10 }, /* Y */
663 .flags = AV_PIX_FMT_FLAG_BE,
666 [AV_PIX_FMT_GRAY10LE] = {
672 { 0, 2, 0, 0, 10 }, /* Y */
676 [AV_PIX_FMT_GRAY12BE] = {
682 { 0, 2, 0, 0, 12 }, /* Y */
684 .flags = AV_PIX_FMT_FLAG_BE,
687 [AV_PIX_FMT_GRAY12LE] = {
693 { 0, 2, 0, 0, 12 }, /* Y */
697 [AV_PIX_FMT_GRAY14BE] = {
703 { 0, 2, 0, 0, 14 }, /* Y */
705 .flags = AV_PIX_FMT_FLAG_BE,
708 [AV_PIX_FMT_GRAY14LE] = {
714 { 0, 2, 0, 0, 14 }, /* Y */
718 [AV_PIX_FMT_GRAY16BE] = {
724 { 0, 2, 0, 0, 16 }, /* Y */
726 .flags = AV_PIX_FMT_FLAG_BE,
729 [AV_PIX_FMT_GRAY16LE] = {
735 { 0, 2, 0, 0, 16 }, /* Y */
739 [AV_PIX_FMT_YUV440P] = {
745 { 0, 1, 0, 0, 8 }, /* Y */
746 { 1, 1, 0, 0, 8 }, /* U */
747 { 2, 1, 0, 0, 8 }, /* V */
749 .flags = AV_PIX_FMT_FLAG_PLANAR,
751 [AV_PIX_FMT_YUVJ440P] = {
757 { 0, 1, 0, 0, 8 }, /* Y */
758 { 1, 1, 0, 0, 8 }, /* U */
759 { 2, 1, 0, 0, 8 }, /* V */
761 .flags = AV_PIX_FMT_FLAG_PLANAR,
763 [AV_PIX_FMT_YUV440P10LE] = {
764 .name = "yuv440p10le",
769 { 0, 2, 0, 0, 10 }, /* Y */
770 { 1, 2, 0, 0, 10 }, /* U */
771 { 2, 2, 0, 0, 10 }, /* V */
773 .flags = AV_PIX_FMT_FLAG_PLANAR,
775 [AV_PIX_FMT_YUV440P10BE] = {
776 .name = "yuv440p10be",
781 { 0, 2, 0, 0, 10 }, /* Y */
782 { 1, 2, 0, 0, 10 }, /* U */
783 { 2, 2, 0, 0, 10 }, /* V */
785 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
787 [AV_PIX_FMT_YUV440P12LE] = {
788 .name = "yuv440p12le",
793 { 0, 2, 0, 0, 12 }, /* Y */
794 { 1, 2, 0, 0, 12 }, /* U */
795 { 2, 2, 0, 0, 12 }, /* V */
797 .flags = AV_PIX_FMT_FLAG_PLANAR,
799 [AV_PIX_FMT_YUV440P12BE] = {
800 .name = "yuv440p12be",
805 { 0, 2, 0, 0, 12 }, /* Y */
806 { 1, 2, 0, 0, 12 }, /* U */
807 { 2, 2, 0, 0, 12 }, /* V */
809 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
811 [AV_PIX_FMT_YUVA420P] = {
817 { 0, 1, 0, 0, 8 }, /* Y */
818 { 1, 1, 0, 0, 8 }, /* U */
819 { 2, 1, 0, 0, 8 }, /* V */
820 { 3, 1, 0, 0, 8 }, /* A */
822 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
824 [AV_PIX_FMT_YUVA422P] = {
830 { 0, 1, 0, 0, 8 }, /* Y */
831 { 1, 1, 0, 0, 8 }, /* U */
832 { 2, 1, 0, 0, 8 }, /* V */
833 { 3, 1, 0, 0, 8 }, /* A */
835 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
837 [AV_PIX_FMT_YUVA444P] = {
843 { 0, 1, 0, 0, 8 }, /* Y */
844 { 1, 1, 0, 0, 8 }, /* U */
845 { 2, 1, 0, 0, 8 }, /* V */
846 { 3, 1, 0, 0, 8 }, /* A */
848 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
850 [AV_PIX_FMT_YUVA420P9BE] = {
851 .name = "yuva420p9be",
856 { 0, 2, 0, 0, 9 }, /* Y */
857 { 1, 2, 0, 0, 9 }, /* U */
858 { 2, 2, 0, 0, 9 }, /* V */
859 { 3, 2, 0, 0, 9 }, /* A */
861 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
863 [AV_PIX_FMT_YUVA420P9LE] = {
864 .name = "yuva420p9le",
869 { 0, 2, 0, 0, 9 }, /* Y */
870 { 1, 2, 0, 0, 9 }, /* U */
871 { 2, 2, 0, 0, 9 }, /* V */
872 { 3, 2, 0, 0, 9 }, /* A */
874 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
876 [AV_PIX_FMT_YUVA422P9BE] = {
877 .name = "yuva422p9be",
882 { 0, 2, 0, 0, 9 }, /* Y */
883 { 1, 2, 0, 0, 9 }, /* U */
884 { 2, 2, 0, 0, 9 }, /* V */
885 { 3, 2, 0, 0, 9 }, /* A */
887 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
889 [AV_PIX_FMT_YUVA422P9LE] = {
890 .name = "yuva422p9le",
895 { 0, 2, 0, 0, 9 }, /* Y */
896 { 1, 2, 0, 0, 9 }, /* U */
897 { 2, 2, 0, 0, 9 }, /* V */
898 { 3, 2, 0, 0, 9 }, /* A */
900 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
902 [AV_PIX_FMT_YUVA444P9BE] = {
903 .name = "yuva444p9be",
908 { 0, 2, 0, 0, 9 }, /* Y */
909 { 1, 2, 0, 0, 9 }, /* U */
910 { 2, 2, 0, 0, 9 }, /* V */
911 { 3, 2, 0, 0, 9 }, /* A */
913 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
915 [AV_PIX_FMT_YUVA444P9LE] = {
916 .name = "yuva444p9le",
921 { 0, 2, 0, 0, 9 }, /* Y */
922 { 1, 2, 0, 0, 9 }, /* U */
923 { 2, 2, 0, 0, 9 }, /* V */
924 { 3, 2, 0, 0, 9 }, /* A */
926 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
928 [AV_PIX_FMT_YUVA420P10BE] = {
929 .name = "yuva420p10be",
934 { 0, 2, 0, 0, 10 }, /* Y */
935 { 1, 2, 0, 0, 10 }, /* U */
936 { 2, 2, 0, 0, 10 }, /* V */
937 { 3, 2, 0, 0, 10 }, /* A */
939 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
941 [AV_PIX_FMT_YUVA420P10LE] = {
942 .name = "yuva420p10le",
947 { 0, 2, 0, 0, 10 }, /* Y */
948 { 1, 2, 0, 0, 10 }, /* U */
949 { 2, 2, 0, 0, 10 }, /* V */
950 { 3, 2, 0, 0, 10 }, /* A */
952 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
954 [AV_PIX_FMT_YUVA422P10BE] = {
955 .name = "yuva422p10be",
960 { 0, 2, 0, 0, 10 }, /* Y */
961 { 1, 2, 0, 0, 10 }, /* U */
962 { 2, 2, 0, 0, 10 }, /* V */
963 { 3, 2, 0, 0, 10 }, /* A */
965 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
967 [AV_PIX_FMT_YUVA422P10LE] = {
968 .name = "yuva422p10le",
973 { 0, 2, 0, 0, 10 }, /* Y */
974 { 1, 2, 0, 0, 10 }, /* U */
975 { 2, 2, 0, 0, 10 }, /* V */
976 { 3, 2, 0, 0, 10 }, /* A */
978 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
980 [AV_PIX_FMT_YUVA444P10BE] = {
981 .name = "yuva444p10be",
986 { 0, 2, 0, 0, 10 }, /* Y */
987 { 1, 2, 0, 0, 10 }, /* U */
988 { 2, 2, 0, 0, 10 }, /* V */
989 { 3, 2, 0, 0, 10 }, /* A */
991 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
993 [AV_PIX_FMT_YUVA444P10LE] = {
994 .name = "yuva444p10le",
999 { 0, 2, 0, 0, 10 }, /* Y */
1000 { 1, 2, 0, 0, 10 }, /* U */
1001 { 2, 2, 0, 0, 10 }, /* V */
1002 { 3, 2, 0, 0, 10 }, /* A */
1004 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1006 [AV_PIX_FMT_YUVA420P16BE] = {
1007 .name = "yuva420p16be",
1012 { 0, 2, 0, 0, 16 }, /* Y */
1013 { 1, 2, 0, 0, 16 }, /* U */
1014 { 2, 2, 0, 0, 16 }, /* V */
1015 { 3, 2, 0, 0, 16 }, /* A */
1017 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1019 [AV_PIX_FMT_YUVA420P16LE] = {
1020 .name = "yuva420p16le",
1025 { 0, 2, 0, 0, 16 }, /* Y */
1026 { 1, 2, 0, 0, 16 }, /* U */
1027 { 2, 2, 0, 0, 16 }, /* V */
1028 { 3, 2, 0, 0, 16 }, /* A */
1030 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1032 [AV_PIX_FMT_YUVA422P16BE] = {
1033 .name = "yuva422p16be",
1038 { 0, 2, 0, 0, 16 }, /* Y */
1039 { 1, 2, 0, 0, 16 }, /* U */
1040 { 2, 2, 0, 0, 16 }, /* V */
1041 { 3, 2, 0, 0, 16 }, /* A */
1043 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1045 [AV_PIX_FMT_YUVA422P16LE] = {
1046 .name = "yuva422p16le",
1051 { 0, 2, 0, 0, 16 }, /* Y */
1052 { 1, 2, 0, 0, 16 }, /* U */
1053 { 2, 2, 0, 0, 16 }, /* V */
1054 { 3, 2, 0, 0, 16 }, /* A */
1056 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1058 [AV_PIX_FMT_YUVA444P16BE] = {
1059 .name = "yuva444p16be",
1064 { 0, 2, 0, 0, 16 }, /* Y */
1065 { 1, 2, 0, 0, 16 }, /* U */
1066 { 2, 2, 0, 0, 16 }, /* V */
1067 { 3, 2, 0, 0, 16 }, /* A */
1069 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1071 [AV_PIX_FMT_YUVA444P16LE] = {
1072 .name = "yuva444p16le",
1077 { 0, 2, 0, 0, 16 }, /* Y */
1078 { 1, 2, 0, 0, 16 }, /* U */
1079 { 2, 2, 0, 0, 16 }, /* V */
1080 { 3, 2, 0, 0, 16 }, /* A */
1082 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1084 [AV_PIX_FMT_RGB48BE] = {
1090 { 0, 6, 0, 0, 16 }, /* R */
1091 { 0, 6, 2, 0, 16 }, /* G */
1092 { 0, 6, 4, 0, 16 }, /* B */
1094 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
1096 [AV_PIX_FMT_RGB48LE] = {
1102 { 0, 6, 0, 0, 16 }, /* R */
1103 { 0, 6, 2, 0, 16 }, /* G */
1104 { 0, 6, 4, 0, 16 }, /* B */
1106 .flags = AV_PIX_FMT_FLAG_RGB,
1108 [AV_PIX_FMT_RGBA64BE] = {
1114 { 0, 8, 0, 0, 16 }, /* R */
1115 { 0, 8, 2, 0, 16 }, /* G */
1116 { 0, 8, 4, 0, 16 }, /* B */
1117 { 0, 8, 6, 0, 16 }, /* A */
1119 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1121 [AV_PIX_FMT_RGBA64LE] = {
1127 { 0, 8, 0, 0, 16 }, /* R */
1128 { 0, 8, 2, 0, 16 }, /* G */
1129 { 0, 8, 4, 0, 16 }, /* B */
1130 { 0, 8, 6, 0, 16 }, /* A */
1132 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1134 [AV_PIX_FMT_RGB565BE] = {
1140 { 0, 2, -1, 3, 5 }, /* R */
1141 { 0, 2, 0, 5, 6 }, /* G */
1142 { 0, 2, 0, 0, 5 }, /* B */
1144 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1146 [AV_PIX_FMT_RGB565LE] = {
1152 { 0, 2, 1, 3, 5 }, /* R */
1153 { 0, 2, 0, 5, 6 }, /* G */
1154 { 0, 2, 0, 0, 5 }, /* B */
1156 .flags = AV_PIX_FMT_FLAG_RGB,
1158 [AV_PIX_FMT_RGB555BE] = {
1164 { 0, 2, -1, 2, 5 }, /* R */
1165 { 0, 2, 0, 5, 5 }, /* G */
1166 { 0, 2, 0, 0, 5 }, /* B */
1168 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1170 [AV_PIX_FMT_RGB555LE] = {
1176 { 0, 2, 1, 2, 5 }, /* R */
1177 { 0, 2, 0, 5, 5 }, /* G */
1178 { 0, 2, 0, 0, 5 }, /* B */
1180 .flags = AV_PIX_FMT_FLAG_RGB,
1182 [AV_PIX_FMT_RGB444BE] = {
1188 { 0, 2, -1, 0, 4 }, /* R */
1189 { 0, 2, 0, 4, 4 }, /* G */
1190 { 0, 2, 0, 0, 4 }, /* B */
1192 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1194 [AV_PIX_FMT_RGB444LE] = {
1200 { 0, 2, 1, 0, 4 }, /* R */
1201 { 0, 2, 0, 4, 4 }, /* G */
1202 { 0, 2, 0, 0, 4 }, /* B */
1204 .flags = AV_PIX_FMT_FLAG_RGB,
1206 [AV_PIX_FMT_BGR48BE] = {
1212 { 0, 6, 4, 0, 16 }, /* R */
1213 { 0, 6, 2, 0, 16 }, /* G */
1214 { 0, 6, 0, 0, 16 }, /* B */
1216 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1218 [AV_PIX_FMT_BGR48LE] = {
1224 { 0, 6, 4, 0, 16 }, /* R */
1225 { 0, 6, 2, 0, 16 }, /* G */
1226 { 0, 6, 0, 0, 16 }, /* B */
1228 .flags = AV_PIX_FMT_FLAG_RGB,
1230 [AV_PIX_FMT_BGRA64BE] = {
1236 { 0, 8, 4, 0, 16 }, /* R */
1237 { 0, 8, 2, 0, 16 }, /* G */
1238 { 0, 8, 0, 0, 16 }, /* B */
1239 { 0, 8, 6, 0, 16 }, /* A */
1241 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1243 [AV_PIX_FMT_BGRA64LE] = {
1249 { 0, 8, 4, 0, 16 }, /* R */
1250 { 0, 8, 2, 0, 16 }, /* G */
1251 { 0, 8, 0, 0, 16 }, /* B */
1252 { 0, 8, 6, 0, 16 }, /* A */
1254 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1256 [AV_PIX_FMT_BGR565BE] = {
1262 { 0, 2, 0, 0, 5 }, /* R */
1263 { 0, 2, 0, 5, 6 }, /* G */
1264 { 0, 2, -1, 3, 5 }, /* B */
1266 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1268 [AV_PIX_FMT_BGR565LE] = {
1274 { 0, 2, 0, 0, 5 }, /* R */
1275 { 0, 2, 0, 5, 6 }, /* G */
1276 { 0, 2, 1, 3, 5 }, /* B */
1278 .flags = AV_PIX_FMT_FLAG_RGB,
1280 [AV_PIX_FMT_BGR555BE] = {
1286 { 0, 2, 0, 0, 5 }, /* R */
1287 { 0, 2, 0, 5, 5 }, /* G */
1288 { 0, 2, -1, 2, 5 }, /* B */
1290 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1292 [AV_PIX_FMT_BGR555LE] = {
1298 { 0, 2, 0, 0, 5 }, /* R */
1299 { 0, 2, 0, 5, 5 }, /* G */
1300 { 0, 2, 1, 2, 5 }, /* B */
1302 .flags = AV_PIX_FMT_FLAG_RGB,
1304 [AV_PIX_FMT_BGR444BE] = {
1310 { 0, 2, 0, 0, 4 }, /* R */
1311 { 0, 2, 0, 4, 4 }, /* G */
1312 { 0, 2, -1, 0, 4 }, /* B */
1314 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1316 [AV_PIX_FMT_BGR444LE] = {
1322 { 0, 2, 0, 0, 4 }, /* R */
1323 { 0, 2, 0, 4, 4 }, /* G */
1324 { 0, 2, 1, 0, 4 }, /* B */
1326 .flags = AV_PIX_FMT_FLAG_RGB,
1328 [AV_PIX_FMT_VAAPI] = {
1332 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1334 [AV_PIX_FMT_YUV420P9LE] = {
1335 .name = "yuv420p9le",
1340 { 0, 2, 0, 0, 9 }, /* Y */
1341 { 1, 2, 0, 0, 9 }, /* U */
1342 { 2, 2, 0, 0, 9 }, /* V */
1344 .flags = AV_PIX_FMT_FLAG_PLANAR,
1346 [AV_PIX_FMT_YUV420P9BE] = {
1347 .name = "yuv420p9be",
1352 { 0, 2, 0, 0, 9 }, /* Y */
1353 { 1, 2, 0, 0, 9 }, /* U */
1354 { 2, 2, 0, 0, 9 }, /* V */
1356 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1358 [AV_PIX_FMT_YUV420P10LE] = {
1359 .name = "yuv420p10le",
1364 { 0, 2, 0, 0, 10 }, /* Y */
1365 { 1, 2, 0, 0, 10 }, /* U */
1366 { 2, 2, 0, 0, 10 }, /* V */
1368 .flags = AV_PIX_FMT_FLAG_PLANAR,
1370 [AV_PIX_FMT_YUV420P10BE] = {
1371 .name = "yuv420p10be",
1376 { 0, 2, 0, 0, 10 }, /* Y */
1377 { 1, 2, 0, 0, 10 }, /* U */
1378 { 2, 2, 0, 0, 10 }, /* V */
1380 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1382 [AV_PIX_FMT_YUV420P12LE] = {
1383 .name = "yuv420p12le",
1388 { 0, 2, 0, 0, 12 }, /* Y */
1389 { 1, 2, 0, 0, 12 }, /* U */
1390 { 2, 2, 0, 0, 12 }, /* V */
1392 .flags = AV_PIX_FMT_FLAG_PLANAR,
1394 [AV_PIX_FMT_YUV420P12BE] = {
1395 .name = "yuv420p12be",
1400 { 0, 2, 0, 0, 12 }, /* Y */
1401 { 1, 2, 0, 0, 12 }, /* U */
1402 { 2, 2, 0, 0, 12 }, /* V */
1404 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1406 [AV_PIX_FMT_YUV420P14LE] = {
1407 .name = "yuv420p14le",
1412 { 0, 2, 0, 0, 14 }, /* Y */
1413 { 1, 2, 0, 0, 14 }, /* U */
1414 { 2, 2, 0, 0, 14 }, /* V */
1416 .flags = AV_PIX_FMT_FLAG_PLANAR,
1418 [AV_PIX_FMT_YUV420P14BE] = {
1419 .name = "yuv420p14be",
1424 { 0, 2, 0, 0, 14 }, /* Y */
1425 { 1, 2, 0, 0, 14 }, /* U */
1426 { 2, 2, 0, 0, 14 }, /* V */
1428 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1430 [AV_PIX_FMT_YUV420P16LE] = {
1431 .name = "yuv420p16le",
1436 { 0, 2, 0, 0, 16 }, /* Y */
1437 { 1, 2, 0, 0, 16 }, /* U */
1438 { 2, 2, 0, 0, 16 }, /* V */
1440 .flags = AV_PIX_FMT_FLAG_PLANAR,
1442 [AV_PIX_FMT_YUV420P16BE] = {
1443 .name = "yuv420p16be",
1448 { 0, 2, 0, 0, 16 }, /* Y */
1449 { 1, 2, 0, 0, 16 }, /* U */
1450 { 2, 2, 0, 0, 16 }, /* V */
1452 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1454 [AV_PIX_FMT_YUV422P9LE] = {
1455 .name = "yuv422p9le",
1460 { 0, 2, 0, 0, 9 }, /* Y */
1461 { 1, 2, 0, 0, 9 }, /* U */
1462 { 2, 2, 0, 0, 9 }, /* V */
1464 .flags = AV_PIX_FMT_FLAG_PLANAR,
1466 [AV_PIX_FMT_YUV422P9BE] = {
1467 .name = "yuv422p9be",
1472 { 0, 2, 0, 0, 9 }, /* Y */
1473 { 1, 2, 0, 0, 9 }, /* U */
1474 { 2, 2, 0, 0, 9 }, /* V */
1476 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1478 [AV_PIX_FMT_YUV422P10LE] = {
1479 .name = "yuv422p10le",
1484 { 0, 2, 0, 0, 10 }, /* Y */
1485 { 1, 2, 0, 0, 10 }, /* U */
1486 { 2, 2, 0, 0, 10 }, /* V */
1488 .flags = AV_PIX_FMT_FLAG_PLANAR,
1490 [AV_PIX_FMT_YUV422P10BE] = {
1491 .name = "yuv422p10be",
1496 { 0, 2, 0, 0, 10 }, /* Y */
1497 { 1, 2, 0, 0, 10 }, /* U */
1498 { 2, 2, 0, 0, 10 }, /* V */
1500 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1502 [AV_PIX_FMT_YUV422P12LE] = {
1503 .name = "yuv422p12le",
1508 { 0, 2, 0, 0, 12 }, /* Y */
1509 { 1, 2, 0, 0, 12 }, /* U */
1510 { 2, 2, 0, 0, 12 }, /* V */
1512 .flags = AV_PIX_FMT_FLAG_PLANAR,
1514 [AV_PIX_FMT_YUV422P12BE] = {
1515 .name = "yuv422p12be",
1520 { 0, 2, 0, 0, 12 }, /* Y */
1521 { 1, 2, 0, 0, 12 }, /* U */
1522 { 2, 2, 0, 0, 12 }, /* V */
1524 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1526 [AV_PIX_FMT_YUV422P14LE] = {
1527 .name = "yuv422p14le",
1532 { 0, 2, 0, 0, 14 }, /* Y */
1533 { 1, 2, 0, 0, 14 }, /* U */
1534 { 2, 2, 0, 0, 14 }, /* V */
1536 .flags = AV_PIX_FMT_FLAG_PLANAR,
1538 [AV_PIX_FMT_YUV422P14BE] = {
1539 .name = "yuv422p14be",
1544 { 0, 2, 0, 0, 14 }, /* Y */
1545 { 1, 2, 0, 0, 14 }, /* U */
1546 { 2, 2, 0, 0, 14 }, /* V */
1548 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1550 [AV_PIX_FMT_YUV422P16LE] = {
1551 .name = "yuv422p16le",
1556 { 0, 2, 0, 0, 16 }, /* Y */
1557 { 1, 2, 0, 0, 16 }, /* U */
1558 { 2, 2, 0, 0, 16 }, /* V */
1560 .flags = AV_PIX_FMT_FLAG_PLANAR,
1562 [AV_PIX_FMT_YUV422P16BE] = {
1563 .name = "yuv422p16be",
1568 { 0, 2, 0, 0, 16 }, /* Y */
1569 { 1, 2, 0, 0, 16 }, /* U */
1570 { 2, 2, 0, 0, 16 }, /* V */
1572 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1574 [AV_PIX_FMT_YUV444P16LE] = {
1575 .name = "yuv444p16le",
1580 { 0, 2, 0, 0, 16 }, /* Y */
1581 { 1, 2, 0, 0, 16 }, /* U */
1582 { 2, 2, 0, 0, 16 }, /* V */
1584 .flags = AV_PIX_FMT_FLAG_PLANAR,
1586 [AV_PIX_FMT_YUV444P16BE] = {
1587 .name = "yuv444p16be",
1592 { 0, 2, 0, 0, 16 }, /* Y */
1593 { 1, 2, 0, 0, 16 }, /* U */
1594 { 2, 2, 0, 0, 16 }, /* V */
1596 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1598 [AV_PIX_FMT_YUV444P10LE] = {
1599 .name = "yuv444p10le",
1604 { 0, 2, 0, 0, 10 }, /* Y */
1605 { 1, 2, 0, 0, 10 }, /* U */
1606 { 2, 2, 0, 0, 10 }, /* V */
1608 .flags = AV_PIX_FMT_FLAG_PLANAR,
1610 [AV_PIX_FMT_YUV444P10BE] = {
1611 .name = "yuv444p10be",
1616 { 0, 2, 0, 0, 10 }, /* Y */
1617 { 1, 2, 0, 0, 10 }, /* U */
1618 { 2, 2, 0, 0, 10 }, /* V */
1620 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1622 [AV_PIX_FMT_YUV444P9LE] = {
1623 .name = "yuv444p9le",
1628 { 0, 2, 0, 0, 9 }, /* Y */
1629 { 1, 2, 0, 0, 9 }, /* U */
1630 { 2, 2, 0, 0, 9 }, /* V */
1632 .flags = AV_PIX_FMT_FLAG_PLANAR,
1634 [AV_PIX_FMT_YUV444P9BE] = {
1635 .name = "yuv444p9be",
1640 { 0, 2, 0, 0, 9 }, /* Y */
1641 { 1, 2, 0, 0, 9 }, /* U */
1642 { 2, 2, 0, 0, 9 }, /* V */
1644 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1646 [AV_PIX_FMT_YUV444P12LE] = {
1647 .name = "yuv444p12le",
1652 { 0, 2, 0, 0, 12 }, /* Y */
1653 { 1, 2, 0, 0, 12 }, /* U */
1654 { 2, 2, 0, 0, 12 }, /* V */
1656 .flags = AV_PIX_FMT_FLAG_PLANAR,
1658 [AV_PIX_FMT_YUV444P12BE] = {
1659 .name = "yuv444p12be",
1664 { 0, 2, 0, 0, 12 }, /* Y */
1665 { 1, 2, 0, 0, 12 }, /* U */
1666 { 2, 2, 0, 0, 12 }, /* V */
1668 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1670 [AV_PIX_FMT_YUV444P14LE] = {
1671 .name = "yuv444p14le",
1676 { 0, 2, 0, 0, 14 }, /* Y */
1677 { 1, 2, 0, 0, 14 }, /* U */
1678 { 2, 2, 0, 0, 14 }, /* V */
1680 .flags = AV_PIX_FMT_FLAG_PLANAR,
1682 [AV_PIX_FMT_YUV444P14BE] = {
1683 .name = "yuv444p14be",
1688 { 0, 2, 0, 0, 14 }, /* Y */
1689 { 1, 2, 0, 0, 14 }, /* U */
1690 { 2, 2, 0, 0, 14 }, /* V */
1692 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1694 [AV_PIX_FMT_D3D11VA_VLD] = {
1695 .name = "d3d11va_vld",
1698 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1700 [AV_PIX_FMT_DXVA2_VLD] = {
1701 .name = "dxva2_vld",
1704 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1706 [AV_PIX_FMT_YA8] = {
1710 { 0, 2, 0, 0, 8 }, /* Y */
1711 { 0, 2, 1, 0, 8 }, /* A */
1713 .flags = AV_PIX_FMT_FLAG_ALPHA,
1716 [AV_PIX_FMT_YA16LE] = {
1720 { 0, 4, 0, 0, 16 }, /* Y */
1721 { 0, 4, 2, 0, 16 }, /* A */
1723 .flags = AV_PIX_FMT_FLAG_ALPHA,
1725 [AV_PIX_FMT_YA16BE] = {
1729 { 0, 4, 0, 0, 16 }, /* Y */
1730 { 0, 4, 2, 0, 16 }, /* A */
1732 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
1734 [AV_PIX_FMT_VIDEOTOOLBOX] = {
1735 .name = "videotoolbox_vld",
1736 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1738 [AV_PIX_FMT_GBRP] = {
1744 { 2, 1, 0, 0, 8 }, /* R */
1745 { 0, 1, 0, 0, 8 }, /* G */
1746 { 1, 1, 0, 0, 8 }, /* B */
1748 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1750 [AV_PIX_FMT_GBRP9LE] = {
1756 { 2, 2, 0, 0, 9 }, /* R */
1757 { 0, 2, 0, 0, 9 }, /* G */
1758 { 1, 2, 0, 0, 9 }, /* B */
1760 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1762 [AV_PIX_FMT_GBRP9BE] = {
1768 { 2, 2, 0, 0, 9 }, /* R */
1769 { 0, 2, 0, 0, 9 }, /* G */
1770 { 1, 2, 0, 0, 9 }, /* B */
1772 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1774 [AV_PIX_FMT_GBRP10LE] = {
1780 { 2, 2, 0, 0, 10 }, /* R */
1781 { 0, 2, 0, 0, 10 }, /* G */
1782 { 1, 2, 0, 0, 10 }, /* B */
1784 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1786 [AV_PIX_FMT_GBRP10BE] = {
1792 { 2, 2, 0, 0, 10 }, /* R */
1793 { 0, 2, 0, 0, 10 }, /* G */
1794 { 1, 2, 0, 0, 10 }, /* B */
1796 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1798 [AV_PIX_FMT_GBRP12LE] = {
1804 { 2, 2, 0, 0, 12 }, /* R */
1805 { 0, 2, 0, 0, 12 }, /* G */
1806 { 1, 2, 0, 0, 12 }, /* B */
1808 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1810 [AV_PIX_FMT_GBRP12BE] = {
1816 { 2, 2, 0, 0, 12 }, /* R */
1817 { 0, 2, 0, 0, 12 }, /* G */
1818 { 1, 2, 0, 0, 12 }, /* B */
1820 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1822 [AV_PIX_FMT_GBRP14LE] = {
1828 { 2, 2, 0, 0, 14 }, /* R */
1829 { 0, 2, 0, 0, 14 }, /* G */
1830 { 1, 2, 0, 0, 14 }, /* B */
1832 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1834 [AV_PIX_FMT_GBRP14BE] = {
1840 { 2, 2, 0, 0, 14 }, /* R */
1841 { 0, 2, 0, 0, 14 }, /* G */
1842 { 1, 2, 0, 0, 14 }, /* B */
1844 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1846 [AV_PIX_FMT_GBRP16LE] = {
1852 { 2, 2, 0, 0, 16 }, /* R */
1853 { 0, 2, 0, 0, 16 }, /* G */
1854 { 1, 2, 0, 0, 16 }, /* B */
1856 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1858 [AV_PIX_FMT_GBRP16BE] = {
1864 { 2, 2, 0, 0, 16 }, /* R */
1865 { 0, 2, 0, 0, 16 }, /* G */
1866 { 1, 2, 0, 0, 16 }, /* B */
1868 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1870 [AV_PIX_FMT_GBRAP] = {
1876 { 2, 1, 0, 0, 8 }, /* R */
1877 { 0, 1, 0, 0, 8 }, /* G */
1878 { 1, 1, 0, 0, 8 }, /* B */
1879 { 3, 1, 0, 0, 8 }, /* A */
1881 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1882 AV_PIX_FMT_FLAG_ALPHA,
1884 [AV_PIX_FMT_GBRAP16LE] = {
1885 .name = "gbrap16le",
1890 { 2, 2, 0, 0, 16 }, /* R */
1891 { 0, 2, 0, 0, 16 }, /* G */
1892 { 1, 2, 0, 0, 16 }, /* B */
1893 { 3, 2, 0, 0, 16 }, /* A */
1895 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1896 AV_PIX_FMT_FLAG_ALPHA,
1898 [AV_PIX_FMT_GBRAP16BE] = {
1899 .name = "gbrap16be",
1904 { 2, 2, 0, 0, 16 }, /* R */
1905 { 0, 2, 0, 0, 16 }, /* G */
1906 { 1, 2, 0, 0, 16 }, /* B */
1907 { 3, 2, 0, 0, 16 }, /* A */
1909 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
1910 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1912 [AV_PIX_FMT_VDPAU] = {
1916 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1918 [AV_PIX_FMT_XYZ12LE] = {
1924 { 0, 6, 0, 4, 12 }, /* X */
1925 { 0, 6, 2, 4, 12 }, /* Y */
1926 { 0, 6, 4, 4, 12 }, /* Z */
1928 /*.flags = -- not used*/
1930 [AV_PIX_FMT_XYZ12BE] = {
1936 { 0, 6, 0, 4, 12 }, /* X */
1937 { 0, 6, 2, 4, 12 }, /* Y */
1938 { 0, 6, 4, 4, 12 }, /* Z */
1940 .flags = AV_PIX_FMT_FLAG_BE,
1943 #define BAYER8_DESC_COMMON \
1944 .nb_components= 3, \
1945 .log2_chroma_w= 0, \
1946 .log2_chroma_h= 0, \
1948 { 0, 1, 0, 0, 2 }, \
1949 { 0, 1, 0, 0, 4 }, \
1950 { 0, 1, 0, 0, 2 }, \
1953 #define BAYER16_DESC_COMMON \
1954 .nb_components= 3, \
1955 .log2_chroma_w= 0, \
1956 .log2_chroma_h= 0, \
1958 { 0, 2, 0, 0, 4 }, \
1959 { 0, 2, 0, 0, 8 }, \
1960 { 0, 2, 0, 0, 4 }, \
1963 [AV_PIX_FMT_BAYER_BGGR8] = {
1964 .name = "bayer_bggr8",
1966 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1968 [AV_PIX_FMT_BAYER_BGGR16LE] = {
1969 .name = "bayer_bggr16le",
1971 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1973 [AV_PIX_FMT_BAYER_BGGR16BE] = {
1974 .name = "bayer_bggr16be",
1976 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1978 [AV_PIX_FMT_BAYER_RGGB8] = {
1979 .name = "bayer_rggb8",
1981 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1983 [AV_PIX_FMT_BAYER_RGGB16LE] = {
1984 .name = "bayer_rggb16le",
1986 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1988 [AV_PIX_FMT_BAYER_RGGB16BE] = {
1989 .name = "bayer_rggb16be",
1991 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1993 [AV_PIX_FMT_BAYER_GBRG8] = {
1994 .name = "bayer_gbrg8",
1996 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1998 [AV_PIX_FMT_BAYER_GBRG16LE] = {
1999 .name = "bayer_gbrg16le",
2001 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2003 [AV_PIX_FMT_BAYER_GBRG16BE] = {
2004 .name = "bayer_gbrg16be",
2006 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2008 [AV_PIX_FMT_BAYER_GRBG8] = {
2009 .name = "bayer_grbg8",
2011 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2013 [AV_PIX_FMT_BAYER_GRBG16LE] = {
2014 .name = "bayer_grbg16le",
2016 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2018 [AV_PIX_FMT_BAYER_GRBG16BE] = {
2019 .name = "bayer_grbg16be",
2021 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2023 [AV_PIX_FMT_NV16] = {
2029 { 0, 1, 0, 0, 8 }, /* Y */
2030 { 1, 2, 0, 0, 8 }, /* U */
2031 { 1, 2, 1, 0, 8 }, /* V */
2033 .flags = AV_PIX_FMT_FLAG_PLANAR,
2035 [AV_PIX_FMT_NV20LE] = {
2041 { 0, 2, 0, 0, 10 }, /* Y */
2042 { 1, 4, 0, 0, 10 }, /* U */
2043 { 1, 4, 2, 0, 10 }, /* V */
2045 .flags = AV_PIX_FMT_FLAG_PLANAR,
2047 [AV_PIX_FMT_NV20BE] = {
2053 { 0, 2, 0, 0, 10 }, /* Y */
2054 { 1, 4, 0, 0, 10 }, /* U */
2055 { 1, 4, 2, 0, 10 }, /* V */
2057 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2059 [AV_PIX_FMT_QSV] = {
2061 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2063 [AV_PIX_FMT_MEDIACODEC] = {
2064 .name = "mediacodec",
2065 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2067 [AV_PIX_FMT_MMAL] = {
2069 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2071 [AV_PIX_FMT_CUDA] = {
2073 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2075 [AV_PIX_FMT_AYUV64LE] = {
2081 { 0, 8, 2, 0, 16 }, /* Y */
2082 { 0, 8, 4, 0, 16 }, /* U */
2083 { 0, 8, 6, 0, 16 }, /* V */
2084 { 0, 8, 0, 0, 16 }, /* A */
2086 .flags = AV_PIX_FMT_FLAG_ALPHA,
2088 [AV_PIX_FMT_AYUV64BE] = {
2094 { 0, 8, 2, 0, 16 }, /* Y */
2095 { 0, 8, 4, 0, 16 }, /* U */
2096 { 0, 8, 6, 0, 16 }, /* V */
2097 { 0, 8, 0, 0, 16 }, /* A */
2099 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
2101 [AV_PIX_FMT_P010LE] = {
2107 { 0, 2, 0, 6, 10 }, /* Y */
2108 { 1, 4, 0, 6, 10 }, /* U */
2109 { 1, 4, 2, 6, 10 }, /* V */
2111 .flags = AV_PIX_FMT_FLAG_PLANAR,
2113 [AV_PIX_FMT_P010BE] = {
2119 { 0, 2, 0, 6, 10 }, /* Y */
2120 { 1, 4, 0, 6, 10 }, /* U */
2121 { 1, 4, 2, 6, 10 }, /* V */
2123 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2125 [AV_PIX_FMT_P016LE] = {
2131 { 0, 2, 0, 0, 16 }, /* Y */
2132 { 1, 4, 0, 0, 16 }, /* U */
2133 { 1, 4, 2, 0, 16 }, /* V */
2135 .flags = AV_PIX_FMT_FLAG_PLANAR,
2137 [AV_PIX_FMT_P016BE] = {
2143 { 0, 2, 0, 0, 16 }, /* Y */
2144 { 1, 4, 0, 0, 16 }, /* U */
2145 { 1, 4, 2, 0, 16 }, /* V */
2147 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2149 [AV_PIX_FMT_GBRAP12LE] = {
2150 .name = "gbrap12le",
2155 { 2, 2, 0, 0, 12 }, /* R */
2156 { 0, 2, 0, 0, 12 }, /* G */
2157 { 1, 2, 0, 0, 12 }, /* B */
2158 { 3, 2, 0, 0, 12 }, /* A */
2160 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2161 AV_PIX_FMT_FLAG_ALPHA,
2163 [AV_PIX_FMT_GBRAP12BE] = {
2164 .name = "gbrap12be",
2169 { 2, 2, 0, 0, 12 }, /* R */
2170 { 0, 2, 0, 0, 12 }, /* G */
2171 { 1, 2, 0, 0, 12 }, /* B */
2172 { 3, 2, 0, 0, 12 }, /* A */
2174 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2175 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2177 [AV_PIX_FMT_GBRAP10LE] = {
2178 .name = "gbrap10le",
2183 { 2, 2, 0, 0, 10 }, /* R */
2184 { 0, 2, 0, 0, 10 }, /* G */
2185 { 1, 2, 0, 0, 10 }, /* B */
2186 { 3, 2, 0, 0, 10 }, /* A */
2188 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2189 AV_PIX_FMT_FLAG_ALPHA,
2191 [AV_PIX_FMT_GBRAP10BE] = {
2192 .name = "gbrap10be",
2197 { 2, 2, 0, 0, 10 }, /* R */
2198 { 0, 2, 0, 0, 10 }, /* G */
2199 { 1, 2, 0, 0, 10 }, /* B */
2200 { 3, 2, 0, 0, 10 }, /* A */
2202 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2203 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2205 [AV_PIX_FMT_D3D11] = {
2207 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2209 [AV_PIX_FMT_GBRPF32BE] = {
2210 .name = "gbrpf32be",
2215 { 2, 4, 0, 0, 32 }, /* R */
2216 { 0, 4, 0, 0, 32 }, /* G */
2217 { 1, 4, 0, 0, 32 }, /* B */
2219 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2220 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
2222 [AV_PIX_FMT_GBRPF32LE] = {
2223 .name = "gbrpf32le",
2228 { 2, 4, 0, 0, 32 }, /* R */
2229 { 0, 4, 0, 0, 32 }, /* G */
2230 { 1, 4, 0, 0, 32 }, /* B */
2232 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_RGB,
2234 [AV_PIX_FMT_GBRAPF32BE] = {
2235 .name = "gbrapf32be",
2240 { 2, 4, 0, 0, 32 }, /* R */
2241 { 0, 4, 0, 0, 32 }, /* G */
2242 { 1, 4, 0, 0, 32 }, /* B */
2243 { 3, 4, 0, 0, 32 }, /* A */
2245 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2246 AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_RGB |
2247 AV_PIX_FMT_FLAG_FLOAT,
2249 [AV_PIX_FMT_GBRAPF32LE] = {
2250 .name = "gbrapf32le",
2255 { 2, 4, 0, 0, 32 }, /* R */
2256 { 0, 4, 0, 0, 32 }, /* G */
2257 { 1, 4, 0, 0, 32 }, /* B */
2258 { 3, 4, 0, 0, 32 }, /* A */
2260 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA |
2261 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
2263 [AV_PIX_FMT_DRM_PRIME] = {
2264 .name = "drm_prime",
2265 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2267 [AV_PIX_FMT_OPENCL] = {
2269 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2271 [AV_PIX_FMT_GRAYF32BE] = {
2272 .name = "grayf32be",
2277 { 0, 4, 0, 0, 32 }, /* Y */
2279 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_FLOAT,
2282 [AV_PIX_FMT_GRAYF32LE] = {
2283 .name = "grayf32le",
2288 { 0, 4, 0, 0, 32 }, /* Y */
2290 .flags = AV_PIX_FMT_FLAG_FLOAT,
2293 [AV_PIX_FMT_YUVA422P12BE] = {
2294 .name = "yuva422p12be",
2299 { 0, 2, 0, 0, 12 }, /* Y */
2300 { 1, 2, 0, 0, 12 }, /* U */
2301 { 2, 2, 0, 0, 12 }, /* V */
2302 { 3, 2, 0, 0, 12 }, /* A */
2304 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2306 [AV_PIX_FMT_YUVA422P12LE] = {
2307 .name = "yuva422p12le",
2312 { 0, 2, 0, 0, 12 }, /* Y */
2313 { 1, 2, 0, 0, 12 }, /* U */
2314 { 2, 2, 0, 0, 12 }, /* V */
2315 { 3, 2, 0, 0, 12 }, /* A */
2317 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2319 [AV_PIX_FMT_YUVA444P12BE] = {
2320 .name = "yuva444p12be",
2325 { 0, 2, 0, 0, 12 }, /* Y */
2326 { 1, 2, 0, 0, 12 }, /* U */
2327 { 2, 2, 0, 0, 12 }, /* V */
2328 { 3, 2, 0, 0, 12 }, /* A */
2330 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2332 [AV_PIX_FMT_YUVA444P12LE] = {
2333 .name = "yuva444p12le",
2338 { 0, 2, 0, 0, 12 }, /* Y */
2339 { 1, 2, 0, 0, 12 }, /* U */
2340 { 2, 2, 0, 0, 12 }, /* V */
2341 { 3, 2, 0, 0, 12 }, /* A */
2343 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2345 [AV_PIX_FMT_NV24] = {
2351 { 0, 1, 0, 0, 8 }, /* Y */
2352 { 1, 2, 0, 0, 8 }, /* U */
2353 { 1, 2, 1, 0, 8 }, /* V */
2355 .flags = AV_PIX_FMT_FLAG_PLANAR,
2357 [AV_PIX_FMT_NV42] = {
2363 { 0, 1, 0, 0, 8 }, /* Y */
2364 { 1, 2, 1, 0, 8 }, /* U */
2365 { 1, 2, 0, 0, 8 }, /* V */
2367 .flags = AV_PIX_FMT_FLAG_PLANAR,
2369 [AV_PIX_FMT_VULKAN] = {
2371 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2375 static const char * const color_range_names[] = {
2376 [AVCOL_RANGE_UNSPECIFIED] = "unknown",
2377 [AVCOL_RANGE_MPEG] = "tv",
2378 [AVCOL_RANGE_JPEG] = "pc",
2381 static const char * const color_primaries_names[AVCOL_PRI_NB] = {
2382 [AVCOL_PRI_RESERVED0] = "reserved",
2383 [AVCOL_PRI_BT709] = "bt709",
2384 [AVCOL_PRI_UNSPECIFIED] = "unknown",
2385 [AVCOL_PRI_RESERVED] = "reserved",
2386 [AVCOL_PRI_BT470M] = "bt470m",
2387 [AVCOL_PRI_BT470BG] = "bt470bg",
2388 [AVCOL_PRI_SMPTE170M] = "smpte170m",
2389 [AVCOL_PRI_SMPTE240M] = "smpte240m",
2390 [AVCOL_PRI_FILM] = "film",
2391 [AVCOL_PRI_BT2020] = "bt2020",
2392 [AVCOL_PRI_SMPTE428] = "smpte428",
2393 [AVCOL_PRI_SMPTE431] = "smpte431",
2394 [AVCOL_PRI_SMPTE432] = "smpte432",
2395 [AVCOL_PRI_EBU3213] = "ebu3213",
2398 static const char * const color_transfer_names[] = {
2399 [AVCOL_TRC_RESERVED0] = "reserved",
2400 [AVCOL_TRC_BT709] = "bt709",
2401 [AVCOL_TRC_UNSPECIFIED] = "unknown",
2402 [AVCOL_TRC_RESERVED] = "reserved",
2403 [AVCOL_TRC_GAMMA22] = "bt470m",
2404 [AVCOL_TRC_GAMMA28] = "bt470bg",
2405 [AVCOL_TRC_SMPTE170M] = "smpte170m",
2406 [AVCOL_TRC_SMPTE240M] = "smpte240m",
2407 [AVCOL_TRC_LINEAR] = "linear",
2408 [AVCOL_TRC_LOG] = "log100",
2409 [AVCOL_TRC_LOG_SQRT] = "log316",
2410 [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
2411 [AVCOL_TRC_BT1361_ECG] = "bt1361e",
2412 [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
2413 [AVCOL_TRC_BT2020_10] = "bt2020-10",
2414 [AVCOL_TRC_BT2020_12] = "bt2020-12",
2415 [AVCOL_TRC_SMPTE2084] = "smpte2084",
2416 [AVCOL_TRC_SMPTE428] = "smpte428",
2417 [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
2420 static const char * const color_space_names[] = {
2421 [AVCOL_SPC_RGB] = "gbr",
2422 [AVCOL_SPC_BT709] = "bt709",
2423 [AVCOL_SPC_UNSPECIFIED] = "unknown",
2424 [AVCOL_SPC_RESERVED] = "reserved",
2425 [AVCOL_SPC_FCC] = "fcc",
2426 [AVCOL_SPC_BT470BG] = "bt470bg",
2427 [AVCOL_SPC_SMPTE170M] = "smpte170m",
2428 [AVCOL_SPC_SMPTE240M] = "smpte240m",
2429 [AVCOL_SPC_YCGCO] = "ycgco",
2430 [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
2431 [AVCOL_SPC_BT2020_CL] = "bt2020c",
2432 [AVCOL_SPC_SMPTE2085] = "smpte2085",
2433 [AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
2434 [AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
2435 [AVCOL_SPC_ICTCP] = "ictcp",
2438 static const char * const chroma_location_names[] = {
2439 [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
2440 [AVCHROMA_LOC_LEFT] = "left",
2441 [AVCHROMA_LOC_CENTER] = "center",
2442 [AVCHROMA_LOC_TOPLEFT] = "topleft",
2443 [AVCHROMA_LOC_TOP] = "top",
2444 [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
2445 [AVCHROMA_LOC_BOTTOM] = "bottom",
2448 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
2450 enum AVPixelFormat pix_fmt;
2452 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
2453 if (av_pix_fmt_descriptors[pix_fmt].name &&
2454 (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
2455 av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
2458 return AV_PIX_FMT_NONE;
2461 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
2463 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
2464 av_pix_fmt_descriptors[pix_fmt].name : NULL;
2468 # define X_NE(be, le) be
2470 # define X_NE(be, le) le
2473 enum AVPixelFormat av_get_pix_fmt(const char *name)
2475 enum AVPixelFormat pix_fmt;
2477 if (!strcmp(name, "rgb32"))
2478 name = X_NE("argb", "bgra");
2479 else if (!strcmp(name, "bgr32"))
2480 name = X_NE("abgr", "rgba");
2482 pix_fmt = get_pix_fmt_internal(name);
2483 if (pix_fmt == AV_PIX_FMT_NONE) {
2486 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
2487 pix_fmt = get_pix_fmt_internal(name2);
2493 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
2496 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2498 for (c = 0; c < pixdesc->nb_components; c++) {
2499 int s = c == 1 || c == 2 ? 0 : log2_pixels;
2500 bits += pixdesc->comp[c].depth << s;
2503 return bits >> log2_pixels;
2506 int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
2509 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2512 for (c = 0; c < pixdesc->nb_components; c++) {
2513 const AVComponentDescriptor *comp = &pixdesc->comp[c];
2514 int s = c == 1 || c == 2 ? 0 : log2_pixels;
2515 steps[comp->plane] = comp->step << s;
2517 for (c = 0; c < 4; c++)
2520 if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
2523 return bits >> log2_pixels;
2526 char *av_get_pix_fmt_string(char *buf, int buf_size,
2527 enum AVPixelFormat pix_fmt)
2531 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
2533 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
2534 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
2535 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
2541 const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
2543 if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
2545 return &av_pix_fmt_descriptors[pix_fmt];
2548 const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
2551 return &av_pix_fmt_descriptors[0];
2552 while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
2560 enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
2562 if (desc < av_pix_fmt_descriptors ||
2563 desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
2564 return AV_PIX_FMT_NONE;
2566 return desc - av_pix_fmt_descriptors;
2569 int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
2570 int *h_shift, int *v_shift)
2572 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2574 return AVERROR(ENOSYS);
2575 *h_shift = desc->log2_chroma_w;
2576 *v_shift = desc->log2_chroma_h;
2581 int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
2583 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2584 int i, planes[4] = { 0 }, ret = 0;
2587 return AVERROR(EINVAL);
2589 for (i = 0; i < desc->nb_components; i++)
2590 planes[desc->comp[i].plane] = 1;
2591 for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
2596 void ff_check_pixfmt_descriptors(void){
2599 for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
2600 const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
2601 uint8_t fill[4][8+6+3] = {{0}};
2602 uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
2603 int linesize[4] = {0,0,0,0};
2606 if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
2608 // av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
2609 av_assert0(d->log2_chroma_w <= 3);
2610 av_assert0(d->log2_chroma_h <= 3);
2611 av_assert0(d->nb_components <= 4);
2612 av_assert0(d->name && d->name[0]);
2613 av_assert2(av_get_pix_fmt(d->name) == i);
2615 for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
2616 const AVComponentDescriptor *c = &d->comp[j];
2617 if(j>=d->nb_components) {
2618 av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
2621 if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
2622 av_assert0(c->step >= c->depth);
2624 av_assert0(8*c->step >= c->depth);
2626 if (d->flags & AV_PIX_FMT_FLAG_BAYER)
2628 av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
2629 av_assert0(tmp[0] == 0 && tmp[1] == 0);
2630 tmp[0] = tmp[1] = (1ULL << c->depth) - 1;
2631 av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
2637 enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
2639 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2643 if (!desc || strlen(desc->name) < 2)
2644 return AV_PIX_FMT_NONE;
2645 av_strlcpy(name, desc->name, sizeof(name));
2646 i = strlen(name) - 2;
2647 if (strcmp(name + i, "be") && strcmp(name + i, "le"))
2648 return AV_PIX_FMT_NONE;
2650 name[i] ^= 'b' ^ 'l';
2652 return get_pix_fmt_internal(name);
2655 #define FF_COLOR_NA -1
2656 #define FF_COLOR_RGB 0 /**< RGB color space */
2657 #define FF_COLOR_GRAY 1 /**< gray color space */
2658 #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
2659 #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
2660 #define FF_COLOR_XYZ 4
2662 #define pixdesc_has_alpha(pixdesc) \
2663 ((pixdesc)->flags & AV_PIX_FMT_FLAG_ALPHA)
2666 static int get_color_type(const AVPixFmtDescriptor *desc) {
2667 if (desc->flags & AV_PIX_FMT_FLAG_PAL)
2668 return FF_COLOR_RGB;
2670 if(desc->nb_components == 1 || desc->nb_components == 2)
2671 return FF_COLOR_GRAY;
2674 if (av_strstart(desc->name, "yuvj", NULL))
2675 return FF_COLOR_YUV_JPEG;
2677 if (av_strstart(desc->name, "xyz", NULL))
2678 return FF_COLOR_XYZ;
2681 if(desc->flags & AV_PIX_FMT_FLAG_RGB)
2682 return FF_COLOR_RGB;
2684 if(desc->nb_components == 0)
2687 return FF_COLOR_YUV;
2690 static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
2692 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2695 if (!desc || !desc->nb_components) {
2697 return AVERROR(EINVAL);
2700 *min = INT_MAX, *max = -INT_MAX;
2701 for (i = 0; i < desc->nb_components; i++) {
2702 *min = FFMIN(desc->comp[i].depth, *min);
2703 *max = FFMAX(desc->comp[i].depth, *max);
2708 static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
2709 enum AVPixelFormat src_pix_fmt,
2710 unsigned *lossp, unsigned consider)
2712 const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
2713 const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
2714 int src_color, dst_color;
2715 int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
2716 int ret, loss, i, nb_components;
2717 int score = INT_MAX - 1;
2719 if (!src_desc || !dst_desc)
2722 if ((src_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) ||
2723 (dst_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
2724 if (dst_pix_fmt == src_pix_fmt)
2733 if (dst_pix_fmt == src_pix_fmt)
2736 if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
2738 if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
2741 src_color = get_color_type(src_desc);
2742 dst_color = get_color_type(dst_desc);
2743 if (dst_pix_fmt == AV_PIX_FMT_PAL8)
2744 nb_components = FFMIN(src_desc->nb_components, 4);
2746 nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
2748 for (i = 0; i < nb_components; i++) {
2749 int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
2750 if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
2751 loss |= FF_LOSS_DEPTH;
2752 score -= 65536 >> depth_minus1;
2756 if (consider & FF_LOSS_RESOLUTION) {
2757 if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
2758 loss |= FF_LOSS_RESOLUTION;
2759 score -= 256 << dst_desc->log2_chroma_w;
2761 if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
2762 loss |= FF_LOSS_RESOLUTION;
2763 score -= 256 << dst_desc->log2_chroma_h;
2765 // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
2766 if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
2767 dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
2772 if(consider & FF_LOSS_COLORSPACE)
2775 if (src_color != FF_COLOR_RGB &&
2776 src_color != FF_COLOR_GRAY)
2777 loss |= FF_LOSS_COLORSPACE;
2780 if (src_color != FF_COLOR_GRAY)
2781 loss |= FF_LOSS_COLORSPACE;
2784 if (src_color != FF_COLOR_YUV)
2785 loss |= FF_LOSS_COLORSPACE;
2787 case FF_COLOR_YUV_JPEG:
2788 if (src_color != FF_COLOR_YUV_JPEG &&
2789 src_color != FF_COLOR_YUV &&
2790 src_color != FF_COLOR_GRAY)
2791 loss |= FF_LOSS_COLORSPACE;
2794 /* fail safe test */
2795 if (src_color != dst_color)
2796 loss |= FF_LOSS_COLORSPACE;
2799 if(loss & FF_LOSS_COLORSPACE)
2800 score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
2802 if (dst_color == FF_COLOR_GRAY &&
2803 src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
2804 loss |= FF_LOSS_CHROMA;
2807 if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
2808 loss |= FF_LOSS_ALPHA;
2811 if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
2812 (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
2813 loss |= FF_LOSS_COLORQUANT;
2821 int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
2822 enum AVPixelFormat src_pix_fmt,
2826 int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
2832 enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
2833 enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
2835 enum AVPixelFormat dst_pix_fmt;
2836 int loss1, loss2, loss_mask;
2837 const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
2838 const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
2842 dst_pix_fmt = dst_pix_fmt2;
2843 } else if (!desc2) {
2844 dst_pix_fmt = dst_pix_fmt1;
2846 loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
2848 loss_mask &= ~FF_LOSS_ALPHA;
2850 score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
2851 score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
2853 if (score1 == score2) {
2854 if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) {
2855 dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
2857 dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
2860 dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
2865 *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
2869 const char *av_color_range_name(enum AVColorRange range)
2871 return (unsigned) range < AVCOL_RANGE_NB ?
2872 color_range_names[range] : NULL;
2875 int av_color_range_from_name(const char *name)
2879 for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
2880 if (av_strstart(name, color_range_names[i], NULL))
2884 return AVERROR(EINVAL);
2887 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
2889 return (unsigned) primaries < AVCOL_PRI_NB ?
2890 color_primaries_names[primaries] : NULL;
2893 int av_color_primaries_from_name(const char *name)
2897 for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) {
2898 if (!color_primaries_names[i])
2901 if (av_strstart(name, color_primaries_names[i], NULL))
2905 return AVERROR(EINVAL);
2908 const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
2910 return (unsigned) transfer < AVCOL_TRC_NB ?
2911 color_transfer_names[transfer] : NULL;
2914 int av_color_transfer_from_name(const char *name)
2918 for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) {
2919 if (!color_transfer_names[i])
2922 if (av_strstart(name, color_transfer_names[i], NULL))
2926 return AVERROR(EINVAL);
2929 const char *av_color_space_name(enum AVColorSpace space)
2931 return (unsigned) space < AVCOL_SPC_NB ?
2932 color_space_names[space] : NULL;
2935 int av_color_space_from_name(const char *name)
2939 for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) {
2940 if (!color_space_names[i])
2943 if (av_strstart(name, color_space_names[i], NULL))
2947 return AVERROR(EINVAL);
2950 const char *av_chroma_location_name(enum AVChromaLocation location)
2952 return (unsigned) location < AVCHROMA_LOC_NB ?
2953 chroma_location_names[location] : NULL;
2956 int av_chroma_location_from_name(const char *name)
2960 for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) {
2961 if (!chroma_location_names[i])
2964 if (av_strstart(name, chroma_location_names[i], NULL))
2968 return AVERROR(EINVAL);