FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavutil/pixdesc.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 339 394 86.0%
Functions: 28 33 84.8%
Branches: 255 333 76.6%

Line Branch Exec Source
1 /*
2 * pixel format descriptor
3 * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at>
4 *
5 * This file is part of FFmpeg.
6 *
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.
11 *
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.
16 *
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
20 */
21
22 #include <stdio.h>
23 #include <string.h>
24
25 #include "avstring.h"
26 #include "common.h"
27 #include "pixfmt.h"
28 #include "pixdesc.h"
29 #include "intreadwrite.h"
30
31 1056928 void av_read_image_line2(void *dst,
32 const uint8_t *data[4], const int linesize[4],
33 const AVPixFmtDescriptor *desc,
34 int x, int y, int c, int w,
35 int read_pal_component,
36 int dst_element_size)
37 {
38 1056928 AVComponentDescriptor comp = desc->comp[c];
39 1056928 int plane = comp.plane;
40 1056928 int depth = comp.depth;
41 1056928 unsigned mask = (1ULL << depth) - 1;
42 1056928 int shift = comp.shift;
43 1056928 int step = comp.step;
44 1056928 int flags = desc->flags;
45 1056928 uint16_t *dst16 = dst;
46 1056928 uint32_t *dst32 = dst;
47
48
2/2
✓ Branch 0 taken 234720 times.
✓ Branch 1 taken 822208 times.
1056928 if (!depth)
49 234720 return;
50
51
2/2
✓ Branch 0 taken 2896 times.
✓ Branch 1 taken 819312 times.
822208 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
52
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2888 times.
2896 if (step > 8) {
53 // Assume all channels are packed into a 32bit value
54 8 const uint8_t *byte_p = data[plane] + y * linesize[plane];
55 8 const uint32_t *p = (uint32_t *)byte_p;
56
57
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 8 times.
24 while (w--) {
58 16 int val = AV_RB32(p);
59 16 val = (val >> comp.offset) & mask;
60
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (read_pal_component)
61 val = data[1][4*val + c];
62
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (dst_element_size == 4) *dst32++ = val;
63 16 else *dst16++ = val;
64 16 p++;
65 }
66 } else {
67 2888 int skip = x * step + comp.offset;
68 2888 const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
69 2888 int shift = 8 - depth - (skip & 7);
70
71
2/2
✓ Branch 0 taken 1013776 times.
✓ Branch 1 taken 2888 times.
1016664 while (w--) {
72 1013776 int val = (*p >> shift) & mask;
73
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1013776 times.
1013776 if (read_pal_component)
74 val = data[1][4*val + c];
75 1013776 shift -= step;
76 1013776 p -= shift >> 3;
77 1013776 shift &= 7;
78
2/2
✓ Branch 0 taken 1013760 times.
✓ Branch 1 taken 16 times.
1013776 if (dst_element_size == 4) *dst32++ = val;
79 16 else *dst16++ = val;
80 }
81 }
82 } else {
83 819312 const uint8_t *p = data[plane] + y * linesize[plane] +
84 819312 x * step + comp.offset;
85 819312 int is_8bit = shift + depth <= 8;
86 819312 int is_16bit= shift + depth <=16;
87
88
2/2
✓ Branch 0 taken 247146 times.
✓ Branch 1 taken 572166 times.
819312 if (is_8bit)
89 247146 p += !!(flags & AV_PIX_FMT_FLAG_BE);
90
91
2/2
✓ Branch 0 taken 262375104 times.
✓ Branch 1 taken 819312 times.
263194416 while (w--) {
92 unsigned val;
93
2/2
✓ Branch 0 taken 80404212 times.
✓ Branch 1 taken 181970892 times.
262375104 if (is_8bit) val = *p;
94
4/4
✓ Branch 0 taken 173860724 times.
✓ Branch 1 taken 8110168 times.
✓ Branch 2 taken 82368436 times.
✓ Branch 3 taken 91492288 times.
181970892 else if(is_16bit) val = flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p);
95
2/2
✓ Branch 0 taken 4055084 times.
✓ Branch 1 taken 4055084 times.
8110168 else val = flags & AV_PIX_FMT_FLAG_BE ? AV_RB32(p) : AV_RL32(p);
96 262375104 val = (val >> shift) & mask;
97
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 262375104 times.
262375104 if (read_pal_component)
98 val = data[1][4 * val + c];
99 262375104 p += step;
100
2/2
✓ Branch 0 taken 262373760 times.
✓ Branch 1 taken 1344 times.
262375104 if (dst_element_size == 4) *dst32++ = val;
101 1344 else *dst16++ = val;
102 }
103 }
104 }
105
106 688 void av_read_image_line(uint16_t *dst,
107 const uint8_t *data[4], const int linesize[4],
108 const AVPixFmtDescriptor *desc,
109 int x, int y, int c, int w,
110 int read_pal_component)
111 {
112 688 av_read_image_line2(dst, data, linesize, desc,x, y, c, w,
113 read_pal_component,
114 2);
115 688 }
116
117 1059049 void av_write_image_line2(const void *src,
118 uint8_t *data[4], const int linesize[4],
119 const AVPixFmtDescriptor *desc,
120 int x, int y, int c, int w, int src_element_size)
121 {
122 1059049 AVComponentDescriptor comp = desc->comp[c];
123 1059049 int plane = comp.plane;
124 1059049 int depth = comp.depth;
125 1059049 int step = comp.step;
126 1059049 int flags = desc->flags;
127 1059049 const uint32_t *src32 = src;
128 1059049 const uint16_t *src16 = src;
129
130
2/2
✓ Branch 0 taken 234720 times.
✓ Branch 1 taken 824329 times.
1059049 if (!depth)
131 234720 return;
132
133
2/2
✓ Branch 0 taken 2938 times.
✓ Branch 1 taken 821391 times.
824329 if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
134
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 2912 times.
2938 if (step > 8) {
135 // Assume all channels are packed into a 32bit value
136 26 const uint8_t *byte_p = data[plane] + y * linesize[plane];
137 26 uint32_t *p = (uint32_t *)byte_p;
138 26 int offset = comp.offset;
139 26 uint32_t mask = ((1ULL << depth) - 1) << offset;
140
141
2/2
✓ Branch 0 taken 160 times.
✓ Branch 1 taken 26 times.
186 while (w--) {
142
2/2
✓ Branch 0 taken 144 times.
✓ Branch 1 taken 16 times.
160 unsigned val = src_element_size == 4 ? *src32++ : *src16++;
143 160 AV_WB32(p, (AV_RB32(p) & ~mask) | (val << offset));
144 160 p++;
145 }
146 } else {
147 2912 int skip = x * step + comp.offset;
148 2912 uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
149 2912 int shift = 8 - depth - (skip & 7);
150
151
2/2
✓ Branch 0 taken 1013968 times.
✓ Branch 1 taken 2912 times.
1016880 while (w--) {
152
2/2
✓ Branch 0 taken 1013952 times.
✓ Branch 1 taken 16 times.
1013968 *p |= (src_element_size == 4 ? *src32++ : *src16++) << shift;
153 1013968 shift -= step;
154 1013968 p -= shift >> 3;
155 1013968 shift &= 7;
156 }
157 }
158 } else {
159 821391 int shift = comp.shift;
160 821391 uint8_t *p = data[plane] + y * linesize[plane] +
161 821391 x * step + comp.offset;
162
163
2/2
✓ Branch 0 taken 247779 times.
✓ Branch 1 taken 573612 times.
821391 if (shift + depth <= 8) {
164 247779 p += !!(flags & AV_PIX_FMT_FLAG_BE);
165
2/2
✓ Branch 0 taken 80404854 times.
✓ Branch 1 taken 247779 times.
80652633 while (w--) {
166
2/2
✓ Branch 0 taken 80404482 times.
✓ Branch 1 taken 372 times.
80404854 *p |= ((src_element_size == 4 ? *src32++ : *src16++) << shift);
167 80404854 p += step;
168 }
169 } else {
170
2/2
✓ Branch 0 taken 181972356 times.
✓ Branch 1 taken 573612 times.
182545968 while (w--) {
171
2/2
✓ Branch 0 taken 181971384 times.
✓ Branch 1 taken 972 times.
181972356 unsigned s = (src_element_size == 4 ? *src32++ : *src16++);
172
2/2
✓ Branch 0 taken 173862056 times.
✓ Branch 1 taken 8110300 times.
181972356 if (shift + depth <= 16) {
173
2/2
✓ Branch 0 taken 82369093 times.
✓ Branch 1 taken 91492963 times.
173862056 if (flags & AV_PIX_FMT_FLAG_BE) {
174 82369093 uint16_t val = AV_RB16(p) | (s << shift);
175 82369093 AV_WB16(p, val);
176 } else {
177 91492963 uint16_t val = AV_RL16(p) | (s << shift);
178 91492963 AV_WL16(p, val);
179 }
180 } else {
181
2/2
✓ Branch 0 taken 4055150 times.
✓ Branch 1 taken 4055150 times.
8110300 if (flags & AV_PIX_FMT_FLAG_BE) {
182 4055150 uint32_t val = AV_RB32(p) | (s << shift);
183 4055150 AV_WB32(p, val);
184 } else {
185 4055150 uint32_t val = AV_RL32(p) | (s << shift);
186 4055150 AV_WL32(p, val);
187 }
188 }
189 181972356 p += step;
190 }
191 }
192 }
193 }
194
195 688 void av_write_image_line(const uint16_t *src,
196 uint8_t *data[4], const int linesize[4],
197 const AVPixFmtDescriptor *desc,
198 int x, int y, int c, int w)
199 {
200 688 av_write_image_line2(src, data, linesize, desc, x, y, c, w, 2);
201 688 }
202
203 static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
204 [AV_PIX_FMT_YUV420P] = {
205 .name = "yuv420p",
206 .nb_components = 3,
207 .log2_chroma_w = 1,
208 .log2_chroma_h = 1,
209 .comp = {
210 { 0, 1, 0, 0, 8 }, /* Y */
211 { 1, 1, 0, 0, 8 }, /* U */
212 { 2, 1, 0, 0, 8 }, /* V */
213 },
214 .flags = AV_PIX_FMT_FLAG_PLANAR,
215 },
216 [AV_PIX_FMT_YUYV422] = {
217 .name = "yuyv422",
218 .nb_components = 3,
219 .log2_chroma_w = 1,
220 .log2_chroma_h = 0,
221 .comp = {
222 { 0, 2, 0, 0, 8 }, /* Y */
223 { 0, 4, 1, 0, 8 }, /* U */
224 { 0, 4, 3, 0, 8 }, /* V */
225 },
226 },
227 [AV_PIX_FMT_YVYU422] = {
228 .name = "yvyu422",
229 .nb_components = 3,
230 .log2_chroma_w = 1,
231 .log2_chroma_h = 0,
232 .comp = {
233 { 0, 2, 0, 0, 8 }, /* Y */
234 { 0, 4, 3, 0, 8 }, /* U */
235 { 0, 4, 1, 0, 8 }, /* V */
236 },
237 },
238 [AV_PIX_FMT_Y210LE] = {
239 .name = "y210le",
240 .nb_components = 3,
241 .log2_chroma_w = 1,
242 .log2_chroma_h = 0,
243 .comp = {
244 { 0, 4, 0, 6, 10 }, /* Y */
245 { 0, 8, 2, 6, 10 }, /* U */
246 { 0, 8, 6, 6, 10 }, /* V */
247 },
248 },
249 [AV_PIX_FMT_Y210BE] = {
250 .name = "y210be",
251 .nb_components = 3,
252 .log2_chroma_w = 1,
253 .log2_chroma_h = 0,
254 .comp = {
255 { 0, 4, 0, 6, 10 }, /* Y */
256 { 0, 8, 2, 6, 10 }, /* U */
257 { 0, 8, 6, 6, 10 }, /* V */
258 },
259 .flags = AV_PIX_FMT_FLAG_BE,
260 },
261 [AV_PIX_FMT_RGB24] = {
262 .name = "rgb24",
263 .nb_components = 3,
264 .log2_chroma_w = 0,
265 .log2_chroma_h = 0,
266 .comp = {
267 { 0, 3, 0, 0, 8 }, /* R */
268 { 0, 3, 1, 0, 8 }, /* G */
269 { 0, 3, 2, 0, 8 }, /* B */
270 },
271 .flags = AV_PIX_FMT_FLAG_RGB,
272 },
273 [AV_PIX_FMT_BGR24] = {
274 .name = "bgr24",
275 .nb_components = 3,
276 .log2_chroma_w = 0,
277 .log2_chroma_h = 0,
278 .comp = {
279 { 0, 3, 2, 0, 8 }, /* R */
280 { 0, 3, 1, 0, 8 }, /* G */
281 { 0, 3, 0, 0, 8 }, /* B */
282 },
283 .flags = AV_PIX_FMT_FLAG_RGB,
284 },
285 [AV_PIX_FMT_X2RGB10LE] = {
286 .name = "x2rgb10le",
287 .nb_components= 3,
288 .log2_chroma_w= 0,
289 .log2_chroma_h= 0,
290 .comp = {
291 { 0, 4, 2, 4, 10 }, /* R */
292 { 0, 4, 1, 2, 10 }, /* G */
293 { 0, 4, 0, 0, 10 }, /* B */
294 { 0, 4, 3, 6, 2 }, /* X */
295 },
296 .flags = AV_PIX_FMT_FLAG_RGB,
297 },
298 [AV_PIX_FMT_X2RGB10BE] = {
299 .name = "x2rgb10be",
300 .nb_components= 3,
301 .log2_chroma_w= 0,
302 .log2_chroma_h= 0,
303 .comp = {
304 { 0, 4, 0, 4, 10 }, /* R */
305 { 0, 4, 1, 2, 10 }, /* G */
306 { 0, 4, 2, 0, 10 }, /* B */
307 { 0, 4, 3, 6, 2 }, /* X */
308 },
309 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
310 },
311 [AV_PIX_FMT_X2BGR10LE] = {
312 .name = "x2bgr10le",
313 .nb_components= 3,
314 .log2_chroma_w= 0,
315 .log2_chroma_h= 0,
316 .comp = {
317 { 0, 4, 0, 0, 10 }, /* R */
318 { 0, 4, 1, 2, 10 }, /* G */
319 { 0, 4, 2, 4, 10 }, /* B */
320 { 0, 4, 3, 6, 2 }, /* X */
321 },
322 .flags = AV_PIX_FMT_FLAG_RGB,
323 },
324 [AV_PIX_FMT_X2BGR10BE] = {
325 .name = "x2bgr10be",
326 .nb_components= 3,
327 .log2_chroma_w= 0,
328 .log2_chroma_h= 0,
329 .comp = {
330 { 0, 4, 2, 0, 10 }, /* R */
331 { 0, 4, 1, 2, 10 }, /* G */
332 { 0, 4, 0, 4, 10 }, /* B */
333 { 0, 4, 3, 6, 2 }, /* X */
334 },
335 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
336 },
337 [AV_PIX_FMT_YUV422P] = {
338 .name = "yuv422p",
339 .nb_components = 3,
340 .log2_chroma_w = 1,
341 .log2_chroma_h = 0,
342 .comp = {
343 { 0, 1, 0, 0, 8 }, /* Y */
344 { 1, 1, 0, 0, 8 }, /* U */
345 { 2, 1, 0, 0, 8 }, /* V */
346 },
347 .flags = AV_PIX_FMT_FLAG_PLANAR,
348 },
349 [AV_PIX_FMT_YUV444P] = {
350 .name = "yuv444p",
351 .nb_components = 3,
352 .log2_chroma_w = 0,
353 .log2_chroma_h = 0,
354 .comp = {
355 { 0, 1, 0, 0, 8 }, /* Y */
356 { 1, 1, 0, 0, 8 }, /* U */
357 { 2, 1, 0, 0, 8 }, /* V */
358 },
359 .flags = AV_PIX_FMT_FLAG_PLANAR,
360 },
361 [AV_PIX_FMT_YUV410P] = {
362 .name = "yuv410p",
363 .nb_components = 3,
364 .log2_chroma_w = 2,
365 .log2_chroma_h = 2,
366 .comp = {
367 { 0, 1, 0, 0, 8 }, /* Y */
368 { 1, 1, 0, 0, 8 }, /* U */
369 { 2, 1, 0, 0, 8 }, /* V */
370 },
371 .flags = AV_PIX_FMT_FLAG_PLANAR,
372 },
373 [AV_PIX_FMT_YUV411P] = {
374 .name = "yuv411p",
375 .nb_components = 3,
376 .log2_chroma_w = 2,
377 .log2_chroma_h = 0,
378 .comp = {
379 { 0, 1, 0, 0, 8 }, /* Y */
380 { 1, 1, 0, 0, 8 }, /* U */
381 { 2, 1, 0, 0, 8 }, /* V */
382 },
383 .flags = AV_PIX_FMT_FLAG_PLANAR,
384 },
385 [AV_PIX_FMT_YUVJ411P] = {
386 .name = "yuvj411p",
387 .nb_components = 3,
388 .log2_chroma_w = 2,
389 .log2_chroma_h = 0,
390 .comp = {
391 { 0, 1, 0, 0, 8 }, /* Y */
392 { 1, 1, 0, 0, 8 }, /* U */
393 { 2, 1, 0, 0, 8 }, /* V */
394 },
395 .flags = AV_PIX_FMT_FLAG_PLANAR,
396 },
397 [AV_PIX_FMT_GRAY8] = {
398 .name = "gray",
399 .nb_components = 1,
400 .log2_chroma_w = 0,
401 .log2_chroma_h = 0,
402 .comp = {
403 { 0, 1, 0, 0, 8 }, /* Y */
404 },
405 .alias = "gray8,y8",
406 },
407 [AV_PIX_FMT_MONOWHITE] = {
408 .name = "monow",
409 .nb_components = 1,
410 .log2_chroma_w = 0,
411 .log2_chroma_h = 0,
412 .comp = {
413 { 0, 1, 0, 0, 1 }, /* Y */
414 },
415 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
416 },
417 [AV_PIX_FMT_MONOBLACK] = {
418 .name = "monob",
419 .nb_components = 1,
420 .log2_chroma_w = 0,
421 .log2_chroma_h = 0,
422 .comp = {
423 { 0, 1, 0, 7, 1 }, /* Y */
424 },
425 .flags = AV_PIX_FMT_FLAG_BITSTREAM,
426 },
427 [AV_PIX_FMT_PAL8] = {
428 .name = "pal8",
429 .nb_components = 1,
430 .log2_chroma_w = 0,
431 .log2_chroma_h = 0,
432 .comp = {
433 { 0, 1, 0, 0, 8 },
434 },
435 .flags = AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_ALPHA,
436 },
437 [AV_PIX_FMT_YUVJ420P] = {
438 .name = "yuvj420p",
439 .nb_components = 3,
440 .log2_chroma_w = 1,
441 .log2_chroma_h = 1,
442 .comp = {
443 { 0, 1, 0, 0, 8 }, /* Y */
444 { 1, 1, 0, 0, 8 }, /* U */
445 { 2, 1, 0, 0, 8 }, /* V */
446 },
447 .flags = AV_PIX_FMT_FLAG_PLANAR,
448 },
449 [AV_PIX_FMT_YUVJ422P] = {
450 .name = "yuvj422p",
451 .nb_components = 3,
452 .log2_chroma_w = 1,
453 .log2_chroma_h = 0,
454 .comp = {
455 { 0, 1, 0, 0, 8 }, /* Y */
456 { 1, 1, 0, 0, 8 }, /* U */
457 { 2, 1, 0, 0, 8 }, /* V */
458 },
459 .flags = AV_PIX_FMT_FLAG_PLANAR,
460 },
461 [AV_PIX_FMT_YUVJ444P] = {
462 .name = "yuvj444p",
463 .nb_components = 3,
464 .log2_chroma_w = 0,
465 .log2_chroma_h = 0,
466 .comp = {
467 { 0, 1, 0, 0, 8 }, /* Y */
468 { 1, 1, 0, 0, 8 }, /* U */
469 { 2, 1, 0, 0, 8 }, /* V */
470 },
471 .flags = AV_PIX_FMT_FLAG_PLANAR,
472 },
473 [AV_PIX_FMT_UYVY422] = {
474 .name = "uyvy422",
475 .nb_components = 3,
476 .log2_chroma_w = 1,
477 .log2_chroma_h = 0,
478 .comp = {
479 { 0, 2, 1, 0, 8 }, /* Y */
480 { 0, 4, 0, 0, 8 }, /* U */
481 { 0, 4, 2, 0, 8 }, /* V */
482 },
483 },
484 [AV_PIX_FMT_UYYVYY411] = {
485 .name = "uyyvyy411",
486 .nb_components = 3,
487 .log2_chroma_w = 2,
488 .log2_chroma_h = 0,
489 .comp = {
490 { 0, 4, 1, 0, 8 }, /* Y */
491 { 0, 6, 0, 0, 8 }, /* U */
492 { 0, 6, 3, 0, 8 }, /* V */
493 },
494 },
495 [AV_PIX_FMT_BGR8] = {
496 .name = "bgr8",
497 .nb_components = 3,
498 .log2_chroma_w = 0,
499 .log2_chroma_h = 0,
500 .comp = {
501 { 0, 1, 0, 0, 3 }, /* R */
502 { 0, 1, 0, 3, 3 }, /* G */
503 { 0, 1, 0, 6, 2 }, /* B */
504 },
505 .flags = AV_PIX_FMT_FLAG_RGB,
506 },
507 [AV_PIX_FMT_BGR4] = {
508 .name = "bgr4",
509 .nb_components = 3,
510 .log2_chroma_w = 0,
511 .log2_chroma_h = 0,
512 .comp = {
513 { 0, 4, 3, 0, 1 }, /* R */
514 { 0, 4, 1, 0, 2 }, /* G */
515 { 0, 4, 0, 0, 1 }, /* B */
516 },
517 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
518 },
519 [AV_PIX_FMT_BGR4_BYTE] = {
520 .name = "bgr4_byte",
521 .nb_components = 3,
522 .log2_chroma_w = 0,
523 .log2_chroma_h = 0,
524 .comp = {
525 { 0, 1, 0, 0, 1 }, /* R */
526 { 0, 1, 0, 1, 2 }, /* G */
527 { 0, 1, 0, 3, 1 }, /* B */
528 },
529 .flags = AV_PIX_FMT_FLAG_RGB,
530 },
531 [AV_PIX_FMT_RGB8] = {
532 .name = "rgb8",
533 .nb_components = 3,
534 .log2_chroma_w = 0,
535 .log2_chroma_h = 0,
536 .comp = {
537 { 0, 1, 0, 5, 3 }, /* R */
538 { 0, 1, 0, 2, 3 }, /* G */
539 { 0, 1, 0, 0, 2 }, /* B */
540 },
541 .flags = AV_PIX_FMT_FLAG_RGB,
542 },
543 [AV_PIX_FMT_RGB4] = {
544 .name = "rgb4",
545 .nb_components = 3,
546 .log2_chroma_w = 0,
547 .log2_chroma_h = 0,
548 .comp = {
549 { 0, 4, 0, 0, 1 }, /* R */
550 { 0, 4, 1, 0, 2 }, /* G */
551 { 0, 4, 3, 0, 1 }, /* B */
552 },
553 .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
554 },
555 [AV_PIX_FMT_RGB4_BYTE] = {
556 .name = "rgb4_byte",
557 .nb_components = 3,
558 .log2_chroma_w = 0,
559 .log2_chroma_h = 0,
560 .comp = {
561 { 0, 1, 0, 3, 1 }, /* R */
562 { 0, 1, 0, 1, 2 }, /* G */
563 { 0, 1, 0, 0, 1 }, /* B */
564 },
565 .flags = AV_PIX_FMT_FLAG_RGB,
566 },
567 [AV_PIX_FMT_NV12] = {
568 .name = "nv12",
569 .nb_components = 3,
570 .log2_chroma_w = 1,
571 .log2_chroma_h = 1,
572 .comp = {
573 { 0, 1, 0, 0, 8 }, /* Y */
574 { 1, 2, 0, 0, 8 }, /* U */
575 { 1, 2, 1, 0, 8 }, /* V */
576 },
577 .flags = AV_PIX_FMT_FLAG_PLANAR,
578 },
579 [AV_PIX_FMT_NV21] = {
580 .name = "nv21",
581 .nb_components = 3,
582 .log2_chroma_w = 1,
583 .log2_chroma_h = 1,
584 .comp = {
585 { 0, 1, 0, 0, 8 }, /* Y */
586 { 1, 2, 1, 0, 8 }, /* U */
587 { 1, 2, 0, 0, 8 }, /* V */
588 },
589 .flags = AV_PIX_FMT_FLAG_PLANAR,
590 },
591 [AV_PIX_FMT_ARGB] = {
592 .name = "argb",
593 .nb_components = 4,
594 .log2_chroma_w = 0,
595 .log2_chroma_h = 0,
596 .comp = {
597 { 0, 4, 1, 0, 8 }, /* R */
598 { 0, 4, 2, 0, 8 }, /* G */
599 { 0, 4, 3, 0, 8 }, /* B */
600 { 0, 4, 0, 0, 8 }, /* A */
601 },
602 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
603 },
604 [AV_PIX_FMT_RGBA] = {
605 .name = "rgba",
606 .nb_components = 4,
607 .log2_chroma_w = 0,
608 .log2_chroma_h = 0,
609 .comp = {
610 { 0, 4, 0, 0, 8 }, /* R */
611 { 0, 4, 1, 0, 8 }, /* G */
612 { 0, 4, 2, 0, 8 }, /* B */
613 { 0, 4, 3, 0, 8 }, /* A */
614 },
615 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
616 },
617 [AV_PIX_FMT_ABGR] = {
618 .name = "abgr",
619 .nb_components = 4,
620 .log2_chroma_w = 0,
621 .log2_chroma_h = 0,
622 .comp = {
623 { 0, 4, 3, 0, 8 }, /* R */
624 { 0, 4, 2, 0, 8 }, /* G */
625 { 0, 4, 1, 0, 8 }, /* B */
626 { 0, 4, 0, 0, 8 }, /* A */
627 },
628 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
629 },
630 [AV_PIX_FMT_BGRA] = {
631 .name = "bgra",
632 .nb_components = 4,
633 .log2_chroma_w = 0,
634 .log2_chroma_h = 0,
635 .comp = {
636 { 0, 4, 2, 0, 8 }, /* R */
637 { 0, 4, 1, 0, 8 }, /* G */
638 { 0, 4, 0, 0, 8 }, /* B */
639 { 0, 4, 3, 0, 8 }, /* A */
640 },
641 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
642 },
643 [AV_PIX_FMT_0RGB] = {
644 .name = "0rgb",
645 .nb_components= 3,
646 .log2_chroma_w= 0,
647 .log2_chroma_h= 0,
648 .comp = {
649 { 0, 4, 1, 0, 8 }, /* R */
650 { 0, 4, 2, 0, 8 }, /* G */
651 { 0, 4, 3, 0, 8 }, /* B */
652 { 0, 4, 0, 0, 8 }, /* X */
653 },
654 .flags = AV_PIX_FMT_FLAG_RGB,
655 },
656 [AV_PIX_FMT_RGB0] = {
657 .name = "rgb0",
658 .nb_components= 3,
659 .log2_chroma_w= 0,
660 .log2_chroma_h= 0,
661 .comp = {
662 { 0, 4, 0, 0, 8 }, /* R */
663 { 0, 4, 1, 0, 8 }, /* G */
664 { 0, 4, 2, 0, 8 }, /* B */
665 { 0, 4, 3, 0, 8 }, /* X */
666 },
667 .flags = AV_PIX_FMT_FLAG_RGB,
668 },
669 [AV_PIX_FMT_0BGR] = {
670 .name = "0bgr",
671 .nb_components= 3,
672 .log2_chroma_w= 0,
673 .log2_chroma_h= 0,
674 .comp = {
675 { 0, 4, 3, 0, 8 }, /* R */
676 { 0, 4, 2, 0, 8 }, /* G */
677 { 0, 4, 1, 0, 8 }, /* B */
678 { 0, 4, 0, 0, 8 }, /* X */
679 },
680 .flags = AV_PIX_FMT_FLAG_RGB,
681 },
682 [AV_PIX_FMT_BGR0] = {
683 .name = "bgr0",
684 .nb_components= 3,
685 .log2_chroma_w= 0,
686 .log2_chroma_h= 0,
687 .comp = {
688 { 0, 4, 2, 0, 8 }, /* R */
689 { 0, 4, 1, 0, 8 }, /* G */
690 { 0, 4, 0, 0, 8 }, /* B */
691 { 0, 4, 3, 0, 8 }, /* X */
692 },
693 .flags = AV_PIX_FMT_FLAG_RGB,
694 },
695 [AV_PIX_FMT_GRAY9BE] = {
696 .name = "gray9be",
697 .nb_components = 1,
698 .log2_chroma_w = 0,
699 .log2_chroma_h = 0,
700 .comp = {
701 { 0, 2, 0, 0, 9 }, /* Y */
702 },
703 .flags = AV_PIX_FMT_FLAG_BE,
704 .alias = "y9be",
705 },
706 [AV_PIX_FMT_GRAY9LE] = {
707 .name = "gray9le",
708 .nb_components = 1,
709 .log2_chroma_w = 0,
710 .log2_chroma_h = 0,
711 .comp = {
712 { 0, 2, 0, 0, 9 }, /* Y */
713 },
714 .alias = "y9le",
715 },
716 [AV_PIX_FMT_GRAY10BE] = {
717 .name = "gray10be",
718 .nb_components = 1,
719 .log2_chroma_w = 0,
720 .log2_chroma_h = 0,
721 .comp = {
722 { 0, 2, 0, 0, 10 }, /* Y */
723 },
724 .flags = AV_PIX_FMT_FLAG_BE,
725 .alias = "y10be",
726 },
727 [AV_PIX_FMT_GRAY10LE] = {
728 .name = "gray10le",
729 .nb_components = 1,
730 .log2_chroma_w = 0,
731 .log2_chroma_h = 0,
732 .comp = {
733 { 0, 2, 0, 0, 10 }, /* Y */
734 },
735 .alias = "y10le",
736 },
737 [AV_PIX_FMT_GRAY12BE] = {
738 .name = "gray12be",
739 .nb_components = 1,
740 .log2_chroma_w = 0,
741 .log2_chroma_h = 0,
742 .comp = {
743 { 0, 2, 0, 0, 12 }, /* Y */
744 },
745 .flags = AV_PIX_FMT_FLAG_BE,
746 .alias = "y12be",
747 },
748 [AV_PIX_FMT_GRAY12LE] = {
749 .name = "gray12le",
750 .nb_components = 1,
751 .log2_chroma_w = 0,
752 .log2_chroma_h = 0,
753 .comp = {
754 { 0, 2, 0, 0, 12 }, /* Y */
755 },
756 .alias = "y12le",
757 },
758 [AV_PIX_FMT_GRAY14BE] = {
759 .name = "gray14be",
760 .nb_components = 1,
761 .log2_chroma_w = 0,
762 .log2_chroma_h = 0,
763 .comp = {
764 { 0, 2, 0, 0, 14 }, /* Y */
765 },
766 .flags = AV_PIX_FMT_FLAG_BE,
767 .alias = "y14be",
768 },
769 [AV_PIX_FMT_GRAY14LE] = {
770 .name = "gray14le",
771 .nb_components = 1,
772 .log2_chroma_w = 0,
773 .log2_chroma_h = 0,
774 .comp = {
775 { 0, 2, 0, 0, 14 }, /* Y */
776 },
777 .alias = "y14le",
778 },
779 [AV_PIX_FMT_GRAY16BE] = {
780 .name = "gray16be",
781 .nb_components = 1,
782 .log2_chroma_w = 0,
783 .log2_chroma_h = 0,
784 .comp = {
785 { 0, 2, 0, 0, 16 }, /* Y */
786 },
787 .flags = AV_PIX_FMT_FLAG_BE,
788 .alias = "y16be",
789 },
790 [AV_PIX_FMT_GRAY16LE] = {
791 .name = "gray16le",
792 .nb_components = 1,
793 .log2_chroma_w = 0,
794 .log2_chroma_h = 0,
795 .comp = {
796 { 0, 2, 0, 0, 16 }, /* Y */
797 },
798 .alias = "y16le",
799 },
800 [AV_PIX_FMT_YUV440P] = {
801 .name = "yuv440p",
802 .nb_components = 3,
803 .log2_chroma_w = 0,
804 .log2_chroma_h = 1,
805 .comp = {
806 { 0, 1, 0, 0, 8 }, /* Y */
807 { 1, 1, 0, 0, 8 }, /* U */
808 { 2, 1, 0, 0, 8 }, /* V */
809 },
810 .flags = AV_PIX_FMT_FLAG_PLANAR,
811 },
812 [AV_PIX_FMT_YUVJ440P] = {
813 .name = "yuvj440p",
814 .nb_components = 3,
815 .log2_chroma_w = 0,
816 .log2_chroma_h = 1,
817 .comp = {
818 { 0, 1, 0, 0, 8 }, /* Y */
819 { 1, 1, 0, 0, 8 }, /* U */
820 { 2, 1, 0, 0, 8 }, /* V */
821 },
822 .flags = AV_PIX_FMT_FLAG_PLANAR,
823 },
824 [AV_PIX_FMT_YUV440P10LE] = {
825 .name = "yuv440p10le",
826 .nb_components = 3,
827 .log2_chroma_w = 0,
828 .log2_chroma_h = 1,
829 .comp = {
830 { 0, 2, 0, 0, 10 }, /* Y */
831 { 1, 2, 0, 0, 10 }, /* U */
832 { 2, 2, 0, 0, 10 }, /* V */
833 },
834 .flags = AV_PIX_FMT_FLAG_PLANAR,
835 },
836 [AV_PIX_FMT_YUV440P10BE] = {
837 .name = "yuv440p10be",
838 .nb_components = 3,
839 .log2_chroma_w = 0,
840 .log2_chroma_h = 1,
841 .comp = {
842 { 0, 2, 0, 0, 10 }, /* Y */
843 { 1, 2, 0, 0, 10 }, /* U */
844 { 2, 2, 0, 0, 10 }, /* V */
845 },
846 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
847 },
848 [AV_PIX_FMT_YUV440P12LE] = {
849 .name = "yuv440p12le",
850 .nb_components = 3,
851 .log2_chroma_w = 0,
852 .log2_chroma_h = 1,
853 .comp = {
854 { 0, 2, 0, 0, 12 }, /* Y */
855 { 1, 2, 0, 0, 12 }, /* U */
856 { 2, 2, 0, 0, 12 }, /* V */
857 },
858 .flags = AV_PIX_FMT_FLAG_PLANAR,
859 },
860 [AV_PIX_FMT_YUV440P12BE] = {
861 .name = "yuv440p12be",
862 .nb_components = 3,
863 .log2_chroma_w = 0,
864 .log2_chroma_h = 1,
865 .comp = {
866 { 0, 2, 0, 0, 12 }, /* Y */
867 { 1, 2, 0, 0, 12 }, /* U */
868 { 2, 2, 0, 0, 12 }, /* V */
869 },
870 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
871 },
872 [AV_PIX_FMT_YUVA420P] = {
873 .name = "yuva420p",
874 .nb_components = 4,
875 .log2_chroma_w = 1,
876 .log2_chroma_h = 1,
877 .comp = {
878 { 0, 1, 0, 0, 8 }, /* Y */
879 { 1, 1, 0, 0, 8 }, /* U */
880 { 2, 1, 0, 0, 8 }, /* V */
881 { 3, 1, 0, 0, 8 }, /* A */
882 },
883 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
884 },
885 [AV_PIX_FMT_YUVA422P] = {
886 .name = "yuva422p",
887 .nb_components = 4,
888 .log2_chroma_w = 1,
889 .log2_chroma_h = 0,
890 .comp = {
891 { 0, 1, 0, 0, 8 }, /* Y */
892 { 1, 1, 0, 0, 8 }, /* U */
893 { 2, 1, 0, 0, 8 }, /* V */
894 { 3, 1, 0, 0, 8 }, /* A */
895 },
896 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
897 },
898 [AV_PIX_FMT_YUVA444P] = {
899 .name = "yuva444p",
900 .nb_components = 4,
901 .log2_chroma_w = 0,
902 .log2_chroma_h = 0,
903 .comp = {
904 { 0, 1, 0, 0, 8 }, /* Y */
905 { 1, 1, 0, 0, 8 }, /* U */
906 { 2, 1, 0, 0, 8 }, /* V */
907 { 3, 1, 0, 0, 8 }, /* A */
908 },
909 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
910 },
911 [AV_PIX_FMT_YUVA420P9BE] = {
912 .name = "yuva420p9be",
913 .nb_components = 4,
914 .log2_chroma_w = 1,
915 .log2_chroma_h = 1,
916 .comp = {
917 { 0, 2, 0, 0, 9 }, /* Y */
918 { 1, 2, 0, 0, 9 }, /* U */
919 { 2, 2, 0, 0, 9 }, /* V */
920 { 3, 2, 0, 0, 9 }, /* A */
921 },
922 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
923 },
924 [AV_PIX_FMT_YUVA420P9LE] = {
925 .name = "yuva420p9le",
926 .nb_components = 4,
927 .log2_chroma_w = 1,
928 .log2_chroma_h = 1,
929 .comp = {
930 { 0, 2, 0, 0, 9 }, /* Y */
931 { 1, 2, 0, 0, 9 }, /* U */
932 { 2, 2, 0, 0, 9 }, /* V */
933 { 3, 2, 0, 0, 9 }, /* A */
934 },
935 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
936 },
937 [AV_PIX_FMT_YUVA422P9BE] = {
938 .name = "yuva422p9be",
939 .nb_components = 4,
940 .log2_chroma_w = 1,
941 .log2_chroma_h = 0,
942 .comp = {
943 { 0, 2, 0, 0, 9 }, /* Y */
944 { 1, 2, 0, 0, 9 }, /* U */
945 { 2, 2, 0, 0, 9 }, /* V */
946 { 3, 2, 0, 0, 9 }, /* A */
947 },
948 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
949 },
950 [AV_PIX_FMT_YUVA422P9LE] = {
951 .name = "yuva422p9le",
952 .nb_components = 4,
953 .log2_chroma_w = 1,
954 .log2_chroma_h = 0,
955 .comp = {
956 { 0, 2, 0, 0, 9 }, /* Y */
957 { 1, 2, 0, 0, 9 }, /* U */
958 { 2, 2, 0, 0, 9 }, /* V */
959 { 3, 2, 0, 0, 9 }, /* A */
960 },
961 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
962 },
963 [AV_PIX_FMT_YUVA444P9BE] = {
964 .name = "yuva444p9be",
965 .nb_components = 4,
966 .log2_chroma_w = 0,
967 .log2_chroma_h = 0,
968 .comp = {
969 { 0, 2, 0, 0, 9 }, /* Y */
970 { 1, 2, 0, 0, 9 }, /* U */
971 { 2, 2, 0, 0, 9 }, /* V */
972 { 3, 2, 0, 0, 9 }, /* A */
973 },
974 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
975 },
976 [AV_PIX_FMT_YUVA444P9LE] = {
977 .name = "yuva444p9le",
978 .nb_components = 4,
979 .log2_chroma_w = 0,
980 .log2_chroma_h = 0,
981 .comp = {
982 { 0, 2, 0, 0, 9 }, /* Y */
983 { 1, 2, 0, 0, 9 }, /* U */
984 { 2, 2, 0, 0, 9 }, /* V */
985 { 3, 2, 0, 0, 9 }, /* A */
986 },
987 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
988 },
989 [AV_PIX_FMT_YUVA420P10BE] = {
990 .name = "yuva420p10be",
991 .nb_components = 4,
992 .log2_chroma_w = 1,
993 .log2_chroma_h = 1,
994 .comp = {
995 { 0, 2, 0, 0, 10 }, /* Y */
996 { 1, 2, 0, 0, 10 }, /* U */
997 { 2, 2, 0, 0, 10 }, /* V */
998 { 3, 2, 0, 0, 10 }, /* A */
999 },
1000 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1001 },
1002 [AV_PIX_FMT_YUVA420P10LE] = {
1003 .name = "yuva420p10le",
1004 .nb_components = 4,
1005 .log2_chroma_w = 1,
1006 .log2_chroma_h = 1,
1007 .comp = {
1008 { 0, 2, 0, 0, 10 }, /* Y */
1009 { 1, 2, 0, 0, 10 }, /* U */
1010 { 2, 2, 0, 0, 10 }, /* V */
1011 { 3, 2, 0, 0, 10 }, /* A */
1012 },
1013 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1014 },
1015 [AV_PIX_FMT_YUVA422P10BE] = {
1016 .name = "yuva422p10be",
1017 .nb_components = 4,
1018 .log2_chroma_w = 1,
1019 .log2_chroma_h = 0,
1020 .comp = {
1021 { 0, 2, 0, 0, 10 }, /* Y */
1022 { 1, 2, 0, 0, 10 }, /* U */
1023 { 2, 2, 0, 0, 10 }, /* V */
1024 { 3, 2, 0, 0, 10 }, /* A */
1025 },
1026 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1027 },
1028 [AV_PIX_FMT_YUVA422P10LE] = {
1029 .name = "yuva422p10le",
1030 .nb_components = 4,
1031 .log2_chroma_w = 1,
1032 .log2_chroma_h = 0,
1033 .comp = {
1034 { 0, 2, 0, 0, 10 }, /* Y */
1035 { 1, 2, 0, 0, 10 }, /* U */
1036 { 2, 2, 0, 0, 10 }, /* V */
1037 { 3, 2, 0, 0, 10 }, /* A */
1038 },
1039 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1040 },
1041 [AV_PIX_FMT_YUVA444P10BE] = {
1042 .name = "yuva444p10be",
1043 .nb_components = 4,
1044 .log2_chroma_w = 0,
1045 .log2_chroma_h = 0,
1046 .comp = {
1047 { 0, 2, 0, 0, 10 }, /* Y */
1048 { 1, 2, 0, 0, 10 }, /* U */
1049 { 2, 2, 0, 0, 10 }, /* V */
1050 { 3, 2, 0, 0, 10 }, /* A */
1051 },
1052 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1053 },
1054 [AV_PIX_FMT_YUVA444P10LE] = {
1055 .name = "yuva444p10le",
1056 .nb_components = 4,
1057 .log2_chroma_w = 0,
1058 .log2_chroma_h = 0,
1059 .comp = {
1060 { 0, 2, 0, 0, 10 }, /* Y */
1061 { 1, 2, 0, 0, 10 }, /* U */
1062 { 2, 2, 0, 0, 10 }, /* V */
1063 { 3, 2, 0, 0, 10 }, /* A */
1064 },
1065 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1066 },
1067 [AV_PIX_FMT_YUVA420P16BE] = {
1068 .name = "yuva420p16be",
1069 .nb_components = 4,
1070 .log2_chroma_w = 1,
1071 .log2_chroma_h = 1,
1072 .comp = {
1073 { 0, 2, 0, 0, 16 }, /* Y */
1074 { 1, 2, 0, 0, 16 }, /* U */
1075 { 2, 2, 0, 0, 16 }, /* V */
1076 { 3, 2, 0, 0, 16 }, /* A */
1077 },
1078 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1079 },
1080 [AV_PIX_FMT_YUVA420P16LE] = {
1081 .name = "yuva420p16le",
1082 .nb_components = 4,
1083 .log2_chroma_w = 1,
1084 .log2_chroma_h = 1,
1085 .comp = {
1086 { 0, 2, 0, 0, 16 }, /* Y */
1087 { 1, 2, 0, 0, 16 }, /* U */
1088 { 2, 2, 0, 0, 16 }, /* V */
1089 { 3, 2, 0, 0, 16 }, /* A */
1090 },
1091 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1092 },
1093 [AV_PIX_FMT_YUVA422P16BE] = {
1094 .name = "yuva422p16be",
1095 .nb_components = 4,
1096 .log2_chroma_w = 1,
1097 .log2_chroma_h = 0,
1098 .comp = {
1099 { 0, 2, 0, 0, 16 }, /* Y */
1100 { 1, 2, 0, 0, 16 }, /* U */
1101 { 2, 2, 0, 0, 16 }, /* V */
1102 { 3, 2, 0, 0, 16 }, /* A */
1103 },
1104 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1105 },
1106 [AV_PIX_FMT_YUVA422P16LE] = {
1107 .name = "yuva422p16le",
1108 .nb_components = 4,
1109 .log2_chroma_w = 1,
1110 .log2_chroma_h = 0,
1111 .comp = {
1112 { 0, 2, 0, 0, 16 }, /* Y */
1113 { 1, 2, 0, 0, 16 }, /* U */
1114 { 2, 2, 0, 0, 16 }, /* V */
1115 { 3, 2, 0, 0, 16 }, /* A */
1116 },
1117 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1118 },
1119 [AV_PIX_FMT_YUVA444P16BE] = {
1120 .name = "yuva444p16be",
1121 .nb_components = 4,
1122 .log2_chroma_w = 0,
1123 .log2_chroma_h = 0,
1124 .comp = {
1125 { 0, 2, 0, 0, 16 }, /* Y */
1126 { 1, 2, 0, 0, 16 }, /* U */
1127 { 2, 2, 0, 0, 16 }, /* V */
1128 { 3, 2, 0, 0, 16 }, /* A */
1129 },
1130 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1131 },
1132 [AV_PIX_FMT_YUVA444P16LE] = {
1133 .name = "yuva444p16le",
1134 .nb_components = 4,
1135 .log2_chroma_w = 0,
1136 .log2_chroma_h = 0,
1137 .comp = {
1138 { 0, 2, 0, 0, 16 }, /* Y */
1139 { 1, 2, 0, 0, 16 }, /* U */
1140 { 2, 2, 0, 0, 16 }, /* V */
1141 { 3, 2, 0, 0, 16 }, /* A */
1142 },
1143 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
1144 },
1145 [AV_PIX_FMT_RGB48BE] = {
1146 .name = "rgb48be",
1147 .nb_components = 3,
1148 .log2_chroma_w = 0,
1149 .log2_chroma_h = 0,
1150 .comp = {
1151 { 0, 6, 0, 0, 16 }, /* R */
1152 { 0, 6, 2, 0, 16 }, /* G */
1153 { 0, 6, 4, 0, 16 }, /* B */
1154 },
1155 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
1156 },
1157 [AV_PIX_FMT_RGB48LE] = {
1158 .name = "rgb48le",
1159 .nb_components = 3,
1160 .log2_chroma_w = 0,
1161 .log2_chroma_h = 0,
1162 .comp = {
1163 { 0, 6, 0, 0, 16 }, /* R */
1164 { 0, 6, 2, 0, 16 }, /* G */
1165 { 0, 6, 4, 0, 16 }, /* B */
1166 },
1167 .flags = AV_PIX_FMT_FLAG_RGB,
1168 },
1169 [AV_PIX_FMT_RGBA64BE] = {
1170 .name = "rgba64be",
1171 .nb_components = 4,
1172 .log2_chroma_w = 0,
1173 .log2_chroma_h = 0,
1174 .comp = {
1175 { 0, 8, 0, 0, 16 }, /* R */
1176 { 0, 8, 2, 0, 16 }, /* G */
1177 { 0, 8, 4, 0, 16 }, /* B */
1178 { 0, 8, 6, 0, 16 }, /* A */
1179 },
1180 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1181 },
1182 [AV_PIX_FMT_RGBA64LE] = {
1183 .name = "rgba64le",
1184 .nb_components = 4,
1185 .log2_chroma_w = 0,
1186 .log2_chroma_h = 0,
1187 .comp = {
1188 { 0, 8, 0, 0, 16 }, /* R */
1189 { 0, 8, 2, 0, 16 }, /* G */
1190 { 0, 8, 4, 0, 16 }, /* B */
1191 { 0, 8, 6, 0, 16 }, /* A */
1192 },
1193 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1194 },
1195 [AV_PIX_FMT_RGB565BE] = {
1196 .name = "rgb565be",
1197 .nb_components = 3,
1198 .log2_chroma_w = 0,
1199 .log2_chroma_h = 0,
1200 .comp = {
1201 { 0, 2, -1, 3, 5 }, /* R */
1202 { 0, 2, 0, 5, 6 }, /* G */
1203 { 0, 2, 0, 0, 5 }, /* B */
1204 },
1205 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1206 },
1207 [AV_PIX_FMT_RGB565LE] = {
1208 .name = "rgb565le",
1209 .nb_components = 3,
1210 .log2_chroma_w = 0,
1211 .log2_chroma_h = 0,
1212 .comp = {
1213 { 0, 2, 1, 3, 5 }, /* R */
1214 { 0, 2, 0, 5, 6 }, /* G */
1215 { 0, 2, 0, 0, 5 }, /* B */
1216 },
1217 .flags = AV_PIX_FMT_FLAG_RGB,
1218 },
1219 [AV_PIX_FMT_RGB555BE] = {
1220 .name = "rgb555be",
1221 .nb_components = 3,
1222 .log2_chroma_w = 0,
1223 .log2_chroma_h = 0,
1224 .comp = {
1225 { 0, 2, -1, 2, 5 }, /* R */
1226 { 0, 2, 0, 5, 5 }, /* G */
1227 { 0, 2, 0, 0, 5 }, /* B */
1228 },
1229 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1230 },
1231 [AV_PIX_FMT_RGB555LE] = {
1232 .name = "rgb555le",
1233 .nb_components = 3,
1234 .log2_chroma_w = 0,
1235 .log2_chroma_h = 0,
1236 .comp = {
1237 { 0, 2, 1, 2, 5 }, /* R */
1238 { 0, 2, 0, 5, 5 }, /* G */
1239 { 0, 2, 0, 0, 5 }, /* B */
1240 },
1241 .flags = AV_PIX_FMT_FLAG_RGB,
1242 },
1243 [AV_PIX_FMT_RGB444BE] = {
1244 .name = "rgb444be",
1245 .nb_components = 3,
1246 .log2_chroma_w = 0,
1247 .log2_chroma_h = 0,
1248 .comp = {
1249 { 0, 2, -1, 0, 4 }, /* R */
1250 { 0, 2, 0, 4, 4 }, /* G */
1251 { 0, 2, 0, 0, 4 }, /* B */
1252 },
1253 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1254 },
1255 [AV_PIX_FMT_RGB444LE] = {
1256 .name = "rgb444le",
1257 .nb_components = 3,
1258 .log2_chroma_w = 0,
1259 .log2_chroma_h = 0,
1260 .comp = {
1261 { 0, 2, 1, 0, 4 }, /* R */
1262 { 0, 2, 0, 4, 4 }, /* G */
1263 { 0, 2, 0, 0, 4 }, /* B */
1264 },
1265 .flags = AV_PIX_FMT_FLAG_RGB,
1266 },
1267 [AV_PIX_FMT_BGR48BE] = {
1268 .name = "bgr48be",
1269 .nb_components = 3,
1270 .log2_chroma_w = 0,
1271 .log2_chroma_h = 0,
1272 .comp = {
1273 { 0, 6, 4, 0, 16 }, /* R */
1274 { 0, 6, 2, 0, 16 }, /* G */
1275 { 0, 6, 0, 0, 16 }, /* B */
1276 },
1277 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1278 },
1279 [AV_PIX_FMT_BGR48LE] = {
1280 .name = "bgr48le",
1281 .nb_components = 3,
1282 .log2_chroma_w = 0,
1283 .log2_chroma_h = 0,
1284 .comp = {
1285 { 0, 6, 4, 0, 16 }, /* R */
1286 { 0, 6, 2, 0, 16 }, /* G */
1287 { 0, 6, 0, 0, 16 }, /* B */
1288 },
1289 .flags = AV_PIX_FMT_FLAG_RGB,
1290 },
1291 [AV_PIX_FMT_BGRA64BE] = {
1292 .name = "bgra64be",
1293 .nb_components = 4,
1294 .log2_chroma_w = 0,
1295 .log2_chroma_h = 0,
1296 .comp = {
1297 { 0, 8, 4, 0, 16 }, /* R */
1298 { 0, 8, 2, 0, 16 }, /* G */
1299 { 0, 8, 0, 0, 16 }, /* B */
1300 { 0, 8, 6, 0, 16 }, /* A */
1301 },
1302 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1303 },
1304 [AV_PIX_FMT_BGRA64LE] = {
1305 .name = "bgra64le",
1306 .nb_components = 4,
1307 .log2_chroma_w = 0,
1308 .log2_chroma_h = 0,
1309 .comp = {
1310 { 0, 8, 4, 0, 16 }, /* R */
1311 { 0, 8, 2, 0, 16 }, /* G */
1312 { 0, 8, 0, 0, 16 }, /* B */
1313 { 0, 8, 6, 0, 16 }, /* A */
1314 },
1315 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1316 },
1317 [AV_PIX_FMT_BGR565BE] = {
1318 .name = "bgr565be",
1319 .nb_components = 3,
1320 .log2_chroma_w = 0,
1321 .log2_chroma_h = 0,
1322 .comp = {
1323 { 0, 2, 0, 0, 5 }, /* R */
1324 { 0, 2, 0, 5, 6 }, /* G */
1325 { 0, 2, -1, 3, 5 }, /* B */
1326 },
1327 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1328 },
1329 [AV_PIX_FMT_BGR565LE] = {
1330 .name = "bgr565le",
1331 .nb_components = 3,
1332 .log2_chroma_w = 0,
1333 .log2_chroma_h = 0,
1334 .comp = {
1335 { 0, 2, 0, 0, 5 }, /* R */
1336 { 0, 2, 0, 5, 6 }, /* G */
1337 { 0, 2, 1, 3, 5 }, /* B */
1338 },
1339 .flags = AV_PIX_FMT_FLAG_RGB,
1340 },
1341 [AV_PIX_FMT_BGR555BE] = {
1342 .name = "bgr555be",
1343 .nb_components = 3,
1344 .log2_chroma_w = 0,
1345 .log2_chroma_h = 0,
1346 .comp = {
1347 { 0, 2, 0, 0, 5 }, /* R */
1348 { 0, 2, 0, 5, 5 }, /* G */
1349 { 0, 2, -1, 2, 5 }, /* B */
1350 },
1351 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1352 },
1353 [AV_PIX_FMT_BGR555LE] = {
1354 .name = "bgr555le",
1355 .nb_components = 3,
1356 .log2_chroma_w = 0,
1357 .log2_chroma_h = 0,
1358 .comp = {
1359 { 0, 2, 0, 0, 5 }, /* R */
1360 { 0, 2, 0, 5, 5 }, /* G */
1361 { 0, 2, 1, 2, 5 }, /* B */
1362 },
1363 .flags = AV_PIX_FMT_FLAG_RGB,
1364 },
1365 [AV_PIX_FMT_BGR444BE] = {
1366 .name = "bgr444be",
1367 .nb_components = 3,
1368 .log2_chroma_w = 0,
1369 .log2_chroma_h = 0,
1370 .comp = {
1371 { 0, 2, 0, 0, 4 }, /* R */
1372 { 0, 2, 0, 4, 4 }, /* G */
1373 { 0, 2, -1, 0, 4 }, /* B */
1374 },
1375 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
1376 },
1377 [AV_PIX_FMT_BGR444LE] = {
1378 .name = "bgr444le",
1379 .nb_components = 3,
1380 .log2_chroma_w = 0,
1381 .log2_chroma_h = 0,
1382 .comp = {
1383 { 0, 2, 0, 0, 4 }, /* R */
1384 { 0, 2, 0, 4, 4 }, /* G */
1385 { 0, 2, 1, 0, 4 }, /* B */
1386 },
1387 .flags = AV_PIX_FMT_FLAG_RGB,
1388 },
1389 [AV_PIX_FMT_VAAPI] = {
1390 .name = "vaapi",
1391 .log2_chroma_w = 1,
1392 .log2_chroma_h = 1,
1393 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1394 },
1395 [AV_PIX_FMT_YUV420P9LE] = {
1396 .name = "yuv420p9le",
1397 .nb_components = 3,
1398 .log2_chroma_w = 1,
1399 .log2_chroma_h = 1,
1400 .comp = {
1401 { 0, 2, 0, 0, 9 }, /* Y */
1402 { 1, 2, 0, 0, 9 }, /* U */
1403 { 2, 2, 0, 0, 9 }, /* V */
1404 },
1405 .flags = AV_PIX_FMT_FLAG_PLANAR,
1406 },
1407 [AV_PIX_FMT_YUV420P9BE] = {
1408 .name = "yuv420p9be",
1409 .nb_components = 3,
1410 .log2_chroma_w = 1,
1411 .log2_chroma_h = 1,
1412 .comp = {
1413 { 0, 2, 0, 0, 9 }, /* Y */
1414 { 1, 2, 0, 0, 9 }, /* U */
1415 { 2, 2, 0, 0, 9 }, /* V */
1416 },
1417 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1418 },
1419 [AV_PIX_FMT_YUV420P10LE] = {
1420 .name = "yuv420p10le",
1421 .nb_components = 3,
1422 .log2_chroma_w = 1,
1423 .log2_chroma_h = 1,
1424 .comp = {
1425 { 0, 2, 0, 0, 10 }, /* Y */
1426 { 1, 2, 0, 0, 10 }, /* U */
1427 { 2, 2, 0, 0, 10 }, /* V */
1428 },
1429 .flags = AV_PIX_FMT_FLAG_PLANAR,
1430 },
1431 [AV_PIX_FMT_YUV420P10BE] = {
1432 .name = "yuv420p10be",
1433 .nb_components = 3,
1434 .log2_chroma_w = 1,
1435 .log2_chroma_h = 1,
1436 .comp = {
1437 { 0, 2, 0, 0, 10 }, /* Y */
1438 { 1, 2, 0, 0, 10 }, /* U */
1439 { 2, 2, 0, 0, 10 }, /* V */
1440 },
1441 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1442 },
1443 [AV_PIX_FMT_YUV420P12LE] = {
1444 .name = "yuv420p12le",
1445 .nb_components = 3,
1446 .log2_chroma_w = 1,
1447 .log2_chroma_h = 1,
1448 .comp = {
1449 { 0, 2, 0, 0, 12 }, /* Y */
1450 { 1, 2, 0, 0, 12 }, /* U */
1451 { 2, 2, 0, 0, 12 }, /* V */
1452 },
1453 .flags = AV_PIX_FMT_FLAG_PLANAR,
1454 },
1455 [AV_PIX_FMT_YUV420P12BE] = {
1456 .name = "yuv420p12be",
1457 .nb_components = 3,
1458 .log2_chroma_w = 1,
1459 .log2_chroma_h = 1,
1460 .comp = {
1461 { 0, 2, 0, 0, 12 }, /* Y */
1462 { 1, 2, 0, 0, 12 }, /* U */
1463 { 2, 2, 0, 0, 12 }, /* V */
1464 },
1465 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1466 },
1467 [AV_PIX_FMT_YUV420P14LE] = {
1468 .name = "yuv420p14le",
1469 .nb_components = 3,
1470 .log2_chroma_w = 1,
1471 .log2_chroma_h = 1,
1472 .comp = {
1473 { 0, 2, 0, 0, 14 }, /* Y */
1474 { 1, 2, 0, 0, 14 }, /* U */
1475 { 2, 2, 0, 0, 14 }, /* V */
1476 },
1477 .flags = AV_PIX_FMT_FLAG_PLANAR,
1478 },
1479 [AV_PIX_FMT_YUV420P14BE] = {
1480 .name = "yuv420p14be",
1481 .nb_components = 3,
1482 .log2_chroma_w = 1,
1483 .log2_chroma_h = 1,
1484 .comp = {
1485 { 0, 2, 0, 0, 14 }, /* Y */
1486 { 1, 2, 0, 0, 14 }, /* U */
1487 { 2, 2, 0, 0, 14 }, /* V */
1488 },
1489 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1490 },
1491 [AV_PIX_FMT_YUV420P16LE] = {
1492 .name = "yuv420p16le",
1493 .nb_components = 3,
1494 .log2_chroma_w = 1,
1495 .log2_chroma_h = 1,
1496 .comp = {
1497 { 0, 2, 0, 0, 16 }, /* Y */
1498 { 1, 2, 0, 0, 16 }, /* U */
1499 { 2, 2, 0, 0, 16 }, /* V */
1500 },
1501 .flags = AV_PIX_FMT_FLAG_PLANAR,
1502 },
1503 [AV_PIX_FMT_YUV420P16BE] = {
1504 .name = "yuv420p16be",
1505 .nb_components = 3,
1506 .log2_chroma_w = 1,
1507 .log2_chroma_h = 1,
1508 .comp = {
1509 { 0, 2, 0, 0, 16 }, /* Y */
1510 { 1, 2, 0, 0, 16 }, /* U */
1511 { 2, 2, 0, 0, 16 }, /* V */
1512 },
1513 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1514 },
1515 [AV_PIX_FMT_YUV422P9LE] = {
1516 .name = "yuv422p9le",
1517 .nb_components = 3,
1518 .log2_chroma_w = 1,
1519 .log2_chroma_h = 0,
1520 .comp = {
1521 { 0, 2, 0, 0, 9 }, /* Y */
1522 { 1, 2, 0, 0, 9 }, /* U */
1523 { 2, 2, 0, 0, 9 }, /* V */
1524 },
1525 .flags = AV_PIX_FMT_FLAG_PLANAR,
1526 },
1527 [AV_PIX_FMT_YUV422P9BE] = {
1528 .name = "yuv422p9be",
1529 .nb_components = 3,
1530 .log2_chroma_w = 1,
1531 .log2_chroma_h = 0,
1532 .comp = {
1533 { 0, 2, 0, 0, 9 }, /* Y */
1534 { 1, 2, 0, 0, 9 }, /* U */
1535 { 2, 2, 0, 0, 9 }, /* V */
1536 },
1537 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1538 },
1539 [AV_PIX_FMT_YUV422P10LE] = {
1540 .name = "yuv422p10le",
1541 .nb_components = 3,
1542 .log2_chroma_w = 1,
1543 .log2_chroma_h = 0,
1544 .comp = {
1545 { 0, 2, 0, 0, 10 }, /* Y */
1546 { 1, 2, 0, 0, 10 }, /* U */
1547 { 2, 2, 0, 0, 10 }, /* V */
1548 },
1549 .flags = AV_PIX_FMT_FLAG_PLANAR,
1550 },
1551 [AV_PIX_FMT_YUV422P10BE] = {
1552 .name = "yuv422p10be",
1553 .nb_components = 3,
1554 .log2_chroma_w = 1,
1555 .log2_chroma_h = 0,
1556 .comp = {
1557 { 0, 2, 0, 0, 10 }, /* Y */
1558 { 1, 2, 0, 0, 10 }, /* U */
1559 { 2, 2, 0, 0, 10 }, /* V */
1560 },
1561 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1562 },
1563 [AV_PIX_FMT_YUV422P12LE] = {
1564 .name = "yuv422p12le",
1565 .nb_components = 3,
1566 .log2_chroma_w = 1,
1567 .log2_chroma_h = 0,
1568 .comp = {
1569 { 0, 2, 0, 0, 12 }, /* Y */
1570 { 1, 2, 0, 0, 12 }, /* U */
1571 { 2, 2, 0, 0, 12 }, /* V */
1572 },
1573 .flags = AV_PIX_FMT_FLAG_PLANAR,
1574 },
1575 [AV_PIX_FMT_YUV422P12BE] = {
1576 .name = "yuv422p12be",
1577 .nb_components = 3,
1578 .log2_chroma_w = 1,
1579 .log2_chroma_h = 0,
1580 .comp = {
1581 { 0, 2, 0, 0, 12 }, /* Y */
1582 { 1, 2, 0, 0, 12 }, /* U */
1583 { 2, 2, 0, 0, 12 }, /* V */
1584 },
1585 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1586 },
1587 [AV_PIX_FMT_YUV422P14LE] = {
1588 .name = "yuv422p14le",
1589 .nb_components = 3,
1590 .log2_chroma_w = 1,
1591 .log2_chroma_h = 0,
1592 .comp = {
1593 { 0, 2, 0, 0, 14 }, /* Y */
1594 { 1, 2, 0, 0, 14 }, /* U */
1595 { 2, 2, 0, 0, 14 }, /* V */
1596 },
1597 .flags = AV_PIX_FMT_FLAG_PLANAR,
1598 },
1599 [AV_PIX_FMT_YUV422P14BE] = {
1600 .name = "yuv422p14be",
1601 .nb_components = 3,
1602 .log2_chroma_w = 1,
1603 .log2_chroma_h = 0,
1604 .comp = {
1605 { 0, 2, 0, 0, 14 }, /* Y */
1606 { 1, 2, 0, 0, 14 }, /* U */
1607 { 2, 2, 0, 0, 14 }, /* V */
1608 },
1609 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1610 },
1611 [AV_PIX_FMT_YUV422P16LE] = {
1612 .name = "yuv422p16le",
1613 .nb_components = 3,
1614 .log2_chroma_w = 1,
1615 .log2_chroma_h = 0,
1616 .comp = {
1617 { 0, 2, 0, 0, 16 }, /* Y */
1618 { 1, 2, 0, 0, 16 }, /* U */
1619 { 2, 2, 0, 0, 16 }, /* V */
1620 },
1621 .flags = AV_PIX_FMT_FLAG_PLANAR,
1622 },
1623 [AV_PIX_FMT_YUV422P16BE] = {
1624 .name = "yuv422p16be",
1625 .nb_components = 3,
1626 .log2_chroma_w = 1,
1627 .log2_chroma_h = 0,
1628 .comp = {
1629 { 0, 2, 0, 0, 16 }, /* Y */
1630 { 1, 2, 0, 0, 16 }, /* U */
1631 { 2, 2, 0, 0, 16 }, /* V */
1632 },
1633 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1634 },
1635 [AV_PIX_FMT_YUV444P16LE] = {
1636 .name = "yuv444p16le",
1637 .nb_components = 3,
1638 .log2_chroma_w = 0,
1639 .log2_chroma_h = 0,
1640 .comp = {
1641 { 0, 2, 0, 0, 16 }, /* Y */
1642 { 1, 2, 0, 0, 16 }, /* U */
1643 { 2, 2, 0, 0, 16 }, /* V */
1644 },
1645 .flags = AV_PIX_FMT_FLAG_PLANAR,
1646 },
1647 [AV_PIX_FMT_YUV444P16BE] = {
1648 .name = "yuv444p16be",
1649 .nb_components = 3,
1650 .log2_chroma_w = 0,
1651 .log2_chroma_h = 0,
1652 .comp = {
1653 { 0, 2, 0, 0, 16 }, /* Y */
1654 { 1, 2, 0, 0, 16 }, /* U */
1655 { 2, 2, 0, 0, 16 }, /* V */
1656 },
1657 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1658 },
1659 [AV_PIX_FMT_YUV444P10LE] = {
1660 .name = "yuv444p10le",
1661 .nb_components = 3,
1662 .log2_chroma_w = 0,
1663 .log2_chroma_h = 0,
1664 .comp = {
1665 { 0, 2, 0, 0, 10 }, /* Y */
1666 { 1, 2, 0, 0, 10 }, /* U */
1667 { 2, 2, 0, 0, 10 }, /* V */
1668 },
1669 .flags = AV_PIX_FMT_FLAG_PLANAR,
1670 },
1671 [AV_PIX_FMT_YUV444P10BE] = {
1672 .name = "yuv444p10be",
1673 .nb_components = 3,
1674 .log2_chroma_w = 0,
1675 .log2_chroma_h = 0,
1676 .comp = {
1677 { 0, 2, 0, 0, 10 }, /* Y */
1678 { 1, 2, 0, 0, 10 }, /* U */
1679 { 2, 2, 0, 0, 10 }, /* V */
1680 },
1681 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1682 },
1683 [AV_PIX_FMT_YUV444P9LE] = {
1684 .name = "yuv444p9le",
1685 .nb_components = 3,
1686 .log2_chroma_w = 0,
1687 .log2_chroma_h = 0,
1688 .comp = {
1689 { 0, 2, 0, 0, 9 }, /* Y */
1690 { 1, 2, 0, 0, 9 }, /* U */
1691 { 2, 2, 0, 0, 9 }, /* V */
1692 },
1693 .flags = AV_PIX_FMT_FLAG_PLANAR,
1694 },
1695 [AV_PIX_FMT_YUV444P9BE] = {
1696 .name = "yuv444p9be",
1697 .nb_components = 3,
1698 .log2_chroma_w = 0,
1699 .log2_chroma_h = 0,
1700 .comp = {
1701 { 0, 2, 0, 0, 9 }, /* Y */
1702 { 1, 2, 0, 0, 9 }, /* U */
1703 { 2, 2, 0, 0, 9 }, /* V */
1704 },
1705 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1706 },
1707 [AV_PIX_FMT_YUV444P12LE] = {
1708 .name = "yuv444p12le",
1709 .nb_components = 3,
1710 .log2_chroma_w = 0,
1711 .log2_chroma_h = 0,
1712 .comp = {
1713 { 0, 2, 0, 0, 12 }, /* Y */
1714 { 1, 2, 0, 0, 12 }, /* U */
1715 { 2, 2, 0, 0, 12 }, /* V */
1716 },
1717 .flags = AV_PIX_FMT_FLAG_PLANAR,
1718 },
1719 [AV_PIX_FMT_YUV444P12BE] = {
1720 .name = "yuv444p12be",
1721 .nb_components = 3,
1722 .log2_chroma_w = 0,
1723 .log2_chroma_h = 0,
1724 .comp = {
1725 { 0, 2, 0, 0, 12 }, /* Y */
1726 { 1, 2, 0, 0, 12 }, /* U */
1727 { 2, 2, 0, 0, 12 }, /* V */
1728 },
1729 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1730 },
1731 [AV_PIX_FMT_YUV444P14LE] = {
1732 .name = "yuv444p14le",
1733 .nb_components = 3,
1734 .log2_chroma_w = 0,
1735 .log2_chroma_h = 0,
1736 .comp = {
1737 { 0, 2, 0, 0, 14 }, /* Y */
1738 { 1, 2, 0, 0, 14 }, /* U */
1739 { 2, 2, 0, 0, 14 }, /* V */
1740 },
1741 .flags = AV_PIX_FMT_FLAG_PLANAR,
1742 },
1743 [AV_PIX_FMT_YUV444P14BE] = {
1744 .name = "yuv444p14be",
1745 .nb_components = 3,
1746 .log2_chroma_w = 0,
1747 .log2_chroma_h = 0,
1748 .comp = {
1749 { 0, 2, 0, 0, 14 }, /* Y */
1750 { 1, 2, 0, 0, 14 }, /* U */
1751 { 2, 2, 0, 0, 14 }, /* V */
1752 },
1753 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
1754 },
1755 [AV_PIX_FMT_D3D11VA_VLD] = {
1756 .name = "d3d11va_vld",
1757 .log2_chroma_w = 1,
1758 .log2_chroma_h = 1,
1759 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1760 },
1761 [AV_PIX_FMT_DXVA2_VLD] = {
1762 .name = "dxva2_vld",
1763 .log2_chroma_w = 1,
1764 .log2_chroma_h = 1,
1765 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1766 },
1767 [AV_PIX_FMT_YA8] = {
1768 .name = "ya8",
1769 .nb_components = 2,
1770 .comp = {
1771 { 0, 2, 0, 0, 8 }, /* Y */
1772 { 0, 2, 1, 0, 8 }, /* A */
1773 },
1774 .flags = AV_PIX_FMT_FLAG_ALPHA,
1775 .alias = "gray8a",
1776 },
1777 [AV_PIX_FMT_YA16LE] = {
1778 .name = "ya16le",
1779 .nb_components = 2,
1780 .comp = {
1781 { 0, 4, 0, 0, 16 }, /* Y */
1782 { 0, 4, 2, 0, 16 }, /* A */
1783 },
1784 .flags = AV_PIX_FMT_FLAG_ALPHA,
1785 },
1786 [AV_PIX_FMT_YA16BE] = {
1787 .name = "ya16be",
1788 .nb_components = 2,
1789 .comp = {
1790 { 0, 4, 0, 0, 16 }, /* Y */
1791 { 0, 4, 2, 0, 16 }, /* A */
1792 },
1793 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
1794 },
1795 [AV_PIX_FMT_VIDEOTOOLBOX] = {
1796 .name = "videotoolbox_vld",
1797 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1798 },
1799 [AV_PIX_FMT_GBRP] = {
1800 .name = "gbrp",
1801 .nb_components = 3,
1802 .log2_chroma_w = 0,
1803 .log2_chroma_h = 0,
1804 .comp = {
1805 { 2, 1, 0, 0, 8 }, /* R */
1806 { 0, 1, 0, 0, 8 }, /* G */
1807 { 1, 1, 0, 0, 8 }, /* B */
1808 },
1809 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1810 },
1811 [AV_PIX_FMT_GBRP9LE] = {
1812 .name = "gbrp9le",
1813 .nb_components = 3,
1814 .log2_chroma_w = 0,
1815 .log2_chroma_h = 0,
1816 .comp = {
1817 { 2, 2, 0, 0, 9 }, /* R */
1818 { 0, 2, 0, 0, 9 }, /* G */
1819 { 1, 2, 0, 0, 9 }, /* B */
1820 },
1821 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1822 },
1823 [AV_PIX_FMT_GBRP9BE] = {
1824 .name = "gbrp9be",
1825 .nb_components = 3,
1826 .log2_chroma_w = 0,
1827 .log2_chroma_h = 0,
1828 .comp = {
1829 { 2, 2, 0, 0, 9 }, /* R */
1830 { 0, 2, 0, 0, 9 }, /* G */
1831 { 1, 2, 0, 0, 9 }, /* B */
1832 },
1833 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1834 },
1835 [AV_PIX_FMT_GBRP10LE] = {
1836 .name = "gbrp10le",
1837 .nb_components = 3,
1838 .log2_chroma_w = 0,
1839 .log2_chroma_h = 0,
1840 .comp = {
1841 { 2, 2, 0, 0, 10 }, /* R */
1842 { 0, 2, 0, 0, 10 }, /* G */
1843 { 1, 2, 0, 0, 10 }, /* B */
1844 },
1845 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1846 },
1847 [AV_PIX_FMT_GBRP10BE] = {
1848 .name = "gbrp10be",
1849 .nb_components = 3,
1850 .log2_chroma_w = 0,
1851 .log2_chroma_h = 0,
1852 .comp = {
1853 { 2, 2, 0, 0, 10 }, /* R */
1854 { 0, 2, 0, 0, 10 }, /* G */
1855 { 1, 2, 0, 0, 10 }, /* B */
1856 },
1857 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1858 },
1859 [AV_PIX_FMT_GBRP12LE] = {
1860 .name = "gbrp12le",
1861 .nb_components = 3,
1862 .log2_chroma_w = 0,
1863 .log2_chroma_h = 0,
1864 .comp = {
1865 { 2, 2, 0, 0, 12 }, /* R */
1866 { 0, 2, 0, 0, 12 }, /* G */
1867 { 1, 2, 0, 0, 12 }, /* B */
1868 },
1869 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1870 },
1871 [AV_PIX_FMT_GBRP12BE] = {
1872 .name = "gbrp12be",
1873 .nb_components = 3,
1874 .log2_chroma_w = 0,
1875 .log2_chroma_h = 0,
1876 .comp = {
1877 { 2, 2, 0, 0, 12 }, /* R */
1878 { 0, 2, 0, 0, 12 }, /* G */
1879 { 1, 2, 0, 0, 12 }, /* B */
1880 },
1881 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1882 },
1883 [AV_PIX_FMT_GBRP14LE] = {
1884 .name = "gbrp14le",
1885 .nb_components = 3,
1886 .log2_chroma_w = 0,
1887 .log2_chroma_h = 0,
1888 .comp = {
1889 { 2, 2, 0, 0, 14 }, /* R */
1890 { 0, 2, 0, 0, 14 }, /* G */
1891 { 1, 2, 0, 0, 14 }, /* B */
1892 },
1893 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1894 },
1895 [AV_PIX_FMT_GBRP14BE] = {
1896 .name = "gbrp14be",
1897 .nb_components = 3,
1898 .log2_chroma_w = 0,
1899 .log2_chroma_h = 0,
1900 .comp = {
1901 { 2, 2, 0, 0, 14 }, /* R */
1902 { 0, 2, 0, 0, 14 }, /* G */
1903 { 1, 2, 0, 0, 14 }, /* B */
1904 },
1905 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1906 },
1907 [AV_PIX_FMT_GBRP16LE] = {
1908 .name = "gbrp16le",
1909 .nb_components = 3,
1910 .log2_chroma_w = 0,
1911 .log2_chroma_h = 0,
1912 .comp = {
1913 { 2, 2, 0, 0, 16 }, /* R */
1914 { 0, 2, 0, 0, 16 }, /* G */
1915 { 1, 2, 0, 0, 16 }, /* B */
1916 },
1917 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1918 },
1919 [AV_PIX_FMT_GBRP16BE] = {
1920 .name = "gbrp16be",
1921 .nb_components = 3,
1922 .log2_chroma_w = 0,
1923 .log2_chroma_h = 0,
1924 .comp = {
1925 { 2, 2, 0, 0, 16 }, /* R */
1926 { 0, 2, 0, 0, 16 }, /* G */
1927 { 1, 2, 0, 0, 16 }, /* B */
1928 },
1929 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
1930 },
1931 [AV_PIX_FMT_GBRAP] = {
1932 .name = "gbrap",
1933 .nb_components = 4,
1934 .log2_chroma_w = 0,
1935 .log2_chroma_h = 0,
1936 .comp = {
1937 { 2, 1, 0, 0, 8 }, /* R */
1938 { 0, 1, 0, 0, 8 }, /* G */
1939 { 1, 1, 0, 0, 8 }, /* B */
1940 { 3, 1, 0, 0, 8 }, /* A */
1941 },
1942 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1943 AV_PIX_FMT_FLAG_ALPHA,
1944 },
1945 [AV_PIX_FMT_GBRAP16LE] = {
1946 .name = "gbrap16le",
1947 .nb_components = 4,
1948 .log2_chroma_w = 0,
1949 .log2_chroma_h = 0,
1950 .comp = {
1951 { 2, 2, 0, 0, 16 }, /* R */
1952 { 0, 2, 0, 0, 16 }, /* G */
1953 { 1, 2, 0, 0, 16 }, /* B */
1954 { 3, 2, 0, 0, 16 }, /* A */
1955 },
1956 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
1957 AV_PIX_FMT_FLAG_ALPHA,
1958 },
1959 [AV_PIX_FMT_GBRAP16BE] = {
1960 .name = "gbrap16be",
1961 .nb_components = 4,
1962 .log2_chroma_w = 0,
1963 .log2_chroma_h = 0,
1964 .comp = {
1965 { 2, 2, 0, 0, 16 }, /* R */
1966 { 0, 2, 0, 0, 16 }, /* G */
1967 { 1, 2, 0, 0, 16 }, /* B */
1968 { 3, 2, 0, 0, 16 }, /* A */
1969 },
1970 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
1971 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
1972 },
1973 [AV_PIX_FMT_VDPAU] = {
1974 .name = "vdpau",
1975 .log2_chroma_w = 1,
1976 .log2_chroma_h = 1,
1977 .flags = AV_PIX_FMT_FLAG_HWACCEL,
1978 },
1979 [AV_PIX_FMT_XYZ12LE] = {
1980 .name = "xyz12le",
1981 .nb_components = 3,
1982 .log2_chroma_w = 0,
1983 .log2_chroma_h = 0,
1984 .comp = {
1985 { 0, 6, 0, 4, 12 }, /* X */
1986 { 0, 6, 2, 4, 12 }, /* Y */
1987 { 0, 6, 4, 4, 12 }, /* Z */
1988 },
1989 .flags = AV_PIX_FMT_FLAG_XYZ,
1990 },
1991 [AV_PIX_FMT_XYZ12BE] = {
1992 .name = "xyz12be",
1993 .nb_components = 3,
1994 .log2_chroma_w = 0,
1995 .log2_chroma_h = 0,
1996 .comp = {
1997 { 0, 6, 0, 4, 12 }, /* X */
1998 { 0, 6, 2, 4, 12 }, /* Y */
1999 { 0, 6, 4, 4, 12 }, /* Z */
2000 },
2001 .flags = AV_PIX_FMT_FLAG_XYZ | AV_PIX_FMT_FLAG_BE,
2002 },
2003
2004 #define BAYER8_DESC_COMMON \
2005 .nb_components= 3, \
2006 .log2_chroma_w= 0, \
2007 .log2_chroma_h= 0, \
2008 .comp = { \
2009 { 0, 1, 0, 0, 2 }, \
2010 { 0, 1, 0, 0, 4 }, \
2011 { 0, 1, 0, 0, 2 }, \
2012 }, \
2013
2014 #define BAYER16_DESC_COMMON \
2015 .nb_components= 3, \
2016 .log2_chroma_w= 0, \
2017 .log2_chroma_h= 0, \
2018 .comp = { \
2019 { 0, 2, 0, 0, 4 }, \
2020 { 0, 2, 0, 0, 8 }, \
2021 { 0, 2, 0, 0, 4 }, \
2022 }, \
2023
2024 [AV_PIX_FMT_BAYER_BGGR8] = {
2025 .name = "bayer_bggr8",
2026 BAYER8_DESC_COMMON
2027 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2028 },
2029 [AV_PIX_FMT_BAYER_BGGR16LE] = {
2030 .name = "bayer_bggr16le",
2031 BAYER16_DESC_COMMON
2032 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2033 },
2034 [AV_PIX_FMT_BAYER_BGGR16BE] = {
2035 .name = "bayer_bggr16be",
2036 BAYER16_DESC_COMMON
2037 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2038 },
2039 [AV_PIX_FMT_BAYER_RGGB8] = {
2040 .name = "bayer_rggb8",
2041 BAYER8_DESC_COMMON
2042 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2043 },
2044 [AV_PIX_FMT_BAYER_RGGB16LE] = {
2045 .name = "bayer_rggb16le",
2046 BAYER16_DESC_COMMON
2047 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2048 },
2049 [AV_PIX_FMT_BAYER_RGGB16BE] = {
2050 .name = "bayer_rggb16be",
2051 BAYER16_DESC_COMMON
2052 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2053 },
2054 [AV_PIX_FMT_BAYER_GBRG8] = {
2055 .name = "bayer_gbrg8",
2056 BAYER8_DESC_COMMON
2057 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2058 },
2059 [AV_PIX_FMT_BAYER_GBRG16LE] = {
2060 .name = "bayer_gbrg16le",
2061 BAYER16_DESC_COMMON
2062 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2063 },
2064 [AV_PIX_FMT_BAYER_GBRG16BE] = {
2065 .name = "bayer_gbrg16be",
2066 BAYER16_DESC_COMMON
2067 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2068 },
2069 [AV_PIX_FMT_BAYER_GRBG8] = {
2070 .name = "bayer_grbg8",
2071 BAYER8_DESC_COMMON
2072 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2073 },
2074 [AV_PIX_FMT_BAYER_GRBG16LE] = {
2075 .name = "bayer_grbg16le",
2076 BAYER16_DESC_COMMON
2077 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2078 },
2079 [AV_PIX_FMT_BAYER_GRBG16BE] = {
2080 .name = "bayer_grbg16be",
2081 BAYER16_DESC_COMMON
2082 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
2083 },
2084 [AV_PIX_FMT_NV16] = {
2085 .name = "nv16",
2086 .nb_components = 3,
2087 .log2_chroma_w = 1,
2088 .log2_chroma_h = 0,
2089 .comp = {
2090 { 0, 1, 0, 0, 8 }, /* Y */
2091 { 1, 2, 0, 0, 8 }, /* U */
2092 { 1, 2, 1, 0, 8 }, /* V */
2093 },
2094 .flags = AV_PIX_FMT_FLAG_PLANAR,
2095 },
2096 [AV_PIX_FMT_NV20LE] = {
2097 .name = "nv20le",
2098 .nb_components = 3,
2099 .log2_chroma_w = 1,
2100 .log2_chroma_h = 0,
2101 .comp = {
2102 { 0, 2, 0, 0, 10 }, /* Y */
2103 { 1, 4, 0, 0, 10 }, /* U */
2104 { 1, 4, 2, 0, 10 }, /* V */
2105 },
2106 .flags = AV_PIX_FMT_FLAG_PLANAR,
2107 },
2108 [AV_PIX_FMT_NV20BE] = {
2109 .name = "nv20be",
2110 .nb_components = 3,
2111 .log2_chroma_w = 1,
2112 .log2_chroma_h = 0,
2113 .comp = {
2114 { 0, 2, 0, 0, 10 }, /* Y */
2115 { 1, 4, 0, 0, 10 }, /* U */
2116 { 1, 4, 2, 0, 10 }, /* V */
2117 },
2118 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2119 },
2120 [AV_PIX_FMT_QSV] = {
2121 .name = "qsv",
2122 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2123 },
2124 [AV_PIX_FMT_MEDIACODEC] = {
2125 .name = "mediacodec",
2126 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2127 },
2128 [AV_PIX_FMT_MMAL] = {
2129 .name = "mmal",
2130 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2131 },
2132 [AV_PIX_FMT_CUDA] = {
2133 .name = "cuda",
2134 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2135 },
2136 [AV_PIX_FMT_VYU444] = {
2137 .name = "vyu444",
2138 .nb_components = 3,
2139 .log2_chroma_w = 0,
2140 .log2_chroma_h = 0,
2141 .comp = {
2142 { 0, 3, 1, 0, 8 }, /* Y */
2143 { 0, 3, 2, 0, 8 }, /* U */
2144 { 0, 3, 0, 0, 8 }, /* V */
2145 },
2146 },
2147 [AV_PIX_FMT_UYVA] = {
2148 .name = "uyva",
2149 .nb_components = 4,
2150 .log2_chroma_w = 0,
2151 .log2_chroma_h = 0,
2152 .comp = {
2153 { 0, 4, 1, 0, 8 }, /* Y */
2154 { 0, 4, 0, 0, 8 }, /* U */
2155 { 0, 4, 2, 0, 8 }, /* V */
2156 { 0, 4, 3, 0, 8 }, /* A */
2157 },
2158 .flags = AV_PIX_FMT_FLAG_ALPHA,
2159 },
2160 [AV_PIX_FMT_AYUV] = {
2161 .name = "ayuv",
2162 .nb_components = 4,
2163 .log2_chroma_w = 0,
2164 .log2_chroma_h = 0,
2165 .comp = {
2166 { 0, 4, 1, 0, 8 }, /* Y */
2167 { 0, 4, 2, 0, 8 }, /* U */
2168 { 0, 4, 3, 0, 8 }, /* V */
2169 { 0, 4, 0, 0, 8 }, /* A */
2170 },
2171 .flags = AV_PIX_FMT_FLAG_ALPHA,
2172 },
2173 [AV_PIX_FMT_AYUV64LE] = {
2174 .name = "ayuv64le",
2175 .nb_components = 4,
2176 .log2_chroma_w = 0,
2177 .log2_chroma_h = 0,
2178 .comp = {
2179 { 0, 8, 2, 0, 16 }, /* Y */
2180 { 0, 8, 4, 0, 16 }, /* U */
2181 { 0, 8, 6, 0, 16 }, /* V */
2182 { 0, 8, 0, 0, 16 }, /* A */
2183 },
2184 .flags = AV_PIX_FMT_FLAG_ALPHA,
2185 },
2186 [AV_PIX_FMT_AYUV64BE] = {
2187 .name = "ayuv64be",
2188 .nb_components = 4,
2189 .log2_chroma_w = 0,
2190 .log2_chroma_h = 0,
2191 .comp = {
2192 { 0, 8, 2, 0, 16 }, /* Y */
2193 { 0, 8, 4, 0, 16 }, /* U */
2194 { 0, 8, 6, 0, 16 }, /* V */
2195 { 0, 8, 0, 0, 16 }, /* A */
2196 },
2197 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
2198 },
2199 [AV_PIX_FMT_P010LE] = {
2200 .name = "p010le",
2201 .nb_components = 3,
2202 .log2_chroma_w = 1,
2203 .log2_chroma_h = 1,
2204 .comp = {
2205 { 0, 2, 0, 6, 10 }, /* Y */
2206 { 1, 4, 0, 6, 10 }, /* U */
2207 { 1, 4, 2, 6, 10 }, /* V */
2208 },
2209 .flags = AV_PIX_FMT_FLAG_PLANAR,
2210 },
2211 [AV_PIX_FMT_P010BE] = {
2212 .name = "p010be",
2213 .nb_components = 3,
2214 .log2_chroma_w = 1,
2215 .log2_chroma_h = 1,
2216 .comp = {
2217 { 0, 2, 0, 6, 10 }, /* Y */
2218 { 1, 4, 0, 6, 10 }, /* U */
2219 { 1, 4, 2, 6, 10 }, /* V */
2220 },
2221 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2222 },
2223 [AV_PIX_FMT_P012LE] = {
2224 .name = "p012le",
2225 .nb_components = 3,
2226 .log2_chroma_w = 1,
2227 .log2_chroma_h = 1,
2228 .comp = {
2229 { 0, 2, 0, 4, 12 }, /* Y */
2230 { 1, 4, 0, 4, 12 }, /* U */
2231 { 1, 4, 2, 4, 12 }, /* V */
2232 },
2233 .flags = AV_PIX_FMT_FLAG_PLANAR,
2234 },
2235 [AV_PIX_FMT_P012BE] = {
2236 .name = "p012be",
2237 .nb_components = 3,
2238 .log2_chroma_w = 1,
2239 .log2_chroma_h = 1,
2240 .comp = {
2241 { 0, 2, 0, 4, 12 }, /* Y */
2242 { 1, 4, 0, 4, 12 }, /* U */
2243 { 1, 4, 2, 4, 12 }, /* V */
2244 },
2245 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2246 },
2247 [AV_PIX_FMT_P016LE] = {
2248 .name = "p016le",
2249 .nb_components = 3,
2250 .log2_chroma_w = 1,
2251 .log2_chroma_h = 1,
2252 .comp = {
2253 { 0, 2, 0, 0, 16 }, /* Y */
2254 { 1, 4, 0, 0, 16 }, /* U */
2255 { 1, 4, 2, 0, 16 }, /* V */
2256 },
2257 .flags = AV_PIX_FMT_FLAG_PLANAR,
2258 },
2259 [AV_PIX_FMT_P016BE] = {
2260 .name = "p016be",
2261 .nb_components = 3,
2262 .log2_chroma_w = 1,
2263 .log2_chroma_h = 1,
2264 .comp = {
2265 { 0, 2, 0, 0, 16 }, /* Y */
2266 { 1, 4, 0, 0, 16 }, /* U */
2267 { 1, 4, 2, 0, 16 }, /* V */
2268 },
2269 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2270 },
2271 [AV_PIX_FMT_GBRAP14LE] = {
2272 .name = "gbrap14le",
2273 .nb_components = 4,
2274 .log2_chroma_w = 0,
2275 .log2_chroma_h = 0,
2276 .comp = {
2277 { 2, 2, 0, 0, 14 }, /* R */
2278 { 0, 2, 0, 0, 14 }, /* G */
2279 { 1, 2, 0, 0, 14 }, /* B */
2280 { 3, 2, 0, 0, 14 }, /* A */
2281 },
2282 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2283 AV_PIX_FMT_FLAG_ALPHA,
2284 },
2285 [AV_PIX_FMT_GBRAP14BE] = {
2286 .name = "gbrap14be",
2287 .nb_components = 4,
2288 .log2_chroma_w = 0,
2289 .log2_chroma_h = 0,
2290 .comp = {
2291 { 2, 2, 0, 0, 14 }, /* R */
2292 { 0, 2, 0, 0, 14 }, /* G */
2293 { 1, 2, 0, 0, 14 }, /* B */
2294 { 3, 2, 0, 0, 14 }, /* A */
2295 },
2296 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2297 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2298 },
2299 [AV_PIX_FMT_GBRAP12LE] = {
2300 .name = "gbrap12le",
2301 .nb_components = 4,
2302 .log2_chroma_w = 0,
2303 .log2_chroma_h = 0,
2304 .comp = {
2305 { 2, 2, 0, 0, 12 }, /* R */
2306 { 0, 2, 0, 0, 12 }, /* G */
2307 { 1, 2, 0, 0, 12 }, /* B */
2308 { 3, 2, 0, 0, 12 }, /* A */
2309 },
2310 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2311 AV_PIX_FMT_FLAG_ALPHA,
2312 },
2313 [AV_PIX_FMT_GBRAP12BE] = {
2314 .name = "gbrap12be",
2315 .nb_components = 4,
2316 .log2_chroma_w = 0,
2317 .log2_chroma_h = 0,
2318 .comp = {
2319 { 2, 2, 0, 0, 12 }, /* R */
2320 { 0, 2, 0, 0, 12 }, /* G */
2321 { 1, 2, 0, 0, 12 }, /* B */
2322 { 3, 2, 0, 0, 12 }, /* A */
2323 },
2324 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2325 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2326 },
2327 [AV_PIX_FMT_GBRAP10LE] = {
2328 .name = "gbrap10le",
2329 .nb_components = 4,
2330 .log2_chroma_w = 0,
2331 .log2_chroma_h = 0,
2332 .comp = {
2333 { 2, 2, 0, 0, 10 }, /* R */
2334 { 0, 2, 0, 0, 10 }, /* G */
2335 { 1, 2, 0, 0, 10 }, /* B */
2336 { 3, 2, 0, 0, 10 }, /* A */
2337 },
2338 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
2339 AV_PIX_FMT_FLAG_ALPHA,
2340 },
2341 [AV_PIX_FMT_GBRAP10BE] = {
2342 .name = "gbrap10be",
2343 .nb_components = 4,
2344 .log2_chroma_w = 0,
2345 .log2_chroma_h = 0,
2346 .comp = {
2347 { 2, 2, 0, 0, 10 }, /* R */
2348 { 0, 2, 0, 0, 10 }, /* G */
2349 { 1, 2, 0, 0, 10 }, /* B */
2350 { 3, 2, 0, 0, 10 }, /* A */
2351 },
2352 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2353 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2354 },
2355 [AV_PIX_FMT_D3D11] = {
2356 .name = "d3d11",
2357 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2358 },
2359 [AV_PIX_FMT_D3D12] = {
2360 .name = "d3d12",
2361 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2362 },
2363 [AV_PIX_FMT_GBRPF32BE] = {
2364 .name = "gbrpf32be",
2365 .nb_components = 3,
2366 .log2_chroma_w = 0,
2367 .log2_chroma_h = 0,
2368 .comp = {
2369 { 2, 4, 0, 0, 32 }, /* R */
2370 { 0, 4, 0, 0, 32 }, /* G */
2371 { 1, 4, 0, 0, 32 }, /* B */
2372 },
2373 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2374 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
2375 },
2376 [AV_PIX_FMT_GBRPF32LE] = {
2377 .name = "gbrpf32le",
2378 .nb_components = 3,
2379 .log2_chroma_w = 0,
2380 .log2_chroma_h = 0,
2381 .comp = {
2382 { 2, 4, 0, 0, 32 }, /* R */
2383 { 0, 4, 0, 0, 32 }, /* G */
2384 { 1, 4, 0, 0, 32 }, /* B */
2385 },
2386 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_RGB,
2387 },
2388 [AV_PIX_FMT_GBRAPF32BE] = {
2389 .name = "gbrapf32be",
2390 .nb_components = 4,
2391 .log2_chroma_w = 0,
2392 .log2_chroma_h = 0,
2393 .comp = {
2394 { 2, 4, 0, 0, 32 }, /* R */
2395 { 0, 4, 0, 0, 32 }, /* G */
2396 { 1, 4, 0, 0, 32 }, /* B */
2397 { 3, 4, 0, 0, 32 }, /* A */
2398 },
2399 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
2400 AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_RGB |
2401 AV_PIX_FMT_FLAG_FLOAT,
2402 },
2403 [AV_PIX_FMT_GBRAPF32LE] = {
2404 .name = "gbrapf32le",
2405 .nb_components = 4,
2406 .log2_chroma_w = 0,
2407 .log2_chroma_h = 0,
2408 .comp = {
2409 { 2, 4, 0, 0, 32 }, /* R */
2410 { 0, 4, 0, 0, 32 }, /* G */
2411 { 1, 4, 0, 0, 32 }, /* B */
2412 { 3, 4, 0, 0, 32 }, /* A */
2413 },
2414 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA |
2415 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
2416 },
2417 [AV_PIX_FMT_DRM_PRIME] = {
2418 .name = "drm_prime",
2419 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2420 },
2421 [AV_PIX_FMT_OPENCL] = {
2422 .name = "opencl",
2423 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2424 },
2425 [AV_PIX_FMT_GRAYF32BE] = {
2426 .name = "grayf32be",
2427 .nb_components = 1,
2428 .log2_chroma_w = 0,
2429 .log2_chroma_h = 0,
2430 .comp = {
2431 { 0, 4, 0, 0, 32 }, /* Y */
2432 },
2433 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_FLOAT,
2434 .alias = "yf32be",
2435 },
2436 [AV_PIX_FMT_GRAYF32LE] = {
2437 .name = "grayf32le",
2438 .nb_components = 1,
2439 .log2_chroma_w = 0,
2440 .log2_chroma_h = 0,
2441 .comp = {
2442 { 0, 4, 0, 0, 32 }, /* Y */
2443 },
2444 .flags = AV_PIX_FMT_FLAG_FLOAT,
2445 .alias = "yf32le",
2446 },
2447 [AV_PIX_FMT_YUVA422P12BE] = {
2448 .name = "yuva422p12be",
2449 .nb_components = 4,
2450 .log2_chroma_w = 1,
2451 .log2_chroma_h = 0,
2452 .comp = {
2453 { 0, 2, 0, 0, 12 }, /* Y */
2454 { 1, 2, 0, 0, 12 }, /* U */
2455 { 2, 2, 0, 0, 12 }, /* V */
2456 { 3, 2, 0, 0, 12 }, /* A */
2457 },
2458 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2459 },
2460 [AV_PIX_FMT_YUVA422P12LE] = {
2461 .name = "yuva422p12le",
2462 .nb_components = 4,
2463 .log2_chroma_w = 1,
2464 .log2_chroma_h = 0,
2465 .comp = {
2466 { 0, 2, 0, 0, 12 }, /* Y */
2467 { 1, 2, 0, 0, 12 }, /* U */
2468 { 2, 2, 0, 0, 12 }, /* V */
2469 { 3, 2, 0, 0, 12 }, /* A */
2470 },
2471 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2472 },
2473 [AV_PIX_FMT_YUVA444P12BE] = {
2474 .name = "yuva444p12be",
2475 .nb_components = 4,
2476 .log2_chroma_w = 0,
2477 .log2_chroma_h = 0,
2478 .comp = {
2479 { 0, 2, 0, 0, 12 }, /* Y */
2480 { 1, 2, 0, 0, 12 }, /* U */
2481 { 2, 2, 0, 0, 12 }, /* V */
2482 { 3, 2, 0, 0, 12 }, /* A */
2483 },
2484 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2485 },
2486 [AV_PIX_FMT_YUVA444P12LE] = {
2487 .name = "yuva444p12le",
2488 .nb_components = 4,
2489 .log2_chroma_w = 0,
2490 .log2_chroma_h = 0,
2491 .comp = {
2492 { 0, 2, 0, 0, 12 }, /* Y */
2493 { 1, 2, 0, 0, 12 }, /* U */
2494 { 2, 2, 0, 0, 12 }, /* V */
2495 { 3, 2, 0, 0, 12 }, /* A */
2496 },
2497 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
2498 },
2499 [AV_PIX_FMT_NV24] = {
2500 .name = "nv24",
2501 .nb_components = 3,
2502 .log2_chroma_w = 0,
2503 .log2_chroma_h = 0,
2504 .comp = {
2505 { 0, 1, 0, 0, 8 }, /* Y */
2506 { 1, 2, 0, 0, 8 }, /* U */
2507 { 1, 2, 1, 0, 8 }, /* V */
2508 },
2509 .flags = AV_PIX_FMT_FLAG_PLANAR,
2510 },
2511 [AV_PIX_FMT_NV42] = {
2512 .name = "nv42",
2513 .nb_components = 3,
2514 .log2_chroma_w = 0,
2515 .log2_chroma_h = 0,
2516 .comp = {
2517 { 0, 1, 0, 0, 8 }, /* Y */
2518 { 1, 2, 1, 0, 8 }, /* U */
2519 { 1, 2, 0, 0, 8 }, /* V */
2520 },
2521 .flags = AV_PIX_FMT_FLAG_PLANAR,
2522 },
2523 [AV_PIX_FMT_VULKAN] = {
2524 .name = "vulkan",
2525 .flags = AV_PIX_FMT_FLAG_HWACCEL,
2526 },
2527 [AV_PIX_FMT_P210BE] = {
2528 .name = "p210be",
2529 .nb_components = 3,
2530 .log2_chroma_w = 1,
2531 .log2_chroma_h = 0,
2532 .comp = {
2533 { 0, 2, 0, 6, 10 }, /* Y */
2534 { 1, 4, 0, 6, 10 }, /* U */
2535 { 1, 4, 2, 6, 10 }, /* V */
2536 },
2537 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2538 },
2539 [AV_PIX_FMT_P210LE] = {
2540 .name = "p210le",
2541 .nb_components = 3,
2542 .log2_chroma_w = 1,
2543 .log2_chroma_h = 0,
2544 .comp = {
2545 { 0, 2, 0, 6, 10 }, /* Y */
2546 { 1, 4, 0, 6, 10 }, /* U */
2547 { 1, 4, 2, 6, 10 }, /* V */
2548 },
2549 .flags = AV_PIX_FMT_FLAG_PLANAR,
2550 },
2551 [AV_PIX_FMT_P410BE] = {
2552 .name = "p410be",
2553 .nb_components = 3,
2554 .log2_chroma_w = 0,
2555 .log2_chroma_h = 0,
2556 .comp = {
2557 { 0, 2, 0, 6, 10 }, /* Y */
2558 { 1, 4, 0, 6, 10 }, /* U */
2559 { 1, 4, 2, 6, 10 }, /* V */
2560 },
2561 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2562 },
2563 [AV_PIX_FMT_P410LE] = {
2564 .name = "p410le",
2565 .nb_components = 3,
2566 .log2_chroma_w = 0,
2567 .log2_chroma_h = 0,
2568 .comp = {
2569 { 0, 2, 0, 6, 10 }, /* Y */
2570 { 1, 4, 0, 6, 10 }, /* U */
2571 { 1, 4, 2, 6, 10 }, /* V */
2572 },
2573 .flags = AV_PIX_FMT_FLAG_PLANAR,
2574 },
2575 [AV_PIX_FMT_P216BE] = {
2576 .name = "p216be",
2577 .nb_components = 3,
2578 .log2_chroma_w = 1,
2579 .log2_chroma_h = 0,
2580 .comp = {
2581 { 0, 2, 0, 0, 16 }, /* Y */
2582 { 1, 4, 0, 0, 16 }, /* U */
2583 { 1, 4, 2, 0, 16 }, /* V */
2584 },
2585 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2586 },
2587 [AV_PIX_FMT_P216LE] = {
2588 .name = "p216le",
2589 .nb_components = 3,
2590 .log2_chroma_w = 1,
2591 .log2_chroma_h = 0,
2592 .comp = {
2593 { 0, 2, 0, 0, 16 }, /* Y */
2594 { 1, 4, 0, 0, 16 }, /* U */
2595 { 1, 4, 2, 0, 16 }, /* V */
2596 },
2597 .flags = AV_PIX_FMT_FLAG_PLANAR,
2598 },
2599 [AV_PIX_FMT_P416BE] = {
2600 .name = "p416be",
2601 .nb_components = 3,
2602 .log2_chroma_w = 0,
2603 .log2_chroma_h = 0,
2604 .comp = {
2605 { 0, 2, 0, 0, 16 }, /* Y */
2606 { 1, 4, 0, 0, 16 }, /* U */
2607 { 1, 4, 2, 0, 16 }, /* V */
2608 },
2609 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2610 },
2611 [AV_PIX_FMT_P416LE] = {
2612 .name = "p416le",
2613 .nb_components = 3,
2614 .log2_chroma_w = 0,
2615 .log2_chroma_h = 0,
2616 .comp = {
2617 { 0, 2, 0, 0, 16 }, /* Y */
2618 { 1, 4, 0, 0, 16 }, /* U */
2619 { 1, 4, 2, 0, 16 }, /* V */
2620 },
2621 .flags = AV_PIX_FMT_FLAG_PLANAR,
2622 },
2623 [AV_PIX_FMT_VUYA] = {
2624 .name = "vuya",
2625 .nb_components = 4,
2626 .log2_chroma_w = 0,
2627 .log2_chroma_h = 0,
2628 .comp = {
2629 { 0, 4, 2, 0, 8 }, /* Y */
2630 { 0, 4, 1, 0, 8 }, /* U */
2631 { 0, 4, 0, 0, 8 }, /* V */
2632 { 0, 4, 3, 0, 8 }, /* A */
2633 },
2634 .flags = AV_PIX_FMT_FLAG_ALPHA,
2635 },
2636 [AV_PIX_FMT_VUYX] = {
2637 .name = "vuyx",
2638 .nb_components = 3,
2639 .log2_chroma_w = 0,
2640 .log2_chroma_h = 0,
2641 .comp = {
2642 { 0, 4, 2, 0, 8 }, /* Y */
2643 { 0, 4, 1, 0, 8 }, /* U */
2644 { 0, 4, 0, 0, 8 }, /* V */
2645 { 0, 4, 3, 0, 8 }, /* X */
2646 },
2647 },
2648 [AV_PIX_FMT_RGBF16BE] = {
2649 .name = "rgbf16be",
2650 .nb_components = 3,
2651 .log2_chroma_w = 0,
2652 .log2_chroma_h = 0,
2653 .comp = {
2654 { 0, 6, 0, 0, 16 }, /* R */
2655 { 0, 6, 2, 0, 16 }, /* G */
2656 { 0, 6, 4, 0, 16 }, /* B */
2657 },
2658 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB |
2659 AV_PIX_FMT_FLAG_FLOAT,
2660 },
2661 [AV_PIX_FMT_RGBF16LE] = {
2662 .name = "rgbf16le",
2663 .nb_components = 3,
2664 .log2_chroma_w = 0,
2665 .log2_chroma_h = 0,
2666 .comp = {
2667 { 0, 6, 0, 0, 16 }, /* R */
2668 { 0, 6, 2, 0, 16 }, /* G */
2669 { 0, 6, 4, 0, 16 }, /* B */
2670 },
2671 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT
2672 },
2673 [AV_PIX_FMT_RGBAF16BE] = {
2674 .name = "rgbaf16be",
2675 .nb_components = 4,
2676 .log2_chroma_w = 0,
2677 .log2_chroma_h = 0,
2678 .comp = {
2679 { 0, 8, 0, 0, 16 }, /* R */
2680 { 0, 8, 2, 0, 16 }, /* G */
2681 { 0, 8, 4, 0, 16 }, /* B */
2682 { 0, 8, 6, 0, 16 }, /* A */
2683 },
2684 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB |
2685 AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_FLOAT,
2686 },
2687 [AV_PIX_FMT_RGBAF16LE] = {
2688 .name = "rgbaf16le",
2689 .nb_components = 4,
2690 .log2_chroma_w = 0,
2691 .log2_chroma_h = 0,
2692 .comp = {
2693 { 0, 8, 0, 0, 16 }, /* R */
2694 { 0, 8, 2, 0, 16 }, /* G */
2695 { 0, 8, 4, 0, 16 }, /* B */
2696 { 0, 8, 6, 0, 16 }, /* A */
2697 },
2698 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA |
2699 AV_PIX_FMT_FLAG_FLOAT,
2700 },
2701 [AV_PIX_FMT_Y212LE] = {
2702 .name = "y212le",
2703 .nb_components = 3,
2704 .log2_chroma_w = 1,
2705 .log2_chroma_h = 0,
2706 .comp = {
2707 { 0, 4, 0, 4, 12 }, /* Y */
2708 { 0, 8, 2, 4, 12 }, /* U */
2709 { 0, 8, 6, 4, 12 }, /* V */
2710 },
2711 },
2712 [AV_PIX_FMT_Y212BE] = {
2713 .name = "y212be",
2714 .nb_components = 3,
2715 .log2_chroma_w = 1,
2716 .log2_chroma_h = 0,
2717 .comp = {
2718 { 0, 4, 0, 4, 12 }, /* Y */
2719 { 0, 8, 2, 4, 12 }, /* U */
2720 { 0, 8, 6, 4, 12 }, /* V */
2721 },
2722 .flags = AV_PIX_FMT_FLAG_BE,
2723 },
2724 [AV_PIX_FMT_XV30LE] = {
2725 .name = "xv30le",
2726 .nb_components= 3,
2727 .log2_chroma_w= 0,
2728 .log2_chroma_h= 0,
2729 .comp = {
2730 { 0, 4, 1, 2, 10 }, /* Y */
2731 { 0, 4, 0, 0, 10 }, /* U */
2732 { 0, 4, 2, 4, 10 }, /* V */
2733 { 0, 4, 3, 6, 2 }, /* X */
2734 },
2735 },
2736 [AV_PIX_FMT_XV30BE] = {
2737 .name = "xv30be",
2738 .nb_components= 3,
2739 .log2_chroma_w= 0,
2740 .log2_chroma_h= 0,
2741 .comp = {
2742 { 0, 32, 10, 0, 10 }, /* Y */
2743 { 0, 32, 0, 0, 10 }, /* U */
2744 { 0, 32, 20, 0, 10 }, /* V */
2745 { 0, 32, 30, 0, 2 }, /* X */
2746 },
2747 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_BITSTREAM,
2748 },
2749 [AV_PIX_FMT_XV36LE] = {
2750 .name = "xv36le",
2751 .nb_components= 3,
2752 .log2_chroma_w= 0,
2753 .log2_chroma_h= 0,
2754 .comp = {
2755 { 0, 8, 2, 4, 12 }, /* Y */
2756 { 0, 8, 0, 4, 12 }, /* U */
2757 { 0, 8, 4, 4, 12 }, /* V */
2758 { 0, 8, 6, 4, 12 }, /* X */
2759 },
2760 },
2761 [AV_PIX_FMT_XV36BE] = {
2762 .name = "xv36be",
2763 .nb_components= 3,
2764 .log2_chroma_w= 0,
2765 .log2_chroma_h= 0,
2766 .comp = {
2767 { 0, 8, 2, 4, 12 }, /* Y */
2768 { 0, 8, 0, 4, 12 }, /* U */
2769 { 0, 8, 4, 4, 12 }, /* V */
2770 { 0, 8, 6, 4, 12 }, /* X */
2771 },
2772 .flags = AV_PIX_FMT_FLAG_BE,
2773 },
2774 [AV_PIX_FMT_XV48LE] = {
2775 .name = "xv48le",
2776 .nb_components = 3,
2777 .log2_chroma_w = 0,
2778 .log2_chroma_h = 0,
2779 .comp = {
2780 { 0, 8, 2, 0, 16 }, /* Y */
2781 { 0, 8, 0, 0, 16 }, /* U */
2782 { 0, 8, 4, 0, 16 }, /* V */
2783 { 0, 8, 6, 0, 16 }, /* X */
2784 },
2785 },
2786 [AV_PIX_FMT_XV48BE] = {
2787 .name = "xv48be",
2788 .nb_components = 3,
2789 .log2_chroma_w = 0,
2790 .log2_chroma_h = 0,
2791 .comp = {
2792 { 0, 8, 2, 0, 16 }, /* Y */
2793 { 0, 8, 0, 0, 16 }, /* U */
2794 { 0, 8, 4, 0, 16 }, /* V */
2795 { 0, 8, 6, 0, 16 }, /* X */
2796 },
2797 .flags = AV_PIX_FMT_FLAG_BE,
2798 },
2799 [AV_PIX_FMT_V30XLE] = {
2800 .name = "v30xle",
2801 .nb_components = 3,
2802 .log2_chroma_w = 0,
2803 .log2_chroma_h = 0,
2804 .comp = {
2805 { 0, 4, 1, 4, 10 }, /* Y */
2806 { 0, 4, 0, 2, 10 }, /* U */
2807 { 0, 4, 2, 6, 10 }, /* V */
2808 { 0, 4, 0, 0, 2 }, /* X */
2809 },
2810 },
2811 [AV_PIX_FMT_V30XBE] = {
2812 .name = "v30xbe",
2813 .nb_components= 3,
2814 .log2_chroma_w= 0,
2815 .log2_chroma_h= 0,
2816 .comp = {
2817 { 0, 32, 12, 0, 10 }, /* Y */
2818 { 0, 32, 2, 0, 10 }, /* U */
2819 { 0, 32, 22, 0, 10 }, /* V */
2820 { 0, 32, 0, 0, 2 }, /* X */
2821 },
2822 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_BITSTREAM,
2823 },
2824 [AV_PIX_FMT_RGBF32BE] = {
2825 .name = "rgbf32be",
2826 .nb_components = 3,
2827 .log2_chroma_w = 0,
2828 .log2_chroma_h = 0,
2829 .comp = {
2830 { 0, 12, 0, 0, 32 }, /* R */
2831 { 0, 12, 4, 0, 32 }, /* G */
2832 { 0, 12, 8, 0, 32 }, /* B */
2833 },
2834 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB |
2835 AV_PIX_FMT_FLAG_FLOAT,
2836 },
2837 [AV_PIX_FMT_RGBF32LE] = {
2838 .name = "rgbf32le",
2839 .nb_components = 3,
2840 .log2_chroma_w = 0,
2841 .log2_chroma_h = 0,
2842 .comp = {
2843 { 0, 12, 0, 0, 32 }, /* R */
2844 { 0, 12, 4, 0, 32 }, /* G */
2845 { 0, 12, 8, 0, 32 }, /* B */
2846 },
2847 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
2848 },
2849 [AV_PIX_FMT_RGB96BE] = {
2850 .name = "rgb96be",
2851 .nb_components = 3,
2852 .log2_chroma_w = 0,
2853 .log2_chroma_h = 0,
2854 .comp = {
2855 { 0, 12, 0, 0, 32 }, /* R */
2856 { 0, 12, 4, 0, 32 }, /* G */
2857 { 0, 12, 8, 0, 32 }, /* B */
2858 },
2859 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
2860 },
2861 [AV_PIX_FMT_RGB96LE] = {
2862 .name = "rgb96le",
2863 .nb_components = 3,
2864 .log2_chroma_w = 0,
2865 .log2_chroma_h = 0,
2866 .comp = {
2867 { 0, 12, 0, 0, 32 }, /* R */
2868 { 0, 12, 4, 0, 32 }, /* G */
2869 { 0, 12, 8, 0, 32 }, /* B */
2870 },
2871 .flags = AV_PIX_FMT_FLAG_RGB,
2872 },
2873 [AV_PIX_FMT_RGBAF32BE] = {
2874 .name = "rgbaf32be",
2875 .nb_components = 4,
2876 .log2_chroma_w = 0,
2877 .log2_chroma_h = 0,
2878 .comp = {
2879 { 0, 16, 0, 0, 32 }, /* R */
2880 { 0, 16, 4, 0, 32 }, /* G */
2881 { 0, 16, 8, 0, 32 }, /* B */
2882 { 0, 16, 12, 0, 32 }, /* A */
2883 },
2884 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB |
2885 AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA,
2886 },
2887 [AV_PIX_FMT_RGBAF32LE] = {
2888 .name = "rgbaf32le",
2889 .nb_components = 4,
2890 .log2_chroma_w = 0,
2891 .log2_chroma_h = 0,
2892 .comp = {
2893 { 0, 16, 0, 0, 32 }, /* R */
2894 { 0, 16, 4, 0, 32 }, /* G */
2895 { 0, 16, 8, 0, 32 }, /* B */
2896 { 0, 16, 12, 0, 32 }, /* A */
2897 },
2898 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT |
2899 AV_PIX_FMT_FLAG_ALPHA,
2900 },
2901 [AV_PIX_FMT_RGBA128BE] = {
2902 .name = "rgba128be",
2903 .nb_components = 4,
2904 .log2_chroma_w = 0,
2905 .log2_chroma_h = 0,
2906 .comp = {
2907 { 0, 16, 0, 0, 32 }, /* R */
2908 { 0, 16, 4, 0, 32 }, /* G */
2909 { 0, 16, 8, 0, 32 }, /* B */
2910 { 0, 16, 12, 0, 32 }, /* A */
2911 },
2912 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB |
2913 AV_PIX_FMT_FLAG_ALPHA,
2914 },
2915 [AV_PIX_FMT_RGBA128LE] = {
2916 .name = "rgba128le",
2917 .nb_components = 4,
2918 .log2_chroma_w = 0,
2919 .log2_chroma_h = 0,
2920 .comp = {
2921 { 0, 16, 0, 0, 32 }, /* R */
2922 { 0, 16, 4, 0, 32 }, /* G */
2923 { 0, 16, 8, 0, 32 }, /* B */
2924 { 0, 16, 12, 0, 32 }, /* A */
2925 },
2926 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
2927 },
2928 [AV_PIX_FMT_P212BE] = {
2929 .name = "p212be",
2930 .nb_components = 3,
2931 .log2_chroma_w = 1,
2932 .log2_chroma_h = 0,
2933 .comp = {
2934 { 0, 2, 0, 4, 12 }, /* Y */
2935 { 1, 4, 0, 4, 12 }, /* U */
2936 { 1, 4, 2, 4, 12 }, /* V */
2937 },
2938 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2939 },
2940 [AV_PIX_FMT_P212LE] = {
2941 .name = "p212le",
2942 .nb_components = 3,
2943 .log2_chroma_w = 1,
2944 .log2_chroma_h = 0,
2945 .comp = {
2946 { 0, 2, 0, 4, 12 }, /* Y */
2947 { 1, 4, 0, 4, 12 }, /* U */
2948 { 1, 4, 2, 4, 12 }, /* V */
2949 },
2950 .flags = AV_PIX_FMT_FLAG_PLANAR,
2951 },
2952 [AV_PIX_FMT_P412BE] = {
2953 .name = "p412be",
2954 .nb_components = 3,
2955 .log2_chroma_w = 0,
2956 .log2_chroma_h = 0,
2957 .comp = {
2958 { 0, 2, 0, 4, 12 }, /* Y */
2959 { 1, 4, 0, 4, 12 }, /* U */
2960 { 1, 4, 2, 4, 12 }, /* V */
2961 },
2962 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
2963 },
2964 [AV_PIX_FMT_P412LE] = {
2965 .name = "p412le",
2966 .nb_components = 3,
2967 .log2_chroma_w = 0,
2968 .log2_chroma_h = 0,
2969 .comp = {
2970 { 0, 2, 0, 4, 12 }, /* Y */
2971 { 1, 4, 0, 4, 12 }, /* U */
2972 { 1, 4, 2, 4, 12 }, /* V */
2973 },
2974 .flags = AV_PIX_FMT_FLAG_PLANAR,
2975 },
2976 [AV_PIX_FMT_Y216LE] = {
2977 .name = "y216le",
2978 .nb_components = 3,
2979 .log2_chroma_w = 1,
2980 .log2_chroma_h = 0,
2981 .comp = {
2982 { 0, 4, 0, 0, 16 }, /* Y */
2983 { 0, 8, 2, 0, 16 }, /* U */
2984 { 0, 8, 6, 0, 16 }, /* V */
2985 },
2986 },
2987 [AV_PIX_FMT_Y216BE] = {
2988 .name = "y216be",
2989 .nb_components = 3,
2990 .log2_chroma_w = 1,
2991 .log2_chroma_h = 0,
2992 .comp = {
2993 { 0, 4, 0, 0, 16 }, /* Y */
2994 { 0, 8, 2, 0, 16 }, /* U */
2995 { 0, 8, 6, 0, 16 }, /* V */
2996 },
2997 .flags = AV_PIX_FMT_FLAG_BE,
2998 },
2999 };
3000
3001 static const char * const color_range_names[] = {
3002 [AVCOL_RANGE_UNSPECIFIED] = "unknown",
3003 [AVCOL_RANGE_MPEG] = "tv",
3004 [AVCOL_RANGE_JPEG] = "pc",
3005 };
3006
3007 static const char * const color_primaries_names[AVCOL_PRI_NB] = {
3008 [AVCOL_PRI_RESERVED0] = "reserved",
3009 [AVCOL_PRI_BT709] = "bt709",
3010 [AVCOL_PRI_UNSPECIFIED] = "unknown",
3011 [AVCOL_PRI_RESERVED] = "reserved",
3012 [AVCOL_PRI_BT470M] = "bt470m",
3013 [AVCOL_PRI_BT470BG] = "bt470bg",
3014 [AVCOL_PRI_SMPTE170M] = "smpte170m",
3015 [AVCOL_PRI_SMPTE240M] = "smpte240m",
3016 [AVCOL_PRI_FILM] = "film",
3017 [AVCOL_PRI_BT2020] = "bt2020",
3018 [AVCOL_PRI_SMPTE428] = "smpte428",
3019 [AVCOL_PRI_SMPTE431] = "smpte431",
3020 [AVCOL_PRI_SMPTE432] = "smpte432",
3021 [AVCOL_PRI_EBU3213] = "ebu3213",
3022 };
3023
3024 static const char * const color_transfer_names[] = {
3025 [AVCOL_TRC_RESERVED0] = "reserved",
3026 [AVCOL_TRC_BT709] = "bt709",
3027 [AVCOL_TRC_UNSPECIFIED] = "unknown",
3028 [AVCOL_TRC_RESERVED] = "reserved",
3029 [AVCOL_TRC_GAMMA22] = "bt470m",
3030 [AVCOL_TRC_GAMMA28] = "bt470bg",
3031 [AVCOL_TRC_SMPTE170M] = "smpte170m",
3032 [AVCOL_TRC_SMPTE240M] = "smpte240m",
3033 [AVCOL_TRC_LINEAR] = "linear",
3034 [AVCOL_TRC_LOG] = "log100",
3035 [AVCOL_TRC_LOG_SQRT] = "log316",
3036 [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
3037 [AVCOL_TRC_BT1361_ECG] = "bt1361e",
3038 [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
3039 [AVCOL_TRC_BT2020_10] = "bt2020-10",
3040 [AVCOL_TRC_BT2020_12] = "bt2020-12",
3041 [AVCOL_TRC_SMPTE2084] = "smpte2084",
3042 [AVCOL_TRC_SMPTE428] = "smpte428",
3043 [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
3044 };
3045
3046 static const char * const color_space_names[] = {
3047 [AVCOL_SPC_RGB] = "gbr",
3048 [AVCOL_SPC_BT709] = "bt709",
3049 [AVCOL_SPC_UNSPECIFIED] = "unknown",
3050 [AVCOL_SPC_RESERVED] = "reserved",
3051 [AVCOL_SPC_FCC] = "fcc",
3052 [AVCOL_SPC_BT470BG] = "bt470bg",
3053 [AVCOL_SPC_SMPTE170M] = "smpte170m",
3054 [AVCOL_SPC_SMPTE240M] = "smpte240m",
3055 [AVCOL_SPC_YCGCO] = "ycgco",
3056 [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
3057 [AVCOL_SPC_BT2020_CL] = "bt2020c",
3058 [AVCOL_SPC_SMPTE2085] = "smpte2085",
3059 [AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
3060 [AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
3061 [AVCOL_SPC_ICTCP] = "ictcp",
3062 [AVCOL_SPC_IPT_C2] = "ipt-c2",
3063 [AVCOL_SPC_YCGCO_RE] = "ycgco-re",
3064 [AVCOL_SPC_YCGCO_RO] = "ycgco-ro",
3065 };
3066
3067 static const char * const chroma_location_names[] = {
3068 [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
3069 [AVCHROMA_LOC_LEFT] = "left",
3070 [AVCHROMA_LOC_CENTER] = "center",
3071 [AVCHROMA_LOC_TOPLEFT] = "topleft",
3072 [AVCHROMA_LOC_TOP] = "top",
3073 [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
3074 [AVCHROMA_LOC_BOTTOM] = "bottom",
3075 };
3076
3077 22411 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
3078 {
3079 enum AVPixelFormat pix_fmt;
3080
3081
2/2
✓ Branch 0 taken 2054807 times.
✓ Branch 1 taken 1158 times.
2055965 for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
3082
1/2
✓ Branch 0 taken 2054807 times.
✗ Branch 1 not taken.
2054807 if (av_pix_fmt_descriptors[pix_fmt].name &&
3083
4/4
✓ Branch 0 taken 2033556 times.
✓ Branch 1 taken 21251 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2033554 times.
4088363 (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
3084 2033556 av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
3085 21253 return pix_fmt;
3086
3087 1158 return AV_PIX_FMT_NONE;
3088 }
3089
3090 85462 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
3091 {
3092 85462 return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
3093
2/2
✓ Branch 0 taken 85460 times.
✓ Branch 1 taken 2 times.
85462 av_pix_fmt_descriptors[pix_fmt].name : NULL;
3094 }
3095
3096 #if HAVE_BIGENDIAN
3097 # define X_NE(be, le) be
3098 #else
3099 # define X_NE(be, le) le
3100 #endif
3101
3102 21243 enum AVPixelFormat av_get_pix_fmt(const char *name)
3103 {
3104 enum AVPixelFormat pix_fmt;
3105
3106
2/2
✓ Branch 0 taken 37 times.
✓ Branch 1 taken 21206 times.
21243 if (!strcmp(name, "rgb32"))
3107 37 name = X_NE("argb", "bgra");
3108
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 21206 times.
21206 else if (!strcmp(name, "bgr32"))
3109 name = X_NE("abgr", "rgba");
3110
3111 21243 pix_fmt = get_pix_fmt_internal(name);
3112
2/2
✓ Branch 0 taken 1156 times.
✓ Branch 1 taken 20087 times.
21243 if (pix_fmt == AV_PIX_FMT_NONE) {
3113 char name2[32];
3114
3115 1156 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
3116 1156 pix_fmt = get_pix_fmt_internal(name2);
3117 }
3118
3119 21243 return pix_fmt;
3120 }
3121
3122 176026 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
3123 {
3124 176026 int c, bits = 0;
3125 176026 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
3126
3127
2/2
✓ Branch 0 taken 522108 times.
✓ Branch 1 taken 176026 times.
698134 for (c = 0; c < pixdesc->nb_components; c++) {
3128
4/4
✓ Branch 0 taken 355124 times.
✓ Branch 1 taken 166984 times.
✓ Branch 2 taken 188601 times.
✓ Branch 3 taken 166523 times.
522108 int s = c == 1 || c == 2 ? 0 : log2_pixels;
3129 522108 bits += pixdesc->comp[c].depth << s;
3130 }
3131
3132 176026 return bits >> log2_pixels;
3133 }
3134
3135 1162 int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
3136 {
3137 1162 int c, bits = 0;
3138 1162 int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
3139 1162 int steps[4] = {0};
3140
3141
2/2
✓ Branch 0 taken 3525 times.
✓ Branch 1 taken 1162 times.
4687 for (c = 0; c < pixdesc->nb_components; c++) {
3142 3525 const AVComponentDescriptor *comp = &pixdesc->comp[c];
3143
4/4
✓ Branch 0 taken 2489 times.
✓ Branch 1 taken 1036 times.
✓ Branch 2 taken 1453 times.
✓ Branch 3 taken 1036 times.
3525 int s = c == 1 || c == 2 ? 0 : log2_pixels;
3144 3525 steps[comp->plane] = comp->step << s;
3145 }
3146
2/2
✓ Branch 0 taken 4648 times.
✓ Branch 1 taken 1162 times.
5810 for (c = 0; c < 4; c++)
3147 4648 bits += steps[c];
3148
3149
2/2
✓ Branch 0 taken 1068 times.
✓ Branch 1 taken 94 times.
1162 if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
3150 1068 bits *= 8;
3151
3152 1162 return bits >> log2_pixels;
3153 }
3154
3155 char *av_get_pix_fmt_string(char *buf, int buf_size,
3156 enum AVPixelFormat pix_fmt)
3157 {
3158 /* print header */
3159 if (pix_fmt < 0) {
3160 snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
3161 } else {
3162 const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
3163 snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
3164 pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
3165 }
3166
3167 return buf;
3168 }
3169
3170 305361188 const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
3171 {
3172
4/4
✓ Branch 0 taken 304444551 times.
✓ Branch 1 taken 916637 times.
✓ Branch 2 taken 67769 times.
✓ Branch 3 taken 304376782 times.
305361188 if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
3173 984406 return NULL;
3174 304376782 return &av_pix_fmt_descriptors[pix_fmt];
3175 }
3176
3177 2887008 const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
3178 {
3179
2/2
✓ Branch 0 taken 11832 times.
✓ Branch 1 taken 2875176 times.
2887008 if (!prev)
3180 11832 return &av_pix_fmt_descriptors[0];
3181
2/2
✓ Branch 0 taken 2863344 times.
✓ Branch 1 taken 11832 times.
2875176 while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
3182 2863344 prev++;
3183
1/2
✓ Branch 0 taken 2863344 times.
✗ Branch 1 not taken.
2863344 if (prev->name)
3184 2863344 return prev;
3185 }
3186 11832 return NULL;
3187 }
3188
3189 2875419 enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
3190 {
3191
1/2
✓ Branch 0 taken 2875419 times.
✗ Branch 1 not taken.
2875419 if (desc < av_pix_fmt_descriptors ||
3192
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2875419 times.
2875419 desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
3193 return AV_PIX_FMT_NONE;
3194
3195 2875419 return desc - av_pix_fmt_descriptors;
3196 }
3197
3198 51431 int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
3199 int *h_shift, int *v_shift)
3200 {
3201 51431 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
3202
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 51431 times.
51431 if (!desc)
3203 return AVERROR(ENOSYS);
3204 51431 *h_shift = desc->log2_chroma_w;
3205 51431 *v_shift = desc->log2_chroma_h;
3206
3207 51431 return 0;
3208 }
3209
3210 155412 int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
3211 {
3212 155412 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
3213 155412 int i, planes[4] = { 0 }, ret = 0;
3214
3215
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 155412 times.
155412 if (!desc)
3216 return AVERROR(EINVAL);
3217
3218
2/2
✓ Branch 0 taken 455971 times.
✓ Branch 1 taken 155412 times.
611383 for (i = 0; i < desc->nb_components; i++)
3219 455971 planes[desc->comp[i].plane] = 1;
3220
2/2
✓ Branch 0 taken 621648 times.
✓ Branch 1 taken 155412 times.
777060 for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
3221 621648 ret += planes[i];
3222 155412 return ret;
3223 }
3224
3225 12 enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
3226 {
3227 12 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
3228 char name[16];
3229 int i;
3230
3231
2/4
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
12 if (!desc || strlen(desc->name) < 2)
3232 return AV_PIX_FMT_NONE;
3233 12 av_strlcpy(name, desc->name, sizeof(name));
3234 12 i = strlen(name) - 2;
3235
3/4
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
12 if (strcmp(name + i, "be") && strcmp(name + i, "le"))
3236 return AV_PIX_FMT_NONE;
3237
3238 12 name[i] ^= 'b' ^ 'l';
3239
3240 12 return get_pix_fmt_internal(name);
3241 }
3242
3243 #define FF_COLOR_NA -1
3244 #define FF_COLOR_RGB 0 /**< RGB color space */
3245 #define FF_COLOR_GRAY 1 /**< gray color space */
3246 #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
3247 #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
3248 #define FF_COLOR_XYZ 4
3249
3250 #define pixdesc_has_alpha(pixdesc) \
3251 ((pixdesc)->flags & AV_PIX_FMT_FLAG_ALPHA)
3252
3253
3254 8522 static int get_color_type(const AVPixFmtDescriptor *desc) {
3255
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 8504 times.
8522 if (desc->flags & AV_PIX_FMT_FLAG_PAL)
3256 18 return FF_COLOR_RGB;
3257
3258
4/4
✓ Branch 0 taken 7554 times.
✓ Branch 1 taken 950 times.
✓ Branch 2 taken 87 times.
✓ Branch 3 taken 7467 times.
8504 if(desc->nb_components == 1 || desc->nb_components == 2)
3259 1037 return FF_COLOR_GRAY;
3260
3261
1/2
✓ Branch 0 taken 7467 times.
✗ Branch 1 not taken.
7467 if (desc->name) {
3262
2/2
✓ Branch 1 taken 242 times.
✓ Branch 2 taken 7225 times.
7467 if (av_strstart(desc->name, "yuvj", NULL))
3263 242 return FF_COLOR_YUV_JPEG;
3264 }
3265
3266
2/2
✓ Branch 0 taken 2497 times.
✓ Branch 1 taken 4728 times.
7225 if(desc->flags & AV_PIX_FMT_FLAG_RGB)
3267 2497 return FF_COLOR_RGB;
3268
3269
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 4726 times.
4728 if(desc->flags & AV_PIX_FMT_FLAG_XYZ)
3270 2 return FF_COLOR_XYZ;
3271
3272
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4726 times.
4726 if(desc->nb_components == 0)
3273 return FF_COLOR_NA;
3274
3275 4726 return FF_COLOR_YUV;
3276 }
3277
3278 8522 static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
3279 {
3280 8522 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
3281 int i;
3282
3283
2/4
✓ Branch 0 taken 8522 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8522 times.
8522 if (!desc || !desc->nb_components) {
3284 *min = *max = 0;
3285 return AVERROR(EINVAL);
3286 }
3287
3288 8522 *min = INT_MAX, *max = -INT_MAX;
3289
2/2
✓ Branch 0 taken 24733 times.
✓ Branch 1 taken 8522 times.
33255 for (i = 0; i < desc->nb_components; i++) {
3290 24733 *min = FFMIN(desc->comp[i].depth, *min);
3291 24733 *max = FFMAX(desc->comp[i].depth, *max);
3292 }
3293 8522 return 0;
3294 }
3295
3296 4824 static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
3297 enum AVPixelFormat src_pix_fmt,
3298 unsigned *lossp, unsigned consider)
3299 {
3300 4824 const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
3301 4824 const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
3302 int src_color, dst_color;
3303 int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
3304 int ret, loss, i, nb_components;
3305 4824 int score = INT_MAX - 1;
3306
3307
2/4
✓ Branch 0 taken 4824 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4824 times.
4824 if (!src_desc || !dst_desc)
3308 return -4;
3309
3310
2/2
✓ Branch 0 taken 4722 times.
✓ Branch 1 taken 102 times.
4824 if ((src_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) ||
3311
2/2
✓ Branch 0 taken 150 times.
✓ Branch 1 taken 4572 times.
4722 (dst_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
3312
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 249 times.
252 if (dst_pix_fmt == src_pix_fmt)
3313 3 return -1;
3314 else
3315 249 return -2;
3316 }
3317
3318 /* compute loss */
3319 4572 *lossp = loss = 0;
3320
3321
2/2
✓ Branch 0 taken 311 times.
✓ Branch 1 taken 4261 times.
4572 if (dst_pix_fmt == src_pix_fmt)
3322 311 return INT_MAX;
3323
3324
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4261 times.
4261 if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
3325 return -3;
3326
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4261 times.
4261 if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
3327 return -3;
3328
3329 4261 src_color = get_color_type(src_desc);
3330 4261 dst_color = get_color_type(dst_desc);
3331
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 4243 times.
4261 if (dst_pix_fmt == AV_PIX_FMT_PAL8)
3332 18 nb_components = FFMIN(src_desc->nb_components, 4);
3333 else
3334 4243 nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
3335
3336
2/2
✓ Branch 0 taken 11218 times.
✓ Branch 1 taken 4261 times.
15479 for (i = 0; i < nb_components; i++) {
3337
2/2
✓ Branch 0 taken 54 times.
✓ Branch 1 taken 11164 times.
11218 int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
3338 11218 int depth_delta = src_desc->comp[i].depth - 1 - depth_minus1;
3339
3/4
✓ Branch 0 taken 1693 times.
✓ Branch 1 taken 9525 times.
✓ Branch 2 taken 1693 times.
✗ Branch 3 not taken.
11218 if (depth_delta > 0 && (consider & FF_LOSS_DEPTH)) {
3340 1693 loss |= FF_LOSS_DEPTH;
3341 1693 score -= 65536 >> depth_minus1;
3342
3/4
✓ Branch 0 taken 3308 times.
✓ Branch 1 taken 6217 times.
✓ Branch 2 taken 3308 times.
✗ Branch 3 not taken.
9525 } else if (depth_delta < 0 && (consider & FF_LOSS_EXCESS_DEPTH)) {
3343 // Favour formats where bit depth exactly matches. If all other
3344 // scoring is equal, we'd rather use the bit depth that most closely
3345 // matches the source.
3346 3308 loss |= FF_LOSS_EXCESS_DEPTH;
3347 3308 score += depth_delta;
3348 }
3349 }
3350
3351
1/2
✓ Branch 0 taken 4261 times.
✗ Branch 1 not taken.
4261 if (consider & FF_LOSS_RESOLUTION) {
3352
2/2
✓ Branch 0 taken 872 times.
✓ Branch 1 taken 3389 times.
4261 if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
3353 872 loss |= FF_LOSS_RESOLUTION;
3354 872 score -= 256 << dst_desc->log2_chroma_w;
3355 }
3356
2/2
✓ Branch 0 taken 638 times.
✓ Branch 1 taken 3623 times.
4261 if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
3357 638 loss |= FF_LOSS_RESOLUTION;
3358 638 score -= 256 << dst_desc->log2_chroma_h;
3359 }
3360 // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
3361
4/4
✓ Branch 0 taken 1552 times.
✓ Branch 1 taken 2709 times.
✓ Branch 2 taken 839 times.
✓ Branch 3 taken 713 times.
4261 if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
3362
4/4
✓ Branch 0 taken 568 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 539 times.
✓ Branch 3 taken 29 times.
839 dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
3363 539 score += 512;
3364 }
3365 }
3366
3367
1/2
✓ Branch 0 taken 4261 times.
✗ Branch 1 not taken.
4261 if (consider & FF_LOSS_EXCESS_RESOLUTION) {
3368 // Favour formats where chroma subsampling exactly matches. If all other
3369 // scoring is equal, we'd rather use the subsampling that most closely
3370 // matches the source.
3371
2/2
✓ Branch 0 taken 1178 times.
✓ Branch 1 taken 3083 times.
4261 if (dst_desc->log2_chroma_w < src_desc->log2_chroma_w) {
3372 1178 loss |= FF_LOSS_EXCESS_RESOLUTION;
3373 1178 score -= 1 << (src_desc->log2_chroma_w - dst_desc->log2_chroma_w);
3374 }
3375
3376
2/2
✓ Branch 0 taken 1260 times.
✓ Branch 1 taken 3001 times.
4261 if (dst_desc->log2_chroma_h < src_desc->log2_chroma_h) {
3377 1260 loss |= FF_LOSS_EXCESS_RESOLUTION;
3378 1260 score -= 1 << (src_desc->log2_chroma_h - dst_desc->log2_chroma_h);
3379 }
3380
3381 // don't favour 411 over 420, because 420 has much better support on the
3382 // decoder side.
3383
4/4
✓ Branch 0 taken 1552 times.
✓ Branch 1 taken 2709 times.
✓ Branch 2 taken 63 times.
✓ Branch 3 taken 1489 times.
4261 if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 2 &&
3384
4/4
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 31 times.
✓ Branch 2 taken 19 times.
✓ Branch 3 taken 13 times.
63 dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 2) {
3385 19 score += 4;
3386 }
3387 }
3388
3389
1/2
✓ Branch 0 taken 4261 times.
✗ Branch 1 not taken.
4261 if(consider & FF_LOSS_COLORSPACE)
3390
5/5
✓ Branch 0 taken 1027 times.
✓ Branch 1 taken 749 times.
✓ Branch 2 taken 2429 times.
✓ Branch 3 taken 54 times.
✓ Branch 4 taken 2 times.
4261 switch(dst_color) {
3391 1027 case FF_COLOR_RGB:
3392
4/4
✓ Branch 0 taken 666 times.
✓ Branch 1 taken 361 times.
✓ Branch 2 taken 630 times.
✓ Branch 3 taken 36 times.
1027 if (src_color != FF_COLOR_RGB &&
3393 src_color != FF_COLOR_GRAY)
3394 630 loss |= FF_LOSS_COLORSPACE;
3395 1027 break;
3396 749 case FF_COLOR_GRAY:
3397
2/2
✓ Branch 0 taken 605 times.
✓ Branch 1 taken 144 times.
749 if (src_color != FF_COLOR_GRAY)
3398 605 loss |= FF_LOSS_COLORSPACE;
3399 749 break;
3400 2429 case FF_COLOR_YUV:
3401
2/2
✓ Branch 0 taken 1025 times.
✓ Branch 1 taken 1404 times.
2429 if (src_color != FF_COLOR_YUV)
3402 1025 loss |= FF_LOSS_COLORSPACE;
3403 2429 break;
3404 54 case FF_COLOR_YUV_JPEG:
3405
3/4
✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 16 times.
54 if (src_color != FF_COLOR_YUV_JPEG &&
3406
1/2
✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
38 src_color != FF_COLOR_YUV &&
3407 src_color != FF_COLOR_GRAY)
3408 38 loss |= FF_LOSS_COLORSPACE;
3409 54 break;
3410 2 default:
3411 /* fail safe test */
3412
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (src_color != dst_color)
3413 2 loss |= FF_LOSS_COLORSPACE;
3414 2 break;
3415 }
3416
2/2
✓ Branch 0 taken 2300 times.
✓ Branch 1 taken 1961 times.
4261 if(loss & FF_LOSS_COLORSPACE)
3417
2/2
✓ Branch 0 taken 698 times.
✓ Branch 1 taken 1602 times.
2300 score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
3418
3419
4/4
✓ Branch 0 taken 749 times.
✓ Branch 1 taken 3512 times.
✓ Branch 2 taken 605 times.
✓ Branch 3 taken 144 times.
4261 if (dst_color == FF_COLOR_GRAY &&
3420
1/2
✓ Branch 0 taken 605 times.
✗ Branch 1 not taken.
605 src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
3421 605 loss |= FF_LOSS_CHROMA;
3422 605 score -= 2 * 65536;
3423 }
3424
6/6
✓ Branch 0 taken 3838 times.
✓ Branch 1 taken 423 times.
✓ Branch 2 taken 698 times.
✓ Branch 3 taken 3140 times.
✓ Branch 4 taken 154 times.
✓ Branch 5 taken 544 times.
4261 if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
3425 154 loss |= FF_LOSS_ALPHA;
3426 154 score -= 65536;
3427 }
3428
4/6
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 4243 times.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
4261 if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
3429
1/6
✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
18 (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
3430 18 loss |= FF_LOSS_COLORQUANT;
3431 18 score -= 65536;
3432 }
3433
3434 4261 *lossp = loss;
3435 4261 return score;
3436 }
3437
3438 int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
3439 enum AVPixelFormat src_pix_fmt,
3440 int has_alpha)
3441 {
3442 int loss;
3443 int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
3444 if (ret < 0)
3445 return ret;
3446 return loss;
3447 }
3448
3449 2622 enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
3450 enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
3451 {
3452 enum AVPixelFormat dst_pix_fmt;
3453 int loss1, loss2, loss_mask;
3454 2622 const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
3455 2622 const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
3456 int score1, score2;
3457
3458
2/2
✓ Branch 0 taken 210 times.
✓ Branch 1 taken 2412 times.
2622 if (!desc1) {
3459 210 dst_pix_fmt = dst_pix_fmt2;
3460
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2412 times.
2412 } else if (!desc2) {
3461 dst_pix_fmt = dst_pix_fmt1;
3462 } else {
3463
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2412 times.
2412 loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
3464
2/2
✓ Branch 0 taken 2248 times.
✓ Branch 1 taken 164 times.
2412 if(!has_alpha)
3465 2248 loss_mask &= ~FF_LOSS_ALPHA;
3466
3467 2412 score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
3468 2412 score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
3469
3470
2/2
✓ Branch 0 taken 205 times.
✓ Branch 1 taken 2207 times.
2412 if (score1 == score2) {
3471
2/2
✓ Branch 2 taken 155 times.
✓ Branch 3 taken 50 times.
205 if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) {
3472
2/2
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 147 times.
155 dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
3473 } else {
3474
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 50 times.
50 dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
3475 }
3476 } else {
3477
2/2
✓ Branch 0 taken 408 times.
✓ Branch 1 taken 1799 times.
2207 dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
3478 }
3479 }
3480
3481
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2622 times.
2622 if (loss_ptr)
3482 *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
3483 2622 return dst_pix_fmt;
3484 }
3485
3486 30925 const char *av_color_range_name(enum AVColorRange range)
3487 {
3488 return (unsigned) range < AVCOL_RANGE_NB ?
3489
1/2
✓ Branch 0 taken 30925 times.
✗ Branch 1 not taken.
30925 color_range_names[range] : NULL;
3490 }
3491
3492 1870 int av_color_range_from_name(const char *name)
3493 {
3494 int i;
3495
3496
1/2
✓ Branch 0 taken 3823 times.
✗ Branch 1 not taken.
3823 for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
3497
2/2
✓ Branch 1 taken 1870 times.
✓ Branch 2 taken 1953 times.
3823 if (av_strstart(name, color_range_names[i], NULL))
3498 1870 return i;
3499 }
3500
3501 return AVERROR(EINVAL);
3502 }
3503
3504 3805 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
3505 {
3506 return (unsigned) primaries < AVCOL_PRI_NB ?
3507
1/2
✓ Branch 0 taken 3805 times.
✗ Branch 1 not taken.
3805 color_primaries_names[primaries] : NULL;
3508 }
3509
3510 int av_color_primaries_from_name(const char *name)
3511 {
3512 int i;
3513
3514 for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) {
3515 if (!color_primaries_names[i])
3516 continue;
3517
3518 if (av_strstart(name, color_primaries_names[i], NULL))
3519 return i;
3520 }
3521
3522 return AVERROR(EINVAL);
3523 }
3524
3525 3805 const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
3526 {
3527 return (unsigned) transfer < AVCOL_TRC_NB ?
3528
1/2
✓ Branch 0 taken 3805 times.
✗ Branch 1 not taken.
3805 color_transfer_names[transfer] : NULL;
3529 }
3530
3531 int av_color_transfer_from_name(const char *name)
3532 {
3533 int i;
3534
3535 for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) {
3536 if (!color_transfer_names[i])
3537 continue;
3538
3539 if (av_strstart(name, color_transfer_names[i], NULL))
3540 return i;
3541 }
3542
3543 return AVERROR(EINVAL);
3544 }
3545
3546 21099 const char *av_color_space_name(enum AVColorSpace space)
3547 {
3548 return (unsigned) space < AVCOL_SPC_NB ?
3549
1/2
✓ Branch 0 taken 21099 times.
✗ Branch 1 not taken.
21099 color_space_names[space] : NULL;
3550 }
3551
3552 20 int av_color_space_from_name(const char *name)
3553 {
3554 int i;
3555
3556
1/2
✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
65 for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) {
3557
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 65 times.
65 if (!color_space_names[i])
3558 continue;
3559
3560
2/2
✓ Branch 1 taken 20 times.
✓ Branch 2 taken 45 times.
65 if (av_strstart(name, color_space_names[i], NULL))
3561 20 return i;
3562 }
3563
3564 return AVERROR(EINVAL);
3565 }
3566
3567 697 const char *av_chroma_location_name(enum AVChromaLocation location)
3568 {
3569 return (unsigned) location < AVCHROMA_LOC_NB ?
3570
1/2
✓ Branch 0 taken 697 times.
✗ Branch 1 not taken.
697 chroma_location_names[location] : NULL;
3571 }
3572
3573 int av_chroma_location_from_name(const char *name)
3574 {
3575 int i;
3576
3577 for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) {
3578 if (!chroma_location_names[i])
3579 continue;
3580
3581 if (av_strstart(name, chroma_location_names[i], NULL))
3582 return i;
3583 }
3584
3585 return AVERROR(EINVAL);
3586 }
3587
3588 11184 int av_chroma_location_enum_to_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
3589 {
3590
2/4
✓ Branch 0 taken 11184 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 11184 times.
11184 if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB)
3591 return AVERROR(EINVAL);
3592 11184 pos--;
3593
3594 11184 *xpos = (pos&1) * 128;
3595 11184 *ypos = ((pos>>1)^(pos<4)) * 128;
3596
3597 11184 return 0;
3598 }
3599
3600 37 enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos)
3601 {
3602 int pos, xout, yout;
3603
3604
1/2
✓ Branch 0 taken 67 times.
✗ Branch 1 not taken.
67 for (pos = AVCHROMA_LOC_UNSPECIFIED + 1; pos < AVCHROMA_LOC_NB; pos++) {
3605
5/6
✓ Branch 1 taken 67 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 45 times.
✓ Branch 4 taken 22 times.
✓ Branch 5 taken 37 times.
✓ Branch 6 taken 8 times.
67 if (av_chroma_location_enum_to_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos)
3606 37 return pos;
3607 }
3608 return AVCHROMA_LOC_UNSPECIFIED;
3609 }
3610