FFmpeg
pixdesc.c
Go to the documentation of this file.
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 "avassert.h"
26 #include "avstring.h"
27 #include "common.h"
28 #include "pixfmt.h"
29 #include "pixdesc.h"
30 #include "internal.h"
31 #include "intreadwrite.h"
32 #include "version.h"
33 
34 void av_read_image_line2(void *dst,
35  const uint8_t *data[4], const int linesize[4],
36  const AVPixFmtDescriptor *desc,
37  int x, int y, int c, int w,
38  int read_pal_component,
39  int dst_element_size)
40 {
42  int plane = comp.plane;
43  int depth = comp.depth;
44  unsigned mask = (1ULL << depth) - 1;
45  int shift = comp.shift;
46  int step = comp.step;
47  int flags = desc->flags;
48  uint16_t *dst16 = dst;
49  uint32_t *dst32 = dst;
50 
51  if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
52  int skip = x * step + comp.offset;
53  const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
54  int shift = 8 - depth - (skip & 7);
55 
56  while (w--) {
57  int val = (*p >> shift) & mask;
58  if (read_pal_component)
59  val = data[1][4*val + c];
60  shift -= step;
61  p -= shift >> 3;
62  shift &= 7;
63  if (dst_element_size == 4) *dst32++ = val;
64  else *dst16++ = val;
65  }
66  } else {
67  const uint8_t *p = data[plane] + y * linesize[plane] +
68  x * step + comp.offset;
69  int is_8bit = shift + depth <= 8;
70  int is_16bit= shift + depth <=16;
71 
72  if (is_8bit)
73  p += !!(flags & AV_PIX_FMT_FLAG_BE);
74 
75  while (w--) {
76  unsigned val;
77  if (is_8bit) val = *p;
78  else if(is_16bit) val = flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p);
79  else val = flags & AV_PIX_FMT_FLAG_BE ? AV_RB32(p) : AV_RL32(p);
80  val = (val >> shift) & mask;
81  if (read_pal_component)
82  val = data[1][4 * val + c];
83  p += step;
84  if (dst_element_size == 4) *dst32++ = val;
85  else *dst16++ = val;
86  }
87  }
88 }
89 
90 void av_read_image_line(uint16_t *dst,
91  const uint8_t *data[4], const int linesize[4],
92  const AVPixFmtDescriptor *desc,
93  int x, int y, int c, int w,
94  int read_pal_component)
95 {
96  av_read_image_line2(dst, data, linesize, desc,x, y, c, w,
97  read_pal_component,
98  2);
99 }
100 
101 void av_write_image_line2(const void *src,
102  uint8_t *data[4], const int linesize[4],
103  const AVPixFmtDescriptor *desc,
104  int x, int y, int c, int w, int src_element_size)
105 {
106  AVComponentDescriptor comp = desc->comp[c];
107  int plane = comp.plane;
108  int depth = comp.depth;
109  int step = comp.step;
110  int flags = desc->flags;
111  const uint32_t *src32 = src;
112  const uint16_t *src16 = src;
113 
114  if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
115  int skip = x * step + comp.offset;
116  uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
117  int shift = 8 - depth - (skip & 7);
118 
119  while (w--) {
120  *p |= (src_element_size == 4 ? *src32++ : *src16++) << shift;
121  shift -= step;
122  p -= shift >> 3;
123  shift &= 7;
124  }
125  } else {
126  int shift = comp.shift;
127  uint8_t *p = data[plane] + y * linesize[plane] +
128  x * step + comp.offset;
129 
130  if (shift + depth <= 8) {
131  p += !!(flags & AV_PIX_FMT_FLAG_BE);
132  while (w--) {
133  *p |= ((src_element_size == 4 ? *src32++ : *src16++) << shift);
134  p += step;
135  }
136  } else {
137  while (w--) {
138  unsigned s = (src_element_size == 4 ? *src32++ : *src16++);
139  if (shift + depth <= 16) {
140  if (flags & AV_PIX_FMT_FLAG_BE) {
141  uint16_t val = AV_RB16(p) | (s << shift);
142  AV_WB16(p, val);
143  } else {
144  uint16_t val = AV_RL16(p) | (s << shift);
145  AV_WL16(p, val);
146  }
147  } else {
148  if (flags & AV_PIX_FMT_FLAG_BE) {
149  uint32_t val = AV_RB32(p) | (s << shift);
150  AV_WB32(p, val);
151  } else {
152  uint32_t val = AV_RL32(p) | (s << shift);
153  AV_WL32(p, val);
154  }
155  }
156  p += step;
157  }
158  }
159  }
160 }
161 
162 void av_write_image_line(const uint16_t *src,
163  uint8_t *data[4], const int linesize[4],
164  const AVPixFmtDescriptor *desc,
165  int x, int y, int c, int w)
166 {
167  av_write_image_line2(src, data, linesize, desc, x, y, c, w, 2);
168 }
169 
170 #if FF_API_PLUS1_MINUS1
172 #endif
174  [AV_PIX_FMT_YUV420P] = {
175  .name = "yuv420p",
176  .nb_components = 3,
177  .log2_chroma_w = 1,
178  .log2_chroma_h = 1,
179  .comp = {
180  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
181  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
182  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
183  },
184  .flags = AV_PIX_FMT_FLAG_PLANAR,
185  },
186  [AV_PIX_FMT_YUYV422] = {
187  .name = "yuyv422",
188  .nb_components = 3,
189  .log2_chroma_w = 1,
190  .log2_chroma_h = 0,
191  .comp = {
192  { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
193  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* U */
194  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* V */
195  },
196  },
197  [AV_PIX_FMT_YVYU422] = {
198  .name = "yvyu422",
199  .nb_components = 3,
200  .log2_chroma_w = 1,
201  .log2_chroma_h = 0,
202  .comp = {
203  { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
204  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* U */
205  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* V */
206  },
207  },
208  [AV_PIX_FMT_Y210LE] = {
209  .name = "y210le",
210  .nb_components = 3,
211  .log2_chroma_w = 1,
212  .log2_chroma_h = 0,
213  .comp = {
214  { 0, 4, 0, 6, 10, 3, 9, 1 }, /* Y */
215  { 0, 8, 2, 6, 10, 7, 9, 3 }, /* U */
216  { 0, 8, 6, 6, 10, 7, 9, 7 }, /* V */
217  },
218  },
219  [AV_PIX_FMT_Y210BE] = {
220  .name = "y210be",
221  .nb_components = 3,
222  .log2_chroma_w = 1,
223  .log2_chroma_h = 0,
224  .comp = {
225  { 0, 4, 0, 6, 10, 3, 9, 1 }, /* Y */
226  { 0, 8, 2, 6, 10, 7, 9, 3 }, /* U */
227  { 0, 8, 6, 6, 10, 7, 9, 7 }, /* V */
228  },
229  .flags = AV_PIX_FMT_FLAG_BE,
230  },
231  [AV_PIX_FMT_RGB24] = {
232  .name = "rgb24",
233  .nb_components = 3,
234  .log2_chroma_w = 0,
235  .log2_chroma_h = 0,
236  .comp = {
237  { 0, 3, 0, 0, 8, 2, 7, 1 }, /* R */
238  { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
239  { 0, 3, 2, 0, 8, 2, 7, 3 }, /* B */
240  },
241  .flags = AV_PIX_FMT_FLAG_RGB,
242  },
243  [AV_PIX_FMT_BGR24] = {
244  .name = "bgr24",
245  .nb_components = 3,
246  .log2_chroma_w = 0,
247  .log2_chroma_h = 0,
248  .comp = {
249  { 0, 3, 2, 0, 8, 2, 7, 3 }, /* R */
250  { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
251  { 0, 3, 0, 0, 8, 2, 7, 1 }, /* B */
252  },
253  .flags = AV_PIX_FMT_FLAG_RGB,
254  },
256  .name = "x2rgb10le",
257  .nb_components= 3,
258  .log2_chroma_w= 0,
259  .log2_chroma_h= 0,
260  .comp = {
261  { 0, 4, 2, 4, 10, 3, 9, 2 }, /* R */
262  { 0, 4, 1, 2, 10, 3, 9, 3 }, /* G */
263  { 0, 4, 0, 0, 10, 3, 9, 4 }, /* B */
264  },
265  .flags = AV_PIX_FMT_FLAG_RGB,
266  },
268  .name = "x2rgb10be",
269  .nb_components= 3,
270  .log2_chroma_w= 0,
271  .log2_chroma_h= 0,
272  .comp = {
273  { 0, 4, 0, 4, 10, 3, 9, 2 }, /* R */
274  { 0, 4, 1, 2, 10, 3, 9, 3 }, /* G */
275  { 0, 4, 2, 0, 10, 3, 9, 4 }, /* B */
276  },
278  },
279  [AV_PIX_FMT_YUV422P] = {
280  .name = "yuv422p",
281  .nb_components = 3,
282  .log2_chroma_w = 1,
283  .log2_chroma_h = 0,
284  .comp = {
285  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
286  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
287  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
288  },
289  .flags = AV_PIX_FMT_FLAG_PLANAR,
290  },
291  [AV_PIX_FMT_YUV444P] = {
292  .name = "yuv444p",
293  .nb_components = 3,
294  .log2_chroma_w = 0,
295  .log2_chroma_h = 0,
296  .comp = {
297  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
298  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
299  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
300  },
301  .flags = AV_PIX_FMT_FLAG_PLANAR,
302  },
303  [AV_PIX_FMT_YUV410P] = {
304  .name = "yuv410p",
305  .nb_components = 3,
306  .log2_chroma_w = 2,
307  .log2_chroma_h = 2,
308  .comp = {
309  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
310  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
311  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
312  },
313  .flags = AV_PIX_FMT_FLAG_PLANAR,
314  },
315  [AV_PIX_FMT_YUV411P] = {
316  .name = "yuv411p",
317  .nb_components = 3,
318  .log2_chroma_w = 2,
319  .log2_chroma_h = 0,
320  .comp = {
321  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
322  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
323  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
324  },
325  .flags = AV_PIX_FMT_FLAG_PLANAR,
326  },
327  [AV_PIX_FMT_YUVJ411P] = {
328  .name = "yuvj411p",
329  .nb_components = 3,
330  .log2_chroma_w = 2,
331  .log2_chroma_h = 0,
332  .comp = {
333  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
334  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
335  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
336  },
337  .flags = AV_PIX_FMT_FLAG_PLANAR,
338  },
339  [AV_PIX_FMT_GRAY8] = {
340  .name = "gray",
341  .nb_components = 1,
342  .log2_chroma_w = 0,
343  .log2_chroma_h = 0,
344  .comp = {
345  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
346  },
347  .flags = FF_PSEUDOPAL,
348  .alias = "gray8,y8",
349  },
351  .name = "monow",
352  .nb_components = 1,
353  .log2_chroma_w = 0,
354  .log2_chroma_h = 0,
355  .comp = {
356  { 0, 1, 0, 0, 1, 0, 0, 1 }, /* Y */
357  },
358  .flags = AV_PIX_FMT_FLAG_BITSTREAM,
359  },
361  .name = "monob",
362  .nb_components = 1,
363  .log2_chroma_w = 0,
364  .log2_chroma_h = 0,
365  .comp = {
366  { 0, 1, 0, 7, 1, 0, 0, 1 }, /* Y */
367  },
368  .flags = AV_PIX_FMT_FLAG_BITSTREAM,
369  },
370  [AV_PIX_FMT_PAL8] = {
371  .name = "pal8",
372  .nb_components = 1,
373  .log2_chroma_w = 0,
374  .log2_chroma_h = 0,
375  .comp = {
376  { 0, 1, 0, 0, 8, 0, 7, 1 },
377  },
379  },
380  [AV_PIX_FMT_YUVJ420P] = {
381  .name = "yuvj420p",
382  .nb_components = 3,
383  .log2_chroma_w = 1,
384  .log2_chroma_h = 1,
385  .comp = {
386  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
387  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
388  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
389  },
390  .flags = AV_PIX_FMT_FLAG_PLANAR,
391  },
392  [AV_PIX_FMT_YUVJ422P] = {
393  .name = "yuvj422p",
394  .nb_components = 3,
395  .log2_chroma_w = 1,
396  .log2_chroma_h = 0,
397  .comp = {
398  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
399  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
400  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
401  },
402  .flags = AV_PIX_FMT_FLAG_PLANAR,
403  },
404  [AV_PIX_FMT_YUVJ444P] = {
405  .name = "yuvj444p",
406  .nb_components = 3,
407  .log2_chroma_w = 0,
408  .log2_chroma_h = 0,
409  .comp = {
410  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
411  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
412  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
413  },
414  .flags = AV_PIX_FMT_FLAG_PLANAR,
415  },
416  [AV_PIX_FMT_XVMC] = {
417  .name = "xvmc",
418  .flags = AV_PIX_FMT_FLAG_HWACCEL,
419  },
420  [AV_PIX_FMT_UYVY422] = {
421  .name = "uyvy422",
422  .nb_components = 3,
423  .log2_chroma_w = 1,
424  .log2_chroma_h = 0,
425  .comp = {
426  { 0, 2, 1, 0, 8, 1, 7, 2 }, /* Y */
427  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* U */
428  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* V */
429  },
430  },
432  .name = "uyyvyy411",
433  .nb_components = 3,
434  .log2_chroma_w = 2,
435  .log2_chroma_h = 0,
436  .comp = {
437  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* Y */
438  { 0, 6, 0, 0, 8, 5, 7, 1 }, /* U */
439  { 0, 6, 3, 0, 8, 5, 7, 4 }, /* V */
440  },
441  },
442  [AV_PIX_FMT_BGR8] = {
443  .name = "bgr8",
444  .nb_components = 3,
445  .log2_chroma_w = 0,
446  .log2_chroma_h = 0,
447  .comp = {
448  { 0, 1, 0, 0, 3, 0, 2, 1 }, /* R */
449  { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
450  { 0, 1, 0, 6, 2, 0, 1, 1 }, /* B */
451  },
453  },
454  [AV_PIX_FMT_BGR4] = {
455  .name = "bgr4",
456  .nb_components = 3,
457  .log2_chroma_w = 0,
458  .log2_chroma_h = 0,
459  .comp = {
460  { 0, 4, 3, 0, 1, 3, 0, 4 }, /* R */
461  { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
462  { 0, 4, 0, 0, 1, 3, 0, 1 }, /* B */
463  },
465  },
467  .name = "bgr4_byte",
468  .nb_components = 3,
469  .log2_chroma_w = 0,
470  .log2_chroma_h = 0,
471  .comp = {
472  { 0, 1, 0, 0, 1, 0, 0, 1 }, /* R */
473  { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
474  { 0, 1, 0, 3, 1, 0, 0, 1 }, /* B */
475  },
477  },
478  [AV_PIX_FMT_RGB8] = {
479  .name = "rgb8",
480  .nb_components = 3,
481  .log2_chroma_w = 0,
482  .log2_chroma_h = 0,
483  .comp = {
484  { 0, 1, 0, 6, 2, 0, 1, 1 }, /* R */
485  { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
486  { 0, 1, 0, 0, 3, 0, 2, 1 }, /* B */
487  },
489  },
490  [AV_PIX_FMT_RGB4] = {
491  .name = "rgb4",
492  .nb_components = 3,
493  .log2_chroma_w = 0,
494  .log2_chroma_h = 0,
495  .comp = {
496  { 0, 4, 0, 0, 1, 3, 0, 1 }, /* R */
497  { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
498  { 0, 4, 3, 0, 1, 3, 0, 4 }, /* B */
499  },
501  },
503  .name = "rgb4_byte",
504  .nb_components = 3,
505  .log2_chroma_w = 0,
506  .log2_chroma_h = 0,
507  .comp = {
508  { 0, 1, 0, 3, 1, 0, 0, 1 }, /* R */
509  { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
510  { 0, 1, 0, 0, 1, 0, 0, 1 }, /* B */
511  },
513  },
514  [AV_PIX_FMT_NV12] = {
515  .name = "nv12",
516  .nb_components = 3,
517  .log2_chroma_w = 1,
518  .log2_chroma_h = 1,
519  .comp = {
520  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
521  { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
522  { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
523  },
524  .flags = AV_PIX_FMT_FLAG_PLANAR,
525  },
526  [AV_PIX_FMT_NV21] = {
527  .name = "nv21",
528  .nb_components = 3,
529  .log2_chroma_w = 1,
530  .log2_chroma_h = 1,
531  .comp = {
532  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
533  { 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */
534  { 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */
535  },
536  .flags = AV_PIX_FMT_FLAG_PLANAR,
537  },
538  [AV_PIX_FMT_ARGB] = {
539  .name = "argb",
540  .nb_components = 4,
541  .log2_chroma_w = 0,
542  .log2_chroma_h = 0,
543  .comp = {
544  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
545  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
546  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
547  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
548  },
550  },
551  [AV_PIX_FMT_RGBA] = {
552  .name = "rgba",
553  .nb_components = 4,
554  .log2_chroma_w = 0,
555  .log2_chroma_h = 0,
556  .comp = {
557  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
558  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
559  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
560  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
561  },
563  },
564  [AV_PIX_FMT_ABGR] = {
565  .name = "abgr",
566  .nb_components = 4,
567  .log2_chroma_w = 0,
568  .log2_chroma_h = 0,
569  .comp = {
570  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
571  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
572  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
573  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
574  },
576  },
577  [AV_PIX_FMT_BGRA] = {
578  .name = "bgra",
579  .nb_components = 4,
580  .log2_chroma_w = 0,
581  .log2_chroma_h = 0,
582  .comp = {
583  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
584  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
585  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
586  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
587  },
589  },
590  [AV_PIX_FMT_0RGB] = {
591  .name = "0rgb",
592  .nb_components= 3,
593  .log2_chroma_w= 0,
594  .log2_chroma_h= 0,
595  .comp = {
596  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
597  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
598  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
599  },
600  .flags = AV_PIX_FMT_FLAG_RGB,
601  },
602  [AV_PIX_FMT_RGB0] = {
603  .name = "rgb0",
604  .nb_components= 3,
605  .log2_chroma_w= 0,
606  .log2_chroma_h= 0,
607  .comp = {
608  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
609  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
610  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
611  },
612  .flags = AV_PIX_FMT_FLAG_RGB,
613  },
614  [AV_PIX_FMT_0BGR] = {
615  .name = "0bgr",
616  .nb_components= 3,
617  .log2_chroma_w= 0,
618  .log2_chroma_h= 0,
619  .comp = {
620  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
621  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
622  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
623  },
624  .flags = AV_PIX_FMT_FLAG_RGB,
625  },
626  [AV_PIX_FMT_BGR0] = {
627  .name = "bgr0",
628  .nb_components= 3,
629  .log2_chroma_w= 0,
630  .log2_chroma_h= 0,
631  .comp = {
632  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
633  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
634  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
635  },
636  .flags = AV_PIX_FMT_FLAG_RGB,
637  },
638  [AV_PIX_FMT_GRAY9BE] = {
639  .name = "gray9be",
640  .nb_components = 1,
641  .log2_chroma_w = 0,
642  .log2_chroma_h = 0,
643  .comp = {
644  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
645  },
646  .flags = AV_PIX_FMT_FLAG_BE,
647  .alias = "y9be",
648  },
649  [AV_PIX_FMT_GRAY9LE] = {
650  .name = "gray9le",
651  .nb_components = 1,
652  .log2_chroma_w = 0,
653  .log2_chroma_h = 0,
654  .comp = {
655  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
656  },
657  .alias = "y9le",
658  },
659  [AV_PIX_FMT_GRAY10BE] = {
660  .name = "gray10be",
661  .nb_components = 1,
662  .log2_chroma_w = 0,
663  .log2_chroma_h = 0,
664  .comp = {
665  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
666  },
667  .flags = AV_PIX_FMT_FLAG_BE,
668  .alias = "y10be",
669  },
670  [AV_PIX_FMT_GRAY10LE] = {
671  .name = "gray10le",
672  .nb_components = 1,
673  .log2_chroma_w = 0,
674  .log2_chroma_h = 0,
675  .comp = {
676  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
677  },
678  .alias = "y10le",
679  },
680  [AV_PIX_FMT_GRAY12BE] = {
681  .name = "gray12be",
682  .nb_components = 1,
683  .log2_chroma_w = 0,
684  .log2_chroma_h = 0,
685  .comp = {
686  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
687  },
688  .flags = AV_PIX_FMT_FLAG_BE,
689  .alias = "y12be",
690  },
691  [AV_PIX_FMT_GRAY12LE] = {
692  .name = "gray12le",
693  .nb_components = 1,
694  .log2_chroma_w = 0,
695  .log2_chroma_h = 0,
696  .comp = {
697  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
698  },
699  .alias = "y12le",
700  },
701  [AV_PIX_FMT_GRAY14BE] = {
702  .name = "gray14be",
703  .nb_components = 1,
704  .log2_chroma_w = 0,
705  .log2_chroma_h = 0,
706  .comp = {
707  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
708  },
709  .flags = AV_PIX_FMT_FLAG_BE,
710  .alias = "y14be",
711  },
712  [AV_PIX_FMT_GRAY14LE] = {
713  .name = "gray14le",
714  .nb_components = 1,
715  .log2_chroma_w = 0,
716  .log2_chroma_h = 0,
717  .comp = {
718  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
719  },
720  .alias = "y14le",
721  },
722  [AV_PIX_FMT_GRAY16BE] = {
723  .name = "gray16be",
724  .nb_components = 1,
725  .log2_chroma_w = 0,
726  .log2_chroma_h = 0,
727  .comp = {
728  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
729  },
730  .flags = AV_PIX_FMT_FLAG_BE,
731  .alias = "y16be",
732  },
733  [AV_PIX_FMT_GRAY16LE] = {
734  .name = "gray16le",
735  .nb_components = 1,
736  .log2_chroma_w = 0,
737  .log2_chroma_h = 0,
738  .comp = {
739  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
740  },
741  .alias = "y16le",
742  },
743  [AV_PIX_FMT_YUV440P] = {
744  .name = "yuv440p",
745  .nb_components = 3,
746  .log2_chroma_w = 0,
747  .log2_chroma_h = 1,
748  .comp = {
749  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
750  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
751  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
752  },
753  .flags = AV_PIX_FMT_FLAG_PLANAR,
754  },
755  [AV_PIX_FMT_YUVJ440P] = {
756  .name = "yuvj440p",
757  .nb_components = 3,
758  .log2_chroma_w = 0,
759  .log2_chroma_h = 1,
760  .comp = {
761  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
762  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
763  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
764  },
765  .flags = AV_PIX_FMT_FLAG_PLANAR,
766  },
768  .name = "yuv440p10le",
769  .nb_components = 3,
770  .log2_chroma_w = 0,
771  .log2_chroma_h = 1,
772  .comp = {
773  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
774  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
775  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
776  },
777  .flags = AV_PIX_FMT_FLAG_PLANAR,
778  },
780  .name = "yuv440p10be",
781  .nb_components = 3,
782  .log2_chroma_w = 0,
783  .log2_chroma_h = 1,
784  .comp = {
785  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
786  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
787  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
788  },
790  },
792  .name = "yuv440p12le",
793  .nb_components = 3,
794  .log2_chroma_w = 0,
795  .log2_chroma_h = 1,
796  .comp = {
797  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
798  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
799  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
800  },
801  .flags = AV_PIX_FMT_FLAG_PLANAR,
802  },
804  .name = "yuv440p12be",
805  .nb_components = 3,
806  .log2_chroma_w = 0,
807  .log2_chroma_h = 1,
808  .comp = {
809  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
810  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
811  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
812  },
814  },
815  [AV_PIX_FMT_YUVA420P] = {
816  .name = "yuva420p",
817  .nb_components = 4,
818  .log2_chroma_w = 1,
819  .log2_chroma_h = 1,
820  .comp = {
821  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
822  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
823  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
824  { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
825  },
827  },
828  [AV_PIX_FMT_YUVA422P] = {
829  .name = "yuva422p",
830  .nb_components = 4,
831  .log2_chroma_w = 1,
832  .log2_chroma_h = 0,
833  .comp = {
834  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
835  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
836  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
837  { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
838  },
840  },
841  [AV_PIX_FMT_YUVA444P] = {
842  .name = "yuva444p",
843  .nb_components = 4,
844  .log2_chroma_w = 0,
845  .log2_chroma_h = 0,
846  .comp = {
847  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
848  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
849  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
850  { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
851  },
853  },
855  .name = "yuva420p9be",
856  .nb_components = 4,
857  .log2_chroma_w = 1,
858  .log2_chroma_h = 1,
859  .comp = {
860  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
861  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
862  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
863  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
864  },
866  },
868  .name = "yuva420p9le",
869  .nb_components = 4,
870  .log2_chroma_w = 1,
871  .log2_chroma_h = 1,
872  .comp = {
873  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
874  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
875  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
876  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
877  },
879  },
881  .name = "yuva422p9be",
882  .nb_components = 4,
883  .log2_chroma_w = 1,
884  .log2_chroma_h = 0,
885  .comp = {
886  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
887  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
888  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
889  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
890  },
892  },
894  .name = "yuva422p9le",
895  .nb_components = 4,
896  .log2_chroma_w = 1,
897  .log2_chroma_h = 0,
898  .comp = {
899  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
900  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
901  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
902  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
903  },
905  },
907  .name = "yuva444p9be",
908  .nb_components = 4,
909  .log2_chroma_w = 0,
910  .log2_chroma_h = 0,
911  .comp = {
912  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
913  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
914  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
915  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
916  },
918  },
920  .name = "yuva444p9le",
921  .nb_components = 4,
922  .log2_chroma_w = 0,
923  .log2_chroma_h = 0,
924  .comp = {
925  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
926  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
927  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
928  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
929  },
931  },
933  .name = "yuva420p10be",
934  .nb_components = 4,
935  .log2_chroma_w = 1,
936  .log2_chroma_h = 1,
937  .comp = {
938  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
939  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
940  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
941  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
942  },
944  },
946  .name = "yuva420p10le",
947  .nb_components = 4,
948  .log2_chroma_w = 1,
949  .log2_chroma_h = 1,
950  .comp = {
951  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
952  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
953  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
954  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
955  },
957  },
959  .name = "yuva422p10be",
960  .nb_components = 4,
961  .log2_chroma_w = 1,
962  .log2_chroma_h = 0,
963  .comp = {
964  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
965  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
966  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
967  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
968  },
970  },
972  .name = "yuva422p10le",
973  .nb_components = 4,
974  .log2_chroma_w = 1,
975  .log2_chroma_h = 0,
976  .comp = {
977  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
978  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
979  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
980  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
981  },
983  },
985  .name = "yuva444p10be",
986  .nb_components = 4,
987  .log2_chroma_w = 0,
988  .log2_chroma_h = 0,
989  .comp = {
990  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
991  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
992  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
993  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
994  },
996  },
998  .name = "yuva444p10le",
999  .nb_components = 4,
1000  .log2_chroma_w = 0,
1001  .log2_chroma_h = 0,
1002  .comp = {
1003  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1004  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1005  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1006  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
1007  },
1009  },
1011  .name = "yuva420p16be",
1012  .nb_components = 4,
1013  .log2_chroma_w = 1,
1014  .log2_chroma_h = 1,
1015  .comp = {
1016  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1017  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1018  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1019  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1020  },
1022  },
1024  .name = "yuva420p16le",
1025  .nb_components = 4,
1026  .log2_chroma_w = 1,
1027  .log2_chroma_h = 1,
1028  .comp = {
1029  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1030  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1031  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1032  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1033  },
1035  },
1037  .name = "yuva422p16be",
1038  .nb_components = 4,
1039  .log2_chroma_w = 1,
1040  .log2_chroma_h = 0,
1041  .comp = {
1042  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1043  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1044  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1045  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1046  },
1048  },
1050  .name = "yuva422p16le",
1051  .nb_components = 4,
1052  .log2_chroma_w = 1,
1053  .log2_chroma_h = 0,
1054  .comp = {
1055  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1056  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1057  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1058  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1059  },
1061  },
1063  .name = "yuva444p16be",
1064  .nb_components = 4,
1065  .log2_chroma_w = 0,
1066  .log2_chroma_h = 0,
1067  .comp = {
1068  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1069  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1070  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1071  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1072  },
1074  },
1076  .name = "yuva444p16le",
1077  .nb_components = 4,
1078  .log2_chroma_w = 0,
1079  .log2_chroma_h = 0,
1080  .comp = {
1081  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1082  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1083  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1084  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1085  },
1087  },
1088  [AV_PIX_FMT_RGB48BE] = {
1089  .name = "rgb48be",
1090  .nb_components = 3,
1091  .log2_chroma_w = 0,
1092  .log2_chroma_h = 0,
1093  .comp = {
1094  { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
1095  { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1096  { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
1097  },
1099  },
1100  [AV_PIX_FMT_RGB48LE] = {
1101  .name = "rgb48le",
1102  .nb_components = 3,
1103  .log2_chroma_w = 0,
1104  .log2_chroma_h = 0,
1105  .comp = {
1106  { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
1107  { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1108  { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
1109  },
1110  .flags = AV_PIX_FMT_FLAG_RGB,
1111  },
1112  [AV_PIX_FMT_RGBA64BE] = {
1113  .name = "rgba64be",
1114  .nb_components = 4,
1115  .log2_chroma_w = 0,
1116  .log2_chroma_h = 0,
1117  .comp = {
1118  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
1119  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1120  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1121  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1122  },
1124  },
1125  [AV_PIX_FMT_RGBA64LE] = {
1126  .name = "rgba64le",
1127  .nb_components = 4,
1128  .log2_chroma_w = 0,
1129  .log2_chroma_h = 0,
1130  .comp = {
1131  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
1132  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1133  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1134  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1135  },
1137  },
1138  [AV_PIX_FMT_RGB565BE] = {
1139  .name = "rgb565be",
1140  .nb_components = 3,
1141  .log2_chroma_w = 0,
1142  .log2_chroma_h = 0,
1143  .comp = {
1144  { 0, 2, -1, 3, 5, 1, 4, 0 }, /* R */
1145  { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1146  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1147  },
1149  },
1150  [AV_PIX_FMT_RGB565LE] = {
1151  .name = "rgb565le",
1152  .nb_components = 3,
1153  .log2_chroma_w = 0,
1154  .log2_chroma_h = 0,
1155  .comp = {
1156  { 0, 2, 1, 3, 5, 1, 4, 2 }, /* R */
1157  { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1158  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1159  },
1160  .flags = AV_PIX_FMT_FLAG_RGB,
1161  },
1162  [AV_PIX_FMT_RGB555BE] = {
1163  .name = "rgb555be",
1164  .nb_components = 3,
1165  .log2_chroma_w = 0,
1166  .log2_chroma_h = 0,
1167  .comp = {
1168  { 0, 2, -1, 2, 5, 1, 4, 0 }, /* R */
1169  { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1170  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1171  },
1173  },
1174  [AV_PIX_FMT_RGB555LE] = {
1175  .name = "rgb555le",
1176  .nb_components = 3,
1177  .log2_chroma_w = 0,
1178  .log2_chroma_h = 0,
1179  .comp = {
1180  { 0, 2, 1, 2, 5, 1, 4, 2 }, /* R */
1181  { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1182  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1183  },
1184  .flags = AV_PIX_FMT_FLAG_RGB,
1185  },
1186  [AV_PIX_FMT_RGB444BE] = {
1187  .name = "rgb444be",
1188  .nb_components = 3,
1189  .log2_chroma_w = 0,
1190  .log2_chroma_h = 0,
1191  .comp = {
1192  { 0, 2, -1, 0, 4, 1, 3, 0 }, /* R */
1193  { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1194  { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1195  },
1197  },
1198  [AV_PIX_FMT_RGB444LE] = {
1199  .name = "rgb444le",
1200  .nb_components = 3,
1201  .log2_chroma_w = 0,
1202  .log2_chroma_h = 0,
1203  .comp = {
1204  { 0, 2, 1, 0, 4, 1, 3, 2 }, /* R */
1205  { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1206  { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1207  },
1208  .flags = AV_PIX_FMT_FLAG_RGB,
1209  },
1210  [AV_PIX_FMT_BGR48BE] = {
1211  .name = "bgr48be",
1212  .nb_components = 3,
1213  .log2_chroma_w = 0,
1214  .log2_chroma_h = 0,
1215  .comp = {
1216  { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1217  { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1218  { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1219  },
1221  },
1222  [AV_PIX_FMT_BGR48LE] = {
1223  .name = "bgr48le",
1224  .nb_components = 3,
1225  .log2_chroma_w = 0,
1226  .log2_chroma_h = 0,
1227  .comp = {
1228  { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1229  { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1230  { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1231  },
1232  .flags = AV_PIX_FMT_FLAG_RGB,
1233  },
1234  [AV_PIX_FMT_BGRA64BE] = {
1235  .name = "bgra64be",
1236  .nb_components = 4,
1237  .log2_chroma_w = 0,
1238  .log2_chroma_h = 0,
1239  .comp = {
1240  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1241  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1242  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1243  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1244  },
1246  },
1247  [AV_PIX_FMT_BGRA64LE] = {
1248  .name = "bgra64le",
1249  .nb_components = 4,
1250  .log2_chroma_w = 0,
1251  .log2_chroma_h = 0,
1252  .comp = {
1253  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1254  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1255  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1256  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1257  },
1259  },
1260  [AV_PIX_FMT_BGR565BE] = {
1261  .name = "bgr565be",
1262  .nb_components = 3,
1263  .log2_chroma_w = 0,
1264  .log2_chroma_h = 0,
1265  .comp = {
1266  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1267  { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1268  { 0, 2, -1, 3, 5, 1, 4, 0 }, /* B */
1269  },
1271  },
1272  [AV_PIX_FMT_BGR565LE] = {
1273  .name = "bgr565le",
1274  .nb_components = 3,
1275  .log2_chroma_w = 0,
1276  .log2_chroma_h = 0,
1277  .comp = {
1278  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1279  { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1280  { 0, 2, 1, 3, 5, 1, 4, 2 }, /* B */
1281  },
1282  .flags = AV_PIX_FMT_FLAG_RGB,
1283  },
1284  [AV_PIX_FMT_BGR555BE] = {
1285  .name = "bgr555be",
1286  .nb_components = 3,
1287  .log2_chroma_w = 0,
1288  .log2_chroma_h = 0,
1289  .comp = {
1290  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1291  { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1292  { 0, 2, -1, 2, 5, 1, 4, 0 }, /* B */
1293  },
1295  },
1296  [AV_PIX_FMT_BGR555LE] = {
1297  .name = "bgr555le",
1298  .nb_components = 3,
1299  .log2_chroma_w = 0,
1300  .log2_chroma_h = 0,
1301  .comp = {
1302  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1303  { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1304  { 0, 2, 1, 2, 5, 1, 4, 2 }, /* B */
1305  },
1306  .flags = AV_PIX_FMT_FLAG_RGB,
1307  },
1308  [AV_PIX_FMT_BGR444BE] = {
1309  .name = "bgr444be",
1310  .nb_components = 3,
1311  .log2_chroma_w = 0,
1312  .log2_chroma_h = 0,
1313  .comp = {
1314  { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1315  { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1316  { 0, 2, -1, 0, 4, 1, 3, 0 }, /* B */
1317  },
1319  },
1320  [AV_PIX_FMT_BGR444LE] = {
1321  .name = "bgr444le",
1322  .nb_components = 3,
1323  .log2_chroma_w = 0,
1324  .log2_chroma_h = 0,
1325  .comp = {
1326  { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1327  { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1328  { 0, 2, 1, 0, 4, 1, 3, 2 }, /* B */
1329  },
1330  .flags = AV_PIX_FMT_FLAG_RGB,
1331  },
1332 #if FF_API_VAAPI
1333  [AV_PIX_FMT_VAAPI_MOCO] = {
1334  .name = "vaapi_moco",
1335  .log2_chroma_w = 1,
1336  .log2_chroma_h = 1,
1337  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1338  },
1339  [AV_PIX_FMT_VAAPI_IDCT] = {
1340  .name = "vaapi_idct",
1341  .log2_chroma_w = 1,
1342  .log2_chroma_h = 1,
1343  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1344  },
1345  [AV_PIX_FMT_VAAPI_VLD] = {
1346  .name = "vaapi_vld",
1347  .log2_chroma_w = 1,
1348  .log2_chroma_h = 1,
1349  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1350  },
1351 #else
1352  [AV_PIX_FMT_VAAPI] = {
1353  .name = "vaapi",
1354  .log2_chroma_w = 1,
1355  .log2_chroma_h = 1,
1356  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1357  },
1358 #endif
1359  [AV_PIX_FMT_YUV420P9LE] = {
1360  .name = "yuv420p9le",
1361  .nb_components = 3,
1362  .log2_chroma_w = 1,
1363  .log2_chroma_h = 1,
1364  .comp = {
1365  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1366  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1367  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1368  },
1369  .flags = AV_PIX_FMT_FLAG_PLANAR,
1370  },
1371  [AV_PIX_FMT_YUV420P9BE] = {
1372  .name = "yuv420p9be",
1373  .nb_components = 3,
1374  .log2_chroma_w = 1,
1375  .log2_chroma_h = 1,
1376  .comp = {
1377  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1378  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1379  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1380  },
1382  },
1384  .name = "yuv420p10le",
1385  .nb_components = 3,
1386  .log2_chroma_w = 1,
1387  .log2_chroma_h = 1,
1388  .comp = {
1389  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1390  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1391  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1392  },
1393  .flags = AV_PIX_FMT_FLAG_PLANAR,
1394  },
1396  .name = "yuv420p10be",
1397  .nb_components = 3,
1398  .log2_chroma_w = 1,
1399  .log2_chroma_h = 1,
1400  .comp = {
1401  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1402  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1403  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1404  },
1406  },
1408  .name = "yuv420p12le",
1409  .nb_components = 3,
1410  .log2_chroma_w = 1,
1411  .log2_chroma_h = 1,
1412  .comp = {
1413  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1414  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1415  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1416  },
1417  .flags = AV_PIX_FMT_FLAG_PLANAR,
1418  },
1420  .name = "yuv420p12be",
1421  .nb_components = 3,
1422  .log2_chroma_w = 1,
1423  .log2_chroma_h = 1,
1424  .comp = {
1425  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1426  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1427  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1428  },
1430  },
1432  .name = "yuv420p14le",
1433  .nb_components = 3,
1434  .log2_chroma_w = 1,
1435  .log2_chroma_h = 1,
1436  .comp = {
1437  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1438  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1439  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1440  },
1441  .flags = AV_PIX_FMT_FLAG_PLANAR,
1442  },
1444  .name = "yuv420p14be",
1445  .nb_components = 3,
1446  .log2_chroma_w = 1,
1447  .log2_chroma_h = 1,
1448  .comp = {
1449  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1450  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1451  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1452  },
1454  },
1456  .name = "yuv420p16le",
1457  .nb_components = 3,
1458  .log2_chroma_w = 1,
1459  .log2_chroma_h = 1,
1460  .comp = {
1461  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1462  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1463  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1464  },
1465  .flags = AV_PIX_FMT_FLAG_PLANAR,
1466  },
1468  .name = "yuv420p16be",
1469  .nb_components = 3,
1470  .log2_chroma_w = 1,
1471  .log2_chroma_h = 1,
1472  .comp = {
1473  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1474  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1475  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1476  },
1478  },
1479  [AV_PIX_FMT_YUV422P9LE] = {
1480  .name = "yuv422p9le",
1481  .nb_components = 3,
1482  .log2_chroma_w = 1,
1483  .log2_chroma_h = 0,
1484  .comp = {
1485  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1486  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1487  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1488  },
1489  .flags = AV_PIX_FMT_FLAG_PLANAR,
1490  },
1491  [AV_PIX_FMT_YUV422P9BE] = {
1492  .name = "yuv422p9be",
1493  .nb_components = 3,
1494  .log2_chroma_w = 1,
1495  .log2_chroma_h = 0,
1496  .comp = {
1497  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1498  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1499  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1500  },
1502  },
1504  .name = "yuv422p10le",
1505  .nb_components = 3,
1506  .log2_chroma_w = 1,
1507  .log2_chroma_h = 0,
1508  .comp = {
1509  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1510  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1511  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1512  },
1513  .flags = AV_PIX_FMT_FLAG_PLANAR,
1514  },
1516  .name = "yuv422p10be",
1517  .nb_components = 3,
1518  .log2_chroma_w = 1,
1519  .log2_chroma_h = 0,
1520  .comp = {
1521  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1522  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1523  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1524  },
1526  },
1528  .name = "yuv422p12le",
1529  .nb_components = 3,
1530  .log2_chroma_w = 1,
1531  .log2_chroma_h = 0,
1532  .comp = {
1533  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1534  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1535  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1536  },
1537  .flags = AV_PIX_FMT_FLAG_PLANAR,
1538  },
1540  .name = "yuv422p12be",
1541  .nb_components = 3,
1542  .log2_chroma_w = 1,
1543  .log2_chroma_h = 0,
1544  .comp = {
1545  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1546  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1547  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1548  },
1550  },
1552  .name = "yuv422p14le",
1553  .nb_components = 3,
1554  .log2_chroma_w = 1,
1555  .log2_chroma_h = 0,
1556  .comp = {
1557  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1558  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1559  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1560  },
1561  .flags = AV_PIX_FMT_FLAG_PLANAR,
1562  },
1564  .name = "yuv422p14be",
1565  .nb_components = 3,
1566  .log2_chroma_w = 1,
1567  .log2_chroma_h = 0,
1568  .comp = {
1569  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1570  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1571  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1572  },
1574  },
1576  .name = "yuv422p16le",
1577  .nb_components = 3,
1578  .log2_chroma_w = 1,
1579  .log2_chroma_h = 0,
1580  .comp = {
1581  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1582  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1583  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1584  },
1585  .flags = AV_PIX_FMT_FLAG_PLANAR,
1586  },
1588  .name = "yuv422p16be",
1589  .nb_components = 3,
1590  .log2_chroma_w = 1,
1591  .log2_chroma_h = 0,
1592  .comp = {
1593  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1594  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1595  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1596  },
1598  },
1600  .name = "yuv444p16le",
1601  .nb_components = 3,
1602  .log2_chroma_w = 0,
1603  .log2_chroma_h = 0,
1604  .comp = {
1605  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1606  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1607  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1608  },
1609  .flags = AV_PIX_FMT_FLAG_PLANAR,
1610  },
1612  .name = "yuv444p16be",
1613  .nb_components = 3,
1614  .log2_chroma_w = 0,
1615  .log2_chroma_h = 0,
1616  .comp = {
1617  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1618  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1619  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1620  },
1622  },
1624  .name = "yuv444p10le",
1625  .nb_components = 3,
1626  .log2_chroma_w = 0,
1627  .log2_chroma_h = 0,
1628  .comp = {
1629  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1630  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1631  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1632  },
1633  .flags = AV_PIX_FMT_FLAG_PLANAR,
1634  },
1636  .name = "yuv444p10be",
1637  .nb_components = 3,
1638  .log2_chroma_w = 0,
1639  .log2_chroma_h = 0,
1640  .comp = {
1641  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1642  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1643  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1644  },
1646  },
1647  [AV_PIX_FMT_YUV444P9LE] = {
1648  .name = "yuv444p9le",
1649  .nb_components = 3,
1650  .log2_chroma_w = 0,
1651  .log2_chroma_h = 0,
1652  .comp = {
1653  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1654  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1655  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1656  },
1657  .flags = AV_PIX_FMT_FLAG_PLANAR,
1658  },
1659  [AV_PIX_FMT_YUV444P9BE] = {
1660  .name = "yuv444p9be",
1661  .nb_components = 3,
1662  .log2_chroma_w = 0,
1663  .log2_chroma_h = 0,
1664  .comp = {
1665  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1666  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1667  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1668  },
1670  },
1672  .name = "yuv444p12le",
1673  .nb_components = 3,
1674  .log2_chroma_w = 0,
1675  .log2_chroma_h = 0,
1676  .comp = {
1677  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1678  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1679  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1680  },
1681  .flags = AV_PIX_FMT_FLAG_PLANAR,
1682  },
1684  .name = "yuv444p12be",
1685  .nb_components = 3,
1686  .log2_chroma_w = 0,
1687  .log2_chroma_h = 0,
1688  .comp = {
1689  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1690  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1691  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1692  },
1694  },
1696  .name = "yuv444p14le",
1697  .nb_components = 3,
1698  .log2_chroma_w = 0,
1699  .log2_chroma_h = 0,
1700  .comp = {
1701  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1702  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1703  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1704  },
1705  .flags = AV_PIX_FMT_FLAG_PLANAR,
1706  },
1708  .name = "yuv444p14be",
1709  .nb_components = 3,
1710  .log2_chroma_w = 0,
1711  .log2_chroma_h = 0,
1712  .comp = {
1713  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1714  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1715  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1716  },
1718  },
1720  .name = "d3d11va_vld",
1721  .log2_chroma_w = 1,
1722  .log2_chroma_h = 1,
1723  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1724  },
1725  [AV_PIX_FMT_DXVA2_VLD] = {
1726  .name = "dxva2_vld",
1727  .log2_chroma_w = 1,
1728  .log2_chroma_h = 1,
1729  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1730  },
1731  [AV_PIX_FMT_YA8] = {
1732  .name = "ya8",
1733  .nb_components = 2,
1734  .comp = {
1735  { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
1736  { 0, 2, 1, 0, 8, 1, 7, 2 }, /* A */
1737  },
1738  .flags = AV_PIX_FMT_FLAG_ALPHA,
1739  .alias = "gray8a",
1740  },
1741  [AV_PIX_FMT_YA16LE] = {
1742  .name = "ya16le",
1743  .nb_components = 2,
1744  .comp = {
1745  { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1746  { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1747  },
1748  .flags = AV_PIX_FMT_FLAG_ALPHA,
1749  },
1750  [AV_PIX_FMT_YA16BE] = {
1751  .name = "ya16be",
1752  .nb_components = 2,
1753  .comp = {
1754  { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1755  { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1756  },
1758  },
1760  .name = "videotoolbox_vld",
1761  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1762  },
1763  [AV_PIX_FMT_GBRP] = {
1764  .name = "gbrp",
1765  .nb_components = 3,
1766  .log2_chroma_w = 0,
1767  .log2_chroma_h = 0,
1768  .comp = {
1769  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1770  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1771  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1772  },
1774  },
1775  [AV_PIX_FMT_GBRP9LE] = {
1776  .name = "gbrp9le",
1777  .nb_components = 3,
1778  .log2_chroma_w = 0,
1779  .log2_chroma_h = 0,
1780  .comp = {
1781  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1782  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1783  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1784  },
1786  },
1787  [AV_PIX_FMT_GBRP9BE] = {
1788  .name = "gbrp9be",
1789  .nb_components = 3,
1790  .log2_chroma_w = 0,
1791  .log2_chroma_h = 0,
1792  .comp = {
1793  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1794  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1795  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1796  },
1798  },
1799  [AV_PIX_FMT_GBRP10LE] = {
1800  .name = "gbrp10le",
1801  .nb_components = 3,
1802  .log2_chroma_w = 0,
1803  .log2_chroma_h = 0,
1804  .comp = {
1805  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1806  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1807  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1808  },
1810  },
1811  [AV_PIX_FMT_GBRP10BE] = {
1812  .name = "gbrp10be",
1813  .nb_components = 3,
1814  .log2_chroma_w = 0,
1815  .log2_chroma_h = 0,
1816  .comp = {
1817  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1818  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1819  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1820  },
1822  },
1823  [AV_PIX_FMT_GBRP12LE] = {
1824  .name = "gbrp12le",
1825  .nb_components = 3,
1826  .log2_chroma_w = 0,
1827  .log2_chroma_h = 0,
1828  .comp = {
1829  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1830  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1831  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1832  },
1834  },
1835  [AV_PIX_FMT_GBRP12BE] = {
1836  .name = "gbrp12be",
1837  .nb_components = 3,
1838  .log2_chroma_w = 0,
1839  .log2_chroma_h = 0,
1840  .comp = {
1841  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1842  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1843  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1844  },
1846  },
1847  [AV_PIX_FMT_GBRP14LE] = {
1848  .name = "gbrp14le",
1849  .nb_components = 3,
1850  .log2_chroma_w = 0,
1851  .log2_chroma_h = 0,
1852  .comp = {
1853  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1854  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1855  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1856  },
1858  },
1859  [AV_PIX_FMT_GBRP14BE] = {
1860  .name = "gbrp14be",
1861  .nb_components = 3,
1862  .log2_chroma_w = 0,
1863  .log2_chroma_h = 0,
1864  .comp = {
1865  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1866  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1867  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1868  },
1870  },
1871  [AV_PIX_FMT_GBRP16LE] = {
1872  .name = "gbrp16le",
1873  .nb_components = 3,
1874  .log2_chroma_w = 0,
1875  .log2_chroma_h = 0,
1876  .comp = {
1877  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1878  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1879  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1880  },
1882  },
1883  [AV_PIX_FMT_GBRP16BE] = {
1884  .name = "gbrp16be",
1885  .nb_components = 3,
1886  .log2_chroma_w = 0,
1887  .log2_chroma_h = 0,
1888  .comp = {
1889  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1890  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1891  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1892  },
1894  },
1895  [AV_PIX_FMT_GBRAP] = {
1896  .name = "gbrap",
1897  .nb_components = 4,
1898  .log2_chroma_w = 0,
1899  .log2_chroma_h = 0,
1900  .comp = {
1901  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1902  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1903  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1904  { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
1905  },
1908  },
1909  [AV_PIX_FMT_GBRAP16LE] = {
1910  .name = "gbrap16le",
1911  .nb_components = 4,
1912  .log2_chroma_w = 0,
1913  .log2_chroma_h = 0,
1914  .comp = {
1915  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1916  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1917  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1918  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1919  },
1922  },
1923  [AV_PIX_FMT_GBRAP16BE] = {
1924  .name = "gbrap16be",
1925  .nb_components = 4,
1926  .log2_chroma_w = 0,
1927  .log2_chroma_h = 0,
1928  .comp = {
1929  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1930  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1931  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1932  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1933  },
1936  },
1937  [AV_PIX_FMT_VDPAU] = {
1938  .name = "vdpau",
1939  .log2_chroma_w = 1,
1940  .log2_chroma_h = 1,
1941  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1942  },
1943  [AV_PIX_FMT_XYZ12LE] = {
1944  .name = "xyz12le",
1945  .nb_components = 3,
1946  .log2_chroma_w = 0,
1947  .log2_chroma_h = 0,
1948  .comp = {
1949  { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1950  { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1951  { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1952  },
1953  /*.flags = -- not used*/
1954  },
1955  [AV_PIX_FMT_XYZ12BE] = {
1956  .name = "xyz12be",
1957  .nb_components = 3,
1958  .log2_chroma_w = 0,
1959  .log2_chroma_h = 0,
1960  .comp = {
1961  { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1962  { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1963  { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1964  },
1965  .flags = AV_PIX_FMT_FLAG_BE,
1966  },
1967 
1968 #define BAYER8_DESC_COMMON \
1969  .nb_components= 3, \
1970  .log2_chroma_w= 0, \
1971  .log2_chroma_h= 0, \
1972  .comp = { \
1973  {0,1,0,0,2,0,1,1},\
1974  {0,1,0,0,4,0,3,1},\
1975  {0,1,0,0,2,0,1,1},\
1976  }, \
1977 
1978 #define BAYER16_DESC_COMMON \
1979  .nb_components= 3, \
1980  .log2_chroma_w= 0, \
1981  .log2_chroma_h= 0, \
1982  .comp = { \
1983  {0,2,0,0,4,1,3,1},\
1984  {0,2,0,0,8,1,7,1},\
1985  {0,2,0,0,4,1,3,1},\
1986  }, \
1987 
1989  .name = "bayer_bggr8",
1992  },
1994  .name = "bayer_bggr16le",
1997  },
1999  .name = "bayer_bggr16be",
2002  },
2004  .name = "bayer_rggb8",
2007  },
2009  .name = "bayer_rggb16le",
2012  },
2014  .name = "bayer_rggb16be",
2017  },
2019  .name = "bayer_gbrg8",
2022  },
2024  .name = "bayer_gbrg16le",
2027  },
2029  .name = "bayer_gbrg16be",
2032  },
2034  .name = "bayer_grbg8",
2037  },
2039  .name = "bayer_grbg16le",
2042  },
2044  .name = "bayer_grbg16be",
2047  },
2048  [AV_PIX_FMT_NV16] = {
2049  .name = "nv16",
2050  .nb_components = 3,
2051  .log2_chroma_w = 1,
2052  .log2_chroma_h = 0,
2053  .comp = {
2054  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
2055  { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
2056  { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
2057  },
2058  .flags = AV_PIX_FMT_FLAG_PLANAR,
2059  },
2060  [AV_PIX_FMT_NV20LE] = {
2061  .name = "nv20le",
2062  .nb_components = 3,
2063  .log2_chroma_w = 1,
2064  .log2_chroma_h = 0,
2065  .comp = {
2066  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
2067  { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
2068  { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
2069  },
2070  .flags = AV_PIX_FMT_FLAG_PLANAR,
2071  },
2072  [AV_PIX_FMT_NV20BE] = {
2073  .name = "nv20be",
2074  .nb_components = 3,
2075  .log2_chroma_w = 1,
2076  .log2_chroma_h = 0,
2077  .comp = {
2078  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
2079  { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
2080  { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
2081  },
2083  },
2084  [AV_PIX_FMT_QSV] = {
2085  .name = "qsv",
2086  .flags = AV_PIX_FMT_FLAG_HWACCEL,
2087  },
2088  [AV_PIX_FMT_MEDIACODEC] = {
2089  .name = "mediacodec",
2090  .flags = AV_PIX_FMT_FLAG_HWACCEL,
2091  },
2092  [AV_PIX_FMT_MMAL] = {
2093  .name = "mmal",
2094  .flags = AV_PIX_FMT_FLAG_HWACCEL,
2095  },
2096  [AV_PIX_FMT_CUDA] = {
2097  .name = "cuda",
2098  .flags = AV_PIX_FMT_FLAG_HWACCEL,
2099  },
2100  [AV_PIX_FMT_AYUV64LE] = {
2101  .name = "ayuv64le",
2102  .nb_components = 4,
2103  .log2_chroma_w = 0,
2104  .log2_chroma_h = 0,
2105  .comp = {
2106  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
2107  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2108  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2109  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2110  },
2111  .flags = AV_PIX_FMT_FLAG_ALPHA,
2112  },
2113  [AV_PIX_FMT_AYUV64BE] = {
2114  .name = "ayuv64be",
2115  .nb_components = 4,
2116  .log2_chroma_w = 0,
2117  .log2_chroma_h = 0,
2118  .comp = {
2119  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
2120  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2121  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2122  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2123  },
2125  },
2126  [AV_PIX_FMT_P010LE] = {
2127  .name = "p010le",
2128  .nb_components = 3,
2129  .log2_chroma_w = 1,
2130  .log2_chroma_h = 1,
2131  .comp = {
2132  { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2133  { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2134  { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2135  },
2136  .flags = AV_PIX_FMT_FLAG_PLANAR,
2137  },
2138  [AV_PIX_FMT_P010BE] = {
2139  .name = "p010be",
2140  .nb_components = 3,
2141  .log2_chroma_w = 1,
2142  .log2_chroma_h = 1,
2143  .comp = {
2144  { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2145  { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2146  { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2147  },
2149  },
2150  [AV_PIX_FMT_P016LE] = {
2151  .name = "p016le",
2152  .nb_components = 3,
2153  .log2_chroma_w = 1,
2154  .log2_chroma_h = 1,
2155  .comp = {
2156  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
2157  { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
2158  { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
2159  },
2160  .flags = AV_PIX_FMT_FLAG_PLANAR,
2161  },
2162  [AV_PIX_FMT_P016BE] = {
2163  .name = "p016be",
2164  .nb_components = 3,
2165  .log2_chroma_w = 1,
2166  .log2_chroma_h = 1,
2167  .comp = {
2168  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
2169  { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
2170  { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
2171  },
2173  },
2174  [AV_PIX_FMT_GBRAP12LE] = {
2175  .name = "gbrap12le",
2176  .nb_components = 4,
2177  .log2_chroma_w = 0,
2178  .log2_chroma_h = 0,
2179  .comp = {
2180  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2181  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2182  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2183  { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2184  },
2187  },
2188  [AV_PIX_FMT_GBRAP12BE] = {
2189  .name = "gbrap12be",
2190  .nb_components = 4,
2191  .log2_chroma_w = 0,
2192  .log2_chroma_h = 0,
2193  .comp = {
2194  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2195  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2196  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2197  { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2198  },
2201  },
2202  [AV_PIX_FMT_GBRAP10LE] = {
2203  .name = "gbrap10le",
2204  .nb_components = 4,
2205  .log2_chroma_w = 0,
2206  .log2_chroma_h = 0,
2207  .comp = {
2208  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2209  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2210  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2211  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2212  },
2215  },
2216  [AV_PIX_FMT_GBRAP10BE] = {
2217  .name = "gbrap10be",
2218  .nb_components = 4,
2219  .log2_chroma_w = 0,
2220  .log2_chroma_h = 0,
2221  .comp = {
2222  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2223  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2224  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2225  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2226  },
2229  },
2230  [AV_PIX_FMT_D3D11] = {
2231  .name = "d3d11",
2232  .flags = AV_PIX_FMT_FLAG_HWACCEL,
2233  },
2234  [AV_PIX_FMT_GBRPF32BE] = {
2235  .name = "gbrpf32be",
2236  .nb_components = 3,
2237  .log2_chroma_w = 0,
2238  .log2_chroma_h = 0,
2239  .comp = {
2240  { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2241  { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2242  { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2243  },
2246  },
2247  [AV_PIX_FMT_GBRPF32LE] = {
2248  .name = "gbrpf32le",
2249  .nb_components = 3,
2250  .log2_chroma_w = 0,
2251  .log2_chroma_h = 0,
2252  .comp = {
2253  { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2254  { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2255  { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2256  },
2258  },
2259  [AV_PIX_FMT_GBRAPF32BE] = {
2260  .name = "gbrapf32be",
2261  .nb_components = 4,
2262  .log2_chroma_w = 0,
2263  .log2_chroma_h = 0,
2264  .comp = {
2265  { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2266  { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2267  { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2268  { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
2269  },
2273  },
2274  [AV_PIX_FMT_GBRAPF32LE] = {
2275  .name = "gbrapf32le",
2276  .nb_components = 4,
2277  .log2_chroma_w = 0,
2278  .log2_chroma_h = 0,
2279  .comp = {
2280  { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
2281  { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
2282  { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
2283  { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
2284  },
2287  },
2288  [AV_PIX_FMT_DRM_PRIME] = {
2289  .name = "drm_prime",
2290  .flags = AV_PIX_FMT_FLAG_HWACCEL,
2291  },
2292  [AV_PIX_FMT_OPENCL] = {
2293  .name = "opencl",
2294  .flags = AV_PIX_FMT_FLAG_HWACCEL,
2295  },
2296  [AV_PIX_FMT_GRAYF32BE] = {
2297  .name = "grayf32be",
2298  .nb_components = 1,
2299  .log2_chroma_w = 0,
2300  .log2_chroma_h = 0,
2301  .comp = {
2302  { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */
2303  },
2305  .alias = "yf32be",
2306  },
2307  [AV_PIX_FMT_GRAYF32LE] = {
2308  .name = "grayf32le",
2309  .nb_components = 1,
2310  .log2_chroma_w = 0,
2311  .log2_chroma_h = 0,
2312  .comp = {
2313  { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */
2314  },
2315  .flags = AV_PIX_FMT_FLAG_FLOAT,
2316  .alias = "yf32le",
2317  },
2319  .name = "yuva422p12be",
2320  .nb_components = 4,
2321  .log2_chroma_w = 1,
2322  .log2_chroma_h = 0,
2323  .comp = {
2324  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
2325  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
2326  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
2327  { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2328  },
2330  },
2332  .name = "yuva422p12le",
2333  .nb_components = 4,
2334  .log2_chroma_w = 1,
2335  .log2_chroma_h = 0,
2336  .comp = {
2337  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
2338  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
2339  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
2340  { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2341  },
2343  },
2345  .name = "yuva444p12be",
2346  .nb_components = 4,
2347  .log2_chroma_w = 0,
2348  .log2_chroma_h = 0,
2349  .comp = {
2350  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
2351  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
2352  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
2353  { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2354  },
2356  },
2358  .name = "yuva444p12le",
2359  .nb_components = 4,
2360  .log2_chroma_w = 0,
2361  .log2_chroma_h = 0,
2362  .comp = {
2363  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
2364  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
2365  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
2366  { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2367  },
2369  },
2370  [AV_PIX_FMT_NV24] = {
2371  .name = "nv24",
2372  .nb_components = 3,
2373  .log2_chroma_w = 0,
2374  .log2_chroma_h = 0,
2375  .comp = {
2376  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
2377  { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
2378  { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
2379  },
2380  .flags = AV_PIX_FMT_FLAG_PLANAR,
2381  },
2382  [AV_PIX_FMT_NV42] = {
2383  .name = "nv42",
2384  .nb_components = 3,
2385  .log2_chroma_w = 0,
2386  .log2_chroma_h = 0,
2387  .comp = {
2388  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
2389  { 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */
2390  { 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */
2391  },
2392  .flags = AV_PIX_FMT_FLAG_PLANAR,
2393  },
2394  [AV_PIX_FMT_VULKAN] = {
2395  .name = "vulkan",
2396  .flags = AV_PIX_FMT_FLAG_HWACCEL,
2397  },
2398 };
2399 #if FF_API_PLUS1_MINUS1
2401 #endif
2402 
2403 static const char * const color_range_names[] = {
2404  [AVCOL_RANGE_UNSPECIFIED] = "unknown",
2405  [AVCOL_RANGE_MPEG] = "tv",
2406  [AVCOL_RANGE_JPEG] = "pc",
2407 };
2408 
2409 static const char * const color_primaries_names[AVCOL_PRI_NB] = {
2410  [AVCOL_PRI_RESERVED0] = "reserved",
2411  [AVCOL_PRI_BT709] = "bt709",
2412  [AVCOL_PRI_UNSPECIFIED] = "unknown",
2413  [AVCOL_PRI_RESERVED] = "reserved",
2414  [AVCOL_PRI_BT470M] = "bt470m",
2415  [AVCOL_PRI_BT470BG] = "bt470bg",
2416  [AVCOL_PRI_SMPTE170M] = "smpte170m",
2417  [AVCOL_PRI_SMPTE240M] = "smpte240m",
2418  [AVCOL_PRI_FILM] = "film",
2419  [AVCOL_PRI_BT2020] = "bt2020",
2420  [AVCOL_PRI_SMPTE428] = "smpte428",
2421  [AVCOL_PRI_SMPTE431] = "smpte431",
2422  [AVCOL_PRI_SMPTE432] = "smpte432",
2423  [AVCOL_PRI_EBU3213] = "ebu3213",
2424 };
2425 
2426 static const char * const color_transfer_names[] = {
2427  [AVCOL_TRC_RESERVED0] = "reserved",
2428  [AVCOL_TRC_BT709] = "bt709",
2429  [AVCOL_TRC_UNSPECIFIED] = "unknown",
2430  [AVCOL_TRC_RESERVED] = "reserved",
2431  [AVCOL_TRC_GAMMA22] = "bt470m",
2432  [AVCOL_TRC_GAMMA28] = "bt470bg",
2433  [AVCOL_TRC_SMPTE170M] = "smpte170m",
2434  [AVCOL_TRC_SMPTE240M] = "smpte240m",
2435  [AVCOL_TRC_LINEAR] = "linear",
2436  [AVCOL_TRC_LOG] = "log100",
2437  [AVCOL_TRC_LOG_SQRT] = "log316",
2438  [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
2439  [AVCOL_TRC_BT1361_ECG] = "bt1361e",
2440  [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
2441  [AVCOL_TRC_BT2020_10] = "bt2020-10",
2442  [AVCOL_TRC_BT2020_12] = "bt2020-12",
2443  [AVCOL_TRC_SMPTE2084] = "smpte2084",
2444  [AVCOL_TRC_SMPTE428] = "smpte428",
2445  [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
2446 };
2447 
2448 static const char * const color_space_names[] = {
2449  [AVCOL_SPC_RGB] = "gbr",
2450  [AVCOL_SPC_BT709] = "bt709",
2451  [AVCOL_SPC_UNSPECIFIED] = "unknown",
2452  [AVCOL_SPC_RESERVED] = "reserved",
2453  [AVCOL_SPC_FCC] = "fcc",
2454  [AVCOL_SPC_BT470BG] = "bt470bg",
2455  [AVCOL_SPC_SMPTE170M] = "smpte170m",
2456  [AVCOL_SPC_SMPTE240M] = "smpte240m",
2457  [AVCOL_SPC_YCGCO] = "ycgco",
2458  [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
2459  [AVCOL_SPC_BT2020_CL] = "bt2020c",
2460  [AVCOL_SPC_SMPTE2085] = "smpte2085",
2461  [AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
2462  [AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
2463  [AVCOL_SPC_ICTCP] = "ictcp",
2464 };
2465 
2466 static const char * const chroma_location_names[] = {
2467  [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
2468  [AVCHROMA_LOC_LEFT] = "left",
2469  [AVCHROMA_LOC_CENTER] = "center",
2470  [AVCHROMA_LOC_TOPLEFT] = "topleft",
2471  [AVCHROMA_LOC_TOP] = "top",
2472  [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
2473  [AVCHROMA_LOC_BOTTOM] = "bottom",
2474 };
2475 
2476 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
2477 {
2478  enum AVPixelFormat pix_fmt;
2479 
2480  for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
2481  if (av_pix_fmt_descriptors[pix_fmt].name &&
2482  (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
2483  av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
2484  return pix_fmt;
2485 
2486  return AV_PIX_FMT_NONE;
2487 }
2488 
2490 {
2491  return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
2492  av_pix_fmt_descriptors[pix_fmt].name : NULL;
2493 }
2494 
2495 #if HAVE_BIGENDIAN
2496 # define X_NE(be, le) be
2497 #else
2498 # define X_NE(be, le) le
2499 #endif
2500 
2502 {
2503  enum AVPixelFormat pix_fmt;
2504 
2505  if (!strcmp(name, "rgb32"))
2506  name = X_NE("argb", "bgra");
2507  else if (!strcmp(name, "bgr32"))
2508  name = X_NE("abgr", "rgba");
2509 
2510  pix_fmt = get_pix_fmt_internal(name);
2511  if (pix_fmt == AV_PIX_FMT_NONE) {
2512  char name2[32];
2513 
2514  snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
2515  pix_fmt = get_pix_fmt_internal(name2);
2516  }
2517 
2518 #if FF_API_VAAPI
2519  if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
2520  pix_fmt = AV_PIX_FMT_VAAPI;
2521 #endif
2522  return pix_fmt;
2523 }
2524 
2526 {
2527  int c, bits = 0;
2528  int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2529 
2530  for (c = 0; c < pixdesc->nb_components; c++) {
2531  int s = c == 1 || c == 2 ? 0 : log2_pixels;
2532  bits += pixdesc->comp[c].depth << s;
2533  }
2534 
2535  return bits >> log2_pixels;
2536 }
2537 
2539 {
2540  int c, bits = 0;
2541  int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2542  int steps[4] = {0};
2543 
2544  for (c = 0; c < pixdesc->nb_components; c++) {
2545  const AVComponentDescriptor *comp = &pixdesc->comp[c];
2546  int s = c == 1 || c == 2 ? 0 : log2_pixels;
2547  steps[comp->plane] = comp->step << s;
2548  }
2549  for (c = 0; c < 4; c++)
2550  bits += steps[c];
2551 
2552  if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
2553  bits *= 8;
2554 
2555  return bits >> log2_pixels;
2556 }
2557 
2558 char *av_get_pix_fmt_string(char *buf, int buf_size,
2559  enum AVPixelFormat pix_fmt)
2560 {
2561  /* print header */
2562  if (pix_fmt < 0) {
2563  snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
2564  } else {
2565  const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
2566  snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
2567  pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
2568  }
2569 
2570  return buf;
2571 }
2572 
2574 {
2575  if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
2576  return NULL;
2577  return &av_pix_fmt_descriptors[pix_fmt];
2578 }
2579 
2581 {
2582  if (!prev)
2583  return &av_pix_fmt_descriptors[0];
2584  while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
2585  prev++;
2586  if (prev->name)
2587  return prev;
2588  }
2589  return NULL;
2590 }
2591 
2593 {
2594  if (desc < av_pix_fmt_descriptors ||
2595  desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
2596  return AV_PIX_FMT_NONE;
2597 
2598  return desc - av_pix_fmt_descriptors;
2599 }
2600 
2602  int *h_shift, int *v_shift)
2603 {
2604  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2605  if (!desc)
2606  return AVERROR(ENOSYS);
2607  *h_shift = desc->log2_chroma_w;
2608  *v_shift = desc->log2_chroma_h;
2609 
2610  return 0;
2611 }
2612 
2614 {
2615  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2616  int i, planes[4] = { 0 }, ret = 0;
2617 
2618  if (!desc)
2619  return AVERROR(EINVAL);
2620 
2621  for (i = 0; i < desc->nb_components; i++)
2622  planes[desc->comp[i].plane] = 1;
2623  for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
2624  ret += planes[i];
2625  return ret;
2626 }
2627 
2629  int i, j;
2630 
2631  for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
2632  const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
2633  uint8_t fill[4][8+6+3] = {{0}};
2634  uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
2635  int linesize[4] = {0,0,0,0};
2636  uint16_t tmp[2];
2637 
2638  if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
2639  continue;
2640 // av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
2641  av_assert0(d->log2_chroma_w <= 3);
2642  av_assert0(d->log2_chroma_h <= 3);
2643  av_assert0(d->nb_components <= 4);
2644  av_assert0(d->name && d->name[0]);
2645  av_assert2(av_get_pix_fmt(d->name) == i);
2646 
2647  for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
2648  const AVComponentDescriptor *c = &d->comp[j];
2649  if(j>=d->nb_components) {
2650  av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
2651  continue;
2652  }
2653  if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
2654  av_assert0(c->step >= c->depth);
2655  } else {
2656  av_assert0(8*c->step >= c->depth);
2657  }
2658  if (d->flags & AV_PIX_FMT_FLAG_BAYER)
2659  continue;
2660  av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
2661  av_assert0(tmp[0] == 0 && tmp[1] == 0);
2662  tmp[0] = tmp[1] = (1<<c->depth) - 1;
2663  av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
2664  }
2665  }
2666 }
2667 
2668 
2670 {
2671  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2672  char name[16];
2673  int i;
2674 
2675  if (!desc || strlen(desc->name) < 2)
2676  return AV_PIX_FMT_NONE;
2677  av_strlcpy(name, desc->name, sizeof(name));
2678  i = strlen(name) - 2;
2679  if (strcmp(name + i, "be") && strcmp(name + i, "le"))
2680  return AV_PIX_FMT_NONE;
2681 
2682  name[i] ^= 'b' ^ 'l';
2683 
2684  return get_pix_fmt_internal(name);
2685 }
2686 
2687 #define FF_COLOR_NA -1
2688 #define FF_COLOR_RGB 0 /**< RGB color space */
2689 #define FF_COLOR_GRAY 1 /**< gray color space */
2690 #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
2691 #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
2692 #define FF_COLOR_XYZ 4
2693 
2694 #define pixdesc_has_alpha(pixdesc) \
2695  ((pixdesc)->flags & AV_PIX_FMT_FLAG_ALPHA)
2696 
2697 
2699  if (desc->flags & AV_PIX_FMT_FLAG_PAL)
2700  return FF_COLOR_RGB;
2701 
2702  if(desc->nb_components == 1 || desc->nb_components == 2)
2703  return FF_COLOR_GRAY;
2704 
2705  if(desc->name && !strncmp(desc->name, "yuvj", 4))
2706  return FF_COLOR_YUV_JPEG;
2707 
2708  if(desc->name && !strncmp(desc->name, "xyz", 3))
2709  return FF_COLOR_XYZ;
2710 
2711  if(desc->flags & AV_PIX_FMT_FLAG_RGB)
2712  return FF_COLOR_RGB;
2713 
2714  if(desc->nb_components == 0)
2715  return FF_COLOR_NA;
2716 
2717  return FF_COLOR_YUV;
2718 }
2719 
2720 static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
2721 {
2722  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2723  int i;
2724 
2725  if (!desc || !desc->nb_components) {
2726  *min = *max = 0;
2727  return AVERROR(EINVAL);
2728  }
2729 
2730  *min = INT_MAX, *max = -INT_MAX;
2731  for (i = 0; i < desc->nb_components; i++) {
2732  *min = FFMIN(desc->comp[i].depth, *min);
2733  *max = FFMAX(desc->comp[i].depth, *max);
2734  }
2735  return 0;
2736 }
2737 
2738 static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
2739  enum AVPixelFormat src_pix_fmt,
2740  unsigned *lossp, unsigned consider)
2741 {
2742  const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
2743  const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
2744  int src_color, dst_color;
2745  int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
2746  int ret, loss, i, nb_components;
2747  int score = INT_MAX - 1;
2748 
2749  if (!src_desc || !dst_desc)
2750  return -4;
2751 
2752  if ((src_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) ||
2753  (dst_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
2754  if (dst_pix_fmt == src_pix_fmt)
2755  return -1;
2756  else
2757  return -2;
2758  }
2759 
2760  /* compute loss */
2761  *lossp = loss = 0;
2762 
2763  if (dst_pix_fmt == src_pix_fmt)
2764  return INT_MAX;
2765 
2766  if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
2767  return -3;
2768  if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
2769  return -3;
2770 
2771  src_color = get_color_type(src_desc);
2772  dst_color = get_color_type(dst_desc);
2773  if (dst_pix_fmt == AV_PIX_FMT_PAL8)
2774  nb_components = FFMIN(src_desc->nb_components, 4);
2775  else
2776  nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
2777 
2778  for (i = 0; i < nb_components; i++) {
2779  int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
2780  if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
2781  loss |= FF_LOSS_DEPTH;
2782  score -= 65536 >> depth_minus1;
2783  }
2784  }
2785 
2786  if (consider & FF_LOSS_RESOLUTION) {
2787  if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
2788  loss |= FF_LOSS_RESOLUTION;
2789  score -= 256 << dst_desc->log2_chroma_w;
2790  }
2791  if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
2792  loss |= FF_LOSS_RESOLUTION;
2793  score -= 256 << dst_desc->log2_chroma_h;
2794  }
2795  // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
2796  if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
2797  dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
2798  score += 512;
2799  }
2800  }
2801 
2802  if(consider & FF_LOSS_COLORSPACE)
2803  switch(dst_color) {
2804  case FF_COLOR_RGB:
2805  if (src_color != FF_COLOR_RGB &&
2806  src_color != FF_COLOR_GRAY)
2807  loss |= FF_LOSS_COLORSPACE;
2808  break;
2809  case FF_COLOR_GRAY:
2810  if (src_color != FF_COLOR_GRAY)
2811  loss |= FF_LOSS_COLORSPACE;
2812  break;
2813  case FF_COLOR_YUV:
2814  if (src_color != FF_COLOR_YUV)
2815  loss |= FF_LOSS_COLORSPACE;
2816  break;
2817  case FF_COLOR_YUV_JPEG:
2818  if (src_color != FF_COLOR_YUV_JPEG &&
2819  src_color != FF_COLOR_YUV &&
2820  src_color != FF_COLOR_GRAY)
2821  loss |= FF_LOSS_COLORSPACE;
2822  break;
2823  default:
2824  /* fail safe test */
2825  if (src_color != dst_color)
2826  loss |= FF_LOSS_COLORSPACE;
2827  break;
2828  }
2829  if(loss & FF_LOSS_COLORSPACE)
2830  score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
2831 
2832  if (dst_color == FF_COLOR_GRAY &&
2833  src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
2834  loss |= FF_LOSS_CHROMA;
2835  score -= 2 * 65536;
2836  }
2837  if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
2838  loss |= FF_LOSS_ALPHA;
2839  score -= 65536;
2840  }
2841  if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
2842  (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
2843  loss |= FF_LOSS_COLORQUANT;
2844  score -= 65536;
2845  }
2846 
2847  *lossp = loss;
2848  return score;
2849 }
2850 
2851 int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
2852  enum AVPixelFormat src_pix_fmt,
2853  int has_alpha)
2854 {
2855  int loss;
2856  int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
2857  if (ret < 0)
2858  return ret;
2859  return loss;
2860 }
2861 
2862 enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
2863  enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
2864 {
2865  enum AVPixelFormat dst_pix_fmt;
2866  int loss1, loss2, loss_mask;
2867  const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
2868  const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
2869  int score1, score2;
2870 
2871  if (!desc1) {
2872  dst_pix_fmt = dst_pix_fmt2;
2873  } else if (!desc2) {
2874  dst_pix_fmt = dst_pix_fmt1;
2875  } else {
2876  loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
2877  if(!has_alpha)
2878  loss_mask &= ~FF_LOSS_ALPHA;
2879 
2880  score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
2881  score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
2882 
2883  if (score1 == score2) {
2885  dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
2886  } else {
2887  dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
2888  }
2889  } else {
2890  dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
2891  }
2892  }
2893 
2894  if (loss_ptr)
2895  *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
2896  return dst_pix_fmt;
2897 }
2898 
2899 const char *av_color_range_name(enum AVColorRange range)
2900 {
2901  return (unsigned) range < AVCOL_RANGE_NB ?
2902  color_range_names[range] : NULL;
2903 }
2904 
2906 {
2907  int i;
2908 
2909  for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
2910  size_t len = strlen(color_range_names[i]);
2911  if (!strncmp(color_range_names[i], name, len))
2912  return i;
2913  }
2914 
2915  return AVERROR(EINVAL);
2916 }
2917 
2918 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
2919 {
2920  return (unsigned) primaries < AVCOL_PRI_NB ?
2921  color_primaries_names[primaries] : NULL;
2922 }
2923 
2925 {
2926  int i;
2927 
2928  for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) {
2929  size_t len;
2930 
2931  if (!color_primaries_names[i])
2932  continue;
2933 
2934  len = strlen(color_primaries_names[i]);
2935  if (!strncmp(color_primaries_names[i], name, len))
2936  return i;
2937  }
2938 
2939  return AVERROR(EINVAL);
2940 }
2941 
2943 {
2944  return (unsigned) transfer < AVCOL_TRC_NB ?
2945  color_transfer_names[transfer] : NULL;
2946 }
2947 
2949 {
2950  int i;
2951 
2952  for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) {
2953  size_t len;
2954 
2955  if (!color_transfer_names[i])
2956  continue;
2957 
2958  len = strlen(color_transfer_names[i]);
2959  if (!strncmp(color_transfer_names[i], name, len))
2960  return i;
2961  }
2962 
2963  return AVERROR(EINVAL);
2964 }
2965 
2967 {
2968  return (unsigned) space < AVCOL_SPC_NB ?
2970 }
2971 
2973 {
2974  int i;
2975 
2976  for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) {
2977  size_t len;
2978 
2979  if (!color_space_names[i])
2980  continue;
2981 
2982  len = strlen(color_space_names[i]);
2983  if (!strncmp(color_space_names[i], name, len))
2984  return i;
2985  }
2986 
2987  return AVERROR(EINVAL);
2988 }
2989 
2990 const char *av_chroma_location_name(enum AVChromaLocation location)
2991 {
2992  return (unsigned) location < AVCHROMA_LOC_NB ?
2993  chroma_location_names[location] : NULL;
2994 }
2995 
2997 {
2998  int i;
2999 
3000  for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) {
3001  size_t len;
3002 
3003  if (!chroma_location_names[i])
3004  continue;
3005 
3006  len = strlen(chroma_location_names[i]);
3007  if (!strncmp(chroma_location_names[i], name, len))
3008  return i;
3009  }
3010 
3011  return AVERROR(EINVAL);
3012 }
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Definition: pixdesc.h:132
ITU-R BT2020 for 12-bit system.
Definition: pixfmt.h:499
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
Definition: pixfmt.h:514
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:81
EBU Tech. 3213-E / JEDEC P22 phosphors.
Definition: pixfmt.h:474
IEEE-754 single precision Y, 32bpp, big-endian.
Definition: pixfmt.h:340
packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian
Definition: pixfmt.h:359
planar GBR 4:4:4:4 40bpp, little-endian
Definition: pixfmt.h:291
int plane
Which of the 4 planes contains the component.
Definition: pixdesc.h:35
#define NULL
Definition: coverity.c:32
HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_r...
Definition: pixfmt.h:118
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:166
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:275
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:252
static enum AVPixelFormat pix_fmt
static int shift(int a, int b)
Definition: sonic.c:82
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:245
IEC 61966-2-4.
Definition: pixfmt.h:495
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2573
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
Definition: pixfmt.h:607
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:100
"Linear transfer characteristics"
Definition: pixfmt.h:492
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:249
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:159
8 bits gray, 8 bits alpha
Definition: pixfmt.h:143
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:208
packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined ...
Definition: pixfmt.h:362
const char * desc
Definition: libsvtav1.c:79
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
#define FF_LOSS_ALPHA
loss of alpha bits
Definition: pixdesc.h:395
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian ...
Definition: pixfmt.h:346
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2613
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in ...
Definition: pixfmt.h:84
hardware decoding through Videotoolbox
Definition: pixfmt.h:282
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:162
#define FF_LOSS_CHROMA
loss of chroma (e.g.
Definition: pixdesc.h:397
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
Definition: pixdesc.c:2525
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
Definition: pixfmt.h:518
char * av_get_pix_fmt_string(char *buf, int buf_size, enum AVPixelFormat pix_fmt)
Print in buf the string corresponding to the pixel format with number pix_fmt, or a header if pix_fmt...
Definition: pixdesc.c:2558
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:250
bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples
Definition: pixfmt.h:262
SMPTE ST 432-1 (2010) / P3 D65 / Display P3.
Definition: pixfmt.h:473
bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples
Definition: pixfmt.h:263
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:207
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:108
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian
Definition: pixfmt.h:270
HW decoding through VA API, Picture.data[3] contains a VASurfaceID.
Definition: pixfmt.h:120
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:189
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition: pixfmt.h:519
static const char *const chroma_location_names[]
Definition: pixdesc.c:2466
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
Definition: pixfmt.h:111
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:255
SMPTE ST 431-2 (2011) / DCI P3.
Definition: pixfmt.h:472
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
Definition: pixfmt.h:156
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
Definition: pixfmt.h:140
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition: pixfmt.h:239
bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples
Definition: pixfmt.h:260
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
Definition: bytestream.h:91
Y , 12bpp, little-endian.
Definition: pixfmt.h:296
enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
Utility function to swap the endianness of a pixel format.
Definition: pixdesc.c:2669
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:254
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:131
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:91
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
Definition: pixfmt.h:513
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:92
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:483
packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in ...
Definition: pixfmt.h:87
functionally identical to above
Definition: pixfmt.h:520
const char * av_color_space_name(enum AVColorSpace space)
Definition: pixdesc.c:2966
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition: pixfmt.h:106
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
Definition: pixfmt.h:85
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian ...
Definition: pixfmt.h:179
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
planar GBRA 4:4:4:4 64bpp, big-endian
Definition: pixfmt.h:216
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:190
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian ...
Definition: pixfmt.h:344
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:117
uint8_t
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
Definition: pixdesc.h:179
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
#define BAYER16_DESC_COMMON
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition: pixfmt.h:238
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
Definition: pixfmt.h:103
int av_color_range_from_name(const char *name)
Definition: pixdesc.c:2905
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:512
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian
Definition: pixfmt.h:268
const char * av_color_range_name(enum AVColorRange range)
Definition: pixdesc.c:2899
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
Definition: pixdesc.h:190
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian
Definition: pixfmt.h:269
Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16.
Definition: pixfmt.h:521
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:205
also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:488
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:139
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:251
void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], const AVPixFmtDescriptor *desc, int x, int y, int c, int w)
Definition: pixdesc.c:162
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Definition: bytestream.h:91
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
Definition: pixfmt.h:105
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:94
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:191
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:276
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:174
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
Definition: pixfmt.h:100
Y , 9bpp, little-endian.
Definition: pixfmt.h:316
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:194
Not part of ABI.
Definition: pixfmt.h:587
Y , 10bpp, little-endian.
Definition: pixfmt.h:298
AVColorRange
Visual content value range.
Definition: pixfmt.h:551
#define max(a, b)
Definition: cuda_runtime.h:33
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:278
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:458
#define AV_WB16(p, v)
Definition: intreadwrite.h:405
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian
Definition: pixfmt.h:264
int av_color_transfer_from_name(const char *name)
Definition: pixdesc.c:2948
const char * name
Definition: pixdesc.h:82
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:157
#define src
Definition: vp8dsp.c:254
planar GBR 4:4:4 27bpp, big-endian
Definition: pixfmt.h:170
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:165
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition: pixdesc.c:2990
also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:463
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:176
16 bits gray, 16 bits alpha (big-endian)
Definition: pixfmt.h:212
ITU-R BT1361 Extended Colour Gamut.
Definition: pixfmt.h:496
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:101
static const uint16_t mask[17]
Definition: lzw.c:38
like NV12, with 16bpp per component, big-endian
Definition: pixfmt.h:301
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:136
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition: pixdesc.h:148
static const char *const color_space_names[]
Definition: pixdesc.c:2448
int av_chroma_location_from_name(const char *name)
Definition: pixdesc.c:2996
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
Definition: pixdesc.c:2601
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:95
int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel for the pixel format described by pixdesc, including any padding ...
Definition: pixdesc.c:2538
Not part of ABI.
Definition: pixfmt.h:476
#define FF_LOSS_DEPTH
loss due to color depth change
Definition: pixdesc.h:393
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:182
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:161
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:89
packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, big-endian
Definition: pixfmt.h:358
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
Definition: pixfmt.h:460
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
Definition: pixdesc.h:140
simple assert() macros that are a bit more flexible than ISO C assert().
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:248
like NV12, with 16bpp per component, little-endian
Definition: pixfmt.h:300
SMPTE ST 428-1 (CIE 1931 XYZ)
Definition: pixfmt.h:470
int av_match_name(const char *name, const char *names)
Match instances of a name in a comma-separated list of names.
Definition: avstring.c:352
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:134
uint8_t bits
Definition: vp3data.h:202
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian
Definition: pixfmt.h:285
Libavutil version macros.
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:183
#define FFMAX(a, b)
Definition: common.h:94
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:92
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
Definition: avstring.c:83
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
Definition: pixfmt.h:149
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:93
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
Definition: pixdesc.c:2918
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:184
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
XVideo Motion Acceleration via common packet passing.
Definition: pixfmt.h:273
static const char *const color_transfer_names[]
Definition: pixdesc.c:2426
common internal API header
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:106
planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:348
as above, but U and V bytes are swapped
Definition: pixfmt.h:90
planar GBR 4:4:4:4 48bpp, big-endian
Definition: pixfmt.h:287
enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
Definition: pixdesc.c:2592
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:83
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition: pixfmt.h:500
#define BAYER8_DESC_COMMON
planar GBR 4:4:4:4 40bpp, big-endian
Definition: pixfmt.h:290
IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian.
Definition: pixfmt.h:319
#define FFMIN(a, b)
Definition: common.h:96
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
Definition: pixfmt.h:88
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
colour filters using Illuminant C
Definition: pixfmt.h:468
uint8_t w
Definition: llviddspenc.c:38
#define FF_COLOR_YUV_JPEG
YUV color space.
Definition: pixdesc.c:2691
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:523
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
Definition: pixfmt.h:609
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:465
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:188
#define FF_COLOR_XYZ
Definition: pixdesc.c:2692
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
Definition: pixfmt.h:210
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated space
Definition: undefined.txt:3
#define s(width, name)
Definition: cbs_vp9.c:257
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition: pixfmt.h:180
void av_read_image_line2(void *dst, const uint8_t *data[4], const int linesize[4], const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component, int dst_element_size)
Read a line from an image, and write the values of the pixel format component c to dst...
Definition: pixdesc.c:34
Hardware surfaces for OpenCL.
Definition: pixfmt.h:335
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:243
packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big...
Definition: pixfmt.h:200
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:158
interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian ...
Definition: pixfmt.h:203
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
Definition: pixfmt.h:284
static int get_color_type(const AVPixFmtDescriptor *desc)
Definition: pixdesc.c:2698
#define pixdesc_has_alpha(pixdesc)
Definition: pixdesc.c:2694
#define AV_PIX_FMT_FLAG_BAYER
The pixel format is following a Bayer pattern.
Definition: pixdesc.h:184
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:167
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:148
HW acceleration through CUDA.
Definition: pixfmt.h:235
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
Definition: pixfmt.h:110
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:517
packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:361
#define FF_ARRAY_ELEMS(a)
Full range content.
Definition: pixfmt.h:586
HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state str...
Definition: pixfmt.h:119
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
Definition: eamad.c:83
planar GBR 4:4:4:4 48bpp, little-endian
Definition: pixfmt.h:288
also ITU-R BT1361
Definition: pixfmt.h:485
ITU-R BT.2100-0, ICtCp.
Definition: pixfmt.h:528
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition: pixfmt.h:83
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:132
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
Definition: pixfmt.h:490
functionally identical to above
Definition: pixfmt.h:467
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
Chromaticity-derived constant luminance system.
Definition: pixfmt.h:527
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian
Definition: pixfmt.h:267
planar GBR 4:4:4 30bpp, big-endian
Definition: pixfmt.h:172
int av_color_primaries_from_name(const char *name)
Definition: pixdesc.c:2924
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian
Definition: pixfmt.h:271
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:192
static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, unsigned *lossp, unsigned consider)
Definition: pixdesc.c:2738
#define FF_COLOR_YUV
YUV color space.
Definition: pixdesc.c:2690
static const struct @324 planes[]
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:67
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:277
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:257
static FF_DISABLE_DEPRECATION_WARNINGS const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB]
Definition: pixdesc.c:173
Chromaticity-derived non-constant luminance system.
Definition: pixfmt.h:526
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:193
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:195
#define AV_WB32(p, v)
Definition: intreadwrite.h:419
Y , 16bpp, big-endian.
Definition: pixfmt.h:97
as above, but U and V bytes are swapped
Definition: pixfmt.h:349
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
Definition: pixfmt.h:318
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
Definition: pixfmt.h:197
static enum AVPixelFormat get_pix_fmt_internal(const char *name)
Definition: pixdesc.c:2476
DRM-managed buffers exposed through PRIME buffer sharing.
Definition: pixfmt.h:328
Not part of ABI.
Definition: pixfmt.h:505
"Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
Definition: pixfmt.h:494
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:244
int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, int has_alpha)
Compute what kind of losses will occur when converting from one specific pixel format to another...
Definition: pixdesc.c:2851
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
Definition: pixfmt.h:222
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian ...
Definition: pixfmt.h:345
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:240
Y , 9bpp, big-endian.
Definition: pixfmt.h:315
planar GBR 4:4:4 42bpp, big-endian
Definition: pixfmt.h:256
static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2720
SMPTE ST 428-1.
Definition: pixfmt.h:502
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
Definition: pixfmt.h:178
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:113
#define snprintf
Definition: snprintf.h:34
Y , 14bpp, little-endian.
Definition: pixfmt.h:338
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian
Definition: pixfmt.h:265
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
Definition: pixdesc.h:136
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer. ...
Definition: pixfmt.h:137
int shift
Number of least significant bits that must be shifted away to get the value.
Definition: pixdesc.h:53
void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component)
Definition: pixdesc.c:90
int offset
Number of elements before the component of the first pixel.
Definition: pixdesc.h:47
hardware decoding through MediaCodec
Definition: pixfmt.h:293
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:187
#define flags(name, subs,...)
Definition: cbs_av1.c:560
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:107
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian
Definition: pixfmt.h:266
Y , 10bpp, big-endian.
Definition: pixfmt.h:297
#define FF_COLOR_RGB
RGB color space.
Definition: pixdesc.c:2688
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
Definition: pixfmt.h:142
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:163
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:135
Hardware surfaces for Direct3D11.
Definition: pixfmt.h:313
Narrow or limited range content.
Definition: pixfmt.h:569
static FF_ENABLE_DEPRECATION_WARNINGS const char *const color_range_names[]
Definition: pixdesc.c:2403
ITU-R BT2020 constant luminance system.
Definition: pixfmt.h:524
#define X_NE(be, le)
Definition: pixdesc.c:2498
#define FF_LOSS_COLORSPACE
loss due to color space conversion
Definition: pixdesc.h:394
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb...
Definition: pixfmt.h:76
Vulkan hardware images.
Definition: pixfmt.h:356
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:247
Y , 8bpp.
Definition: pixfmt.h:74
IEC 61966-2-1 (sRGB or sYCC)
Definition: pixfmt.h:497
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:84
common internal and external API header
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
Definition: pixfmt.h:75
void av_write_image_line2(const void *src, uint8_t *data[4], const int linesize[4], const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int src_element_size)
Write the values from src to the pixel format component c of an image line.
Definition: pixdesc.c:101
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian.
Definition: pixfmt.h:321
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:171
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
Definition: pixdesc.c:2942
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:102
also ITU-R BT470BG
Definition: pixfmt.h:489
#define AV_WL16(p, v)
Definition: intreadwrite.h:412
SMPTE 2085, Y&#39;D&#39;zD&#39;x.
Definition: pixfmt.h:525
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:133
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples
Definition: pixfmt.h:261
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
Definition: pixfmt.h:86
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:201
static const char *const color_primaries_names[AVCOL_PRI_NB]
Definition: pixdesc.c:2409
enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
Compute what kind of losses will occur when converting from one specific pixel format to another...
Definition: pixdesc.c:2862
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:185
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
Definition: pixdesc.h:128
ARIB STD-B67, known as "Hybrid log-gamma".
Definition: pixfmt.h:504
#define FF_LOSS_RESOLUTION
loss due to resolution change
Definition: pixdesc.h:392
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
Definition: pixfmt.h:320
#define FF_PSEUDOPAL
Definition: internal.h:335
pixel format definitions
packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as lit...
Definition: pixfmt.h:199
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:280
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:85
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:253
int len
Y , 14bpp, big-endian.
Definition: pixfmt.h:337
Y , 16bpp, little-endian.
Definition: pixfmt.h:98
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:258
Not part of ABI.
Definition: pixfmt.h:613
16 bits gray, 16 bits alpha (little-endian)
Definition: pixfmt.h:213
#define FF_COLOR_NA
Definition: pixdesc.c:2687
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:186
Definition: mccdec.c:62
Y , 12bpp, big-endian.
Definition: pixfmt.h:295
ITU-R BT2020 for 10-bit system.
Definition: pixfmt.h:498
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition: pixfmt.h:466
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:112
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
Definition: pixfmt.h:363
ITU-R BT2020.
Definition: pixfmt.h:469
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
#define FF_LOSS_COLORQUANT
loss due to color quantization
Definition: pixdesc.h:396
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:605
HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView p...
Definition: pixfmt.h:229
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:175
void ff_check_pixfmt_descriptors(void)
Definition: pixdesc.c:2628
MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0.
Definition: pixfmt.h:608
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:141
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
Definition: pixdesc.c:2501
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:2489
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
Definition: pixfmt.h:181
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
int depth
Number of bits in the component.
Definition: pixdesc.h:58
interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian ...
Definition: pixfmt.h:202
IEEE-754 single precision Y, 32bpp, little-endian.
Definition: pixfmt.h:341
HW acceleration though MMAL, data[3] contains a pointer to the MMAL_BUFFER_HEADER_T structure...
Definition: pixfmt.h:227
planar GBRA 4:4:4:4 64bpp, little-endian
Definition: pixfmt.h:217
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition: pixfmt.h:237
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
Definition: pixfmt.h:82
int av_color_space_from_name(const char *name)
Definition: pixdesc.c:2972
float min
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:91
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
static double val(void *priv, double ch)
Definition: aeval.c:76
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Definition: pixdesc.h:144
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:242
Not part of ABI.
Definition: pixfmt.h:529
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:164
for(j=16;j >0;--j)
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:246
int i
Definition: input.c:407
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:173
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:206
int step
Number of elements between 2 horizontally consecutive pixels.
Definition: pixdesc.h:41
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:279
#define AV_WL32(p, v)
Definition: intreadwrite.h:426
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.
Definition: pixdesc.c:2580
const char * name
Definition: opengl_enc.c:102
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian ...
Definition: pixfmt.h:343
"Logarithmic transfer characteristic (100:1 range)"
Definition: pixfmt.h:493
#define FF_COLOR_GRAY
gray color space
Definition: pixdesc.c:2689
static uint8_t tmp[11]
Definition: aes_ctr.c:26
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:160