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_GRAY9BE] = {
569 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
571 .flags = AV_PIX_FMT_FLAG_BE,
574 [AV_PIX_FMT_GRAY9LE] = {
580 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
584 [AV_PIX_FMT_GRAY10BE] = {
590 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
592 .flags = AV_PIX_FMT_FLAG_BE,
595 [AV_PIX_FMT_GRAY10LE] = {
601 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
605 [AV_PIX_FMT_GRAY12BE] = {
611 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
613 .flags = AV_PIX_FMT_FLAG_BE,
616 [AV_PIX_FMT_GRAY12LE] = {
622 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
626 [AV_PIX_FMT_GRAY16BE] = {
632 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
634 .flags = AV_PIX_FMT_FLAG_BE,
637 [AV_PIX_FMT_GRAY16LE] = {
643 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
647 [AV_PIX_FMT_YUV440P] = {
653 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
654 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
655 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
657 .flags = AV_PIX_FMT_FLAG_PLANAR,
659 [AV_PIX_FMT_YUVJ440P] = {
665 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
666 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
667 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
669 .flags = AV_PIX_FMT_FLAG_PLANAR,
671 [AV_PIX_FMT_YUV440P10LE] = {
672 .name = "yuv440p10le",
677 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
678 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
679 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
681 .flags = AV_PIX_FMT_FLAG_PLANAR,
683 [AV_PIX_FMT_YUV440P10BE] = {
684 .name = "yuv440p10be",
689 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
690 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
691 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
693 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
695 [AV_PIX_FMT_YUV440P12LE] = {
696 .name = "yuv440p12le",
701 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
702 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
703 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
705 .flags = AV_PIX_FMT_FLAG_PLANAR,
707 [AV_PIX_FMT_YUV440P12BE] = {
708 .name = "yuv440p12be",
713 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
714 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
715 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
717 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
719 [AV_PIX_FMT_YUVA420P] = {
725 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
726 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
727 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
728 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
730 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
732 [AV_PIX_FMT_YUVA422P] = {
738 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
739 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
740 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
741 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
743 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
745 [AV_PIX_FMT_YUVA444P] = {
751 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
752 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
753 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
754 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
756 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
758 [AV_PIX_FMT_YUVA420P9BE] = {
759 .name = "yuva420p9be",
764 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
765 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
766 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
767 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
769 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
771 [AV_PIX_FMT_YUVA420P9LE] = {
772 .name = "yuva420p9le",
777 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
778 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
779 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
780 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
782 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
784 [AV_PIX_FMT_YUVA422P9BE] = {
785 .name = "yuva422p9be",
790 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
791 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
792 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
793 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
795 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
797 [AV_PIX_FMT_YUVA422P9LE] = {
798 .name = "yuva422p9le",
803 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
804 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
805 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
806 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
808 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
810 [AV_PIX_FMT_YUVA444P9BE] = {
811 .name = "yuva444p9be",
816 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
817 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
818 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
819 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
821 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
823 [AV_PIX_FMT_YUVA444P9LE] = {
824 .name = "yuva444p9le",
829 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
830 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
831 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
832 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
834 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
836 [AV_PIX_FMT_YUVA420P10BE] = {
837 .name = "yuva420p10be",
842 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
843 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
844 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
845 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
847 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
849 [AV_PIX_FMT_YUVA420P10LE] = {
850 .name = "yuva420p10le",
855 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
856 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
857 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
858 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
860 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
862 [AV_PIX_FMT_YUVA422P10BE] = {
863 .name = "yuva422p10be",
868 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
869 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
870 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
871 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
873 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
875 [AV_PIX_FMT_YUVA422P10LE] = {
876 .name = "yuva422p10le",
881 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
882 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
883 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
884 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
886 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
888 [AV_PIX_FMT_YUVA444P10BE] = {
889 .name = "yuva444p10be",
894 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
895 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
896 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
897 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
899 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
901 [AV_PIX_FMT_YUVA444P10LE] = {
902 .name = "yuva444p10le",
907 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
908 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
909 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
910 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
912 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
914 [AV_PIX_FMT_YUVA420P16BE] = {
915 .name = "yuva420p16be",
920 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
921 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
922 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
923 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
925 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
927 [AV_PIX_FMT_YUVA420P16LE] = {
928 .name = "yuva420p16le",
933 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
934 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
935 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
936 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
938 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
940 [AV_PIX_FMT_YUVA422P16BE] = {
941 .name = "yuva422p16be",
946 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
947 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
948 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
949 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
951 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
953 [AV_PIX_FMT_YUVA422P16LE] = {
954 .name = "yuva422p16le",
959 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
960 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
961 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
962 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
964 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
966 [AV_PIX_FMT_YUVA444P16BE] = {
967 .name = "yuva444p16be",
972 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
973 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
974 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
975 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
977 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
979 [AV_PIX_FMT_YUVA444P16LE] = {
980 .name = "yuva444p16le",
985 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
986 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
987 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
988 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
990 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
993 [AV_PIX_FMT_VDPAU_H264] = {
994 .name = "vdpau_h264",
997 .flags = AV_PIX_FMT_FLAG_HWACCEL,
999 [AV_PIX_FMT_VDPAU_MPEG1] = {
1000 .name = "vdpau_mpeg1",
1003 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1005 [AV_PIX_FMT_VDPAU_MPEG2] = {
1006 .name = "vdpau_mpeg2",
1009 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1011 [AV_PIX_FMT_VDPAU_WMV3] = {
1012 .name = "vdpau_wmv3",
1015 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1017 [AV_PIX_FMT_VDPAU_VC1] = {
1018 .name = "vdpau_vc1",
1021 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1023 [AV_PIX_FMT_VDPAU_MPEG4] = {
1024 .name = "vdpau_mpeg4",
1027 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1030 [AV_PIX_FMT_RGB48BE] = {
1036 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
1037 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1038 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
1040 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
1042 [AV_PIX_FMT_RGB48LE] = {
1048 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
1049 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1050 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
1052 .flags = AV_PIX_FMT_FLAG_RGB,
1054 [AV_PIX_FMT_RGBA64BE] = {
1060 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
1061 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1062 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1063 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1065 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1067 [AV_PIX_FMT_RGBA64LE] = {
1073 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
1074 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1075 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1076 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1078 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1080 [AV_PIX_FMT_RGB565BE] = {
1086 { 0, 2, -1, 3, 5, 1, 4, 0 }, /* R */
1087 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1088 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1090 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1092 [AV_PIX_FMT_RGB565LE] = {
1098 { 0, 2, 1, 3, 5, 1, 4, 2 }, /* R */
1099 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1100 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1102 .flags = AV_PIX_FMT_FLAG_RGB,
1104 [AV_PIX_FMT_RGB555BE] = {
1110 { 0, 2, -1, 2, 5, 1, 4, 0 }, /* R */
1111 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1112 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1114 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1116 [AV_PIX_FMT_RGB555LE] = {
1122 { 0, 2, 1, 2, 5, 1, 4, 2 }, /* R */
1123 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1124 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1126 .flags = AV_PIX_FMT_FLAG_RGB,
1128 [AV_PIX_FMT_RGB444BE] = {
1134 { 0, 2, -1, 0, 4, 1, 3, 0 }, /* R */
1135 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1136 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1138 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1140 [AV_PIX_FMT_RGB444LE] = {
1146 { 0, 2, 1, 0, 4, 1, 3, 2 }, /* R */
1147 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1148 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1150 .flags = AV_PIX_FMT_FLAG_RGB,
1152 [AV_PIX_FMT_BGR48BE] = {
1158 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1159 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1160 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1162 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1164 [AV_PIX_FMT_BGR48LE] = {
1170 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1171 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1172 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1174 .flags = AV_PIX_FMT_FLAG_RGB,
1176 [AV_PIX_FMT_BGRA64BE] = {
1182 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1183 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1184 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1185 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1187 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1189 [AV_PIX_FMT_BGRA64LE] = {
1195 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1196 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1197 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1198 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1200 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1202 [AV_PIX_FMT_BGR565BE] = {
1208 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1209 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1210 { 0, 2, -1, 3, 5, 1, 4, 0 }, /* B */
1212 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1214 [AV_PIX_FMT_BGR565LE] = {
1220 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1221 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1222 { 0, 2, 1, 3, 5, 1, 4, 2 }, /* B */
1224 .flags = AV_PIX_FMT_FLAG_RGB,
1226 [AV_PIX_FMT_BGR555BE] = {
1232 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1233 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1234 { 0, 2, -1, 2, 5, 1, 4, 0 }, /* B */
1236 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1238 [AV_PIX_FMT_BGR555LE] = {
1244 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1245 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1246 { 0, 2, 1, 2, 5, 1, 4, 2 }, /* B */
1248 .flags = AV_PIX_FMT_FLAG_RGB,
1250 [AV_PIX_FMT_BGR444BE] = {
1256 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1257 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1258 { 0, 2, -1, 0, 4, 1, 3, 0 }, /* B */
1260 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1262 [AV_PIX_FMT_BGR444LE] = {
1268 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1269 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1270 { 0, 2, 1, 0, 4, 1, 3, 2 }, /* B */
1272 .flags = AV_PIX_FMT_FLAG_RGB,
1275 [AV_PIX_FMT_VAAPI_MOCO] = {
1276 .name = "vaapi_moco",
1279 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1281 [AV_PIX_FMT_VAAPI_IDCT] = {
1282 .name = "vaapi_idct",
1285 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1287 [AV_PIX_FMT_VAAPI_VLD] = {
1288 .name = "vaapi_vld",
1291 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1294 [AV_PIX_FMT_VAAPI] = {
1298 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1301 [AV_PIX_FMT_YUV420P9LE] = {
1302 .name = "yuv420p9le",
1307 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1308 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1309 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1311 .flags = AV_PIX_FMT_FLAG_PLANAR,
1313 [AV_PIX_FMT_YUV420P9BE] = {
1314 .name = "yuv420p9be",
1319 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1320 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1321 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1323 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1325 [AV_PIX_FMT_YUV420P10LE] = {
1326 .name = "yuv420p10le",
1331 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1332 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1333 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1335 .flags = AV_PIX_FMT_FLAG_PLANAR,
1337 [AV_PIX_FMT_YUV420P10BE] = {
1338 .name = "yuv420p10be",
1343 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1344 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1345 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1347 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1349 [AV_PIX_FMT_YUV420P12LE] = {
1350 .name = "yuv420p12le",
1355 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1356 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1357 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1359 .flags = AV_PIX_FMT_FLAG_PLANAR,
1361 [AV_PIX_FMT_YUV420P12BE] = {
1362 .name = "yuv420p12be",
1367 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1368 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1369 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1371 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1373 [AV_PIX_FMT_YUV420P14LE] = {
1374 .name = "yuv420p14le",
1379 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1380 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1381 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1383 .flags = AV_PIX_FMT_FLAG_PLANAR,
1385 [AV_PIX_FMT_YUV420P14BE] = {
1386 .name = "yuv420p14be",
1391 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1392 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1393 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1395 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1397 [AV_PIX_FMT_YUV420P16LE] = {
1398 .name = "yuv420p16le",
1403 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1404 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1405 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1407 .flags = AV_PIX_FMT_FLAG_PLANAR,
1409 [AV_PIX_FMT_YUV420P16BE] = {
1410 .name = "yuv420p16be",
1415 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1416 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1417 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1419 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1421 [AV_PIX_FMT_YUV422P9LE] = {
1422 .name = "yuv422p9le",
1427 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1428 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1429 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1431 .flags = AV_PIX_FMT_FLAG_PLANAR,
1433 [AV_PIX_FMT_YUV422P9BE] = {
1434 .name = "yuv422p9be",
1439 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1440 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1441 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1443 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1445 [AV_PIX_FMT_YUV422P10LE] = {
1446 .name = "yuv422p10le",
1451 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1452 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1453 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1455 .flags = AV_PIX_FMT_FLAG_PLANAR,
1457 [AV_PIX_FMT_YUV422P10BE] = {
1458 .name = "yuv422p10be",
1463 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1464 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1465 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1467 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1469 [AV_PIX_FMT_YUV422P12LE] = {
1470 .name = "yuv422p12le",
1475 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1476 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1477 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1479 .flags = AV_PIX_FMT_FLAG_PLANAR,
1481 [AV_PIX_FMT_YUV422P12BE] = {
1482 .name = "yuv422p12be",
1487 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1488 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1489 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1491 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1493 [AV_PIX_FMT_YUV422P14LE] = {
1494 .name = "yuv422p14le",
1499 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1500 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1501 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1503 .flags = AV_PIX_FMT_FLAG_PLANAR,
1505 [AV_PIX_FMT_YUV422P14BE] = {
1506 .name = "yuv422p14be",
1511 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1512 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1513 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1515 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1517 [AV_PIX_FMT_YUV422P16LE] = {
1518 .name = "yuv422p16le",
1523 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1524 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1525 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1527 .flags = AV_PIX_FMT_FLAG_PLANAR,
1529 [AV_PIX_FMT_YUV422P16BE] = {
1530 .name = "yuv422p16be",
1535 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1536 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1537 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1539 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1541 [AV_PIX_FMT_YUV444P16LE] = {
1542 .name = "yuv444p16le",
1547 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1548 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1549 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1551 .flags = AV_PIX_FMT_FLAG_PLANAR,
1553 [AV_PIX_FMT_YUV444P16BE] = {
1554 .name = "yuv444p16be",
1559 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1560 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1561 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1563 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1565 [AV_PIX_FMT_YUV444P10LE] = {
1566 .name = "yuv444p10le",
1571 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1572 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1573 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1575 .flags = AV_PIX_FMT_FLAG_PLANAR,
1577 [AV_PIX_FMT_YUV444P10BE] = {
1578 .name = "yuv444p10be",
1583 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1584 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1585 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1587 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1589 [AV_PIX_FMT_YUV444P9LE] = {
1590 .name = "yuv444p9le",
1595 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1596 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1597 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1599 .flags = AV_PIX_FMT_FLAG_PLANAR,
1601 [AV_PIX_FMT_YUV444P9BE] = {
1602 .name = "yuv444p9be",
1607 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1608 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1609 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1611 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1613 [AV_PIX_FMT_YUV444P12LE] = {
1614 .name = "yuv444p12le",
1619 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1620 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1621 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1623 .flags = AV_PIX_FMT_FLAG_PLANAR,
1625 [AV_PIX_FMT_YUV444P12BE] = {
1626 .name = "yuv444p12be",
1631 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1632 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1633 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1635 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1637 [AV_PIX_FMT_YUV444P14LE] = {
1638 .name = "yuv444p14le",
1643 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1644 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1645 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1647 .flags = AV_PIX_FMT_FLAG_PLANAR,
1649 [AV_PIX_FMT_YUV444P14BE] = {
1650 .name = "yuv444p14be",
1655 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1656 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1657 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1659 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1661 [AV_PIX_FMT_D3D11VA_VLD] = {
1662 .name = "d3d11va_vld",
1665 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1667 [AV_PIX_FMT_DXVA2_VLD] = {
1668 .name = "dxva2_vld",
1671 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1673 [AV_PIX_FMT_VDA_VLD] = {
1677 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1679 [AV_PIX_FMT_YA8] = {
1683 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
1684 { 0, 2, 1, 0, 8, 1, 7, 2 }, /* A */
1686 .flags = AV_PIX_FMT_FLAG_ALPHA,
1689 [AV_PIX_FMT_YA16LE] = {
1693 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1694 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1696 .flags = AV_PIX_FMT_FLAG_ALPHA,
1698 [AV_PIX_FMT_YA16BE] = {
1702 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1703 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1705 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
1707 [AV_PIX_FMT_VIDEOTOOLBOX] = {
1708 .name = "videotoolbox_vld",
1709 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1711 [AV_PIX_FMT_GBRP] = {
1717 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1718 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1719 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1721 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1723 [AV_PIX_FMT_GBRP9LE] = {
1729 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1730 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1731 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1733 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1735 [AV_PIX_FMT_GBRP9BE] = {
1741 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1742 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1743 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1745 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1747 [AV_PIX_FMT_GBRP10LE] = {
1753 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1754 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1755 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1757 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1759 [AV_PIX_FMT_GBRP10BE] = {
1765 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1766 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1767 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1769 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1771 [AV_PIX_FMT_GBRP12LE] = {
1777 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1778 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1779 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1781 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1783 [AV_PIX_FMT_GBRP12BE] = {
1789 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1790 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1791 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1793 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1795 [AV_PIX_FMT_GBRP14LE] = {
1801 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1802 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1803 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1805 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1807 [AV_PIX_FMT_GBRP14BE] = {
1813 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1814 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1815 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1817 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1819 [AV_PIX_FMT_GBRP16LE] = {
1825 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1826 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1827 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1829 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1831 [AV_PIX_FMT_GBRP16BE] = {
1837 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1838 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1839 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1841 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1843 [AV_PIX_FMT_GBRAP] = {
1849 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1850 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1851 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1852 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
1854 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1855 AV_PIX_FMT_FLAG_ALPHA,
1857 [AV_PIX_FMT_GBRAP16LE] = {
1858 .name = "gbrap16le",
1863 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1864 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1865 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1866 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1868 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1869 AV_PIX_FMT_FLAG_ALPHA,
1871 [AV_PIX_FMT_GBRAP16BE] = {
1872 .name = "gbrap16be",
1877 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1878 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1879 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1880 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1882 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
1883 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1885 [AV_PIX_FMT_VDPAU] = {
1889 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1891 [AV_PIX_FMT_XYZ12LE] = {
1897 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1898 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1899 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1901 /*.flags = -- not used*/
1903 [AV_PIX_FMT_XYZ12BE] = {
1909 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1910 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1911 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1913 .flags = AV_PIX_FMT_FLAG_BE,
1916 #define BAYER8_DESC_COMMON \
1917 .nb_components= 3, \
1918 .log2_chroma_w= 0, \
1919 .log2_chroma_h= 0, \
1926 #define BAYER16_DESC_COMMON \
1927 .nb_components= 3, \
1928 .log2_chroma_w= 0, \
1929 .log2_chroma_h= 0, \
1936 [AV_PIX_FMT_BAYER_BGGR8] = {
1937 .name = "bayer_bggr8",
1939 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1941 [AV_PIX_FMT_BAYER_BGGR16LE] = {
1942 .name = "bayer_bggr16le",
1944 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1946 [AV_PIX_FMT_BAYER_BGGR16BE] = {
1947 .name = "bayer_bggr16be",
1949 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1951 [AV_PIX_FMT_BAYER_RGGB8] = {
1952 .name = "bayer_rggb8",
1954 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1956 [AV_PIX_FMT_BAYER_RGGB16LE] = {
1957 .name = "bayer_rggb16le",
1959 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1961 [AV_PIX_FMT_BAYER_RGGB16BE] = {
1962 .name = "bayer_rggb16be",
1964 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1966 [AV_PIX_FMT_BAYER_GBRG8] = {
1967 .name = "bayer_gbrg8",
1969 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1971 [AV_PIX_FMT_BAYER_GBRG16LE] = {
1972 .name = "bayer_gbrg16le",
1974 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1976 [AV_PIX_FMT_BAYER_GBRG16BE] = {
1977 .name = "bayer_gbrg16be",
1979 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1981 [AV_PIX_FMT_BAYER_GRBG8] = {
1982 .name = "bayer_grbg8",
1984 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1986 [AV_PIX_FMT_BAYER_GRBG16LE] = {
1987 .name = "bayer_grbg16le",
1989 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1991 [AV_PIX_FMT_BAYER_GRBG16BE] = {
1992 .name = "bayer_grbg16be",
1994 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1996 [AV_PIX_FMT_NV16] = {
2002 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
2003 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
2004 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
2006 .flags = AV_PIX_FMT_FLAG_PLANAR,
2008 [AV_PIX_FMT_NV20LE] = {
2014 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
2015 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
2016 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
2018 .flags = AV_PIX_FMT_FLAG_PLANAR,
2020 [AV_PIX_FMT_NV20BE] = {
2026 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
2027 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
2028 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
2030 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2032 [AV_PIX_FMT_VDA] = {
2034 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2036 [AV_PIX_FMT_QSV] = {
2038 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2040 [AV_PIX_FMT_MEDIACODEC] = {
2041 .name = "mediacodec",
2042 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2044 [AV_PIX_FMT_MMAL] = {
2046 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2048 [AV_PIX_FMT_CUDA] = {
2050 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2052 [AV_PIX_FMT_AYUV64LE] = {
2058 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
2059 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2060 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2061 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2063 .flags = AV_PIX_FMT_FLAG_ALPHA,
2065 [AV_PIX_FMT_AYUV64BE] = {
2071 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
2072 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2073 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2074 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2076 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
2078 [AV_PIX_FMT_P010LE] = {
2084 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2085 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2086 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2088 .flags = AV_PIX_FMT_FLAG_PLANAR,
2090 [AV_PIX_FMT_P010BE] = {
2096 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2097 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2098 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2100 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2102 [AV_PIX_FMT_P016LE] = {
2108 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
2109 { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
2110 { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
2112 .flags = AV_PIX_FMT_FLAG_PLANAR,
2114 [AV_PIX_FMT_P016BE] = {
2120 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
2121 { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
2122 { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
2124 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2126 [AV_PIX_FMT_GBRAP12LE] = {
2127 .name = "gbrap12le",
2132 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2133 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2134 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2135 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2137 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2138 AV_PIX_FMT_FLAG_ALPHA,
2140 [AV_PIX_FMT_GBRAP12BE] = {
2141 .name = "gbrap12be",
2146 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2147 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2148 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2149 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2151 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2152 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2154 [AV_PIX_FMT_GBRAP10LE] = {
2155 .name = "gbrap10le",
2160 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2161 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2162 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2163 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2165 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2166 AV_PIX_FMT_FLAG_ALPHA,
2168 [AV_PIX_FMT_GBRAP10BE] = {
2169 .name = "gbrap10be",
2174 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2175 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2176 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2177 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2179 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2180 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2182 [AV_PIX_FMT_D3D11] = {
2184 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2186 [AV_PIX_FMT_GBRPF32BE] = {
2187 .name = "gbrpf32be",
2192 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2193 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2194 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2196 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2197 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
2199 [AV_PIX_FMT_GBRPF32LE] = {
2200 .name = "gbrpf32le",
2205 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2206 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2207 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2209 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_RGB,
2211 [AV_PIX_FMT_GBRAPF32BE] = {
2212 .name = "gbrapf32be",
2217 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2218 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2219 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2220 { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
2222 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2223 AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_RGB |
2224 AV_PIX_FMT_FLAG_FLOAT,
2226 [AV_PIX_FMT_GBRAPF32LE] = {
2227 .name = "gbrapf32le",
2232 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2233 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2234 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2235 { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
2237 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA |
2238 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
2240 [AV_PIX_FMT_DRM_PRIME] = {
2241 .name = "drm_prime",
2242 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2245 #if FF_API_PLUS1_MINUS1
2246 FF_ENABLE_DEPRECATION_WARNINGS
2249 static const char * const color_range_names[] = {
2250 [AVCOL_RANGE_UNSPECIFIED] = "unknown",
2251 [AVCOL_RANGE_MPEG] = "tv",
2252 [AVCOL_RANGE_JPEG] = "pc",
2255 static const char * const color_primaries_names[AVCOL_PRI_NB] = {
2256 [AVCOL_PRI_RESERVED0] = "reserved",
2257 [AVCOL_PRI_BT709] = "bt709",
2258 [AVCOL_PRI_UNSPECIFIED] = "unknown",
2259 [AVCOL_PRI_RESERVED] = "reserved",
2260 [AVCOL_PRI_BT470M] = "bt470m",
2261 [AVCOL_PRI_BT470BG] = "bt470bg",
2262 [AVCOL_PRI_SMPTE170M] = "smpte170m",
2263 [AVCOL_PRI_SMPTE240M] = "smpte240m",
2264 [AVCOL_PRI_FILM] = "film",
2265 [AVCOL_PRI_BT2020] = "bt2020",
2266 [AVCOL_PRI_SMPTE428] = "smpte428",
2267 [AVCOL_PRI_SMPTE431] = "smpte431",
2268 [AVCOL_PRI_SMPTE432] = "smpte432",
2269 [AVCOL_PRI_JEDEC_P22] = "jedec-p22",
2272 static const char * const color_transfer_names[] = {
2273 [AVCOL_TRC_RESERVED0] = "reserved",
2274 [AVCOL_TRC_BT709] = "bt709",
2275 [AVCOL_TRC_UNSPECIFIED] = "unknown",
2276 [AVCOL_TRC_RESERVED] = "reserved",
2277 [AVCOL_TRC_GAMMA22] = "bt470m",
2278 [AVCOL_TRC_GAMMA28] = "bt470bg",
2279 [AVCOL_TRC_SMPTE170M] = "smpte170m",
2280 [AVCOL_TRC_SMPTE240M] = "smpte240m",
2281 [AVCOL_TRC_LINEAR] = "linear",
2282 [AVCOL_TRC_LOG] = "log100",
2283 [AVCOL_TRC_LOG_SQRT] = "log316",
2284 [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
2285 [AVCOL_TRC_BT1361_ECG] = "bt1361e",
2286 [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
2287 [AVCOL_TRC_BT2020_10] = "bt2020-10",
2288 [AVCOL_TRC_BT2020_12] = "bt2020-12",
2289 [AVCOL_TRC_SMPTE2084] = "smpte2084",
2290 [AVCOL_TRC_SMPTE428] = "smpte428",
2291 [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
2294 static const char * const color_space_names[] = {
2295 [AVCOL_SPC_RGB] = "gbr",
2296 [AVCOL_SPC_BT709] = "bt709",
2297 [AVCOL_SPC_UNSPECIFIED] = "unknown",
2298 [AVCOL_SPC_RESERVED] = "reserved",
2299 [AVCOL_SPC_FCC] = "fcc",
2300 [AVCOL_SPC_BT470BG] = "bt470bg",
2301 [AVCOL_SPC_SMPTE170M] = "smpte170m",
2302 [AVCOL_SPC_SMPTE240M] = "smpte240m",
2303 [AVCOL_SPC_YCGCO] = "ycgco",
2304 [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
2305 [AVCOL_SPC_BT2020_CL] = "bt2020c",
2306 [AVCOL_SPC_SMPTE2085] = "smpte2085",
2307 [AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
2308 [AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
2309 [AVCOL_SPC_ICTCP] = "ictcp",
2312 static const char * const chroma_location_names[] = {
2313 [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
2314 [AVCHROMA_LOC_LEFT] = "left",
2315 [AVCHROMA_LOC_CENTER] = "center",
2316 [AVCHROMA_LOC_TOPLEFT] = "topleft",
2317 [AVCHROMA_LOC_TOP] = "top",
2318 [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
2319 [AVCHROMA_LOC_BOTTOM] = "bottom",
2322 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
2324 enum AVPixelFormat pix_fmt;
2326 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
2327 if (av_pix_fmt_descriptors[pix_fmt].name &&
2328 (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
2329 av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
2332 return AV_PIX_FMT_NONE;
2335 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
2337 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
2338 av_pix_fmt_descriptors[pix_fmt].name : NULL;
2342 # define X_NE(be, le) be
2344 # define X_NE(be, le) le
2347 enum AVPixelFormat av_get_pix_fmt(const char *name)
2349 enum AVPixelFormat pix_fmt;
2351 if (!strcmp(name, "rgb32"))
2352 name = X_NE("argb", "bgra");
2353 else if (!strcmp(name, "bgr32"))
2354 name = X_NE("abgr", "rgba");
2356 pix_fmt = get_pix_fmt_internal(name);
2357 if (pix_fmt == AV_PIX_FMT_NONE) {
2360 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
2361 pix_fmt = get_pix_fmt_internal(name2);
2365 if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
2366 pix_fmt = AV_PIX_FMT_VAAPI;
2371 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
2374 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2376 for (c = 0; c < pixdesc->nb_components; c++) {
2377 int s = c == 1 || c == 2 ? 0 : log2_pixels;
2378 bits += pixdesc->comp[c].depth << s;
2381 return bits >> log2_pixels;
2384 int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
2387 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2390 for (c = 0; c < pixdesc->nb_components; c++) {
2391 const AVComponentDescriptor *comp = &pixdesc->comp[c];
2392 int s = c == 1 || c == 2 ? 0 : log2_pixels;
2393 steps[comp->plane] = comp->step << s;
2395 for (c = 0; c < 4; c++)
2398 if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
2401 return bits >> log2_pixels;
2404 char *av_get_pix_fmt_string(char *buf, int buf_size,
2405 enum AVPixelFormat pix_fmt)
2409 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
2411 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
2412 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
2413 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
2419 const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
2421 if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
2423 return &av_pix_fmt_descriptors[pix_fmt];
2426 const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
2429 return &av_pix_fmt_descriptors[0];
2430 while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
2438 enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
2440 if (desc < av_pix_fmt_descriptors ||
2441 desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
2442 return AV_PIX_FMT_NONE;
2444 return desc - av_pix_fmt_descriptors;
2447 int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
2448 int *h_shift, int *v_shift)
2450 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2452 return AVERROR(ENOSYS);
2453 *h_shift = desc->log2_chroma_w;
2454 *v_shift = desc->log2_chroma_h;
2459 int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
2461 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2462 int i, planes[4] = { 0 }, ret = 0;
2465 return AVERROR(EINVAL);
2467 for (i = 0; i < desc->nb_components; i++)
2468 planes[desc->comp[i].plane] = 1;
2469 for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
2474 void ff_check_pixfmt_descriptors(void){
2477 for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
2478 const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
2479 uint8_t fill[4][8+6+3] = {{0}};
2480 uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
2481 int linesize[4] = {0,0,0,0};
2484 if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
2486 // av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
2487 av_assert0(d->log2_chroma_w <= 3);
2488 av_assert0(d->log2_chroma_h <= 3);
2489 av_assert0(d->nb_components <= 4);
2490 av_assert0(d->name && d->name[0]);
2491 av_assert0((d->nb_components==4 || d->nb_components==2) == !!(d->flags & AV_PIX_FMT_FLAG_ALPHA));
2492 av_assert2(av_get_pix_fmt(d->name) == i);
2494 for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
2495 const AVComponentDescriptor *c = &d->comp[j];
2496 if(j>=d->nb_components) {
2497 av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
2500 if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
2501 av_assert0(c->step >= c->depth);
2503 av_assert0(8*c->step >= c->depth);
2505 if (d->flags & AV_PIX_FMT_FLAG_BAYER)
2507 av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
2508 av_assert0(tmp[0] == 0 && tmp[1] == 0);
2509 tmp[0] = tmp[1] = (1<<c->depth) - 1;
2510 av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
2516 enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
2518 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2522 if (!desc || strlen(desc->name) < 2)
2523 return AV_PIX_FMT_NONE;
2524 av_strlcpy(name, desc->name, sizeof(name));
2525 i = strlen(name) - 2;
2526 if (strcmp(name + i, "be") && strcmp(name + i, "le"))
2527 return AV_PIX_FMT_NONE;
2529 name[i] ^= 'b' ^ 'l';
2531 return get_pix_fmt_internal(name);
2534 #define FF_COLOR_NA -1
2535 #define FF_COLOR_RGB 0 /**< RGB color space */
2536 #define FF_COLOR_GRAY 1 /**< gray color space */
2537 #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
2538 #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
2539 #define FF_COLOR_XYZ 4
2541 #define pixdesc_has_alpha(pixdesc) \
2542 ((pixdesc)->nb_components == 2 || (pixdesc)->nb_components == 4 || (pixdesc)->flags & AV_PIX_FMT_FLAG_PAL)
2545 static int get_color_type(const AVPixFmtDescriptor *desc) {
2546 if (desc->flags & AV_PIX_FMT_FLAG_PAL)
2547 return FF_COLOR_RGB;
2549 if(desc->nb_components == 1 || desc->nb_components == 2)
2550 return FF_COLOR_GRAY;
2552 if(desc->name && !strncmp(desc->name, "yuvj", 4))
2553 return FF_COLOR_YUV_JPEG;
2555 if(desc->name && !strncmp(desc->name, "xyz", 3))
2556 return FF_COLOR_XYZ;
2558 if(desc->flags & AV_PIX_FMT_FLAG_RGB)
2559 return FF_COLOR_RGB;
2561 if(desc->nb_components == 0)
2564 return FF_COLOR_YUV;
2567 static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
2569 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2572 if (!desc || !desc->nb_components) {
2574 return AVERROR(EINVAL);
2577 *min = INT_MAX, *max = -INT_MAX;
2578 for (i = 0; i < desc->nb_components; i++) {
2579 *min = FFMIN(desc->comp[i].depth, *min);
2580 *max = FFMAX(desc->comp[i].depth, *max);
2585 static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
2586 enum AVPixelFormat src_pix_fmt,
2587 unsigned *lossp, unsigned consider)
2589 const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
2590 const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
2591 int src_color, dst_color;
2592 int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
2593 int ret, loss, i, nb_components;
2594 int score = INT_MAX - 1;
2596 if (!src_desc || !dst_desc)
2599 if ((src_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) ||
2600 (dst_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
2601 if (dst_pix_fmt == src_pix_fmt)
2610 if (dst_pix_fmt == src_pix_fmt)
2613 if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
2615 if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
2618 src_color = get_color_type(src_desc);
2619 dst_color = get_color_type(dst_desc);
2620 if (dst_pix_fmt == AV_PIX_FMT_PAL8)
2621 nb_components = FFMIN(src_desc->nb_components, 4);
2623 nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
2625 for (i = 0; i < nb_components; i++) {
2626 int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
2627 if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
2628 loss |= FF_LOSS_DEPTH;
2629 score -= 65536 >> depth_minus1;
2633 if (consider & FF_LOSS_RESOLUTION) {
2634 if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
2635 loss |= FF_LOSS_RESOLUTION;
2636 score -= 256 << dst_desc->log2_chroma_w;
2638 if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
2639 loss |= FF_LOSS_RESOLUTION;
2640 score -= 256 << dst_desc->log2_chroma_h;
2642 // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
2643 if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
2644 dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
2649 if(consider & FF_LOSS_COLORSPACE)
2652 if (src_color != FF_COLOR_RGB &&
2653 src_color != FF_COLOR_GRAY)
2654 loss |= FF_LOSS_COLORSPACE;
2657 if (src_color != FF_COLOR_GRAY)
2658 loss |= FF_LOSS_COLORSPACE;
2661 if (src_color != FF_COLOR_YUV)
2662 loss |= FF_LOSS_COLORSPACE;
2664 case FF_COLOR_YUV_JPEG:
2665 if (src_color != FF_COLOR_YUV_JPEG &&
2666 src_color != FF_COLOR_YUV &&
2667 src_color != FF_COLOR_GRAY)
2668 loss |= FF_LOSS_COLORSPACE;
2671 /* fail safe test */
2672 if (src_color != dst_color)
2673 loss |= FF_LOSS_COLORSPACE;
2676 if(loss & FF_LOSS_COLORSPACE)
2677 score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
2679 if (dst_color == FF_COLOR_GRAY &&
2680 src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
2681 loss |= FF_LOSS_CHROMA;
2684 if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
2685 loss |= FF_LOSS_ALPHA;
2688 if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
2689 (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
2690 loss |= FF_LOSS_COLORQUANT;
2698 int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
2699 enum AVPixelFormat src_pix_fmt,
2703 int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
2709 enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
2710 enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
2712 enum AVPixelFormat dst_pix_fmt;
2713 int loss1, loss2, loss_mask;
2714 const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
2715 const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
2719 dst_pix_fmt = dst_pix_fmt2;
2720 } else if (!desc2) {
2721 dst_pix_fmt = dst_pix_fmt1;
2723 loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
2725 loss_mask &= ~FF_LOSS_ALPHA;
2727 score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
2728 score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
2730 if (score1 == score2) {
2731 if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) {
2732 dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
2734 dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
2737 dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
2742 *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
2746 const char *av_color_range_name(enum AVColorRange range)
2748 return (unsigned) range < AVCOL_RANGE_NB ?
2749 color_range_names[range] : NULL;
2752 int av_color_range_from_name(const char *name)
2756 for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
2757 size_t len = strlen(color_range_names[i]);
2758 if (!strncmp(color_range_names[i], name, len))
2762 return AVERROR(EINVAL);
2765 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
2767 return (unsigned) primaries < AVCOL_PRI_NB ?
2768 color_primaries_names[primaries] : NULL;
2771 int av_color_primaries_from_name(const char *name)
2775 for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) {
2776 size_t len = strlen(color_primaries_names[i]);
2777 if (!strncmp(color_primaries_names[i], name, len))
2781 return AVERROR(EINVAL);
2784 const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
2786 return (unsigned) transfer < AVCOL_TRC_NB ?
2787 color_transfer_names[transfer] : NULL;
2790 int av_color_transfer_from_name(const char *name)
2794 for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) {
2795 size_t len = strlen(color_transfer_names[i]);
2796 if (!strncmp(color_transfer_names[i], name, len))
2800 return AVERROR(EINVAL);
2803 const char *av_color_space_name(enum AVColorSpace space)
2805 return (unsigned) space < AVCOL_SPC_NB ?
2806 color_space_names[space] : NULL;
2809 int av_color_space_from_name(const char *name)
2813 for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) {
2814 size_t len = strlen(color_space_names[i]);
2815 if (!strncmp(color_space_names[i], name, len))
2819 return AVERROR(EINVAL);
2822 const char *av_chroma_location_name(enum AVChromaLocation location)
2824 return (unsigned) location < AVCHROMA_LOC_NB ?
2825 chroma_location_names[location] : NULL;
2828 int av_chroma_location_from_name(const char *name)
2832 for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) {
2833 size_t len = strlen(chroma_location_names[i]);
2834 if (!strncmp(chroma_location_names[i], name, len))
2838 return AVERROR(EINVAL);