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,
329 [AV_PIX_FMT_XVMC] = {
331 .flags = AV_PIX_FMT_FLAG_HWACCEL,
333 [AV_PIX_FMT_UYVY422] = {
339 { 0, 2, 1, 0, 8, 1, 7, 2 }, /* Y */
340 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* U */
341 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* V */
344 [AV_PIX_FMT_UYYVYY411] = {
350 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* Y */
351 { 0, 6, 0, 0, 8, 5, 7, 1 }, /* U */
352 { 0, 6, 3, 0, 8, 5, 7, 4 }, /* V */
355 [AV_PIX_FMT_BGR8] = {
361 { 0, 1, 0, 0, 3, 0, 2, 1 }, /* R */
362 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
363 { 0, 1, 0, 6, 2, 0, 1, 1 }, /* B */
365 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
367 [AV_PIX_FMT_BGR4] = {
373 { 0, 4, 3, 0, 1, 3, 0, 4 }, /* R */
374 { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
375 { 0, 4, 0, 0, 1, 3, 0, 1 }, /* B */
377 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
379 [AV_PIX_FMT_BGR4_BYTE] = {
385 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* R */
386 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
387 { 0, 1, 0, 3, 1, 0, 0, 1 }, /* B */
389 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
391 [AV_PIX_FMT_RGB8] = {
397 { 0, 1, 0, 6, 2, 0, 1, 1 }, /* R */
398 { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
399 { 0, 1, 0, 0, 3, 0, 2, 1 }, /* B */
401 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
403 [AV_PIX_FMT_RGB4] = {
409 { 0, 4, 0, 0, 1, 3, 0, 1 }, /* R */
410 { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
411 { 0, 4, 3, 0, 1, 3, 0, 4 }, /* B */
413 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
415 [AV_PIX_FMT_RGB4_BYTE] = {
421 { 0, 1, 0, 3, 1, 0, 0, 1 }, /* R */
422 { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
423 { 0, 1, 0, 0, 1, 0, 0, 1 }, /* B */
425 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
427 [AV_PIX_FMT_NV12] = {
433 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
434 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
435 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
437 .flags = AV_PIX_FMT_FLAG_PLANAR,
439 [AV_PIX_FMT_NV21] = {
445 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
446 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */
447 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */
449 .flags = AV_PIX_FMT_FLAG_PLANAR,
451 [AV_PIX_FMT_ARGB] = {
457 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
458 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
459 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
460 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
462 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
464 [AV_PIX_FMT_RGBA] = {
470 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
471 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
472 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
473 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
475 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
477 [AV_PIX_FMT_ABGR] = {
483 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
484 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
485 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
486 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
488 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
490 [AV_PIX_FMT_BGRA] = {
496 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
497 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
498 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
499 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
501 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
503 [AV_PIX_FMT_0RGB] = {
509 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
510 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
511 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
513 .flags = AV_PIX_FMT_FLAG_RGB,
515 [AV_PIX_FMT_RGB0] = {
521 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
522 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
523 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
525 .flags = AV_PIX_FMT_FLAG_RGB,
527 [AV_PIX_FMT_0BGR] = {
533 { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
534 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
535 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
537 .flags = AV_PIX_FMT_FLAG_RGB,
539 [AV_PIX_FMT_BGR0] = {
545 { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
546 { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
547 { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
549 .flags = AV_PIX_FMT_FLAG_RGB,
551 [AV_PIX_FMT_GRAY9BE] = {
557 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
559 .flags = AV_PIX_FMT_FLAG_BE,
562 [AV_PIX_FMT_GRAY9LE] = {
568 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
572 [AV_PIX_FMT_GRAY10BE] = {
578 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
580 .flags = AV_PIX_FMT_FLAG_BE,
583 [AV_PIX_FMT_GRAY10LE] = {
589 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
593 [AV_PIX_FMT_GRAY12BE] = {
599 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
601 .flags = AV_PIX_FMT_FLAG_BE,
604 [AV_PIX_FMT_GRAY12LE] = {
610 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
614 [AV_PIX_FMT_GRAY16BE] = {
620 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
622 .flags = AV_PIX_FMT_FLAG_BE,
625 [AV_PIX_FMT_GRAY16LE] = {
631 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
635 [AV_PIX_FMT_YUV440P] = {
641 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
642 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
643 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
645 .flags = AV_PIX_FMT_FLAG_PLANAR,
647 [AV_PIX_FMT_YUVJ440P] = {
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_YUV440P10LE] = {
660 .name = "yuv440p10le",
665 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
666 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
667 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
669 .flags = AV_PIX_FMT_FLAG_PLANAR,
671 [AV_PIX_FMT_YUV440P10BE] = {
672 .name = "yuv440p10be",
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_BE | AV_PIX_FMT_FLAG_PLANAR,
683 [AV_PIX_FMT_YUV440P12LE] = {
684 .name = "yuv440p12le",
689 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
690 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
691 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
693 .flags = AV_PIX_FMT_FLAG_PLANAR,
695 [AV_PIX_FMT_YUV440P12BE] = {
696 .name = "yuv440p12be",
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_BE | AV_PIX_FMT_FLAG_PLANAR,
707 [AV_PIX_FMT_YUVA420P] = {
713 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
714 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
715 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
716 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
718 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
720 [AV_PIX_FMT_YUVA422P] = {
726 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
727 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
728 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
729 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
731 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
733 [AV_PIX_FMT_YUVA444P] = {
739 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
740 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
741 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
742 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
744 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
746 [AV_PIX_FMT_YUVA420P9BE] = {
747 .name = "yuva420p9be",
752 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
753 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
754 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
755 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
757 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
759 [AV_PIX_FMT_YUVA420P9LE] = {
760 .name = "yuva420p9le",
765 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
766 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
767 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
768 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
770 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
772 [AV_PIX_FMT_YUVA422P9BE] = {
773 .name = "yuva422p9be",
778 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
779 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
780 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
781 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
783 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
785 [AV_PIX_FMT_YUVA422P9LE] = {
786 .name = "yuva422p9le",
791 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
792 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
793 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
794 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
796 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
798 [AV_PIX_FMT_YUVA444P9BE] = {
799 .name = "yuva444p9be",
804 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
805 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
806 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
807 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
809 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
811 [AV_PIX_FMT_YUVA444P9LE] = {
812 .name = "yuva444p9le",
817 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
818 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
819 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
820 { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
822 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
824 [AV_PIX_FMT_YUVA420P10BE] = {
825 .name = "yuva420p10be",
830 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
831 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
832 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
833 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
835 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
837 [AV_PIX_FMT_YUVA420P10LE] = {
838 .name = "yuva420p10le",
843 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
844 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
845 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
846 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
848 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
850 [AV_PIX_FMT_YUVA422P10BE] = {
851 .name = "yuva422p10be",
856 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
857 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
858 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
859 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
861 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
863 [AV_PIX_FMT_YUVA422P10LE] = {
864 .name = "yuva422p10le",
869 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
870 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
871 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
872 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
874 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
876 [AV_PIX_FMT_YUVA444P10BE] = {
877 .name = "yuva444p10be",
882 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
883 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
884 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
885 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
887 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
889 [AV_PIX_FMT_YUVA444P10LE] = {
890 .name = "yuva444p10le",
895 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
896 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
897 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
898 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
900 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
902 [AV_PIX_FMT_YUVA420P16BE] = {
903 .name = "yuva420p16be",
908 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
909 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
910 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
911 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
913 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
915 [AV_PIX_FMT_YUVA420P16LE] = {
916 .name = "yuva420p16le",
921 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
922 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
923 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
924 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
926 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
928 [AV_PIX_FMT_YUVA422P16BE] = {
929 .name = "yuva422p16be",
934 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
935 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
936 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
937 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
939 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
941 [AV_PIX_FMT_YUVA422P16LE] = {
942 .name = "yuva422p16le",
947 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
948 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
949 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
950 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
952 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
954 [AV_PIX_FMT_YUVA444P16BE] = {
955 .name = "yuva444p16be",
960 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
961 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
962 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
963 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
965 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
967 [AV_PIX_FMT_YUVA444P16LE] = {
968 .name = "yuva444p16le",
973 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
974 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
975 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
976 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
978 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
980 [AV_PIX_FMT_RGB48BE] = {
986 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
987 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
988 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
990 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
992 [AV_PIX_FMT_RGB48LE] = {
998 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
999 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1000 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
1002 .flags = AV_PIX_FMT_FLAG_RGB,
1004 [AV_PIX_FMT_RGBA64BE] = {
1010 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
1011 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1012 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1013 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1015 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1017 [AV_PIX_FMT_RGBA64LE] = {
1023 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
1024 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1025 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1026 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1028 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1030 [AV_PIX_FMT_RGB565BE] = {
1036 { 0, 2, -1, 3, 5, 1, 4, 0 }, /* R */
1037 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1038 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1040 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1042 [AV_PIX_FMT_RGB565LE] = {
1048 { 0, 2, 1, 3, 5, 1, 4, 2 }, /* R */
1049 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1050 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1052 .flags = AV_PIX_FMT_FLAG_RGB,
1054 [AV_PIX_FMT_RGB555BE] = {
1060 { 0, 2, -1, 2, 5, 1, 4, 0 }, /* R */
1061 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1062 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1064 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1066 [AV_PIX_FMT_RGB555LE] = {
1072 { 0, 2, 1, 2, 5, 1, 4, 2 }, /* R */
1073 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1074 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1076 .flags = AV_PIX_FMT_FLAG_RGB,
1078 [AV_PIX_FMT_RGB444BE] = {
1084 { 0, 2, -1, 0, 4, 1, 3, 0 }, /* R */
1085 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1086 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1088 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1090 [AV_PIX_FMT_RGB444LE] = {
1096 { 0, 2, 1, 0, 4, 1, 3, 2 }, /* R */
1097 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1098 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1100 .flags = AV_PIX_FMT_FLAG_RGB,
1102 [AV_PIX_FMT_BGR48BE] = {
1108 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1109 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1110 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1112 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1114 [AV_PIX_FMT_BGR48LE] = {
1120 { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1121 { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1122 { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1124 .flags = AV_PIX_FMT_FLAG_RGB,
1126 [AV_PIX_FMT_BGRA64BE] = {
1132 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1133 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1134 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1135 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1137 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1139 [AV_PIX_FMT_BGRA64LE] = {
1145 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1146 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1147 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1148 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1150 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1152 [AV_PIX_FMT_BGR565BE] = {
1158 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1159 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1160 { 0, 2, -1, 3, 5, 1, 4, 0 }, /* B */
1162 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1164 [AV_PIX_FMT_BGR565LE] = {
1170 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1171 { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1172 { 0, 2, 1, 3, 5, 1, 4, 2 }, /* B */
1174 .flags = AV_PIX_FMT_FLAG_RGB,
1176 [AV_PIX_FMT_BGR555BE] = {
1182 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1183 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1184 { 0, 2, -1, 2, 5, 1, 4, 0 }, /* B */
1186 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1188 [AV_PIX_FMT_BGR555LE] = {
1194 { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1195 { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1196 { 0, 2, 1, 2, 5, 1, 4, 2 }, /* B */
1198 .flags = AV_PIX_FMT_FLAG_RGB,
1200 [AV_PIX_FMT_BGR444BE] = {
1206 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1207 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1208 { 0, 2, -1, 0, 4, 1, 3, 0 }, /* B */
1210 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1212 [AV_PIX_FMT_BGR444LE] = {
1218 { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1219 { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1220 { 0, 2, 1, 0, 4, 1, 3, 2 }, /* B */
1222 .flags = AV_PIX_FMT_FLAG_RGB,
1225 [AV_PIX_FMT_VAAPI_MOCO] = {
1226 .name = "vaapi_moco",
1229 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1231 [AV_PIX_FMT_VAAPI_IDCT] = {
1232 .name = "vaapi_idct",
1235 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1237 [AV_PIX_FMT_VAAPI_VLD] = {
1238 .name = "vaapi_vld",
1241 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1244 [AV_PIX_FMT_VAAPI] = {
1248 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1251 [AV_PIX_FMT_YUV420P9LE] = {
1252 .name = "yuv420p9le",
1257 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1258 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1259 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1261 .flags = AV_PIX_FMT_FLAG_PLANAR,
1263 [AV_PIX_FMT_YUV420P9BE] = {
1264 .name = "yuv420p9be",
1269 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1270 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1271 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1273 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1275 [AV_PIX_FMT_YUV420P10LE] = {
1276 .name = "yuv420p10le",
1281 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1282 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1283 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1285 .flags = AV_PIX_FMT_FLAG_PLANAR,
1287 [AV_PIX_FMT_YUV420P10BE] = {
1288 .name = "yuv420p10be",
1293 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1294 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1295 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1297 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1299 [AV_PIX_FMT_YUV420P12LE] = {
1300 .name = "yuv420p12le",
1305 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1306 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1307 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1309 .flags = AV_PIX_FMT_FLAG_PLANAR,
1311 [AV_PIX_FMT_YUV420P12BE] = {
1312 .name = "yuv420p12be",
1317 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1318 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1319 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1321 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1323 [AV_PIX_FMT_YUV420P14LE] = {
1324 .name = "yuv420p14le",
1329 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1330 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1331 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1333 .flags = AV_PIX_FMT_FLAG_PLANAR,
1335 [AV_PIX_FMT_YUV420P14BE] = {
1336 .name = "yuv420p14be",
1341 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1342 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1343 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1345 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1347 [AV_PIX_FMT_YUV420P16LE] = {
1348 .name = "yuv420p16le",
1353 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1354 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1355 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1357 .flags = AV_PIX_FMT_FLAG_PLANAR,
1359 [AV_PIX_FMT_YUV420P16BE] = {
1360 .name = "yuv420p16be",
1365 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1366 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1367 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1369 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1371 [AV_PIX_FMT_YUV422P9LE] = {
1372 .name = "yuv422p9le",
1377 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1378 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1379 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1381 .flags = AV_PIX_FMT_FLAG_PLANAR,
1383 [AV_PIX_FMT_YUV422P9BE] = {
1384 .name = "yuv422p9be",
1389 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1390 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1391 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1393 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1395 [AV_PIX_FMT_YUV422P10LE] = {
1396 .name = "yuv422p10le",
1401 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1402 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1403 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1405 .flags = AV_PIX_FMT_FLAG_PLANAR,
1407 [AV_PIX_FMT_YUV422P10BE] = {
1408 .name = "yuv422p10be",
1413 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1414 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1415 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1417 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1419 [AV_PIX_FMT_YUV422P12LE] = {
1420 .name = "yuv422p12le",
1425 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1426 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1427 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1429 .flags = AV_PIX_FMT_FLAG_PLANAR,
1431 [AV_PIX_FMT_YUV422P12BE] = {
1432 .name = "yuv422p12be",
1437 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1438 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1439 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1441 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1443 [AV_PIX_FMT_YUV422P14LE] = {
1444 .name = "yuv422p14le",
1449 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1450 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1451 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1453 .flags = AV_PIX_FMT_FLAG_PLANAR,
1455 [AV_PIX_FMT_YUV422P14BE] = {
1456 .name = "yuv422p14be",
1461 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1462 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1463 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1465 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1467 [AV_PIX_FMT_YUV422P16LE] = {
1468 .name = "yuv422p16le",
1473 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1474 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1475 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1477 .flags = AV_PIX_FMT_FLAG_PLANAR,
1479 [AV_PIX_FMT_YUV422P16BE] = {
1480 .name = "yuv422p16be",
1485 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1486 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1487 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1489 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1491 [AV_PIX_FMT_YUV444P16LE] = {
1492 .name = "yuv444p16le",
1497 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1498 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1499 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1501 .flags = AV_PIX_FMT_FLAG_PLANAR,
1503 [AV_PIX_FMT_YUV444P16BE] = {
1504 .name = "yuv444p16be",
1509 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1510 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1511 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1513 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1515 [AV_PIX_FMT_YUV444P10LE] = {
1516 .name = "yuv444p10le",
1521 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1522 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1523 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1525 .flags = AV_PIX_FMT_FLAG_PLANAR,
1527 [AV_PIX_FMT_YUV444P10BE] = {
1528 .name = "yuv444p10be",
1533 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1534 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1535 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1537 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1539 [AV_PIX_FMT_YUV444P9LE] = {
1540 .name = "yuv444p9le",
1545 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1546 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1547 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1549 .flags = AV_PIX_FMT_FLAG_PLANAR,
1551 [AV_PIX_FMT_YUV444P9BE] = {
1552 .name = "yuv444p9be",
1557 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1558 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1559 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1561 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1563 [AV_PIX_FMT_YUV444P12LE] = {
1564 .name = "yuv444p12le",
1569 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1570 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1571 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1573 .flags = AV_PIX_FMT_FLAG_PLANAR,
1575 [AV_PIX_FMT_YUV444P12BE] = {
1576 .name = "yuv444p12be",
1581 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1582 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1583 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1585 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1587 [AV_PIX_FMT_YUV444P14LE] = {
1588 .name = "yuv444p14le",
1593 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1594 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1595 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1597 .flags = AV_PIX_FMT_FLAG_PLANAR,
1599 [AV_PIX_FMT_YUV444P14BE] = {
1600 .name = "yuv444p14be",
1605 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1606 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1607 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1609 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1611 [AV_PIX_FMT_D3D11VA_VLD] = {
1612 .name = "d3d11va_vld",
1615 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1617 [AV_PIX_FMT_DXVA2_VLD] = {
1618 .name = "dxva2_vld",
1621 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1623 [AV_PIX_FMT_YA8] = {
1627 { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
1628 { 0, 2, 1, 0, 8, 1, 7, 2 }, /* A */
1630 .flags = AV_PIX_FMT_FLAG_ALPHA,
1633 [AV_PIX_FMT_YA16LE] = {
1637 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1638 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1640 .flags = AV_PIX_FMT_FLAG_ALPHA,
1642 [AV_PIX_FMT_YA16BE] = {
1646 { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1647 { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1649 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
1651 [AV_PIX_FMT_VIDEOTOOLBOX] = {
1652 .name = "videotoolbox_vld",
1653 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1655 [AV_PIX_FMT_GBRP] = {
1661 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1662 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1663 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1665 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1667 [AV_PIX_FMT_GBRP9LE] = {
1673 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1674 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1675 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1677 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1679 [AV_PIX_FMT_GBRP9BE] = {
1685 { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1686 { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1687 { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1689 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1691 [AV_PIX_FMT_GBRP10LE] = {
1697 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1698 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1699 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1701 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1703 [AV_PIX_FMT_GBRP10BE] = {
1709 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1710 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1711 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1713 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1715 [AV_PIX_FMT_GBRP12LE] = {
1721 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1722 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1723 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1725 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1727 [AV_PIX_FMT_GBRP12BE] = {
1733 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1734 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1735 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1737 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1739 [AV_PIX_FMT_GBRP14LE] = {
1745 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1746 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1747 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1749 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1751 [AV_PIX_FMT_GBRP14BE] = {
1757 { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1758 { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1759 { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1761 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1763 [AV_PIX_FMT_GBRP16LE] = {
1769 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1770 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1771 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1773 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1775 [AV_PIX_FMT_GBRP16BE] = {
1781 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1782 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1783 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1785 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1787 [AV_PIX_FMT_GBRAP] = {
1793 { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1794 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1795 { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1796 { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
1798 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1799 AV_PIX_FMT_FLAG_ALPHA,
1801 [AV_PIX_FMT_GBRAP16LE] = {
1802 .name = "gbrap16le",
1807 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1808 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1809 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1810 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1812 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1813 AV_PIX_FMT_FLAG_ALPHA,
1815 [AV_PIX_FMT_GBRAP16BE] = {
1816 .name = "gbrap16be",
1821 { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1822 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1823 { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1824 { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1826 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
1827 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1829 [AV_PIX_FMT_VDPAU] = {
1833 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1835 [AV_PIX_FMT_XYZ12LE] = {
1841 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1842 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1843 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1845 /*.flags = -- not used*/
1847 [AV_PIX_FMT_XYZ12BE] = {
1853 { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1854 { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1855 { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1857 .flags = AV_PIX_FMT_FLAG_BE,
1860 #define BAYER8_DESC_COMMON \
1861 .nb_components= 3, \
1862 .log2_chroma_w= 0, \
1863 .log2_chroma_h= 0, \
1870 #define BAYER16_DESC_COMMON \
1871 .nb_components= 3, \
1872 .log2_chroma_w= 0, \
1873 .log2_chroma_h= 0, \
1880 [AV_PIX_FMT_BAYER_BGGR8] = {
1881 .name = "bayer_bggr8",
1883 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1885 [AV_PIX_FMT_BAYER_BGGR16LE] = {
1886 .name = "bayer_bggr16le",
1888 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1890 [AV_PIX_FMT_BAYER_BGGR16BE] = {
1891 .name = "bayer_bggr16be",
1893 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1895 [AV_PIX_FMT_BAYER_RGGB8] = {
1896 .name = "bayer_rggb8",
1898 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1900 [AV_PIX_FMT_BAYER_RGGB16LE] = {
1901 .name = "bayer_rggb16le",
1903 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1905 [AV_PIX_FMT_BAYER_RGGB16BE] = {
1906 .name = "bayer_rggb16be",
1908 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1910 [AV_PIX_FMT_BAYER_GBRG8] = {
1911 .name = "bayer_gbrg8",
1913 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1915 [AV_PIX_FMT_BAYER_GBRG16LE] = {
1916 .name = "bayer_gbrg16le",
1918 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1920 [AV_PIX_FMT_BAYER_GBRG16BE] = {
1921 .name = "bayer_gbrg16be",
1923 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1925 [AV_PIX_FMT_BAYER_GRBG8] = {
1926 .name = "bayer_grbg8",
1928 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1930 [AV_PIX_FMT_BAYER_GRBG16LE] = {
1931 .name = "bayer_grbg16le",
1933 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1935 [AV_PIX_FMT_BAYER_GRBG16BE] = {
1936 .name = "bayer_grbg16be",
1938 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
1940 [AV_PIX_FMT_NV16] = {
1946 { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
1947 { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
1948 { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
1950 .flags = AV_PIX_FMT_FLAG_PLANAR,
1952 [AV_PIX_FMT_NV20LE] = {
1958 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1959 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
1960 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
1962 .flags = AV_PIX_FMT_FLAG_PLANAR,
1964 [AV_PIX_FMT_NV20BE] = {
1970 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1971 { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
1972 { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
1974 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
1976 [AV_PIX_FMT_QSV] = {
1978 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1980 [AV_PIX_FMT_MEDIACODEC] = {
1981 .name = "mediacodec",
1982 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1984 [AV_PIX_FMT_MMAL] = {
1986 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1988 [AV_PIX_FMT_CUDA] = {
1990 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1992 [AV_PIX_FMT_AYUV64LE] = {
1998 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
1999 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2000 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2001 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2003 .flags = AV_PIX_FMT_FLAG_ALPHA,
2005 [AV_PIX_FMT_AYUV64BE] = {
2011 { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
2012 { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2013 { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2014 { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2016 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
2018 [AV_PIX_FMT_P010LE] = {
2024 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2025 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2026 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2028 .flags = AV_PIX_FMT_FLAG_PLANAR,
2030 [AV_PIX_FMT_P010BE] = {
2036 { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2037 { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2038 { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2040 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2042 [AV_PIX_FMT_P016LE] = {
2048 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
2049 { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
2050 { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
2052 .flags = AV_PIX_FMT_FLAG_PLANAR,
2054 [AV_PIX_FMT_P016BE] = {
2060 { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
2061 { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
2062 { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
2064 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2066 [AV_PIX_FMT_GBRAP12LE] = {
2067 .name = "gbrap12le",
2072 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2073 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2074 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2075 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2077 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2078 AV_PIX_FMT_FLAG_ALPHA,
2080 [AV_PIX_FMT_GBRAP12BE] = {
2081 .name = "gbrap12be",
2086 { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2087 { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2088 { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2089 { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2091 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2092 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2094 [AV_PIX_FMT_GBRAP10LE] = {
2095 .name = "gbrap10le",
2100 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2101 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2102 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2103 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2105 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2106 AV_PIX_FMT_FLAG_ALPHA,
2108 [AV_PIX_FMT_GBRAP10BE] = {
2109 .name = "gbrap10be",
2114 { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2115 { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2116 { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2117 { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2119 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2120 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2122 [AV_PIX_FMT_D3D11] = {
2124 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2126 [AV_PIX_FMT_GBRPF32BE] = {
2127 .name = "gbrpf32be",
2132 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2133 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2134 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2136 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2137 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
2139 [AV_PIX_FMT_GBRPF32LE] = {
2140 .name = "gbrpf32le",
2145 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2146 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2147 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2149 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_RGB,
2151 [AV_PIX_FMT_GBRAPF32BE] = {
2152 .name = "gbrapf32be",
2157 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2158 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2159 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2160 { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
2162 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2163 AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_RGB |
2164 AV_PIX_FMT_FLAG_FLOAT,
2166 [AV_PIX_FMT_GBRAPF32LE] = {
2167 .name = "gbrapf32le",
2172 { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2173 { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2174 { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2175 { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
2177 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA |
2178 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
2180 [AV_PIX_FMT_DRM_PRIME] = {
2181 .name = "drm_prime",
2182 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2184 [AV_PIX_FMT_OPENCL] = {
2186 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2189 #if FF_API_PLUS1_MINUS1
2190 FF_ENABLE_DEPRECATION_WARNINGS
2193 static const char * const color_range_names[] = {
2194 [AVCOL_RANGE_UNSPECIFIED] = "unknown",
2195 [AVCOL_RANGE_MPEG] = "tv",
2196 [AVCOL_RANGE_JPEG] = "pc",
2199 static const char * const color_primaries_names[AVCOL_PRI_NB] = {
2200 [AVCOL_PRI_RESERVED0] = "reserved",
2201 [AVCOL_PRI_BT709] = "bt709",
2202 [AVCOL_PRI_UNSPECIFIED] = "unknown",
2203 [AVCOL_PRI_RESERVED] = "reserved",
2204 [AVCOL_PRI_BT470M] = "bt470m",
2205 [AVCOL_PRI_BT470BG] = "bt470bg",
2206 [AVCOL_PRI_SMPTE170M] = "smpte170m",
2207 [AVCOL_PRI_SMPTE240M] = "smpte240m",
2208 [AVCOL_PRI_FILM] = "film",
2209 [AVCOL_PRI_BT2020] = "bt2020",
2210 [AVCOL_PRI_SMPTE428] = "smpte428",
2211 [AVCOL_PRI_SMPTE431] = "smpte431",
2212 [AVCOL_PRI_SMPTE432] = "smpte432",
2213 [AVCOL_PRI_JEDEC_P22] = "jedec-p22",
2216 static const char * const color_transfer_names[] = {
2217 [AVCOL_TRC_RESERVED0] = "reserved",
2218 [AVCOL_TRC_BT709] = "bt709",
2219 [AVCOL_TRC_UNSPECIFIED] = "unknown",
2220 [AVCOL_TRC_RESERVED] = "reserved",
2221 [AVCOL_TRC_GAMMA22] = "bt470m",
2222 [AVCOL_TRC_GAMMA28] = "bt470bg",
2223 [AVCOL_TRC_SMPTE170M] = "smpte170m",
2224 [AVCOL_TRC_SMPTE240M] = "smpte240m",
2225 [AVCOL_TRC_LINEAR] = "linear",
2226 [AVCOL_TRC_LOG] = "log100",
2227 [AVCOL_TRC_LOG_SQRT] = "log316",
2228 [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
2229 [AVCOL_TRC_BT1361_ECG] = "bt1361e",
2230 [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
2231 [AVCOL_TRC_BT2020_10] = "bt2020-10",
2232 [AVCOL_TRC_BT2020_12] = "bt2020-12",
2233 [AVCOL_TRC_SMPTE2084] = "smpte2084",
2234 [AVCOL_TRC_SMPTE428] = "smpte428",
2235 [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
2238 static const char * const color_space_names[] = {
2239 [AVCOL_SPC_RGB] = "gbr",
2240 [AVCOL_SPC_BT709] = "bt709",
2241 [AVCOL_SPC_UNSPECIFIED] = "unknown",
2242 [AVCOL_SPC_RESERVED] = "reserved",
2243 [AVCOL_SPC_FCC] = "fcc",
2244 [AVCOL_SPC_BT470BG] = "bt470bg",
2245 [AVCOL_SPC_SMPTE170M] = "smpte170m",
2246 [AVCOL_SPC_SMPTE240M] = "smpte240m",
2247 [AVCOL_SPC_YCGCO] = "ycgco",
2248 [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
2249 [AVCOL_SPC_BT2020_CL] = "bt2020c",
2250 [AVCOL_SPC_SMPTE2085] = "smpte2085",
2251 [AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
2252 [AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
2253 [AVCOL_SPC_ICTCP] = "ictcp",
2256 static const char * const chroma_location_names[] = {
2257 [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
2258 [AVCHROMA_LOC_LEFT] = "left",
2259 [AVCHROMA_LOC_CENTER] = "center",
2260 [AVCHROMA_LOC_TOPLEFT] = "topleft",
2261 [AVCHROMA_LOC_TOP] = "top",
2262 [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
2263 [AVCHROMA_LOC_BOTTOM] = "bottom",
2266 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
2268 enum AVPixelFormat pix_fmt;
2270 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
2271 if (av_pix_fmt_descriptors[pix_fmt].name &&
2272 (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
2273 av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
2276 return AV_PIX_FMT_NONE;
2279 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
2281 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
2282 av_pix_fmt_descriptors[pix_fmt].name : NULL;
2286 # define X_NE(be, le) be
2288 # define X_NE(be, le) le
2291 enum AVPixelFormat av_get_pix_fmt(const char *name)
2293 enum AVPixelFormat pix_fmt;
2295 if (!strcmp(name, "rgb32"))
2296 name = X_NE("argb", "bgra");
2297 else if (!strcmp(name, "bgr32"))
2298 name = X_NE("abgr", "rgba");
2300 pix_fmt = get_pix_fmt_internal(name);
2301 if (pix_fmt == AV_PIX_FMT_NONE) {
2304 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
2305 pix_fmt = get_pix_fmt_internal(name2);
2309 if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
2310 pix_fmt = AV_PIX_FMT_VAAPI;
2315 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
2318 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2320 for (c = 0; c < pixdesc->nb_components; c++) {
2321 int s = c == 1 || c == 2 ? 0 : log2_pixels;
2322 bits += pixdesc->comp[c].depth << s;
2325 return bits >> log2_pixels;
2328 int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
2331 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2334 for (c = 0; c < pixdesc->nb_components; c++) {
2335 const AVComponentDescriptor *comp = &pixdesc->comp[c];
2336 int s = c == 1 || c == 2 ? 0 : log2_pixels;
2337 steps[comp->plane] = comp->step << s;
2339 for (c = 0; c < 4; c++)
2342 if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
2345 return bits >> log2_pixels;
2348 char *av_get_pix_fmt_string(char *buf, int buf_size,
2349 enum AVPixelFormat pix_fmt)
2353 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
2355 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
2356 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
2357 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
2363 const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
2365 if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
2367 return &av_pix_fmt_descriptors[pix_fmt];
2370 const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
2373 return &av_pix_fmt_descriptors[0];
2374 while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
2382 enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
2384 if (desc < av_pix_fmt_descriptors ||
2385 desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
2386 return AV_PIX_FMT_NONE;
2388 return desc - av_pix_fmt_descriptors;
2391 int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
2392 int *h_shift, int *v_shift)
2394 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2396 return AVERROR(ENOSYS);
2397 *h_shift = desc->log2_chroma_w;
2398 *v_shift = desc->log2_chroma_h;
2403 int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
2405 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2406 int i, planes[4] = { 0 }, ret = 0;
2409 return AVERROR(EINVAL);
2411 for (i = 0; i < desc->nb_components; i++)
2412 planes[desc->comp[i].plane] = 1;
2413 for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
2418 void ff_check_pixfmt_descriptors(void){
2421 for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
2422 const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
2423 uint8_t fill[4][8+6+3] = {{0}};
2424 uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
2425 int linesize[4] = {0,0,0,0};
2428 if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
2430 // av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
2431 av_assert0(d->log2_chroma_w <= 3);
2432 av_assert0(d->log2_chroma_h <= 3);
2433 av_assert0(d->nb_components <= 4);
2434 av_assert0(d->name && d->name[0]);
2435 av_assert0((d->nb_components==4 || d->nb_components==2) == !!(d->flags & AV_PIX_FMT_FLAG_ALPHA));
2436 av_assert2(av_get_pix_fmt(d->name) == i);
2438 for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
2439 const AVComponentDescriptor *c = &d->comp[j];
2440 if(j>=d->nb_components) {
2441 av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
2444 if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
2445 av_assert0(c->step >= c->depth);
2447 av_assert0(8*c->step >= c->depth);
2449 if (d->flags & AV_PIX_FMT_FLAG_BAYER)
2451 av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
2452 av_assert0(tmp[0] == 0 && tmp[1] == 0);
2453 tmp[0] = tmp[1] = (1<<c->depth) - 1;
2454 av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
2460 enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
2462 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2466 if (!desc || strlen(desc->name) < 2)
2467 return AV_PIX_FMT_NONE;
2468 av_strlcpy(name, desc->name, sizeof(name));
2469 i = strlen(name) - 2;
2470 if (strcmp(name + i, "be") && strcmp(name + i, "le"))
2471 return AV_PIX_FMT_NONE;
2473 name[i] ^= 'b' ^ 'l';
2475 return get_pix_fmt_internal(name);
2478 #define FF_COLOR_NA -1
2479 #define FF_COLOR_RGB 0 /**< RGB color space */
2480 #define FF_COLOR_GRAY 1 /**< gray color space */
2481 #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
2482 #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
2483 #define FF_COLOR_XYZ 4
2485 #define pixdesc_has_alpha(pixdesc) \
2486 ((pixdesc)->nb_components == 2 || (pixdesc)->nb_components == 4 || (pixdesc)->flags & AV_PIX_FMT_FLAG_PAL)
2489 static int get_color_type(const AVPixFmtDescriptor *desc) {
2490 if (desc->flags & AV_PIX_FMT_FLAG_PAL)
2491 return FF_COLOR_RGB;
2493 if(desc->nb_components == 1 || desc->nb_components == 2)
2494 return FF_COLOR_GRAY;
2496 if(desc->name && !strncmp(desc->name, "yuvj", 4))
2497 return FF_COLOR_YUV_JPEG;
2499 if(desc->name && !strncmp(desc->name, "xyz", 3))
2500 return FF_COLOR_XYZ;
2502 if(desc->flags & AV_PIX_FMT_FLAG_RGB)
2503 return FF_COLOR_RGB;
2505 if(desc->nb_components == 0)
2508 return FF_COLOR_YUV;
2511 static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
2513 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2516 if (!desc || !desc->nb_components) {
2518 return AVERROR(EINVAL);
2521 *min = INT_MAX, *max = -INT_MAX;
2522 for (i = 0; i < desc->nb_components; i++) {
2523 *min = FFMIN(desc->comp[i].depth, *min);
2524 *max = FFMAX(desc->comp[i].depth, *max);
2529 static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
2530 enum AVPixelFormat src_pix_fmt,
2531 unsigned *lossp, unsigned consider)
2533 const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
2534 const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
2535 int src_color, dst_color;
2536 int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
2537 int ret, loss, i, nb_components;
2538 int score = INT_MAX - 1;
2540 if (!src_desc || !dst_desc)
2543 if ((src_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) ||
2544 (dst_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
2545 if (dst_pix_fmt == src_pix_fmt)
2554 if (dst_pix_fmt == src_pix_fmt)
2557 if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
2559 if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
2562 src_color = get_color_type(src_desc);
2563 dst_color = get_color_type(dst_desc);
2564 if (dst_pix_fmt == AV_PIX_FMT_PAL8)
2565 nb_components = FFMIN(src_desc->nb_components, 4);
2567 nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
2569 for (i = 0; i < nb_components; i++) {
2570 int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
2571 if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
2572 loss |= FF_LOSS_DEPTH;
2573 score -= 65536 >> depth_minus1;
2577 if (consider & FF_LOSS_RESOLUTION) {
2578 if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
2579 loss |= FF_LOSS_RESOLUTION;
2580 score -= 256 << dst_desc->log2_chroma_w;
2582 if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
2583 loss |= FF_LOSS_RESOLUTION;
2584 score -= 256 << dst_desc->log2_chroma_h;
2586 // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
2587 if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
2588 dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
2593 if(consider & FF_LOSS_COLORSPACE)
2596 if (src_color != FF_COLOR_RGB &&
2597 src_color != FF_COLOR_GRAY)
2598 loss |= FF_LOSS_COLORSPACE;
2601 if (src_color != FF_COLOR_GRAY)
2602 loss |= FF_LOSS_COLORSPACE;
2605 if (src_color != FF_COLOR_YUV)
2606 loss |= FF_LOSS_COLORSPACE;
2608 case FF_COLOR_YUV_JPEG:
2609 if (src_color != FF_COLOR_YUV_JPEG &&
2610 src_color != FF_COLOR_YUV &&
2611 src_color != FF_COLOR_GRAY)
2612 loss |= FF_LOSS_COLORSPACE;
2615 /* fail safe test */
2616 if (src_color != dst_color)
2617 loss |= FF_LOSS_COLORSPACE;
2620 if(loss & FF_LOSS_COLORSPACE)
2621 score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
2623 if (dst_color == FF_COLOR_GRAY &&
2624 src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
2625 loss |= FF_LOSS_CHROMA;
2628 if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
2629 loss |= FF_LOSS_ALPHA;
2632 if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
2633 (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
2634 loss |= FF_LOSS_COLORQUANT;
2642 int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
2643 enum AVPixelFormat src_pix_fmt,
2647 int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
2653 enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
2654 enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
2656 enum AVPixelFormat dst_pix_fmt;
2657 int loss1, loss2, loss_mask;
2658 const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
2659 const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
2663 dst_pix_fmt = dst_pix_fmt2;
2664 } else if (!desc2) {
2665 dst_pix_fmt = dst_pix_fmt1;
2667 loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
2669 loss_mask &= ~FF_LOSS_ALPHA;
2671 score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
2672 score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
2674 if (score1 == score2) {
2675 if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) {
2676 dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
2678 dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
2681 dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
2686 *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
2690 const char *av_color_range_name(enum AVColorRange range)
2692 return (unsigned) range < AVCOL_RANGE_NB ?
2693 color_range_names[range] : NULL;
2696 int av_color_range_from_name(const char *name)
2700 for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
2701 size_t len = strlen(color_range_names[i]);
2702 if (!strncmp(color_range_names[i], name, len))
2706 return AVERROR(EINVAL);
2709 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
2711 return (unsigned) primaries < AVCOL_PRI_NB ?
2712 color_primaries_names[primaries] : NULL;
2715 int av_color_primaries_from_name(const char *name)
2719 for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) {
2720 size_t len = strlen(color_primaries_names[i]);
2721 if (!strncmp(color_primaries_names[i], name, len))
2725 return AVERROR(EINVAL);
2728 const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
2730 return (unsigned) transfer < AVCOL_TRC_NB ?
2731 color_transfer_names[transfer] : NULL;
2734 int av_color_transfer_from_name(const char *name)
2738 for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) {
2739 size_t len = strlen(color_transfer_names[i]);
2740 if (!strncmp(color_transfer_names[i], name, len))
2744 return AVERROR(EINVAL);
2747 const char *av_color_space_name(enum AVColorSpace space)
2749 return (unsigned) space < AVCOL_SPC_NB ?
2750 color_space_names[space] : NULL;
2753 int av_color_space_from_name(const char *name)
2757 for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) {
2758 size_t len = strlen(color_space_names[i]);
2759 if (!strncmp(color_space_names[i], name, len))
2763 return AVERROR(EINVAL);
2766 const char *av_chroma_location_name(enum AVChromaLocation location)
2768 return (unsigned) location < AVCHROMA_LOC_NB ?
2769 chroma_location_names[location] : NULL;
2772 int av_chroma_location_from_name(const char *name)
2776 for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) {
2777 size_t len = strlen(chroma_location_names[i]);
2778 if (!strncmp(chroma_location_names[i], name, len))
2782 return AVERROR(EINVAL);