FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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_line(uint16_t *dst,
35  const uint8_t *data[4], const int linesize[4],
36  const AVPixFmtDescriptor *desc,
37  int x, int y, int c, int w,
38  int read_pal_component)
39 {
41  int plane = comp.plane;
42  int depth = comp.depth;
43  int mask = (1 << depth) - 1;
44  int shift = comp.shift;
45  int step = comp.step;
46  int flags = desc->flags;
47 
48  if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
49  int skip = x * step + comp.offset;
50  const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
51  int shift = 8 - depth - (skip & 7);
52 
53  while (w--) {
54  int val = (*p >> shift) & mask;
55  if (read_pal_component)
56  val = data[1][4*val + c];
57  shift -= step;
58  p -= shift >> 3;
59  shift &= 7;
60  *dst++ = val;
61  }
62  } else {
63  const uint8_t *p = data[plane] + y * linesize[plane] +
64  x * step + comp.offset;
65  int is_8bit = shift + depth <= 8;
66 
67  if (is_8bit)
68  p += !!(flags & AV_PIX_FMT_FLAG_BE);
69 
70  while (w--) {
71  int val = is_8bit ? *p :
72  flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p);
73  val = (val >> shift) & mask;
74  if (read_pal_component)
75  val = data[1][4 * val + c];
76  p += step;
77  *dst++ = val;
78  }
79  }
80 }
81 
82 void av_write_image_line(const uint16_t *src,
83  uint8_t *data[4], const int linesize[4],
84  const AVPixFmtDescriptor *desc,
85  int x, int y, int c, int w)
86 {
88  int plane = comp.plane;
89  int depth = comp.depth;
90  int step = comp.step;
91  int flags = desc->flags;
92 
93  if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
94  int skip = x * step + comp.offset;
95  uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
96  int shift = 8 - depth - (skip & 7);
97 
98  while (w--) {
99  *p |= *src++ << shift;
100  shift -= step;
101  p -= shift >> 3;
102  shift &= 7;
103  }
104  } else {
105  int shift = comp.shift;
106  uint8_t *p = data[plane] + y * linesize[plane] +
107  x * step + comp.offset;
108 
109  if (shift + depth <= 8) {
110  p += !!(flags & AV_PIX_FMT_FLAG_BE);
111  while (w--) {
112  *p |= (*src++ << shift);
113  p += step;
114  }
115  } else {
116  while (w--) {
117  if (flags & AV_PIX_FMT_FLAG_BE) {
118  uint16_t val = AV_RB16(p) | (*src++ << shift);
119  AV_WB16(p, val);
120  } else {
121  uint16_t val = AV_RL16(p) | (*src++ << shift);
122  AV_WL16(p, val);
123  }
124  p += step;
125  }
126  }
127  }
128 }
129 
130 #if FF_API_PLUS1_MINUS1
132 #endif
134  [AV_PIX_FMT_YUV420P] = {
135  .name = "yuv420p",
136  .nb_components = 3,
137  .log2_chroma_w = 1,
138  .log2_chroma_h = 1,
139  .comp = {
140  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
141  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
142  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
143  },
144  .flags = AV_PIX_FMT_FLAG_PLANAR,
145  },
146  [AV_PIX_FMT_YUYV422] = {
147  .name = "yuyv422",
148  .nb_components = 3,
149  .log2_chroma_w = 1,
150  .log2_chroma_h = 0,
151  .comp = {
152  { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
153  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* U */
154  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* V */
155  },
156  },
157  [AV_PIX_FMT_YVYU422] = {
158  .name = "yvyu422",
159  .nb_components = 3,
160  .log2_chroma_w = 1,
161  .log2_chroma_h = 0,
162  .comp = {
163  { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
164  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* U */
165  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* V */
166  },
167  },
168  [AV_PIX_FMT_RGB24] = {
169  .name = "rgb24",
170  .nb_components = 3,
171  .log2_chroma_w = 0,
172  .log2_chroma_h = 0,
173  .comp = {
174  { 0, 3, 0, 0, 8, 2, 7, 1 }, /* R */
175  { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
176  { 0, 3, 2, 0, 8, 2, 7, 3 }, /* B */
177  },
178  .flags = AV_PIX_FMT_FLAG_RGB,
179  },
180  [AV_PIX_FMT_BGR24] = {
181  .name = "bgr24",
182  .nb_components = 3,
183  .log2_chroma_w = 0,
184  .log2_chroma_h = 0,
185  .comp = {
186  { 0, 3, 2, 0, 8, 2, 7, 3 }, /* R */
187  { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
188  { 0, 3, 0, 0, 8, 2, 7, 1 }, /* B */
189  },
190  .flags = AV_PIX_FMT_FLAG_RGB,
191  },
192  [AV_PIX_FMT_YUV422P] = {
193  .name = "yuv422p",
194  .nb_components = 3,
195  .log2_chroma_w = 1,
196  .log2_chroma_h = 0,
197  .comp = {
198  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
199  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
200  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
201  },
202  .flags = AV_PIX_FMT_FLAG_PLANAR,
203  },
204  [AV_PIX_FMT_YUV444P] = {
205  .name = "yuv444p",
206  .nb_components = 3,
207  .log2_chroma_w = 0,
208  .log2_chroma_h = 0,
209  .comp = {
210  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
211  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
212  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
213  },
214  .flags = AV_PIX_FMT_FLAG_PLANAR,
215  },
216  [AV_PIX_FMT_YUV410P] = {
217  .name = "yuv410p",
218  .nb_components = 3,
219  .log2_chroma_w = 2,
220  .log2_chroma_h = 2,
221  .comp = {
222  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
223  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
224  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
225  },
226  .flags = AV_PIX_FMT_FLAG_PLANAR,
227  },
228  [AV_PIX_FMT_YUV411P] = {
229  .name = "yuv411p",
230  .nb_components = 3,
231  .log2_chroma_w = 2,
232  .log2_chroma_h = 0,
233  .comp = {
234  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
235  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
236  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
237  },
238  .flags = AV_PIX_FMT_FLAG_PLANAR,
239  },
240  [AV_PIX_FMT_YUVJ411P] = {
241  .name = "yuvj411p",
242  .nb_components = 3,
243  .log2_chroma_w = 2,
244  .log2_chroma_h = 0,
245  .comp = {
246  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
247  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
248  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
249  },
250  .flags = AV_PIX_FMT_FLAG_PLANAR,
251  },
252  [AV_PIX_FMT_GRAY8] = {
253  .name = "gray",
254  .nb_components = 1,
255  .log2_chroma_w = 0,
256  .log2_chroma_h = 0,
257  .comp = {
258  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
259  },
260  .flags = AV_PIX_FMT_FLAG_PSEUDOPAL,
261  .alias = "gray8,y8",
262  },
264  .name = "monow",
265  .nb_components = 1,
266  .log2_chroma_w = 0,
267  .log2_chroma_h = 0,
268  .comp = {
269  { 0, 1, 0, 0, 1, 0, 0, 1 }, /* Y */
270  },
271  .flags = AV_PIX_FMT_FLAG_BITSTREAM,
272  },
274  .name = "monob",
275  .nb_components = 1,
276  .log2_chroma_w = 0,
277  .log2_chroma_h = 0,
278  .comp = {
279  { 0, 1, 0, 7, 1, 0, 0, 1 }, /* Y */
280  },
281  .flags = AV_PIX_FMT_FLAG_BITSTREAM,
282  },
283  [AV_PIX_FMT_PAL8] = {
284  .name = "pal8",
285  .nb_components = 1,
286  .log2_chroma_w = 0,
287  .log2_chroma_h = 0,
288  .comp = {
289  { 0, 1, 0, 0, 8, 0, 7, 1 },
290  },
291  .flags = AV_PIX_FMT_FLAG_PAL,
292  },
293  [AV_PIX_FMT_YUVJ420P] = {
294  .name = "yuvj420p",
295  .nb_components = 3,
296  .log2_chroma_w = 1,
297  .log2_chroma_h = 1,
298  .comp = {
299  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
300  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
301  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
302  },
303  .flags = AV_PIX_FMT_FLAG_PLANAR,
304  },
305  [AV_PIX_FMT_YUVJ422P] = {
306  .name = "yuvj422p",
307  .nb_components = 3,
308  .log2_chroma_w = 1,
309  .log2_chroma_h = 0,
310  .comp = {
311  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
312  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
313  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
314  },
315  .flags = AV_PIX_FMT_FLAG_PLANAR,
316  },
317  [AV_PIX_FMT_YUVJ444P] = {
318  .name = "yuvj444p",
319  .nb_components = 3,
320  .log2_chroma_w = 0,
321  .log2_chroma_h = 0,
322  .comp = {
323  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
324  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
325  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
326  },
327  .flags = AV_PIX_FMT_FLAG_PLANAR,
328  },
329 #if FF_API_XVMC
331  .name = "xvmcmc",
332  .flags = AV_PIX_FMT_FLAG_HWACCEL,
333  },
335  .name = "xvmcidct",
336  .flags = AV_PIX_FMT_FLAG_HWACCEL,
337  },
338 #endif /* FF_API_XVMC */
339 #if !FF_API_XVMC
340  [AV_PIX_FMT_XVMC] = {
341  .name = "xvmc",
342  .flags = AV_PIX_FMT_FLAG_HWACCEL,
343  },
344 #endif /* !FF_API_XVMC */
345  [AV_PIX_FMT_UYVY422] = {
346  .name = "uyvy422",
347  .nb_components = 3,
348  .log2_chroma_w = 1,
349  .log2_chroma_h = 0,
350  .comp = {
351  { 0, 2, 1, 0, 8, 1, 7, 2 }, /* Y */
352  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* U */
353  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* V */
354  },
355  },
357  .name = "uyyvyy411",
358  .nb_components = 3,
359  .log2_chroma_w = 2,
360  .log2_chroma_h = 0,
361  .comp = {
362  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* Y */
363  { 0, 6, 0, 0, 8, 5, 7, 1 }, /* U */
364  { 0, 6, 3, 0, 8, 5, 7, 4 }, /* V */
365  },
366  },
367  [AV_PIX_FMT_BGR8] = {
368  .name = "bgr8",
369  .nb_components = 3,
370  .log2_chroma_w = 0,
371  .log2_chroma_h = 0,
372  .comp = {
373  { 0, 1, 0, 0, 3, 0, 2, 1 }, /* R */
374  { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
375  { 0, 1, 0, 6, 2, 0, 1, 1 }, /* B */
376  },
378  },
379  [AV_PIX_FMT_BGR4] = {
380  .name = "bgr4",
381  .nb_components = 3,
382  .log2_chroma_w = 0,
383  .log2_chroma_h = 0,
384  .comp = {
385  { 0, 4, 3, 0, 1, 3, 0, 4 }, /* R */
386  { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
387  { 0, 4, 0, 0, 1, 3, 0, 1 }, /* B */
388  },
390  },
392  .name = "bgr4_byte",
393  .nb_components = 3,
394  .log2_chroma_w = 0,
395  .log2_chroma_h = 0,
396  .comp = {
397  { 0, 1, 0, 0, 1, 0, 0, 1 }, /* R */
398  { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
399  { 0, 1, 0, 3, 1, 0, 0, 1 }, /* B */
400  },
402  },
403  [AV_PIX_FMT_RGB8] = {
404  .name = "rgb8",
405  .nb_components = 3,
406  .log2_chroma_w = 0,
407  .log2_chroma_h = 0,
408  .comp = {
409  { 0, 1, 0, 6, 2, 0, 1, 1 }, /* R */
410  { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
411  { 0, 1, 0, 0, 3, 0, 2, 1 }, /* B */
412  },
414  },
415  [AV_PIX_FMT_RGB4] = {
416  .name = "rgb4",
417  .nb_components = 3,
418  .log2_chroma_w = 0,
419  .log2_chroma_h = 0,
420  .comp = {
421  { 0, 4, 0, 0, 1, 3, 0, 1 }, /* R */
422  { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
423  { 0, 4, 3, 0, 1, 3, 0, 4 }, /* B */
424  },
426  },
428  .name = "rgb4_byte",
429  .nb_components = 3,
430  .log2_chroma_w = 0,
431  .log2_chroma_h = 0,
432  .comp = {
433  { 0, 1, 0, 3, 1, 0, 0, 1 }, /* R */
434  { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
435  { 0, 1, 0, 0, 1, 0, 0, 1 }, /* B */
436  },
438  },
439  [AV_PIX_FMT_NV12] = {
440  .name = "nv12",
441  .nb_components = 3,
442  .log2_chroma_w = 1,
443  .log2_chroma_h = 1,
444  .comp = {
445  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
446  { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
447  { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
448  },
449  .flags = AV_PIX_FMT_FLAG_PLANAR,
450  },
451  [AV_PIX_FMT_NV21] = {
452  .name = "nv21",
453  .nb_components = 3,
454  .log2_chroma_w = 1,
455  .log2_chroma_h = 1,
456  .comp = {
457  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
458  { 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */
459  { 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */
460  },
461  .flags = AV_PIX_FMT_FLAG_PLANAR,
462  },
463  [AV_PIX_FMT_ARGB] = {
464  .name = "argb",
465  .nb_components = 4,
466  .log2_chroma_w = 0,
467  .log2_chroma_h = 0,
468  .comp = {
469  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
470  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
471  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
472  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
473  },
475  },
476  [AV_PIX_FMT_RGBA] = {
477  .name = "rgba",
478  .nb_components = 4,
479  .log2_chroma_w = 0,
480  .log2_chroma_h = 0,
481  .comp = {
482  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
483  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
484  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
485  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
486  },
488  },
489  [AV_PIX_FMT_ABGR] = {
490  .name = "abgr",
491  .nb_components = 4,
492  .log2_chroma_w = 0,
493  .log2_chroma_h = 0,
494  .comp = {
495  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
496  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
497  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
498  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
499  },
501  },
502  [AV_PIX_FMT_BGRA] = {
503  .name = "bgra",
504  .nb_components = 4,
505  .log2_chroma_w = 0,
506  .log2_chroma_h = 0,
507  .comp = {
508  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
509  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
510  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
511  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
512  },
514  },
515  [AV_PIX_FMT_0RGB] = {
516  .name = "0rgb",
517  .nb_components= 3,
518  .log2_chroma_w= 0,
519  .log2_chroma_h= 0,
520  .comp = {
521  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
522  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
523  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
524  },
525  .flags = AV_PIX_FMT_FLAG_RGB,
526  },
527  [AV_PIX_FMT_RGB0] = {
528  .name = "rgb0",
529  .nb_components= 3,
530  .log2_chroma_w= 0,
531  .log2_chroma_h= 0,
532  .comp = {
533  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
534  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
535  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
536  },
537  .flags = AV_PIX_FMT_FLAG_RGB,
538  },
539  [AV_PIX_FMT_0BGR] = {
540  .name = "0bgr",
541  .nb_components= 3,
542  .log2_chroma_w= 0,
543  .log2_chroma_h= 0,
544  .comp = {
545  { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
546  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
547  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
548  },
549  .flags = AV_PIX_FMT_FLAG_RGB,
550  },
551  [AV_PIX_FMT_BGR0] = {
552  .name = "bgr0",
553  .nb_components= 3,
554  .log2_chroma_w= 0,
555  .log2_chroma_h= 0,
556  .comp = {
557  { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
558  { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
559  { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
560  },
561  .flags = AV_PIX_FMT_FLAG_RGB,
562  },
563  [AV_PIX_FMT_GRAY16BE] = {
564  .name = "gray16be",
565  .nb_components = 1,
566  .log2_chroma_w = 0,
567  .log2_chroma_h = 0,
568  .comp = {
569  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
570  },
571  .flags = AV_PIX_FMT_FLAG_BE,
572  .alias = "y16be",
573  },
574  [AV_PIX_FMT_GRAY16LE] = {
575  .name = "gray16le",
576  .nb_components = 1,
577  .log2_chroma_w = 0,
578  .log2_chroma_h = 0,
579  .comp = {
580  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
581  },
582  .alias = "y16le",
583  },
584  [AV_PIX_FMT_YUV440P] = {
585  .name = "yuv440p",
586  .nb_components = 3,
587  .log2_chroma_w = 0,
588  .log2_chroma_h = 1,
589  .comp = {
590  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
591  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
592  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
593  },
594  .flags = AV_PIX_FMT_FLAG_PLANAR,
595  },
596  [AV_PIX_FMT_YUVJ440P] = {
597  .name = "yuvj440p",
598  .nb_components = 3,
599  .log2_chroma_w = 0,
600  .log2_chroma_h = 1,
601  .comp = {
602  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
603  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
604  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
605  },
606  .flags = AV_PIX_FMT_FLAG_PLANAR,
607  },
609  .name = "yuv440p10le",
610  .nb_components = 3,
611  .log2_chroma_w = 0,
612  .log2_chroma_h = 1,
613  .comp = {
614  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
615  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
616  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
617  },
618  .flags = AV_PIX_FMT_FLAG_PLANAR,
619  },
621  .name = "yuv440p10be",
622  .nb_components = 3,
623  .log2_chroma_w = 0,
624  .log2_chroma_h = 1,
625  .comp = {
626  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
627  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
628  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
629  },
631  },
633  .name = "yuv440p12le",
634  .nb_components = 3,
635  .log2_chroma_w = 0,
636  .log2_chroma_h = 1,
637  .comp = {
638  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
639  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
640  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
641  },
642  .flags = AV_PIX_FMT_FLAG_PLANAR,
643  },
645  .name = "yuv440p12be",
646  .nb_components = 3,
647  .log2_chroma_w = 0,
648  .log2_chroma_h = 1,
649  .comp = {
650  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
651  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
652  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
653  },
655  },
656  [AV_PIX_FMT_YUVA420P] = {
657  .name = "yuva420p",
658  .nb_components = 4,
659  .log2_chroma_w = 1,
660  .log2_chroma_h = 1,
661  .comp = {
662  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
663  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
664  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
665  { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
666  },
668  },
669  [AV_PIX_FMT_YUVA422P] = {
670  .name = "yuva422p",
671  .nb_components = 4,
672  .log2_chroma_w = 1,
673  .log2_chroma_h = 0,
674  .comp = {
675  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
676  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
677  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
678  { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
679  },
681  },
682  [AV_PIX_FMT_YUVA444P] = {
683  .name = "yuva444p",
684  .nb_components = 4,
685  .log2_chroma_w = 0,
686  .log2_chroma_h = 0,
687  .comp = {
688  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
689  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
690  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
691  { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
692  },
694  },
696  .name = "yuva420p9be",
697  .nb_components = 4,
698  .log2_chroma_w = 1,
699  .log2_chroma_h = 1,
700  .comp = {
701  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
702  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
703  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
704  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
705  },
707  },
709  .name = "yuva420p9le",
710  .nb_components = 4,
711  .log2_chroma_w = 1,
712  .log2_chroma_h = 1,
713  .comp = {
714  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
715  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
716  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
717  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
718  },
720  },
722  .name = "yuva422p9be",
723  .nb_components = 4,
724  .log2_chroma_w = 1,
725  .log2_chroma_h = 0,
726  .comp = {
727  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
728  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
729  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
730  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
731  },
733  },
735  .name = "yuva422p9le",
736  .nb_components = 4,
737  .log2_chroma_w = 1,
738  .log2_chroma_h = 0,
739  .comp = {
740  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
741  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
742  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
743  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
744  },
746  },
748  .name = "yuva444p9be",
749  .nb_components = 4,
750  .log2_chroma_w = 0,
751  .log2_chroma_h = 0,
752  .comp = {
753  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
754  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
755  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
756  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
757  },
759  },
761  .name = "yuva444p9le",
762  .nb_components = 4,
763  .log2_chroma_w = 0,
764  .log2_chroma_h = 0,
765  .comp = {
766  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
767  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
768  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
769  { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
770  },
772  },
774  .name = "yuva420p10be",
775  .nb_components = 4,
776  .log2_chroma_w = 1,
777  .log2_chroma_h = 1,
778  .comp = {
779  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
780  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
781  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
782  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
783  },
785  },
787  .name = "yuva420p10le",
788  .nb_components = 4,
789  .log2_chroma_w = 1,
790  .log2_chroma_h = 1,
791  .comp = {
792  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
793  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
794  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
795  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
796  },
798  },
800  .name = "yuva422p10be",
801  .nb_components = 4,
802  .log2_chroma_w = 1,
803  .log2_chroma_h = 0,
804  .comp = {
805  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
806  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
807  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
808  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
809  },
811  },
813  .name = "yuva422p10le",
814  .nb_components = 4,
815  .log2_chroma_w = 1,
816  .log2_chroma_h = 0,
817  .comp = {
818  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
819  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
820  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
821  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
822  },
824  },
826  .name = "yuva444p10be",
827  .nb_components = 4,
828  .log2_chroma_w = 0,
829  .log2_chroma_h = 0,
830  .comp = {
831  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
832  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
833  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
834  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
835  },
837  },
839  .name = "yuva444p10le",
840  .nb_components = 4,
841  .log2_chroma_w = 0,
842  .log2_chroma_h = 0,
843  .comp = {
844  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
845  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
846  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
847  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
848  },
850  },
852  .name = "yuva420p16be",
853  .nb_components = 4,
854  .log2_chroma_w = 1,
855  .log2_chroma_h = 1,
856  .comp = {
857  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
858  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
859  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
860  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
861  },
863  },
865  .name = "yuva420p16le",
866  .nb_components = 4,
867  .log2_chroma_w = 1,
868  .log2_chroma_h = 1,
869  .comp = {
870  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
871  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
872  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
873  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
874  },
876  },
878  .name = "yuva422p16be",
879  .nb_components = 4,
880  .log2_chroma_w = 1,
881  .log2_chroma_h = 0,
882  .comp = {
883  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
884  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
885  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
886  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
887  },
889  },
891  .name = "yuva422p16le",
892  .nb_components = 4,
893  .log2_chroma_w = 1,
894  .log2_chroma_h = 0,
895  .comp = {
896  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
897  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
898  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
899  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
900  },
902  },
904  .name = "yuva444p16be",
905  .nb_components = 4,
906  .log2_chroma_w = 0,
907  .log2_chroma_h = 0,
908  .comp = {
909  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
910  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
911  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
912  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
913  },
915  },
917  .name = "yuva444p16le",
918  .nb_components = 4,
919  .log2_chroma_w = 0,
920  .log2_chroma_h = 0,
921  .comp = {
922  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
923  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
924  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
925  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
926  },
928  },
929 #if FF_API_VDPAU
931  .name = "vdpau_h264",
932  .log2_chroma_w = 1,
933  .log2_chroma_h = 1,
934  .flags = AV_PIX_FMT_FLAG_HWACCEL,
935  },
937  .name = "vdpau_mpeg1",
938  .log2_chroma_w = 1,
939  .log2_chroma_h = 1,
940  .flags = AV_PIX_FMT_FLAG_HWACCEL,
941  },
943  .name = "vdpau_mpeg2",
944  .log2_chroma_w = 1,
945  .log2_chroma_h = 1,
946  .flags = AV_PIX_FMT_FLAG_HWACCEL,
947  },
949  .name = "vdpau_wmv3",
950  .log2_chroma_w = 1,
951  .log2_chroma_h = 1,
952  .flags = AV_PIX_FMT_FLAG_HWACCEL,
953  },
955  .name = "vdpau_vc1",
956  .log2_chroma_w = 1,
957  .log2_chroma_h = 1,
958  .flags = AV_PIX_FMT_FLAG_HWACCEL,
959  },
961  .name = "vdpau_mpeg4",
962  .log2_chroma_w = 1,
963  .log2_chroma_h = 1,
964  .flags = AV_PIX_FMT_FLAG_HWACCEL,
965  },
966 #endif
967  [AV_PIX_FMT_RGB48BE] = {
968  .name = "rgb48be",
969  .nb_components = 3,
970  .log2_chroma_w = 0,
971  .log2_chroma_h = 0,
972  .comp = {
973  { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
974  { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
975  { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
976  },
978  },
979  [AV_PIX_FMT_RGB48LE] = {
980  .name = "rgb48le",
981  .nb_components = 3,
982  .log2_chroma_w = 0,
983  .log2_chroma_h = 0,
984  .comp = {
985  { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
986  { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
987  { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
988  },
989  .flags = AV_PIX_FMT_FLAG_RGB,
990  },
991  [AV_PIX_FMT_RGBA64BE] = {
992  .name = "rgba64be",
993  .nb_components = 4,
994  .log2_chroma_w = 0,
995  .log2_chroma_h = 0,
996  .comp = {
997  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
998  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
999  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1000  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1001  },
1003  },
1004  [AV_PIX_FMT_RGBA64LE] = {
1005  .name = "rgba64le",
1006  .nb_components = 4,
1007  .log2_chroma_w = 0,
1008  .log2_chroma_h = 0,
1009  .comp = {
1010  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
1011  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1012  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
1013  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1014  },
1016  },
1017  [AV_PIX_FMT_RGB565BE] = {
1018  .name = "rgb565be",
1019  .nb_components = 3,
1020  .log2_chroma_w = 0,
1021  .log2_chroma_h = 0,
1022  .comp = {
1023  { 0, 2, -1, 3, 5, 1, 4, 0 }, /* R */
1024  { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1025  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1026  },
1028  },
1029  [AV_PIX_FMT_RGB565LE] = {
1030  .name = "rgb565le",
1031  .nb_components = 3,
1032  .log2_chroma_w = 0,
1033  .log2_chroma_h = 0,
1034  .comp = {
1035  { 0, 2, 1, 3, 5, 1, 4, 2 }, /* R */
1036  { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1037  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1038  },
1039  .flags = AV_PIX_FMT_FLAG_RGB,
1040  },
1041  [AV_PIX_FMT_RGB555BE] = {
1042  .name = "rgb555be",
1043  .nb_components = 3,
1044  .log2_chroma_w = 0,
1045  .log2_chroma_h = 0,
1046  .comp = {
1047  { 0, 2, -1, 2, 5, 1, 4, 0 }, /* R */
1048  { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1049  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1050  },
1052  },
1053  [AV_PIX_FMT_RGB555LE] = {
1054  .name = "rgb555le",
1055  .nb_components = 3,
1056  .log2_chroma_w = 0,
1057  .log2_chroma_h = 0,
1058  .comp = {
1059  { 0, 2, 1, 2, 5, 1, 4, 2 }, /* R */
1060  { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1061  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
1062  },
1063  .flags = AV_PIX_FMT_FLAG_RGB,
1064  },
1065  [AV_PIX_FMT_RGB444BE] = {
1066  .name = "rgb444be",
1067  .nb_components = 3,
1068  .log2_chroma_w = 0,
1069  .log2_chroma_h = 0,
1070  .comp = {
1071  { 0, 2, -1, 0, 4, 1, 3, 0 }, /* R */
1072  { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1073  { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1074  },
1076  },
1077  [AV_PIX_FMT_RGB444LE] = {
1078  .name = "rgb444le",
1079  .nb_components = 3,
1080  .log2_chroma_w = 0,
1081  .log2_chroma_h = 0,
1082  .comp = {
1083  { 0, 2, 1, 0, 4, 1, 3, 2 }, /* R */
1084  { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1085  { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
1086  },
1087  .flags = AV_PIX_FMT_FLAG_RGB,
1088  },
1089  [AV_PIX_FMT_BGR48BE] = {
1090  .name = "bgr48be",
1091  .nb_components = 3,
1092  .log2_chroma_w = 0,
1093  .log2_chroma_h = 0,
1094  .comp = {
1095  { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1096  { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1097  { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1098  },
1100  },
1101  [AV_PIX_FMT_BGR48LE] = {
1102  .name = "bgr48le",
1103  .nb_components = 3,
1104  .log2_chroma_w = 0,
1105  .log2_chroma_h = 0,
1106  .comp = {
1107  { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
1108  { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
1109  { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
1110  },
1111  .flags = AV_PIX_FMT_FLAG_RGB,
1112  },
1113  [AV_PIX_FMT_BGRA64BE] = {
1114  .name = "bgra64be",
1115  .nb_components = 4,
1116  .log2_chroma_w = 0,
1117  .log2_chroma_h = 0,
1118  .comp = {
1119  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1120  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1121  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1122  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1123  },
1125  },
1126  [AV_PIX_FMT_BGRA64LE] = {
1127  .name = "bgra64le",
1128  .nb_components = 4,
1129  .log2_chroma_w = 0,
1130  .log2_chroma_h = 0,
1131  .comp = {
1132  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
1133  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
1134  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
1135  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
1136  },
1138  },
1139  [AV_PIX_FMT_BGR565BE] = {
1140  .name = "bgr565be",
1141  .nb_components = 3,
1142  .log2_chroma_w = 0,
1143  .log2_chroma_h = 0,
1144  .comp = {
1145  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1146  { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1147  { 0, 2, -1, 3, 5, 1, 4, 0 }, /* B */
1148  },
1150  },
1151  [AV_PIX_FMT_BGR565LE] = {
1152  .name = "bgr565le",
1153  .nb_components = 3,
1154  .log2_chroma_w = 0,
1155  .log2_chroma_h = 0,
1156  .comp = {
1157  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1158  { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
1159  { 0, 2, 1, 3, 5, 1, 4, 2 }, /* B */
1160  },
1161  .flags = AV_PIX_FMT_FLAG_RGB,
1162  },
1163  [AV_PIX_FMT_BGR555BE] = {
1164  .name = "bgr555be",
1165  .nb_components = 3,
1166  .log2_chroma_w = 0,
1167  .log2_chroma_h = 0,
1168  .comp = {
1169  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1170  { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1171  { 0, 2, -1, 2, 5, 1, 4, 0 }, /* B */
1172  },
1174  },
1175  [AV_PIX_FMT_BGR555LE] = {
1176  .name = "bgr555le",
1177  .nb_components = 3,
1178  .log2_chroma_w = 0,
1179  .log2_chroma_h = 0,
1180  .comp = {
1181  { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
1182  { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
1183  { 0, 2, 1, 2, 5, 1, 4, 2 }, /* B */
1184  },
1185  .flags = AV_PIX_FMT_FLAG_RGB,
1186  },
1187  [AV_PIX_FMT_BGR444BE] = {
1188  .name = "bgr444be",
1189  .nb_components = 3,
1190  .log2_chroma_w = 0,
1191  .log2_chroma_h = 0,
1192  .comp = {
1193  { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1194  { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1195  { 0, 2, -1, 0, 4, 1, 3, 0 }, /* B */
1196  },
1198  },
1199  [AV_PIX_FMT_BGR444LE] = {
1200  .name = "bgr444le",
1201  .nb_components = 3,
1202  .log2_chroma_w = 0,
1203  .log2_chroma_h = 0,
1204  .comp = {
1205  { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
1206  { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
1207  { 0, 2, 1, 0, 4, 1, 3, 2 }, /* B */
1208  },
1209  .flags = AV_PIX_FMT_FLAG_RGB,
1210  },
1211 #if FF_API_VAAPI
1212  [AV_PIX_FMT_VAAPI_MOCO] = {
1213  .name = "vaapi_moco",
1214  .log2_chroma_w = 1,
1215  .log2_chroma_h = 1,
1216  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1217  },
1218  [AV_PIX_FMT_VAAPI_IDCT] = {
1219  .name = "vaapi_idct",
1220  .log2_chroma_w = 1,
1221  .log2_chroma_h = 1,
1222  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1223  },
1224  [AV_PIX_FMT_VAAPI_VLD] = {
1225  .name = "vaapi_vld",
1226  .log2_chroma_w = 1,
1227  .log2_chroma_h = 1,
1228  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1229  },
1230 #else
1231  [AV_PIX_FMT_VAAPI] = {
1232  .name = "vaapi",
1233  .log2_chroma_w = 1,
1234  .log2_chroma_h = 1,
1235  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1236  },
1237 #endif
1238  [AV_PIX_FMT_YUV420P9LE] = {
1239  .name = "yuv420p9le",
1240  .nb_components = 3,
1241  .log2_chroma_w = 1,
1242  .log2_chroma_h = 1,
1243  .comp = {
1244  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1245  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1246  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1247  },
1248  .flags = AV_PIX_FMT_FLAG_PLANAR,
1249  },
1250  [AV_PIX_FMT_YUV420P9BE] = {
1251  .name = "yuv420p9be",
1252  .nb_components = 3,
1253  .log2_chroma_w = 1,
1254  .log2_chroma_h = 1,
1255  .comp = {
1256  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1257  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1258  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1259  },
1261  },
1263  .name = "yuv420p10le",
1264  .nb_components = 3,
1265  .log2_chroma_w = 1,
1266  .log2_chroma_h = 1,
1267  .comp = {
1268  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1269  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1270  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1271  },
1272  .flags = AV_PIX_FMT_FLAG_PLANAR,
1273  },
1275  .name = "yuv420p10be",
1276  .nb_components = 3,
1277  .log2_chroma_w = 1,
1278  .log2_chroma_h = 1,
1279  .comp = {
1280  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1281  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1282  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1283  },
1285  },
1287  .name = "yuv420p12le",
1288  .nb_components = 3,
1289  .log2_chroma_w = 1,
1290  .log2_chroma_h = 1,
1291  .comp = {
1292  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1293  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1294  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1295  },
1296  .flags = AV_PIX_FMT_FLAG_PLANAR,
1297  },
1299  .name = "yuv420p12be",
1300  .nb_components = 3,
1301  .log2_chroma_w = 1,
1302  .log2_chroma_h = 1,
1303  .comp = {
1304  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1305  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1306  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1307  },
1309  },
1311  .name = "yuv420p14le",
1312  .nb_components = 3,
1313  .log2_chroma_w = 1,
1314  .log2_chroma_h = 1,
1315  .comp = {
1316  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1317  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1318  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1319  },
1320  .flags = AV_PIX_FMT_FLAG_PLANAR,
1321  },
1323  .name = "yuv420p14be",
1324  .nb_components = 3,
1325  .log2_chroma_w = 1,
1326  .log2_chroma_h = 1,
1327  .comp = {
1328  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1329  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1330  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1331  },
1333  },
1335  .name = "yuv420p16le",
1336  .nb_components = 3,
1337  .log2_chroma_w = 1,
1338  .log2_chroma_h = 1,
1339  .comp = {
1340  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1341  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1342  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1343  },
1344  .flags = AV_PIX_FMT_FLAG_PLANAR,
1345  },
1347  .name = "yuv420p16be",
1348  .nb_components = 3,
1349  .log2_chroma_w = 1,
1350  .log2_chroma_h = 1,
1351  .comp = {
1352  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1353  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1354  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1355  },
1357  },
1358  [AV_PIX_FMT_YUV422P9LE] = {
1359  .name = "yuv422p9le",
1360  .nb_components = 3,
1361  .log2_chroma_w = 1,
1362  .log2_chroma_h = 0,
1363  .comp = {
1364  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1365  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1366  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1367  },
1368  .flags = AV_PIX_FMT_FLAG_PLANAR,
1369  },
1370  [AV_PIX_FMT_YUV422P9BE] = {
1371  .name = "yuv422p9be",
1372  .nb_components = 3,
1373  .log2_chroma_w = 1,
1374  .log2_chroma_h = 0,
1375  .comp = {
1376  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1377  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1378  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1379  },
1381  },
1383  .name = "yuv422p10le",
1384  .nb_components = 3,
1385  .log2_chroma_w = 1,
1386  .log2_chroma_h = 0,
1387  .comp = {
1388  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1389  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1390  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1391  },
1392  .flags = AV_PIX_FMT_FLAG_PLANAR,
1393  },
1395  .name = "yuv422p10be",
1396  .nb_components = 3,
1397  .log2_chroma_w = 1,
1398  .log2_chroma_h = 0,
1399  .comp = {
1400  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1401  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1402  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1403  },
1405  },
1407  .name = "yuv422p12le",
1408  .nb_components = 3,
1409  .log2_chroma_w = 1,
1410  .log2_chroma_h = 0,
1411  .comp = {
1412  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1413  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1414  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1415  },
1416  .flags = AV_PIX_FMT_FLAG_PLANAR,
1417  },
1419  .name = "yuv422p12be",
1420  .nb_components = 3,
1421  .log2_chroma_w = 1,
1422  .log2_chroma_h = 0,
1423  .comp = {
1424  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1425  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1426  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1427  },
1429  },
1431  .name = "yuv422p14le",
1432  .nb_components = 3,
1433  .log2_chroma_w = 1,
1434  .log2_chroma_h = 0,
1435  .comp = {
1436  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1437  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1438  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1439  },
1440  .flags = AV_PIX_FMT_FLAG_PLANAR,
1441  },
1443  .name = "yuv422p14be",
1444  .nb_components = 3,
1445  .log2_chroma_w = 1,
1446  .log2_chroma_h = 0,
1447  .comp = {
1448  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1449  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1450  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1451  },
1453  },
1455  .name = "yuv422p16le",
1456  .nb_components = 3,
1457  .log2_chroma_w = 1,
1458  .log2_chroma_h = 0,
1459  .comp = {
1460  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1461  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1462  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1463  },
1464  .flags = AV_PIX_FMT_FLAG_PLANAR,
1465  },
1467  .name = "yuv422p16be",
1468  .nb_components = 3,
1469  .log2_chroma_w = 1,
1470  .log2_chroma_h = 0,
1471  .comp = {
1472  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1473  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1474  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1475  },
1477  },
1479  .name = "yuv444p16le",
1480  .nb_components = 3,
1481  .log2_chroma_w = 0,
1482  .log2_chroma_h = 0,
1483  .comp = {
1484  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1485  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1486  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1487  },
1488  .flags = AV_PIX_FMT_FLAG_PLANAR,
1489  },
1491  .name = "yuv444p16be",
1492  .nb_components = 3,
1493  .log2_chroma_w = 0,
1494  .log2_chroma_h = 0,
1495  .comp = {
1496  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
1497  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
1498  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
1499  },
1501  },
1503  .name = "yuv444p10le",
1504  .nb_components = 3,
1505  .log2_chroma_w = 0,
1506  .log2_chroma_h = 0,
1507  .comp = {
1508  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1509  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1510  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1511  },
1512  .flags = AV_PIX_FMT_FLAG_PLANAR,
1513  },
1515  .name = "yuv444p10be",
1516  .nb_components = 3,
1517  .log2_chroma_w = 0,
1518  .log2_chroma_h = 0,
1519  .comp = {
1520  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1521  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
1522  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
1523  },
1525  },
1526  [AV_PIX_FMT_YUV444P9LE] = {
1527  .name = "yuv444p9le",
1528  .nb_components = 3,
1529  .log2_chroma_w = 0,
1530  .log2_chroma_h = 0,
1531  .comp = {
1532  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1533  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1534  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1535  },
1536  .flags = AV_PIX_FMT_FLAG_PLANAR,
1537  },
1538  [AV_PIX_FMT_YUV444P9BE] = {
1539  .name = "yuv444p9be",
1540  .nb_components = 3,
1541  .log2_chroma_w = 0,
1542  .log2_chroma_h = 0,
1543  .comp = {
1544  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
1545  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
1546  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
1547  },
1549  },
1551  .name = "yuv444p12le",
1552  .nb_components = 3,
1553  .log2_chroma_w = 0,
1554  .log2_chroma_h = 0,
1555  .comp = {
1556  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1557  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1558  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1559  },
1560  .flags = AV_PIX_FMT_FLAG_PLANAR,
1561  },
1563  .name = "yuv444p12be",
1564  .nb_components = 3,
1565  .log2_chroma_w = 0,
1566  .log2_chroma_h = 0,
1567  .comp = {
1568  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
1569  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
1570  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
1571  },
1573  },
1575  .name = "yuv444p14le",
1576  .nb_components = 3,
1577  .log2_chroma_w = 0,
1578  .log2_chroma_h = 0,
1579  .comp = {
1580  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1581  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1582  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1583  },
1584  .flags = AV_PIX_FMT_FLAG_PLANAR,
1585  },
1587  .name = "yuv444p14be",
1588  .nb_components = 3,
1589  .log2_chroma_w = 0,
1590  .log2_chroma_h = 0,
1591  .comp = {
1592  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
1593  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
1594  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
1595  },
1597  },
1599  .name = "d3d11va_vld",
1600  .log2_chroma_w = 1,
1601  .log2_chroma_h = 1,
1602  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1603  },
1604  [AV_PIX_FMT_DXVA2_VLD] = {
1605  .name = "dxva2_vld",
1606  .log2_chroma_w = 1,
1607  .log2_chroma_h = 1,
1608  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1609  },
1610  [AV_PIX_FMT_VDA_VLD] = {
1611  .name = "vda_vld",
1612  .log2_chroma_w = 1,
1613  .log2_chroma_h = 1,
1614  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1615  },
1616  [AV_PIX_FMT_YA8] = {
1617  .name = "ya8",
1618  .nb_components = 2,
1619  .comp = {
1620  { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
1621  { 0, 2, 1, 0, 8, 1, 7, 2 }, /* A */
1622  },
1623  .flags = AV_PIX_FMT_FLAG_ALPHA,
1624  .alias = "gray8a",
1625  },
1626  [AV_PIX_FMT_YA16LE] = {
1627  .name = "ya16le",
1628  .nb_components = 2,
1629  .comp = {
1630  { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1631  { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1632  },
1633  .flags = AV_PIX_FMT_FLAG_ALPHA,
1634  },
1635  [AV_PIX_FMT_YA16BE] = {
1636  .name = "ya16be",
1637  .nb_components = 2,
1638  .comp = {
1639  { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
1640  { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
1641  },
1643  },
1645  .name = "videotoolbox_vld",
1646  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1647  },
1648  [AV_PIX_FMT_GBRP] = {
1649  .name = "gbrp",
1650  .nb_components = 3,
1651  .log2_chroma_w = 0,
1652  .log2_chroma_h = 0,
1653  .comp = {
1654  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1655  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1656  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1657  },
1659  },
1660  [AV_PIX_FMT_GBRP9LE] = {
1661  .name = "gbrp9le",
1662  .nb_components = 3,
1663  .log2_chroma_w = 0,
1664  .log2_chroma_h = 0,
1665  .comp = {
1666  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1667  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1668  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1669  },
1671  },
1672  [AV_PIX_FMT_GBRP9BE] = {
1673  .name = "gbrp9be",
1674  .nb_components = 3,
1675  .log2_chroma_w = 0,
1676  .log2_chroma_h = 0,
1677  .comp = {
1678  { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
1679  { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
1680  { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
1681  },
1683  },
1684  [AV_PIX_FMT_GBRP10LE] = {
1685  .name = "gbrp10le",
1686  .nb_components = 3,
1687  .log2_chroma_w = 0,
1688  .log2_chroma_h = 0,
1689  .comp = {
1690  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1691  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1692  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1693  },
1695  },
1696  [AV_PIX_FMT_GBRP10BE] = {
1697  .name = "gbrp10be",
1698  .nb_components = 3,
1699  .log2_chroma_w = 0,
1700  .log2_chroma_h = 0,
1701  .comp = {
1702  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
1703  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
1704  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
1705  },
1707  },
1708  [AV_PIX_FMT_GBRP12LE] = {
1709  .name = "gbrp12le",
1710  .nb_components = 3,
1711  .log2_chroma_w = 0,
1712  .log2_chroma_h = 0,
1713  .comp = {
1714  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1715  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1716  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1717  },
1719  },
1720  [AV_PIX_FMT_GBRP12BE] = {
1721  .name = "gbrp12be",
1722  .nb_components = 3,
1723  .log2_chroma_w = 0,
1724  .log2_chroma_h = 0,
1725  .comp = {
1726  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
1727  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
1728  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
1729  },
1731  },
1732  [AV_PIX_FMT_GBRP14LE] = {
1733  .name = "gbrp14le",
1734  .nb_components = 3,
1735  .log2_chroma_w = 0,
1736  .log2_chroma_h = 0,
1737  .comp = {
1738  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1739  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1740  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1741  },
1743  },
1744  [AV_PIX_FMT_GBRP14BE] = {
1745  .name = "gbrp14be",
1746  .nb_components = 3,
1747  .log2_chroma_w = 0,
1748  .log2_chroma_h = 0,
1749  .comp = {
1750  { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
1751  { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
1752  { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
1753  },
1755  },
1756  [AV_PIX_FMT_GBRP16LE] = {
1757  .name = "gbrp16le",
1758  .nb_components = 3,
1759  .log2_chroma_w = 0,
1760  .log2_chroma_h = 0,
1761  .comp = {
1762  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1763  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1764  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1765  },
1767  },
1768  [AV_PIX_FMT_GBRP16BE] = {
1769  .name = "gbrp16be",
1770  .nb_components = 3,
1771  .log2_chroma_w = 0,
1772  .log2_chroma_h = 0,
1773  .comp = {
1774  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1775  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1776  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1777  },
1779  },
1780  [AV_PIX_FMT_GBRAP] = {
1781  .name = "gbrap",
1782  .nb_components = 4,
1783  .log2_chroma_w = 0,
1784  .log2_chroma_h = 0,
1785  .comp = {
1786  { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
1787  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
1788  { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
1789  { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
1790  },
1793  },
1794  [AV_PIX_FMT_GBRAP16LE] = {
1795  .name = "gbrap16le",
1796  .nb_components = 4,
1797  .log2_chroma_w = 0,
1798  .log2_chroma_h = 0,
1799  .comp = {
1800  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1801  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1802  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1803  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1804  },
1807  },
1808  [AV_PIX_FMT_GBRAP16BE] = {
1809  .name = "gbrap16be",
1810  .nb_components = 4,
1811  .log2_chroma_w = 0,
1812  .log2_chroma_h = 0,
1813  .comp = {
1814  { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
1815  { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
1816  { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
1817  { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
1818  },
1821  },
1822  [AV_PIX_FMT_VDPAU] = {
1823  .name = "vdpau",
1824  .log2_chroma_w = 1,
1825  .log2_chroma_h = 1,
1826  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1827  },
1828  [AV_PIX_FMT_XYZ12LE] = {
1829  .name = "xyz12le",
1830  .nb_components = 3,
1831  .log2_chroma_w = 0,
1832  .log2_chroma_h = 0,
1833  .comp = {
1834  { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1835  { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1836  { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1837  },
1838  /*.flags = -- not used*/
1839  },
1840  [AV_PIX_FMT_XYZ12BE] = {
1841  .name = "xyz12be",
1842  .nb_components = 3,
1843  .log2_chroma_w = 0,
1844  .log2_chroma_h = 0,
1845  .comp = {
1846  { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
1847  { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
1848  { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
1849  },
1850  .flags = AV_PIX_FMT_FLAG_BE,
1851  },
1852 
1853 #define BAYER8_DESC_COMMON \
1854  .nb_components= 3, \
1855  .log2_chroma_w= 0, \
1856  .log2_chroma_h= 0, \
1857  .comp = { \
1858  {0,1,0,0,2,0,1,1},\
1859  {0,1,0,0,4,0,3,1},\
1860  {0,1,0,0,2,0,1,1},\
1861  }, \
1862 
1863 #define BAYER16_DESC_COMMON \
1864  .nb_components= 3, \
1865  .log2_chroma_w= 0, \
1866  .log2_chroma_h= 0, \
1867  .comp = { \
1868  {0,2,0,0,4,1,3,1},\
1869  {0,2,0,0,8,1,7,1},\
1870  {0,2,0,0,4,1,3,1},\
1871  }, \
1872 
1874  .name = "bayer_bggr8",
1876  .flags = AV_PIX_FMT_FLAG_RGB,
1877  },
1879  .name = "bayer_bggr16le",
1881  .flags = AV_PIX_FMT_FLAG_RGB,
1882  },
1884  .name = "bayer_bggr16be",
1887  },
1889  .name = "bayer_rggb8",
1891  .flags = AV_PIX_FMT_FLAG_RGB,
1892  },
1894  .name = "bayer_rggb16le",
1896  .flags = AV_PIX_FMT_FLAG_RGB,
1897  },
1899  .name = "bayer_rggb16be",
1902  },
1904  .name = "bayer_gbrg8",
1906  .flags = AV_PIX_FMT_FLAG_RGB,
1907  },
1909  .name = "bayer_gbrg16le",
1911  .flags = AV_PIX_FMT_FLAG_RGB,
1912  },
1914  .name = "bayer_gbrg16be",
1917  },
1919  .name = "bayer_grbg8",
1921  .flags = AV_PIX_FMT_FLAG_RGB,
1922  },
1924  .name = "bayer_grbg16le",
1926  .flags = AV_PIX_FMT_FLAG_RGB,
1927  },
1929  .name = "bayer_grbg16be",
1932  },
1933  [AV_PIX_FMT_NV16] = {
1934  .name = "nv16",
1935  .nb_components = 3,
1936  .log2_chroma_w = 1,
1937  .log2_chroma_h = 0,
1938  .comp = {
1939  { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
1940  { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
1941  { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
1942  },
1943  .flags = AV_PIX_FMT_FLAG_PLANAR,
1944  },
1945  [AV_PIX_FMT_NV20LE] = {
1946  .name = "nv20le",
1947  .nb_components = 3,
1948  .log2_chroma_w = 1,
1949  .log2_chroma_h = 0,
1950  .comp = {
1951  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1952  { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
1953  { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
1954  },
1955  .flags = AV_PIX_FMT_FLAG_PLANAR,
1956  },
1957  [AV_PIX_FMT_NV20BE] = {
1958  .name = "nv20be",
1959  .nb_components = 3,
1960  .log2_chroma_w = 1,
1961  .log2_chroma_h = 0,
1962  .comp = {
1963  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
1964  { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
1965  { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
1966  },
1968  },
1969  [AV_PIX_FMT_VDA] = {
1970  .name = "vda",
1971  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1972  },
1973  [AV_PIX_FMT_QSV] = {
1974  .name = "qsv",
1975  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1976  },
1977  [AV_PIX_FMT_MEDIACODEC] = {
1978  .name = "mediacodec",
1979  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1980  },
1981  [AV_PIX_FMT_MMAL] = {
1982  .name = "mmal",
1983  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1984  },
1985  [AV_PIX_FMT_CUDA] = {
1986  .name = "cuda",
1987  .flags = AV_PIX_FMT_FLAG_HWACCEL,
1988  },
1989  [AV_PIX_FMT_AYUV64LE] = {
1990  .name = "ayuv64le",
1991  .nb_components = 4,
1992  .log2_chroma_w = 0,
1993  .log2_chroma_h = 0,
1994  .comp = {
1995  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
1996  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
1997  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
1998  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
1999  },
2000  .flags = AV_PIX_FMT_FLAG_ALPHA,
2001  },
2002  [AV_PIX_FMT_AYUV64BE] = {
2003  .name = "ayuv64be",
2004  .nb_components = 4,
2005  .log2_chroma_w = 0,
2006  .log2_chroma_h = 0,
2007  .comp = {
2008  { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
2009  { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
2010  { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
2011  { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
2012  },
2014  },
2015  [AV_PIX_FMT_P010LE] = {
2016  .name = "p010le",
2017  .nb_components = 3,
2018  .log2_chroma_w = 1,
2019  .log2_chroma_h = 1,
2020  .comp = {
2021  { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2022  { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2023  { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2024  },
2025  .flags = AV_PIX_FMT_FLAG_PLANAR,
2026  },
2027  [AV_PIX_FMT_P010BE] = {
2028  .name = "p010be",
2029  .nb_components = 3,
2030  .log2_chroma_w = 1,
2031  .log2_chroma_h = 1,
2032  .comp = {
2033  { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
2034  { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
2035  { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
2036  },
2038  },
2039  [AV_PIX_FMT_GBRAP12LE] = {
2040  .name = "gbrap12le",
2041  .nb_components = 4,
2042  .log2_chroma_w = 0,
2043  .log2_chroma_h = 0,
2044  .comp = {
2045  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2046  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2047  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2048  { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2049  },
2052  },
2053  [AV_PIX_FMT_GBRAP12BE] = {
2054  .name = "gbrap12be",
2055  .nb_components = 4,
2056  .log2_chroma_w = 0,
2057  .log2_chroma_h = 0,
2058  .comp = {
2059  { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
2060  { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
2061  { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
2062  { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
2063  },
2066  },
2067  [AV_PIX_FMT_GBRAP10LE] = {
2068  .name = "gbrap10le",
2069  .nb_components = 4,
2070  .log2_chroma_w = 0,
2071  .log2_chroma_h = 0,
2072  .comp = {
2073  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2074  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2075  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2076  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2077  },
2080  },
2081  [AV_PIX_FMT_GBRAP10BE] = {
2082  .name = "gbrap10be",
2083  .nb_components = 4,
2084  .log2_chroma_w = 0,
2085  .log2_chroma_h = 0,
2086  .comp = {
2087  { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
2088  { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
2089  { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
2090  { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
2091  },
2094  },
2095 };
2096 #if FF_API_PLUS1_MINUS1
2098 #endif
2099 
2100 static const char *color_range_names[] = {
2101  [AVCOL_RANGE_UNSPECIFIED] = "unknown",
2102  [AVCOL_RANGE_MPEG] = "tv",
2103  [AVCOL_RANGE_JPEG] = "pc",
2104 };
2105 
2106 static const char *color_primaries_names[AVCOL_PRI_NB] = {
2107  [AVCOL_PRI_RESERVED0] = "reserved",
2108  [AVCOL_PRI_BT709] = "bt709",
2109  [AVCOL_PRI_UNSPECIFIED] = "unknown",
2110  [AVCOL_PRI_RESERVED] = "reserved",
2111  [AVCOL_PRI_BT470M] = "bt470m",
2112  [AVCOL_PRI_BT470BG] = "bt470bg",
2113  [AVCOL_PRI_SMPTE170M] = "smpte170m",
2114  [AVCOL_PRI_SMPTE240M] = "smpte240m",
2115  [AVCOL_PRI_FILM] = "film",
2116  [AVCOL_PRI_BT2020] = "bt2020",
2117  [AVCOL_PRI_SMPTEST428_1] = "smpte428-1",
2118  [AVCOL_PRI_SMPTE431] = "smpte431",
2119  [AVCOL_PRI_SMPTE432] = "smpte432",
2120 };
2121 
2122 static const char *color_transfer_names[] = {
2123  [AVCOL_TRC_RESERVED0] = "reserved",
2124  [AVCOL_TRC_BT709] = "bt709",
2125  [AVCOL_TRC_UNSPECIFIED] = "unknown",
2126  [AVCOL_TRC_RESERVED] = "reserved",
2127  [AVCOL_TRC_GAMMA22] = "bt470m",
2128  [AVCOL_TRC_GAMMA28] = "bt470bg",
2129  [AVCOL_TRC_SMPTE170M] = "smpte170m",
2130  [AVCOL_TRC_SMPTE240M] = "smpte240m",
2131  [AVCOL_TRC_LINEAR] = "linear",
2132  [AVCOL_TRC_LOG] = "log100",
2133  [AVCOL_TRC_LOG_SQRT] = "log316",
2134  [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
2135  [AVCOL_TRC_BT1361_ECG] = "bt1361e",
2136  [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
2137  [AVCOL_TRC_BT2020_10] = "bt2020-10",
2138  [AVCOL_TRC_BT2020_12] = "bt2020-20",
2139  [AVCOL_TRC_SMPTEST2084] = "smpte2084",
2140  [AVCOL_TRC_SMPTEST428_1] = "smpte428-1",
2141  [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
2142 };
2143 
2144 static const char *color_space_names[] = {
2145  [AVCOL_SPC_RGB] = "gbr",
2146  [AVCOL_SPC_BT709] = "bt709",
2147  [AVCOL_SPC_UNSPECIFIED] = "unknown",
2148  [AVCOL_SPC_RESERVED] = "reserved",
2149  [AVCOL_SPC_FCC] = "fcc",
2150  [AVCOL_SPC_BT470BG] = "bt470bg",
2151  [AVCOL_SPC_SMPTE170M] = "smpte170m",
2152  [AVCOL_SPC_SMPTE240M] = "smpte240m",
2153  [AVCOL_SPC_YCOCG] = "ycgco",
2154  [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
2155  [AVCOL_SPC_BT2020_CL] = "bt2020c",
2156  [AVCOL_SPC_SMPTE2085] = "smpte2085",
2157 };
2158 
2159 static const char *chroma_location_names[] = {
2160  [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
2161  [AVCHROMA_LOC_LEFT] = "left",
2162  [AVCHROMA_LOC_CENTER] = "center",
2163  [AVCHROMA_LOC_TOPLEFT] = "topleft",
2164  [AVCHROMA_LOC_TOP] = "top",
2165  [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
2166  [AVCHROMA_LOC_BOTTOM] = "bottom",
2167 };
2168 
2169 static enum AVPixelFormat get_pix_fmt_internal(const char *name)
2170 {
2171  enum AVPixelFormat pix_fmt;
2172 
2173  for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
2174  if (av_pix_fmt_descriptors[pix_fmt].name &&
2175  (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
2176  av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
2177  return pix_fmt;
2178 
2179  return AV_PIX_FMT_NONE;
2180 }
2181 
2183 {
2184  return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
2185  av_pix_fmt_descriptors[pix_fmt].name : NULL;
2186 }
2187 
2188 #if HAVE_BIGENDIAN
2189 # define X_NE(be, le) be
2190 #else
2191 # define X_NE(be, le) le
2192 #endif
2193 
2195 {
2196  enum AVPixelFormat pix_fmt;
2197 
2198  if (!strcmp(name, "rgb32"))
2199  name = X_NE("argb", "bgra");
2200  else if (!strcmp(name, "bgr32"))
2201  name = X_NE("abgr", "rgba");
2202 
2203  pix_fmt = get_pix_fmt_internal(name);
2204  if (pix_fmt == AV_PIX_FMT_NONE) {
2205  char name2[32];
2206 
2207  snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
2208  pix_fmt = get_pix_fmt_internal(name2);
2209  }
2210 
2211 #if FF_API_VAAPI
2212  if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
2213  pix_fmt = AV_PIX_FMT_VAAPI;
2214 #endif
2215  return pix_fmt;
2216 }
2217 
2219 {
2220  int c, bits = 0;
2221  int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2222 
2223  for (c = 0; c < pixdesc->nb_components; c++) {
2224  int s = c == 1 || c == 2 ? 0 : log2_pixels;
2225  bits += pixdesc->comp[c].depth << s;
2226  }
2227 
2228  return bits >> log2_pixels;
2229 }
2230 
2232 {
2233  int c, bits = 0;
2234  int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
2235  int steps[4] = {0};
2236 
2237  for (c = 0; c < pixdesc->nb_components; c++) {
2238  const AVComponentDescriptor *comp = &pixdesc->comp[c];
2239  int s = c == 1 || c == 2 ? 0 : log2_pixels;
2240  steps[comp->plane] = comp->step << s;
2241  }
2242  for (c = 0; c < 4; c++)
2243  bits += steps[c];
2244 
2245  if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
2246  bits *= 8;
2247 
2248  return bits >> log2_pixels;
2249 }
2250 
2251 char *av_get_pix_fmt_string(char *buf, int buf_size,
2252  enum AVPixelFormat pix_fmt)
2253 {
2254  /* print header */
2255  if (pix_fmt < 0) {
2256  snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
2257  } else {
2258  const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
2259  snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
2260  pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
2261  }
2262 
2263  return buf;
2264 }
2265 
2267 {
2268  if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
2269  return NULL;
2270  return &av_pix_fmt_descriptors[pix_fmt];
2271 }
2272 
2274 {
2275  if (!prev)
2276  return &av_pix_fmt_descriptors[0];
2277  while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
2278  prev++;
2279  if (prev->name)
2280  return prev;
2281  }
2282  return NULL;
2283 }
2284 
2286 {
2287  if (desc < av_pix_fmt_descriptors ||
2288  desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
2289  return AV_PIX_FMT_NONE;
2290 
2291  return desc - av_pix_fmt_descriptors;
2292 }
2293 
2295  int *h_shift, int *v_shift)
2296 {
2297  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2298  if (!desc)
2299  return AVERROR(ENOSYS);
2300  *h_shift = desc->log2_chroma_w;
2301  *v_shift = desc->log2_chroma_h;
2302 
2303  return 0;
2304 }
2305 
2307 {
2308  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2309  int i, planes[4] = { 0 }, ret = 0;
2310 
2311  if (!desc)
2312  return AVERROR(EINVAL);
2313 
2314  for (i = 0; i < desc->nb_components; i++)
2315  planes[desc->comp[i].plane] = 1;
2316  for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
2317  ret += planes[i];
2318  return ret;
2319 }
2320 
2322  int i, j;
2323 
2324  for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
2325  const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
2326  uint8_t fill[4][8+6+3] = {{0}};
2327  uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
2328  int linesize[4] = {0,0,0,0};
2329  uint16_t tmp[2];
2330 
2331  if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
2332  continue;
2333 // av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
2334  av_assert0(d->log2_chroma_w <= 3);
2335  av_assert0(d->log2_chroma_h <= 3);
2336  av_assert0(d->nb_components <= 4);
2337  av_assert0(d->name && d->name[0]);
2338  av_assert0((d->nb_components==4 || d->nb_components==2) == !!(d->flags & AV_PIX_FMT_FLAG_ALPHA));
2339  av_assert2(av_get_pix_fmt(d->name) == i);
2340 
2341  for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
2342  const AVComponentDescriptor *c = &d->comp[j];
2343  if(j>=d->nb_components) {
2344  av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
2345  continue;
2346  }
2347  if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
2348  av_assert0(c->step >= c->depth);
2349  } else {
2350  av_assert0(8*c->step >= c->depth);
2351  }
2352  if (!strncmp(d->name, "bayer_", 6))
2353  continue;
2354  av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
2355  av_assert0(tmp[0] == 0 && tmp[1] == 0);
2356  tmp[0] = tmp[1] = (1<<c->depth) - 1;
2357  av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
2358  }
2359  }
2360 }
2361 
2362 
2364 {
2365  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2366  char name[16];
2367  int i;
2368 
2369  if (!desc || strlen(desc->name) < 2)
2370  return AV_PIX_FMT_NONE;
2371  av_strlcpy(name, desc->name, sizeof(name));
2372  i = strlen(name) - 2;
2373  if (strcmp(name + i, "be") && strcmp(name + i, "le"))
2374  return AV_PIX_FMT_NONE;
2375 
2376  name[i] ^= 'b' ^ 'l';
2377 
2378  return get_pix_fmt_internal(name);
2379 }
2380 
2381 #define FF_COLOR_NA -1
2382 #define FF_COLOR_RGB 0 /**< RGB color space */
2383 #define FF_COLOR_GRAY 1 /**< gray color space */
2384 #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
2385 #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
2386 #define FF_COLOR_XYZ 4
2387 
2388 #define pixdesc_has_alpha(pixdesc) \
2389  ((pixdesc)->nb_components == 2 || (pixdesc)->nb_components == 4 || (pixdesc)->flags & AV_PIX_FMT_FLAG_PAL)
2390 
2391 
2393  if (desc->flags & AV_PIX_FMT_FLAG_PAL)
2394  return FF_COLOR_RGB;
2395 
2396  if(desc->nb_components == 1 || desc->nb_components == 2)
2397  return FF_COLOR_GRAY;
2398 
2399  if(desc->name && !strncmp(desc->name, "yuvj", 4))
2400  return FF_COLOR_YUV_JPEG;
2401 
2402  if(desc->name && !strncmp(desc->name, "xyz", 3))
2403  return FF_COLOR_XYZ;
2404 
2405  if(desc->flags & AV_PIX_FMT_FLAG_RGB)
2406  return FF_COLOR_RGB;
2407 
2408  if(desc->nb_components == 0)
2409  return FF_COLOR_NA;
2410 
2411  return FF_COLOR_YUV;
2412 }
2413 
2414 static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
2415 {
2416  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
2417  int i;
2418 
2419  if (!desc || !desc->nb_components) {
2420  *min = *max = 0;
2421  return AVERROR(EINVAL);
2422  }
2423 
2424  *min = INT_MAX, *max = -INT_MAX;
2425  for (i = 0; i < desc->nb_components; i++) {
2426  *min = FFMIN(desc->comp[i].depth, *min);
2427  *max = FFMAX(desc->comp[i].depth, *max);
2428  }
2429  return 0;
2430 }
2431 
2432 static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
2433  enum AVPixelFormat src_pix_fmt,
2434  unsigned *lossp, unsigned consider)
2435 {
2436  const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
2437  const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
2438  int src_color, dst_color;
2439  int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
2440  int ret, loss, i, nb_components;
2441  int score = INT_MAX - 1;
2442 
2443  if (dst_pix_fmt >= AV_PIX_FMT_NB || dst_pix_fmt <= AV_PIX_FMT_NONE)
2444  return ~0;
2445 
2446  /* compute loss */
2447  *lossp = loss = 0;
2448 
2449  if (dst_pix_fmt == src_pix_fmt)
2450  return INT_MAX;
2451 
2452  if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
2453  return ret;
2454  if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
2455  return ret;
2456 
2457  src_color = get_color_type(src_desc);
2458  dst_color = get_color_type(dst_desc);
2459  if (dst_pix_fmt == AV_PIX_FMT_PAL8)
2460  nb_components = FFMIN(src_desc->nb_components, 4);
2461  else
2462  nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
2463 
2464  for (i = 0; i < nb_components; i++) {
2465  int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
2466  if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
2467  loss |= FF_LOSS_DEPTH;
2468  score -= 65536 >> depth_minus1;
2469  }
2470  }
2471 
2472  if (consider & FF_LOSS_RESOLUTION) {
2473  if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
2474  loss |= FF_LOSS_RESOLUTION;
2475  score -= 256 << dst_desc->log2_chroma_w;
2476  }
2477  if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
2478  loss |= FF_LOSS_RESOLUTION;
2479  score -= 256 << dst_desc->log2_chroma_h;
2480  }
2481  // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
2482  if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
2483  dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
2484  score += 512;
2485  }
2486  }
2487 
2488  if(consider & FF_LOSS_COLORSPACE)
2489  switch(dst_color) {
2490  case FF_COLOR_RGB:
2491  if (src_color != FF_COLOR_RGB &&
2492  src_color != FF_COLOR_GRAY)
2493  loss |= FF_LOSS_COLORSPACE;
2494  break;
2495  case FF_COLOR_GRAY:
2496  if (src_color != FF_COLOR_GRAY)
2497  loss |= FF_LOSS_COLORSPACE;
2498  break;
2499  case FF_COLOR_YUV:
2500  if (src_color != FF_COLOR_YUV)
2501  loss |= FF_LOSS_COLORSPACE;
2502  break;
2503  case FF_COLOR_YUV_JPEG:
2504  if (src_color != FF_COLOR_YUV_JPEG &&
2505  src_color != FF_COLOR_YUV &&
2506  src_color != FF_COLOR_GRAY)
2507  loss |= FF_LOSS_COLORSPACE;
2508  break;
2509  default:
2510  /* fail safe test */
2511  if (src_color != dst_color)
2512  loss |= FF_LOSS_COLORSPACE;
2513  break;
2514  }
2515  if(loss & FF_LOSS_COLORSPACE)
2516  score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
2517 
2518  if (dst_color == FF_COLOR_GRAY &&
2519  src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
2520  loss |= FF_LOSS_CHROMA;
2521  score -= 2 * 65536;
2522  }
2523  if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
2524  loss |= FF_LOSS_ALPHA;
2525  score -= 65536;
2526  }
2527  if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
2528  (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
2529  loss |= FF_LOSS_COLORQUANT;
2530  score -= 65536;
2531  }
2532 
2533  *lossp = loss;
2534  return score;
2535 }
2536 
2537 int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
2538  enum AVPixelFormat src_pix_fmt,
2539  int has_alpha)
2540 {
2541  int loss;
2542  int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
2543  if (ret < 0)
2544  return ret;
2545  return loss;
2546 }
2547 
2548 enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
2549  enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
2550 {
2551  enum AVPixelFormat dst_pix_fmt;
2552  int loss1, loss2, loss_mask;
2553  const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
2554  const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
2555  int score1, score2;
2556 
2557  loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
2558  if(!has_alpha)
2559  loss_mask &= ~FF_LOSS_ALPHA;
2560 
2561  score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
2562  score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
2563 
2564  if (score1 == score2) {
2566  dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
2567  } else {
2568  dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
2569  }
2570  } else {
2571  dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
2572  }
2573 
2574  if (loss_ptr)
2575  *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
2576  return dst_pix_fmt;
2577 }
2578 
2579 const char *av_color_range_name(enum AVColorRange range)
2580 {
2581  return (unsigned) range < AVCOL_RANGE_NB ?
2582  color_range_names[range] : NULL;
2583 }
2584 
2585 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
2586 {
2587  return (unsigned) primaries < AVCOL_PRI_NB ?
2588  color_primaries_names[primaries] : NULL;
2589 }
2590 
2592 {
2593  return (unsigned) transfer < AVCOL_TRC_NB ?
2594  color_transfer_names[transfer] : NULL;
2595 }
2596 
2597 const char *av_color_space_name(enum AVColorSpace space)
2598 {
2599  return (unsigned) space < AVCOL_SPC_NB ?
2600  color_space_names[space] : NULL;
2601 }
2602 
2603 const char *av_chroma_location_name(enum AVChromaLocation location)
2604 {
2605  return (unsigned) location < AVCHROMA_LOC_NB ?
2606  chroma_location_names[location] : NULL;
2607 }
#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:426
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
Definition: pixfmt.h:438
int plane
Definition: avisynth_c.h:422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:82
planar GBR 4:4:4:4 40bpp, little-endian
Definition: pixfmt.h:305
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:126
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:177
const char const char void * val
Definition: avisynth_c.h:771
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:289
const char * s
Definition: avisynth_c.h:768
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:266
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:259
IEC 61966-2-4.
Definition: pixfmt.h:422
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2266
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
Definition: pixfmt.h:481
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
"Linear transfer characteristics"
Definition: pixfmt.h:419
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:263
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:170
SMPTE ST 428-1.
Definition: pixfmt.h:428
8 bits gray, 8 bits alpha
Definition: pixfmt.h:154
SMPTE ST 428-1 (CIE 1931 XYZ)
Definition: pixfmt.h:401
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:220
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:67
MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstr...
Definition: pixfmt.h:106
#define FF_LOSS_ALPHA
loss of alpha bits
Definition: pixdesc.h:347
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2306
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:64
packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in ...
Definition: pixfmt.h:85
const char * desc
Definition: nvenc.c:101
hardware decoding through Videotoolbox
Definition: pixfmt.h:296
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:173
#define FF_LOSS_CHROMA
loss of chroma (e.g.
Definition: pixdesc.h:349
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:2218
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
Definition: pixfmt.h:442
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:2251
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:264
bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
Definition: pixfmt.h:276
SMPTE ST 432-1 D65 (2010)
Definition: pixfmt.h:403
bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
Definition: pixfmt.h:277
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:180
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:219
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:116
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
Definition: pixfmt.h:284
HW decoding through VA API, Picture.data[3] contains a VASurfaceID.
Definition: pixfmt.h:128
static const char * color_primaries_names[AVCOL_PRI_NB]
Definition: pixdesc.c:2106
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:201
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition: pixfmt.h:443
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
Definition: pixfmt.h:119
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:269
SMPTE ST 431-2 (2011)
Definition: pixfmt.h:402
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
Definition: pixfmt.h:167
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
Definition: pixfmt.h:151
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition: pixfmt.h:253
bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
Definition: pixfmt.h:274
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:87
enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
Utility function to swap the endianness of a pixel format.
Definition: pixdesc.c:2363
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:268
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:139
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:87
Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16.
Definition: pixfmt.h:445
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
Definition: pixfmt.h:437
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:410
packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in ...
Definition: pixfmt.h:88
functionally identical to above
Definition: pixfmt.h:444
const char * av_color_space_name(enum AVColorSpace space)
Definition: pixdesc.c:2597
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition: pixfmt.h:114
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
Definition: pixfmt.h:86
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian ...
Definition: pixfmt.h:191
#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:230
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:202
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:102
uint8_t bits
Definition: crc.c:296
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:173
#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:252
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:73
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:111
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:436
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
Definition: pixfmt.h:282
const char * av_color_range_name(enum AVColorRange range)
Definition: pixdesc.c:2579
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
Definition: pixfmt.h:283
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:217
also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:415
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:150
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:265
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)
Write the values from src to the pixel format component c of an image line.
Definition: pixdesc.c:82
static FF_ENABLE_DEPRECATION_WARNINGS const char * color_range_names[]
Definition: pixdesc.c:2100
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
Definition: pixfmt.h:113
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:95
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:203
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:290
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:186
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
Definition: pixfmt.h:101
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:75
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:206
MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstr...
Definition: pixfmt.h:105
Not part of ABI.
Definition: pixfmt.h:461
WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstrea...
Definition: pixfmt.h:107
AVColorRange
MPEG vs JPEG YUV range.
Definition: pixfmt.h:457
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:292
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:389
#define AV_WB16(p, v)
Definition: intreadwrite.h:405
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */
Definition: pixfmt.h:278
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:168
planar GBR 4:4:4 27bpp, big-endian
Definition: pixfmt.h:182
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:176
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition: pixdesc.c:2603
also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:394
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:188
16 bits gray, 16 bits alpha (big-endian)
Definition: pixfmt.h:226
ITU-R BT1361 Extended Colour Gamut.
Definition: pixfmt.h:423
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
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:144
#define AVERROR(e)
Definition: error.h:43
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition: pixdesc.h:148
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:2294
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:96
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:2231
Not part of ABI.
Definition: pixfmt.h:404
#define FF_LOSS_DEPTH
loss due to color depth change
Definition: pixdesc.h:345
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:194
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:172
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:90
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
Definition: pixfmt.h:391
#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:262
XVideo Motion Acceleration via common packet passing.
Definition: pixfmt.h:78
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:320
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:142
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian
Definition: pixfmt.h:299
Libavutil version macros.
HW acceleration through VDA, data[3] contains a CVPixelBufferRef.
Definition: pixfmt.h:224
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:195
#define FFMAX(a, b)
Definition: common.h:94
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:93
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:160
int depth
Definition: v4l.c:62
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:94
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
Definition: pixdesc.c:2585
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:196
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:66
static const char * color_transfer_names[]
Definition: pixdesc.c:2122
common internal API header
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:106
as above, but U and V bytes are swapped
Definition: pixfmt.h:91
planar GBR 4:4:4:4 48bpp, big-endian
Definition: pixfmt.h:301
enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
Definition: pixdesc.c:2285
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:83
#define BAYER8_DESC_COMMON
planar GBR 4:4:4:4 40bpp, big-endian
Definition: pixfmt.h:304
#define FFMIN(a, b)
Definition: common.h:96
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
Definition: pixfmt.h:89
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:74
colour filters using Illuminant C
Definition: pixfmt.h:399
#define FF_COLOR_YUV_JPEG
YUV color space.
Definition: pixdesc.c:2385
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:446
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
Definition: pixfmt.h:483
#define AV_PIX_FMT_FLAG_PSEUDOPAL
The pixel format is "pseudo-paletted".
Definition: pixdesc.h:158
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:396
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:200
#define FF_COLOR_XYZ
Definition: pixdesc.c:2386
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
Definition: pixfmt.h:222
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition: pixfmt.h:192
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:65
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:257
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:212
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:169
interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian ...
Definition: pixfmt.h:215
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
Definition: pixfmt.h:298
static int get_color_type(const AVPixFmtDescriptor *desc)
Definition: pixdesc.c:2392
#define src
Definition: vp9dsp.c:530
#define pixdesc_has_alpha(pixdesc)
Definition: pixdesc.c:2388
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:178
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:159
HW acceleration through CUDA.
Definition: pixfmt.h:249
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
Definition: pixfmt.h:118
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:441
#define FF_ARRAY_ELEMS(a)
the normal 2^n-1 "JPEG" YUV ranges
Definition: pixfmt.h:460
HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state str...
Definition: pixfmt.h:127
planar GBR 4:4:4:4 48bpp, little-endian
Definition: pixfmt.h:302
also ITU-R BT1361
Definition: pixfmt.h:412
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition: pixfmt.h:84
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:140
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
Definition: pixfmt.h:417
functionally identical to above
Definition: pixfmt.h:398
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:189
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */
Definition: pixfmt.h:281
planar GBR 4:4:4 30bpp, big-endian
Definition: pixfmt.h:184
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
Definition: pixfmt.h:285
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:204
static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, unsigned *lossp, unsigned consider)
Definition: pixdesc.c:2432
#define FF_COLOR_YUV
YUV color space.
Definition: pixdesc.c:2384
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:63
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:291
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:271
void * buf
Definition: avisynth_c.h:690
MPEG-4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstr...
Definition: pixfmt.h:146
static const char * color_space_names[]
Definition: pixdesc.c:2144
H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstre...
Definition: pixfmt.h:104
static FF_DISABLE_DEPRECATION_WARNINGS const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB]
Definition: pixdesc.c:133
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:68
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:205
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:207
Y , 16bpp, big-endian.
Definition: pixfmt.h:98
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
Definition: pixfmt.h:209
static enum AVPixelFormat get_pix_fmt_internal(const char *name)
Definition: pixdesc.c:2169
Not part of ABI.
Definition: pixfmt.h:430
"Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
Definition: pixfmt.h:421
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:258
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:2537
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
Definition: pixfmt.h:236
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:254
planar GBR 4:4:4 42bpp, big-endian
Definition: pixfmt.h:270
static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2414
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
Definition: pixfmt.h:190
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:121
#define snprintf
Definition: snprintf.h:34
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */
Definition: pixfmt.h:279
#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:148
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)
Read a line from an image, and write the values of the pixel format component c to dst...
Definition: pixdesc.c:34
int offset
Number of elements before the component of the first pixel.
Definition: pixdesc.h:47
hardware decoding through MediaCodec
Definition: pixfmt.h:307
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:199
static int flags
Definition: cpu.c:47
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:115
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
Definition: pixfmt.h:280
#define FF_COLOR_RGB
RGB color space.
Definition: pixdesc.c:2382
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
Definition: pixfmt.h:153
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:174
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:143
the normal 219*2^(n-8) "MPEG" YUV ranges
Definition: pixfmt.h:459
ITU-R BT2020 constant luminance system.
Definition: pixfmt.h:447
VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstrea...
Definition: pixfmt.h:108
#define X_NE(be, le)
Definition: pixdesc.c:2191
#define FF_LOSS_COLORSPACE
loss due to color space conversion
Definition: pixdesc.h:346
hardware decoding through VDA
Definition: pixfmt.h:179
static const char * chroma_location_names[]
Definition: pixdesc.c:2159
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb...
Definition: pixfmt.h:72
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:261
Y , 8bpp.
Definition: pixfmt.h:70
IEC 61966-2-1 (sRGB or sYCC)
Definition: pixfmt.h:424
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:80
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:71
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:229
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:183
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition: pixfmt.h:427
static double c[64]
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
Definition: pixdesc.c:2591
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:110
also ITU-R BT470BG
Definition: pixfmt.h:416
#define AV_WL16(p, v)
Definition: intreadwrite.h:412
SMPTE 2085, Y'D'zD'x.
Definition: pixfmt.h:448
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:141
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:76
bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */
Definition: pixfmt.h:275
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
Definition: pixfmt.h:87
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:69
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:213
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:2548
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:197
#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:429
#define FF_LOSS_RESOLUTION
loss due to resolution change
Definition: pixdesc.h:344
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:211
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:294
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:81
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:267
static uint8_t tmp[8]
Definition: des.c:38
Y , 16bpp, little-endian.
Definition: pixfmt.h:99
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:272
Not part of ABI.
Definition: pixfmt.h:487
16 bits gray, 16 bits alpha (little-endian)
Definition: pixfmt.h:227
#define FF_COLOR_NA
Definition: pixdesc.c:2381
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:198
ITU-R BT2020 for 10-bit system.
Definition: pixfmt.h:425
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition: pixfmt.h:397
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:120
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
Definition: pixfmt.h:309
ITU-R BT2020.
Definition: pixfmt.h:400
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
Definition: eamad.c:83
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:100
#define FF_LOSS_COLORQUANT
loss due to color quantization
Definition: pixdesc.h:348
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:479
HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer...
Definition: pixfmt.h:243
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:187
void ff_check_pixfmt_descriptors(void)
Definition: pixdesc.c:2321
MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0.
Definition: pixfmt.h:482
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:152
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
Definition: pixdesc.c:2194
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:2182
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
Definition: pixfmt.h:193
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:214
HW acceleration though MMAL, data[3] contains a pointer to the MMAL_BUFFER_HEADER_T structure...
Definition: pixfmt.h:241
planar GBRA 4:4:4:4 64bpp, little-endian
Definition: pixfmt.h:231
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition: pixfmt.h:251
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
Definition: pixfmt.h:83
float min
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60
#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:256
Not part of ABI.
Definition: pixfmt.h:449
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:175
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:260
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:185
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:218
int step
Number of elements between 2 horizontally consecutive pixels.
Definition: pixdesc.h:41
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:293
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.
Definition: pixdesc.c:2273
const char * name
Definition: opengl_enc.c:103
"Logarithmic transfer characteristic (100:1 range)"
Definition: pixfmt.h:420
#define FF_COLOR_GRAY
gray color space
Definition: pixdesc.c:2383
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:171